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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 namespace ui { | 61 namespace ui { |
62 | 62 |
63 class Compositor; | 63 class Compositor; |
64 class CompositorVSyncManager; | 64 class CompositorVSyncManager; |
65 class LatencyInfo; | 65 class LatencyInfo; |
66 class Layer; | 66 class Layer; |
67 class Reflector; | 67 class Reflector; |
68 class ScopedAnimationDurationScaleMode; | 68 class ScopedAnimationDurationScaleMode; |
69 | 69 |
70 #if defined(USE_AURA) | |
71 class Window; | |
72 #endif | |
73 | |
74 const int kCompositorLockTimeoutMs = 67; | 70 const int kCompositorLockTimeoutMs = 67; |
75 | 71 |
76 class COMPOSITOR_EXPORT ContextFactoryObserver { | 72 class COMPOSITOR_EXPORT ContextFactoryObserver { |
77 public: | 73 public: |
78 virtual ~ContextFactoryObserver() {} | 74 virtual ~ContextFactoryObserver() {} |
79 | 75 |
80 // Notifies that the ContextProvider returned from | 76 // Notifies that the ContextProvider returned from |
81 // ui::ContextFactory::SharedMainThreadContextProvider was lost. When this | 77 // ui::ContextFactory::SharedMainThreadContextProvider was lost. When this |
82 // is called, the old resources (e.g. shared context, GL helper) still | 78 // is called, the old resources (e.g. shared context, GL helper) still |
83 // exist, but are about to be destroyed. Getting a reference to those | 79 // exist, but are about to be destroyed. Getting a reference to those |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 base::TimeDelta interval); | 294 base::TimeDelta interval); |
299 | 295 |
300 // Sets the widget for the compositor to render into. | 296 // Sets the widget for the compositor to render into. |
301 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); | 297 void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
302 // Releases the widget previously set through SetAcceleratedWidget(). | 298 // Releases the widget previously set through SetAcceleratedWidget(). |
303 // After returning it will not be used for rendering anymore. | 299 // After returning it will not be used for rendering anymore. |
304 // The compositor must be set to invisible when taking away a widget. | 300 // The compositor must be set to invisible when taking away a widget. |
305 gfx::AcceleratedWidget ReleaseAcceleratedWidget(); | 301 gfx::AcceleratedWidget ReleaseAcceleratedWidget(); |
306 gfx::AcceleratedWidget widget() const; | 302 gfx::AcceleratedWidget widget() const; |
307 | 303 |
308 #if defined(USE_AURA) | |
309 // Sets the window for the compositor to render into on mus+ash. | |
310 void SetWindow(ui::Window* window); | |
311 ui::Window* window() const; | |
312 #endif | |
313 | |
314 // Returns the vsync manager for this compositor. | 304 // Returns the vsync manager for this compositor. |
315 scoped_refptr<CompositorVSyncManager> vsync_manager() const; | 305 scoped_refptr<CompositorVSyncManager> vsync_manager() const; |
316 | 306 |
317 // Returns the main thread task runner this compositor uses. Users of the | 307 // Returns the main thread task runner this compositor uses. Users of the |
318 // compositor generally shouldn't use this. | 308 // compositor generally shouldn't use this. |
319 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { | 309 scoped_refptr<base::SingleThreadTaskRunner> task_runner() const { |
320 return task_runner_; | 310 return task_runner_; |
321 } | 311 } |
322 | 312 |
323 // Compositor does not own observers. It is the responsibility of the | 313 // Compositor does not own observers. It is the responsibility of the |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 ui::ContextFactory* context_factory_; | 396 ui::ContextFactory* context_factory_; |
407 ui::ContextFactoryPrivate* context_factory_private_; | 397 ui::ContextFactoryPrivate* context_factory_private_; |
408 | 398 |
409 // The root of the Layer tree drawn by this compositor. | 399 // The root of the Layer tree drawn by this compositor. |
410 Layer* root_layer_; | 400 Layer* root_layer_; |
411 | 401 |
412 base::ObserverList<CompositorObserver, true> observer_list_; | 402 base::ObserverList<CompositorObserver, true> observer_list_; |
413 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; | 403 base::ObserverList<CompositorAnimationObserver> animation_observer_list_; |
414 | 404 |
415 gfx::AcceleratedWidget widget_; | 405 gfx::AcceleratedWidget widget_; |
416 #if defined(USE_AURA) | |
417 ui::Window* window_; | |
418 #endif | |
419 // A map from child id to parent id. | 406 // A map from child id to parent id. |
420 std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> child_frame_sinks_; | 407 std::unordered_set<cc::FrameSinkId, cc::FrameSinkIdHash> child_frame_sinks_; |
421 bool widget_valid_; | 408 bool widget_valid_; |
422 bool compositor_frame_sink_requested_; | 409 bool compositor_frame_sink_requested_; |
423 const cc::FrameSinkId frame_sink_id_; | 410 const cc::FrameSinkId frame_sink_id_; |
424 scoped_refptr<cc::Layer> root_web_layer_; | 411 scoped_refptr<cc::Layer> root_web_layer_; |
425 std::unique_ptr<cc::AnimationHost> animation_host_; | 412 std::unique_ptr<cc::AnimationHost> animation_host_; |
426 std::unique_ptr<cc::LayerTreeHost> host_; | 413 std::unique_ptr<cc::LayerTreeHost> host_; |
427 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 414 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
428 | 415 |
(...skipping 14 matching lines...) Expand all Loading... |
443 gfx::ColorSpace color_space_; | 430 gfx::ColorSpace color_space_; |
444 | 431 |
445 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 432 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
446 | 433 |
447 DISALLOW_COPY_AND_ASSIGN(Compositor); | 434 DISALLOW_COPY_AND_ASSIGN(Compositor); |
448 }; | 435 }; |
449 | 436 |
450 } // namespace ui | 437 } // namespace ui |
451 | 438 |
452 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 439 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |