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

Changeset 185777 in webkit


Ignore:
Timestamp:
Jun 19, 2015, 4:35:53 PM (11 years ago)
Author:
Matt Baker
Message:

Web Inspector: TimelineAgent needs to handle nested runloops
https://bugs.webkit.org/show_bug.cgi?id=145090

Reviewed by Joseph Pecoraro.

Source/WebCore:

Previously nested run loops caused InspectorTimelineAgent to prematurely pop the current run loop record. This
patch adds a counter to track the run loop nesting level, and rendering frame records are only pushed/popped
when the nesting level is zero. Run loop entry/exit notifications received while the debugger is paused do not
affect the nesting level.

  • inspector/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::InspectorTimelineAgent):

  • inspector/InspectorTimelineAgent.h:

LayoutTests:

Unskip tests after improvements to nested runloop handling in InspectorTimelineAgent.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r185769 r185777  
     12015-06-19  Matt Baker  <mattbaker@apple.com>
     2
     3        Web Inspector: TimelineAgent needs to handle nested runloops
     4        https://bugs.webkit.org/show_bug.cgi?id=145090
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * TestExpectations:
     9        Unskip tests after improvements to nested runloop handling in InspectorTimelineAgent.
     10
    1112015-06-19  Andy Estes  <aestes@apple.com>
    212
  • trunk/LayoutTests/TestExpectations

    r185718 r185777  
    525525webkit.org/b/145390 storage/indexeddb/deleteIndex-bug110792.html [ Pass Failure ]
    526526
    527 webkit.org/b/145090 inspector/debugger/break-on-exception.html [ Skip ]
    528 webkit.org/b/145090 inspector/debugger/break-on-exception-catch.html [ Skip ]
    529 webkit.org/b/145090 inspector/debugger/break-on-exception-finally.html [ Skip ]
    530 webkit.org/b/145090 inspector/debugger/break-on-exception-native.html [ Skip ]
    531 webkit.org/b/145090 inspector/debugger/break-on-exception-throw-in-promise.html [ Skip ]
    532 webkit.org/b/145090 inspector/debugger/break-on-exception-throw-in-promise-with-catch.html [ Skip ]
    533 webkit.org/b/145090 inspector/debugger/break-on-exception-throw-in-promise-then.html [ Skip ]
    534 webkit.org/b/145090 inspector/debugger/break-on-exception-throw-in-promise-then-with-catch.html [ Skip ]
    535 webkit.org/b/145090 inspector/debugger/break-on-exception-throw-in-promise-rethrow-in-catch.html [ Skip ]
    536 webkit.org/b/145090 inspector/debugger/break-on-exception-window-onerror.html [ Skip ]
    537 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception.html [ Skip ]
    538 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-catch.html [ Skip ]
    539 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-finally.html [ Skip ]
    540 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-native.html [ Skip ]
    541 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise.html [ Skip ]
    542 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise-with-catch.html [ Skip ]
    543 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise-then.html [ Skip ]
    544 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise-then-with-catch.html [ Skip ]
    545 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-throw-in-promise-rethrow-in-catch.html [ Skip ]
    546 webkit.org/b/145090 inspector/debugger/break-on-uncaught-exception-window-onerror.html [ Skip ]
    547 
    548527# DumpRenderTree does not allow GIFs to animate, thus animated GIF tests don't work in WebKit1.
    549528fast/images/animated-gif-no-layout.html [ ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r185776 r185777  
     12015-06-19  Matt Baker  <mattbaker@apple.com>
     2
     3        Web Inspector: TimelineAgent needs to handle nested runloops
     4        https://bugs.webkit.org/show_bug.cgi?id=145090
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Previously nested run loops caused InspectorTimelineAgent to prematurely pop the current run loop record. This
     9        patch adds a counter to track the run loop nesting level, and rendering frame records are only pushed/popped
     10        when the nesting level is zero. Run loop entry/exit notifications received while the debugger is paused do not
     11        affect the nesting level.
     12
     13        * inspector/InspectorTimelineAgent.cpp:
     14        (WebCore::InspectorTimelineAgent::internalStart):
     15        (WebCore::InspectorTimelineAgent::internalStop):
     16        (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
     17        * inspector/InspectorTimelineAgent.h:
     18
    1192015-06-19  Brent Fulgham  <bfulgham@apple.com>
    220
  • trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp

    r185278 r185777  
    141141        m_maxCallStackDepth = 5;
    142142
    143     m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->start();
     143    // If the debugger is paused the environment's stopwatch will be stopped, and shouldn't be
     144    // restarted until the debugger continues.
     145    if (!m_scriptDebugServer->isPaused())
     146        m_instrumentingAgents->inspectorEnvironment().executionStopwatch()->start();
    144147
    145148    m_instrumentingAgents->setInspectorTimelineAgent(this);
     
    154157#if PLATFORM(COCOA)
    155158    m_frameStartObserver = RunLoopObserver::create(0, [this]() {
    156         if (!m_enabled || m_didStartRecordingRunLoop)
     159        if (!m_enabled || m_scriptDebugServer->isPaused())
    157160            return;
    158161
    159         pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RenderingFrame, false, nullptr);
    160         m_didStartRecordingRunLoop = true;
     162        if (!m_runLoopNestingLevel)
     163            pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RenderingFrame, false, nullptr);
     164        m_runLoopNestingLevel++;
    161165    });
    162166
    163167    m_frameStopObserver = RunLoopObserver::create(frameStopRunLoopOrder, [this]() {
    164         if (!m_enabled || !m_didStartRecordingRunLoop)
     168        if (!m_enabled || m_scriptDebugServer->isPaused())
    165169            return;
    166170
    167         didCompleteCurrentRecord(TimelineRecordType::RenderingFrame);
    168         m_didStartRecordingRunLoop = false;
     171        ASSERT(m_runLoopNestingLevel > 0);
     172        m_runLoopNestingLevel--;
     173        if (!m_runLoopNestingLevel)
     174            didCompleteCurrentRecord(TimelineRecordType::RenderingFrame);
    169175    });
    170176
    171     m_frameStartObserver->schedule(currentRunLoop(), kCFRunLoopAfterWaiting | kCFRunLoopBeforeTimers);
    172     m_frameStopObserver->schedule(currentRunLoop(), kCFRunLoopBeforeWaiting | kCFRunLoopExit);
    173 
    174     // Create a runloop record immediately in order to capture the rest of the current runloop.
     177    m_frameStartObserver->schedule(currentRunLoop(), kCFRunLoopEntry | kCFRunLoopAfterWaiting);
     178    m_frameStopObserver->schedule(currentRunLoop(), kCFRunLoopExit | kCFRunLoopBeforeWaiting);
     179
     180    // Create a runloop record and increment the runloop nesting level, to capture the current turn of the main runloop
     181    // (which is the outer runloop if recording started while paused in the debugger).
    175182    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RenderingFrame, false, nullptr);
    176     m_didStartRecordingRunLoop = true;
     183
     184    m_runLoopNestingLevel = 1;
    177185#endif
    178186
     
    199207    m_frameStartObserver = nullptr;
    200208    m_frameStopObserver = nullptr;
    201     if (m_didStartRecordingRunLoop) {
    202         m_didStartRecordingRunLoop = false;
    203 
    204         // Complete all pending records to prevent discarding events that are currently in progress.
    205         while (!m_recordStack.isEmpty())
    206             didCompleteCurrentRecord(m_recordStack.last().type);
    207     }
     209    m_runLoopNestingLevel = 0;
     210
     211    // Complete all pending records to prevent discarding events that are currently in progress.
     212    while (!m_recordStack.isEmpty())
     213        didCompleteCurrentRecord(m_recordStack.last().type);
    208214#endif
    209215
     
    723729    , m_enabled(false)
    724730    , m_enabledFromFrontend(false)
    725     , m_didStartRecordingRunLoop(false)
     731    , m_runLoopNestingLevel(0)
    726732{
    727733}
  • trunk/Source/WebCore/inspector/InspectorTimelineAgent.h

    r182660 r185777  
    252252    std::unique_ptr<WebCore::RunLoopObserver> m_frameStopObserver;
    253253#endif
    254     bool m_didStartRecordingRunLoop;
     254    int m_runLoopNestingLevel;
    255255};
    256256
Note: See TracChangeset for help on using the changeset viewer.