Minor DisplayRefreshMonitor-related cleanup
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2017 01:13:27 +0000 (01:13 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Dec 2017 01:13:27 +0000 (01:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179802

Reviewed by Sam Weinig.

Source/WebCore:

New trace point for when the CVDisplayLink fires on its own thread.

Some #pragma once, and put all the WellKnownRunLoopOrders in one place.

* inspector/agents/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStart):
* platform/cf/RunLoopObserver.h:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::displayDidRefresh):
* platform/graphics/ca/LayerFlushScheduler.h:
* platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
(WebCore::LayerFlushScheduler::LayerFlushScheduler):

Source/WebKit:

Use RunLoopObserver::WellKnownRunLoopOrders. We want to fire before layer flushing.

* UIProcess/WebPageProxy.cpp:
(WebKit::m_configurationPreferenceValues):

Source/WTF:

New trace point for when the CVDisplayLink fires on its own thread.

* wtf/SystemTracing.h:

Tools:

New trace point for when the CVDisplayLink fires on its own thread.

* Tracing/SystemTracePoints.plist:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225509 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/SystemTracing.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp
Source/WebCore/platform/cf/RunLoopObserver.h
Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp
Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h
Source/WebCore/platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/WebPageProxy.cpp
Tools/ChangeLog
Tools/Tracing/SystemTracePoints.plist

index bf8fa47..cef7ce0 100644 (file)
@@ -1,3 +1,14 @@
+2017-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Minor DisplayRefreshMonitor-related cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=179802
+
+        Reviewed by Sam Weinig.
+
+        New trace point for when the CVDisplayLink fires on its own thread.
+
+        * wtf/SystemTracing.h:
+
 2017-12-04  JF Bastien  <jfbastien@apple.com>
 
         Update std::expected to match libc++ coding style
index 58cf552..a0b5e59 100644 (file)
@@ -73,6 +73,7 @@ enum TracePointCode {
     UpdateTouchRegionsEnd,
     DisplayListRecordStart,
     DisplayListRecordEnd,
+    DisplayRefreshDispatchingToMainThread,
 
     WebKitRange = 10000,
     WebHTMLViewPaintStart,
index 52b9a60..cd6b71f 100644 (file)
@@ -1,3 +1,23 @@
+2017-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Minor DisplayRefreshMonitor-related cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=179802
+
+        Reviewed by Sam Weinig.
+
+        New trace point for when the CVDisplayLink fires on its own thread.
+
+        Some #pragma once, and put all the WellKnownRunLoopOrders in one place.
+
+        * inspector/agents/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::internalStart):
+        * platform/cf/RunLoopObserver.h:
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::displayDidRefresh):
+        * platform/graphics/ca/LayerFlushScheduler.h:
+        * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp:
+        (WebCore::LayerFlushScheduler::LayerFlushScheduler):
+
 2017-12-04  David Quesada  <david_quesada@apple.com>
 
         Add a class for parsing application manifests
index 3ff563e..14d3423 100644 (file)
@@ -67,8 +67,6 @@ namespace WebCore {
 using namespace Inspector;
 
 #if PLATFORM(COCOA)
-static const CFIndex frameStopRunLoopOrder = (CFIndex)RunLoopObserver::WellKnownRunLoopOrders::CoreAnimationCommit + 1;
-
 static CFRunLoopRef currentRunLoop()
 {
 #if PLATFORM(IOS)
@@ -174,7 +172,7 @@ void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth)
     // FIXME: Abstract away platform-specific code once https://bugs.webkit.org/show_bug.cgi?id=142748 is fixed.
 
 #if PLATFORM(COCOA)
-    m_frameStartObserver = std::make_unique<RunLoopObserver>(0, [this]() {
+    m_frameStartObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::InspectorFrameBegin), [this]() {
         if (!m_enabled || m_environment.scriptDebugServer().isPaused())
             return;
 
@@ -183,7 +181,7 @@ void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth)
         m_runLoopNestingLevel++;
     });
 
-    m_frameStopObserver = std::make_unique<RunLoopObserver>(frameStopRunLoopOrder, [this]() {
+    m_frameStopObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::InspectorFrameEnd), [this]() {
         if (!m_enabled || m_environment.scriptDebugServer().isPaused())
             return;
 
index 969a037..e1c4480 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef RunLoopObserver_h
-#define RunLoopObserver_h
+#pragma once
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <wtf/Function.h>
@@ -51,7 +50,11 @@ public:
     bool isScheduled() const { return m_runLoopObserver; }
 
     enum class WellKnownRunLoopOrders : CFIndex {
-        CoreAnimationCommit = 2000000
+        CoreAnimationCommit     = 2000000,
+        LayerFlush              = CoreAnimationCommit - 1,
+        ActivityStateChange     = CoreAnimationCommit - 2,
+        InspectorFrameBegin     = 0,
+        InspectorFrameEnd       = CoreAnimationCommit + 1 
     };
 
 protected:
@@ -67,4 +70,3 @@ private:
 
 } // namespace WebCore
 
-#endif // RunLoopObserver_h
index fa813f0..c9e2077 100644 (file)
@@ -116,7 +116,7 @@ void DisplayRefreshMonitor::displayDidRefresh()
 
     {
         LockHolder lock(m_mutex);
-        m_previousFrameDone = true;
+        setIsPreviousFrameDone(true);
     }
 
     DisplayRefreshMonitorManager::sharedManager().displayDidRefresh(*this);
index 0acd37a..6c3d8ab 100644 (file)
@@ -23,8 +23,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef LayerFlushScheduler_h
-#define LayerFlushScheduler_h
+#pragma once
 
 #include "LayerFlushSchedulerClient.h"
 #include "RunLoopObserver.h"
@@ -61,4 +60,3 @@ private:
 
 } // namespace WebCore
 
-#endif // LayerFlushScheduler_h
index fb4cbd7..8db4577 100644 (file)
@@ -36,8 +36,6 @@
 
 namespace WebCore {
 
-static const CFIndex layerFlushRunLoopOrder = (CFIndex)RunLoopObserver::WellKnownRunLoopOrders::CoreAnimationCommit - 1;
-
 static CFRunLoopRef currentRunLoop()
 {
 #if PLATFORM(IOS)
@@ -58,7 +56,7 @@ LayerFlushScheduler::LayerFlushScheduler(LayerFlushSchedulerClient* client)
 {
     ASSERT_ARG(client, client);
 
-    m_runLoopObserver = std::make_unique<RunLoopObserver>(layerFlushRunLoopOrder, [this]() {
+    m_runLoopObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::LayerFlush), [this]() {
         if (this->isSuspended())
             return;
         this->layerFlushCallback();
index edf0660..4c48b6f 100644 (file)
@@ -1,3 +1,15 @@
+2017-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Minor DisplayRefreshMonitor-related cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=179802
+
+        Reviewed by Sam Weinig.
+
+        Use RunLoopObserver::WellKnownRunLoopOrders. We want to fire before layer flushing.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::m_configurationPreferenceValues):
+
 2017-12-04  Brent Fulgham  <bfulgham@apple.com>
 
         Don't force creation of process pool when enabling resource load statistics
index 9947e02..bbb8a27 100644 (file)
@@ -408,8 +408,7 @@ WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, uin
     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, *this);
 
 #if PLATFORM(COCOA)
-    const CFIndex activityStateChangeRunLoopOrder = (CFIndex)RunLoopObserver::WellKnownRunLoopOrders::CoreAnimationCommit - 1;
-    m_activityStateChangeDispatcher = std::make_unique<RunLoopObserver>(activityStateChangeRunLoopOrder, [this] {
+    m_activityStateChangeDispatcher = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::ActivityStateChange), [this] {
         this->dispatchActivityStateChange();
     });
 #endif
index e0c22c0..b077406 100644 (file)
@@ -1,3 +1,14 @@
+2017-12-04  Simon Fraser  <simon.fraser@apple.com>
+
+        Minor DisplayRefreshMonitor-related cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=179802
+
+        Reviewed by Sam Weinig.
+
+        New trace point for when the CVDisplayLink fires on its own thread.
+
+        * Tracing/SystemTracePoints.plist:
+
 2017-12-04  David Quesada  <david_quesada@apple.com>
 
         Add a class for parsing application manifests
index fdda840..73efad7 100644 (file)
              </dict>
              <dict>
                  <key>Name</key>
+                 <string>Display Refresh Dispatch to main thread</string>
+                 <key>Type</key>
+                 <string>Impulse</string>
+                 <key>Component</key>
+                 <string>47</string>
+                 <key>Code</key>
+                 <string>5026</string>
+             </dict>
+             <dict>
+                 <key>Name</key>
                  <string>Paint WebHTMLView</string>
                  <key>Type</key>
                  <string>Interval</string>