Title: [266227] trunk/Source
Revision
266227
Author
[email protected]
Date
2020-08-27 02:56:07 -0700 (Thu, 27 Aug 2020)

Log Message

[GTK] Include the run loop source name in frame rendering timeline
https://bugs.webkit.org/show_bug.cgi?id=215847

Reviewed by Adrian Perez de Castro.

Source/WebCore:

Include the given name in rendering frame record data.

* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createRenderingFrameData):
* inspector/TimelineRecordFactory.h:
* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStart):

Source/WebInspectorUI:

Show the frame name if present in timeline panel.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.prototype._processRecord):
* UserInterface/Models/RenderingFrameTimelineRecord.js:
(WI.RenderingFrameTimelineRecord):
(WI.RenderingFrameTimelineRecord.prototype.get name):
* UserInterface/Views/TimelineTabContentView.js:
(WI.TimelineTabContentView.displayNameForRecord):

Source/WTF:

Pass the run loop source name to the observer.

* wtf/RunLoop.h:
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::RunLoop):
(WTF::RunLoop::notify):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (266226 => 266227)


--- trunk/Source/WTF/ChangeLog	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WTF/ChangeLog	2020-08-27 09:56:07 UTC (rev 266227)
@@ -1,3 +1,17 @@
+2020-08-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Include the run loop source name in frame rendering timeline
+        https://bugs.webkit.org/show_bug.cgi?id=215847
+
+        Reviewed by Adrian Perez de Castro.
+
+        Pass the run loop source name to the observer.
+
+        * wtf/RunLoop.h:
+        * wtf/glib/RunLoopGLib.cpp:
+        (WTF::RunLoop::RunLoop):
+        (WTF::RunLoop::notify):
+
 2020-08-26  Alexey Shvayka  <[email protected]>
 
         Use jsTypeofIsObject() in DFG AI and operationTypeOfIsObject()

Modified: trunk/Source/WTF/wtf/RunLoop.h (266226 => 266227)


--- trunk/Source/WTF/wtf/RunLoop.h	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WTF/wtf/RunLoop.h	2020-08-27 09:56:07 UTC (rev 266227)
@@ -99,7 +99,7 @@
 #if USE(GLIB_EVENT_LOOP)
     WTF_EXPORT_PRIVATE GMainContext* mainContext() const { return m_mainContext.get(); }
     enum class Event { WillDispatch, DidDispatch };
-    using Observer = WTF::Observer<void(Event)>;
+    using Observer = WTF::Observer<void(Event, const String&)>;
     WTF_EXPORT_PRIVATE void observe(const Observer&);
 #endif
 
@@ -226,7 +226,7 @@
     RetainPtr<CFRunLoopRef> m_runLoop;
     RetainPtr<CFRunLoopSourceRef> m_runLoopSource;
 #elif USE(GLIB_EVENT_LOOP)
-    void notify(Event);
+    void notify(Event, const char*);
 
     static GSourceFuncs s_runLoopSourceFunctions;
     GRefPtr<GMainContext> m_mainContext;

Modified: trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp (266226 => 266227)


--- trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2020-08-27 09:56:07 UTC (rev 266227)
@@ -47,10 +47,11 @@
         if (g_source_get_ready_time(source) == -1)
             return G_SOURCE_CONTINUE;
         g_source_set_ready_time(source, -1);
+        const char* name = g_source_get_name(source);
         auto& runLoopSource = *reinterpret_cast<RunLoopSource*>(source);
-        runLoopSource.runLoop->notify(RunLoop::Event::WillDispatch);
+        runLoopSource.runLoop->notify(RunLoop::Event::WillDispatch, name);
         auto returnValue = callback(userData);
-        runLoopSource.runLoop->notify(RunLoop::Event::DidDispatch);
+        runLoopSource.runLoop->notify(RunLoop::Event::DidDispatch, name);
         return returnValue;
     },
     nullptr, // finalize
@@ -146,13 +147,13 @@
     m_observers.add(observer);
 }
 
-void RunLoop::notify(RunLoop::Event event)
+void RunLoop::notify(RunLoop::Event event, const char* name)
 {
     if (m_observers.computesEmpty())
         return;
 
-    m_observers.forEach([event](auto& observer) {
-        observer(event);
+    m_observers.forEach([event, name = String::fromUTF8(name)](auto& observer) {
+        observer(event, name);
     });
 }
 

Modified: trunk/Source/WebCore/ChangeLog (266226 => 266227)


--- trunk/Source/WebCore/ChangeLog	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebCore/ChangeLog	2020-08-27 09:56:07 UTC (rev 266227)
@@ -1,3 +1,18 @@
+2020-08-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Include the run loop source name in frame rendering timeline
+        https://bugs.webkit.org/show_bug.cgi?id=215847
+
+        Reviewed by Adrian Perez de Castro.
+
+        Include the given name in rendering frame record data.
+
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createRenderingFrameData):
+        * inspector/TimelineRecordFactory.h:
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::internalStart):
+
 2020-08-27  Chris Dumez  <[email protected]>
 
         Drop unnecessary BufferPlaybackMode enum from AudioBufferSourceNode

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (266226 => 266227)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2020-08-27 09:56:07 UTC (rev 266227)
@@ -56,6 +56,13 @@
     return record;
 }
 
+Ref<JSON::Object> TimelineRecordFactory::createRenderingFrameData(const String& name)
+{
+    Ref<JSON::Object> data = ""
+    data->setString("name"_s, name);
+    return data;
+}
+
 Ref<JSON::Object> TimelineRecordFactory::createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn)
 {
     Ref<JSON::Object> data = ""

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (266226 => 266227)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2020-08-27 09:56:07 UTC (rev 266227)
@@ -46,6 +46,7 @@
 public:
     static Ref<JSON::Object> createGenericRecord(double startTime, int maxCallStackDepth);
 
+    static Ref<JSON::Object> createRenderingFrameData(const String& name);
     static Ref<JSON::Object> createFunctionCallData(const String& scriptName, int scriptLine, int scriptColumn);
     static Ref<JSON::Object> createConsoleProfileData(const String& title);
     static Ref<JSON::Object> createProbeSampleData(JSC::BreakpointActionID, unsigned sampleId);

Modified: trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp (266226 => 266227)


--- trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp	2020-08-27 09:56:07 UTC (rev 266227)
@@ -227,13 +227,13 @@
 
     m_runLoopNestingLevel = 1;
 #elif USE(GLIB_EVENT_LOOP)
-    m_runLoopObserver = makeUnique<RunLoop::Observer>([this](RunLoop::Event event) {
+    m_runLoopObserver = makeUnique<RunLoop::Observer>([this](RunLoop::Event event, const String& name) {
         if (!m_tracking || m_environment.debugger().isPaused())
             return;
 
         switch (event) {
         case RunLoop::Event::WillDispatch:
-            pushCurrentRecord(JSON::Object::create(), TimelineRecordType::RenderingFrame, false, nullptr);
+            pushCurrentRecord(TimelineRecordFactory::createRenderingFrameData(name), TimelineRecordType::RenderingFrame, false, nullptr);
             break;
         case RunLoop::Event::DidDispatch:
             didCompleteCurrentRecord(TimelineRecordType::RenderingFrame);

Modified: trunk/Source/WebInspectorUI/ChangeLog (266226 => 266227)


--- trunk/Source/WebInspectorUI/ChangeLog	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebInspectorUI/ChangeLog	2020-08-27 09:56:07 UTC (rev 266227)
@@ -1,3 +1,21 @@
+2020-08-27  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Include the run loop source name in frame rendering timeline
+        https://bugs.webkit.org/show_bug.cgi?id=215847
+
+        Reviewed by Adrian Perez de Castro.
+
+        Show the frame name if present in timeline panel.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Controllers/TimelineManager.js:
+        (WI.TimelineManager.prototype._processRecord):
+        * UserInterface/Models/RenderingFrameTimelineRecord.js:
+        (WI.RenderingFrameTimelineRecord):
+        (WI.RenderingFrameTimelineRecord.prototype.get name):
+        * UserInterface/Views/TimelineTabContentView.js:
+        (WI.TimelineTabContentView.displayNameForRecord):
+
 2020-08-26  Brian Burg  <[email protected]>
 
         Web Inspector: button for Inspector^2 doesn't work without setting default for DeveloperExtrasEnabled

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (266226 => 266227)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2020-08-27 09:56:07 UTC (rev 266227)
@@ -602,6 +602,7 @@
 localizedStrings["Fragment"] = "Fragment";
 localizedStrings["Fragment Shader"] = "Fragment Shader";
 localizedStrings["Frame %d"] = "Frame %d";
+localizedStrings["Frame %d \u2014 %s"] = "Frame %d \u2014 %s";
 localizedStrings["Frame URL"] = "Frame URL";
 localizedStrings["Frames"] = "Frames";
 localizedStrings["Frames %d \u2013 %d"] = "Frames %d \u2013 %d";

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (266226 => 266227)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2020-08-27 09:56:07 UTC (rev 266227)
@@ -854,7 +854,7 @@
             if (!recordPayload.children || !recordPayload.children.length)
                 return null;
 
-            return new WI.RenderingFrameTimelineRecord(startTime, endTime);
+            return new WI.RenderingFrameTimelineRecord(startTime, endTime, recordPayload.data.name);
 
         case InspectorBackend.Enum.Timeline.EventType.EvaluateScript:
             if (!sourceCodeLocation) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js (266226 => 266227)


--- trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2020-08-27 09:56:07 UTC (rev 266227)
@@ -25,10 +25,11 @@
 
 WI.RenderingFrameTimelineRecord = class RenderingFrameTimelineRecord extends WI.TimelineRecord
 {
-    constructor(startTime, endTime)
+    constructor(startTime, endTime, name)
     {
         super(WI.TimelineRecord.Type.RenderingFrame, startTime, endTime);
 
+        this._name = name || "";
         this._durationByTaskType = new Map;
         this._frameIndex = -1;
     }
@@ -102,6 +103,11 @@
         return this._frameIndex + 1;
     }
 
+    get name()
+    {
+        return this._name;
+    }
+
     setupFrameIndex()
     {
         console.assert(this._frameIndex === -1, "Frame index should only be set once.");

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js (266226 => 266227)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2020-08-27 08:25:23 UTC (rev 266226)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js	2020-08-27 09:56:07 UTC (rev 266227)
@@ -288,6 +288,8 @@
         case WI.TimelineRecord.Type.Script:
             return WI.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType, timelineRecord.details, includeDetailsInMainTitle);
         case WI.TimelineRecord.Type.RenderingFrame:
+            if (timelineRecord.name)
+                return WI.UIString("Frame %d \u2014 %s").format(timelineRecord.frameNumber, timelineRecord.name);
             return WI.UIString("Frame %d").format(timelineRecord.frameNumber);
         case WI.TimelineRecord.Type.HeapAllocations:
             if (timelineRecord.heapSnapshot.imported)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to