Changeset 156861 in webkit
- Timestamp:
- Oct 3, 2013 3:52:36 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 10 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/CMakeLists.txt
r156265 r156861 260 260 UIProcess/BackingStore.cpp 261 261 UIProcess/DrawingAreaProxy.cpp 262 UIProcess/DrawingAreaProxyImpl.cpp263 262 UIProcess/FindIndicator.cpp 264 263 UIProcess/GeolocationPermissionRequestManagerProxy.cpp … … 371 370 UIProcess/Authentication/WebProtectionSpace.cpp 372 371 372 UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp 373 373 UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp 374 374 UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp … … 502 502 WebProcess/WebPage/DecoderAdapter.cpp 503 503 WebProcess/WebPage/DrawingArea.cpp 504 WebProcess/WebPage/DrawingAreaImpl.cpp505 504 WebProcess/WebPage/EncoderAdapter.cpp 506 505 WebProcess/WebPage/EventDispatcher.cpp … … 519 518 WebProcess/WebPage/WebUndoStep.cpp 520 519 520 WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp 521 521 WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 522 522 WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp -
trunk/Source/WebKit2/ChangeLog
r156860 r156861 1 2013-10-03 Sergio Correia <sergio.correia@openbossa.org> 2 3 Create CoordinatedDrawingArea / CoordinatedDrawingAreaProxy 4 https://bugs.webkit.org/show_bug.cgi?id=122207 5 6 Reviewed by Anders Carlsson. 7 8 Since Apple are moving away from DrawingAreaImpl, Coordinated Graphics 9 should have its own drawing area. 10 11 * CMakeLists.txt: Use CoordinatedDrawingArea and 12 CoordinatedDrawingAreaProxy instead of the DrawingAreaImpl / 13 DrawingAreaProxyImpl. 14 * Shared/DrawingAreaInfo.h: Add DrawingAreaTypeCoordinated. 15 * UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp: 16 Added, copied from DrawingAreaProxyImpl.cpp. 17 * UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.h: Added, 18 copied from DrawingAreaProxyImpl.h. 19 * UIProcess/CoordinatedGraphics/WebView.cpp: 20 (WebKit::WebView::createDrawingAreaProxy): Use CoordinatedDrawingAreaProxy. 21 * UIProcess/DrawingAreaProxyImpl.cpp: Remove Coordinated Graphics 22 bits. 23 * UIProcess/DrawingAreaProxyImpl.h: Ditto. 24 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp: 25 Added, copied from DrawingAreaImpl.cpp. 26 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h: 27 Added, copied from DrawingAreaImpl.h. 28 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: 29 (WebKit::CoordinatedLayerTreeHost::performScheduledLayerFlush): Use 30 CoordinatedDrawingArea. 31 * WebProcess/WebPage/DrawingArea.cpp: 32 (WebKit::DrawingArea::create): Handle the DrawingAreaTypeCoordinated 33 in the DrawingArea creation code. 34 * WebProcess/WebPage/DrawingAreaImpl.cpp: Remove Coordinated Graphics 35 bits. 36 * WebProcess/WebPage/DrawingAreaImpl.h: Ditto. 37 1 38 2013-10-03 Anders Carlsson <andersca@apple.com> 2 39 -
trunk/Source/WebKit2/Shared/DrawingAreaInfo.h
r156793 r156861 34 34 DrawingAreaTypeRemoteLayerTree, 35 35 #else 36 #if USE(COORDINATED_GRAPHICS) 37 DrawingAreaTypeCoordinated 38 #else 36 39 DrawingAreaTypeImpl, 40 #endif 37 41 #endif 38 42 }; -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp
r156860 r156861 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 25 26 26 27 #include "config.h" 27 #include "DrawingAreaProxyImpl.h" 28 28 29 #if USE(COORDINATED_GRAPHICS) 30 #include "CoordinatedDrawingAreaProxy.h" 31 32 #include "CoordinatedLayerTreeHostProxy.h" 29 33 #include "DrawingAreaMessages.h" 30 34 #include "DrawingAreaProxyMessages.h" … … 37 41 #include <WebCore/Region.h> 38 42 39 #if USE(COORDINATED_GRAPHICS)40 #include "CoordinatedLayerTreeHostProxy.h"41 #endif42 43 43 using namespace WebCore; 44 44 45 45 namespace WebKit { 46 46 47 DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy* webPageProxy)48 : DrawingAreaProxy(DrawingAreaType Impl, webPageProxy)47 CoordinatedDrawingAreaProxy::CoordinatedDrawingAreaProxy(WebPageProxy* webPageProxy) 48 : DrawingAreaProxy(DrawingAreaTypeCoordinated, webPageProxy) 49 49 , m_currentBackingStoreStateID(0) 50 50 , m_nextBackingStoreStateID(0) … … 52 52 , m_hasReceivedFirstUpdate(false) 53 53 , m_isBackingStoreDiscardable(true) 54 , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore) 55 { 56 #if USE(COORDINATED_GRAPHICS) 54 , m_discardBackingStoreTimer(RunLoop::current(), this, &CoordinatedDrawingAreaProxy::discardBackingStore) 55 { 57 56 // Construct the proxy early to allow messages to be sent to the web process while AC is entered there. 58 57 if (webPageProxy->pageGroup()->preferences()->forceCompositingMode()) 59 58 m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this)); 60 #endif 61 } 62 63 DrawingAreaProxyImpl::~DrawingAreaProxyImpl() 59 } 60 61 CoordinatedDrawingAreaProxy::~CoordinatedDrawingAreaProxy() 64 62 { 65 63 #if USE(ACCELERATED_COMPOSITING) … … 70 68 } 71 69 72 void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion)70 void CoordinatedDrawingAreaProxy::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion) 73 71 { 74 72 unpaintedRegion = rect; … … 85 83 // If we haven't yet received our first bits from the WebProcess then don't paint anything. 86 84 if (!m_hasReceivedFirstUpdate) 87 return; 88 85 return; 86 89 87 if (m_isWaitingForDidUpdateBackingStoreState) { 90 88 // Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint … … 113 111 } 114 112 115 void DrawingAreaProxyImpl::sizeDidChange()113 void CoordinatedDrawingAreaProxy::sizeDidChange() 116 114 { 117 115 backingStoreStateDidChange(RespondImmediately); 118 116 } 119 117 120 void DrawingAreaProxyImpl::deviceScaleFactorDidChange()118 void CoordinatedDrawingAreaProxy::deviceScaleFactorDidChange() 121 119 { 122 120 backingStoreStateDidChange(RespondImmediately); 123 121 } 124 122 125 void DrawingAreaProxyImpl::layerHostingModeDidChange()123 void CoordinatedDrawingAreaProxy::layerHostingModeDidChange() 126 124 { 127 125 m_webPageProxy->process()->send(Messages::DrawingArea::SetLayerHostingMode(m_webPageProxy->layerHostingMode()), m_webPageProxy->pageID()); 128 126 } 129 127 130 void DrawingAreaProxyImpl::visibilityDidChange()128 void CoordinatedDrawingAreaProxy::visibilityDidChange() 131 129 { 132 130 if (!m_webPageProxy->suppressVisibilityUpdates()) { … … 149 147 } 150 148 151 void DrawingAreaProxyImpl::setBackingStoreIsDiscardable(bool isBackingStoreDiscardable)149 void CoordinatedDrawingAreaProxy::setBackingStoreIsDiscardable(bool isBackingStoreDiscardable) 152 150 { 153 151 if (m_isBackingStoreDiscardable == isBackingStoreDiscardable) … … 161 159 } 162 160 163 void DrawingAreaProxyImpl::waitForBackingStoreUpdateOnNextPaint()161 void CoordinatedDrawingAreaProxy::waitForBackingStoreUpdateOnNextPaint() 164 162 { 165 163 m_hasReceivedFirstUpdate = true; 166 164 } 167 165 168 void DrawingAreaProxyImpl::update(uint64_t backingStoreStateID, const UpdateInfo& updateInfo)166 void CoordinatedDrawingAreaProxy::update(uint64_t backingStoreStateID, const UpdateInfo& updateInfo) 169 167 { 170 168 ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID); … … 178 176 } 179 177 180 void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext)178 void CoordinatedDrawingAreaProxy::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext) 181 179 { 182 180 ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_nextBackingStoreStateID); … … 199 197 enterAcceleratedCompositingMode(layerTreeContext); 200 198 ASSERT(layerTreeContext == m_layerTreeContext); 201 } 199 } 202 200 } 203 201 #endif … … 223 221 } 224 222 225 void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext)223 void CoordinatedDrawingAreaProxy::enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext) 226 224 { 227 225 ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID); … … 236 234 } 237 235 238 void DrawingAreaProxyImpl::exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo& updateInfo)236 void CoordinatedDrawingAreaProxy::exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo& updateInfo) 239 237 { 240 238 ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID); … … 249 247 } 250 248 251 void DrawingAreaProxyImpl::updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext)249 void CoordinatedDrawingAreaProxy::updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext& layerTreeContext) 252 250 { 253 251 ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_currentBackingStoreStateID); … … 262 260 } 263 261 264 void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo)262 void CoordinatedDrawingAreaProxy::incorporateUpdate(const UpdateInfo& updateInfo) 265 263 { 266 264 ASSERT(!isInAcceleratedCompositingMode()); … … 278 276 if (shouldScroll) 279 277 m_webPageProxy->scrollView(updateInfo.scrollRect, updateInfo.scrollOffset); 280 278 281 279 if (shouldScroll && !m_webPageProxy->canScrollView()) 282 280 m_webPageProxy->setViewNeedsDisplay(IntRect(IntPoint(), m_webPageProxy->viewSize())); … … 285 283 m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]); 286 284 } 287 285 288 286 if (WebPageProxy::debugPaintFlags() & kWKDebugFlashBackingStoreUpdates) 289 287 m_webPageProxy->flashBackingStoreUpdates(updateInfo.updateRects); … … 293 291 } 294 292 295 void DrawingAreaProxyImpl::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot)293 void CoordinatedDrawingAreaProxy::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot) 296 294 { 297 295 ++m_nextBackingStoreStateID; … … 299 297 } 300 298 301 void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot)299 void CoordinatedDrawingAreaProxy::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot) 302 300 { 303 301 ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID); … … 325 323 #if USE(ACCELERATED_COMPOSITING) 326 324 if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) { 327 // Wait for the DidUpdateBackingStoreState message. Normally we do this in DrawingAreaProxyImpl::paint, but that325 // Wait for the DidUpdateBackingStoreState message. Normally we do this in CoordinatedDrawingAreaProxy::paint, but that 328 326 // function is never called when in accelerated compositing mode. 329 327 waitForAndDispatchDidUpdateBackingStoreState(); … … 332 330 } 333 331 334 void DrawingAreaProxyImpl::waitForAndDispatchDidUpdateBackingStoreState()332 void CoordinatedDrawingAreaProxy::waitForAndDispatchDidUpdateBackingStoreState() 335 333 { 336 334 ASSERT(m_isWaitingForDidUpdateBackingStoreState); … … 354 352 355 353 #if USE(ACCELERATED_COMPOSITING) 356 void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)354 void CoordinatedDrawingAreaProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) 357 355 { 358 356 ASSERT(!isInAcceleratedCompositingMode()); … … 361 359 m_layerTreeContext = layerTreeContext; 362 360 m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); 363 #if USE(COORDINATED_GRAPHICS)364 361 if (!m_coordinatedLayerTreeHostProxy) 365 362 m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this)); 366 #endif 367 } 368 369 #if USE(COORDINATED_GRAPHICS) 370 void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector) 363 } 364 365 void CoordinatedDrawingAreaProxy::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector) 371 366 { 372 367 if (m_coordinatedLayerTreeHostProxy) 373 368 m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, trajectoryVector); 374 369 } 375 #endif 376 377 void DrawingAreaProxyImpl::exitAcceleratedCompositingMode() 370 371 void CoordinatedDrawingAreaProxy::exitAcceleratedCompositingMode() 378 372 { 379 373 ASSERT(isInAcceleratedCompositingMode()); 380 374 381 m_layerTreeContext = LayerTreeContext(); 375 m_layerTreeContext = LayerTreeContext(); 382 376 m_webPageProxy->exitAcceleratedCompositingMode(); 383 377 } 384 378 385 void DrawingAreaProxyImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)379 void CoordinatedDrawingAreaProxy::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) 386 380 { 387 381 ASSERT(isInAcceleratedCompositingMode()); … … 392 386 #endif 393 387 394 void DrawingAreaProxyImpl::discardBackingStoreSoon()388 void CoordinatedDrawingAreaProxy::discardBackingStoreSoon() 395 389 { 396 390 if (!m_isBackingStoreDiscardable || m_discardBackingStoreTimer.isActive()) … … 404 398 } 405 399 406 void DrawingAreaProxyImpl::discardBackingStore()400 void CoordinatedDrawingAreaProxy::discardBackingStore() 407 401 { 408 402 m_backingStore = nullptr; … … 411 405 412 406 } // namespace WebKit 407 #endif // USE(COORDINATED_GRAPHICS) -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.h
r156860 r156861 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 24 25 */ 25 26 26 #ifndef DrawingAreaProxyImpl_h 27 #define DrawingAreaProxyImpl_h 27 #ifndef CoordinatedDrawingAreaProxy_h 28 #define CoordinatedDrawingAreaProxy_h 29 30 #if USE(COORDINATED_GRAPHICS) 28 31 29 32 #include "BackingStore.h" … … 41 44 class CoordinatedLayerTreeHostProxy; 42 45 43 class DrawingAreaProxyImpl: public DrawingAreaProxy {46 class CoordinatedDrawingAreaProxy : public DrawingAreaProxy { 44 47 public: 45 explicit DrawingAreaProxyImpl(WebPageProxy*);46 virtual ~ DrawingAreaProxyImpl();48 explicit CoordinatedDrawingAreaProxy(WebPageProxy*); 49 virtual ~CoordinatedDrawingAreaProxy(); 47 50 48 51 void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion); … … 82 85 void exitAcceleratedCompositingMode(); 83 86 void updateAcceleratedCompositingMode(const LayerTreeContext&); 84 #if USE(COORDINATED_GRAPHICS)85 87 virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory) OVERRIDE; 86 #endif87 88 #else 88 89 bool isInAcceleratedCompositingMode() const { return false; } … … 109 110 // Used to throttle UpdateBackingStoreState messages so we don't send them faster than the Web process can handle. 110 111 bool m_isWaitingForDidUpdateBackingStoreState; 111 112 112 113 // For a new Drawing Area don't draw anything until the WebProcess has sent over the first content. 113 114 bool m_hasReceivedFirstUpdate; … … 116 117 std::unique_ptr<BackingStore> m_backingStore; 117 118 118 WebCore::RunLoop::Timer< DrawingAreaProxyImpl> m_discardBackingStoreTimer;119 WebCore::RunLoop::Timer<CoordinatedDrawingAreaProxy> m_discardBackingStoreTimer; 119 120 }; 120 121 121 122 } // namespace WebKit 122 123 123 #endif // DrawingAreaProxyImpl_h 124 #endif // USE(COORDINATED_GRAPHICS) 125 #endif // CoordinatedDrawingAreaProxy_h -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp
r156700 r156861 30 30 #include "WebView.h" 31 31 32 #include "CoordinatedDrawingAreaProxy.h" 32 33 #include "CoordinatedLayerTreeHostProxy.h" 33 #include "DrawingAreaProxyImpl.h"34 34 #include "NotImplemented.h" 35 35 #include "WebContextMenuProxy.h" … … 284 284 std::unique_ptr<DrawingAreaProxy> WebView::createDrawingAreaProxy() 285 285 { 286 return std::make_unique< DrawingAreaProxyImpl>(page());286 return std::make_unique<CoordinatedDrawingAreaProxy>(page()); 287 287 } 288 288 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
r156688 r156861 37 37 #include <WebCore/Region.h> 38 38 39 #if USE(COORDINATED_GRAPHICS)40 #include "CoordinatedLayerTreeHostProxy.h"41 #endif42 43 39 using namespace WebCore; 44 40 … … 54 50 , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore) 55 51 { 56 #if USE(COORDINATED_GRAPHICS)57 // Construct the proxy early to allow messages to be sent to the web process while AC is entered there.58 if (webPageProxy->pageGroup()->preferences()->forceCompositingMode())59 m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this));60 #endif61 52 } 62 53 … … 361 352 m_layerTreeContext = layerTreeContext; 362 353 m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); 363 #if USE(COORDINATED_GRAPHICS) 364 if (!m_coordinatedLayerTreeHostProxy) 365 m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this)); 366 #endif 367 } 368 369 #if USE(COORDINATED_GRAPHICS) 370 void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector) 371 { 372 if (m_coordinatedLayerTreeHostProxy) 373 m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, trajectoryVector); 374 } 375 #endif 354 } 376 355 377 356 void DrawingAreaProxyImpl::exitAcceleratedCompositingMode() -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
r156688 r156861 82 82 void exitAcceleratedCompositingMode(); 83 83 void updateAcceleratedCompositingMode(const LayerTreeContext&); 84 #if USE(COORDINATED_GRAPHICS)85 virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory) OVERRIDE;86 #endif87 84 #else 88 85 bool isInAcceleratedCompositingMode() const { return false; } -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp
r156860 r156861 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 25 26 26 27 #include "config.h" 27 #include "DrawingAreaImpl.h" 28 29 #if USE(COORDINATED_GRAPHICS) 30 #include "CoordinatedDrawingArea.h" 28 31 29 32 #include "DrawingAreaProxyMessages.h" … … 42 45 namespace WebKit { 43 46 44 DrawingAreaImpl::~DrawingAreaImpl()47 CoordinatedDrawingArea::~CoordinatedDrawingArea() 45 48 { 46 49 if (m_layerTreeHost) … … 48 51 } 49 52 50 DrawingAreaImpl::DrawingAreaImpl(WebPage* webPage, const WebPageCreationParameters& parameters)51 : DrawingArea(DrawingAreaType Impl, webPage)53 CoordinatedDrawingArea::CoordinatedDrawingArea(WebPage* webPage, const WebPageCreationParameters& parameters) 54 : DrawingArea(DrawingAreaTypeCoordinated, webPage) 52 55 , m_backingStoreStateID(0) 53 56 , m_isPaintingEnabled(true) … … 59 62 , m_wantsToExitAcceleratedCompositingMode(false) 60 63 , m_isPaintingSuspended(!parameters.isVisible) 61 , m_alwaysUseCompositing(false) 62 , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired) 63 , m_exitCompositingTimer(RunLoop::main(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode) 64 { 65 if (webPage->corePage()->settings().acceleratedDrawingEnabled() || webPage->corePage()->settings().forceCompositingMode()) 66 m_alwaysUseCompositing = true; 67 68 #if USE(COORDINATED_GRAPHICS) 69 m_alwaysUseCompositing = true; 70 #endif 71 72 if (m_alwaysUseCompositing) 73 enterAcceleratedCompositingMode(0); 74 } 75 76 void DrawingAreaImpl::setNeedsDisplay() 64 , m_displayTimer(RunLoop::main(), this, &CoordinatedDrawingArea::displayTimerFired) 65 , m_exitCompositingTimer(RunLoop::main(), this, &CoordinatedDrawingArea::exitAcceleratedCompositingMode) 66 { 67 // Always use compositing in CoordinatedGraphics 68 enterAcceleratedCompositingMode(0); 69 } 70 71 void CoordinatedDrawingArea::setNeedsDisplay() 77 72 { 78 73 if (!m_isPaintingEnabled) … … 88 83 } 89 84 90 void DrawingAreaImpl::setNeedsDisplayInRect(const IntRect& rect)85 void CoordinatedDrawingArea::setNeedsDisplayInRect(const IntRect& rect) 91 86 { 92 87 if (!m_isPaintingEnabled) … … 98 93 return; 99 94 } 100 95 101 96 IntRect dirtyRect = rect; 102 97 dirtyRect.intersect(m_webPage->bounds()); … … 109 104 } 110 105 111 void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)106 void CoordinatedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) 112 107 { 113 108 if (!m_isPaintingEnabled) … … 155 150 // And add them back. 156 151 m_dirtyRegion.unite(movedDirtyRegionInScrollRect); 157 } 158 152 } 153 159 154 // Compute the scroll repaint region. 160 155 Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollDelta)); … … 167 162 } 168 163 169 void DrawingAreaImpl::pageBackgroundTransparencyChanged()164 void CoordinatedDrawingArea::pageBackgroundTransparencyChanged() 170 165 { 171 166 if (m_layerTreeHost) … … 173 168 } 174 169 175 void DrawingAreaImpl::setLayerTreeStateIsFrozen(bool isFrozen)170 void CoordinatedDrawingArea::setLayerTreeStateIsFrozen(bool isFrozen) 176 171 { 177 172 if (m_layerTreeStateIsFrozen == isFrozen) … … 189 184 } 190 185 191 void DrawingAreaImpl::forceRepaint()186 void CoordinatedDrawingArea::forceRepaint() 192 187 { 193 188 setNeedsDisplay(); … … 202 197 m_layerTreeHost->forceRepaint(); 203 198 else { 204 // Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to 199 // Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to 205 200 // prevent layerHostDidFlushLayers() from being called a second time. 206 201 m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(false); … … 214 209 } 215 210 216 bool DrawingAreaImpl::forceRepaintAsync(uint64_t callbackID)211 bool CoordinatedDrawingArea::forceRepaintAsync(uint64_t callbackID) 217 212 { 218 213 return m_layerTreeHost && m_layerTreeHost->forceRepaintAsync(callbackID); 219 214 } 220 215 221 void DrawingAreaImpl::didInstallPageOverlay(PageOverlay* pageOverlay)216 void CoordinatedDrawingArea::didInstallPageOverlay(PageOverlay* pageOverlay) 222 217 { 223 218 if (m_layerTreeHost) … … 225 220 } 226 221 227 void DrawingAreaImpl::didUninstallPageOverlay(PageOverlay* pageOverlay)222 void CoordinatedDrawingArea::didUninstallPageOverlay(PageOverlay* pageOverlay) 228 223 { 229 224 if (m_layerTreeHost) … … 233 228 } 234 229 235 void DrawingAreaImpl::setPageOverlayNeedsDisplay(PageOverlay* pageOverlay, const IntRect& rect)230 void CoordinatedDrawingArea::setPageOverlayNeedsDisplay(PageOverlay* pageOverlay, const IntRect& rect) 236 231 { 237 232 if (m_layerTreeHost) { … … 243 238 } 244 239 245 void DrawingAreaImpl::setPageOverlayOpacity(PageOverlay* pageOverlay, float value)240 void CoordinatedDrawingArea::setPageOverlayOpacity(PageOverlay* pageOverlay, float value) 246 241 { 247 242 if (m_layerTreeHost) … … 249 244 } 250 245 251 void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled)246 void CoordinatedDrawingArea::setPaintingEnabled(bool paintingEnabled) 252 247 { 253 248 m_isPaintingEnabled = paintingEnabled; 254 249 } 255 250 256 void DrawingAreaImpl::updatePreferences(const WebPreferencesStore& store)251 void CoordinatedDrawingArea::updatePreferences(const WebPreferencesStore& store) 257 252 { 258 253 m_webPage->corePage()->settings().setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()) && LayerTreeHost::supportsAcceleratedCompositing()); 259 254 } 260 255 261 void DrawingAreaImpl::layerHostDidFlushLayers()256 void CoordinatedDrawingArea::layerHostDidFlushLayers() 262 257 { 263 258 ASSERT(m_layerTreeHost); … … 283 278 284 279 #if USE(ACCELERATED_COMPOSITING) 285 GraphicsLayerFactory* DrawingAreaImpl::graphicsLayerFactory()280 GraphicsLayerFactory* CoordinatedDrawingArea::graphicsLayerFactory() 286 281 { 287 282 if (m_layerTreeHost) … … 291 286 } 292 287 293 void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)288 void CoordinatedDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer) 294 289 { 295 290 // FIXME: Instead of using nested if statements, we should keep a compositing state 296 // enum in the DrawingAreaImplobject and have a changeAcceleratedCompositingState function291 // enum in the CoordinatedDrawingArea object and have a changeAcceleratedCompositingState function 297 292 // that takes the new state. 298 293 … … 315 310 } 316 311 } else { 317 if (m_layerTreeHost) {312 if (m_layerTreeHost) 318 313 m_layerTreeHost->setRootCompositingLayer(0); 319 if (!m_alwaysUseCompositing) { 320 // We'll exit accelerated compositing mode on a timer, to avoid re-entering 321 // compositing code via display() and layout. 322 // If we're leaving compositing mode because of a setSize, it is safe to 323 // exit accelerated compositing mode right away. 324 if (m_inUpdateBackingStoreState) 325 exitAcceleratedCompositingMode(); 326 else 327 exitAcceleratedCompositingModeSoon(); 328 } 329 } 330 } 331 } 332 333 void DrawingAreaImpl::scheduleCompositingLayerFlush() 314 } 315 } 316 317 void CoordinatedDrawingArea::scheduleCompositingLayerFlush() 334 318 { 335 319 if (!m_layerTreeHost) … … 339 323 #endif 340 324 341 void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset)325 void CoordinatedDrawingArea::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize& size, const WebCore::IntSize& scrollOffset) 342 326 { 343 327 ASSERT(!m_inUpdateBackingStoreState); … … 355 339 356 340 if (m_layerTreeHost) { 357 #if USE(COORDINATED_GRAPHICS)358 341 // Coordinated Graphics sets the size of the root layer to contents size. 359 342 if (!m_webPage->useFixedLayout()) 360 #endif361 343 m_layerTreeHost->sizeDidChange(m_webPage->size()); 362 344 } else … … 390 372 } 391 373 392 void DrawingAreaImpl::sendDidUpdateBackingStoreState()374 void CoordinatedDrawingArea::sendDidUpdateBackingStoreState() 393 375 { 394 376 ASSERT(!m_isWaitingForDidUpdate); … … 424 406 } 425 407 426 void DrawingAreaImpl::didUpdate()408 void CoordinatedDrawingArea::didUpdate() 427 409 { 428 410 // We might get didUpdate messages from the UI process even after we've … … 437 419 } 438 420 439 void DrawingAreaImpl::suspendPainting()421 void CoordinatedDrawingArea::suspendPainting() 440 422 { 441 423 ASSERT(!m_isPaintingSuspended); … … 450 432 } 451 433 452 void DrawingAreaImpl::resumePainting()434 void CoordinatedDrawingArea::resumePainting() 453 435 { 454 436 if (!m_isPaintingSuspended) { … … 457 439 return; 458 440 } 459 441 460 442 if (m_layerTreeHost) 461 443 m_layerTreeHost->resumeRendering(); 462 444 463 445 m_isPaintingSuspended = false; 464 446 … … 469 451 } 470 452 471 void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)453 void CoordinatedDrawingArea::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer) 472 454 { 473 455 m_exitCompositingTimer.stop(); … … 481 463 482 464 m_layerTreeHost->setRootCompositingLayer(graphicsLayer); 483 465 484 466 // Non-composited content will now be handled exclusively by the layer tree host. 485 467 m_dirtyRegion = Region(); … … 490 472 } 491 473 492 void DrawingAreaImpl::exitAcceleratedCompositingMode() 493 { 494 if (m_alwaysUseCompositing) 495 return; 496 497 ASSERT(!m_layerTreeStateIsFrozen); 498 499 m_exitCompositingTimer.stop(); 500 m_wantsToExitAcceleratedCompositingMode = false; 501 502 ASSERT(m_layerTreeHost); 503 504 m_layerTreeHost->invalidate(); 505 m_layerTreeHost = nullptr; 506 m_dirtyRegion = m_webPage->bounds(); 507 508 if (m_inUpdateBackingStoreState) 509 return; 510 511 if (m_shouldSendDidUpdateBackingStoreState) { 512 sendDidUpdateBackingStoreState(); 513 return; 514 } 515 516 UpdateInfo updateInfo; 517 if (m_isPaintingSuspended) { 518 updateInfo.viewSize = m_webPage->size(); 519 updateInfo.deviceScaleFactor = m_webPage->corePage()->deviceScaleFactor(); 520 } else 521 display(updateInfo); 522 523 #if USE(ACCELERATED_COMPOSITING) 524 // Send along a complete update of the page so we can paint the contents right after we exit the 525 // accelerated compositing mode, eliminiating flicker. 526 if (m_compositingAccordingToProxyMessages) { 527 m_webPage->send(Messages::DrawingAreaProxy::ExitAcceleratedCompositingMode(m_backingStoreStateID, updateInfo)); 528 m_compositingAccordingToProxyMessages = false; 529 } else { 530 // If we left accelerated compositing mode before we sent an EnterAcceleratedCompositingMode message to the 531 // UI process, we still need to let it know about the new contents, so send an Update message. 532 m_webPage->send(Messages::DrawingAreaProxy::Update(m_backingStoreStateID, updateInfo)); 533 } 534 #endif 535 } 536 537 void DrawingAreaImpl::exitAcceleratedCompositingModeSoon() 474 void CoordinatedDrawingArea::exitAcceleratedCompositingModeSoon() 538 475 { 539 476 if (m_layerTreeStateIsFrozen) { … … 548 485 } 549 486 550 void DrawingAreaImpl::scheduleDisplay()487 void CoordinatedDrawingArea::scheduleDisplay() 551 488 { 552 489 ASSERT(!m_layerTreeHost); … … 567 504 } 568 505 569 void DrawingAreaImpl::displayTimerFired()506 void CoordinatedDrawingArea::displayTimerFired() 570 507 { 571 508 display(); 572 509 } 573 510 574 void DrawingAreaImpl::display()511 void CoordinatedDrawingArea::display() 575 512 { 576 513 ASSERT(!m_layerTreeHost); … … 611 548 612 549 // Attempt to guess whether or not we should use the region bounds rect or the individual rects. 613 // We do this by computing the percentage of "wasted space" in the bounds. 550 // We do this by computing the percentage of "wasted space" in the bounds. If that wasted space 614 551 // is too large, then we will do individual rect painting instead. 615 552 unsigned boundsArea = bounds.width() * bounds.height(); … … 623 560 } 624 561 625 void DrawingAreaImpl::display(UpdateInfo& updateInfo)562 void CoordinatedDrawingArea::display(UpdateInfo& updateInfo) 626 563 { 627 564 ASSERT(!m_isPaintingSuspended); … … 668 605 auto graphicsContext = bitmap->createGraphicsContext(); 669 606 graphicsContext->applyDeviceScaleFactor(deviceScaleFactor); 670 607 671 608 updateInfo.updateRectBounds = bounds; 672 609 … … 691 628 } 692 629 693 #if USE(COORDINATED_GRAPHICS) 694 void DrawingAreaImpl::didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder) 630 void CoordinatedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder) 695 631 { 696 632 if (m_layerTreeHost) 697 633 m_layerTreeHost->didReceiveCoordinatedLayerTreeHostMessage(connection, decoder); 698 634 } 699 #endif700 635 701 636 } // namespace WebKit 637 #endif // USE(COORDINATED_GRAPHICS) -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h
r156860 r156861 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies). 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 24 25 */ 25 26 26 #ifndef DrawingAreaImpl_h 27 #define DrawingAreaImpl_h 27 #ifndef CoordinatedDrawingArea_h 28 #define CoordinatedDrawingArea_h 29 30 #if USE(COORDINATED_GRAPHICS) 28 31 29 32 #include "DrawingArea.h" … … 32 35 #include <WebCore/RunLoop.h> 33 36 34 namespace WebCore {35 class GraphicsContext;36 }37 38 37 namespace WebKit { 39 38 40 class ShareableBitmap; 41 class UpdateInfo; 42 43 class DrawingAreaImpl : public DrawingArea { 39 class CoordinatedDrawingArea : public DrawingArea { 44 40 public: 45 DrawingAreaImpl(WebPage*, const WebPageCreationParameters&);46 virtual ~ DrawingAreaImpl();41 CoordinatedDrawingArea(WebPage*, const WebPageCreationParameters&); 42 virtual ~CoordinatedDrawingArea(); 47 43 48 44 void layerHostDidFlushLayers(); … … 74 70 #endif 75 71 76 #if USE(COORDINATED_GRAPHICS)77 72 virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); 78 #endif79 73 80 74 // CoreIPC message handlers. … … 83 77 virtual void suspendPainting(); 84 78 virtual void resumePainting(); 85 79 86 80 void sendDidUpdateBackingStoreState(); 87 81 … … 89 83 void exitAcceleratedCompositingModeSoon(); 90 84 bool exitAcceleratedCompositingModePending() const { return m_exitCompositingTimer.isActive(); } 91 void exitAcceleratedCompositingMode() ;85 void exitAcceleratedCompositingMode() { } 92 86 93 87 void scheduleDisplay(); … … 112 106 bool m_shouldSendDidUpdateBackingStoreState; 113 107 114 // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 108 // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 115 109 // web process won't paint more frequent than the UI process can handle. 116 110 bool m_isWaitingForDidUpdate; 117 111 118 112 // True between sending the 'enter compositing' messages, and the 'exit compositing' message. 119 113 bool m_compositingAccordingToProxyMessages; … … 127 121 bool m_wantsToExitAcceleratedCompositingMode; 128 122 129 // Whether painting is suspended. We'll still keep track of the dirty region but we 123 // Whether painting is suspended. We'll still keep track of the dirty region but we 130 124 // won't paint until painting has resumed again. 131 125 bool m_isPaintingSuspended; 132 bool m_alwaysUseCompositing;133 126 134 WebCore::RunLoop::Timer< DrawingAreaImpl> m_displayTimer;135 WebCore::RunLoop::Timer< DrawingAreaImpl> m_exitCompositingTimer;127 WebCore::RunLoop::Timer<CoordinatedDrawingArea> m_displayTimer; 128 WebCore::RunLoop::Timer<CoordinatedDrawingArea> m_exitCompositingTimer; 136 129 137 130 // The layer tree host that handles accelerated compositing. … … 141 134 } // namespace WebKit 142 135 143 #endif // DrawingAreaImpl_h 136 #endif // USE(COORDINATED_GRAPHICS) 137 138 #endif // CoordinatedDrawingArea_h -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
r156566 r156861 31 31 #include "CoordinatedLayerTreeHost.h" 32 32 33 #include "CoordinatedDrawingArea.h" 33 34 #include "CoordinatedGraphicsArgumentCoders.h" 34 35 #include "CoordinatedLayerTreeHostProxyMessages.h" 35 #include "DrawingAreaImpl.h"36 36 #include "GraphicsContext.h" 37 37 #include "WebCoordinatedSurface.h" … … 319 319 320 320 if (m_notifyAfterScheduledLayerFlush && didSync) { 321 static_cast< DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();321 static_cast<CoordinatedDrawingArea*>(m_webPage->drawingArea())->layerHostDidFlushLayers(); 322 322 m_notifyAfterScheduledLayerFlush = false; 323 323 } -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
r156828 r156861 32 32 #include "TiledCoreAnimationDrawingArea.h" 33 33 #else 34 #if USE(COORDINATED_GRAPHICS) 35 #include "CoordinatedDrawingArea.h" 36 #else 34 37 #include "DrawingAreaImpl.h" 38 #endif 35 39 #endif 36 40 … … 48 52 return std::make_unique<RemoteLayerTreeDrawingArea>(webPage, parameters); 49 53 #else 54 #if USE(COORDINATED_GRAPHICS) 55 case DrawingAreaTypeCoordinated: 56 return std::make_unique<CoordinatedDrawingArea>(webPage, parameters); 57 #else 50 58 case DrawingAreaTypeImpl: 51 59 return std::make_unique<DrawingAreaImpl>(webPage, parameters); 60 #endif 52 61 #endif 53 62 } -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
r156793 r156861 66 66 m_alwaysUseCompositing = true; 67 67 68 #if USE(COORDINATED_GRAPHICS)69 m_alwaysUseCompositing = true;70 #endif71 72 68 if (m_alwaysUseCompositing) 73 69 enterAcceleratedCompositingMode(0); … … 355 351 356 352 if (m_layerTreeHost) { 357 #if USE(COORDINATED_GRAPHICS) 358 // Coordinated Graphics sets the size of the root layer to contents size. 359 if (!m_webPage->useFixedLayout()) 360 #endif 361 m_layerTreeHost->sizeDidChange(m_webPage->size()); 353 m_layerTreeHost->sizeDidChange(m_webPage->size()); 362 354 } else 363 355 m_dirtyRegion = m_webPage->bounds(); … … 691 683 } 692 684 693 #if USE(COORDINATED_GRAPHICS)694 void DrawingAreaImpl::didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder)695 {696 if (m_layerTreeHost)697 m_layerTreeHost->didReceiveCoordinatedLayerTreeHostMessage(connection, decoder);698 }699 #endif700 701 685 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
r156793 r156861 74 74 #endif 75 75 76 #if USE(COORDINATED_GRAPHICS)77 virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);78 #endif79 80 76 // CoreIPC message handlers. 81 77 virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
Note: See TracChangeset
for help on using the changeset viewer.