Chromium Code Reviews| 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..786a4b5b02c24f3646e0aad4e6e69125dba1f4a0 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, |
|
vmpstr
2016/10/06 18:34:21
It looks a bit weird that the deserializer takes o
Khushal
2016/10/06 20:05:40
TBH I want to restructure the code to eliminate th
|
| + ScrollCallback scroll_callback, |
|
vmpstr
2016/10/06 18:34:21
const ref
Khushal
2016/10/06 20:05:40
Done.
|
| + 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; |
|
vmpstr
2016/10/06 18:34:21
Is this just GetLayerForEngineId()->id()? (if one
Khushal
2016/10/06 20:05:40
Meh. Was just being lazy. Removed.
|
| + |
| // Deserializes the |layer_tree_host_proto| into the LayerTreeHost. |
| void DeserializeCompositorUpdate( |
| const proto::LayerTreeHost& layer_tree_host_proto); |
| @@ -47,23 +54,44 @@ 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(); |
| + |
| + scoped_refptr<Layer> layer; |
| + |
| + // Set only for PictureLayers. |
| + std::unique_ptr<DeserializedContentLayerClient> content_layer_client; |
|
vmpstr
2016/10/06 18:34:21
Can this just be a member and not a unique_ptr?
Khushal
2016/10/06 20:05:40
Only needed for PictureLayers so I used a unique_p
|
| + }; |
| + |
| + using EngineIdToLayerMap = |
| + std::unordered_map<int, std::unique_ptr<LayerData>>; |
|
vmpstr
2016/10/06 18:34:21
Can this be a map of int to LayerData? And maybe y
Khushal
2016/10/06 20:05:40
Good point. Done.
|
| + // 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_; |