bool CompositingCoordinator::flushPendingLayerChanges() { TemporaryChange<bool> protector(m_isFlushingLayerChanges, true); initializeRootCompositingLayerIfNeeded(); m_rootLayer->flushCompositingStateForThisLayerOnly(); m_client->didFlushRootLayer(); bool didSync = m_page->mainFrame().view()->flushCompositingStateIncludingSubframes(); toCoordinatedGraphicsLayer(m_rootLayer.get())->updateContentBuffersIncludingSubLayers(); toCoordinatedGraphicsLayer(m_rootLayer.get())->syncPendingStateChangesIncludingSubLayers(); flushPendingImageBackingChanges(); if (m_shouldSyncFrame) { didSync = true; if (m_rootCompositingLayer) { m_state.contentsSize = roundedIntSize(m_rootCompositingLayer->size()); if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer()) m_state.coveredRect = contentsLayer->coverRect(); } m_state.scrollPosition = m_visibleContentsRect.location(); m_client->commitSceneState(m_state); clearPendingStateChanges(); m_shouldSyncFrame = false; } return didSync; }
bool CoordinatedLayerTreeHost::flushPendingLayerChanges() { if (m_waitingForUIProcess) return false; TemporaryChange<bool> protector(m_isFlushingLayerChanges, true); createCompositingLayers(); initializeRootCompositingLayerIfNeeded(); m_rootLayer->flushCompositingStateForThisLayerOnly(); m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly(); if (m_pageOverlayLayer) m_pageOverlayLayer->flushCompositingStateForThisLayerOnly(); bool didSync = m_webPage->corePage()->mainFrame()->view()->flushCompositingStateIncludingSubframes(); flushPendingImageBackingChanges(); deleteCompositingLayers(); if (m_shouldSyncFrame) { didSync = true; m_state.contentsSize = roundedIntSize(m_nonCompositedContentLayer->size()); m_state.coveredRect = toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->coverRect(); m_state.scrollPosition = m_visibleContentsRect.location(); m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(m_state)); m_state.layersToUpdate.clear(); m_state.imagesToUpdate.clear(); m_waitingForUIProcess = true; m_shouldSyncFrame = false; } else unlockAnimations(); if (m_forceRepaintAsyncCallbackID) { m_webPage->send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsyncCallbackID)); m_forceRepaintAsyncCallbackID = 0; } return didSync; }