Diff
Modified: trunk/Source/WebCore/ChangeLog (224796 => 224797)
--- trunk/Source/WebCore/ChangeLog 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/ChangeLog 2017-11-14 02:28:36 UTC (rev 224797)
@@ -1,5 +1,31 @@
2017-11-13 Simon Fraser <[email protected]>
+ Minor DisplayRefreshMonitor-related cleanup
+ https://bugs.webkit.org/show_bug.cgi?id=179648
+
+ Reviewed by Alex Christensen.
+
+ Use more "#pragma once" and C++ initializers.
+
+ Make more member functions of DisplayRefreshMonitor protected.
+
+ Improve the ordering of member variables.
+
+ Don't mix member variables and member functions in the declaration of ScriptedAnimationController.
+
+ * dom/ScriptedAnimationController.h:
+ * platform/graphics/DisplayRefreshMonitor.cpp:
+ (WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
+ (WebCore::DisplayRefreshMonitor::displayDidRefresh):
+ * platform/graphics/DisplayRefreshMonitor.h:
+ (WebCore::DisplayRefreshMonitor::mutex):
+ * platform/graphics/DisplayRefreshMonitorManager.h:
+ * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
+ (WebCore::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
+ * platform/graphics/mac/DisplayRefreshMonitorMac.h:
+
+2017-11-13 Simon Fraser <[email protected]>
+
When navigating back to a page, compositing layers may not use accelerated drawing
https://bugs.webkit.org/show_bug.cgi?id=178749
rdar://problem/35158946
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (224796 => 224797)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.h 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h 2017-11-14 02:28:36 UTC (rev 224797)
@@ -73,6 +73,7 @@
};
void addThrottlingReason(ThrottlingReason);
void removeThrottlingReason(ThrottlingReason);
+
WEBCORE_EXPORT bool isThrottled() const;
WEBCORE_EXPORT Seconds interval() const;
@@ -81,6 +82,14 @@
private:
ScriptedAnimationController(Document&, PlatformDisplayID);
+ void scheduleAnimation();
+ void animationTimerFired();
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ // Override for DisplayRefreshMonitorClient
+ void displayRefreshFired() override;
+#endif
+
Page* page() const;
typedef Vector<RefPtr<RequestAnimationFrameCallback>> CallbackList;
@@ -90,19 +99,13 @@
CallbackId m_nextCallbackId { 0 };
int m_suspendCount { 0 };
- void scheduleAnimation();
- void animationTimerFired();
Timer m_animationTimer;
double m_lastAnimationFrameTimestamp { 0 };
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
- // Override for DisplayRefreshMonitorClient
- void displayRefreshFired() override;
RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
-
+ OptionSet<ThrottlingReason> m_throttlingReasons;
bool m_isUsingTimer { false };
-
- OptionSet<ThrottlingReason> m_throttlingReasons;
#endif
};
Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp (224796 => 224797)
--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp 2017-11-14 02:28:36 UTC (rev 224797)
@@ -57,12 +57,7 @@
}
DisplayRefreshMonitor::DisplayRefreshMonitor(PlatformDisplayID displayID)
- : m_active(true)
- , m_scheduled(false)
- , m_previousFrameDone(true)
- , m_unscheduledFireCount(0)
- , m_displayID(displayID)
- , m_clientsToBeNotified(nullptr)
+ : m_displayID(displayID)
{
}
@@ -123,7 +118,7 @@
LockHolder lock(m_mutex);
m_previousFrameDone = true;
}
-
+
DisplayRefreshMonitorManager::sharedManager().displayDidRefresh(*this);
}
Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h (224796 => 224797)
--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h 2017-11-14 02:28:36 UTC (rev 224797)
@@ -23,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DisplayRefreshMonitor_h
-#define DisplayRefreshMonitor_h
+#pragma once
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
@@ -61,6 +60,14 @@
return !m_scheduled && m_unscheduledFireCount > maxInactiveFireCount;
}
+ static RefPtr<DisplayRefreshMonitor> createDefaultDisplayRefreshMonitor(PlatformDisplayID);
+
+protected:
+ WEBCORE_EXPORT explicit DisplayRefreshMonitor(PlatformDisplayID);
+ WEBCORE_EXPORT static void handleDisplayRefreshedNotificationOnMainThread(void* data);
+
+ Lock& mutex() { return m_mutex; }
+
bool isActive() const { return m_active; }
void setIsActive(bool active) { m_active = active; }
@@ -70,26 +77,17 @@
bool isPreviousFrameDone() const { return m_previousFrameDone; }
void setIsPreviousFrameDone(bool done) { m_previousFrameDone = done; }
- Lock& mutex() { return m_mutex; }
-
- static RefPtr<DisplayRefreshMonitor> createDefaultDisplayRefreshMonitor(PlatformDisplayID);
-
-protected:
- WEBCORE_EXPORT explicit DisplayRefreshMonitor(PlatformDisplayID);
- WEBCORE_EXPORT static void handleDisplayRefreshedNotificationOnMainThread(void* data);
-
private:
void displayDidRefresh();
- bool m_active;
- bool m_scheduled;
- bool m_previousFrameDone;
- int m_unscheduledFireCount; // Number of times the display link has fired with no clients.
- PlatformDisplayID m_displayID;
+ HashSet<DisplayRefreshMonitorClient*> m_clients;
+ HashSet<DisplayRefreshMonitorClient*>* m_clientsToBeNotified { nullptr };
Lock m_mutex;
-
- HashSet<DisplayRefreshMonitorClient*> m_clients;
- HashSet<DisplayRefreshMonitorClient*>* m_clientsToBeNotified;
+ PlatformDisplayID m_displayID { 0 };
+ int m_unscheduledFireCount { 0 }; // Number of times the display link has fired with no clients.
+ bool m_active { true };
+ bool m_scheduled { false };
+ bool m_previousFrameDone { true };
};
}
@@ -96,4 +94,3 @@
#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-#endif
Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h (224796 => 224797)
--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorManager.h 2017-11-14 02:28:36 UTC (rev 224797)
@@ -23,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DisplayRefreshMonitorManager_h
-#define DisplayRefreshMonitorManager_h
+#pragma once
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
@@ -62,5 +61,3 @@
}
#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-
-#endif
Modified: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp (224796 => 224797)
--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp 2017-11-14 02:28:36 UTC (rev 224797)
@@ -36,7 +36,6 @@
DisplayRefreshMonitorMac::DisplayRefreshMonitorMac(PlatformDisplayID displayID)
: DisplayRefreshMonitor(displayID)
- , m_displayLink(nullptr)
{
}
Modified: trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h (224796 => 224797)
--- trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h 2017-11-14 02:01:40 UTC (rev 224796)
+++ trunk/Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.h 2017-11-14 02:28:36 UTC (rev 224797)
@@ -50,7 +50,7 @@
explicit DisplayRefreshMonitorMac(PlatformDisplayID);
WeakPtrFactory<DisplayRefreshMonitorMac> m_weakFactory;
- CVDisplayLinkRef m_displayLink;
+ CVDisplayLinkRef m_displayLink { nullptr };
};
}