void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState& state) { m_renderedContentsScrollPosition = state.scrollPosition; createLayers(state.layersToCreate); deleteLayers(state.layersToRemove); if (state.rootCompositingLayer != m_rootLayerID) setRootLayerID(state.rootCompositingLayer); syncImageBackings(state); syncUpdateAtlases(state); for (size_t i = 0; i < state.layersToUpdate.size(); ++i) setLayerState(state.layersToUpdate[i].first, state.layersToUpdate[i].second); commitPendingBackingStoreOperations(); removeReleasedImageBackingsIfNeeded(); // The pending tiles state is on its way for the screen, tell the web process to render the next one. RefPtr<CoordinatedGraphicsScene> protector(this); dispatchOnMainThread([=] { protector->renderNextFrame(); }); }
void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState& state) { m_renderedContentsScrollPosition = state.scrollPosition; createLayers(state.layersToCreate); deleteLayers(state.layersToRemove); if (state.rootCompositingLayer != m_rootLayerID) setRootLayerID(state.rootCompositingLayer); syncImageBackings(state); syncUpdateAtlases(state); #if ENABLE(CSS_SHADERS) syncCustomFilterPrograms(state); #endif for (size_t i = 0; i < state.layersToUpdate.size(); ++i) setLayerState(state.layersToUpdate[i].first, state.layersToUpdate[i].second); commitPendingBackingStoreOperations(); removeReleasedImageBackingsIfNeeded(); // The pending tiles state is on its way for the screen, tell the web process to render the next one. dispatchOnMainThread(bind(&CoordinatedGraphicsScene::renderNextFrame, this)); }
void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState& state) { m_renderedContentsScrollPosition = state.scrollPosition; // Since the frame has now been rendered, we can safely unlock the animations until the next layout. setAnimationsLocked(false); if (state.rootCompositingLayer != m_rootLayerID) setRootLayerID(state.rootCompositingLayer); if (state.backgroundColor != m_backgroundColor) setBackgroundColor(state.backgroundColor); for (size_t i = 0; i < state.imagesToUpdate.size(); ++i) updateImageBacking(state.imagesToUpdate[i].first, state.imagesToUpdate[i].second); for (size_t i = 0; i < state.layersToUpdate.size(); ++i) setLayerState(state.layersToUpdate[i].first, state.layersToUpdate[i].second); m_rootLayer->flushCompositingState(FloatRect()); commitPendingBackingStoreOperations(); removeReleasedImageBackingsIfNeeded(); // The pending tiles state is on its way for the screen, tell the web process to render the next one. dispatchOnMainThread(bind(&CoordinatedGraphicsScene::renderNextFrame, this)); }
void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState& state) { m_renderedContentsScrollPosition = state.scrollPosition; createLayers(state.layersToCreate); deleteLayers(state.layersToRemove); if (state.rootCompositingLayer != m_rootLayerID) setRootLayerID(state.rootCompositingLayer); syncImageBackings(state); syncUpdateAtlases(state); for (auto& layer : state.layersToUpdate) setLayerState(layer.first, layer.second); commitPendingBackingStoreOperations(); removeReleasedImageBackingsIfNeeded(); }
void LayerTreeHostProxy::syncRemoteContent() { // We enqueue messages and execute them during paint, as they require an active GL context. ensureRootLayer(); while (OwnPtr<LayerTreeMessageToRenderer> nextMessage = m_messagesToRenderer.tryGetMessage()) { switch (nextMessage->type()) { case LayerTreeMessageToRenderer::SetRootLayer: { const SetRootLayerMessageData& data = static_cast<SetRootLayerMessage*>(nextMessage.get())->data(); setRootLayerID(data.layerID); break; } case LayerTreeMessageToRenderer::DeleteLayer: { const DeleteLayerMessageData& data = static_cast<DeleteLayerMessage*>(nextMessage.get())->data(); deleteLayer(data.layerID); break; } case LayerTreeMessageToRenderer::SyncLayerParameters: { const SyncLayerParametersMessageData& data = static_cast<SyncLayerParametersMessage*>(nextMessage.get())->data(); syncLayerParameters(data.layerInfo); break; } case LayerTreeMessageToRenderer::CreateTile: { const CreateTileMessageData& data = static_cast<CreateTileMessage*>(nextMessage.get())->data(); createTile(data.layerID, data.remoteTileID, data.scale); break; } case LayerTreeMessageToRenderer::RemoveTile: { const RemoveTileMessageData& data = static_cast<RemoveTileMessage*>(nextMessage.get())->data(); removeTile(data.layerID, data.remoteTileID); break; } case LayerTreeMessageToRenderer::UpdateTile: { const UpdateTileMessageData& data = static_cast<UpdateTileMessage*>(nextMessage.get())->data(); updateTile(data.layerID, data.remoteTileID, data.sourceRect, data.targetRect, data.image); break; } case LayerTreeMessageToRenderer::CreateImage: { const CreateImageMessageData& data = static_cast<CreateImageMessage*>(nextMessage.get())->data(); createImage(data.imageID, data.image); break; } case LayerTreeMessageToRenderer::DestroyImage: { const CreateImageMessageData& data = static_cast<CreateImageMessage*>(nextMessage.get())->data(); destroyImage(data.imageID); break; } case LayerTreeMessageToRenderer::FlushLayerChanges: flushLayerChanges(); break; } } }
void LayerTreeHostProxy::syncLayerParameters(const WebLayerInfo& layerInfo) { WebLayerID id = layerInfo.id; ensureLayer(id); LayerMap::iterator it = m_layers.find(id); GraphicsLayer* layer = it->second; layer->setName(layerInfo.name); layer->setReplicatedByLayer(layerByID(layerInfo.replica)); layer->setMaskLayer(layerByID(layerInfo.mask)); layer->setPosition(layerInfo.pos); layer->setSize(layerInfo.size); layer->setTransform(layerInfo.transform); layer->setAnchorPoint(layerInfo.anchorPoint); layer->setChildrenTransform(layerInfo.childrenTransform); layer->setBackfaceVisibility(layerInfo.backfaceVisible); layer->setContentsOpaque(layerInfo.contentsOpaque); layer->setContentsRect(layerInfo.contentsRect); layer->setDrawsContent(layerInfo.drawsContent); if (layerInfo.imageIsUpdated) assignImageToLayer(layer, layerInfo.imageBackingStoreID); // Never make the root layer clip. layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds); layer->setOpacity(layerInfo.opacity); layer->setPreserves3D(layerInfo.preserves3D); Vector<GraphicsLayer*> children; for (size_t i = 0; i < layerInfo.children.size(); ++i) { WebLayerID childID = layerInfo.children[i]; GraphicsLayer* child = layerByID(childID); if (!child) { child = createLayer(childID).leakPtr(); m_layers.add(childID, child); } children.append(child); } layer->setChildren(children); for (size_t i = 0; i < layerInfo.animations.size(); ++i) { const WebKit::WebLayerAnimation anim = layerInfo.animations[i]; switch (anim.operation) { case WebKit::WebLayerAnimation::AddAnimation: { const IntSize boxSize = anim.boxSize; double offset = WTF::currentTime() - anim.startTime; layer->addAnimation(anim.keyframeList, boxSize, anim.animation.get(), anim.name, offset); break; } case WebKit::WebLayerAnimation::RemoveAnimation: layer->removeAnimation(anim.name); break; case WebKit::WebLayerAnimation::PauseAnimation: double offset = WTF::currentTime() - anim.startTime; layer->pauseAnimation(anim.name, offset); break; } } if (layerInfo.isRootLayer && m_rootLayerID != id) setRootLayerID(id); }