CoordinatedBackingStore* LayerTreeRenderer::getBackingStore(GraphicsLayer* graphicsLayer) { TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer); ASSERT(layer); CoordinatedBackingStore* backingStore = static_cast<CoordinatedBackingStore*>(layer->backingStore().get()); BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer); if (it != m_pendingSyncBackingStores.end()) backingStore = it->value.get(); return backingStore; }
PassRefPtr<LayerBackingStore> LayerTreeHostProxy::getBackingStore(WebLayerID id) { ensureLayer(id); TextureMapperLayer* layer = toTextureMapperLayer(layerByID(id)); RefPtr<LayerBackingStore> backingStore = static_cast<LayerBackingStore*>(layer->backingStore().get()); if (!backingStore) { backingStore = LayerBackingStore::create(); layer->setBackingStore(backingStore.get()); } ASSERT(backingStore); return backingStore; }
PassRefPtr<LayerBackingStore> WebLayerTreeRenderer::getBackingStore(WebLayerID id) { TextureMapperLayer* layer = toTextureMapperLayer(layerByID(id)); ASSERT(layer); RefPtr<LayerBackingStore> backingStore = static_cast<LayerBackingStore*>(layer->backingStore().get()); if (!backingStore) { backingStore = LayerBackingStore::create(); layer->setBackingStore(backingStore.get()); } ASSERT(backingStore); return backingStore; }
void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) { TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer); ASSERT(layer); // Check if the layout already has a backing store (committed or pending). BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer); if (it != m_pendingSyncBackingStores.end()) { if (it->value) { // There is a pending addition, cancel it. m_pendingSyncBackingStores.remove(it); } // There is already a pending removal. return; } if (!layer->backingStore()) return; // The layer has no backing store (and no pending addition). ASSERT(!m_pendingSyncBackingStores.contains(layer)); m_pendingSyncBackingStores.add(layer, 0); }
void LayerTreeRenderer::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) { TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer); ASSERT(layer); // Make sure the layer does not already have a backing store (committed or pending). BackingStoreMap::iterator it = m_pendingSyncBackingStores.find(layer); if (it != m_pendingSyncBackingStores.end()) { if (!it->value) { // There is a pending removal, cancel it. m_pendingSyncBackingStores.remove(it); } // There is already a pending addition. return; } if (layer->backingStore()) return; // The layer already has a backing store (and no pending removal). RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); backingStore->setSize(graphicsLayer->size()); ASSERT(!m_pendingSyncBackingStores.contains(layer)); m_pendingSyncBackingStores.add(layer, backingStore); }