- Revision
- 253744
- Author
- carlo...@webkit.org
- Date
- 2019-12-19 01:44:47 -0800 (Thu, 19 Dec 2019)
Log Message
[CoordinatedGraphics] ThreadedDisplayRefreshMonitor is never released
https://bugs.webkit.org/show_bug.cgi?id=205387
Reviewed by Žan Doberšek.
Source/WebCore:
The problem is that DisplayRefreshMonitorManager::createMonitorForClient() always creates a new one for
RenderingUpdateScheduler because it's not notified of the window screen change. So,
createDisplayRefreshMonitor() is called every time, which returns a reference of the same object, but it's added
to the monitors vector of DisplayRefreshMonitorManager and never removed from there.
* page/Chrome.cpp:
(WebCore::Chrome::windowScreenDidChange): Notify the RenderingUpdateScheduler about the screen change.
* page/RenderingUpdateScheduler.h: Make windowScreenDidChange public.
Source/WebKit:
Update the window screen ID after creating the layer tree host to ensure that the call to
createDisplayRefreshMonitor will create the ThreadedDisplayRefrershMonitor instead of the default one.
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Use the dispalyID of the layer tree host.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::LayerTreeHost): Initialize the display ID.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (253743 => 253744)
--- trunk/Source/WebCore/ChangeLog 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebCore/ChangeLog 2019-12-19 09:44:47 UTC (rev 253744)
@@ -1,3 +1,19 @@
+2019-12-19 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [CoordinatedGraphics] ThreadedDisplayRefreshMonitor is never released
+ https://bugs.webkit.org/show_bug.cgi?id=205387
+
+ Reviewed by Žan Doberšek.
+
+ The problem is that DisplayRefreshMonitorManager::createMonitorForClient() always creates a new one for
+ RenderingUpdateScheduler because it's not notified of the window screen change. So,
+ createDisplayRefreshMonitor() is called every time, which returns a reference of the same object, but it's added
+ to the monitors vector of DisplayRefreshMonitorManager and never removed from there.
+
+ * page/Chrome.cpp:
+ (WebCore::Chrome::windowScreenDidChange): Notify the RenderingUpdateScheduler about the screen change.
+ * page/RenderingUpdateScheduler.h: Make windowScreenDidChange public.
+
2019-12-19 youenn fablet <you...@apple.com>
Safari resumes autoplay audio elements after getUserMedia
Modified: trunk/Source/WebCore/page/Chrome.cpp (253743 => 253744)
--- trunk/Source/WebCore/page/Chrome.cpp 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebCore/page/Chrome.cpp 2019-12-19 09:44:47 UTC (rev 253744)
@@ -511,6 +511,9 @@
frame->document()->windowScreenDidChange(displayID);
}
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ m_page.renderingUpdateScheduler().windowScreenDidChange(displayID);
+#endif
m_page.setNeedsRecalcStyleInAllFrames();
#if PLATFORM(MAC) && ENABLE(GRAPHICS_CONTEXT_3D)
Modified: trunk/Source/WebCore/page/RenderingUpdateScheduler.h (253743 => 253744)
--- trunk/Source/WebCore/page/RenderingUpdateScheduler.h 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebCore/page/RenderingUpdateScheduler.h 2019-12-19 09:44:47 UTC (rev 253744)
@@ -50,10 +50,13 @@
void scheduleImmediateRenderingUpdate();
void scheduleRenderingUpdate();
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ void windowScreenDidChange(PlatformDisplayID);
+#endif
+
private:
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const final;
- void windowScreenDidChange(PlatformDisplayID);
void displayRefreshFired() final;
#else
void displayRefreshFired();
Modified: trunk/Source/WebKit/ChangeLog (253743 => 253744)
--- trunk/Source/WebKit/ChangeLog 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebKit/ChangeLog 2019-12-19 09:44:47 UTC (rev 253744)
@@ -1,3 +1,19 @@
+2019-12-19 Carlos Garcia Campos <cgar...@igalia.com>
+
+ [CoordinatedGraphics] ThreadedDisplayRefreshMonitor is never released
+ https://bugs.webkit.org/show_bug.cgi?id=205387
+
+ Reviewed by Žan Doberšek.
+
+ Update the window screen ID after creating the layer tree host to ensure that the call to
+ createDisplayRefreshMonitor will create the ThreadedDisplayRefrershMonitor instead of the default one.
+
+ * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
+ (WebKit::DrawingAreaCoordinatedGraphics::enterAcceleratedCompositingMode): Use the dispalyID of the layer tree host.
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
+ (WebKit::LayerTreeHost::LayerTreeHost): Initialize the display ID.
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
+
2019-12-18 Sihui Liu <sihui_...@apple.com>
IndexedDB: perform IDBServer work only on background thread
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (253743 => 253744)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2019-12-19 09:44:47 UTC (rev 253744)
@@ -562,13 +562,16 @@
m_exitCompositingTimer.stop();
m_wantsToExitAcceleratedCompositingMode = false;
- // In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because ThreadedDisplayRefreshMonitor
- // is driven by the ThreadedCompositor of the drawing area), give each page a unique DisplayID derived from WebPage's unique ID.
- m_webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - m_webPage.identifier().toUInt64());
+ auto changeWindowScreen = [&] {
+ // In order to ensure that we get a unique DisplayRefreshMonitor per-DrawingArea (necessary because ThreadedDisplayRefreshMonitor
+ // is driven by the ThreadedCompositor of the drawing area), give each page a unique DisplayID derived from WebPage's unique ID.
+ m_webPage.windowScreenDidChange(m_layerTreeHost->displayID());
+ };
ASSERT(!m_layerTreeHost);
if (m_previousLayerTreeHost) {
m_layerTreeHost = WTFMove(m_previousLayerTreeHost);
+ changeWindowScreen();
m_layerTreeHost->setIsDiscardable(false);
m_layerTreeHost->resumeRendering();
if (!m_layerTreeStateIsFrozen)
@@ -576,6 +579,7 @@
} else {
#if USE(COORDINATED_GRAPHICS)
m_layerTreeHost = makeUnique<LayerTreeHost>(m_webPage);
+ changeWindowScreen();
#else
m_layerTreeHost = nullptr;
return;
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (253743 => 253744)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2019-12-19 09:44:47 UTC (rev 253744)
@@ -54,6 +54,7 @@
, m_layerFlushTimer(RunLoop::main(), this, &LayerTreeHost::layerFlushTimerFired)
, m_sceneIntegration(Nicosia::SceneIntegration::create(*this))
, m_coordinator(webPage, *this)
+ , m_displayID(std::numeric_limits<uint32_t>::max() - m_webPage.identifier().toUInt64())
{
#if USE(GLIB_EVENT_LOOP)
m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
@@ -75,7 +76,7 @@
if (m_surface->shouldPaintMirrored())
paintFlags |= TextureMapper::PaintingMirrored;
- m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, m_webPage.corePage()->chrome().displayID(), scaledSize, scaleFactor, paintFlags);
+ m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, m_displayID, scaledSize, scaleFactor, paintFlags);
m_layerTreeContext.contextID = m_surface->surfaceID();
didChangeViewport();
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h (253743 => 253744)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h 2019-12-19 09:34:31 UTC (rev 253743)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h 2019-12-19 09:44:47 UTC (rev 253744)
@@ -96,6 +96,8 @@
RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID);
#endif
+ WebCore::PlatformDisplayID displayID() const { return m_displayID; }
+
private:
#if USE(COORDINATED_GRAPHICS)
void layerFlushTimerFired();
@@ -201,6 +203,7 @@
Ref<Nicosia::SceneIntegration> m_sceneIntegration;
CompositingCoordinator m_coordinator;
#endif // USE(COORDINATED_GRAPHICS)
+ WebCore::PlatformDisplayID m_displayID;
};
#if !USE(COORDINATED_GRAPHICS)