Changeset 244191 in webkit


Ignore:
Timestamp:
Apr 11, 2019 10:45:05 AM (5 years ago)
Author:
Truitt Savell
Message:

Unreviewed, rolling out r244158.

Casued 8 inspector/timeline/ test failures.

Reverted changeset:

"Web Inspector: Timelines: can't reliably stop/start a
recording"
https://bugs.webkit.org/show_bug.cgi?id=196778
https://trac.webkit.org/changeset/244158

Location:
trunk/Source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r244185 r244191  
     12019-04-11  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r244158.
     4
     5        Casued 8 inspector/timeline/ test failures.
     6
     7        Reverted changeset:
     8
     9        "Web Inspector: Timelines: can't reliably stop/start a
     10        recording"
     11        https://bugs.webkit.org/show_bug.cgi?id=196778
     12        https://trac.webkit.org/changeset/244158
     13
    1142019-04-10  Saam Barati  <sbarati@apple.com>
    215
  • trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp

    r244158 r244191  
    122122    ErrorString unused;
    123123
     124    // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
     125    if (m_scriptProfilerAgent)
     126        m_scriptProfilerAgent->programmaticCaptureStarted();
     127
    124128    if (m_debuggerAgent) {
    125129        m_profileRestoreBreakpointActiveValue = m_debuggerAgent->breakpointsActive();
     
    142146    if (m_debuggerAgent)
    143147        m_debuggerAgent->setBreakpointsActive(unused, m_profileRestoreBreakpointActiveValue);
     148
     149    // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
     150    if (m_scriptProfilerAgent)
     151        m_scriptProfilerAgent->programmaticCaptureStopped();
    144152}
    145153
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp

    r244158 r244191  
    204204void InspectorScriptProfilerAgent::trackingComplete()
    205205{
    206     auto timestamp = m_environment.executionStopwatch()->elapsedTime().seconds();
    207 
    208206#if ENABLE(SAMPLING_PROFILER)
    209207    if (m_enabledSamplingProfiler) {
     
    223221        m_enabledSamplingProfiler = false;
    224222
    225         m_frontendDispatcher->trackingComplete(timestamp, WTFMove(samples));
     223        m_frontendDispatcher->trackingComplete(WTFMove(samples));
    226224    } else
    227         m_frontendDispatcher->trackingComplete(timestamp, nullptr);
     225        m_frontendDispatcher->trackingComplete(nullptr);
    228226#else
    229     m_frontendDispatcher->trackingComplete(timestamp, nullptr);
     227    m_frontendDispatcher->trackingComplete(nullptr);
    230228#endif // ENABLE(SAMPLING_PROFILER)
    231229}
     
    249247}
    250248
     249void InspectorScriptProfilerAgent::programmaticCaptureStarted()
     250{
     251    m_frontendDispatcher->programmaticCaptureStarted();
     252}
     253
     254void InspectorScriptProfilerAgent::programmaticCaptureStopped()
     255{
     256    m_frontendDispatcher->programmaticCaptureStopped();
     257}
     258
    251259} // namespace Inspector
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h

    r244158 r244191  
    5454    void stopTracking(ErrorString&) override;
    5555
     56    void programmaticCaptureStarted();
     57    void programmaticCaptureStopped();
     58
    5659    // Debugger::ProfilingClient
    5760    bool isAlreadyProfiling() const override;
  • trunk/Source/JavaScriptCore/inspector/protocol/CPUProfiler.json

    r244158 r244191  
    5353        {
    5454            "name": "trackingComplete",
    55             "description": "Tracking stopped.",
    56             "parameters": [
    57                 { "name": "timestamp", "type": "number" }
    58             ]
     55            "description": "Tracking stopped. Includes any buffered data during tracking, such as profiling information."
    5956        }
    6057    ]
  • trunk/Source/JavaScriptCore/inspector/protocol/Memory.json

    r244158 r244191  
    6565        {
    6666            "name": "trackingComplete",
    67             "description": "Tracking stopped.",
    68             "parameters": [
    69                 { "name": "timestamp", "type": "number" }
    70             ]
     67            "description": "Tracking stopped."
    7168        }
    7269    ]
  • trunk/Source/JavaScriptCore/inspector/protocol/ScriptProfiler.json

    r244158 r244191  
    8686            "description": "Tracking stopped. Includes any buffered data during tracking, such as profiling information.",
    8787            "parameters": [
    88                 { "name": "timestamp", "type": "number" },
    8988                { "name": "samples", "$ref": "Samples", "optional": true, "description": "Stack traces." }
    9089            ]
     90        },
     91        {
     92            "name": "programmaticCaptureStarted",
     93            "description": "Fired when programmatic capture starts (console.profile). JSContext inspection only."
     94        },
     95        {
     96            "name": "programmaticCaptureStopped",
     97            "description": "Fired when programmatic capture stops (console.profileEnd). JSContext inspection only."
    9198        }
    9299    ]
  • trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json

    r244158 r244191  
    108108            "name": "autoCaptureStarted",
    109109            "description": "Fired when auto capture started."
     110        },
     111        {
     112            "name": "programmaticCaptureStarted",
     113            "description": "Fired when programmatic capture starts (console.profile)."
     114        },
     115        {
     116            "name": "programmaticCaptureStopped",
     117            "description": "Fired when programmatic capture stops (console.profileEnd)."
    110118        }
    111119    ]
  • trunk/Source/WebCore/ChangeLog

    r244188 r244191  
     12019-04-11  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r244158.
     4
     5        Casued 8 inspector/timeline/ test failures.
     6
     7        Reverted changeset:
     8
     9        "Web Inspector: Timelines: can't reliably stop/start a
     10        recording"
     11        https://bugs.webkit.org/show_bug.cgi?id=196778
     12        https://trac.webkit.org/changeset/244158
     13
    1142019-04-11  Pablo Saavedra  <psaavedra@igalia.com>
    215
  • trunk/Source/WebCore/inspector/agents/InspectorCPUProfilerAgent.cpp

    r244158 r244191  
    7878    m_tracking = false;
    7979
    80     m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch()->elapsedTime().seconds());
     80    m_frontendDispatcher->trackingComplete();
    8181}
    8282
  • trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.cpp

    r244158 r244191  
    9393    m_tracking = false;
    9494
    95     m_frontendDispatcher->trackingComplete(m_environment.executionStopwatch()->elapsedTime().seconds());
     95    m_frontendDispatcher->trackingComplete();
    9696}
    9797
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp

    r244158 r244191  
    478478        m_programmaticCaptureRestoreBreakpointActiveValue = false;
    479479
     480    m_frontendDispatcher->programmaticCaptureStarted();
     481
    480482    toggleScriptProfilerInstrument(InstrumentState::Start); // Ensure JavaScript samping data.
    481483    toggleTimelineInstrument(InstrumentState::Start); // Ensure Console Profile event records.
     
    499501        }
    500502    }
     503
     504    m_frontendDispatcher->programmaticCaptureStopped();
    501505}
    502506
  • trunk/Source/WebInspectorUI/ChangeLog

    r244180 r244191  
     12019-04-11  Truitt Savell  <tsavell@apple.com>
     2
     3        Unreviewed, rolling out r244158.
     4
     5        Casued 8 inspector/timeline/ test failures.
     6
     7        Reverted changeset:
     8
     9        "Web Inspector: Timelines: can't reliably stop/start a
     10        recording"
     11        https://bugs.webkit.org/show_bug.cgi?id=196778
     12        https://trac.webkit.org/changeset/244158
     13
    1142019-04-10  Devin Rousso  <drousso@apple.com>
    215
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js

    r244158 r244191  
    3939        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, this._handleBreakpointActionsDidChange, this);
    4040
    41         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
     41        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
     42        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
    4243
    4344        WI.auditManager.addEventListener(WI.AuditManager.Event.TestScheduled, this._handleAuditManagerTestScheduled, this);
     
    11371138    }
    11381139
    1139     _handleTimelineCapturingStateChanged(event)
    1140     {
    1141         switch (WI.timelineManager.capturingState) {
    1142         case WI.TimelineManager.CapturingState.Starting:
    1143             this._startDisablingBreakpointsTemporarily();
    1144             if (this.paused)
    1145                 this.resume();
    1146             break;
    1147 
    1148         case WI.TimelineManager.CapturingState.Inactive:
    1149             this._stopDisablingBreakpointsTemporarily();
    1150             break;
    1151         }
     1140    _timelineCapturingWillStart(event)
     1141    {
     1142        this._startDisablingBreakpointsTemporarily();
     1143
     1144        if (this.paused)
     1145            this.resume();
     1146    }
     1147
     1148    _timelineCapturingStopped(event)
     1149    {
     1150        this._stopDisablingBreakpointsTemporarily();
    11521151    }
    11531152
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

    r244158 r244191  
    3434        WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
    3535        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     36        WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
     37        WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
     38
     39        WI.heapManager.addEventListener(WI.HeapManager.Event.GarbageCollected, this._garbageCollected, this);
     40        WI.memoryManager.addEventListener(WI.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
     41
     42        WI.settings.timelinesAutoStop.addEventListener(WI.Setting.Event.Changed, this._handleTimelinesAutoStopSettingChanged, this);
    3643
    3744        this._enabledTimelineTypesSetting = new WI.Setting("enabled-instrument-types", WI.TimelineManager.defaultTimelineTypes());
    3845
    39         this._capturingState = TimelineManager.CapturingState.Inactive;
    40         this._capturingInstrumentCount = 0;
    41         this._capturingStartTime = NaN;
    42         this._capturingEndTime = NaN;
    43 
     46        this._isCapturing = false;
    4447        this._initiatedByBackendStart = false;
    4548        this._initiatedByBackendStop = false;
    46 
     49        this._waitingForCapturingStartedEvent = false;
    4750        this._isCapturingPageReload = false;
    4851        this._autoCaptureOnPageLoad = false;
     
    5053        this._shouldSetAutoCapturingMainResource = false;
    5154        this._transitioningPageTarget = false;
     55        this._boundStopCapturing = this.stopCapturing.bind(this);
    5256
    5357        this._webTimelineScriptRecordsExpectingScriptProfilerEvents = null;
    5458        this._scriptProfilerRecords = null;
    5559
    56         this._boundStopCapturing = this.stopCapturing.bind(this);
    5760        this._stopCapturingTimeout = undefined;
    5861        this._deadTimeTimeout = undefined;
     
    151154    // Public
    152155
    153     get capturingState() { return this._capturingState; }
    154 
    155156    reset()
    156157    {
    157         if (this.isCapturing())
     158        if (this._isCapturing)
    158159            this.stopCapturing();
    159160
     
    168169    get activeRecording()
    169170    {
    170         console.assert(this._activeRecording || !this.isCapturing());
     171        console.assert(this._activeRecording || !this._isCapturing);
    171172        return this._activeRecording;
    172173    }
     
    191192        this._autoCaptureOnPageLoad = autoCapture;
    192193
    193         for (let target of WI.targets) {
    194             if (target.TimelineAgent)
    195                 target.TimelineAgent.setAutoCaptureEnabled(this._autoCaptureOnPageLoad);
    196         }
     194        if (window.TimelineAgent && TimelineAgent.setAutoCaptureEnabled)
     195            TimelineAgent.setAutoCaptureEnabled(this._autoCaptureOnPageLoad);
    197196    }
    198197
     
    212211    isCapturing()
    213212    {
    214         return this._capturingState !== TimelineManager.CapturingState.Inactive;
     213        return this._isCapturing;
    215214    }
    216215
     
    240239    startCapturing(shouldCreateRecording)
    241240    {
    242         console.assert(this._capturingState === TimelineManager.CapturingState.Stopping || this._capturingState === TimelineManager.CapturingState.Inactive, "TimelineManager is already capturing.");
    243         if (this._capturingState !== TimelineManager.CapturingState.Stopping && this._capturingState !== TimelineManager.CapturingState.Inactive)
    244             return;
     241        console.assert(!this._isCapturing, "TimelineManager is already capturing.");
    245242
    246243        if (!this._activeRecording || shouldCreateRecording)
    247244            this._loadNewRecording();
    248245
    249         this._updateCapturingState(TimelineManager.CapturingState.Starting);
    250 
    251         this._capturingStartTime = NaN;
     246        this._waitingForCapturingStartedEvent = true;
     247
     248        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingWillStart);
     249
    252250        this._activeRecording.start(this._initiatedByBackendStart);
    253251    }
     
    255253    stopCapturing()
    256254    {
    257         console.assert(this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active, "TimelineManager is not capturing.");
    258         if (this._capturingState !== TimelineManager.CapturingState.Starting && this._capturingState !== TimelineManager.CapturingState.Active)
    259             return;
    260 
    261         this._updateCapturingState(TimelineManager.CapturingState.Stopping);
    262 
    263         this._capturingEndTime = NaN;
     255        console.assert(this._isCapturing, "TimelineManager is not capturing.");
     256
    264257        this._activeRecording.stop(this._initiatedByBackendStop);
     258
     259        // NOTE: Always stop immediately instead of waiting for a Timeline.recordingStopped event.
     260        // This way the UI feels as responsive to a stop as possible.
     261        // FIXME: <https://webkit.org/b/152904> Web Inspector: Timeline UI should keep up with processing all incoming records
     262        this.capturingStopped();
     263    }
     264
     265    unloadRecording()
     266    {
     267        if (!this._activeRecording)
     268            return;
     269
     270        if (this._isCapturing)
     271            this.stopCapturing();
     272
     273        this._activeRecording.unloaded();
     274        this._activeRecording = null;
    265275    }
    266276
     
    296306        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingCreated, {recording: newRecording});
    297307
    298         if (this.isCapturing())
     308        if (this._isCapturing)
    299309            this.stopCapturing();
    300310
     
    330340        // Called from WI.TimelineObserver.
    331341
    332         // The frontend didn't start capturing, so this was a programmatic start.
    333         if (this._capturingState === TimelineManager.CapturingState.Inactive) {
    334             this._initiatedByBackendStart = true;
    335             this._activeRecording.addScriptInstrumentForProgrammaticCapture();
    336             this.startCapturing();
    337         }
    338 
    339         if (!isNaN(startTime)) {
    340             if (isNaN(this._capturingStartTime) || startTime < this._capturingStartTime)
    341                 this._capturingStartTime = startTime;
    342 
    343             this._activeRecording.initializeTimeBoundsIfNecessary(startTime);
    344         }
    345 
    346         this._capturingInstrumentCount++;
    347         console.assert(this._capturingInstrumentCount);
    348         if (this._capturingInstrumentCount > 1)
    349             return;
    350 
    351         if (this._capturingState === TimelineManager.CapturingState.Active)
    352             return;
     342        if (this._isCapturing)
     343            return;
     344
     345        this._waitingForCapturingStartedEvent = false;
     346        this._isCapturing = true;
    353347
    354348        this._lastDeadTimeTickle = 0;
    355349
     350        if (startTime)
     351            this.activeRecording.initializeTimeBoundsIfNecessary(startTime);
     352
    356353        this._webTimelineScriptRecordsExpectingScriptProfilerEvents = [];
    357 
    358         WI.settings.timelinesAutoStop.addEventListener(WI.Setting.Event.Changed, this._handleTimelinesAutoStopSettingChanged, this);
    359 
    360         WI.Frame.addEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
    361         WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
    362 
    363         WI.heapManager.addEventListener(WI.HeapManager.Event.GarbageCollected, this._garbageCollected, this);
    364 
    365         WI.memoryManager.addEventListener(WI.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
    366354
    367355        WI.DOMNode.addEventListener(WI.DOMNode.Event.DidFireEvent, this._handleDOMNodeDidFireEvent, this);
    368356        WI.DOMNode.addEventListener(WI.DOMNode.Event.LowPowerChanged, this._handleDOMNodeLowPowerChanged, this);
    369357
    370         this._updateCapturingState(TimelineManager.CapturingState.Active, {startTime: this._capturingStartTime});
     358        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingStarted, {startTime});
    371359    }
    372360
     
    375363        // Called from WI.TimelineObserver.
    376364
    377         // The frontend didn't stop capturing, so this was a programmatic stop.
    378         if (this._capturingState === TimelineManager.CapturingState.Active) {
    379             this._initiatedByBackendStop = true;
    380             this.stopCapturing();
    381         }
    382 
    383         if (!isNaN(endTime)) {
    384             if (isNaN(this._capturingEndTime) || endTime > this._capturingEndTime)
    385                 this._capturingEndTime = endTime;
    386         }
    387 
    388         this._capturingInstrumentCount--;
    389         console.assert(this._capturingInstrumentCount >= 0);
    390         if (this._capturingInstrumentCount)
    391             return;
    392 
    393         if (this._capturingState === TimelineManager.CapturingState.Inactive)
     365        if (!this._isCapturing)
    394366            return;
    395367
    396368        WI.DOMNode.removeEventListener(null, null, this);
    397         WI.memoryManager.removeEventListener(null, null, this);
    398         WI.heapManager.removeEventListener(null, null, this);
    399         WI.Target.removeEventListener(WI.Target.Event.ResourceAdded, this._resourceWasAdded, this);
    400         WI.Frame.removeEventListener(WI.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
    401         WI.settings.timelinesAutoStop.removeEventListener(null, null, this);
    402369
    403370        this.relaxAutoStop();
    404371
     372        this._isCapturing = false;
    405373        this._isCapturingPageReload = false;
    406374        this._shouldSetAutoCapturingMainResource = false;
     
    409377        this._initiatedByBackendStop = false;
    410378
    411         this._updateCapturingState(TimelineManager.CapturingState.Inactive, {endTime: this._capturingEndTime});
     379        this.dispatchEventToListeners(WI.TimelineManager.Event.CapturingStopped, {endTime});
    412380    }
    413381
     
    416384        // Called from WI.TimelineObserver.
    417385
    418         let waitingForCapturingStartedEvent = this._capturingState === TimelineManager.CapturingState.Starting;
    419 
    420         if (this.isCapturing())
     386        if (this._isCapturing)
    421387            this.stopCapturing();
    422388
     
    426392        // between sending the Timeline.start command and receiving Timeline.capturingStarted event.
    427393        // In that case, there is no need to call startCapturing again. Reuse the fresh recording.
    428         if (!waitingForCapturingStartedEvent) {
     394        if (!this._waitingForCapturingStartedEvent) {
    429395            const createNewRecording = true;
    430396            this.startCapturing(createNewRecording);
     
    434400    }
    435401
     402    programmaticCaptureStarted()
     403    {
     404        // Called from WI.TimelineObserver.
     405
     406        this._initiatedByBackendStart = true;
     407
     408        this._activeRecording.addScriptInstrumentForProgrammaticCapture();
     409
     410        const createNewRecording = false;
     411        this.startCapturing(createNewRecording);
     412    }
     413
     414    programmaticCaptureStopped()
     415    {
     416        // Called from WI.TimelineObserver.
     417
     418        this._initiatedByBackendStop = true;
     419
     420        // FIXME: This is purely to avoid a noisy assert. Previously
     421        // it was impossible to stop without stopping from the UI.
     422        console.assert(!this._isCapturing);
     423        this._isCapturing = true;
     424
     425        this.stopCapturing();
     426    }
     427
    436428    eventRecorded(recordPayload)
    437429    {
    438430        // Called from WI.TimelineObserver.
    439431
    440         console.assert(this.isCapturing());
    441         if (!this.isCapturing())
     432        if (!this._isCapturing)
    442433            return;
    443434
     
    479470    }
    480471
     472    // Protected
     473
    481474    pageDOMContentLoadedEventFired(timestamp)
    482475    {
     
    486479        console.assert(isNaN(WI.networkManager.mainFrame.domContentReadyEventTimestamp));
    487480
    488         let computedTimestamp = this._activeRecording.computeElapsedTime(timestamp);
     481        let computedTimestamp = this.activeRecording.computeElapsedTime(timestamp);
    489482
    490483        WI.networkManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);
     
    501494        console.assert(isNaN(WI.networkManager.mainFrame.loadEventTimestamp));
    502495
    503         let computedTimestamp = this._activeRecording.computeElapsedTime(timestamp);
     496        let computedTimestamp = this.activeRecording.computeElapsedTime(timestamp);
    504497
    505498        WI.networkManager.mainFrame.markLoadEvent(computedTimestamp);
     
    522515        // Called from WI.CPUProfilerObserver.
    523516
    524         console.assert(this.isCapturing());
    525         if (!this.isCapturing())
     517        if (!this._isCapturing)
    526518            return;
    527519
     
    529521    }
    530522
    531     cpuProfilerTrackingCompleted(timestamp)
     523    cpuProfilerTrackingCompleted()
    532524    {
    533525        // Called from WI.CPUProfilerObserver.
    534 
    535         this.capturingStopped(timestamp);
    536526    }
    537527
     
    547537        // Called from WI.MemoryObserver.
    548538
    549         console.assert(this.isCapturing());
    550         if (!this.isCapturing())
     539        if (!this._isCapturing)
    551540            return;
    552541
     
    554543    }
    555544
    556     memoryTrackingCompleted(timestamp)
     545    memoryTrackingCompleted()
    557546    {
    558547        // Called from WI.MemoryObserver.
    559 
    560         this.capturingStopped(timestamp);
    561548    }
    562549
     
    565552        // Called from WI.HeapObserver.
    566553
     554        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     555
    567556        this.capturingStarted(timestamp);
     557    }
     558
     559    heapTrackingCompleted(timestamp, snapshot)
     560    {
     561        // Called from WI.HeapObserver.
    568562
    569563        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    570564    }
    571565
    572     heapTrackingCompleted(timestamp, snapshot)
    573     {
    574         // Called from WI.HeapObserver.
     566    heapSnapshotAdded(timestamp, snapshot)
     567    {
     568        // Called from WI.HeapAllocationsInstrument.
    575569
    576570        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    577 
    578         this.capturingStopped();
    579     }
    580 
    581     heapSnapshotAdded(timestamp, snapshot)
    582     {
    583         // Called from WI.HeapAllocationsInstrument.
    584 
    585         console.assert(this.isCapturing());
    586         if (!this.isCapturing())
    587             return;
    588 
    589         this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    590571    }
    591572
    592573    // Private
    593574
    594     _updateCapturingState(state, data = {})
    595     {
    596         if (this._capturingState === state)
    597             return;
    598 
    599         this._capturingState = state;
    600 
    601         this.dispatchEventToListeners(TimelineManager.Event.CapturingStateChanged, data);
    602     }
    603 
    604575    _processRecord(recordPayload, parentRecordPayload)
    605576    {
    606         console.assert(this.isCapturing());
    607 
    608         var startTime = this._activeRecording.computeElapsedTime(recordPayload.startTime);
    609         var endTime = this._activeRecording.computeElapsedTime(recordPayload.endTime);
     577        var startTime = this.activeRecording.computeElapsedTime(recordPayload.startTime);
     578        var endTime = this.activeRecording.computeElapsedTime(recordPayload.endTime);
    610579        var callFrames = this._callFramesFromPayload(recordPayload.stackTrace);
    611580
     
    794763    _processEvent(recordPayload, parentRecordPayload)
    795764    {
    796         console.assert(this.isCapturing());
    797 
    798765        switch (recordPayload.type) {
    799766        case TimelineAgent.EventType.TimeStamp:
    800             var timestamp = this._activeRecording.computeElapsedTime(recordPayload.startTime);
     767            var timestamp = this.activeRecording.computeElapsedTime(recordPayload.startTime);
    801768            var eventMarker = new WI.TimelineMarker(timestamp, WI.TimelineMarker.Type.TimeStamp, recordPayload.data.message);
    802769            this._activeRecording.addEventMarker(eventMarker);
     
    828795        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingCreated, {recording: newRecording});
    829796
    830         if (this.isCapturing())
     797        if (this._isCapturing)
    831798            this.stopCapturing();
    832799
     
    861828    _addRecord(record)
    862829    {
    863         console.assert(this.isCapturing());
    864 
    865830        this._activeRecording.addRecord(record);
    866831
     
    880845        // COMPATIBILITY (iOS 9): Timeline.setAutoCaptureEnabled did not exist.
    881846        // Perform auto capture in the frontend.
    882         if (!InspectorBackend.domains.Timeline)
     847        if (!window.TimelineAgent)
    883848            return false;
    884         if (!InspectorBackend.domains.Timeline.setAutoCaptureEnabled)
     849        if (!TimelineAgent.setAutoCaptureEnabled)
    885850            return this._legacyAttemptStartAutoCapturingForFrame(frame);
    886851
     
    888853            return false;
    889854
    890         console.assert(this.isCapturing(), "We saw autoCaptureStarted so we should already be capturing");
     855        console.assert(this._isCapturing, "We saw autoCaptureStarted so we should already be capturing");
    891856
    892857        let mainResource = frame.provisionalMainResource || frame.mainResource;
     
    910875    _legacyAttemptStartAutoCapturingForFrame(frame)
    911876    {
    912         if (this.isCapturing() && !this._mainResourceForAutoCapturing)
     877        if (this._isCapturing && !this._mainResourceForAutoCapturing)
    913878            return false;
    914879
     
    920885        this._isCapturingPageReload = oldMainResource !== null && oldMainResource.url === mainResource.url;
    921886
    922         if (this.isCapturing())
     887        if (this._isCapturing)
    923888            this.stopCapturing();
    924889
     
    942907
    943908        // Only auto stop when auto capturing.
    944         if (!this.isCapturing() || !this._mainResourceForAutoCapturing)
     909        if (!this._isCapturing || !this._mainResourceForAutoCapturing)
    945910            return;
    946911
     
    966931
    967932        // Only monitor dead time when auto capturing.
    968         if (!this.isCapturing() || !this._mainResourceForAutoCapturing)
     933        if (!this._isCapturing || !this._mainResourceForAutoCapturing)
    969934            return;
    970935
     
    1007972            return;
    1008973
    1009         console.assert(this.isCapturing());
    1010         if (!this.isCapturing())
     974        if (!this._isCapturing)
    1011975            return;
    1012976
     
    1020984    _resourceWasAdded(event)
    1021985    {
     986
    1022987        // Ignore resource events when there isn't a main frame yet. Those events are triggered by
    1023988        // loading the cached resources when the inspector opens, and they do not have timing information.
     
    1025990            return;
    1026991
     992        if (!this._isCapturing)
     993            return;
     994
    1027995        this._addRecord(new WI.ResourceTimelineRecord(event.data.resource));
    1028996    }
     
    1030998    _garbageCollected(event)
    1031999    {
    1032         let {collection} = event.data;
     1000        if (!this._isCapturing)
     1001            return;
     1002
     1003        let collection = event.data.collection;
    10331004        this._addRecord(new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.GarbageCollected, collection.startTime, collection.endTime, null, null, collection));
    10341005    }
     
    10361007    _memoryPressure(event)
    10371008    {
    1038         this._activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);
     1009        if (!this._isCapturing)
     1010            return;
     1011
     1012        this.activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);
    10391013    }
    10401014
    10411015    _handleTimelinesAutoStopSettingChanged(event)
    10421016    {
     1017        if (!this._isCapturing)
     1018            return;
     1019
    10431020        if (WI.settings.timelinesAutoStop.value) {
    10441021            if (this._mainResourceForAutoCapturing && !isNaN(this._mainResourceForAutoCapturing.parentFrame.loadEventTimestamp))
     
    10631040    }
    10641041
     1042    scriptProfilerProgrammaticCaptureStarted()
     1043    {
     1044        // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
     1045        console.assert(WI.sharedApp.debuggableType === WI.DebuggableType.JavaScript);
     1046        console.assert(!this._isCapturing);
     1047
     1048        this.programmaticCaptureStarted();
     1049    }
     1050
     1051    scriptProfilerProgrammaticCaptureStopped()
     1052    {
     1053        // FIXME: <https://webkit.org/b/158753> Generalize the concept of Instruments on the backend to work equally for JSContext and Web inspection
     1054        console.assert(WI.sharedApp.debuggableType === WI.DebuggableType.JavaScript);
     1055        console.assert(this._isCapturing);
     1056
     1057        this.programmaticCaptureStopped();
     1058    }
     1059
    10651060    scriptProfilerTrackingStarted(timestamp)
    10661061    {
     
    10861081    }
    10871082
    1088     scriptProfilerTrackingCompleted(timestamp, samples)
     1083    scriptProfilerTrackingCompleted(samples)
    10891084    {
    10901085        console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
     
    10921087        if (samples) {
    10931088            let {stackTraces} = samples;
    1094             let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
     1089            let topDownCallingContextTree = this.activeRecording.topDownCallingContextTree;
    10951090
    10961091            // Calculate a per-sample duration.
     
    11261121                sampleDurations.fill(defaultDuration, sampleDurationIndex);
    11271122
    1128             this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
     1123            this.activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
    11291124
    11301125            // FIXME: This transformation should not be needed after introducing ProfileView.
     
    11461141        this._scriptProfilerRecords = null;
    11471142
    1148         let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
     1143        let timeline = this.activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
    11491144        timeline.refresh();
    1150 
    1151         this.capturingStopped(timestamp);
    11521145    }
    11531146
     
    12481241    _handleDOMNodeDidFireEvent(event)
    12491242    {
     1243        console.assert(this._isCapturing);
     1244
    12501245        let {domEvent} = event.data;
    12511246
     
    12581253    _handleDOMNodeLowPowerChanged(event)
    12591254    {
     1255        console.assert(this._isCapturing);
     1256
    12601257        let {timestamp, isLowPower} = event.data;
    12611258
     
    12671264};
    12681265
    1269 WI.TimelineManager.CapturingState = {
    1270     Inactive: "inactive",
    1271     Starting: "starting",
    1272     Active: "active",
    1273     Stopping: "stopping",
    1274 };
    1275 
    12761266WI.TimelineManager.Event = {
    1277     CapturingStateChanged: "timeline-manager-capturing-started",
    12781267    RecordingCreated: "timeline-manager-recording-created",
    12791268    RecordingLoaded: "timeline-manager-recording-loaded",
    12801269    RecordingImported: "timeline-manager-recording-imported",
     1270    CapturingWillStart: "timeline-manager-capturing-will-start",
     1271    CapturingStarted: "timeline-manager-capturing-started",
     1272    CapturingStopped: "timeline-manager-capturing-stopped"
    12811273};
    12821274
  • trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js

    r244158 r244191  
    3434        // Necessary event required to track page load time and resource sizes.
    3535        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
    36         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
     36        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
    3737
    3838        // Necessary events required to track load of resources.
     
    164164    }
    165165
    166     _handleTimelineCapturingStateChanged(event)
    167     {
    168         if (WI.timelineManager.isCapturing())
    169             return;
    170 
     166    _capturingStopped(event)
     167    {
    171168        // If recording stops, we should stop the timer if it hasn't stopped already.
    172169        this._stopUpdatingTime();
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/CPUProfilerObserver.js

    r244158 r244191  
    3838    }
    3939
    40     trackingComplete(timestamp)
     40    trackingComplete(samples)
    4141    {
    42         WI.timelineManager.cpuProfilerTrackingCompleted(timestamp);
     42        WI.timelineManager.cpuProfilerTrackingCompleted(samples);
    4343    }
    4444};
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js

    r244158 r244191  
    4343    }
    4444
    45     trackingComplete(timestamp)
     45    trackingComplete()
    4646    {
    47         WI.timelineManager.memoryTrackingCompleted(timestamp);
     47        WI.timelineManager.memoryTrackingCompleted();
    4848    }
    4949};
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/ScriptProfilerObserver.js

    r244158 r244191  
    3838    }
    3939
    40     trackingComplete(timestamp, samples)
     40    trackingComplete(samples)
    4141    {
    42         WI.timelineManager.scriptProfilerTrackingCompleted(timestamp, samples);
     42        WI.timelineManager.scriptProfilerTrackingCompleted(samples);
    4343    }
    4444
    4545    programmaticCaptureStarted()
    4646    {
    47         // COMPATIBILITY (iOS 12.2): ScriptProfiler.programmaticCaptureStarted was removed after iOS 12.2.
     47        WI.timelineManager.scriptProfilerProgrammaticCaptureStarted();
    4848    }
    4949
    5050    programmaticCaptureStopped()
    5151    {
    52         // COMPATIBILITY (iOS 12.2): ScriptProfiler.programmaticCaptureStopped was removed after iOS 12.2.
     52        WI.timelineManager.scriptProfilerProgrammaticCaptureStopped();
    5353    }
    5454};
  • trunk/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js

    r244158 r244191  
    5050    programmaticCaptureStarted()
    5151    {
    52         // COMPATIBILITY (iOS 12.2): Timeline.programmaticCaptureStarted was removed after iOS 12.2.
     52        WI.timelineManager.programmaticCaptureStarted();
    5353    }
    5454
    5555    programmaticCaptureStopped()
    5656    {
    57         // COMPATIBILITY (iOS 12.2): Timeline.programmaticCaptureStopped was removed after iOS 12.2.
     57        WI.timelineManager.programmaticCaptureStopped();
    5858    }
    5959};
  • trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js

    r244158 r244191  
    5656        WI.DOMBreakpoint.addEventListener(WI.DOMBreakpoint.Event.DOMNodeChanged, this._handleDOMBreakpointDOMNodeChanged, this);
    5757
    58         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
     58        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
     59        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
    5960
    6061        WI.auditManager.addEventListener(WI.AuditManager.Event.TestScheduled, this._handleAuditManagerTestScheduled, this);
     
    251252
    252253        if (WI.debuggerManager.breakpointsDisabledTemporarily) {
    253             this._handleTimelineCapturingStateChanged();
     254            if (WI.timelineManager.isCapturing())
     255                this._timelineCapturingWillStart();
    254256
    255257            if (WI.auditManager.runningState === WI.AuditManager.RunningState.Active || WI.auditManager.runningState === WI.AuditManager.RunningState.Stopping)
     
    647649    }
    648650
    649     _handleTimelineCapturingStateChanged(event)
     651    _timelineCapturingWillStart(event)
    650652    {
    651653        this._updateTemporarilyDisabledBreakpointsButtons();
    652654
    653         switch (WI.timelineManager.capturingState) {
    654         case WI.TimelineManager.CapturingState.Starting:
    655             this.contentView.element.insertBefore(this._timelineRecordingWarningElement, this.contentView.element.firstChild);
    656             break;
    657 
    658         case WI.TimelineManager.CapturingState.Inactive:
    659             this._timelineRecordingWarningElement.remove();
    660             break;
    661         }
    662 
     655        this.contentView.element.insertBefore(this._timelineRecordingWarningElement, this.contentView.element.firstChild);
     656        this._updateBreakpointsDisabledBanner();
     657    }
     658
     659    _timelineCapturingStopped(event)
     660    {
     661        this._updateTemporarilyDisabledBreakpointsButtons();
     662
     663        this._timelineRecordingWarningElement.remove();
    663664        this._updateBreakpointsDisabledBanner();
    664665    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js

    r244158 r244191  
    283283        WI.consoleManager.addEventListener(WI.ConsoleManager.Event.Cleared, this._handleConsoleCleared, this);
    284284
    285         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
     285        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._handleTimelineCapturingWillStart, this);
     286        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._handleTimelineCapturingStopped, this);
    286287
    287288        WI.auditManager.addEventListener(WI.AuditManager.Event.TestScheduled, this._handleAuditManagerTestScheduled, this);
     
    337338
    338339        if (WI.debuggerManager.breakpointsDisabledTemporarily) {
    339             this._handleTimelineCapturingStateChanged();
     340            if (WI.timelineManager.isCapturing())
     341                this._handleTimelineCapturingWillStart();
    340342
    341343            if (WI.auditManager.runningState === WI.AuditManager.RunningState.Active || WI.auditManager.runningState === WI.AuditManager.RunningState.Stopping)
     
    18191821    }
    18201822
    1821     _handleTimelineCapturingStateChanged(event)
     1823    _handleTimelineCapturingWillStart(event)
    18221824    {
    18231825        this._updateTemporarilyDisabledBreakpointsButtons();
    18241826
    1825         switch (WI.timelineManager.capturingState) {
    1826         case WI.TimelineManager.CapturingState.Starting:
    1827             if (!this._timelineRecordingWarningElement) {
    1828                 let stopRecordingButton = document.createElement("button");
    1829                 stopRecordingButton.textContent = WI.UIString("Stop recording");
    1830                 stopRecordingButton.addEventListener("click", () => {
    1831                     WI.timelineManager.stopCapturing();
    1832                 });
    1833 
    1834                 this._timelineRecordingWarningElement = document.createElement("div");
    1835                 this._timelineRecordingWarningElement.classList.add("warning-banner");
    1836                 this._timelineRecordingWarningElement.append(WI.UIString("Debugger disabled during Timeline recording"), document.createElement("br"), stopRecordingButton);
    1837             }
    1838 
    1839             this.contentView.element.insertBefore(this._timelineRecordingWarningElement, this.contentView.element.firstChild);
    1840             break;
    1841 
    1842         case WI.TimelineManager.CapturingState.Inactive:
    1843             if (this._timelineRecordingWarningElement) {
    1844                 this._timelineRecordingWarningElement.remove();
    1845                 this._timelineRecordingWarningElement = null;
    1846             }
    1847             break;
     1827        if (!this._timelineRecordingWarningElement) {
     1828            let stopRecordingButton = document.createElement("button");
     1829            stopRecordingButton.textContent = WI.UIString("Stop recording");
     1830            stopRecordingButton.addEventListener("click", () => {
     1831                WI.timelineManager.stopCapturing();
     1832            });
     1833
     1834            this._timelineRecordingWarningElement = document.createElement("div");
     1835            this._timelineRecordingWarningElement.classList.add("warning-banner");
     1836            this._timelineRecordingWarningElement.append(WI.UIString("Debugger disabled during Timeline recording"), document.createElement("br"), stopRecordingButton);
     1837        }
     1838
     1839        this.contentView.element.insertBefore(this._timelineRecordingWarningElement, this.contentView.element.firstChild);
     1840
     1841        this._updateBreakpointsDisabledBanner();
     1842    }
     1843
     1844    _handleTimelineCapturingStopped(event)
     1845    {
     1846        this._updateTemporarilyDisabledBreakpointsButtons();
     1847
     1848        if (this._timelineRecordingWarningElement) {
     1849            this._timelineRecordingWarningElement.remove();
     1850            this._timelineRecordingWarningElement = null;
    18481851        }
    18491852
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js

    r244158 r244191  
    117117        this._viewModeDidChange();
    118118
    119         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
    120119        WI.timelineManager.addEventListener(WI.TimelineManager.Event.RecordingImported, this._recordingImported, this);
     120        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
     121        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
    121122    }
    122123
     
    10321033    }
    10331034
    1034     _handleTimelineCapturingStateChanged(event)
    1035     {
    1036         switch (WI.timelineManager.capturingState) {
    1037         case WI.TimelineManager.CapturingState.Active:
    1038             this._editInstrumentsButton.enabled = false;
    1039             this._stopEditingInstruments();
    1040             break;
    1041 
    1042         case WI.TimelineManager.CapturingState.Inactive:
    1043             this._editInstrumentsButton.enabled = true;
    1044             break;
    1045         }
    1046     }
    1047 
    10481035    _recordingImported(event)
    10491036    {
     
    10691056    }
    10701057
     1058    _capturingStarted(event)
     1059    {
     1060        this._editInstrumentsButton.enabled = false;
     1061        this._stopEditingInstruments();
     1062    }
     1063
     1064    _capturingStopped(event)
     1065    {
     1066        this._editInstrumentsButton.enabled = true;
     1067    }
     1068
    10711069    _compareTimelineTreeElements(a, b)
    10721070    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js

    r244158 r244191  
    103103        this._recording.addEventListener(WI.TimelineRecording.Event.Unloaded, this._recordingUnloaded, this);
    104104
    105         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
     105        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
     106        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
    106107
    107108        WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, this._debuggerPaused, this);
     
    510511    }
    511512
    512     _handleTimelineCapturingStateChanged(event)
    513     {
    514         let {startTime, endTime} = event.data;
    515 
     513    _capturingStarted(event)
     514    {
    516515        this._updateProgressView();
    517516
    518         switch (WI.timelineManager.capturingState) {
    519         case WI.TimelineManager.CapturingState.Active:
    520             if (!this._updating)
    521                 this._startUpdatingCurrentTime(startTime);
    522 
    523             this._clearTimelineNavigationItem.enabled = !this._recording.readonly;
    524             this._exportButtonNavigationItem.enabled = false;
    525 
    526             // A discontinuity occurs when the recording is stopped and resumed at
    527             // a future time. Capturing started signals the end of the current
    528             // discontinuity, if one exists.
    529             if (!isNaN(this._discontinuityStartTime)) {
    530                 this._recording.addDiscontinuity(this._discontinuityStartTime, startTime);
    531                 this._discontinuityStartTime = NaN;
    532             }
    533             break;
    534 
    535         case WI.TimelineManager.CapturingState.Inactive:
    536             if (this._updating)
    537                 this._stopUpdatingCurrentTime();
    538 
    539             if (this.currentTimelineView)
    540                 this._updateTimelineViewTimes(this.currentTimelineView);
    541 
    542             this._discontinuityStartTime = endTime || this._currentTime;
    543 
    544             this._exportButtonNavigationItem.enabled = this._recording.canExport();
    545             break;
    546         }
     517        let startTime = event.data.startTime;
     518        if (!this._updating)
     519            this._startUpdatingCurrentTime(startTime);
     520        this._clearTimelineNavigationItem.enabled = !this._recording.readonly;
     521        this._exportButtonNavigationItem.enabled = false;
     522
     523        // A discontinuity occurs when the recording is stopped and resumed at
     524        // a future time. Capturing started signals the end of the current
     525        // discontinuity, if one exists.
     526        if (!isNaN(this._discontinuityStartTime)) {
     527            this._recording.addDiscontinuity(this._discontinuityStartTime, startTime);
     528            this._discontinuityStartTime = NaN;
     529        }
     530    }
     531
     532    _capturingStopped(event)
     533    {
     534        this._updateProgressView();
     535
     536        if (this._updating)
     537            this._stopUpdatingCurrentTime();
     538
     539        if (this.currentTimelineView)
     540            this._updateTimelineViewTimes(this.currentTimelineView);
     541
     542        this._discontinuityStartTime = event.data.endTime || this._currentTime;
     543
     544        this._exportButtonNavigationItem.enabled = this._recording.canExport();
    547545    }
    548546
     
    734732        console.assert(!this._updating);
    735733
    736         WI.timelineManager.removeEventListener(null, null, this);
     734        WI.timelineManager.removeEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
     735        WI.timelineManager.removeEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
    737736    }
    738737
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js

    r244158 r244191  
    7272        }
    7373
    74         WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStateChanged, this._handleTimelineCapturingStateChanged, this);
    7574        WI.timelineManager.addEventListener(WI.TimelineManager.Event.RecordingCreated, this._recordingCreated, this);
    7675        WI.timelineManager.addEventListener(WI.TimelineManager.Event.RecordingLoaded, this._recordingLoaded, this);
     76
     77        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStarted, this._capturingStartedOrStopped, this);
     78        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._capturingStartedOrStopped, this);
    7779
    7880        WI.notifications.addEventListener(WI.Notification.VisibilityStateDidChange, this._inspectorVisibilityChanged, this);
     
    424426    }
    425427
    426     _handleTimelineCapturingStateChanged(event)
    427     {
    428         let enabled = WI.timelineManager.capturingState === WI.TimelineManager.CapturingState.Active || WI.timelineManager.capturingState === WI.TimelineManager.CapturingState.Inactive;
    429 
    430         this._toggleRecordingShortcut.disabled = !enabled;
    431         this._toggleNewRecordingShortcut.disabled = !enabled;
    432 
    433         this._recordButton.toggled = WI.timelineManager.isCapturing();
    434         this._recordButton.enabled = enabled;
     428    _capturingStartedOrStopped(event)
     429    {
     430        let isCapturing = WI.timelineManager.isCapturing();
     431        this._recordButton.toggled = isCapturing;
    435432
    436433        this._updateNavigationBarButtons();
Note: See TracChangeset for help on using the changeset viewer.