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::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); }
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::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot) { ++m_nextBackingStoreStateID; sendUpdateBackingStoreState(respondImmediatelyOrNot); }