OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_HOST_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "cc/animation/animation_events.h" | 18 #include "cc/animation/animation_events.h" |
19 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
20 #include "cc/base/scoped_ptr_vector.h" | 20 #include "cc/base/scoped_ptr_vector.h" |
21 #include "cc/debug/latency_info.h" | 21 #include "cc/debug/latency_info.h" |
| 22 #include "cc/input/input_handler.h" |
22 #include "cc/layers/layer_lists.h" | 23 #include "cc/layers/layer_lists.h" |
23 #include "cc/output/output_surface.h" | 24 #include "cc/output/output_surface.h" |
24 #include "cc/scheduler/rate_limiter.h" | 25 #include "cc/scheduler/rate_limiter.h" |
25 #include "cc/trees/layer_tree_host_client.h" | 26 #include "cc/trees/layer_tree_host_client.h" |
26 #include "cc/trees/layer_tree_host_common.h" | 27 #include "cc/trees/layer_tree_host_common.h" |
27 #include "cc/trees/layer_tree_settings.h" | 28 #include "cc/trees/layer_tree_settings.h" |
28 #include "cc/trees/occlusion_tracker.h" | 29 #include "cc/trees/occlusion_tracker.h" |
29 #include "cc/trees/proxy.h" | 30 #include "cc/trees/proxy.h" |
30 #include "skia/ext/refptr.h" | 31 #include "skia/ext/refptr.h" |
31 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" | 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebScrollbar.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void DidBeginFrame(); | 103 void DidBeginFrame(); |
103 void UpdateClientAnimations(base::TimeTicks monotonic_frame_begin_time); | 104 void UpdateClientAnimations(base::TimeTicks monotonic_frame_begin_time); |
104 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 105 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
105 void DidStopFlinging(); | 106 void DidStopFlinging(); |
106 void Layout(); | 107 void Layout(); |
107 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); | 108 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); |
108 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 109 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
109 void WillCommit(); | 110 void WillCommit(); |
110 void CommitComplete(); | 111 void CommitComplete(); |
111 scoped_ptr<OutputSurface> CreateOutputSurface(); | 112 scoped_ptr<OutputSurface> CreateOutputSurface(); |
112 scoped_ptr<InputHandlerClient> CreateInputHandlerClient(); | |
113 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 113 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
114 LayerTreeHostImplClient* client); | 114 LayerTreeHostImplClient* client); |
115 void DidLoseOutputSurface(); | 115 void DidLoseOutputSurface(); |
116 bool output_surface_lost() const { return output_surface_lost_; } | 116 bool output_surface_lost() const { return output_surface_lost_; } |
117 enum CreateResult { | 117 enum CreateResult { |
118 CreateSucceeded, | 118 CreateSucceeded, |
119 CreateFailedButTryAgain, | 119 CreateFailedButTryAgain, |
120 CreateFailedAndGaveUp, | 120 CreateFailedAndGaveUp, |
121 }; | 121 }; |
122 CreateResult OnCreateAndInitializeOutputSurfaceAttempted(bool success); | 122 CreateResult OnCreateAndInitializeOutputSurfaceAttempted(bool success); |
123 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } | 123 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } |
124 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } | 124 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } |
125 void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider); | 125 void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider); |
126 virtual void AcquireLayerTextures(); | 126 virtual void AcquireLayerTextures(); |
127 // Returns false if we should abort this frame due to initialization failure. | 127 // Returns false if we should abort this frame due to initialization failure. |
128 bool InitializeOutputSurfaceIfNeeded(); | 128 bool InitializeOutputSurfaceIfNeeded(); |
129 void UpdateLayers(ResourceUpdateQueue* queue, | 129 void UpdateLayers(ResourceUpdateQueue* queue, |
130 size_t contents_memory_limit_bytes); | 130 size_t contents_memory_limit_bytes); |
131 | 131 |
132 LayerTreeHostClient* client() { return client_; } | 132 LayerTreeHostClient* client() { return client_; } |
| 133 const base::WeakPtr<InputHandler>& GetInputHandler() { |
| 134 return input_handler_weak_ptr_; |
| 135 } |
133 | 136 |
134 void Composite(base::TimeTicks frame_begin_time); | 137 void Composite(base::TimeTicks frame_begin_time); |
135 | 138 |
136 // Only used when compositing on the main thread. | 139 // Only used when compositing on the main thread. |
137 void ScheduleComposite(); | 140 void ScheduleComposite(); |
138 | 141 |
139 // Composites and attempts to read back the result into the provided | 142 // Composites and attempts to read back the result into the provided |
140 // buffer. If it wasn't possible, e.g. due to context lost, will return | 143 // buffer. If it wasn't possible, e.g. due to context lost, will return |
141 // false. | 144 // false. |
142 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); | 145 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 bool output_surface_can_be_initialized_; | 293 bool output_surface_can_be_initialized_; |
291 bool output_surface_lost_; | 294 bool output_surface_lost_; |
292 int num_failed_recreate_attempts_; | 295 int num_failed_recreate_attempts_; |
293 | 296 |
294 scoped_refptr<Layer> root_layer_; | 297 scoped_refptr<Layer> root_layer_; |
295 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; | 298 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; |
296 | 299 |
297 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; | 300 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; |
298 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; | 301 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; |
299 | 302 |
| 303 base::WeakPtr<InputHandler> input_handler_weak_ptr_; |
300 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; | 304 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; |
301 | 305 |
302 LayerTreeSettings settings_; | 306 LayerTreeSettings settings_; |
303 LayerTreeDebugState debug_state_; | 307 LayerTreeDebugState debug_state_; |
304 | 308 |
305 gfx::Size device_viewport_size_; | 309 gfx::Size device_viewport_size_; |
306 float overdraw_bottom_height_; | 310 float overdraw_bottom_height_; |
307 float device_scale_factor_; | 311 float device_scale_factor_; |
308 | 312 |
309 bool visible_; | 313 bool visible_; |
(...skipping 27 matching lines...) Expand all Loading... |
337 bool in_paint_layer_contents_; | 341 bool in_paint_layer_contents_; |
338 | 342 |
339 LatencyInfo latency_info_; | 343 LatencyInfo latency_info_; |
340 | 344 |
341 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 345 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
342 }; | 346 }; |
343 | 347 |
344 } // namespace cc | 348 } // namespace cc |
345 | 349 |
346 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 350 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |