Title: [261264] trunk/Source
Revision
261264
Author
hironori.fu...@sony.com
Date
2020-05-06 20:40:42 -0700 (Wed, 06 May 2020)

Log Message

[Win] Implement DisplayRefreshMonitor by using RunLoop::Timer
https://bugs.webkit.org/show_bug.cgi?id=211431

Reviewed by Don Olmstead.

Source/WebCore:

* PlatformWin.cmake:
* platform/graphics/DisplayRefreshMonitor.cpp:
(WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
* platform/graphics/win/DisplayRefreshMonitorWin.cpp: Added.
(WebCore::DisplayRefreshMonitorWin::create):
(WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
(WebCore::DisplayRefreshMonitorWin::requestRefreshCallback):
(WebCore::DisplayRefreshMonitorWin::displayLinkFired):
* platform/graphics/win/DisplayRefreshMonitorWin.h: Added.

Source/WTF:

USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR is turned off only for Windows ports.
Turn it on, and add DisplayRefreshMonitorWin.

I'll remove USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR macro in a follow-up patch.

* wtf/PlatformUse.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (261263 => 261264)


--- trunk/Source/WTF/ChangeLog	2020-05-07 02:13:43 UTC (rev 261263)
+++ trunk/Source/WTF/ChangeLog	2020-05-07 03:40:42 UTC (rev 261264)
@@ -1,3 +1,17 @@
+2020-05-06  Yoshiaki Jitsukawa  <yoshiaki.jitsuk...@sony.com> and Fujii Hironori  <hironori.fu...@sony.com>
+
+        [Win] Implement DisplayRefreshMonitor by using RunLoop::Timer
+        https://bugs.webkit.org/show_bug.cgi?id=211431
+
+        Reviewed by Don Olmstead.
+
+        USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR is turned off only for Windows ports.
+        Turn it on, and add DisplayRefreshMonitorWin.
+
+        I'll remove USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR macro in a follow-up patch.
+
+        * wtf/PlatformUse.h:
+
 2020-05-06  Darin Adler  <da...@apple.com>
 
         Make a helper for the pattern of ICU functions that may need to be called twice to populate a buffer

Modified: trunk/Source/WTF/wtf/PlatformUse.h (261263 => 261264)


--- trunk/Source/WTF/wtf/PlatformUse.h	2020-05-07 02:13:43 UTC (rev 261263)
+++ trunk/Source/WTF/wtf/PlatformUse.h	2020-05-07 03:40:42 UTC (rev 261264)
@@ -187,9 +187,7 @@
 #define USE_AV_SAMPLE_BUFFER_DISPLAY_LAYER 1
 #endif
 
-#if !PLATFORM(WIN)
 #define USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1
-#endif
 
 #if !defined(USE_ZLIB)
 #define USE_ZLIB 1

Modified: trunk/Source/WebCore/ChangeLog (261263 => 261264)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 02:13:43 UTC (rev 261263)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 03:40:42 UTC (rev 261264)
@@ -1,3 +1,20 @@
+2020-05-06  Yoshiaki Jitsukawa  <yoshiaki.jitsuk...@sony.com> and Fujii Hironori  <hironori.fu...@sony.com>
+
+        [Win] Implement DisplayRefreshMonitor by using RunLoop::Timer
+        https://bugs.webkit.org/show_bug.cgi?id=211431
+
+        Reviewed by Don Olmstead.
+
+        * PlatformWin.cmake:
+        * platform/graphics/DisplayRefreshMonitor.cpp:
+        (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor):
+        * platform/graphics/win/DisplayRefreshMonitorWin.cpp: Added.
+        (WebCore::DisplayRefreshMonitorWin::create):
+        (WebCore::DisplayRefreshMonitorWin::DisplayRefreshMonitorWin):
+        (WebCore::DisplayRefreshMonitorWin::requestRefreshCallback):
+        (WebCore::DisplayRefreshMonitorWin::displayLinkFired):
+        * platform/graphics/win/DisplayRefreshMonitorWin.h: Added.
+
 2020-05-06  Zalan Bujtas  <za...@apple.com>
 
         [ContentObservation] Shutterstock search bar is not activated on the first tap

Modified: trunk/Source/WebCore/PlatformWin.cmake (261263 => 261264)


--- trunk/Source/WebCore/PlatformWin.cmake	2020-05-07 02:13:43 UTC (rev 261263)
+++ trunk/Source/WebCore/PlatformWin.cmake	2020-05-07 03:40:42 UTC (rev 261264)
@@ -52,6 +52,7 @@
     platform/graphics/win/ComplexTextControllerDirectWrite.cpp
     platform/graphics/win/ComplexTextControllerUniscribe.cpp
     platform/graphics/win/DIBPixelData.cpp
+    platform/graphics/win/DisplayRefreshMonitorWin.cpp
     platform/graphics/win/FloatPointDirect2D.cpp
     platform/graphics/win/FloatRectDirect2D.cpp
     platform/graphics/win/FloatSizeDirect2D.cpp

Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (261263 => 261264)


--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2020-05-07 02:13:43 UTC (rev 261263)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp	2020-05-07 03:40:42 UTC (rev 261264)
@@ -38,6 +38,8 @@
 #include "DisplayRefreshMonitorMac.h"
 #elif PLATFORM(GTK)
 #include "DisplayRefreshMonitorGtk.h"
+#elif PLATFORM(WIN)
+#include "DisplayRefreshMonitorWin.h"
 #endif
 
 namespace WebCore {
@@ -53,6 +55,9 @@
 #if PLATFORM(GTK) && !USE(GTK4)
     return DisplayRefreshMonitorGtk::create(displayID);
 #endif
+#if PLATFORM(WIN)
+    return DisplayRefreshMonitorWin::create(displayID);
+#endif
     UNUSED_PARAM(displayID);
     return nullptr;
 }

Added: trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp (0 => 261264)


--- trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.cpp	2020-05-07 03:40:42 UTC (rev 261264)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplayRefreshMonitorWin.h"
+
+namespace WebCore {
+
+RefPtr<DisplayRefreshMonitorWin> DisplayRefreshMonitorWin::create(PlatformDisplayID displayID)
+{
+    return adoptRef(*new DisplayRefreshMonitorWin(displayID));
+}
+
+DisplayRefreshMonitorWin::DisplayRefreshMonitorWin(PlatformDisplayID displayID)
+    : DisplayRefreshMonitor(displayID)
+    , m_timer(RunLoop::main(), this, &DisplayRefreshMonitorWin::displayLinkFired)
+{
+}
+
+bool DisplayRefreshMonitorWin::requestRefreshCallback()
+{
+    if (!isActive())
+        return false;
+    m_timer.startOneShot(16_ms);
+    setIsActive(true);
+    setIsScheduled(true);
+    return true;
+}
+
+void DisplayRefreshMonitorWin::displayLinkFired()
+{
+    if (!isPreviousFrameDone())
+        return;
+
+    setIsPreviousFrameDone(false);
+
+    handleDisplayRefreshedNotificationOnMainThread(this);
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.h (0 => 261264)


--- trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/win/DisplayRefreshMonitorWin.h	2020-05-07 03:40:42 UTC (rev 261264)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "DisplayRefreshMonitor.h"
+#include <wtf/RunLoop.h>
+
+namespace WebCore {
+
+class DisplayRefreshMonitorWin : public DisplayRefreshMonitor {
+public:
+    static RefPtr<DisplayRefreshMonitorWin> create(PlatformDisplayID);
+
+    void displayLinkFired() override;
+    bool requestRefreshCallback() override;
+
+private:
+    explicit DisplayRefreshMonitorWin(PlatformDisplayID);
+    RunLoop::Timer<DisplayRefreshMonitorWin> m_timer;
+};
+
+} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to