Diff
Modified: trunk/Source/WebCore/ChangeLog (256852 => 256853)
--- trunk/Source/WebCore/ChangeLog 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/ChangeLog 2020-02-18 21:58:11 UTC (rev 256853)
@@ -1,3 +1,26 @@
+2020-02-18 Antti Koivisto <an...@apple.com>
+
+ [macOS] Don't fire timers when there is a pending rendering update
+ https://bugs.webkit.org/show_bug.cgi?id=207889
+
+ Reviewed by Simon Fraser.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/WindowEventLoop.cpp:
+ (WebCore::WindowEventLoop::breakToAllowRenderingUpdate):
+
+ Add the exported interface to WindowEventLoop as the future direction is to do everything via it.
+ For now it just calls into ThreadTimers rather than doing anything with the event loop itself.
+
+ * dom/WindowEventLoop.h:
+ * platform/ThreadTimers.cpp:
+ (WebCore::ThreadTimers::sharedTimerFiredInternal):
+ (WebCore::ThreadTimers::breakFireLoopForRenderingUpdate):
+
+ If we are in a firing timer set a flag so that no more timers are fired during the current runloop cycle.
+
+ * platform/ThreadTimers.h:
+
2020-02-18 Youenn Fablet <you...@apple.com>
Remove PlatformMediaSessionClient dependency on Document
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (256852 => 256853)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-02-18 21:58:11 UTC (rev 256853)
@@ -2891,7 +2891,7 @@
9B02E0C8235EAD2A004044B2 /* TextManipulationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B02E0C3235E76AA004044B2 /* TextManipulationController.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B0ABCAE236BB43100B45085 /* TaskSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0ABCAC236BB40A00B45085 /* TaskSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B24DE8E15194B9500C59C27 /* HTMLBDIElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B24DE8C15194B9500C59C27 /* HTMLBDIElement.h */; };
- 9B27FC60234D9ADB00394A46 /* WindowEventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B27FC5E234D9ADA00394A46 /* WindowEventLoop.h */; };
+ 9B27FC60234D9ADB00394A46 /* WindowEventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B27FC5E234D9ADA00394A46 /* WindowEventLoop.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B32CDA913DF7FA900F34D13 /* RenderedPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */; };
9B417064125662B3006B28FC /* ApplyBlockElementCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */; };
@@ -3408,7 +3408,6 @@
AA7FEEAD16A4E74B004C0C33 /* JSSpeechSynthesis.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7FEEAC16A4E74B004C0C33 /* JSSpeechSynthesis.h */; };
AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = AAA728F116D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h */; };
AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC08CF115F941FC00F1E188 /* AccessibilitySVGRoot.h */; };
- AAD9D0B521DFA810001B11C7 /* LazyLoadImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
AB23A32809BBA7D00067CC53 /* BeforeTextInsertedEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = AB23A32609BBA7D00067CC53 /* BeforeTextInsertedEvent.h */; };
AB247A6D0AFD6383003FA5FD /* RenderSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = AB247A6B0AFD6383003FA5FD /* RenderSlider.h */; };
AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */ = {isa = PBXBuildFile; fileRef = AB31C91D10AE1B8E000C7B92 /* LineClampValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9185,8 +9184,6 @@
65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
697101071C6BE1550018C7F1 /* AccessibilitySVGElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilitySVGElement.cpp; sourceTree = "<group>"; };
697101081C6BE1550018C7F1 /* AccessibilitySVGElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySVGElement.h; sourceTree = "<group>"; };
- AAD9D0B121DFA80C001B11C7 /* LazyLoadImageObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadImageObserver.cpp; sourceTree = "<group>"; };
- AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyLoadImageObserver.h; sourceTree = "<group>"; };
6A22E86F1F10418600F546C3 /* InspectorCanvas.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InspectorCanvas.h; sourceTree = "<group>"; };
6A22E8721F1042C400F546C3 /* InspectorCanvas.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorCanvas.cpp; sourceTree = "<group>"; };
6A7279881F16C29B003F39B8 /* InspectorShaderProgram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorShaderProgram.h; sourceTree = "<group>"; };
@@ -12226,6 +12223,8 @@
AACC83D62316569E00EB6BF5 /* HTMLOrForeignElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTMLOrForeignElement.idl; sourceTree = "<group>"; };
AACC83D72316576A00EB6BF5 /* JSHTMLOrForeignElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSHTMLOrForeignElement.h; sourceTree = "<group>"; };
AACC83D82316576B00EB6BF5 /* JSHTMLOrForeignElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOrForeignElement.cpp; sourceTree = "<group>"; };
+ AAD9D0B121DFA80C001B11C7 /* LazyLoadImageObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyLoadImageObserver.cpp; sourceTree = "<group>"; };
+ AAD9D0B321DFA80E001B11C7 /* LazyLoadImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LazyLoadImageObserver.h; sourceTree = "<group>"; };
AAE27B7416CBFC0D00623043 /* PlatformSpeechSynthesizerMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformSpeechSynthesizerMock.cpp; sourceTree = "<group>"; };
AAE27B7516CBFC0D00623043 /* PlatformSpeechSynthesizerMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformSpeechSynthesizerMock.h; sourceTree = "<group>"; };
AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformSpeechSynthesizerIOS.mm; sourceTree = "<group>"; };
Modified: trunk/Source/WebCore/dom/WindowEventLoop.cpp (256852 => 256853)
--- trunk/Source/WebCore/dom/WindowEventLoop.cpp 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/dom/WindowEventLoop.cpp 2020-02-18 21:58:11 UTC (rev 256853)
@@ -154,4 +154,11 @@
return *m_customElementQueue;
}
+void WindowEventLoop::breakToAllowRenderingUpdate()
+{
+ // FIXME: Also bail out from the task loop in EventLoop::run().
+ threadGlobalData().threadTimers().breakFireLoopForRenderingUpdate();
+}
+
+
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/WindowEventLoop.h (256852 => 256853)
--- trunk/Source/WebCore/dom/WindowEventLoop.h 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/dom/WindowEventLoop.h 2020-02-18 21:58:11 UTC (rev 256853)
@@ -53,6 +53,8 @@
CustomElementQueue& backupElementQueue();
+ WEBCORE_EXPORT static void breakToAllowRenderingUpdate();
+
private:
static Ref<WindowEventLoop> create(const String&);
WindowEventLoop(const String&);
Modified: trunk/Source/WebCore/platform/ThreadTimers.cpp (256852 => 256853)
--- trunk/Source/WebCore/platform/ThreadTimers.cpp 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/platform/ThreadTimers.cpp 2020-02-18 21:58:11 UTC (rev 256853)
@@ -131,9 +131,13 @@
// Catch the case where the timer asked timers to fire in a nested event loop, or we are over time limit.
if (!m_firingTimers || timeToQuit < MonotonicTime::now())
break;
+
+ if (m_shouldBreakFireLoopForRenderingUpdate)
+ break;
}
m_firingTimers = false;
+ m_shouldBreakFireLoopForRenderingUpdate = false;
updateSharedTimer();
}
@@ -151,5 +155,12 @@
updateSharedTimer();
}
+void ThreadTimers::breakFireLoopForRenderingUpdate()
+{
+ if (!m_firingTimers)
+ return;
+ m_shouldBreakFireLoopForRenderingUpdate = true;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ThreadTimers.h (256852 => 256853)
--- trunk/Source/WebCore/platform/ThreadTimers.h 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebCore/platform/ThreadTimers.h 2020-02-18 21:58:11 UTC (rev 256853)
@@ -55,6 +55,7 @@
void updateSharedTimer();
void fireTimersInNestedEventLoop();
+ void breakFireLoopForRenderingUpdate();
unsigned nextHeapInsertionCount() { return m_currentHeapInsertionOrder++; }
@@ -64,7 +65,8 @@
ThreadTimerHeap m_timerHeap;
SharedTimer* m_sharedTimer { nullptr }; // External object, can be a run loop on a worker thread. Normally set/reset by worker thread.
- bool m_firingTimers { false }; // Reentrancy guard.
+ bool m_firingTimers { false };
+ bool m_shouldBreakFireLoopForRenderingUpdate { false };
unsigned m_currentHeapInsertionOrder { 0 };
MonotonicTime m_pendingSharedTimerFireTime;
};
Modified: trunk/Source/WebKit/ChangeLog (256852 => 256853)
--- trunk/Source/WebKit/ChangeLog 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebKit/ChangeLog 2020-02-18 21:58:11 UTC (rev 256853)
@@ -1,3 +1,15 @@
+2020-02-18 Antti Koivisto <an...@apple.com>
+
+ [macOS] Don't fire timers when there is a pending rendering update
+ https://bugs.webkit.org/show_bug.cgi?id=207889
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::scheduleRenderingUpdateRunLoopObserver):
+
+ Ensure the event loop cycles to reach the runloop observer as fast as possible.
+
2020-02-18 Alex Christensen <achristen...@webkit.org>
Unreviewed, rolling out r254873.
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (256852 => 256853)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2020-02-18 21:45:47 UTC (rev 256852)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2020-02-18 21:58:11 UTC (rev 256853)
@@ -39,6 +39,7 @@
#import "WebPageCreationParameters.h"
#import "WebPageProxyMessages.h"
#import "WebProcess.h"
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
#import <QuartzCore/QuartzCore.h>
#import <WebCore/DebugPageOverlays.h>
#import <WebCore/Frame.h>
@@ -56,7 +57,7 @@
#import <WebCore/Settings.h>
#import <WebCore/TiledBacking.h>
#import <WebCore/WebActionDisablingCALayerDelegate.h>
-#import <pal/spi/cocoa/QuartzCoreSPI.h>
+#import <WebCore/WindowEventLoop.h>
#import <wtf/MachSendRight.h>
#import <wtf/MainThread.h>
#import <wtf/SystemTracing.h>
@@ -960,6 +961,9 @@
tracePoint(RenderingUpdateRunLoopObserverStart);
m_renderUpdateRunLoopObserver->schedule(CFRunLoopGetCurrent());
+
+ // Avoid running any more tasks before the runloop observer fires.
+ WebCore::WindowEventLoop::breakToAllowRenderingUpdate();
}
bool TiledCoreAnimationDrawingArea::adjustRenderingUpdateThrottling(OptionSet<RenderingUpdateThrottleState> flags)