Changeset 241982 in webkit


Ignore:
Timestamp:
Feb 22, 2019 8:17:58 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Timelines: add UI for preventing auto-stop
https://bugs.webkit.org/show_bug.cgi?id=194956

Reviewed by Joseph Pecoraro.

Add a checkbox to the navigation area of the Timelines tab that controls whether recordings
automatically stop (e.g. after "load" or a period of inactivity).

  • UserInterface/Views/TimelineRecordingContentView.js:

(WI.TimelineRecordingContentView):
(WI.TimelineRecordingContentView.prototype.get navigationItems):
(WI.TimelineRecordingContentView.prototype._handleAutoStopCheckboxCheckedDidChange): Added.
(WI.TimelineRecordingContentView.prototype._handleTimelinesAutoStopSettingChanged): Added.

  • UserInterface/Controllers/TimelineManager.js:

(WI.TimelineManager):
(WI.TimelineManager.prototype.capturingStopped):
(WI.TimelineManager.prototype._stopAutoRecordingSoon):
(WI.TimelineManager.prototype._resetAutoRecordingMaxTimeTimeout):
(WI.TimelineManager.prototype._resetAutoRecordingDeadTimeTimeout):
(WI.TimelineManager.prototype._handleTimelinesAutoStopSettingChanged):

  • UserInterface/Base/Setting.js:
  • Localizations/en.lproj/localizedStrings.js:
Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r241981 r241982  
     12019-02-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Timelines: add UI for preventing auto-stop
     4        https://bugs.webkit.org/show_bug.cgi?id=194956
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Add a checkbox to the navigation area of the Timelines tab that controls whether recordings
     9        automatically stop (e.g. after "load" or a period of inactivity).
     10
     11        * UserInterface/Views/TimelineRecordingContentView.js:
     12        (WI.TimelineRecordingContentView):
     13        (WI.TimelineRecordingContentView.prototype.get navigationItems):
     14        (WI.TimelineRecordingContentView.prototype._handleAutoStopCheckboxCheckedDidChange): Added.
     15        (WI.TimelineRecordingContentView.prototype._handleTimelinesAutoStopSettingChanged): Added.
     16
     17        * UserInterface/Controllers/TimelineManager.js:
     18        (WI.TimelineManager):
     19        (WI.TimelineManager.prototype.capturingStopped):
     20        (WI.TimelineManager.prototype._stopAutoRecordingSoon):
     21        (WI.TimelineManager.prototype._resetAutoRecordingMaxTimeTimeout):
     22        (WI.TimelineManager.prototype._resetAutoRecordingDeadTimeTimeout):
     23        (WI.TimelineManager.prototype._handleTimelinesAutoStopSettingChanged):
     24
     25        * UserInterface/Base/Setting.js:
     26        * Localizations/en.lproj/localizedStrings.js:
     27
    1282019-02-22  Devin Rousso  <drousso@apple.com>
    229
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r241750 r241982  
    939939localizedStrings["Stop recording (%s)"] = "Stop recording (%s)";
    940940localizedStrings["Stop recording canvas actions"] = "Stop recording canvas actions";
     941localizedStrings["Stop recording once page loads"] = "Stop recording once page loads";
    941942localizedStrings["Stopping the \u201C%s\u201D audit"] = "Stopping the \u201C%s\u201D audit";
    942943localizedStrings["Storage"] = "Storage";
  • trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js

    r241633 r241982  
    151151    showWhitespaceCharacters: new WI.Setting("show-whitespace-characters", false),
    152152    tabSize: new WI.Setting("tab-size", 4),
     153    timelinesAutoStop: new WI.Setting("timelines-auto-stop", true),
    153154    zoomFactor: new WI.Setting("zoom-factor", 1),
    154155
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

    r241750 r241982  
    4040        WI.memoryManager.addEventListener(WI.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
    4141
     42        WI.settings.timelinesAutoStop.addEventListener(WI.Setting.Event.Changed, this._handleTimelinesAutoStopSettingChanged, this);
     43
    4244        this._enabledTimelineTypesSetting = new WI.Setting("enabled-instrument-types", WI.TimelineManager.defaultTimelineTypes());
    4345
     
    305307        WI.DOMNode.removeEventListener(null, null, this);
    306308
    307         if (this._stopCapturingTimeout) {
    308             clearTimeout(this._stopCapturingTimeout);
    309             this._stopCapturingTimeout = undefined;
    310         }
    311 
    312         if (this._deadTimeTimeout) {
    313             clearTimeout(this._deadTimeTimeout);
    314             this._deadTimeTimeout = undefined;
    315         }
     309        this.relaxAutoStop();
    316310
    317311        this._isCapturing = false;
     
    848842    _stopAutoRecordingSoon()
    849843    {
     844        if (!WI.settings.timelinesAutoStop.value)
     845            return;
     846
    850847        // Only auto stop when auto capturing.
    851848        if (!this._isCapturing || !this._mainResourceForAutoCapturing)
     
    859856    _resetAutoRecordingMaxTimeTimeout()
    860857    {
     858        if (!WI.settings.timelinesAutoStop.value)
     859            return;
     860
    861861        if (this._stopCapturingTimeout)
    862862            clearTimeout(this._stopCapturingTimeout);
     
    866866    _resetAutoRecordingDeadTimeTimeout()
    867867    {
     868        if (!WI.settings.timelinesAutoStop.value)
     869            return;
     870
    868871        // Only monitor dead time when auto capturing.
    869872        if (!this._isCapturing || !this._mainResourceForAutoCapturing)
     
    947950
    948951        this.activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);
     952    }
     953
     954    _handleTimelinesAutoStopSettingChanged(event)
     955    {
     956        if (!this._isCapturing)
     957            return;
     958
     959        if (WI.settings.timelinesAutoStop.value)
     960            this._resetAutoRecordingMaxTimeTimeout();
     961        else
     962            this.relaxAutoStop();
    949963    }
    950964
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js

    r241953 r241982  
    5757        this.addSubview(this._timelineContentBrowser);
    5858
     59        this._autoStopCheckboxNavigationItem = new WI.CheckboxNavigationItem("auto-stop-recording", WI.UIString("Stop recording once page loads"), WI.settings.timelinesAutoStop.value);
     60        this._autoStopCheckboxNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
     61        this._autoStopCheckboxNavigationItem.addEventListener(WI.CheckboxNavigationItem.Event.CheckedDidChange, this._handleAutoStopCheckboxCheckedDidChange, this);
     62
     63        WI.settings.timelinesAutoStop.addEventListener(WI.Setting.Event.Changed, this._handleTimelinesAutoStopSettingChanged, this);
     64
    5965        this._clearTimelineNavigationItem = new WI.ButtonNavigationItem("clear-timeline", WI.UIString("Clear Timeline (%s)").format(WI.clearKeyboardShortcut.displayName), "Images/NavigationItemTrash.svg", 15, 15);
    6066        this._clearTimelineNavigationItem.visibilityPriority = WI.NavigationItem.VisibilityPriority.Low;
     
    153159    get navigationItems()
    154160    {
    155         return [this._clearTimelineNavigationItem];
     161        return [
     162            this._autoStopCheckboxNavigationItem,
     163            new WI.DividerNavigationItem,
     164            this._clearTimelineNavigationItem,
     165        ];
    156166    }
    157167
     
    535545        this._recording.removeEventListener(WI.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
    536546        this._waitingToResetCurrentTime = false;
     547    }
     548
     549    _handleAutoStopCheckboxCheckedDidChange(event)
     550    {
     551        WI.settings.timelinesAutoStop.value = this._autoStopCheckboxNavigationItem.checked;
     552    }
     553
     554    _handleTimelinesAutoStopSettingChanged(event)
     555    {
     556        this._autoStopCheckboxNavigationItem.checked = WI.settings.timelinesAutoStop.value;
    537557    }
    538558
Note: See TracChangeset for help on using the changeset viewer.