Changeset 239397 in webkit
- Timestamp:
- Dec 19, 2018, 3:17:31 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/protocol/Timeline.json (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/MutationObserver.cpp (modified) (2 diffs)
-
WebCore/en.lproj/Localizable.strings (modified) (2 diffs)
-
WebCore/inspector/InspectorInstrumentation.cpp (modified) (1 diff)
-
WebCore/inspector/InspectorInstrumentation.h (modified) (4 diffs)
-
WebCore/inspector/TimelineRecordFactory.cpp (modified) (1 diff)
-
WebCore/inspector/TimelineRecordFactory.h (modified) (1 diff)
-
WebCore/inspector/agents/InspectorTimelineAgent.cpp (modified) (2 diffs)
-
WebCore/inspector/agents/InspectorTimelineAgent.h (modified) (2 diffs)
-
WebCore/page/IntersectionObserver.cpp (modified) (2 diffs)
-
WebCore/page/PerformanceObserver.cpp (modified) (2 diffs)
-
WebInspectorUI/ChangeLog (modified) (1 diff)
-
WebInspectorUI/Localizations/en.lproj/localizedStrings.js (modified) (4 diffs)
-
WebInspectorUI/UserInterface/Controllers/TimelineManager.js (modified) (3 diffs)
-
WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js (modified) (2 diffs)
-
WebInspectorUI/UserInterface/Views/TimelineTabContentView.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r239392 r239397 1 2018-12-18 Simon Fraser <simon.fraser@apple.com> 2 3 Web Inspector: Timelines: correctly label Intersection Observer callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=192669 5 <rdar://problem/46702490> 6 7 Reviewed by Joseph Pecoraro. 8 9 Add InspectorInstrumentation::willFireObserverCallback() and use it to wrap calls 10 to Intersection Observer, Performance Observer and Mutation Observer callbacks so 11 that they get correctly labeled in the Inspector timeline. 12 13 * inspector/protocol/Timeline.json: 14 1 15 2018-12-18 Mark Lam <mark.lam@apple.com> 2 16 -
trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json
r224634 r239397 29 29 "RequestAnimationFrame", 30 30 "CancelAnimationFrame", 31 "FireAnimationFrame" 31 "FireAnimationFrame", 32 "ObserverCallback" 32 33 ] 33 34 }, -
trunk/Source/WebCore/ChangeLog
r239395 r239397 1 2018-12-18 Simon Fraser <simon.fraser@apple.com> 2 3 Web Inspector: Timelines: correctly label Intersection Observer callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=192669 5 <rdar://problem/46702490> 6 7 Reviewed by Joseph Pecoraro. 8 9 Add InspectorInstrumentation::willFireObserverCallback() and use it to wrap calls 10 to Intersection Observer, Performance Observer and Mutation Observer callbacks so 11 that they get correctly labeled in the Inspector timeline. 12 13 * dom/MutationObserver.cpp: 14 (WebCore::MutationObserver::deliver): 15 * en.lproj/Localizable.strings: 16 * inspector/InspectorInstrumentation.cpp: 17 (WebCore::InspectorInstrumentation::willFireObserverCallbackImpl): 18 (WebCore::InspectorInstrumentation::didFireObserverCallbackImpl): 19 * inspector/InspectorInstrumentation.h: 20 (WebCore::InspectorInstrumentation::willFireObserverCallback): 21 (WebCore::InspectorInstrumentation::didFireObserverCallback): 22 * inspector/TimelineRecordFactory.cpp: 23 (WebCore::TimelineRecordFactory::createObserverCallbackData): 24 * inspector/TimelineRecordFactory.h: 25 * inspector/agents/InspectorTimelineAgent.cpp: 26 (WebCore::InspectorTimelineAgent::willFireObserverCallback): 27 (WebCore::InspectorTimelineAgent::didFireObserverCallback): 28 (WebCore::toProtocol): 29 * inspector/agents/InspectorTimelineAgent.h: 30 * page/IntersectionObserver.cpp: 31 (WebCore::IntersectionObserver::notify): 32 * page/PerformanceObserver.cpp: 33 (WebCore::PerformanceObserver::deliver): 34 1 35 2018-12-19 Claudio Saavedra <csaavedra@igalia.com> 2 36 -
trunk/Source/WebCore/dom/MutationObserver.cpp
r236825 r239397 37 37 #include "GCReachableRef.h" 38 38 #include "HTMLSlotElement.h" 39 #include "InspectorInstrumentation.h" 39 40 #include "Microtasks.h" 40 41 #include "MutationCallback.h" … … 245 246 246 247 // FIXME: Keep mutation observer callback as long as its observed nodes are alive. See https://webkit.org/b/179224. 247 if (m_callback->hasCallback()) 248 if (m_callback->hasCallback()) { 249 auto* context = m_callback->scriptExecutionContext(); 250 if (!context) 251 return; 252 253 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "MutationObserver"_s); 248 254 m_callback->handleEvent(*this, records, *this); 255 InspectorInstrumentation::didFireObserverCallback(cookie); 256 } 249 257 } 250 258 -
trunk/Source/WebCore/en.lproj/Localizable.strings
r239015 r239397 647 647 "Show Controls" = "Show Controls"; 648 648 649 /* Action from safe browsing warning */ 650 "Show Details" = "Show Details"; 651 649 652 /* Show fonts context menu item */ 650 653 "Show Fonts" = "Show Fonts"; … … 656 659 "Show Substitutions" = "Show Substitutions"; 657 660 658 /* Action from safe browsing warning */659 "Show Details" = "Show Details";660 661 661 /* Title of the context menu item to show when PDFPlugin was used instead of a blocked plugin */ 662 662 "Show in blocked plug-in" = "Show in blocked plug-in"; -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r238570 r239397 1100 1100 } 1101 1101 1102 InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallbackImpl(InstrumentingAgents& instrumentingAgents, const String& callbackType, ScriptExecutionContext& context) 1103 { 1104 int timelineAgentId = 0; 1105 if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent()) { 1106 timelineAgent->willFireObserverCallback(callbackType, frameForScriptExecutionContext(&context)); 1107 timelineAgentId = timelineAgent->id(); 1108 } 1109 return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId); 1110 } 1111 1112 void InspectorInstrumentation::didFireObserverCallbackImpl(const InspectorInstrumentationCookie& cookie) 1113 { 1114 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) 1115 timelineAgent->didFireObserverCallback(); 1116 } 1117 1102 1118 void InspectorInstrumentation::registerInstrumentingAgents(InstrumentingAgents& instrumentingAgents) 1103 1119 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r238771 r239397 236 236 static void didFireAnimationFrame(const InspectorInstrumentationCookie&); 237 237 238 static InspectorInstrumentationCookie willFireObserverCallback(ScriptExecutionContext&, const String& callbackType); 239 static void didFireObserverCallback(const InspectorInstrumentationCookie&); 240 238 241 static void didOpenDatabase(ScriptExecutionContext*, RefPtr<Database>&&, const String& domain, const String& name, const String& version); 239 242 … … 408 411 static void didFireAnimationFrameImpl(const InspectorInstrumentationCookie&); 409 412 413 static InspectorInstrumentationCookie willFireObserverCallbackImpl(InstrumentingAgents&, const String&, ScriptExecutionContext&); 414 static void didFireObserverCallbackImpl(const InspectorInstrumentationCookie&); 415 410 416 static void didOpenDatabaseImpl(InstrumentingAgents&, RefPtr<Database>&&, const String& domain, const String& name, const String& version); 411 417 … … 1411 1417 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrame(Document& document, int callbackId) 1412 1418 { 1419 FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); 1413 1420 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) 1414 1421 return willFireAnimationFrameImpl(*instrumentingAgents, callbackId, document); … … 1421 1428 if (cookie.isValid()) 1422 1429 didFireAnimationFrameImpl(cookie); 1430 } 1431 1432 inline InspectorInstrumentationCookie InspectorInstrumentation::willFireObserverCallback(ScriptExecutionContext& context, const String& callbackType) 1433 { 1434 FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie()); 1435 if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context)) 1436 return willFireObserverCallbackImpl(*instrumentingAgents, callbackType, context); 1437 return InspectorInstrumentationCookie(); 1438 } 1439 1440 inline void InspectorInstrumentation::didFireObserverCallback(const InspectorInstrumentationCookie& cookie) 1441 { 1442 FAST_RETURN_IF_NO_FRONTENDS(void()); 1443 if (cookie.isValid()) 1444 didFireObserverCallbackImpl(cookie); 1423 1445 } 1424 1446 -
trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp
r234586 r239397 126 126 } 127 127 128 Ref<JSON::Object> TimelineRecordFactory::createObserverCallbackData(const String& callbackType) 129 { 130 Ref<JSON::Object> data = JSON::Object::create(); 131 data->setString("type"_s, callbackType); 132 return data; 133 } 134 128 135 static Ref<JSON::Array> createQuad(const FloatQuad& quad) 129 136 { -
trunk/Source/WebCore/inspector/TimelineRecordFactory.h
r225231 r239397 59 59 static Ref<JSON::Object> createTimeStampData(const String&); 60 60 static Ref<JSON::Object> createAnimationFrameData(int callbackId); 61 static Ref<JSON::Object> createObserverCallbackData(const String& callbackType); 61 62 static Ref<JSON::Object> createPaintData(const FloatQuad&); 62 63 -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
r239266 r239397 598 598 } 599 599 600 void InspectorTimelineAgent::willFireObserverCallback(const String& callbackType, Frame* frame) 601 { 602 pushCurrentRecord(TimelineRecordFactory::createObserverCallbackData(callbackType), TimelineRecordType::ObserverCallback, false, frame); 603 } 604 605 void InspectorTimelineAgent::didFireObserverCallback() 606 { 607 didCompleteCurrentRecord(TimelineRecordType::ObserverCallback); 608 } 609 600 610 // ScriptDebugListener 601 611 … … 655 665 case TimelineRecordType::FireAnimationFrame: 656 666 return Inspector::Protocol::Timeline::EventType::FireAnimationFrame; 667 668 case TimelineRecordType::ObserverCallback: 669 return Inspector::Protocol::Timeline::EventType::ObserverCallback; 657 670 } 658 671 -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h
r228600 r239397 84 84 CancelAnimationFrame, 85 85 FireAnimationFrame, 86 87 ObserverCallback, 86 88 }; 87 89 … … 138 140 void willFireAnimationFrame(int callbackId, Frame*); 139 141 void didFireAnimationFrame(); 142 void willFireObserverCallback(const String& callbackType, Frame*); 143 void didFireObserverCallback(); 140 144 void time(Frame&, const String&); 141 145 void timeEnd(Frame&, const String&); -
trunk/Source/WebCore/page/IntersectionObserver.cpp
r238610 r239397 33 33 #include "CSSTokenizer.h" 34 34 #include "Element.h" 35 #include "InspectorInstrumentation.h" 35 36 #include "IntersectionObserverCallback.h" 36 37 #include "IntersectionObserverEntry.h" … … 257 258 } 258 259 260 auto* context = m_callback->scriptExecutionContext(); 261 if (!context) 262 return; 263 264 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "IntersectionObserver"_s); 265 259 266 auto takenRecords = takeRecords(); 260 267 m_callback->handleEvent(WTFMove(takenRecords.records), *this); 268 269 InspectorInstrumentation::didFireObserverCallback(cookie); 261 270 } 262 271 -
trunk/Source/WebCore/page/PerformanceObserver.cpp
r237228 r239397 29 29 #include "DOMWindow.h" 30 30 #include "Document.h" 31 #include "InspectorInstrumentation.h" 31 32 #include "Performance.h" 32 33 #include "PerformanceObserverEntryList.h" … … 101 102 return; 102 103 104 auto* context = m_callback->scriptExecutionContext(); 105 if (!context) 106 return; 107 103 108 Vector<RefPtr<PerformanceEntry>> entries = WTFMove(m_entriesToDeliver); 104 109 auto list = PerformanceObserverEntryList::create(WTFMove(entries)); 110 111 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireObserverCallback(*context, "PerformanceObserver"_s); 105 112 m_callback->handleEvent(list, *this); 113 InspectorInstrumentation::didFireObserverCallback(cookie); 106 114 } 107 115 -
trunk/Source/WebInspectorUI/ChangeLog
r239394 r239397 1 2018-12-18 Simon Fraser <simon.fraser@apple.com> 2 3 Web Inspector: Timelines: correctly label Intersection Observer callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=192669 5 <rdar://problem/46702490> 6 7 Reviewed by Joseph Pecoraro. 8 9 Add InspectorInstrumentation::willFireObserverCallback() and use it to wrap calls 10 to Intersection Observer, Performance Observer and Mutation Observer callbacks so 11 that they get correctly labeled in the Inspector timeline. 12 13 * Localizations/en.lproj/localizedStrings.js: 14 * UserInterface/Controllers/TimelineManager.js: 15 (WI.TimelineManager.prototype._processRecord): 16 * UserInterface/Models/ScriptTimelineRecord.js: 17 (WI.ScriptTimelineRecord.EventType.displayName): 18 * UserInterface/Views/TimelineTabContentView.js: 19 (WI.TimelineTabContentView.iconClassNameForRecord): 20 1 21 2018-12-19 Devin Rousso <drousso@apple.com> 2 22 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r239286 r239397 46 46 localizedStrings["%s (default)"] = "%s (default)"; 47 47 localizedStrings["%s (hidden)"] = "%s (hidden)"; 48 localizedStrings["%s Callback"] = "%s Callback"; 48 49 localizedStrings["%s Event Dispatched"] = "%s Event Dispatched"; 49 50 localizedStrings["%s Fired"] = "%s Fired"; … … 54 55 localizedStrings["%s cannot be modified"] = "%s cannot be modified"; 55 56 localizedStrings["%s delay"] = "%s delay"; 57 localizedStrings["%s eval\n%s async"] = "%s eval\n%s async"; 56 58 localizedStrings["%s interval"] = "%s interval"; 57 59 localizedStrings["(Action %s)"] = "(Action %s)"; … … 122 124 localizedStrings["Assertion with message: %s"] = "Assertion with message: %s"; 123 125 localizedStrings["Assertive"] = "Assertive"; 126 localizedStrings["Async audits are not supported."] = "Async audits are not supported."; 124 127 localizedStrings["Attribute"] = "Attribute"; 125 128 localizedStrings["Attribute Modified"] = "Attribute Modified"; … … 631 634 localizedStrings["Object Graph"] = "Object Graph"; 632 635 localizedStrings["Object Store"] = "Object Store"; 636 localizedStrings["Observer Callback"] = "Observer Callback"; 633 637 localizedStrings["Off"] = "Off"; 634 638 localizedStrings["Once"] = "Once"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
r238864 r239397 547 547 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.TimerFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.timerId, profileData); 548 548 break; 549 case TimelineAgent.EventType.ObserverCallback: 550 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ObserverCallback, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData); 551 break; 552 case TimelineAgent.EventType.FireAnimationFrame: 553 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.AnimationFrameFired, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.id, profileData); 554 break; 549 555 default: 550 556 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ScriptEvaluated, startTime, endTime, callFrames, sourceCodeLocation, null, profileData); … … 564 570 case TimelineAgent.EventType.EventDispatch: 565 571 case TimelineAgent.EventType.FireAnimationFrame: 566 // These are handled when the parent of FunctionCall or EvaluateScript. 572 case TimelineAgent.EventType.ObserverCallback: 573 // These are handled when we see the child FunctionCall or EvaluateScript. 567 574 break; 568 575 … … 596 603 case TimelineAgent.EventType.EventDispatch: 597 604 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.EventDispatched, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData); 605 break; 606 case TimelineAgent.EventType.ObserverCallback: 607 record = new WI.ScriptTimelineRecord(WI.ScriptTimelineRecord.EventType.ObserverCallback, startTime, endTime, callFrames, sourceCodeLocation, parentRecordPayload.data.type, profileData); 598 608 break; 599 609 case TimelineAgent.EventType.FireAnimationFrame: -
trunk/Source/WebInspectorUI/UserInterface/Models/ScriptTimelineRecord.js
r238743 r239397 195 195 AnimationFrameRequested: "script-timeline-record-animation-frame-requested", 196 196 AnimationFrameCanceled: "script-timeline-record-animation-frame-canceled", 197 ObserverCallback: "script-timeline-record-observer-callback", 197 198 ConsoleProfileRecorded: "script-timeline-record-console-profile-recorded", 198 199 GarbageCollected: "script-timeline-record-garbage-collected", … … 401 402 return WI.UIString("Animation Frame %d Fired").format(details); 402 403 return WI.UIString("Animation Frame Fired"); 404 case WI.ScriptTimelineRecord.EventType.ObserverCallback: 405 if (details && (details instanceof String || typeof details === "string")) 406 return WI.UIString("%s Callback").format(details); 407 return WI.UIString("Observer Callback"); 403 408 case WI.ScriptTimelineRecord.EventType.AnimationFrameRequested: 404 409 if (details && includeDetailsInMainTitle) -
trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js
r238484 r239397 208 208 case WI.ScriptTimelineRecord.EventType.MicrotaskDispatched: 209 209 case WI.ScriptTimelineRecord.EventType.EventDispatched: 210 case WI.ScriptTimelineRecord.EventType.ObserverCallback: 210 211 return WI.TimelineRecordTreeElement.EventRecordIconStyleClass; 211 212 case WI.ScriptTimelineRecord.EventType.ProbeSampleRecorded:
Note:
See TracChangeset
for help on using the changeset viewer.