OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_COMPOSITOR_COMPOSITOR_H_ | 5 #ifndef UI_COMPOSITOR_COMPOSITOR_H_ |
6 #define UI_COMPOSITOR_COMPOSITOR_H_ | 6 #define UI_COMPOSITOR_COMPOSITOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/single_thread_task_runner.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "cc/trees/layer_tree_host_client.h" | 16 #include "cc/trees/layer_tree_host_client.h" |
16 #include "cc/trees/layer_tree_host_single_thread_client.h" | 17 #include "cc/trees/layer_tree_host_single_thread_client.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
18 #include "ui/compositor/compositor_export.h" | 19 #include "ui/compositor/compositor_export.h" |
19 #include "ui/compositor/compositor_observer.h" | 20 #include "ui/compositor/compositor_observer.h" |
20 #include "ui/compositor/layer_animator_collection.h" | 21 #include "ui/compositor/layer_animator_collection.h" |
21 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
22 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
23 #include "ui/gfx/vector2d.h" | 24 #include "ui/gfx/vector2d.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // A Browser compositor object is responsible for generating the final | 125 // A Browser compositor object is responsible for generating the final |
125 // displayable form of pixels comprising a single widget's contents. It draws an | 126 // displayable form of pixels comprising a single widget's contents. It draws an |
126 // appropriately transformed texture for each transformed view in the widget's | 127 // appropriately transformed texture for each transformed view in the widget's |
127 // view hierarchy. | 128 // view hierarchy. |
128 class COMPOSITOR_EXPORT Compositor | 129 class COMPOSITOR_EXPORT Compositor |
129 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 130 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
130 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 131 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
131 NON_EXPORTED_BASE(public LayerAnimatorCollectionDelegate) { | 132 NON_EXPORTED_BASE(public LayerAnimatorCollectionDelegate) { |
132 public: | 133 public: |
133 Compositor(gfx::AcceleratedWidget widget, | 134 Compositor(gfx::AcceleratedWidget widget, |
134 ui::ContextFactory* context_factory); | 135 ui::ContextFactory* context_factory, |
| 136 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
135 virtual ~Compositor(); | 137 virtual ~Compositor(); |
136 | 138 |
137 ui::ContextFactory* context_factory() { return context_factory_; } | 139 ui::ContextFactory* context_factory() { return context_factory_; } |
138 | 140 |
139 // Schedules a redraw of the layer tree associated with this compositor. | 141 // Schedules a redraw of the layer tree associated with this compositor. |
140 void ScheduleDraw(); | 142 void ScheduleDraw(); |
141 | 143 |
142 // Sets the root of the layer tree drawn by this Compositor. The root layer | 144 // Sets the root of the layer tree drawn by this Compositor. The root layer |
143 // must have no parent. The compositor's root layer is reset if the root layer | 145 // must have no parent. The compositor's root layer is reset if the root layer |
144 // is destroyed. NULL can be passed to reset the root layer, in which case the | 146 // is destroyed. NULL can be passed to reset the root layer, in which case the |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 269 |
268 // The root of the Layer tree drawn by this compositor. | 270 // The root of the Layer tree drawn by this compositor. |
269 Layer* root_layer_; | 271 Layer* root_layer_; |
270 | 272 |
271 ObserverList<CompositorObserver> observer_list_; | 273 ObserverList<CompositorObserver> observer_list_; |
272 | 274 |
273 gfx::AcceleratedWidget widget_; | 275 gfx::AcceleratedWidget widget_; |
274 scoped_refptr<cc::Layer> root_web_layer_; | 276 scoped_refptr<cc::Layer> root_web_layer_; |
275 scoped_ptr<cc::LayerTreeHost> host_; | 277 scoped_ptr<cc::LayerTreeHost> host_; |
276 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_; | 278 scoped_refptr<base::MessageLoopProxy> compositor_thread_loop_; |
| 279 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
277 | 280 |
278 // The manager of vsync parameters for this compositor. | 281 // The manager of vsync parameters for this compositor. |
279 scoped_refptr<CompositorVSyncManager> vsync_manager_; | 282 scoped_refptr<CompositorVSyncManager> vsync_manager_; |
280 | 283 |
281 // The device scale factor of the monitor that this compositor is compositing | 284 // The device scale factor of the monitor that this compositor is compositing |
282 // layers on. | 285 // layers on. |
283 float device_scale_factor_; | 286 float device_scale_factor_; |
284 | 287 |
285 int last_started_frame_; | 288 int last_started_frame_; |
286 int last_ended_frame_; | 289 int last_ended_frame_; |
(...skipping 14 matching lines...) Expand all Loading... |
301 LayerAnimatorCollection layer_animator_collection_; | 304 LayerAnimatorCollection layer_animator_collection_; |
302 | 305 |
303 base::WeakPtrFactory<Compositor> schedule_draw_factory_; | 306 base::WeakPtrFactory<Compositor> schedule_draw_factory_; |
304 | 307 |
305 DISALLOW_COPY_AND_ASSIGN(Compositor); | 308 DISALLOW_COPY_AND_ASSIGN(Compositor); |
306 }; | 309 }; |
307 | 310 |
308 } // namespace ui | 311 } // namespace ui |
309 | 312 |
310 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 313 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |