| Index: cc/blimp/compositor_state_deserializer.h
|
| diff --git a/cc/blimp/compositor_state_deserializer.h b/cc/blimp/compositor_state_deserializer.h
|
| index 5357bcf5c5da81a3c0846b456f19b5c08a7dba97..141e341a122dff5943103190eabcac995b653dce 100644
|
| --- a/cc/blimp/compositor_state_deserializer.h
|
| +++ b/cc/blimp/compositor_state_deserializer.h
|
| @@ -19,7 +19,9 @@ class LayerTree;
|
| class LayerTreeHost;
|
| } // namespace proto
|
|
|
| +class ClientPictureCache;
|
| class CompositorStateDeserializerClient;
|
| +class DeserializedContentLayerClient;
|
| class Layer;
|
| class LayerFactory;
|
| class LayerTreeHost;
|
| @@ -31,14 +33,19 @@ class CC_EXPORT CompositorStateDeserializer {
|
| // is updated.
|
| using ScrollCallback = base::Callback<void(int engine_layer_id)>;
|
|
|
| - CompositorStateDeserializer(LayerTreeHost* layer_tree_host,
|
| - ScrollCallback scroll_callback,
|
| - CompositorStateDeserializerClient* client);
|
| + CompositorStateDeserializer(
|
| + LayerTreeHost* layer_tree_host,
|
| + std::unique_ptr<ClientPictureCache> client_picture_cache,
|
| + const ScrollCallback& scroll_callback,
|
| + CompositorStateDeserializerClient* client);
|
| ~CompositorStateDeserializer();
|
|
|
| // Returns the local layer on the client for the given |engine_layer_id|.
|
| Layer* GetLayerForEngineId(int engine_layer_id) const;
|
|
|
| + // Returns the local layer id on the client for the given |engine_layer_id|.
|
| + int GetClientIdFromEngineId(int engine_layer_id) const;
|
| +
|
| // Deserializes the |layer_tree_host_proto| into the LayerTreeHost.
|
| void DeserializeCompositorUpdate(
|
| const proto::LayerTreeHost& layer_tree_host_proto);
|
| @@ -47,23 +54,49 @@ class CC_EXPORT CompositorStateDeserializer {
|
| void SetLayerFactoryForTesting(std::unique_ptr<LayerFactory> layer_factory);
|
|
|
| private:
|
| - using EngineIdToLayerMap = std::unordered_map<int, scoped_refptr<Layer>>;
|
| + // A holder for the Layer and any data tied to it.
|
| + struct LayerData {
|
| + LayerData();
|
| + LayerData(LayerData&& other);
|
| + ~LayerData();
|
| +
|
| + LayerData& operator=(LayerData&& other);
|
| +
|
| + scoped_refptr<Layer> layer;
|
| +
|
| + // Set only for PictureLayers.
|
| + std::unique_ptr<DeserializedContentLayerClient> content_layer_client;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(LayerData);
|
| + };
|
| +
|
| + using EngineIdToLayerMap = std::unordered_map<int, LayerData>;
|
| + // Map of the scrollbar layer id to the corresponding scroll layer id. Both
|
| + // ids refer to the engine layer id.
|
| + using ScrollbarLayerToScrollLayerId = std::unordered_map<int, int>;
|
|
|
| void SychronizeLayerTreeState(const proto::LayerTree& layer_tree_proto);
|
| void SynchronizeLayerState(
|
| const proto::LayerProperties& layer_properties_proto);
|
| - void SynchronizeLayerHierarchyRecursive(Layer* layer,
|
| - const proto::LayerNode& layer_node,
|
| - EngineIdToLayerMap* new_layer_map);
|
| + void SynchronizeLayerHierarchyRecursive(
|
| + Layer* layer,
|
| + const proto::LayerNode& layer_node,
|
| + EngineIdToLayerMap* new_layer_map,
|
| + ScrollbarLayerToScrollLayerId* scrollbar_layer_to_scroll_layer);
|
| scoped_refptr<Layer> GetLayerAndAddToNewMap(
|
| const proto::LayerNode& layer_node,
|
| - EngineIdToLayerMap* new_layer_map);
|
| + EngineIdToLayerMap* new_layer_map,
|
| + ScrollbarLayerToScrollLayerId* scrollbar_layer_to_scroll_layer);
|
|
|
| - int GetClientIdFromEngineId(int engine_layer_id);
|
| - scoped_refptr<Layer> GetLayer(int engine_layer_id);
|
| + scoped_refptr<Layer> GetLayer(int engine_layer_id) const;
|
| + DeserializedContentLayerClient* GetContentLayerClient(
|
| + int engine_layer_id) const;
|
|
|
| std::unique_ptr<LayerFactory> layer_factory_;
|
| +
|
| LayerTreeHost* layer_tree_host_;
|
| + std::unique_ptr<ClientPictureCache> client_picture_cache_;
|
| ScrollCallback scroll_callback_;
|
| CompositorStateDeserializerClient* client_;
|
|
|
|
|