void DrawingAreaProxyImpl::exitAcceleratedCompositingMode() { ASSERT(isInAcceleratedCompositingMode()); m_layerTreeContext = LayerTreeContext(); m_webPageProxy->exitAcceleratedCompositingMode(); }
void DrawingAreaProxyImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { ASSERT(isInAcceleratedCompositingMode()); m_layerTreeContext = layerTreeContext; m_webPageProxy->updateAcceleratedCompositingMode(layerTreeContext); }
void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo) { ASSERT(!isInAcceleratedCompositingMode()); if (updateInfo.updateRectBounds.isEmpty()) return; if (!m_backingStore) m_backingStore = BackingStore::create(updateInfo.viewSize, updateInfo.deviceScaleFactor, m_webPageProxy); m_backingStore->incorporateUpdate(updateInfo); bool shouldScroll = !updateInfo.scrollRect.isEmpty(); if (shouldScroll) m_webPageProxy->scrollView(updateInfo.scrollRect, updateInfo.scrollOffset); if (shouldScroll && !m_webPageProxy->canScrollView()) m_webPageProxy->setViewNeedsDisplay(IntRect(IntPoint(), m_webPageProxy->viewSize())); else { for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) m_webPageProxy->setViewNeedsDisplay(updateInfo.updateRects[i]); } if (WebPageProxy::debugPaintFlags() & kWKDebugFlashBackingStoreUpdates) m_webPageProxy->flashBackingStoreUpdates(updateInfo.updateRects); if (shouldScroll) m_webPageProxy->displayView(); }
void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext) { ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_nextBackingStoreStateID); ASSERT_ARG(backingStoreStateID, backingStoreStateID > m_currentBackingStoreStateID); m_currentBackingStoreStateID = backingStoreStateID; m_isWaitingForDidUpdateBackingStoreState = false; if (m_nextBackingStoreStateID != m_currentBackingStoreStateID) sendUpdateBackingStoreState(RespondImmediately); #if USE(ACCELERATED_COMPOSITING) if (layerTreeContext != m_layerTreeContext) { if (!m_layerTreeContext.isEmpty()) { exitAcceleratedCompositingMode(); ASSERT(m_layerTreeContext.isEmpty()); } if (!layerTreeContext.isEmpty()) { enterAcceleratedCompositingMode(layerTreeContext); ASSERT(layerTreeContext == m_layerTreeContext); } } if (isInAcceleratedCompositingMode()) { ASSERT(!m_backingStore); return; } #endif // FIXME: We could just reuse our existing backing store if it's the same size as // updateInfo.viewSize. m_backingStore = nullptr; incorporateUpdate(updateInfo); }
void DrawingAreaProxyImpl::incorporateUpdate(const UpdateInfo& updateInfo) { ASSERT(!isInAcceleratedCompositingMode()); if (updateInfo.updateRectBounds.isEmpty()) return; if (!m_backingStore) m_backingStore = std::make_unique<BackingStore>(updateInfo.viewSize, updateInfo.deviceScaleFactor, m_webPageProxy); m_backingStore->incorporateUpdate(updateInfo); bool shouldScroll = !updateInfo.scrollRect.isEmpty(); if (shouldScroll) m_webPageProxy.scrollView(updateInfo.scrollRect, updateInfo.scrollOffset); if (shouldScroll && !m_webPageProxy.canScrollView()) m_webPageProxy.setViewNeedsDisplay(IntRect(IntPoint(), m_webPageProxy.viewSize())); else { for (size_t i = 0; i < updateInfo.updateRects.size(); ++i) m_webPageProxy.setViewNeedsDisplay(updateInfo.updateRects[i]); } if (shouldScroll) m_webPageProxy.displayView(); }
DrawingAreaProxyImpl::~DrawingAreaProxyImpl() { #if USE(ACCELERATED_COMPOSITING) // Make sure to exit accelerated compositing mode. if (isInAcceleratedCompositingMode()) exitAcceleratedCompositingMode(); #endif }
void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { ASSERT(!isInAcceleratedCompositingMode()); m_backingStore = nullptr; m_layerTreeContext = layerTreeContext; m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); }
void CoordinatedDrawingAreaProxy::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { ASSERT(!isInAcceleratedCompositingMode()); m_backingStore = nullptr; m_layerTreeContext = layerTreeContext; m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); if (!m_coordinatedLayerTreeHostProxy) m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this)); }
void DrawingAreaProxyImpl::paint(BackingStore::PlatformGraphicsContext context, const IntRect& rect, Region& unpaintedRegion) { unpaintedRegion = rect; if (isInAcceleratedCompositingMode()) return; ASSERT(m_currentBackingStoreStateID <= m_nextBackingStoreStateID); if (m_currentBackingStoreStateID < m_nextBackingStoreStateID) { // Tell the web process to do a full backing store update now, in case we previously told // it about our next state but didn't request an immediate update. sendUpdateBackingStoreState(RespondImmediately); // If we haven't yet received our first bits from the WebProcess then don't paint anything. if (!m_hasReceivedFirstUpdate) return; if (m_isWaitingForDidUpdateBackingStoreState) { // Wait for a DidUpdateBackingStoreState message that contains the new bits before we paint // what's currently in the backing store. waitForAndDispatchDidUpdateBackingStoreState(); } // Dispatching DidUpdateBackingStoreState (either beneath sendUpdateBackingStoreState or // beneath waitForAndDispatchDidUpdateBackingStoreState) could destroy our backing store or // change the compositing mode. if (!m_backingStore || isInAcceleratedCompositingMode()) return; } else { ASSERT(!m_isWaitingForDidUpdateBackingStoreState); if (!m_backingStore) { // The view has asked us to paint before the web process has painted anything. There's // nothing we can do. return; } } m_backingStore->paint(context, rect); unpaintedRegion.subtract(IntRect(IntPoint(), m_backingStore->size())); discardBackingStoreSoon(); }
void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { ASSERT(!isInAcceleratedCompositingMode()); m_backingStore = nullptr; m_layerTreeContext = layerTreeContext; m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); #if USE(COORDINATED_GRAPHICS) if (!m_coordinatedLayerTreeHostProxy) m_coordinatedLayerTreeHostProxy = adoptPtr(new CoordinatedLayerTreeHostProxy(this)); #endif }
void DrawingAreaProxyImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext) { ASSERT(!isInAcceleratedCompositingMode()); m_backingStore = nullptr; m_layerTreeContext = layerTreeContext; m_webPageProxy->enterAcceleratedCompositingMode(layerTreeContext); #if USE(TEXTURE_MAPPER) if (!m_layerTreeHostProxy) m_layerTreeHostProxy = adoptPtr(new LayerTreeHostProxy(this)); #endif }
void DrawingAreaProxyImpl::didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo& updateInfo, const LayerTreeContext& layerTreeContext) { ASSERT_ARG(backingStoreStateID, backingStoreStateID <= m_nextBackingStoreStateID); ASSERT_ARG(backingStoreStateID, backingStoreStateID > m_currentBackingStoreStateID); m_currentBackingStoreStateID = backingStoreStateID; m_isWaitingForDidUpdateBackingStoreState = false; // Stop the responsiveness timer that was started in sendUpdateBackingStoreState. m_webPageProxy->process()->responsivenessTimer()->stop(); #if USE(ACCELERATED_COMPOSITING) if (layerTreeContext != m_layerTreeContext) { if (!m_layerTreeContext.isEmpty()) { exitAcceleratedCompositingMode(); ASSERT(m_layerTreeContext.isEmpty()); } if (!layerTreeContext.isEmpty()) { enterAcceleratedCompositingMode(layerTreeContext); ASSERT(layerTreeContext == m_layerTreeContext); } } #endif if (m_nextBackingStoreStateID != m_currentBackingStoreStateID) sendUpdateBackingStoreState(RespondImmediately); else m_hasReceivedFirstUpdate = true; #if USE(ACCELERATED_COMPOSITING) if (isInAcceleratedCompositingMode()) { ASSERT(!m_backingStore); return; } #else UNUSED_PARAM(layerTreeContext); #endif // If we have a backing store the right size, reuse it. if (m_backingStore && (m_backingStore->size() != updateInfo.viewSize || m_backingStore->deviceScaleFactor() != updateInfo.deviceScaleFactor)) m_backingStore = nullptr; incorporateUpdate(updateInfo); }
DrawingAreaProxyImpl::~DrawingAreaProxyImpl() { // Make sure to exit accelerated compositing mode. if (isInAcceleratedCompositingMode()) exitAcceleratedCompositingMode(); }