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 <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "ui/events/latency_info.h" | 41 #include "ui/events/latency_info.h" |
42 #include "ui/gfx/rect.h" | 42 #include "ui/gfx/rect.h" |
43 | 43 |
44 namespace cc { | 44 namespace cc { |
45 | 45 |
46 class AnimationRegistrar; | 46 class AnimationRegistrar; |
47 class HeadsUpDisplayLayer; | 47 class HeadsUpDisplayLayer; |
48 class Layer; | 48 class Layer; |
49 class LayerTreeHostImpl; | 49 class LayerTreeHostImpl; |
50 class LayerTreeHostImplClient; | 50 class LayerTreeHostImplClient; |
| 51 class LayerTreeHostSingleThreadClient; |
| 52 class PrioritizedResource; |
51 class PrioritizedResourceManager; | 53 class PrioritizedResourceManager; |
52 class PrioritizedResource; | |
53 class Region; | 54 class Region; |
54 class RenderingStatsInstrumentation; | 55 class RenderingStatsInstrumentation; |
55 class ResourceProvider; | 56 class ResourceProvider; |
56 class ResourceUpdateQueue; | 57 class ResourceUpdateQueue; |
57 class SharedBitmapManager; | 58 class SharedBitmapManager; |
58 class TopControlsManager; | 59 class TopControlsManager; |
59 struct RenderingStats; | 60 struct RenderingStats; |
60 struct ScrollAndScaleSet; | 61 struct ScrollAndScaleSet; |
61 | 62 |
62 // Provides information on an Impl's rendering capabilities back to the | 63 // Provides information on an Impl's rendering capabilities back to the |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 private: | 107 private: |
107 UIResourceRequestType type_; | 108 UIResourceRequestType type_; |
108 UIResourceId id_; | 109 UIResourceId id_; |
109 scoped_ptr<UIResourceBitmap> bitmap_; | 110 scoped_ptr<UIResourceBitmap> bitmap_; |
110 }; | 111 }; |
111 | 112 |
112 class CC_EXPORT LayerTreeHost { | 113 class CC_EXPORT LayerTreeHost { |
113 public: | 114 public: |
114 // The SharedBitmapManager will be used on the compositor thread. | 115 // The SharedBitmapManager will be used on the compositor thread. |
115 static scoped_ptr<LayerTreeHost> Create( | 116 static scoped_ptr<LayerTreeHost> CreateThreaded( |
116 LayerTreeHostClient* client, | 117 LayerTreeHostClient* client, |
117 SharedBitmapManager* manager, | 118 SharedBitmapManager* manager, |
118 const LayerTreeSettings& settings, | 119 const LayerTreeSettings& settings, |
119 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 121 |
| 122 static scoped_ptr<LayerTreeHost> CreateSingleThreaded( |
| 123 LayerTreeHostClient* client, |
| 124 LayerTreeHostSingleThreadClient* single_thread_client, |
| 125 SharedBitmapManager* manager, |
| 126 const LayerTreeSettings& settings); |
120 virtual ~LayerTreeHost(); | 127 virtual ~LayerTreeHost(); |
121 | 128 |
122 void SetLayerTreeHostClientReady(); | 129 void SetLayerTreeHostClientReady(); |
123 | 130 |
124 void set_needs_filter_context() { needs_filter_context_ = true; } | 131 void set_needs_filter_context() { needs_filter_context_ = true; } |
125 bool needs_offscreen_context() const { | 132 bool needs_offscreen_context() const { |
126 return needs_filter_context_; | 133 return needs_filter_context_; |
127 } | 134 } |
128 | 135 |
129 // LayerTreeHost interface to Proxy. | 136 // LayerTreeHost interface to Proxy. |
(...skipping 28 matching lines...) Expand all Loading... |
158 | 165 |
159 LayerTreeHostClient* client() { return client_; } | 166 LayerTreeHostClient* client() { return client_; } |
160 const base::WeakPtr<InputHandler>& GetInputHandler() { | 167 const base::WeakPtr<InputHandler>& GetInputHandler() { |
161 return input_handler_weak_ptr_; | 168 return input_handler_weak_ptr_; |
162 } | 169 } |
163 | 170 |
164 void NotifyInputThrottledUntilCommit(); | 171 void NotifyInputThrottledUntilCommit(); |
165 | 172 |
166 void Composite(base::TimeTicks frame_begin_time); | 173 void Composite(base::TimeTicks frame_begin_time); |
167 | 174 |
168 // Only used when compositing on the main thread. | |
169 void ScheduleComposite(); | |
170 | |
171 // Composites and attempts to read back the result into the provided | 175 // Composites and attempts to read back the result into the provided |
172 // buffer. If it wasn't possible, e.g. due to context lost, will return | 176 // buffer. If it wasn't possible, e.g. due to context lost, will return |
173 // false. | 177 // false. |
174 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); | 178 bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); |
175 | 179 |
176 void FinishAllRendering(); | 180 void FinishAllRendering(); |
177 | 181 |
178 void SetDeferCommits(bool defer_commits); | 182 void SetDeferCommits(bool defer_commits); |
179 | 183 |
180 // Test only hook | 184 // Test only hook |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 int id() const { return tree_id_; } | 313 int id() const { return tree_id_; } |
310 | 314 |
311 bool ScheduleMicroBenchmark(const std::string& benchmark_name, | 315 bool ScheduleMicroBenchmark(const std::string& benchmark_name, |
312 scoped_ptr<base::Value> value, | 316 scoped_ptr<base::Value> value, |
313 const MicroBenchmark::DoneCallback& callback); | 317 const MicroBenchmark::DoneCallback& callback); |
314 | 318 |
315 protected: | 319 protected: |
316 LayerTreeHost(LayerTreeHostClient* client, | 320 LayerTreeHost(LayerTreeHostClient* client, |
317 SharedBitmapManager* manager, | 321 SharedBitmapManager* manager, |
318 const LayerTreeSettings& settings); | 322 const LayerTreeSettings& settings); |
319 bool Initialize(scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 323 bool InitializeThreaded( |
| 324 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 325 bool InitializeSingleThreaded( |
| 326 LayerTreeHostSingleThreadClient* single_thread_client); |
320 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); | 327 bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); |
321 void SetOutputSurfaceLostForTesting(bool is_lost) { | 328 void SetOutputSurfaceLostForTesting(bool is_lost) { |
322 output_surface_lost_ = is_lost; | 329 output_surface_lost_ = is_lost; |
323 } | 330 } |
324 | 331 |
325 private: | 332 private: |
326 bool InitializeProxy(scoped_ptr<Proxy> proxy); | 333 bool InitializeProxy(scoped_ptr<Proxy> proxy); |
327 | 334 |
328 void PaintLayerContents( | 335 void PaintLayerContents( |
329 const RenderSurfaceLayerList& render_surface_layer_list, | 336 const RenderSurfaceLayerList& render_surface_layer_list, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 scoped_refptr<Layer> outer_viewport_scroll_layer_; | 462 scoped_refptr<Layer> outer_viewport_scroll_layer_; |
456 | 463 |
457 SharedBitmapManager* shared_bitmap_manager_; | 464 SharedBitmapManager* shared_bitmap_manager_; |
458 | 465 |
459 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 466 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
460 }; | 467 }; |
461 | 468 |
462 } // namespace cc | 469 } // namespace cc |
463 | 470 |
464 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 471 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
OLD | NEW |