Changeset 181625 in webkit
- Timestamp:
- Mar 17, 2015, 1:41:19 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/protocol/Timeline.json (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/inspector/InspectorTimelineAgent.cpp (modified) (5 diffs)
-
WebCore/inspector/InspectorTimelineAgent.h (modified) (3 diffs)
-
WebCore/platform/cf/RunLoopObserver.cpp (modified) (2 diffs)
-
WebCore/platform/cf/RunLoopObserver.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r181618 r181625 1 2015-03-17 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Show rendering frames (and FPS) in Layout and Rendering timeline 4 https://bugs.webkit.org/show_bug.cgi?id=142029 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/protocol/Timeline.json: 9 Added new event type for runloop timeline records. 10 1 11 2015-03-16 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json
r178371 r181625 14 14 "Layout", 15 15 "Paint", 16 "RunLoop", 16 17 "ScrollLayer", 17 18 "ParseHTML", -
trunk/Source/WebCore/ChangeLog
r181624 r181625 1 2015-03-17 Matt Baker <mattbaker@apple.com> 2 3 Web Inspector: Show rendering frames (and FPS) in Layout and Rendering timeline 4 https://bugs.webkit.org/show_bug.cgi?id=142029 5 6 Reviewed by Timothy Hatcher. 7 8 Add new functionality to the Inspector timelines backend to add runloop data to timeline recordings. 9 10 * inspector/InspectorTimelineAgent.cpp: 11 (WebCore::currentRunLoop): 12 (WebCore::InspectorTimelineAgent::internalStart): 13 (WebCore::InspectorTimelineAgent::internalStop): 14 (WebCore::toProtocol): 15 (WebCore::InspectorTimelineAgent::InspectorTimelineAgent): 16 Install observers for the begining and end of the runloop when recording begins. All other 17 instrumented timeline events get added as children of the current runloop record, which is 18 sent to the frontend once the runloop completes. 19 20 * inspector/InspectorTimelineAgent.h: 21 22 * platform/cf/RunLoopObserver.cpp: 23 (WebCore::RunLoopObserver::schedule): 24 Wrapper changed to allow observing arbitrary runloop activities. 25 26 * platform/cf/RunLoopObserver.h: 27 1 28 2015-03-17 Philippe Normand <pnormand@igalia.com> 2 29 -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp
r180901 r181625 55 55 #include <wtf/CurrentTime.h> 56 56 57 #if PLATFORM(IOS) 58 #include "RuntimeApplicationChecksIOS.h" 59 #include <WebCore/WebCoreThread.h> 60 #endif 61 62 #if PLATFORM(COCOA) 63 #include <WebCore/RunLoopObserver.h> 64 #endif 65 57 66 using namespace Inspector; 58 67 59 68 namespace WebCore { 69 70 #if PLATFORM(COCOA) 71 static const CFIndex frameStopRunLoopOrder = (CFIndex)RunLoopObserver::WellKnownRunLoopOrders::CoreAnimationCommit + 1; 72 73 static CFRunLoopRef currentRunLoop() 74 { 75 #if PLATFORM(IOS) 76 // A race condition during WebView deallocation can lead to a crash if the layer sync run loop 77 // observer is added to the main run loop <rdar://problem/9798550>. However, for responsiveness, 78 // we still allow this, see <rdar://problem/7403328>. Since the race condition and subsequent 79 // crash are especially troublesome for iBooks, we never allow the observer to be added to the 80 // main run loop in iBooks. 81 if (applicationIsIBooksOnIOS()) 82 return WebThreadRunLoop(); 83 #endif 84 return CFRunLoopGetCurrent(); 85 } 86 #endif 60 87 61 88 InspectorTimelineAgent::~InspectorTimelineAgent() … … 123 150 m_enabled = true; 124 151 152 // FIXME: Abstract away platform-specific code once https://bugs.webkit.org/show_bug.cgi?id=142748 is fixed. 153 154 #if PLATFORM(COCOA) 155 m_frameStartObserver = RunLoopObserver::create(0, [this]() { 156 if (!m_enabled || m_didStartRecordingRunLoop) 157 return; 158 159 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RunLoop, false, nullptr); 160 m_didStartRecordingRunLoop = true; 161 }); 162 163 m_frameStopObserver = RunLoopObserver::create(frameStopRunLoopOrder, [this]() { 164 if (!m_enabled || !m_didStartRecordingRunLoop) 165 return; 166 167 didCompleteCurrentRecord(TimelineRecordType::RunLoop); 168 m_didStartRecordingRunLoop = false; 169 }); 170 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. 175 pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RunLoop, false, nullptr); 176 m_didStartRecordingRunLoop = true; 177 #endif 178 125 179 if (m_frontendDispatcher) 126 180 m_frontendDispatcher->recordingStarted(); … … 141 195 if (m_scriptDebugServer) 142 196 m_scriptDebugServer->removeListener(this, true); 197 198 #if PLATFORM(COCOA) 199 m_frameStartObserver = nullptr; 200 m_frameStopObserver = nullptr; 201 #endif 143 202 144 203 clearRecordStack(); … … 540 599 case TimelineRecordType::Paint: 541 600 return Inspector::Protocol::Timeline::EventType::Paint; 601 case TimelineRecordType::RunLoop: 602 return Inspector::Protocol::Timeline::EventType::RunLoop; 542 603 case TimelineRecordType::ScrollLayer: 543 604 return Inspector::Protocol::Timeline::EventType::ScrollLayer; … … 655 716 , m_enabled(false) 656 717 , m_enabledFromFrontend(false) 718 , m_didStartRecordingRunLoop(false) 657 719 { 658 720 } -
trunk/Source/WebCore/inspector/InspectorTimelineAgent.h
r180116 r181625 62 62 class ResourceRequest; 63 63 class ResourceResponse; 64 class RunLoopObserver; 64 65 65 66 typedef String ErrorString; … … 72 73 Layout, 73 74 Paint, 75 RunLoop, 74 76 ScrollLayer, 75 77 … … 245 247 bool m_enabled; 246 248 bool m_enabledFromFrontend; 249 250 #if PLATFORM(COCOA) 251 std::unique_ptr<WebCore::RunLoopObserver> m_frameStartObserver; 252 std::unique_ptr<WebCore::RunLoopObserver> m_frameStopObserver; 253 #endif 254 bool m_didStartRecordingRunLoop; 247 255 }; 248 256 -
trunk/Source/WebCore/platform/cf/RunLoopObserver.cpp
r169775 r181625 50 50 } 51 51 52 void RunLoopObserver::schedule(CFRunLoopRef runLoop )52 void RunLoopObserver::schedule(CFRunLoopRef runLoop, CFRunLoopActivity activity) 53 53 { 54 54 if (!runLoop) … … 62 62 63 63 CFRunLoopObserverContext context = { 0, this, 0, 0, 0 }; 64 m_runLoopObserver = adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, m_order, runLoopObserverFired, &context));64 m_runLoopObserver = adoptCF(CFRunLoopObserverCreate(0, activity, true, m_order, runLoopObserverFired, &context)); 65 65 66 66 CFRunLoopAddObserver(runLoop, m_runLoopObserver.get(), kCFRunLoopCommonModes); -
trunk/Source/WebCore/platform/cf/RunLoopObserver.h
r172849 r181625 43 43 WEBCORE_EXPORT ~RunLoopObserver(); 44 44 45 WEBCORE_EXPORT void schedule(CFRunLoopRef = nullptr );45 WEBCORE_EXPORT void schedule(CFRunLoopRef = nullptr, CFRunLoopActivity = kCFRunLoopBeforeWaiting | kCFRunLoopExit); 46 46 WEBCORE_EXPORT void invalidate(); 47 47
Note:
See TracChangeset
for help on using the changeset viewer.