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_TREES_LAYER_TREE_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 class CC_EXPORT LayerTreeImpl { | 53 class CC_EXPORT LayerTreeImpl { |
54 public: | 54 public: |
55 static scoped_ptr<LayerTreeImpl> create( | 55 static scoped_ptr<LayerTreeImpl> create( |
56 LayerTreeHostImpl* layer_tree_host_impl) { | 56 LayerTreeHostImpl* layer_tree_host_impl) { |
57 return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); | 57 return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); |
58 } | 58 } |
59 virtual ~LayerTreeImpl(); | 59 virtual ~LayerTreeImpl(); |
60 | 60 |
61 void Shutdown(); | 61 void Shutdown(); |
| 62 void ReleaseResources(); |
62 | 63 |
63 // Methods called by the layer tree that pass-through or access LTHI. | 64 // Methods called by the layer tree that pass-through or access LTHI. |
64 // --------------------------------------------------------------------------- | 65 // --------------------------------------------------------------------------- |
65 const LayerTreeSettings& settings() const; | 66 const LayerTreeSettings& settings() const; |
66 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 67 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
67 ContextProvider* context_provider() const; | 68 ContextProvider* context_provider() const; |
68 OutputSurface* output_surface() const; | 69 OutputSurface* output_surface() const; |
69 ResourceProvider* resource_provider() const; | 70 ResourceProvider* resource_provider() const; |
70 TileManager* tile_manager() const; | 71 TileManager* tile_manager() const; |
71 FrameRateCounter* frame_rate_counter() const; | 72 FrameRateCounter* frame_rate_counter() const; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 157 } |
157 float page_scale_factor() const { return page_scale_factor_; } | 158 float page_scale_factor() const { return page_scale_factor_; } |
158 float min_page_scale_factor() const { return min_page_scale_factor_; } | 159 float min_page_scale_factor() const { return min_page_scale_factor_; } |
159 float max_page_scale_factor() const { return max_page_scale_factor_; } | 160 float max_page_scale_factor() const { return max_page_scale_factor_; } |
160 float page_scale_delta() const { return page_scale_delta_; } | 161 float page_scale_delta() const { return page_scale_delta_; } |
161 void set_sent_page_scale_delta(float delta) { | 162 void set_sent_page_scale_delta(float delta) { |
162 sent_page_scale_delta_ = delta; | 163 sent_page_scale_delta_ = delta; |
163 } | 164 } |
164 float sent_page_scale_delta() const { return sent_page_scale_delta_; } | 165 float sent_page_scale_delta() const { return sent_page_scale_delta_; } |
165 | 166 |
| 167 void SetUseGpuRasterization(bool use_gpu); |
| 168 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
| 169 |
166 // Updates draw properties and render surface layer list, as well as tile | 170 // Updates draw properties and render surface layer list, as well as tile |
167 // priorities. | 171 // priorities. |
168 void UpdateDrawProperties(); | 172 void UpdateDrawProperties(); |
169 | 173 |
170 void set_needs_update_draw_properties() { | 174 void set_needs_update_draw_properties() { |
171 needs_update_draw_properties_ = true; | 175 needs_update_draw_properties_ = true; |
172 } | 176 } |
173 bool needs_update_draw_properties() const { | 177 bool needs_update_draw_properties() const { |
174 return needs_update_draw_properties_; | 178 return needs_update_draw_properties_; |
175 } | 179 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void AddLayerWithCopyOutputRequest(LayerImpl* layer); | 247 void AddLayerWithCopyOutputRequest(LayerImpl* layer); |
244 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); | 248 void RemoveLayerWithCopyOutputRequest(LayerImpl* layer); |
245 const std::vector<LayerImpl*>& LayersWithCopyOutputRequest() const; | 249 const std::vector<LayerImpl*>& LayersWithCopyOutputRequest() const; |
246 | 250 |
247 int current_render_surface_list_id() const { | 251 int current_render_surface_list_id() const { |
248 return render_surface_layer_list_id_; | 252 return render_surface_layer_list_id_; |
249 } | 253 } |
250 | 254 |
251 protected: | 255 protected: |
252 explicit LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); | 256 explicit LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
| 257 void ReleaseResourcesRecursive(LayerImpl* current); |
253 | 258 |
254 LayerTreeHostImpl* layer_tree_host_impl_; | 259 LayerTreeHostImpl* layer_tree_host_impl_; |
255 int source_frame_number_; | 260 int source_frame_number_; |
256 scoped_ptr<LayerImpl> root_layer_; | 261 scoped_ptr<LayerImpl> root_layer_; |
257 HeadsUpDisplayLayerImpl* hud_layer_; | 262 HeadsUpDisplayLayerImpl* hud_layer_; |
258 LayerImpl* currently_scrolling_layer_; | 263 LayerImpl* currently_scrolling_layer_; |
259 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; | 264 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; |
260 scoped_ptr<LayerScrollOffsetDelegateProxy> | 265 scoped_ptr<LayerScrollOffsetDelegateProxy> |
261 inner_viewport_scroll_delegate_proxy_; | 266 inner_viewport_scroll_delegate_proxy_; |
262 scoped_ptr<LayerScrollOffsetDelegateProxy> | 267 scoped_ptr<LayerScrollOffsetDelegateProxy> |
(...skipping 16 matching lines...) Expand all Loading... |
279 | 284 |
280 std::vector<LayerImpl*> layers_with_copy_output_request_; | 285 std::vector<LayerImpl*> layers_with_copy_output_request_; |
281 | 286 |
282 // Persisted state for non-impl-side-painting. | 287 // Persisted state for non-impl-side-painting. |
283 int scrolling_layer_id_from_previous_tree_; | 288 int scrolling_layer_id_from_previous_tree_; |
284 | 289 |
285 // List of visible or hit-testable layers for the most recently prepared | 290 // List of visible or hit-testable layers for the most recently prepared |
286 // frame. Used for rendering and input event hit testing. | 291 // frame. Used for rendering and input event hit testing. |
287 LayerImplList render_surface_layer_list_; | 292 LayerImplList render_surface_layer_list_; |
288 | 293 |
| 294 bool use_gpu_rasterization_; |
289 bool contents_textures_purged_; | 295 bool contents_textures_purged_; |
290 bool requires_high_res_to_draw_; | 296 bool requires_high_res_to_draw_; |
291 bool viewport_size_invalid_; | 297 bool viewport_size_invalid_; |
292 bool needs_update_draw_properties_; | 298 bool needs_update_draw_properties_; |
293 | 299 |
294 // In impl-side painting mode, this is true when the tree may contain | 300 // In impl-side painting mode, this is true when the tree may contain |
295 // structural differences relative to the active tree. | 301 // structural differences relative to the active tree. |
296 bool needs_full_tree_sync_; | 302 bool needs_full_tree_sync_; |
297 | 303 |
298 bool next_activation_forces_redraw_; | 304 bool next_activation_forces_redraw_; |
299 | 305 |
300 ScopedPtrVector<SwapPromise> swap_promise_list_; | 306 ScopedPtrVector<SwapPromise> swap_promise_list_; |
301 | 307 |
302 UIResourceRequestQueue ui_resource_request_queue_; | 308 UIResourceRequestQueue ui_resource_request_queue_; |
303 | 309 |
304 int render_surface_layer_list_id_; | 310 int render_surface_layer_list_id_; |
305 | 311 |
306 private: | 312 private: |
307 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 313 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
308 }; | 314 }; |
309 | 315 |
310 } // namespace cc | 316 } // namespace cc |
311 | 317 |
312 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 318 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |