Changeset 201802 in webkit
- Timestamp:
- Jun 8, 2016 5:13:11 AM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r201770 r201802 1 2016-06-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 LayerTreeHost should be created with a WebPage reference instead of a pointer 4 https://bugs.webkit.org/show_bug.cgi?id=158520 5 6 Reviewed by Žan Doberšek. 7 8 We are indeed creating the LayerTreeHost always from a WebPage reference but getting its address to pass it to 9 the LayerTreeHost create() function. 10 11 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp: 12 (WebKit::CoordinatedDrawingArea::enterAcceleratedCompositingMode): 13 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: 14 (WebKit::CoordinatedLayerTreeHost::create): 15 (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost): 16 (WebKit::CoordinatedLayerTreeHost::didFlushRootLayer): 17 (WebKit::CoordinatedLayerTreeHost::performScheduledLayerFlush): 18 (WebKit::CoordinatedLayerTreeHost::commitSceneState): 19 (WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): 20 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: 21 * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp: 22 (WebKit::ThreadedCoordinatedLayerTreeHost::create): 23 (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost): 24 (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): 25 (WebKit::ThreadedCoordinatedLayerTreeHost::compositorDidFlushLayers): 26 (WebKit::ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged): 27 (WebKit::ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect): 28 * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h: 29 * WebProcess/WebPage/DrawingAreaImpl.cpp: 30 (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): 31 * WebProcess/WebPage/LayerTreeHost.cpp: 32 (WebKit::LayerTreeHost::create): 33 (WebKit::LayerTreeHost::LayerTreeHost): 34 * WebProcess/WebPage/LayerTreeHost.h: 35 * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp: 36 (WebKit::LayerTreeHostGtk::create): 37 (WebKit::LayerTreeHostGtk::LayerTreeHostGtk): 38 (WebKit::LayerTreeHostGtk::makeContextCurrent): 39 (WebKit::LayerTreeHostGtk::deviceOrPageScaleFactorChanged): 40 (WebKit::LayerTreeHostGtk::paintContents): 41 (WebKit::LayerTreeHostGtk::deviceScaleFactor): 42 (WebKit::LayerTreeHostGtk::pageScaleFactor): 43 (WebKit::LayerTreeHostGtk::flushPendingLayerChanges): 44 (WebKit::LayerTreeHostGtk::flushAndRenderLayers): 45 (WebKit::LayerTreeHostGtk::pageBackgroundTransparencyChanged): 46 (WebKit::LayerTreeHostGtk::initialize): Deleted. 47 * WebProcess/WebPage/gtk/LayerTreeHostGtk.h: 48 1 49 2016-06-07 Sam Weinig <sam@webkit.org> 2 50 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp
r193843 r201802 307 307 m_wantsToExitAcceleratedCompositingMode = false; 308 308 309 m_layerTreeHost = LayerTreeHost::create( &m_webPage);309 m_layerTreeHost = LayerTreeHost::create(m_webPage); 310 310 if (!m_inUpdateBackingStoreState) 311 311 m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(true); -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
r200408 r201802 50 50 namespace WebKit { 51 51 52 Ref<CoordinatedLayerTreeHost> CoordinatedLayerTreeHost::create(WebPage *webPage)52 Ref<CoordinatedLayerTreeHost> CoordinatedLayerTreeHost::create(WebPage& webPage) 53 53 { 54 54 return adoptRef(*new CoordinatedLayerTreeHost(webPage)); … … 59 59 } 60 60 61 CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage *webPage)61 CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage& webPage) 62 62 : LayerTreeHost(webPage) 63 63 , m_notifyAfterScheduledLayerFlush(false) … … 70 70 , m_viewOverlayRootLayer(nullptr) 71 71 { 72 m_coordinator = std::make_unique<CompositingCoordinator>( webPage->corePage(), this);73 74 m_coordinator->createRootLayer( webPage->size());72 m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage.corePage(), this); 73 74 m_coordinator->createRootLayer(m_webPage.size()); 75 75 m_layerTreeContext.contextID = toCoordinatedGraphicsLayer(m_coordinator->rootLayer())->id(); 76 76 … … 187 187 // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually. 188 188 if (m_viewOverlayRootLayer) 189 m_viewOverlayRootLayer->flushCompositingState(visibleContentRect, m_webPage ->mainFrame()->view()->viewportIsStable());189 m_viewOverlayRootLayer->flushCompositingState(visibleContentRect, m_webPage.mainFrame()->view()->viewportIsStable()); 190 190 } 191 191 … … 203 203 204 204 if (m_forceRepaintAsyncCallbackID) { 205 m_webPage ->send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsyncCallbackID));205 m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsyncCallbackID)); 206 206 m_forceRepaintAsyncCallbackID = 0; 207 207 } 208 208 209 209 if (m_notifyAfterScheduledLayerFlush && didSync) { 210 static_cast<CoordinatedDrawingArea*>(m_webPage ->drawingArea())->layerHostDidFlushLayers();210 static_cast<CoordinatedDrawingArea*>(m_webPage.drawingArea())->layerHostDidFlushLayers(); 211 211 m_notifyAfterScheduledLayerFlush = false; 212 212 } … … 224 224 void CoordinatedLayerTreeHost::commitSceneState(const WebCore::CoordinatedGraphicsState& state) 225 225 { 226 m_webPage ->send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(state));226 m_webPage.send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(state)); 227 227 m_isWaitingForRenderer = true; 228 228 } … … 236 236 { 237 237 m_coordinator->deviceOrPageScaleFactorChanged(); 238 m_webPage ->mainFrame()->pageOverlayController().didChangeDeviceScaleFactor();238 m_webPage.mainFrame()->pageOverlayController().didChangeDeviceScaleFactor(); 239 239 } 240 240 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
r200408 r201802 41 41 { 42 42 public: 43 static Ref<CoordinatedLayerTreeHost> create(WebPage *);43 static Ref<CoordinatedLayerTreeHost> create(WebPage&); 44 44 virtual ~CoordinatedLayerTreeHost(); 45 45 … … 76 76 77 77 protected: 78 explicit CoordinatedLayerTreeHost(WebPage *);78 explicit CoordinatedLayerTreeHost(WebPage&); 79 79 80 80 private: -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
r200408 r201802 49 49 namespace WebKit { 50 50 51 Ref<ThreadedCoordinatedLayerTreeHost> ThreadedCoordinatedLayerTreeHost::create(WebPage *webPage)51 Ref<ThreadedCoordinatedLayerTreeHost> ThreadedCoordinatedLayerTreeHost::create(WebPage webPage) 52 52 { 53 53 return adoptRef(*new ThreadedCoordinatedLayerTreeHost(webPage)); … … 58 58 } 59 59 60 ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage *webPage)60 ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webPage) 61 61 : LayerTreeHost(webPage) 62 62 , m_forceRepaintAsyncCallbackID(0) … … 67 67 , m_layerFlushSchedulingEnabled(true) 68 68 { 69 m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage ->corePage(), this);70 71 m_coordinator->createRootLayer(m_webPage ->size());69 m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage.corePage(), this); 70 71 m_coordinator->createRootLayer(m_webPage.size()); 72 72 73 73 CoordinatedSurface::setFactory(createCoordinatedSurface); … … 150 150 { 151 151 m_coordinator->deviceOrPageScaleFactorChanged(); 152 m_compositor->setDeviceScaleFactor(m_webPage ->deviceScaleFactor());152 m_compositor->setDeviceScaleFactor(m_webPage.deviceScaleFactor()); 153 153 } 154 154 … … 181 181 void ThreadedCoordinatedLayerTreeHost::compositorDidFlushLayers() 182 182 { 183 static_cast<DrawingAreaImpl*>(m_webPage ->drawingArea())->layerHostDidFlushLayers();183 static_cast<DrawingAreaImpl*>(m_webPage.drawingArea())->layerHostDidFlushLayers(); 184 184 } 185 185 186 186 void ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged(float scale, const IntPoint& origin) 187 187 { 188 m_webPage ->scalePage(scale, origin);188 m_webPage.scalePage(scale, origin); 189 189 } 190 190 … … 222 222 m_lastScrollPosition = roundedIntPoint(rect.location()); 223 223 224 if (!m_webPage ->corePage()->mainFrame().view()->useFixedLayout())225 m_webPage ->corePage()->mainFrame().view()->notifyScrollPositionChanged(m_lastScrollPosition);224 if (!m_webPage.corePage()->mainFrame().view()->useFixedLayout()) 225 m_webPage.corePage()->mainFrame().view()->notifyScrollPositionChanged(m_lastScrollPosition); 226 226 } 227 227 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h
r200408 r201802 62 62 WTF_MAKE_NONCOPYABLE(ThreadedCoordinatedLayerTreeHost); WTF_MAKE_FAST_ALLOCATED; 63 63 public: 64 static Ref<ThreadedCoordinatedLayerTreeHost> create(WebPage *);64 static Ref<ThreadedCoordinatedLayerTreeHost> create(WebPage&); 65 65 virtual ~ThreadedCoordinatedLayerTreeHost(); 66 66 … … 102 102 103 103 protected: 104 explicit ThreadedCoordinatedLayerTreeHost(WebPage *);104 explicit ThreadedCoordinatedLayerTreeHost(WebPage&); 105 105 106 106 private: -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
r197927 r201802 472 472 ASSERT(!m_layerTreeHost); 473 473 474 m_layerTreeHost = LayerTreeHost::create( &m_webPage);474 m_layerTreeHost = LayerTreeHost::create(m_webPage); 475 475 #if USE(TEXTURE_MAPPER) && PLATFORM(GTK) 476 476 if (m_nativeSurfaceHandleForCompositing) -
trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
r194108 r201802 42 42 namespace WebKit { 43 43 44 PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage*webPage)44 RefPtr<LayerTreeHost> LayerTreeHost::create(WebPage& webPage) 45 45 { 46 46 #if USE(COORDINATED_GRAPHICS_THREADED) … … 52 52 #else 53 53 UNUSED_PARAM(webPage); 54 return 0;54 return nullptr; 55 55 #endif 56 56 } 57 57 58 LayerTreeHost::LayerTreeHost(WebPage *webPage)58 LayerTreeHost::LayerTreeHost(WebPage& webPage) 59 59 : m_webPage(webPage) 60 60 { -
trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
r194108 r201802 58 58 class LayerTreeHost : public RefCounted<LayerTreeHost> { 59 59 public: 60 static PassRefPtr<LayerTreeHost> create(WebPage*);60 static RefPtr<LayerTreeHost> create(WebPage&); 61 61 virtual ~LayerTreeHost(); 62 62 … … 102 102 103 103 protected: 104 explicit LayerTreeHost(WebPage *);104 explicit LayerTreeHost(WebPage&); 105 105 106 WebPage *m_webPage;106 WebPage& m_webPage; 107 107 }; 108 108 -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
r198266 r201802 127 127 } 128 128 129 PassRefPtr<LayerTreeHostGtk> LayerTreeHostGtk::create(WebPage* webPage) 130 { 131 RefPtr<LayerTreeHostGtk> host = adoptRef(new LayerTreeHostGtk(webPage)); 132 host->initialize(); 133 return host.release(); 134 } 135 136 LayerTreeHostGtk::LayerTreeHostGtk(WebPage* webPage) 129 Ref<LayerTreeHostGtk> LayerTreeHostGtk::create(WebPage& webPage) 130 { 131 return adoptRef(*new LayerTreeHostGtk(webPage)); 132 } 133 134 LayerTreeHostGtk::LayerTreeHostGtk(WebPage& webPage) 137 135 : LayerTreeHost(webPage) 138 136 , m_isValid(true) … … 142 140 , m_renderFrameScheduler(std::bind(&LayerTreeHostGtk::renderFrame, this)) 143 141 { 142 m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), *this); 143 m_rootLayer->setDrawsContent(false); 144 m_rootLayer->setSize(m_webPage.size()); 145 146 m_scaleMatrix.makeIdentity(); 147 m_scaleMatrix.scale(m_webPage.deviceScaleFactor() * m_webPage.pageScaleFactor()); 148 downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setAnchorPoint(FloatPoint3D()); 149 downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTransform(m_scaleMatrix); 150 151 // The non-composited contents are a child of the root layer. 152 m_nonCompositedContentLayer = GraphicsLayer::create(graphicsLayerFactory(), *this); 153 m_nonCompositedContentLayer->setDrawsContent(true); 154 m_nonCompositedContentLayer->setContentsOpaque(m_webPage.drawsBackground()); 155 m_nonCompositedContentLayer->setSize(m_webPage.size()); 156 if (m_webPage.corePage()->settings().acceleratedDrawingEnabled()) 157 m_nonCompositedContentLayer->setAcceleratesDrawing(true); 158 159 #ifndef NDEBUG 160 m_rootLayer->setName("LayerTreeHost root layer"); 161 m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content"); 162 #endif 163 164 m_rootLayer->addChild(m_nonCompositedContentLayer.get()); 165 m_nonCompositedContentLayer->setNeedsDisplay(); 144 166 } 145 167 … … 160 182 } 161 183 162 void LayerTreeHostGtk::initialize()163 {164 m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);165 m_rootLayer->setDrawsContent(false);166 m_rootLayer->setSize(m_webPage->size());167 168 m_scaleMatrix.makeIdentity();169 m_scaleMatrix.scale(m_webPage->deviceScaleFactor() * m_webPage->pageScaleFactor());170 downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setAnchorPoint(FloatPoint3D());171 downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTransform(m_scaleMatrix);172 173 // The non-composited contents are a child of the root layer.174 m_nonCompositedContentLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);175 m_nonCompositedContentLayer->setDrawsContent(true);176 m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground());177 m_nonCompositedContentLayer->setSize(m_webPage->size());178 if (m_webPage->corePage()->settings().acceleratedDrawingEnabled())179 m_nonCompositedContentLayer->setAcceleratesDrawing(true);180 181 #ifndef NDEBUG182 m_rootLayer->setName("LayerTreeHost root layer");183 m_nonCompositedContentLayer->setName("LayerTreeHost non-composited content");184 #endif185 186 m_rootLayer->addChild(m_nonCompositedContentLayer.get());187 m_nonCompositedContentLayer->setNeedsDisplay();188 }189 190 184 LayerTreeHostGtk::~LayerTreeHostGtk() 191 185 { … … 280 274 281 275 m_scaleMatrix.makeIdentity(); 282 m_scaleMatrix.scale(m_webPage ->deviceScaleFactor() * m_webPage->pageScaleFactor());276 m_scaleMatrix.scale(m_webPage.deviceScaleFactor() * m_webPage.pageScaleFactor()); 283 277 downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTransform(m_scaleMatrix); 284 278 } … … 292 286 { 293 287 if (graphicsLayer == m_nonCompositedContentLayer.get()) 294 m_webPage ->drawRect(graphicsContext, enclosingIntRect(clipRect));288 m_webPage.drawRect(graphicsContext, enclosingIntRect(clipRect)); 295 289 } 296 290 297 291 float LayerTreeHostGtk::deviceScaleFactor() const 298 292 { 299 return m_webPage ->deviceScaleFactor();293 return m_webPage.deviceScaleFactor(); 300 294 } 301 295 302 296 float LayerTreeHostGtk::pageScaleFactor() const 303 297 { 304 return m_webPage ->pageScaleFactor();298 return m_webPage.pageScaleFactor(); 305 299 } 306 300 … … 313 307 bool LayerTreeHostGtk::flushPendingLayerChanges() 314 308 { 315 bool viewportIsStable = m_webPage ->corePage()->mainFrame().view()->viewportIsStable();309 bool viewportIsStable = m_webPage.corePage()->mainFrame().view()->viewportIsStable(); 316 310 m_rootLayer->flushCompositingStateForThisLayerOnly(viewportIsStable); 317 311 m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly(viewportIsStable); 318 312 319 if (!m_webPage ->corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes())313 if (!m_webPage.corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes()) 320 314 return false; 321 315 … … 355 349 { 356 350 RefPtr<LayerTreeHostGtk> protect(this); 357 m_webPage ->layoutIfNeeded();351 m_webPage.layoutIfNeeded(); 358 352 359 353 if (!m_isValid) … … 372 366 if (m_notifyAfterScheduledLayerFlush) { 373 367 // Let the drawing area know that we've done a flush of the layer changes. 374 static_cast<DrawingAreaImpl*>(m_webPage ->drawingArea())->layerHostDidFlushLayers();368 static_cast<DrawingAreaImpl*>(m_webPage.drawingArea())->layerHostDidFlushLayers(); 375 369 m_notifyAfterScheduledLayerFlush = false; 376 370 } … … 402 396 void LayerTreeHostGtk::pageBackgroundTransparencyChanged() 403 397 { 404 m_nonCompositedContentLayer->setContentsOpaque(m_webPage ->drawsBackground());398 m_nonCompositedContentLayer->setContentsOpaque(m_webPage.drawsBackground()); 405 399 } 406 400 -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h
r197563 r201802 42 42 class LayerTreeHostGtk final : public LayerTreeHost, WebCore::GraphicsLayerClient { 43 43 public: 44 static PassRefPtr<LayerTreeHostGtk> create(WebPage*);44 static Ref<LayerTreeHostGtk> create(WebPage&); 45 45 virtual ~LayerTreeHostGtk(); 46 46 47 pr otected:48 explicit LayerTreeHostGtk(WebPage *);47 private: 48 explicit LayerTreeHostGtk(WebPage&); 49 49 50 50 WebCore::GraphicsLayer* rootLayer() const { return m_rootLayer.get(); } 51 52 void initialize();53 51 54 52 // LayerTreeHost … … 64 62 65 63 void setNativeSurfaceHandleForCompositing(uint64_t) override; 66 67 private:68 64 69 65 class RenderFrameScheduler {
Note: See TracChangeset
for help on using the changeset viewer.