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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // view hierarchy. | 181 // view hierarchy. |
182 class COMPOSITOR_EXPORT Compositor | 182 class COMPOSITOR_EXPORT Compositor |
183 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 183 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
184 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 184 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
185 NON_EXPORTED_BASE(public CompositorLockDelegate) { | 185 NON_EXPORTED_BASE(public CompositorLockDelegate) { |
186 public: | 186 public: |
187 Compositor(const viz::FrameSinkId& frame_sink_id, | 187 Compositor(const viz::FrameSinkId& frame_sink_id, |
188 ui::ContextFactory* context_factory, | 188 ui::ContextFactory* context_factory, |
189 ui::ContextFactoryPrivate* context_factory_private, | 189 ui::ContextFactoryPrivate* context_factory_private, |
190 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 190 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
191 bool enable_surface_synchronization); | 191 bool enable_surface_synchronization, |
| 192 bool enable_pixel_canvas); |
192 ~Compositor() override; | 193 ~Compositor() override; |
193 | 194 |
194 ui::ContextFactory* context_factory() { return context_factory_; } | 195 ui::ContextFactory* context_factory() { return context_factory_; } |
195 | 196 |
196 ui::ContextFactoryPrivate* context_factory_private() { | 197 ui::ContextFactoryPrivate* context_factory_private() { |
197 return context_factory_private_; | 198 return context_factory_private_; |
198 } | 199 } |
199 | 200 |
200 void AddFrameSink(const viz::FrameSinkId& frame_sink_id); | 201 void AddFrameSink(const viz::FrameSinkId& frame_sink_id); |
201 void RemoveFrameSink(const viz::FrameSinkId& frame_sink_id); | 202 void RemoveFrameSink(const viz::FrameSinkId& frame_sink_id); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } | 369 } |
369 | 370 |
370 const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 371 const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
371 int activated_frame_count() const { return activated_frame_count_; } | 372 int activated_frame_count() const { return activated_frame_count_; } |
372 float refresh_rate() const { return refresh_rate_; } | 373 float refresh_rate() const { return refresh_rate_; } |
373 | 374 |
374 void set_allow_locks_to_extend_timeout(bool allowed) { | 375 void set_allow_locks_to_extend_timeout(bool allowed) { |
375 allow_locks_to_extend_timeout_ = allowed; | 376 allow_locks_to_extend_timeout_ = allowed; |
376 } | 377 } |
377 | 378 |
| 379 // If true, all paint commands are recorded at pixel size instead of DIP. |
| 380 bool is_pixel_canvas() const { return is_pixel_canvas_; } |
| 381 |
378 private: | 382 private: |
379 friend class base::RefCounted<Compositor>; | 383 friend class base::RefCounted<Compositor>; |
380 | 384 |
381 // CompositorLockDelegate implementation. | 385 // CompositorLockDelegate implementation. |
382 void RemoveCompositorLock(CompositorLock* lock) override; | 386 void RemoveCompositorLock(CompositorLock* lock) override; |
383 | 387 |
384 // Causes all active CompositorLocks to be timed out. | 388 // Causes all active CompositorLocks to be timed out. |
385 void TimeoutLocks(); | 389 void TimeoutLocks(); |
386 | 390 |
387 gfx::Size size_; | 391 gfx::Size size_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 scoped_refptr<cc::AnimationTimeline> animation_timeline_; | 432 scoped_refptr<cc::AnimationTimeline> animation_timeline_; |
429 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_; | 433 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_; |
430 | 434 |
431 gfx::ColorSpace output_color_space_; | 435 gfx::ColorSpace output_color_space_; |
432 gfx::ColorSpace blending_color_space_; | 436 gfx::ColorSpace blending_color_space_; |
433 | 437 |
434 // The estimated time that the locks will timeout. | 438 // The estimated time that the locks will timeout. |
435 base::TimeTicks scheduled_timeout_; | 439 base::TimeTicks scheduled_timeout_; |
436 // If true, the |scheduled_timeout_| might be recalculated and extended. | 440 // If true, the |scheduled_timeout_| might be recalculated and extended. |
437 bool allow_locks_to_extend_timeout_; | 441 bool allow_locks_to_extend_timeout_; |
| 442 // If true, all paint commands are recorded at pixel size instead of DIP. |
| 443 const bool is_pixel_canvas_; |
438 | 444 |
439 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 445 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
440 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_; | 446 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_; |
441 | 447 |
442 DISALLOW_COPY_AND_ASSIGN(Compositor); | 448 DISALLOW_COPY_AND_ASSIGN(Compositor); |
443 }; | 449 }; |
444 | 450 |
445 } // namespace ui | 451 } // namespace ui |
446 | 452 |
447 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 453 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |