Changeset 248286 in webkit


Ignore:
Timestamp:
Aug 5, 2019 7:21:59 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Timelines: disable related agents when the tab is closed
https://bugs.webkit.org/show_bug.cgi?id=200118

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Rework how enable/disable is used for timeline-related agents so that events are not sent
and data isn't kept alive when the Timelines tab isn't enabled.

  • inspector/protocol/Timeline.json:

Add enable/disable commands.

  • inspector/agents/InspectorHeapAgent.cpp:

(Inspector::InspectorHeapAgent::willDestroyFrontendAndBackend):
(Inspector::InspectorHeapAgent::enable):
(Inspector::InspectorHeapAgent::disable):

Source/WebCore:

Rework how enable/disable is used for timeline-related agents so that events are not sent
and data isn't kept alive when the Timelines tab isn't enabled.

  • inspector/agents/InspectorTimelineAgent.h:
  • inspector/agents/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
(WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorTimelineAgent::enable):
(WebCore::InspectorTimelineAgent::disable):
(WebCore::InspectorTimelineAgent::start):
(WebCore::InspectorTimelineAgent::stop):
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::startFromConsole):
(WebCore::InspectorTimelineAgent::stopFromConsole):
(WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
(WebCore::InspectorTimelineAgent::startProgrammaticCapture):
(WebCore::InspectorTimelineAgent::stopProgrammaticCapture):
Rename m_enabled* to m_tracking* to match other timeline-related agents.

  • inspector/agents/InspectorMemoryAgent.h:
  • inspector/agents/InspectorMemoryAgent.cpp:

(WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
(WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorMemoryAgent::enable):
(WebCore::InspectorMemoryAgent::disable):
(WebCore::InspectorMemoryAgent::didHandleMemoryPressure):

  • inspector/InstrumentingAgents.h:

(WebCore::InstrumentingAgents::trackingInspectorTimelineAgent): Added.
(WebCore::InstrumentingAgents::setTrackingInspectorTimelineAgent): Added.
(WebCore::InstrumentingAgents::persistentInspectorTimelineAgent): Added.
(WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent): Added.

  • inspector/InstrumentingAgents.cpp:

(WebCore::InstrumentingAgents::reset):

  • inspector/InspectorInstrumentation.h:
  • inspector/InspectorInstrumentation.cpp:

(WebCore::InspectorInstrumentation::didInstallTimerImpl):
(WebCore::InspectorInstrumentation::didRemoveTimerImpl):
(WebCore::InspectorInstrumentation::willCallFunctionImpl):
(WebCore::InspectorInstrumentation::willDispatchEventImpl):
(WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
(WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
(WebCore::InspectorInstrumentation::willFireTimerImpl):
(WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
(WebCore::InspectorInstrumentation::willLayoutImpl):
(WebCore::InspectorInstrumentation::willCompositeImpl):
(WebCore::InspectorInstrumentation::didCompositeImpl):
(WebCore::InspectorInstrumentation::willPaintImpl):
(WebCore::InspectorInstrumentation::didPaintImpl):
(WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
(WebCore::InspectorInstrumentation::startConsoleTimingImpl):
(WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
(WebCore::InspectorInstrumentation::consoleTimeStampImpl):
(WebCore::InspectorInstrumentation::startProfilingImpl):
(WebCore::InspectorInstrumentation::stopProfilingImpl):
(WebCore::InspectorInstrumentation::timelineAgentTracking): Added.
(WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
(WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
(WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
(WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
(WebCore::InspectorInstrumentation::retrieveTimelineAgent):
(WebCore::InspectorInstrumentation::timelineAgentEnabled): Deleted.

  • bindings/js/JSExecStateInstrumentation.h:

(WebCore::JSExecState::instrumentFunctionInternal):
Rename for clarity/correctness:

  • inspectorTimelineAgent => trackingInspectorTimelineAgent
  • persistentInspectorTimelineAgent => inspectorTimelineAgent

Source/WebInspectorUI:

Rework how enable/disable is used for timeline-related agents so that events are not sent
and data isn't kept alive when the Timelines tab isn't enabled.

  • UserInterface/Controllers/TimelineManager.js:

(WI.TimelineManager):
(WI.TimelineManager.prototype.get domains): Added.
(WI.TimelineManager.prototype.activateExtraDomain): Added.
(WI.TimelineManager.prototype.initializeTarget):
(WI.TimelineManager.prototype.reset):
(WI.TimelineManager.prototype.set autoCaptureOnPageLoad):
(WI.TimelineManager.prototype.enable): Added.
(WI.TimelineManager.prototype.disable): Added.
(WI.TimelineManager.prototype.startCapturing):
(WI.TimelineManager.prototype.stopCapturing):
(WI.TimelineManager.prototype.async processJSON):
(WI.TimelineManager.prototype.capturingStarted):
(WI.TimelineManager.prototype.capturingStopped):
(WI.TimelineManager.prototype.autoCaptureStarted):
(WI.TimelineManager.prototype.eventRecorded):
(WI.TimelineManager.prototype.pageDOMContentLoadedEventFired):
(WI.TimelineManager.prototype.pageLoadEventFired):
(WI.TimelineManager.prototype.cpuProfilerTrackingUpdated):
(WI.TimelineManager.prototype.memoryTrackingUpdated):
(WI.TimelineManager.prototype.heapTrackingStarted):
(WI.TimelineManager.prototype.heapTrackingCompleted):
(WI.TimelineManager.prototype.heapSnapshotAdded):
(WI.TimelineManager.prototype._loadNewRecording):
(WI.TimelineManager.prototype._legacyAttemptStartAutoCapturingForFrame):
(WI.TimelineManager.prototype._provisionalLoadStarted):
(WI.TimelineManager.prototype._mainResourceDidChange):
(WI.TimelineManager.prototype._resourceWasAdded):
(WI.TimelineManager.prototype._garbageCollected):
(WI.TimelineManager.prototype._memoryPressure):
(WI.TimelineManager.prototype.scriptProfilerTrackingUpdated):
(WI.TimelineManager.prototype.scriptProfilerTrackingCompleted):
(WI.TimelineManager.prototype._updateAutoCaptureInstruments):
(WI.TimelineManager.prototype._handleDOMNodeDidFireEvent):
(WI.TimelineManager.prototype._handleDOMNodePowerEfficientPlaybackStateChanged):

  • UserInterface/Models/Instrument.js:

(WI.Instrument.startLegacyTimelineAgent):
(WI.Instrument.stopLegacyTimelineAgent):

  • UserInterface/Controllers/HeapManager.js:

(WI.HeapManager): Added.
(WI.HeapManager.prototype.get domains): Added.
(WI.HeapManager.prototype.activateExtraDomain): Added.
(WI.HeapManager.prototype.initializeTarget):
(WI.HeapManager.prototype.enable): Added.
(WI.HeapManager.prototype.disable): Added.
(WI.HeapManager.prototype.snapshot): Added.
(WI.HeapManager.prototype.getPreview): Added.
(WI.HeapManager.prototype.getRemoteObject): Added.
(WI.HeapManager.prototype.garbageCollected):

  • UserInterface/Controllers/MemoryManager.js:

(WI.MemoryManager): Added.
(WI.MemoryManager.prototype.get domains): Added.
(WI.MemoryManager.prototype.activateExtraDomain): Added.
(WI.MemoryManager.prototype.initializeTarget):
(WI.MemoryManager.prototype.enable): Added.
(WI.MemoryManager.prototype.disable): Added.
(WI.MemoryManager.prototype.memoryPressure):

  • UserInterface/Views/TimelineTabContentView.js:

(WI.TimelineTabContentView):
(WI.TimelineTabContentView.prototype.closed):

  • UserInterface/Models/HeapAllocationsInstrument.js:

(WI.HeapAllocationsInstrument):
(WI.HeapAllocationsInstrument.prototype._takeHeapSnapshot):

  • UserInterface/Views/HeapAllocationsTimelineView.js:

(WI.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):

  • UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:

(WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode):
(WI.HeapSnapshotInstanceDataGridNode.prototype._populatePreview):
(WI.HeapSnapshotInstanceDataGridNode.prototype._mouseoverHandler.appendPathRow):
Go through the HeapManager for HeapAgent commands so it can better manage state.

  • UserInterface/Test/Test.js:

(WI.contentLoaded):

LayoutTests:

  • inspector/timeline/line-column.html:
  • inspector/timeline/setInstruments-errors.html:
  • inspector/timeline/setInstruments-programmatic-capture.html:
Location:
trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248285 r248286  
     12019-08-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Timelines: disable related agents when the tab is closed
     4        https://bugs.webkit.org/show_bug.cgi?id=200118
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * inspector/timeline/line-column.html:
     9        * inspector/timeline/setInstruments-errors.html:
     10        * inspector/timeline/setInstruments-programmatic-capture.html:
     11
    1122019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
    213
  • trunk/LayoutTests/inspector/timeline/line-column.html

    r244195 r248286  
    3434}
    3535
    36 function test() {
    37     ProtocolTest.debug();
     36function test()
     37{
     38    let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn");
    3839
    3940    InspectorProtocol.sendCommand("Page.enable");
    40 
    41     let suite = ProtocolTest.createAsyncSuite("Timeline.LineColumn");
     41    InspectorProtocol.sendCommand("Timeline.enable");
    4242
    4343    function replacer(key, value) {
  • trunk/LayoutTests/inspector/timeline/setInstruments-errors.html

    r210062 r248286  
    77{
    88    let suite = ProtocolTest.createAsyncSuite("Timeline.setInstruments.errors");
     9
     10    InspectorProtocol.sendCommand("Heap.enable");
     11    InspectorProtocol.sendCommand("Memory.enable");
     12    InspectorProtocol.sendCommand("Timeline.enable");
    913
    1014    suite.addTestCase({
  • trunk/LayoutTests/inspector/timeline/setInstruments-programmatic-capture.html

    r244195 r248286  
    1818
    1919    InspectorProtocol.sendCommand("Heap.enable");
     20    InspectorProtocol.sendCommand("Timeline.enable");
    2021
    2122    InspectorProtocol.eventHandler["Timeline.recordingStarted"] = () => {
  • trunk/Source/JavaScriptCore/ChangeLog

    r248274 r248286  
     12019-08-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Timelines: disable related agents when the tab is closed
     4        https://bugs.webkit.org/show_bug.cgi?id=200118
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
     9        and data isn't kept alive when the Timelines tab isn't enabled.
     10
     11        * inspector/protocol/Timeline.json:
     12        Add `enable`/`disable` commands.
     13
     14        * inspector/agents/InspectorHeapAgent.cpp:
     15        (Inspector::InspectorHeapAgent::willDestroyFrontendAndBackend):
     16        (Inspector::InspectorHeapAgent::enable):
     17        (Inspector::InspectorHeapAgent::disable):
     18
    1192019-08-05  Devin Rousso  <drousso@apple.com>
    220
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp

    r243150 r248286  
    5555void InspectorHeapAgent::willDestroyFrontendAndBackend(DisconnectReason)
    5656{
    57     // Stop tracking without taking a snapshot.
    58     m_tracking = false;
    59 
    6057    ErrorString ignored;
    6158    disable(ignored);
    6259}
    6360
    64 void InspectorHeapAgent::enable(ErrorString&)
    65 {
    66     if (m_enabled)
    67         return;
     61void InspectorHeapAgent::enable(ErrorString& errorString)
     62{
     63    if (m_enabled) {
     64        errorString = "HeapAgent already enabled"_s;
     65        return;
     66    }
    6867
    6968    m_enabled = true;
     
    7271}
    7372
    74 void InspectorHeapAgent::disable(ErrorString&)
    75 {
    76     if (!m_enabled)
    77         return;
     73void InspectorHeapAgent::disable(ErrorString& errorString)
     74{
     75    if (!m_enabled) {
     76        errorString = "HeapAgent already disabled"_s;
     77        return;
     78    }
    7879
    7980    m_enabled = false;
     81    m_tracking = false;
    8082
    8183    m_environment.vm().heap.removeObserver(this);
  • trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json

    r244195 r248286  
    5858    "commands": [
    5959        {
     60            "name": "enable",
     61            "description": "Enables Timeline domain events."
     62        },
     63        {
     64            "name": "disable",
     65            "description": "Disables Timeline domain events."
     66        },
     67        {
    6068            "name": "start",
    6169            "description": "Starts capturing instrumentation events.",
  • trunk/Source/WebCore/ChangeLog

    r248285 r248286  
     12019-08-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Timelines: disable related agents when the tab is closed
     4        https://bugs.webkit.org/show_bug.cgi?id=200118
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
     9        and data isn't kept alive when the Timelines tab isn't enabled.
     10
     11        * inspector/agents/InspectorTimelineAgent.h:
     12        * inspector/agents/InspectorTimelineAgent.cpp:
     13        (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
     14        (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
     15        (WebCore::InspectorTimelineAgent::enable):
     16        (WebCore::InspectorTimelineAgent::disable):
     17        (WebCore::InspectorTimelineAgent::start):
     18        (WebCore::InspectorTimelineAgent::stop):
     19        (WebCore::InspectorTimelineAgent::internalStart):
     20        (WebCore::InspectorTimelineAgent::internalStop):
     21        (WebCore::InspectorTimelineAgent::startFromConsole):
     22        (WebCore::InspectorTimelineAgent::stopFromConsole):
     23        (WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
     24        (WebCore::InspectorTimelineAgent::startProgrammaticCapture):
     25        (WebCore::InspectorTimelineAgent::stopProgrammaticCapture):
     26        Rename `m_enabled*` to `m_tracking*` to match other timeline-related agents.
     27
     28        * inspector/agents/InspectorMemoryAgent.h:
     29        * inspector/agents/InspectorMemoryAgent.cpp:
     30        (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
     31        (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
     32        (WebCore::InspectorMemoryAgent::enable):
     33        (WebCore::InspectorMemoryAgent::disable):
     34        (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
     35
     36        * inspector/InstrumentingAgents.h:
     37        (WebCore::InstrumentingAgents::trackingInspectorTimelineAgent): Added.
     38        (WebCore::InstrumentingAgents::setTrackingInspectorTimelineAgent): Added.
     39        (WebCore::InstrumentingAgents::persistentInspectorTimelineAgent): Added.
     40        (WebCore::InstrumentingAgents::setPersistentInspectorTimelineAgent): Added.
     41        * inspector/InstrumentingAgents.cpp:
     42        (WebCore::InstrumentingAgents::reset):
     43        * inspector/InspectorInstrumentation.h:
     44        * inspector/InspectorInstrumentation.cpp:
     45        (WebCore::InspectorInstrumentation::didInstallTimerImpl):
     46        (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
     47        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
     48        (WebCore::InspectorInstrumentation::willDispatchEventImpl):
     49        (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl):
     50        (WebCore::InspectorInstrumentation::willEvaluateScriptImpl):
     51        (WebCore::InspectorInstrumentation::willFireTimerImpl):
     52        (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
     53        (WebCore::InspectorInstrumentation::willLayoutImpl):
     54        (WebCore::InspectorInstrumentation::willCompositeImpl):
     55        (WebCore::InspectorInstrumentation::didCompositeImpl):
     56        (WebCore::InspectorInstrumentation::willPaintImpl):
     57        (WebCore::InspectorInstrumentation::didPaintImpl):
     58        (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
     59        (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
     60        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
     61        (WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
     62        (WebCore::InspectorInstrumentation::startConsoleTimingImpl):
     63        (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
     64        (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
     65        (WebCore::InspectorInstrumentation::startProfilingImpl):
     66        (WebCore::InspectorInstrumentation::stopProfilingImpl):
     67        (WebCore::InspectorInstrumentation::timelineAgentTracking): Added.
     68        (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
     69        (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
     70        (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
     71        (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl):
     72        (WebCore::InspectorInstrumentation::retrieveTimelineAgent):
     73        (WebCore::InspectorInstrumentation::timelineAgentEnabled): Deleted.
     74        * bindings/js/JSExecStateInstrumentation.h:
     75        (WebCore::JSExecState::instrumentFunctionInternal):
     76        Rename for clarity/correctness:
     77         - `inspectorTimelineAgent` => `trackingInspectorTimelineAgent`
     78         - `persistentInspectorTimelineAgent` => `inspectorTimelineAgent`
     79
    1802019-08-05  Fujii Hironori  <Hironori.Fujii@sony.com>
    281
  • trunk/Source/WebCore/bindings/js/JSExecStateInstrumentation.h

    r240323 r248286  
    3636inline InspectorInstrumentationCookie JSExecState::instrumentFunctionInternal(ScriptExecutionContext* context, Type callType, const DataType& callData)
    3737{
    38     if (!InspectorInstrumentation::timelineAgentEnabled(context))
     38    if (!InspectorInstrumentation::timelineAgentTracking(context))
    3939        return InspectorInstrumentationCookie();
    4040    String resourceName;
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r247278 r248286  
    317317        debuggerAgent->didScheduleAsyncCall(context.execState(), InspectorDebuggerAgent::AsyncCallType::DOMTimer, timerId, singleShot);
    318318
    319     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     319    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    320320        timelineAgent->didInstallTimer(timerId, timeout, singleShot, frameForScriptExecutionContext(context));
    321321}
     
    325325    if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent())
    326326        debuggerAgent->didCancelAsyncCall(InspectorDebuggerAgent::AsyncCallType::DOMTimer, timerId);
    327     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     327    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    328328        timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context));
    329329}
     
    379379{
    380380    int timelineAgentId = 0;
    381     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     381    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    382382        timelineAgent->willCallFunction(scriptName, scriptLine, scriptColumn, frameForScriptExecutionContext(context));
    383383        timelineAgentId = timelineAgent->id();
     
    395395{
    396396    int timelineAgentId = 0;
    397     InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
     397    InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent();
    398398    if (timelineAgent && hasEventListeners) {
    399399        timelineAgent->willDispatchEvent(event, document.frame());
     
    431431{
    432432    int timelineAgentId = 0;
    433     InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent();
     433    InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent();
    434434    if (timelineAgent && window.hasEventListeners(event.type())) {
    435435        timelineAgent->willDispatchEvent(event, window.frame());
     
    455455{
    456456    int timelineAgentId = 0;
    457     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     457    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    458458        timelineAgent->willEvaluateScript(url, lineNumber, columnNumber, frame);
    459459        timelineAgentId = timelineAgent->id();
     
    477477
    478478    int timelineAgentId = 0;
    479     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     479    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    480480        timelineAgent->willFireTimer(timerId, frameForScriptExecutionContext(context));
    481481        timelineAgentId = timelineAgent->id();
     
    494494void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
    495495{
    496     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     496    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    497497        timelineAgent->didInvalidateLayout(frame);
    498498}
     
    501501{
    502502    int timelineAgentId = 0;
    503     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     503    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    504504        timelineAgent->willLayout(frame);
    505505        timelineAgentId = timelineAgent->id();
     
    519519void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents& instrumentingAgents, Frame& frame)
    520520{
    521     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     521    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    522522        timelineAgent->willComposite(frame);
    523523}
     
    525525void InspectorInstrumentation::didCompositeImpl(InstrumentingAgents& instrumentingAgents)
    526526{
    527     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     527    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    528528        timelineAgent->didComposite();
    529529}
     
    531531void InspectorInstrumentation::willPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject& renderer)
    532532{
    533     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     533    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    534534        timelineAgent->willPaint(renderer.frame());
    535535}
     
    537537void InspectorInstrumentation::didPaintImpl(InstrumentingAgents& instrumentingAgents, RenderObject& renderer, const LayoutRect& rect)
    538538{
    539     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     539    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    540540        timelineAgent->didPaint(renderer, rect);
    541541
     
    547547{
    548548    int timelineAgentId = 0;
    549     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     549    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    550550        timelineAgent->willRecalculateStyle(document.frame());
    551551        timelineAgentId = timelineAgent->id();
     
    573573void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents& instrumentingAgents, Document& document)
    574574{
    575     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     575    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    576576        timelineAgent->didScheduleStyleRecalculation(document.frame());
    577577    if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
     
    755755
    756756    if (frame.isMainFrame()) {
    757         if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     757        if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    758758            timelineAgent->mainFrameNavigated();
    759759    }
     
    780780        if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
    781781            pageDebuggerAgent->mainFrameStartedLoading();
    782         if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
     782        if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
    783783            timelineAgent->mainFrameStartedLoading();
    784784    }
     
    875875        return;
    876876
    877     if (auto* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     877    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    878878        timelineAgent->time(frame, label);
    879879    if (auto* consoleAgent = instrumentingAgents.webConsoleAgent())
     
    906906    if (auto* consoleAgent = instrumentingAgents.webConsoleAgent())
    907907        consoleAgent->stopTiming(exec, label);
    908     if (auto* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     908    if (auto* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    909909        timelineAgent->timeEnd(frame, label);
    910910}
     
    921921void InspectorInstrumentation::consoleTimeStampImpl(InstrumentingAgents& instrumentingAgents, Frame& frame, Ref<ScriptArguments>&& arguments)
    922922{
    923     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     923    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    924924        String message;
    925925        arguments->getFirstArgumentAsString(message);
     
    930930void InspectorInstrumentation::startProfilingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& title)
    931931{
    932     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
     932    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
    933933        timelineAgent->startFromConsole(exec, title);
    934934}
     
    936936void InspectorInstrumentation::stopProfilingImpl(InstrumentingAgents& instrumentingAgents, JSC::ExecState* exec, const String& title)
    937937{
    938     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
     938    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
    939939        timelineAgent->stopFromConsole(exec, title);
    940940}
     
    11131113}
    11141114
    1115 bool InspectorInstrumentation::timelineAgentEnabled(ScriptExecutionContext* scriptExecutionContext)
     1115bool InspectorInstrumentation::timelineAgentTracking(ScriptExecutionContext* scriptExecutionContext)
    11161116{
    11171117    FAST_RETURN_IF_NO_FRONTENDS(false);
    11181118    if (auto* instrumentingAgents = instrumentingAgentsForContext(scriptExecutionContext))
    1119         return instrumentingAgents->inspectorTimelineAgent();
     1119        return instrumentingAgents->trackingInspectorTimelineAgent();
    11201120    return false;
    11211121}
     
    11251125    if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
    11261126        pageDebuggerAgent->didRequestAnimationFrame(callbackId, document);
    1127     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     1127    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    11281128        timelineAgent->didRequestAnimationFrame(callbackId, document.frame());
    11291129}
     
    11331133    if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
    11341134        pageDebuggerAgent->didCancelAnimationFrame(callbackId);
    1135     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
     1135    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent())
    11361136        timelineAgent->didCancelAnimationFrame(callbackId, document.frame());
    11371137}
     
    11461146
    11471147    int timelineAgentId = 0;
    1148     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     1148    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    11491149        timelineAgent->willFireAnimationFrame(callbackId, document.frame());
    11501150        timelineAgentId = timelineAgent->id();
     
    11641164{
    11651165    int timelineAgentId = 0;
    1166     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) {
     1166    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.trackingInspectorTimelineAgent()) {
    11671167        timelineAgent->willFireObserverCallback(callbackType, frameForScriptExecutionContext(&context));
    11681168        timelineAgentId = timelineAgent->id();
     
    12021202        return nullptr;
    12031203
    1204     InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspectorTimelineAgent();
     1204    InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->trackingInspectorTimelineAgent();
    12051205    if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
    12061206        return timelineAgent;
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r247278 r248286  
    295295
    296296    static bool consoleAgentEnabled(ScriptExecutionContext*);
    297     static bool timelineAgentEnabled(ScriptExecutionContext*);
     297    static bool timelineAgentTracking(ScriptExecutionContext*);
    298298
    299299    static InstrumentingAgents* instrumentingAgentsForPage(Page*);
  • trunk/Source/WebCore/inspector/InstrumentingAgents.cpp

    r243119 r248286  
    5656    m_inspectorScriptProfilerAgent = nullptr;
    5757    m_inspectorTimelineAgent = nullptr;
    58     m_persistentInspectorTimelineAgent = nullptr;
     58    m_trackingInspectorTimelineAgent = nullptr;
    5959    m_inspectorDOMStorageAgent = nullptr;
    6060#if ENABLE(RESOURCE_USAGE)
  • trunk/Source/WebCore/inspector/InstrumentingAgents.h

    r243119 r248286  
    110110    void setInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_inspectorTimelineAgent = agent; }
    111111
    112     InspectorTimelineAgent* persistentInspectorTimelineAgent() const { return m_persistentInspectorTimelineAgent; }
    113     void setPersistentInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_persistentInspectorTimelineAgent = agent; }
     112    InspectorTimelineAgent* trackingInspectorTimelineAgent() const { return m_trackingInspectorTimelineAgent; }
     113    void setTrackingInspectorTimelineAgent(InspectorTimelineAgent* agent) { m_trackingInspectorTimelineAgent = agent; }
    114114
    115115    InspectorDOMStorageAgent* inspectorDOMStorageAgent() const { return m_inspectorDOMStorageAgent; }
     
    164164    Inspector::InspectorScriptProfilerAgent* m_inspectorScriptProfilerAgent { nullptr };
    165165    InspectorTimelineAgent* m_inspectorTimelineAgent { nullptr };
    166     InspectorTimelineAgent* m_persistentInspectorTimelineAgent { nullptr };
     166    InspectorTimelineAgent* m_trackingInspectorTimelineAgent { nullptr };
    167167    InspectorDOMStorageAgent* m_inspectorDOMStorageAgent { nullptr };
    168168#if ENABLE(RESOURCE_USAGE)
  • trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.cpp

    r244195 r248286  
    4848void InspectorMemoryAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
    4949{
    50     m_instrumentingAgents.setInspectorMemoryAgent(this);
    5150}
    5251
    5352void InspectorMemoryAgent::willDestroyFrontendAndBackend(DisconnectReason)
    5453{
    55     m_instrumentingAgents.setInspectorMemoryAgent(nullptr);
    56 
    5754    ErrorString ignored;
    58     stopTracking(ignored);
    5955    disable(ignored);
    6056}
    6157
    62 void InspectorMemoryAgent::enable(ErrorString&)
     58void InspectorMemoryAgent::enable(ErrorString& errorString)
    6359{
    64     m_enabled = true;
     60    if (m_instrumentingAgents.inspectorMemoryAgent() == this) {
     61        errorString = "MemoryAgent already enabled"_s;
     62        return;
     63    }
     64
     65    m_instrumentingAgents.setInspectorMemoryAgent(this);
    6566}
    6667
    67 void InspectorMemoryAgent::disable(ErrorString&)
     68void InspectorMemoryAgent::disable(ErrorString& errorString)
    6869{
    69     m_enabled = false;
     70    if (m_instrumentingAgents.inspectorMemoryAgent() != this) {
     71        errorString = "MemoryAgent already disabled"_s;
     72        return;
     73    }
     74
     75    m_instrumentingAgents.setInspectorMemoryAgent(nullptr);
     76
     77    m_tracking = false;
     78
     79    ResourceUsageThread::removeObserver(this);
    7080}
    7181
     
    98108void InspectorMemoryAgent::didHandleMemoryPressure(Critical critical)
    99109{
    100     if (!m_enabled)
    101         return;
    102 
    103110    MemoryFrontendDispatcher::Severity severity = critical == Critical::Yes ? MemoryFrontendDispatcher::Severity::Critical : MemoryFrontendDispatcher::Severity::NonCritical;
    104111    m_frontendDispatcher->memoryPressure(m_environment.executionStopwatch()->elapsedTime().seconds(), severity);
  • trunk/Source/WebCore/inspector/agents/InspectorMemoryAgent.h

    r228218 r248286  
    6262    std::unique_ptr<Inspector::MemoryFrontendDispatcher> m_frontendDispatcher;
    6363    RefPtr<Inspector::MemoryBackendDispatcher> m_backendDispatcher;
    64     bool m_enabled { false };
    6564    bool m_tracking { false };
    6665};
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp

    r248177 r248286  
    9797void InspectorTimelineAgent::didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*)
    9898{
    99     m_instrumentingAgents.setPersistentInspectorTimelineAgent(this);
    10099}
    101100
    102101void InspectorTimelineAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason)
    103102{
    104     m_instrumentingAgents.setPersistentInspectorTimelineAgent(nullptr);
     103}
     104
     105void InspectorTimelineAgent::enable(ErrorString& errorString)
     106{
     107    if (m_instrumentingAgents.inspectorTimelineAgent() == this) {
     108        errorString = "TimelineAgent already enabled"_s;
     109        return;
     110    }
     111
     112    m_instrumentingAgents.setInspectorTimelineAgent(this);
     113}
     114
     115void InspectorTimelineAgent::disable(ErrorString& errorString)
     116{
     117    if (m_instrumentingAgents.inspectorTimelineAgent() != this) {
     118        errorString = "TimelineAgent already disabled"_s;
     119        return;
     120    }
     121
     122    m_instrumentingAgents.setInspectorTimelineAgent(nullptr);
    105123
    106124    ErrorString unused;
     
    113131void InspectorTimelineAgent::start(ErrorString&, const int* maxCallStackDepth)
    114132{
    115     m_enabledFromFrontend = true;
     133    m_trackingFromFrontend = true;
    116134
    117135    internalStart(maxCallStackDepth);
     
    122140    internalStop();
    123141
    124     m_enabledFromFrontend = false;
     142    m_trackingFromFrontend = false;
    125143}
    126144
     
    156174void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth)
    157175{
    158     if (m_enabled)
     176    if (m_tracking)
    159177        return;
    160178
     
    164182        m_maxCallStackDepth = 5;
    165183
    166     m_instrumentingAgents.setInspectorTimelineAgent(this);
     184    m_instrumentingAgents.setTrackingInspectorTimelineAgent(this);
    167185
    168186    m_environment.scriptDebugServer().addListener(this);
    169187
    170     m_enabled = true;
     188    m_tracking = true;
    171189
    172190    // FIXME: Abstract away platform-specific code once https://bugs.webkit.org/show_bug.cgi?id=142748 is fixed.
     
    174192#if PLATFORM(COCOA)
    175193    m_frameStartObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::InspectorFrameBegin), [this]() {
    176         if (!m_enabled || m_environment.scriptDebugServer().isPaused())
     194        if (!m_tracking || m_environment.scriptDebugServer().isPaused())
    177195            return;
    178196
     
    183201
    184202    m_frameStopObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::InspectorFrameEnd), [this]() {
    185         if (!m_enabled || m_environment.scriptDebugServer().isPaused())
     203        if (!m_tracking || m_environment.scriptDebugServer().isPaused())
    186204            return;
    187205
     
    215233void InspectorTimelineAgent::internalStop()
    216234{
    217     if (!m_enabled)
    218         return;
    219 
    220     m_instrumentingAgents.setInspectorTimelineAgent(nullptr);
     235    if (!m_tracking)
     236        return;
     237
     238    m_instrumentingAgents.setTrackingInspectorTimelineAgent(nullptr);
    221239
    222240    m_environment.scriptDebugServer().removeListener(this, true);
     
    234252    clearRecordStack();
    235253
    236     m_enabled = false;
     254    m_tracking = false;
    237255    m_startedComposite = false;
    238256    m_autoCapturePhase = AutoCapturePhase::None;
     
    267285    }
    268286
    269     if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
     287    if (!m_tracking && m_pendingConsoleProfileRecords.isEmpty())
    270288        startProgrammaticCapture();
    271289
     
    286304            m_pendingConsoleProfileRecords.remove(i);
    287305
    288             if (!m_enabledFromFrontend && m_pendingConsoleProfileRecords.isEmpty())
     306            if (!m_trackingFromFrontend && m_pendingConsoleProfileRecords.isEmpty())
    289307                stopProgrammaticCapture();
    290308
     
    440458void InspectorTimelineAgent::mainFrameStartedLoading()
    441459{
    442     if (m_enabled)
     460    if (m_tracking)
    443461        return;
    444462
     
    474492void InspectorTimelineAgent::startProgrammaticCapture()
    475493{
    476     ASSERT(!m_enabled);
     494    ASSERT(!m_tracking);
    477495
    478496    // Disable breakpoints during programmatic capture.
     
    493511void InspectorTimelineAgent::stopProgrammaticCapture()
    494512{
    495     ASSERT(m_enabled);
    496     ASSERT(!m_enabledFromFrontend);
     513    ASSERT(m_tracking);
     514    ASSERT(!m_trackingFromFrontend);
    497515
    498516    toggleInstruments(InstrumentState::Stop);
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h

    r248177 r248286  
    9595    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
    9696
     97    // TimelineBackendDispatcherHandler
     98    void enable(ErrorString&) final;
     99    void disable(ErrorString&) final;
    97100    void start(ErrorString&, const int* maxCallStackDepth = nullptr) final;
    98101    void stop(ErrorString&) final;
     
    215218    int m_maxCallStackDepth { 5 };
    216219
    217     bool m_enabled { false };
    218     bool m_enabledFromFrontend { false };
     220    bool m_tracking { false };
     221    bool m_trackingFromFrontend { false };
    219222    bool m_programmaticCaptureRestoreBreakpointActiveValue { false };
    220223
  • trunk/Source/WebInspectorUI/ChangeLog

    r248284 r248286  
     12019-08-05  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Timelines: disable related agents when the tab is closed
     4        https://bugs.webkit.org/show_bug.cgi?id=200118
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Rework how `enable`/`disable` is used for timeline-related agents so that events are not sent
     9        and data isn't kept alive when the Timelines tab isn't enabled.
     10
     11        * UserInterface/Controllers/TimelineManager.js:
     12        (WI.TimelineManager):
     13        (WI.TimelineManager.prototype.get domains): Added.
     14        (WI.TimelineManager.prototype.activateExtraDomain): Added.
     15        (WI.TimelineManager.prototype.initializeTarget):
     16        (WI.TimelineManager.prototype.reset):
     17        (WI.TimelineManager.prototype.set autoCaptureOnPageLoad):
     18        (WI.TimelineManager.prototype.enable): Added.
     19        (WI.TimelineManager.prototype.disable): Added.
     20        (WI.TimelineManager.prototype.startCapturing):
     21        (WI.TimelineManager.prototype.stopCapturing):
     22        (WI.TimelineManager.prototype.async processJSON):
     23        (WI.TimelineManager.prototype.capturingStarted):
     24        (WI.TimelineManager.prototype.capturingStopped):
     25        (WI.TimelineManager.prototype.autoCaptureStarted):
     26        (WI.TimelineManager.prototype.eventRecorded):
     27        (WI.TimelineManager.prototype.pageDOMContentLoadedEventFired):
     28        (WI.TimelineManager.prototype.pageLoadEventFired):
     29        (WI.TimelineManager.prototype.cpuProfilerTrackingUpdated):
     30        (WI.TimelineManager.prototype.memoryTrackingUpdated):
     31        (WI.TimelineManager.prototype.heapTrackingStarted):
     32        (WI.TimelineManager.prototype.heapTrackingCompleted):
     33        (WI.TimelineManager.prototype.heapSnapshotAdded):
     34        (WI.TimelineManager.prototype._loadNewRecording):
     35        (WI.TimelineManager.prototype._legacyAttemptStartAutoCapturingForFrame):
     36        (WI.TimelineManager.prototype._provisionalLoadStarted):
     37        (WI.TimelineManager.prototype._mainResourceDidChange):
     38        (WI.TimelineManager.prototype._resourceWasAdded):
     39        (WI.TimelineManager.prototype._garbageCollected):
     40        (WI.TimelineManager.prototype._memoryPressure):
     41        (WI.TimelineManager.prototype.scriptProfilerTrackingUpdated):
     42        (WI.TimelineManager.prototype.scriptProfilerTrackingCompleted):
     43        (WI.TimelineManager.prototype._updateAutoCaptureInstruments):
     44        (WI.TimelineManager.prototype._handleDOMNodeDidFireEvent):
     45        (WI.TimelineManager.prototype._handleDOMNodePowerEfficientPlaybackStateChanged):
     46        * UserInterface/Models/Instrument.js:
     47        (WI.Instrument.startLegacyTimelineAgent):
     48        (WI.Instrument.stopLegacyTimelineAgent):
     49
     50        * UserInterface/Controllers/HeapManager.js:
     51        (WI.HeapManager): Added.
     52        (WI.HeapManager.prototype.get domains): Added.
     53        (WI.HeapManager.prototype.activateExtraDomain): Added.
     54        (WI.HeapManager.prototype.initializeTarget):
     55        (WI.HeapManager.prototype.enable): Added.
     56        (WI.HeapManager.prototype.disable): Added.
     57        (WI.HeapManager.prototype.snapshot): Added.
     58        (WI.HeapManager.prototype.getPreview): Added.
     59        (WI.HeapManager.prototype.getRemoteObject): Added.
     60        (WI.HeapManager.prototype.garbageCollected):
     61
     62        * UserInterface/Controllers/MemoryManager.js:
     63        (WI.MemoryManager): Added.
     64        (WI.MemoryManager.prototype.get domains): Added.
     65        (WI.MemoryManager.prototype.activateExtraDomain): Added.
     66        (WI.MemoryManager.prototype.initializeTarget):
     67        (WI.MemoryManager.prototype.enable): Added.
     68        (WI.MemoryManager.prototype.disable): Added.
     69        (WI.MemoryManager.prototype.memoryPressure):
     70
     71        * UserInterface/Views/TimelineTabContentView.js:
     72        (WI.TimelineTabContentView):
     73        (WI.TimelineTabContentView.prototype.closed):
     74
     75        * UserInterface/Models/HeapAllocationsInstrument.js:
     76        (WI.HeapAllocationsInstrument):
     77        (WI.HeapAllocationsInstrument.prototype._takeHeapSnapshot):
     78        * UserInterface/Views/HeapAllocationsTimelineView.js:
     79        (WI.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):
     80        * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js:
     81        (WI.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode):
     82        (WI.HeapSnapshotInstanceDataGridNode.prototype._populatePreview):
     83        (WI.HeapSnapshotInstanceDataGridNode.prototype._mouseoverHandler.appendPathRow):
     84        Go through the `HeapManager` for `HeapAgent` commands so it can better manage state.
     85
     86        * UserInterface/Test/Test.js:
     87        (WI.contentLoaded):
     88
    1892019-08-05  Nikita Vasilyev  <nvasilyev@apple.com>
    290
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/HeapManager.js

    r237652 r248286  
    2424 */
    2525
     26// FIXME: HeapManager lacks advanced multi-target support. (Instruments/Profilers per-target)
     27
    2628WI.HeapManager = class HeapManager extends WI.Object
    2729{
     30    constructor()
     31    {
     32        super();
     33
     34        this._enabled = false;
     35    }
     36
     37    // Agent
     38
     39    get domains() { return ["Heap"]; }
     40
     41    activateExtraDomain(domain)
     42    {
     43        console.assert(domain === "Heap");
     44
     45        for (let target of WI.targets)
     46            this.initializeTarget(target);
     47    }
     48
    2849    // Target
    2950
    3051    initializeTarget(target)
    3152    {
     53        if (!this._enabled)
     54            return;
     55
    3256        if (target.HeapAgent)
    3357            target.HeapAgent.enable();
     
    3660    // Public
    3761
     62    enable()
     63    {
     64        if (this._enabled)
     65            return;
     66
     67        this._enabled = true;
     68
     69        for (let target of WI.targets)
     70            this.initializeTarget(target);
     71    }
     72
     73    disable()
     74    {
     75        if (!this._enabled)
     76            return;
     77
     78        for (let target of WI.targets) {
     79            if (target.HeapAgent)
     80                target.HeapAgent.disable();
     81        }
     82
     83        this._enabled = false;
     84    }
     85
     86    snapshot(callback)
     87    {
     88        console.assert(this._enabled);
     89        console.assert(window.HeapAgent);
     90        HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
     91            if (error)
     92                WI.reportInternalError(error);
     93            callback(error, timestamp, snapshotStringData);
     94        });
     95    }
     96
     97    getPreview(node, callback)
     98    {
     99        console.assert(this._enabled);
     100        console.assert(window.HeapAgent);
     101        console.assert(node instanceof WI.HeapSnapshotNodeProxy);
     102        HeapAgent.getPreview(node.id, (error, string, functionDetails, preview) => {
     103            if (error)
     104                WI.reportInternalError(error);
     105            callback(error, string, functionDetails, preview);
     106        });
     107    }
     108
     109    getRemoteObject(node, objectGroup, callback)
     110    {
     111        console.assert(this._enabled);
     112        console.assert(window.HeapAgent);
     113        console.assert(node instanceof WI.HeapSnapshotNodeProxy);
     114        HeapAgent.getRemoteObject(node.id, objectGroup, (error, result) => {
     115            if (error)
     116                WI.reportInternalError(error);
     117            callback(error, result);
     118        });
     119    }
     120
     121    // HeapObserver
     122
    38123    garbageCollected(target, payload)
    39124    {
    40         // Called from WI.HeapObserver.
     125        if (!this._enabled)
     126            return;
    41127
    42128        // FIXME: <https://webkit.org/b/167323> Web Inspector: Enable Memory profiling in Workers
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js

    r237652 r248286  
    2626WI.MemoryManager = class MemoryManager extends WI.Object
    2727{
     28    constructor()
     29    {
     30        super();
     31
     32        this._enabled = false;
     33    }
     34
     35    // Agent
     36
     37    get domains() { return ["Memory"]; }
     38
     39    activateExtraDomain(domain)
     40    {
     41        console.assert(domain === "Memory");
     42
     43        for (let target of WI.targets)
     44            this.initializeTarget(target);
     45    }
     46
    2847    // Target
    2948
    3049    initializeTarget(target)
    3150    {
     51        if (!this._enabled)
     52            return;
     53
    3254        if (target.MemoryAgent)
    3355            target.MemoryAgent.enable();
     
    3658    // Public
    3759
     60    enable()
     61    {
     62        if (this._enabled)
     63            return;
     64
     65        this._enabled = true;
     66
     67        for (let target of WI.targets)
     68            this.initializeTarget(target);
     69    }
     70
     71    disable()
     72    {
     73        if (!this._enabled)
     74            return;
     75
     76        for (let target of WI.targets) {
     77            if (target.MemoryAgent)
     78                target.MemoryAgent.disable();
     79        }
     80
     81        this._enabled = false;
     82    }
     83
     84    // MemoryObserver
     85
    3886    memoryPressure(timestamp, protocolSeverity)
    3987    {
    40         // Called from WI.MemoryObserver.
     88        if (!this._enabled)
     89            return;
    4190
    4291        let memoryPressureEvent = WI.MemoryPressureEvent.fromPayload(timestamp, protocolSeverity);
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js

    r247249 r248286  
    3232        super();
    3333
     34        this._enabled = false;
     35
    3436        WI.Frame.addEventListener(WI.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
    3537        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
     
    6264    }
    6365
     66    // Agent
     67
     68    get domains() { return ["Timeline"]; }
     69
     70    activateExtraDomain(domain)
     71    {
     72        console.assert(domain === "Timeline");
     73
     74        for (let target of WI.targets)
     75            this.initializeTarget(target);
     76    }
     77
    6478    // Target
    6579
    6680    initializeTarget(target)
    6781    {
     82        if (!this._enabled)
     83            return;
     84
    6885        if (target.TimelineAgent) {
     86            // COMPATIBILITY (iOS 13.1): Timeline.enable did not exist.
     87            if (target.TimelineAgent.enable)
     88                target.TimelineAgent.enable();
     89
    6990            this._updateAutoCaptureInstruments([target]);
    7091
     
    155176    reset()
    156177    {
    157         if (this.isCapturing())
     178        if (this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active)
    158179            this.stopCapturing();
    159180
     
    184205    set autoCaptureOnPageLoad(autoCapture)
    185206    {
     207        console.assert(this._enabled);
     208
    186209        autoCapture = !!autoCapture;
    187210
     
    238261    }
    239262
     263    enable()
     264    {
     265        if (this._enabled)
     266            return;
     267
     268        this._enabled = true;
     269
     270        this.reset();
     271
     272        for (let target of WI.targets)
     273            this.initializeTarget(target);
     274    }
     275
     276    disable()
     277    {
     278        if (!this._enabled)
     279            return;
     280
     281        this.reset();
     282
     283        for (let target of WI.targets) {
     284            // COMPATIBILITY (iOS 13.1): Timeline.disable did not exist.
     285            if (target.TimelineAgent && target.TimelineAgent.disable)
     286                target.TimelineAgent.disable();
     287        }
     288
     289        this._enabled = false;
     290    }
     291
    240292    startCapturing(shouldCreateRecording)
    241293    {
     294        console.assert(this._enabled);
     295
    242296        console.assert(this._capturingState === TimelineManager.CapturingState.Stopping || this._capturingState === TimelineManager.CapturingState.Inactive, "TimelineManager is already capturing.");
    243297        if (this._capturingState !== TimelineManager.CapturingState.Stopping && this._capturingState !== TimelineManager.CapturingState.Inactive)
     
    255309    stopCapturing()
    256310    {
     311        console.assert(this._enabled);
     312
    257313        console.assert(this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active, "TimelineManager is not capturing.");
    258314        if (this._capturingState !== TimelineManager.CapturingState.Starting && this._capturingState !== TimelineManager.CapturingState.Active)
     
    296352        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingCreated, {recording: newRecording});
    297353
    298         if (this.isCapturing())
     354        if (this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active)
    299355            this.stopCapturing();
    300356
     
    324380    }
    325381
    326     // Protected
     382    heapSnapshotAdded(timestamp, snapshot)
     383    {
     384        if (!this._enabled)
     385            return;
     386
     387        this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     388    }
     389
     390    // TimelineObserver
    327391
    328392    capturingStarted(startTime)
    329393    {
    330         // Called from WI.TimelineObserver.
    331 
    332394        // The frontend didn't start capturing, so this was a programmatic start.
    333395        if (this._capturingState === TimelineManager.CapturingState.Inactive) {
     
    375437    capturingStopped(endTime)
    376438    {
    377         // Called from WI.TimelineObserver.
    378 
    379439        // The frontend didn't stop capturing, so this was a programmatic stop.
    380440        if (this._capturingState === TimelineManager.CapturingState.Active) {
     
    418478    autoCaptureStarted()
    419479    {
    420         // Called from WI.TimelineObserver.
     480        console.assert(this._enabled);
    421481
    422482        let waitingForCapturingStartedEvent = this._capturingState === TimelineManager.CapturingState.Starting;
    423483
    424         if (this.isCapturing())
     484        if (this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active)
    425485            this.stopCapturing();
    426486
     
    440500    eventRecorded(recordPayload)
    441501    {
    442         // Called from WI.TimelineObserver.
     502        if (!this._enabled)
     503            return;
    443504
    444505        console.assert(this.isCapturing());
     
    483544    }
    484545
     546    // PageObserver
     547
    485548    pageDOMContentLoadedEventFired(timestamp)
    486549    {
    487         // Called from WI.PageObserver.
     550        if (!this._enabled)
     551            return;
    488552
    489553        console.assert(this._activeRecording);
     
    500564    pageLoadEventFired(timestamp)
    501565    {
    502         // Called from WI.PageObserver.
     566        if (!this._enabled)
     567            return;
    503568
    504569        console.assert(this._activeRecording);
     
    515580    }
    516581
     582    // CPUProfilerObserver
     583
    517584    cpuProfilerTrackingStarted(timestamp)
    518585    {
    519         // Called from WI.CPUProfilerObserver.
    520 
    521586        this.capturingStarted(timestamp);
    522587    }
     
    524589    cpuProfilerTrackingUpdated(event)
    525590    {
    526         // Called from WI.CPUProfilerObserver.
     591        if (!this._enabled)
     592            return;
    527593
    528594        console.assert(this.isCapturing());
     
    535601    cpuProfilerTrackingCompleted(timestamp)
    536602    {
    537         // Called from WI.CPUProfilerObserver.
    538 
    539603        this.capturingStopped(timestamp);
    540604    }
    541605
     606    // MemoryObserver
     607
    542608    memoryTrackingStarted(timestamp)
    543609    {
    544         // Called from WI.MemoryObserver.
    545 
    546610        this.capturingStarted(timestamp);
    547611    }
     
    549613    memoryTrackingUpdated(event)
    550614    {
    551         // Called from WI.MemoryObserver.
     615        if (!this._enabled)
     616            return;
    552617
    553618        console.assert(this.isCapturing());
     
    560625    memoryTrackingCompleted(timestamp)
    561626    {
    562         // Called from WI.MemoryObserver.
    563 
    564627        this.capturingStopped(timestamp);
    565628    }
    566629
     630    // HeapObserver
     631
    567632    heapTrackingStarted(timestamp, snapshot)
    568633    {
    569         // Called from WI.HeapObserver.
    570 
    571634        this.capturingStarted(timestamp);
    572635
    573         this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     636        if (this._enabled)
     637            this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    574638    }
    575639
    576640    heapTrackingCompleted(timestamp, snapshot)
    577641    {
    578         // Called from WI.HeapObserver.
    579 
    580         this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
     642        if (this._enabled)
     643            this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    581644
    582645        this.capturingStopped();
    583     }
    584 
    585     heapSnapshotAdded(timestamp, snapshot)
    586     {
    587         // Called from WI.HeapAllocationsInstrument.
    588 
    589         this._addRecord(new WI.HeapAllocationsTimelineRecord(timestamp, snapshot));
    590646    }
    591647
     
    828884        this.dispatchEventToListeners(WI.TimelineManager.Event.RecordingCreated, {recording: newRecording});
    829885
    830         if (this.isCapturing())
     886        if (this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active)
    831887            this.stopCapturing();
    832888
     
    918974        this._isCapturingPageReload = oldMainResource !== null && oldMainResource.url === mainResource.url;
    919975
    920         if (this.isCapturing())
     976        if (this._capturingState === TimelineManager.CapturingState.Starting || this._capturingState === TimelineManager.CapturingState.Active)
    921977            this.stopCapturing();
    922978
     
    9801036    _provisionalLoadStarted(event)
    9811037    {
     1038        if (!this._enabled)
     1039            return;
     1040
    9821041        this._attemptAutoCapturingForFrame(event.target);
    9831042    }
     
    9851044    _mainResourceDidChange(event)
    9861045    {
     1046        if (!this._enabled)
     1047            return;
     1048
    9871049        // Ignore resource events when there isn't a main frame yet. Those events are triggered by
    9881050        // loading the cached resources when the inspector opens, and they do not have timing information.
     
    10171079    _resourceWasAdded(event)
    10181080    {
     1081        if (!this._enabled)
     1082            return;
     1083
    10191084        // Ignore resource events when there isn't a main frame yet. Those events are triggered by
    10201085        // loading the cached resources when the inspector opens, and they do not have timing information.
     
    10271092    _garbageCollected(event)
    10281093    {
     1094        if (!this._enabled)
     1095            return;
     1096
    10291097        let {collection} = event.data;
    10301098        this._addRecord(new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.GarbageCollected, collection.startTime, collection.endTime, null, null, collection));
     
    10331101    _memoryPressure(event)
    10341102    {
     1103        if (!this._enabled)
     1104            return;
     1105
    10351106        this._activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);
    10361107    }
     
    10691140    scriptProfilerTrackingUpdated(event)
    10701141    {
     1142        if (!this._enabled)
     1143            return;
     1144
    10711145        let {startTime, endTime, type} = event;
    10721146        let scriptRecordType = this._scriptProfilerTypeToScriptTimelineRecordType(type);
     
    10851159    scriptProfilerTrackingCompleted(timestamp, samples)
    10861160    {
    1087         console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
    1088 
    1089         if (samples) {
    1090             let {stackTraces} = samples;
    1091             let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
    1092 
    1093             // Calculate a per-sample duration.
    1094             let timestampIndex = 0;
    1095             let timestampCount = stackTraces.length;
    1096             let sampleDurations = new Array(timestampCount);
    1097             let sampleDurationIndex = 0;
    1098             const defaultDuration = 1 / 1000; // 1ms.
    1099             for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
    1100                 let record = this._scriptProfilerRecords[i];
     1161        if (this._enabled) {
     1162            console.assert(!this._webTimelineScriptRecordsExpectingScriptProfilerEvents || this._scriptProfilerRecords.length >= this._webTimelineScriptRecordsExpectingScriptProfilerEvents.length);
     1163
     1164            if (samples) {
     1165                let {stackTraces} = samples;
     1166                let topDownCallingContextTree = this._activeRecording.topDownCallingContextTree;
     1167
     1168                // Calculate a per-sample duration.
     1169                let timestampIndex = 0;
     1170                let timestampCount = stackTraces.length;
     1171                let sampleDurations = new Array(timestampCount);
     1172                let sampleDurationIndex = 0;
     1173                const defaultDuration = 1 / 1000; // 1ms.
     1174                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
     1175                    let record = this._scriptProfilerRecords[i];
     1176
     1177                    // Use a default duration for timestamps recorded outside of ScriptProfiler events.
     1178                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
     1179                        sampleDurations[sampleDurationIndex++] = defaultDuration;
     1180                        timestampIndex++;
     1181                    }
     1182
     1183                    // Average the duration per sample across all samples during the record.
     1184                    let samplesInRecord = 0;
     1185                    while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
     1186                        timestampIndex++;
     1187                        samplesInRecord++;
     1188                    }
     1189                    if (samplesInRecord) {
     1190                        let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
     1191                        sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
     1192                        sampleDurationIndex += samplesInRecord;
     1193                    }
     1194                }
    11011195
    11021196                // Use a default duration for timestamps recorded outside of ScriptProfiler events.
    1103                 while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.startTime) {
    1104                     sampleDurations[sampleDurationIndex++] = defaultDuration;
    1105                     timestampIndex++;
    1106                 }
    1107 
    1108                 // Average the duration per sample across all samples during the record.
    1109                 let samplesInRecord = 0;
    1110                 while (timestampIndex < timestampCount && stackTraces[timestampIndex].timestamp < record.endTime) {
    1111                     timestampIndex++;
    1112                     samplesInRecord++;
    1113                 }
    1114                 if (samplesInRecord) {
    1115                     let averageDuration = (record.endTime - record.startTime) / samplesInRecord;
    1116                     sampleDurations.fill(averageDuration, sampleDurationIndex, sampleDurationIndex + samplesInRecord);
    1117                     sampleDurationIndex += samplesInRecord;
     1197                if (timestampIndex < timestampCount)
     1198                    sampleDurations.fill(defaultDuration, sampleDurationIndex);
     1199
     1200                this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
     1201
     1202                // FIXME: This transformation should not be needed after introducing ProfileView.
     1203                // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
     1204                // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
     1205                for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
     1206                    let record = this._scriptProfilerRecords[i];
     1207                    record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
    11181208                }
    11191209            }
    11201210
    1121             // Use a default duration for timestamps recorded outside of ScriptProfiler events.
    1122             if (timestampIndex < timestampCount)
    1123                 sampleDurations.fill(defaultDuration, sampleDurationIndex);
    1124 
    1125             this._activeRecording.initializeCallingContextTrees(stackTraces, sampleDurations);
    1126 
    1127             // FIXME: This transformation should not be needed after introducing ProfileView.
    1128             // Once we eliminate ProfileNodeTreeElements and ProfileNodeDataGridNodes.
    1129             // <https://webkit.org/b/154973> Web Inspector: Timelines UI redesign: Remove TimelineSidebarPanel
    1130             for (let i = 0; i < this._scriptProfilerRecords.length; ++i) {
    1131                 let record = this._scriptProfilerRecords[i];
    1132                 record.profilePayload = topDownCallingContextTree.toCPUProfilePayload(record.startTime, record.endTime);
     1211            // Associate the ScriptProfiler created records with Web Timeline records.
     1212            // Filter out the already added ScriptProfiler events which should not have been wrapped.
     1213            if (WI.sharedApp.debuggableType !== WI.DebuggableType.JavaScript) {
     1214                this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
     1215                this._mergeScriptProfileRecords();
    11331216            }
    1134         }
    1135 
    1136         // Associate the ScriptProfiler created records with Web Timeline records.
    1137         // Filter out the already added ScriptProfiler events which should not have been wrapped.
    1138         if (WI.sharedApp.debuggableType !== WI.DebuggableType.JavaScript) {
    1139             this._scriptProfilerRecords = this._scriptProfilerRecords.filter((x) => x.__scriptProfilerType === ScriptProfilerAgent.EventType.Other);
    1140             this._mergeScriptProfileRecords();
    1141         }
    1142 
    1143         this._scriptProfilerRecords = null;
    1144 
    1145         let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
    1146         timeline.refresh();
     1217
     1218            this._scriptProfilerRecords = null;
     1219
     1220            let timeline = this._activeRecording.timelineForRecordType(WI.TimelineRecord.Type.Script);
     1221            timeline.refresh();
     1222        }
    11471223
    11481224        this.capturingStopped(timestamp);
     
    12071283    _updateAutoCaptureInstruments(targets)
    12081284    {
     1285        console.assert(this._enabled);
     1286
    12091287        let enabledTimelineTypes = this.enabledTimelineTypes;
    12101288
     
    12451323    _handleDOMNodeDidFireEvent(event)
    12461324    {
     1325        if (!this._enabled)
     1326            return;
     1327
    12471328        let {domEvent} = event.data;
    12481329
     
    12551336    _handleDOMNodePowerEfficientPlaybackStateChanged(event)
    12561337    {
     1338        if (!this._enabled)
     1339            return;
     1340
    12571341        let {timestamp, isPowerEfficient} = event.data;
    12581342
  • trunk/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js

    r241219 r248286  
    7676    _takeHeapSnapshot()
    7777    {
    78         HeapAgent.snapshot(function(error, timestamp, snapshotStringData) {
     78        WI.heapManager.snapshot((error, timestamp, snapshotStringData) => {
    7979            let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
    8080            workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
  • trunk/Source/WebInspectorUI/UserInterface/Models/Instrument.js

    r240457 r248286  
    5555    static startLegacyTimelineAgent(initiatedByBackend)
    5656    {
     57        console.assert(WI.timelineManager._enabled);
    5758        console.assert(window.TimelineAgent, "Attempted to start legacy timeline agent without TimelineAgent.");
    5859
     
    7071    static stopLegacyTimelineAgent(initiatedByBackend)
    7172    {
     73        console.assert(WI.timelineManager._enabled);
     74        console.assert(window.TimelineAgent, "Attempted to stop legacy timeline agent without TimelineAgent.");
     75
    7276        if (!WI.Instrument._legacyTimelineAgentStarted)
    7377            return;
  • trunk/Source/WebInspectorUI/UserInterface/Test/Test.js

    r248179 r248286  
    135135    WI.applicationCacheManager.enable();
    136136    WI.canvasManager.enable();
     137    WI.databaseManager.enable();
    137138    WI.domStorageManager.enable();
    138     WI.databaseManager.enable();
     139    WI.heapManager.enable();
    139140    WI.indexedDBManager.enable();
     141    WI.memoryManager.enable();
     142    WI.timelineManager.enable();
    140143
    141144    // Signal that the frontend is now ready to receive messages.
  • trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js

    r248198 r248286  
    409409    _takeHeapSnapshotClicked()
    410410    {
    411         HeapAgent.snapshot((error, timestamp, snapshotStringData) => {
     411        WI.heapManager.snapshot((error, timestamp, snapshotStringData) => {
    412412            let workerProxy = WI.HeapSnapshotWorkerProxy.singleton();
    413413            workerProxy.createSnapshot(snapshotStringData, ({objectId, snapshot: serializedSnapshot}) => {
  • trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotInstanceDataGridNode.js

    r244275 r248286  
    8282
    8383            if (node.className === "string") {
    84                 HeapAgent.getPreview(node.id, function(error, string, functionDetails, objectPreviewPayload) {
     84                WI.heapManager.getPreview(node, function(error, string, functionDetails, objectPreviewPayload) {
    8585                    let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPrimitiveValue(string);
    8686                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass, shouldRevealConsole);
    8787                });
    8888            } else {
    89                 HeapAgent.getRemoteObject(node.id, WI.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
     89                WI.heapManager.getRemoteObject(node, WI.RuntimeManager.ConsoleObjectGroup, function(error, remoteObjectPayload) {
    9090                    let remoteObject = error ? WI.RemoteObject.fromPrimitiveValue(undefined) : WI.RemoteObject.fromPayload(remoteObjectPayload, WI.assumingMainTarget());
    9191                    WI.consoleLogViewController.appendImmediateExecutionWithResult(text, remoteObject, addSpecialUserLogClass, shouldRevealConsole);
     
    266266    _populateWindowPreview(containerElement)
    267267    {
    268         HeapAgent.getRemoteObject(this._node.id, (error, remoteObjectPayload) => {
     268        const objectGroup = undefined;
     269        WI.heapManager.getRemoteObject(this._node, objectGroup, (error, remoteObjectPayload) => {
    269270            if (error) {
    270271                this._populateError(containerElement);
     
    292293    _populatePreview(containerElement)
    293294    {
    294         HeapAgent.getPreview(this._node.id, (error, string, functionDetails, objectPreviewPayload) => {
     295        WI.heapManager.getPreview(this._node, (error, string, functionDetails, objectPreviewPayload) => {
    295296            if (error) {
    296297                this._populateError(containerElement);
     
    429430                goToArrowPlaceHolderElement.style.display = "inline-block";
    430431                goToArrowPlaceHolderElement.style.width = "10px";
    431                 HeapAgent.getPreview(node.id, function(error, string, functionDetails, objectPreviewPayload) {
     432                WI.heapManager.getPreview(node, function(error, string, functionDetails, objectPreviewPayload) {
    432433                    if (functionDetails) {
    433434                        let location = functionDetails.location;
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js

    r248198 r248286  
    9292        // Explicitly update the path for the navigation bar to prevent it from showing up as blank.
    9393        this.contentBrowser.updateHierarchicalPathForCurrentContentView();
     94
     95        WI.heapManager.enable();
     96        WI.memoryManager.enable();
     97        WI.timelineManager.enable();
    9498    }
    9599
     
    328332    closed()
    329333    {
    330         super.closed();
     334        WI.timelineManager.disable();
     335        WI.memoryManager.disable();
     336        WI.heapManager.disable();
    331337
    332338        if (WI.FPSInstrument.supported())
     
    335341        WI.timelineManager.removeEventListener(null, null, this);
    336342        WI.notifications.removeEventListener(null, null, this);
     343
     344        super.closed();
    337345    }
    338346
Note: See TracChangeset for help on using the changeset viewer.