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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void Layout(); | 108 void Layout(); |
108 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); | 109 void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); |
109 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 110 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
110 gfx::Size PinchZoomScrollbarSize( | 111 gfx::Size PinchZoomScrollbarSize( |
111 WebKit::WebScrollbar::Orientation orientation) const; | 112 WebKit::WebScrollbar::Orientation orientation) const; |
112 void SetPinchZoomScrollbarsBoundsAndPosition(); | 113 void SetPinchZoomScrollbarsBoundsAndPosition(); |
113 void CreateAndAddPinchZoomScrollbars(); | 114 void CreateAndAddPinchZoomScrollbars(); |
114 void WillCommit(); | 115 void WillCommit(); |
115 void CommitComplete(); | 116 void CommitComplete(); |
116 scoped_ptr<OutputSurface> CreateOutputSurface(); | 117 scoped_ptr<OutputSurface> CreateOutputSurface(); |
117 scoped_ptr<InputHandlerClient> CreateInputHandlerClient(); | |
118 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( | 118 virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( |
119 LayerTreeHostImplClient* client); | 119 LayerTreeHostImplClient* client); |
120 void DidLoseOutputSurface(); | 120 void DidLoseOutputSurface(); |
121 bool output_surface_lost() const { return output_surface_lost_; } | 121 bool output_surface_lost() const { return output_surface_lost_; } |
122 enum CreateResult { | 122 enum CreateResult { |
123 CreateSucceeded, | 123 CreateSucceeded, |
124 CreateFailedButTryAgain, | 124 CreateFailedButTryAgain, |
125 CreateFailedAndGaveUp, | 125 CreateFailedAndGaveUp, |
126 }; | 126 }; |
127 CreateResult OnCreateAndInitializeOutputSurfaceAttempted(bool success); | 127 CreateResult OnCreateAndInitializeOutputSurfaceAttempted(bool success); |
128 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } | 128 void DidCommitAndDrawFrame() { client_->DidCommitAndDrawFrame(); } |
129 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } | 129 void DidCompleteSwapBuffers() { client_->DidCompleteSwapBuffers(); } |
130 void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider); | 130 void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider); |
131 virtual void AcquireLayerTextures(); | 131 virtual void AcquireLayerTextures(); |
132 // Returns false if we should abort this frame due to initialization failure. | 132 // Returns false if we should abort this frame due to initialization failure. |
133 bool InitializeOutputSurfaceIfNeeded(); | 133 bool InitializeOutputSurfaceIfNeeded(); |
134 void UpdateLayers(ResourceUpdateQueue* queue, | 134 void UpdateLayers(ResourceUpdateQueue* queue, |
135 size_t contents_memory_limit_bytes); | 135 size_t contents_memory_limit_bytes); |
136 | 136 |
137 LayerTreeHostClient* client() { return client_; } | 137 LayerTreeHostClient* client() { return client_; } |
| 138 const base::WeakPtr<InputHandler>& GetInputHandler() { |
| 139 return input_handler_weak_ptr_; |
| 140 } |
138 | 141 |
139 void Composite(base::TimeTicks frame_begin_time); | 142 void Composite(base::TimeTicks frame_begin_time); |
140 | 143 |
141 // Only used when compositing on the main thread. | 144 // Only used when compositing on the main thread. |
142 void ScheduleComposite(); | 145 void ScheduleComposite(); |
143 | 146 |
144 // Composites and attempts to read back the result into the provided | 147 // Composites and attempts to read back the result into the provided |
145 // buffer. If it wasn't possible, e.g. due to context lost, will return | 148 // buffer. If it wasn't possible, e.g. due to context lost, will return |
146 // false. | 149 // false. |
147 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); | 150 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 int num_failed_recreate_attempts_; | 301 int num_failed_recreate_attempts_; |
299 | 302 |
300 scoped_refptr<Layer> root_layer_; | 303 scoped_refptr<Layer> root_layer_; |
301 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; | 304 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; |
302 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_horizontal_; | 305 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_horizontal_; |
303 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_vertical_; | 306 scoped_refptr<ScrollbarLayer> pinch_zoom_scrollbar_vertical_; |
304 | 307 |
305 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; | 308 scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; |
306 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; | 309 scoped_ptr<PrioritizedResource> surface_memory_placeholder_; |
307 | 310 |
| 311 base::WeakPtr<InputHandler> input_handler_weak_ptr_; |
308 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; | 312 base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; |
309 | 313 |
310 LayerTreeSettings settings_; | 314 LayerTreeSettings settings_; |
311 LayerTreeDebugState debug_state_; | 315 LayerTreeDebugState debug_state_; |
312 | 316 |
313 gfx::Size device_viewport_size_; | 317 gfx::Size device_viewport_size_; |
314 float overdraw_bottom_height_; | 318 float overdraw_bottom_height_; |
315 float device_scale_factor_; | 319 float device_scale_factor_; |
316 | 320 |
317 bool visible_; | 321 bool visible_; |
(...skipping 27 matching lines...) Expand all Loading... |
345 bool in_paint_layer_contents_; | 349 bool in_paint_layer_contents_; |
346 | 350 |
347 LatencyInfo latency_info_; | 351 LatencyInfo latency_info_; |
348 | 352 |
349 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 353 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
350 }; | 354 }; |
351 | 355 |
352 } // namespace cc | 356 } // namespace cc |
353 | 357 |
354 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 358 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |