Changeset 242199 in webkit
- Timestamp:
- Feb 28, 2019, 5:17:41 AM (8 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 1 added
- 5 deleted
- 8 edited
- 1 moved
-
ChangeLog (modified) (1 diff)
-
PlatformWin.cmake (modified) (1 diff)
-
Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h (modified) (1 diff)
-
SourcesGTK.txt (modified) (1 diff)
-
SourcesWPE.txt (modified) (1 diff)
-
WebProcess/WebPage/AcceleratedDrawingArea.cpp (modified) (5 diffs)
-
WebProcess/WebPage/AcceleratedDrawingArea.h (modified) (2 diffs)
-
WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (deleted)
-
WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (deleted)
-
WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (moved) (moved from trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp ) (11 diffs)
-
WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h (added)
-
WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (deleted)
-
WebProcess/WebPage/DrawingAreaImpl.cpp (modified) (2 diffs)
-
WebProcess/WebPage/LayerTreeHost.cpp (deleted)
-
WebProcess/WebPage/LayerTreeHost.h (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242196 r242199 1 2019-02-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [CoordinatedGraphics] Unify all LayerTreeHost classes 4 https://bugs.webkit.org/show_bug.cgi?id=195094 5 6 Reviewed by Žan Doberšek. 7 8 There's no reason to have 3 classes, since currently LayerTreeHost is only used by coordinated graphics based 9 ports. 10 11 * PlatformWin.cmake: 12 * SourcesGTK.txt: 13 * SourcesWPE.txt: 14 * WebProcess/WebPage/AcceleratedDrawingArea.cpp: 15 (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode): 16 (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow): 17 * WebProcess/WebPage/AcceleratedDrawingArea.h: 18 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: Removed. 19 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: Removed. 20 * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp. 21 (WebKit::LayerTreeHost::LayerTreeHost): 22 (WebKit::LayerTreeHost::~LayerTreeHost): 23 (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): 24 (WebKit::LayerTreeHost::scheduleLayerFlush): 25 (WebKit::LayerTreeHost::cancelPendingLayerFlush): 26 (WebKit::LayerTreeHost::layerFlushTimerFired): 27 (WebKit::LayerTreeHost::setRootCompositingLayer): 28 (WebKit::LayerTreeHost::setViewOverlayRootLayer): 29 (WebKit::LayerTreeHost::invalidate): 30 (WebKit::LayerTreeHost::scrollNonCompositedContents): 31 (WebKit::LayerTreeHost::forceRepaint): 32 (WebKit::LayerTreeHost::forceRepaintAsync): 33 (WebKit::LayerTreeHost::sizeDidChange): 34 (WebKit::LayerTreeHost::pauseRendering): 35 (WebKit::LayerTreeHost::resumeRendering): 36 (WebKit::LayerTreeHost::graphicsLayerFactory): 37 (WebKit::LayerTreeHost::contentsSizeChanged): 38 (WebKit::LayerTreeHost::didChangeViewportAttributes): 39 (WebKit::LayerTreeHost::didChangeViewport): 40 (WebKit::LayerTreeHost::setIsDiscardable): 41 (WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing): 42 (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged): 43 (WebKit::LayerTreeHost::createDisplayRefreshMonitor): 44 (WebKit::LayerTreeHost::didFlushRootLayer): 45 (WebKit::LayerTreeHost::commitSceneState): 46 (WebKit::LayerTreeHost::frameComplete): 47 (WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing): 48 (WebKit::LayerTreeHost::didDestroyGLContext): 49 (WebKit::LayerTreeHost::willRenderFrame): 50 (WebKit::LayerTreeHost::didRenderFrame): 51 (WebKit::LayerTreeHost::requestDisplayRefreshMonitorUpdate): 52 (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate): 53 (WebKit::LayerTreeHost::renderNextFrame): 54 * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h. 55 * WebProcess/WebPage/DrawingAreaImpl.cpp: 56 (WebKit::DrawingAreaImpl::setNeedsDisplay): 57 (WebKit::DrawingAreaImpl::setNeedsDisplayInRect): 58 * WebProcess/WebPage/LayerTreeHost.cpp: Removed. 59 * WebProcess/WebPage/LayerTreeHost.h: Removed. 60 * WebPage/win/LayerTreeHost.h: Added. 61 1 62 2019-02-28 Justin Fan <justin_fan@apple.com> 2 63 -
trunk/Source/WebKit/PlatformWin.cmake
r240683 r242199 82 82 WebProcess/WebPage/AcceleratedSurface.cpp 83 83 WebProcess/WebPage/DrawingAreaImpl.cpp 84 WebProcess/WebPage/LayerTreeHost.cpp85 84 86 85 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 87 WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 88 WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 86 WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 89 87 90 88 WebProcess/WebPage/win/WebInspectorUIWin.cpp -
trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h
r235111 r242199 26 26 #pragma once 27 27 28 #include <WebCore/DisplayRefreshMonitor.h> 29 28 30 #if USE(COORDINATED_GRAPHICS_THREADED) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 29 30 #include <WebCore/DisplayRefreshMonitor.h>31 31 #include <wtf/RunLoop.h> 32 32 -
trunk/Source/WebKit/SourcesGTK.txt
r241790 r242199 404 404 WebProcess/WebPage/AcceleratedDrawingArea.cpp 405 405 WebProcess/WebPage/AcceleratedSurface.cpp 406 WebProcess/WebPage/LayerTreeHost.cpp407 406 WebProcess/WebPage/ViewGestureGeometryCollector.cpp 408 407 409 408 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 410 WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 411 WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 409 WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 412 410 413 411 WebProcess/WebPage/DrawingAreaImpl.cpp -
trunk/Source/WebKit/SourcesWPE.txt
r242082 r242199 244 244 WebProcess/WebPage/AcceleratedDrawingArea.cpp 245 245 WebProcess/WebPage/AcceleratedSurface.cpp 246 WebProcess/WebPage/LayerTreeHost.cpp247 246 248 247 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 249 WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 250 WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 248 WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 251 249 252 250 WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp -
trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp
r242082 r242199 67 67 } 68 68 69 void AcceleratedDrawingArea::setNeedsDisplay()70 {71 if (!m_isPaintingEnabled)72 return;73 74 if (m_layerTreeHost)75 m_layerTreeHost->setNonCompositedContentsNeedDisplay();76 }77 78 void AcceleratedDrawingArea::setNeedsDisplayInRect(const IntRect& rect)79 {80 if (!m_isPaintingEnabled)81 return;82 83 if (m_layerTreeHost)84 m_layerTreeHost->setNonCompositedContentsNeedDisplayInRect(rect);85 }86 87 69 void AcceleratedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) 88 70 { … … 344 326 ASSERT(!m_layerTreeHost); 345 327 if (m_previousLayerTreeHost) { 346 #if USE(COORDINATED_GRAPHICS)347 328 m_layerTreeHost = WTFMove(m_previousLayerTreeHost); 348 329 m_layerTreeHost->setIsDiscardable(false); … … 351 332 if (!m_layerTreeStateIsFrozen) 352 333 m_layerTreeHost->setLayerFlushSchedulingEnabled(true); 334 } else { 335 #if USE(COORDINATED_GRAPHICS_THREADED) 336 m_layerTreeHost = std::make_unique<LayerTreeHost>(m_webPage); 353 337 #else 354 ASSERT_NOT_REACHED(); 355 #endif 356 } else { 357 m_layerTreeHost = LayerTreeHost::create(m_webPage); 358 338 m_layerTreeHost = nullptr; 339 #endif 340 359 341 if (!m_layerTreeHost) 360 342 return; … … 394 376 m_wantsToExitAcceleratedCompositingMode = false; 395 377 396 #if USE(COORDINATED_GRAPHICS)397 378 ASSERT(m_layerTreeHost); 398 379 m_previousLayerTreeHost = WTFMove(m_layerTreeHost); … … 401 382 m_previousLayerTreeHost->setLayerFlushSchedulingEnabled(false); 402 383 m_discardPreviousLayerTreeHostTimer.startOneShot(5_s); 403 #else404 m_layerTreeHost = nullptr;405 #endif406 384 } 407 385 -
trunk/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h
r242082 r242199 41 41 protected: 42 42 // DrawingArea 43 void setNeedsDisplay() override ;44 void setNeedsDisplayInRect(const WebCore::IntRect&) override ;43 void setNeedsDisplay() override { }; 44 void setNeedsDisplayInRect(const WebCore::IntRect&) override { }; 45 45 void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override; 46 46 void setLayerTreeStateIsFrozen(bool) override; … … 129 129 130 130 // The layer tree host that handles accelerated compositing. 131 RefPtr<LayerTreeHost> m_layerTreeHost;131 std::unique_ptr<LayerTreeHost> m_layerTreeHost; 132 132 133 RefPtr<LayerTreeHost> m_previousLayerTreeHost;133 std::unique_ptr<LayerTreeHost> m_previousLayerTreeHost; 134 134 RunLoop::Timer<AcceleratedDrawingArea> m_discardPreviousLayerTreeHostTimer; 135 135 }; -
trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
r242198 r242199 3 3 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 * Copyright (C) 2012 Company 100, Inc. 5 * Copyright (C) 2014 Igalia S.L.5 * Copyright (C) 2014-2019 Igalia S.L. 6 6 * 7 7 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "config.h" 30 #include " ThreadedCoordinatedLayerTreeHost.h"30 #include "LayerTreeHost.h" 31 31 32 32 #if USE(COORDINATED_GRAPHICS_THREADED) 33 33 34 #include " AcceleratedSurface.h"34 #include "DrawingArea.h" 35 35 #include "WebPage.h" 36 #include "WebPageProxyMessages.h" 36 37 #include <WebCore/Frame.h> 37 38 #include <WebCore/FrameView.h> 39 #include <WebCore/PageOverlayController.h> 40 41 #if USE(GLIB_EVENT_LOOP) 42 #include <wtf/glib/RunLoopSourcePriority.h> 43 #endif 38 44 39 45 namespace WebKit { … … 47 53 #endif 48 54 49 Ref<ThreadedCoordinatedLayerTreeHost> ThreadedCoordinatedLayerTreeHost::create(WebPage& webPage) 50 { 51 return adoptRef(*new ThreadedCoordinatedLayerTreeHost(webPage)); 52 } 53 54 ThreadedCoordinatedLayerTreeHost::~ThreadedCoordinatedLayerTreeHost() 55 { 56 } 57 58 ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webPage) 59 : CoordinatedLayerTreeHost(webPage) 55 LayerTreeHost::LayerTreeHost(WebPage& webPage) 56 : m_webPage(webPage) 57 , m_coordinator(webPage.corePage(), *this) 60 58 , m_compositorClient(*this) 61 59 , m_surface(AcceleratedSurface::create(webPage, *this)) 62 60 , m_viewportController(webPage.size()) 63 { 61 , m_layerFlushTimer(RunLoop::main(), this, &LayerTreeHost::layerFlushTimerFired) 62 { 63 #if USE(GLIB_EVENT_LOOP) 64 m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer); 65 m_layerFlushTimer.setName("[WebKit] LayerTreeHost"); 66 #endif 67 m_coordinator.createRootLayer(m_webPage.size()); 68 scheduleLayerFlush(); 69 64 70 if (FrameView* frameView = m_webPage.mainFrameView()) { 65 71 auto contentsSize = frameView->contentsSize(); … … 88 94 } 89 95 90 void ThreadedCoordinatedLayerTreeHost::invalidate() 91 { 96 LayerTreeHost::~LayerTreeHost() 97 { 98 ASSERT(!m_isValid); 99 } 100 101 void LayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled) 102 { 103 if (m_layerFlushSchedulingEnabled == layerFlushingEnabled) 104 return; 105 106 m_layerFlushSchedulingEnabled = layerFlushingEnabled; 107 108 if (m_layerFlushSchedulingEnabled) { 109 scheduleLayerFlush(); 110 return; 111 } 112 113 cancelPendingLayerFlush(); 114 } 115 116 void LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush) 117 { 118 m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush; 119 } 120 121 void LayerTreeHost::scheduleLayerFlush() 122 { 123 if (!m_layerFlushSchedulingEnabled) 124 return; 125 126 if (m_isWaitingForRenderer) { 127 m_scheduledWhileWaitingForRenderer = true; 128 return; 129 } 130 131 if (!m_layerFlushTimer.isActive()) 132 m_layerFlushTimer.startOneShot(0_s); 133 } 134 135 void LayerTreeHost::cancelPendingLayerFlush() 136 { 137 m_layerFlushTimer.stop(); 138 } 139 140 void LayerTreeHost::layerFlushTimerFired() 141 { 142 if (m_isSuspended || m_isWaitingForRenderer) 143 return; 144 145 m_coordinator.syncDisplayState(); 146 m_webPage.flushPendingEditorStateUpdate(); 147 m_webPage.willDisplayPage(); 148 149 if (!m_isValid || !m_coordinator.rootCompositingLayer()) 150 return; 151 152 // If a force-repaint callback was registered, we should force a 'frame sync' that 153 // will guarantee us a call to renderNextFrame() once the update is complete. 154 if (m_forceRepaintAsync.callbackID) 155 m_coordinator.forceFrameSync(); 156 157 bool didSync = m_coordinator.flushPendingLayerChanges(); 158 159 if (m_notifyAfterScheduledLayerFlush && didSync) { 160 m_webPage.drawingArea()->layerHostDidFlushLayers(); 161 m_notifyAfterScheduledLayerFlush = false; 162 } 163 } 164 165 void LayerTreeHost::setRootCompositingLayer(GraphicsLayer* graphicsLayer) 166 { 167 m_coordinator.setRootCompositingLayer(graphicsLayer); 168 } 169 170 void LayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer) 171 { 172 m_viewOverlayRootLayer = viewOverlayRootLayer; 173 m_coordinator.setViewOverlayRootLayer(viewOverlayRootLayer); 174 } 175 176 void LayerTreeHost::invalidate() 177 { 178 ASSERT(m_isValid); 179 m_isValid = false; 180 181 cancelPendingLayerFlush(); 182 183 m_coordinator.invalidate(); 92 184 m_compositor->invalidate(); 93 CoordinatedLayerTreeHost::invalidate();94 185 m_surface = nullptr; 95 186 } 96 187 97 void ThreadedCoordinatedLayerTreeHost::forceRepaint() 98 { 99 CoordinatedLayerTreeHost::forceRepaint(); 100 m_compositor->forceRepaint(); 101 } 102 103 void ThreadedCoordinatedLayerTreeHost::frameComplete() 104 { 105 m_compositor->frameComplete(); 106 } 107 108 void ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate() 109 { 110 // Flush layers to cause a repaint. If m_isWaitingForRenderer was true at this point, the layer 111 // flush won't do anything, but that means there's a painting ongoing that will send the 112 // display refresh notification when it's done. 113 flushLayersAndForceRepaint(); 114 } 115 116 void ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled) 117 { 118 // Call renderNextFrame. If hasBeenRescheduled is true, the layer flush will force a repaint 119 // that will cause the display refresh notification to come. 120 renderNextFrame(hasBeenRescheduled); 121 m_compositor->handleDisplayRefreshMonitorUpdate(); 122 } 123 124 uint64_t ThreadedCoordinatedLayerTreeHost::nativeSurfaceHandleForCompositing() 125 { 126 if (!m_surface) 127 return m_layerTreeContext.contextID; 128 129 m_surface->initialize(); 130 return m_surface->window(); 131 } 132 133 void ThreadedCoordinatedLayerTreeHost::didDestroyGLContext() 134 { 135 if (m_surface) 136 m_surface->finalize(); 137 } 138 139 void ThreadedCoordinatedLayerTreeHost::willRenderFrame() 140 { 141 if (m_surface) 142 m_surface->willRenderFrame(); 143 } 144 145 void ThreadedCoordinatedLayerTreeHost::didRenderFrame() 146 { 147 if (m_surface) 148 m_surface->didRenderFrame(); 149 } 150 151 void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const IntRect& rect) 152 { 153 FrameView* frameView = m_webPage.mainFrameView(); 188 void LayerTreeHost::scrollNonCompositedContents(const IntRect& rect) 189 { 190 auto* frameView = m_webPage.mainFrameView(); 154 191 if (!frameView || !frameView->delegatesScrolling()) 155 192 return; … … 162 199 } 163 200 164 void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const IntSize& newSize) 201 void LayerTreeHost::forceRepaint() 202 { 203 // This is necessary for running layout tests. Since in this case we are not waiting for a UIProcess to reply nicely. 204 // Instead we are just triggering forceRepaint. But we still want to have the scripted animation callbacks being executed. 205 m_coordinator.syncDisplayState(); 206 207 // We need to schedule another flush, otherwise the forced paint might cancel a later expected flush. 208 scheduleLayerFlush(); 209 210 if (!m_isWaitingForRenderer) 211 m_coordinator.flushPendingLayerChanges(); 212 m_compositor->forceRepaint(); 213 } 214 215 bool LayerTreeHost::forceRepaintAsync(CallbackID callbackID) 216 { 217 scheduleLayerFlush(); 218 219 // We want a clean repaint, meaning that if we're currently waiting for the renderer 220 // to finish an update, we'll have to schedule another flush when it's done. 221 ASSERT(!m_forceRepaintAsync.callbackID); 222 m_forceRepaintAsync.callbackID = OptionalCallbackID(callbackID); 223 m_forceRepaintAsync.needsFreshFlush = m_scheduledWhileWaitingForRenderer; 224 return true; 225 } 226 227 void LayerTreeHost::sizeDidChange(const IntSize& size) 228 { 229 if (m_isDiscardable) { 230 m_discardableSyncActions.add(DiscardableSyncActions::UpdateSize); 231 m_viewportController.didChangeViewportSize(size); 232 return; 233 } 234 235 if (m_surface && m_surface->hostResize(size)) 236 m_layerTreeContext.contextID = m_surface->surfaceID(); 237 238 m_coordinator.sizeDidChange(size); 239 scheduleLayerFlush(); 240 241 m_viewportController.didChangeViewportSize(size); 242 IntSize scaledSize(size); 243 scaledSize.scale(m_webPage.deviceScaleFactor()); 244 m_compositor->setViewportSize(scaledSize, m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor()); 245 didChangeViewport(); 246 } 247 248 void LayerTreeHost::pauseRendering() 249 { 250 m_isSuspended = true; 251 } 252 253 void LayerTreeHost::resumeRendering() 254 { 255 m_isSuspended = false; 256 scheduleLayerFlush(); 257 } 258 259 GraphicsLayerFactory* LayerTreeHost::graphicsLayerFactory() 260 { 261 return &m_coordinator; 262 } 263 264 void LayerTreeHost::contentsSizeChanged(const IntSize& newSize) 165 265 { 166 266 m_viewportController.didChangeContentsSize(newSize); … … 171 271 } 172 272 173 void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged() 174 { 175 if (m_isDiscardable) { 176 m_discardableSyncActions.add(DiscardableSyncActions::UpdateScale); 177 return; 178 } 179 180 if (m_surface && m_surface->hostResize(m_webPage.size())) 181 m_layerTreeContext.contextID = m_surface->surfaceID(); 182 183 CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged(); 184 m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor()); 185 } 186 187 void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size) 188 { 189 if (m_isDiscardable) { 190 m_discardableSyncActions.add(DiscardableSyncActions::UpdateSize); 191 m_viewportController.didChangeViewportSize(size); 192 return; 193 } 194 195 if (m_surface && m_surface->hostResize(size)) 196 m_layerTreeContext.contextID = m_surface->surfaceID(); 197 198 CoordinatedLayerTreeHost::sizeDidChange(size); 199 m_viewportController.didChangeViewportSize(size); 200 IntSize scaledSize(size); 201 scaledSize.scale(m_webPage.deviceScaleFactor()); 202 m_compositor->setViewportSize(scaledSize, m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor()); 203 didChangeViewport(); 204 } 205 206 void ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr) 273 void LayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr) 207 274 { 208 275 m_viewportController.didChangeViewportAttributes(WTFMove(attr)); … … 213 280 } 214 281 215 #if PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) 216 void ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle) 217 { 218 m_layerTreeContext.contextID = handle; 219 m_compositor->setNativeSurfaceHandleForCompositing(handle); 220 scheduleLayerFlush(); 221 } 222 #endif 223 224 void ThreadedCoordinatedLayerTreeHost::didChangeViewport() 282 void LayerTreeHost::didChangeViewport() 225 283 { 226 284 FloatRect visibleRect(m_viewportController.visibleContentsRect()); … … 239 297 visibleRect.expand(0, scrollbar->height()); 240 298 241 CoordinatedLayerTreeHost::setVisibleContentsRect(visibleRect); 299 m_coordinator.setVisibleContentsRect(visibleRect); 300 scheduleLayerFlush(); 242 301 243 302 float pageScale = m_viewportController.pageScaleFactor(); … … 257 316 } 258 317 259 void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state) 260 { 261 CoordinatedLayerTreeHost::commitSceneState(state); 262 m_compositor->updateSceneState(state); 263 } 264 265 void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable) 318 void LayerTreeHost::setIsDiscardable(bool discardable) 266 319 { 267 320 m_isDiscardable = discardable; … … 289 342 } 290 343 344 #if PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW) 345 void LayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle) 346 { 347 m_layerTreeContext.contextID = handle; 348 m_compositor->setNativeSurfaceHandleForCompositing(handle); 349 scheduleLayerFlush(); 350 } 351 #endif 352 353 void LayerTreeHost::deviceOrPageScaleFactorChanged() 354 { 355 if (m_isDiscardable) { 356 m_discardableSyncActions.add(DiscardableSyncActions::UpdateScale); 357 return; 358 } 359 360 if (m_surface && m_surface->hostResize(m_webPage.size())) 361 m_layerTreeContext.contextID = m_surface->surfaceID(); 362 363 m_coordinator.deviceOrPageScaleFactorChanged(); 364 m_webPage.corePage()->pageOverlayController().didChangeDeviceScaleFactor(); 365 m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor()); 366 } 367 291 368 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 292 RefPtr< WebCore::DisplayRefreshMonitor> ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor(PlatformDisplayID displayID)369 RefPtr<DisplayRefreshMonitor> LayerTreeHost::createDisplayRefreshMonitor(PlatformDisplayID displayID) 293 370 { 294 371 return m_compositor->displayRefreshMonitor(displayID); … … 296 373 #endif 297 374 375 void LayerTreeHost::didFlushRootLayer(const FloatRect& visibleContentRect) 376 { 377 // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually. 378 if (m_viewOverlayRootLayer) 379 m_viewOverlayRootLayer->flushCompositingState(visibleContentRect); 380 } 381 382 void LayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state) 383 { 384 m_isWaitingForRenderer = true; 385 m_compositor->updateSceneState(state); 386 } 387 388 void LayerTreeHost::frameComplete() 389 { 390 m_compositor->frameComplete(); 391 } 392 393 uint64_t LayerTreeHost::nativeSurfaceHandleForCompositing() 394 { 395 if (!m_surface) 396 return m_layerTreeContext.contextID; 397 398 m_surface->initialize(); 399 return m_surface->window(); 400 } 401 402 void LayerTreeHost::didDestroyGLContext() 403 { 404 if (m_surface) 405 m_surface->finalize(); 406 } 407 408 void LayerTreeHost::willRenderFrame() 409 { 410 if (m_surface) 411 m_surface->willRenderFrame(); 412 } 413 414 void LayerTreeHost::didRenderFrame() 415 { 416 if (m_surface) 417 m_surface->didRenderFrame(); 418 } 419 420 void LayerTreeHost::requestDisplayRefreshMonitorUpdate() 421 { 422 // Flush layers to cause a repaint. If m_isWaitingForRenderer was true at this point, the layer 423 // flush won't do anything, but that means there's a painting ongoing that will send the 424 // display refresh notification when it's done. 425 m_coordinator.forceFrameSync(); 426 scheduleLayerFlush(); 427 } 428 429 void LayerTreeHost::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled) 430 { 431 // Call renderNextFrame. If hasBeenRescheduled is true, the layer flush will force a repaint 432 // that will cause the display refresh notification to come. 433 renderNextFrame(hasBeenRescheduled); 434 m_compositor->handleDisplayRefreshMonitorUpdate(); 435 } 436 437 void LayerTreeHost::renderNextFrame(bool forceRepaint) 438 { 439 m_isWaitingForRenderer = false; 440 bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false); 441 m_coordinator.renderNextFrame(); 442 443 if (m_forceRepaintAsync.callbackID) { 444 // If the asynchronous force-repaint needs a separate fresh flush, it was due to 445 // the force-repaint request being registered while CoordinatedLayerTreeHost was 446 // waiting for the renderer to finish an update. 447 ASSERT(!m_forceRepaintAsync.needsFreshFlush || scheduledWhileWaitingForRenderer); 448 449 // Execute the callback if another layer flush and the subsequent state update 450 // aren't needed. If they are, the callback will be executed when this function 451 // is called after the next update. 452 if (!m_forceRepaintAsync.needsFreshFlush) { 453 m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsync.callbackID.callbackID())); 454 m_forceRepaintAsync.callbackID = OptionalCallbackID(); 455 } 456 m_forceRepaintAsync.needsFreshFlush = false; 457 } 458 459 if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive() || forceRepaint) { 460 m_layerFlushTimer.stop(); 461 if (forceRepaint) 462 m_coordinator.forceFrameSync(); 463 layerFlushTimerFired(); 464 } 465 } 466 298 467 } // namespace WebKit 299 468 -
trunk/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp
r242082 r242199 62 62 if (m_layerTreeHost) { 63 63 ASSERT(m_dirtyRegion.isEmpty()); 64 AcceleratedDrawingArea::setNeedsDisplay();65 64 return; 66 65 } … … 73 72 if (m_layerTreeHost) { 74 73 ASSERT(m_dirtyRegion.isEmpty()); 75 AcceleratedDrawingArea::setNeedsDisplayInRect(rect);76 74 return; 77 75 }
Note:
See TracChangeset
for help on using the changeset viewer.