OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_LAYER_TREE_IMPL_H_ | 5 #ifndef CC_LAYER_TREE_IMPL_H_ |
6 #define CC_LAYER_TREE_IMPL_H_ | 6 #define CC_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 class LayerTreeHostImpl; | 12 class LayerTreeHostImpl; |
13 class LayerTreeImpl; | 13 class LayerTreeImpl; |
14 class HeadsUpDisplayLayerImpl; | 14 class HeadsUpDisplayLayerImpl; |
15 | 15 |
16 class CC_EXPORT LayerTreeImplClient { | |
17 public: | |
18 virtual void OnCanDrawStateChangedForTree(LayerTreeImpl*) = 0; | |
19 | |
20 protected: | |
21 virtual ~LayerTreeImplClient() {} | |
22 }; | |
23 | |
24 class CC_EXPORT LayerTreeImpl { | 16 class CC_EXPORT LayerTreeImpl { |
25 public: | 17 public: |
26 static scoped_ptr<LayerTreeImpl> create(LayerTreeImplClient* client) | 18 static scoped_ptr<LayerTreeImpl> create(LayerTreeHostImpl* layer_tree_host_imp
l) |
27 { | 19 { |
28 return make_scoped_ptr(new LayerTreeImpl(client)); | 20 return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); |
29 } | 21 } |
30 virtual ~LayerTreeImpl(); | 22 virtual ~LayerTreeImpl(); |
31 | 23 |
| 24 // Methods called by the layer tree. |
| 25 // --------------------------------------------------------------------------- |
| 26 // TODO(nduca): Remove this and have layers call through this class. |
| 27 LayerTreeHostImpl* layer_tree_host_impl() const { return layer_tree_host_impl_
; } |
| 28 |
| 29 // Other public methods |
| 30 // --------------------------------------------------------------------------- |
32 LayerImpl* RootLayer() const { return root_layer_.get(); } | 31 LayerImpl* RootLayer() const { return root_layer_.get(); } |
33 void SetRootLayer(scoped_ptr<LayerImpl>); | 32 void SetRootLayer(scoped_ptr<LayerImpl>); |
34 scoped_ptr<LayerImpl> DetachLayerTree(); | 33 scoped_ptr<LayerImpl> DetachLayerTree(); |
35 | 34 |
36 int source_frame_number() const { return source_frame_number_; } | 35 int source_frame_number() const { return source_frame_number_; } |
37 void set_source_frame_number(int frame_number) { source_frame_number_ = frame_
number; } | 36 void set_source_frame_number(int frame_number) { source_frame_number_ = frame_
number; } |
38 | 37 |
39 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } | 38 HeadsUpDisplayLayerImpl* hud_layer() { return hud_layer_; } |
40 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { hud_layer_ = layer_i
mpl; } | 39 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { hud_layer_ = layer_i
mpl; } |
41 | 40 |
42 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } | 41 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } |
43 void set_root_scroll_layer(LayerImpl* layer_impl) { root_scroll_layer_ = layer
_impl; } | 42 void set_root_scroll_layer(LayerImpl* layer_impl) { root_scroll_layer_ = layer
_impl; } |
44 | 43 |
45 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } | 44 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } |
46 void set_currently_scrolling_layer(LayerImpl* layer_impl) { currently_scrollin
g_layer_ = layer_impl; } | 45 void set_currently_scrolling_layer(LayerImpl* layer_impl) { currently_scrollin
g_layer_ = layer_impl; } |
47 | 46 |
48 void ClearCurrentlyScrollingLayer(); | 47 void ClearCurrentlyScrollingLayer(); |
49 | 48 |
50 protected: | 49 protected: |
51 LayerTreeImpl(LayerTreeImplClient* client); | 50 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
52 | 51 |
53 LayerTreeImplClient* client_; | 52 LayerTreeHostImpl* layer_tree_host_impl_; |
54 int source_frame_number_; | 53 int source_frame_number_; |
55 scoped_ptr<LayerImpl> root_layer_; | 54 scoped_ptr<LayerImpl> root_layer_; |
56 HeadsUpDisplayLayerImpl* hud_layer_; | 55 HeadsUpDisplayLayerImpl* hud_layer_; |
57 LayerImpl* root_scroll_layer_; | 56 LayerImpl* root_scroll_layer_; |
58 LayerImpl* currently_scrolling_layer_; | 57 LayerImpl* currently_scrolling_layer_; |
59 | 58 |
60 // Persisted state | 59 // Persisted state |
61 int scrolling_layer_id_from_previous_tree_; | 60 int scrolling_layer_id_from_previous_tree_; |
62 | 61 |
63 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 62 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
64 }; | 63 }; |
65 | 64 |
66 } | 65 } |
67 | 66 |
68 #endif // CC_LAYER_TREE_IMPL_H_ | 67 #endif // CC_LAYER_TREE_IMPL_H_ |
OLD | NEW |