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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 class COMPOSITOR_EXPORT Compositor | 185 class COMPOSITOR_EXPORT Compositor |
186 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), | 186 : NON_EXPORTED_BASE(public cc::LayerTreeHostClient), |
187 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), | 187 NON_EXPORTED_BASE(public cc::LayerTreeHostSingleThreadClient), |
188 NON_EXPORTED_BASE(public CompositorLockDelegate) { | 188 NON_EXPORTED_BASE(public CompositorLockDelegate) { |
189 public: | 189 public: |
190 Compositor(const viz::FrameSinkId& frame_sink_id, | 190 Compositor(const viz::FrameSinkId& frame_sink_id, |
191 ui::ContextFactory* context_factory, | 191 ui::ContextFactory* context_factory, |
192 ui::ContextFactoryPrivate* context_factory_private, | 192 ui::ContextFactoryPrivate* context_factory_private, |
193 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 193 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
194 bool enable_surface_synchronization, | 194 bool enable_surface_synchronization, |
| 195 bool enable_pixel_canvas, |
195 bool external_begin_frames_enabled = false); | 196 bool external_begin_frames_enabled = false); |
196 ~Compositor() override; | 197 ~Compositor() override; |
197 | 198 |
198 ui::ContextFactory* context_factory() { return context_factory_; } | 199 ui::ContextFactory* context_factory() { return context_factory_; } |
199 | 200 |
200 ui::ContextFactoryPrivate* context_factory_private() { | 201 ui::ContextFactoryPrivate* context_factory_private() { |
201 return context_factory_private_; | 202 return context_factory_private_; |
202 } | 203 } |
203 | 204 |
204 void AddFrameSink(const viz::FrameSinkId& frame_sink_id); | 205 void AddFrameSink(const viz::FrameSinkId& frame_sink_id); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 394 } |
394 | 395 |
395 const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 396 const viz::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
396 int activated_frame_count() const { return activated_frame_count_; } | 397 int activated_frame_count() const { return activated_frame_count_; } |
397 float refresh_rate() const { return refresh_rate_; } | 398 float refresh_rate() const { return refresh_rate_; } |
398 | 399 |
399 void set_allow_locks_to_extend_timeout(bool allowed) { | 400 void set_allow_locks_to_extend_timeout(bool allowed) { |
400 allow_locks_to_extend_timeout_ = allowed; | 401 allow_locks_to_extend_timeout_ = allowed; |
401 } | 402 } |
402 | 403 |
| 404 // If true, all paint commands are recorded at pixel size instead of DIP. |
| 405 bool is_pixel_canvas() const { return is_pixel_canvas_; } |
| 406 |
403 private: | 407 private: |
404 friend class base::RefCounted<Compositor>; | 408 friend class base::RefCounted<Compositor>; |
405 | 409 |
406 // CompositorLockDelegate implementation. | 410 // CompositorLockDelegate implementation. |
407 void RemoveCompositorLock(CompositorLock* lock) override; | 411 void RemoveCompositorLock(CompositorLock* lock) override; |
408 | 412 |
409 // Causes all active CompositorLocks to be timed out. | 413 // Causes all active CompositorLocks to be timed out. |
410 void TimeoutLocks(); | 414 void TimeoutLocks(); |
411 | 415 |
412 gfx::Size size_; | 416 gfx::Size size_; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 scoped_refptr<cc::AnimationTimeline> animation_timeline_; | 461 scoped_refptr<cc::AnimationTimeline> animation_timeline_; |
458 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_; | 462 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_; |
459 | 463 |
460 gfx::ColorSpace output_color_space_; | 464 gfx::ColorSpace output_color_space_; |
461 gfx::ColorSpace blending_color_space_; | 465 gfx::ColorSpace blending_color_space_; |
462 | 466 |
463 // The estimated time that the locks will timeout. | 467 // The estimated time that the locks will timeout. |
464 base::TimeTicks scheduled_timeout_; | 468 base::TimeTicks scheduled_timeout_; |
465 // If true, the |scheduled_timeout_| might be recalculated and extended. | 469 // If true, the |scheduled_timeout_| might be recalculated and extended. |
466 bool allow_locks_to_extend_timeout_; | 470 bool allow_locks_to_extend_timeout_; |
| 471 // If true, all paint commands are recorded at pixel size instead of DIP. |
| 472 const bool is_pixel_canvas_; |
467 | 473 |
468 base::WeakPtrFactory<Compositor> weak_ptr_factory_; | 474 base::WeakPtrFactory<Compositor> weak_ptr_factory_; |
469 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_; | 475 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_; |
470 | 476 |
471 DISALLOW_COPY_AND_ASSIGN(Compositor); | 477 DISALLOW_COPY_AND_ASSIGN(Compositor); |
472 }; | 478 }; |
473 | 479 |
474 } // namespace ui | 480 } // namespace ui |
475 | 481 |
476 #endif // UI_COMPOSITOR_COMPOSITOR_H_ | 482 #endif // UI_COMPOSITOR_COMPOSITOR_H_ |
OLD | NEW |