void DrawingAreaProxyImpl::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot) { ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID); if (!m_webPageProxy->isValid()) return; if (m_isWaitingForDidUpdateBackingStoreState) return; if (m_webPageProxy->viewSize().isEmpty() && !m_webPageProxy->useFixedLayout()) return; m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately; m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_webPageProxy->deviceScaleFactor(), m_size, m_scrollOffset), m_webPageProxy->pageID()); m_scrollOffset = IntSize(); if (m_isWaitingForDidUpdateBackingStoreState) { // Start the responsiveness timer. We will stop it when we hear back from the WebProcess // in didUpdateBackingStoreState. m_webPageProxy->process()->responsivenessTimer()->start(); } #if USE(ACCELERATED_COMPOSITING) if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) { // Wait for the DidUpdateBackingStoreState message. Normally we do this in DrawingAreaProxyImpl::paint, but that // function is never called when in accelerated compositing mode. waitForAndDispatchDidUpdateBackingStoreState(); } #endif }
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::sendUpdateBackingStoreState(RespondImmediatelyOrNot respondImmediatelyOrNot) { ASSERT(m_currentBackingStoreStateID < m_nextBackingStoreStateID); if (!m_webPageProxy->isValid()) return; if (m_isWaitingForDidUpdateBackingStoreState) return; m_isWaitingForDidUpdateBackingStoreState = respondImmediatelyOrNot == RespondImmediately; m_webPageProxy->process()->send(Messages::DrawingArea::UpdateBackingStoreState(m_nextBackingStoreStateID, respondImmediatelyOrNot == RespondImmediately, m_size, m_scrollOffset), m_webPageProxy->pageID()); m_scrollOffset = IntSize(); #if USE(ACCELERATED_COMPOSITING) if (m_isWaitingForDidUpdateBackingStoreState && !m_layerTreeContext.isEmpty()) { // Wait for the DidUpdateBackingStoreState message. Normally we don this in DrawingAreaProxyImpl::paint, but that // function is never called when in accelerated compositing mode. waitForAndDispatchDidUpdateBackingStoreState(); } #endif }