⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 198774 in webkit


Ignore:
Timestamp:
Mar 28, 2016, 8:28:10 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Ensure maximum accuracy while profiling
https://bugs.webkit.org/show_bug.cgi?id=155809
<rdar://problem/25325035>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-03-28
Reviewed by Timothy Hatcher.

  • Localizations/en.lproj/localizedStrings.js:

New strings.

  • UserInterface/Controllers/DebuggerManager.js:

(WebInspector.DebuggerManager):
When starting the inspector, if it was previously closed while
breakpoints were temporarily disabled, restore the correct
breakpoints enabled state.

(WebInspector.DebuggerManager.prototype.set breakpointsEnabled):
Warn if we ever try to enable breakpoints during timeline recordings.

(WebInspector.DebuggerManager.prototype.get breakpointsDisabledTemporarily):
(WebInspector.DebuggerManager.prototype.startDisablingBreakpointsTemporarily):
(WebInspector.DebuggerManager.prototype.stopDisablingBreakpointsTemporarily):
Method to start/stop temporarily disabling breakpoints.

(WebInspector.DebuggerManager.prototype._breakpointDisabledStateDidChange):
(WebInspector.DebuggerManager.prototype._setBreakpoint):
When temporarily disabling breakpoints avoid the convenience behavior of
enabling all breakpoints when enabling or setting a single breakpoint.

  • UserInterface/Controllers/TimelineManager.js:

(WebInspector.TimelineManager.prototype.startCapturing):
Emit a will start capturing event to do work before enabling instruments.

  • UserInterface/Views/DebuggerSidebarPanel.css:

(.sidebar > .panel.navigation.debugger .timeline-recording-warning):
(.sidebar > .panel.navigation.debugger .timeline-recording-warning > a):
Styles for a warning section in the Debugger Sidebar when the Debugger
is temporarily disabled due to a Timeline recording.

  • UserInterface/Views/DebuggerSidebarPanel.js:

(WebInspector.DebuggerSidebarPanel.prototype._timelineRecordingWillStart):
(WebInspector.DebuggerSidebarPanel.prototype._timelineRecordingStopped):
Modify the Debugger state and UI before and after a Timeline recording.

Location:
trunk/Source/WebInspectorUI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r198751 r198774  
     12016-03-28  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Ensure maximum accuracy while profiling
     4        https://bugs.webkit.org/show_bug.cgi?id=155809
     5        <rdar://problem/25325035>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        * Localizations/en.lproj/localizedStrings.js:
     10        New strings.
     11
     12        * UserInterface/Controllers/DebuggerManager.js:
     13        (WebInspector.DebuggerManager):
     14        When starting the inspector, if it was previously closed while
     15        breakpoints were temporarily disabled, restore the correct
     16        breakpoints enabled state.
     17
     18        (WebInspector.DebuggerManager.prototype.set breakpointsEnabled):
     19        Warn if we ever try to enable breakpoints during timeline recordings.
     20
     21        (WebInspector.DebuggerManager.prototype.get breakpointsDisabledTemporarily):
     22        (WebInspector.DebuggerManager.prototype.startDisablingBreakpointsTemporarily):
     23        (WebInspector.DebuggerManager.prototype.stopDisablingBreakpointsTemporarily):
     24        Method to start/stop temporarily disabling breakpoints.
     25
     26        (WebInspector.DebuggerManager.prototype._breakpointDisabledStateDidChange):
     27        (WebInspector.DebuggerManager.prototype._setBreakpoint):
     28        When temporarily disabling breakpoints avoid the convenience behavior of
     29        enabling all breakpoints when enabling or setting a single breakpoint.
     30
     31        * UserInterface/Controllers/TimelineManager.js:
     32        (WebInspector.TimelineManager.prototype.startCapturing):
     33        Emit a will start capturing event to do work before enabling instruments.
     34
     35        * UserInterface/Views/DebuggerSidebarPanel.css:
     36        (.sidebar > .panel.navigation.debugger .timeline-recording-warning):
     37        (.sidebar > .panel.navigation.debugger .timeline-recording-warning > a):
     38        Styles for a warning section in the Debugger Sidebar when the Debugger
     39        is temporarily disabled due to a Timeline recording.
     40
     41        * UserInterface/Views/DebuggerSidebarPanel.js:
     42        (WebInspector.DebuggerSidebarPanel.prototype._timelineRecordingWillStart):
     43        (WebInspector.DebuggerSidebarPanel.prototype._timelineRecordingStopped):
     44        Modify the Debugger state and UI before and after a Timeline recording.
     45
    1462016-03-28  Nikita Vasilyev  <nvasilyev@apple.com>
    247
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r198537 r198774  
    216216localizedStrings["Debugger Paused"] = "Debugger Paused";
    217217localizedStrings["Debugger Statement"] = "Debugger Statement";
     218localizedStrings["Debugger is disabled during a Timeline recording."] = "Debugger is disabled during a Timeline recording.";
    218219localizedStrings["Decoded"] = "Decoded";
    219220localizedStrings["Decoration"] = "Decoration";
     
    684685localizedStrings["Stop Recording"] = "Stop Recording";
    685686localizedStrings["Stop recording (%s)"] = "Stop recording (%s)";
     687localizedStrings["Stop recording."] = "Stop recording.";
    686688localizedStrings["Storage"] = "Storage";
    687689localizedStrings["Style"] = "Style";
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js

    r198555 r198774  
    7272        this._breakpointsEnabledSetting = new WebInspector.Setting("breakpoints-enabled", true);
    7373
     74        // Restore the correct breakpoints enabled setting if Web Inspector had
     75        // previously been left in a state where breakpoints were temporarily disabled.
     76        this._temporarilyDisabledBreakpointsRestoreSetting = new WebInspector.Setting("temporarily-disabled-breakpoints-restore", null);
     77        if (this._temporarilyDisabledBreakpointsRestoreSetting.value !== null) {
     78            this._breakpointsEnabledSetting.value = this._temporarilyDisabledBreakpointsRestoreSetting.value;
     79            this._temporarilyDisabledBreakpointsRestoreSetting.value = null;
     80        }
     81
    7482        if (window.DebuggerAgent)
    7583            DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);
     
    99107    {
    100108        if (this._breakpointsEnabledSetting.value === enabled)
     109            return;
     110
     111        console.assert(!(enabled && this.breakpointsDisabledTemporarily), "Should not enable breakpoints when we are temporarily disabling breakpoints.");
     112        if (enabled && this.breakpointsDisabledTemporarily)
    101113            return;
    102114
     
    334346
    335347        return knownScripts;
     348    }
     349
     350    get breakpointsDisabledTemporarily()
     351    {
     352        return this._temporarilyDisabledBreakpointsRestoreSetting.value !== null;
     353    }
     354
     355    startDisablingBreakpointsTemporarily()
     356    {
     357        console.assert(this._temporarilyDisabledBreakpointsRestoreSetting.value === null, "Already temporarily disabling breakpoints.");
     358        if (this._temporarilyDisabledBreakpointsRestoreSetting.value !== null)
     359            return;
     360
     361        this._temporarilyDisabledBreakpointsRestoreSetting.value = this._breakpointsEnabledSetting.value;
     362
     363        this.breakpointsEnabled = false;
     364    }
     365
     366    stopDisablingBreakpointsTemporarily()
     367    {
     368        console.assert(this._temporarilyDisabledBreakpointsRestoreSetting.value !== null, "Was not temporarily disabling breakpoints.");
     369        if (this._temporarilyDisabledBreakpointsRestoreSetting.value === null)
     370            return;
     371
     372        let restoreState = this._temporarilyDisabledBreakpointsRestoreSetting.value;
     373        this._temporarilyDisabledBreakpointsRestoreSetting.value = null;
     374
     375        this.breakpointsEnabled = restoreState;
    336376    }
    337377
     
    688728            return;
    689729
    690         if (!this._restoringBreakpoints) {
     730        if (!this._restoringBreakpoints && !this.breakpointsDisabledTemporarily) {
    691731            // Enable breakpoints since a breakpoint is being set. This eliminates
    692732            // a multi-step process for the user that can be confusing.
     
    801841        let breakpoint = event.target;
    802842        if (breakpoint === this._allExceptionsBreakpoint) {
    803             if (!breakpoint.disabled)
     843            if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
    804844                this.breakpointsEnabled = true;
    805845            this._allExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
     
    809849
    810850        if (breakpoint === this._allUncaughtExceptionsBreakpoint) {
    811             if (!breakpoint.disabled)
     851            if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
    812852                this.breakpointsEnabled = true;
    813853            this._allUncaughtExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

    r198537 r198774  
    159159            this._loadNewRecording();
    160160
     161        this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingWillStart);
     162
    161163        this._activeRecording.start();
    162164    }
     
    867869    RecordingCreated: "timeline-manager-recording-created",
    868870    RecordingLoaded: "timeline-manager-recording-loaded",
     871    CapturingWillStart: "timeline-manager-capturing-will-start",
    869872    CapturingStarted: "timeline-manager-capturing-started",
    870873    CapturingStopped: "timeline-manager-capturing-stopped"
  • trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.css

    r196713 r198774  
    2424 */
    2525
    26 
    2726.sidebar > .panel.navigation.debugger > :matches(.content, .empty-content-placeholder) {
    2827    top: 29px;
     
    3433    left: 0;
    3534    right: 0;
     35}
     36
     37.sidebar > .panel.navigation.debugger .timeline-recording-warning {
     38    text-align: center;
     39    font-size: 11px;
     40
     41    padding: 11px 6px;
     42    margin-bottom: 6px;
     43
     44    border-bottom: 1px solid var(--border-color);
     45    background-color: hsl(50, 100%, 94%);
     46}
     47
     48.sidebar > .panel.navigation.debugger .timeline-recording-warning > a {
     49    text-decoration: underline;
     50    cursor: pointer;
    3651}
    3752
     
    4762    display: none;
    4863}
    49 
    5064
    5165.sidebar > .panel.navigation.debugger .details-section > .content > .group {
  • trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js

    r194879 r198774  
    4747        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.WaitingToPause, this._debuggerWaitingToPause, this);
    4848
     49        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart, this._timelineRecordingWillStart, this);
     50        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._timelineRecordingStopped, this);       
     51
     52        this._timelineRecordingWarningElement = document.createElement("div");
     53        this._timelineRecordingWarningElement.classList.add("timeline-recording-warning");
     54        this._timelineRecordingWarningElement.append(WebInspector.UIString("Debugger is disabled during a Timeline recording."), " ");
     55        let stopRecordingLink = this._timelineRecordingWarningElement.appendChild(document.createElement("a"));
     56        stopRecordingLink.textContent = WebInspector.UIString("Stop recording.");
     57        stopRecordingLink.addEventListener("click", () => { WebInspector.timelineManager.stopCapturing(); });
     58
    4959        this._navigationBar = new WebInspector.NavigationBar;
    5060        this.addSubview(this._navigationBar);
     
    386396        this._addBreakpointsForSourceCode(resource);
    387397        this._addIssuesForSourceCode(resource);
     398    }
     399
     400    _timelineRecordingWillStart(event)
     401    {
     402        WebInspector.debuggerManager.startDisablingBreakpointsTemporarily();
     403
     404        if (WebInspector.debuggerManager.paused)
     405            WebInspector.debuggerManager.resume();
     406
     407        this._debuggerBreakpointsButtonItem.enabled = false;
     408        this._debuggerPauseResumeButtonItem.enabled = false;
     409
     410        this.contentView.element.insertBefore(this._timelineRecordingWarningElement, this.contentView.element.firstChild);
     411    }
     412
     413    _timelineRecordingStopped(event)
     414    {
     415        WebInspector.debuggerManager.stopDisablingBreakpointsTemporarily();
     416
     417        this._debuggerBreakpointsButtonItem.enabled = true;
     418        this._debuggerPauseResumeButtonItem.enabled = true;
     419
     420        this._timelineRecordingWarningElement.remove();
    388421    }
    389422
Note: See TracChangeset for help on using the changeset viewer.