void CoordinatedGraphicsScene::syncCanvasIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState& state) { ASSERT(m_textureMapper); if (state.canvasChanged) { destroyCanvasIfNeeded(layer, state); createCanvasIfNeeded(layer, state); } if (state.canvasShouldSwapBuffers) { ASSERT(m_surfaceBackingStores.contains(layer)); SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer); RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore = it->value; canvasBackingStore->swapBuffersIfNeeded(state.canvasFrontBuffer); } }
void CoordinatedGraphicsLayer::syncCanvas() { destroyCanvasIfNeeded(); createCanvasIfNeeded(); if (!(m_pendingCanvasOperation & SyncCanvas)) return; m_pendingCanvasOperation &= ~SyncCanvas; if (!m_isValidCanvas) return; ASSERT(m_canvasPlatformLayer); m_layerState.canvasFrontBuffer = m_canvasPlatformLayer->copyToGraphicsSurface(); m_layerState.canvasShouldSwapBuffers = true; }