Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: ui/compositor/compositor.h

Issue 2877483003: Implements core logic for Pixel Canvas (Closed)
Patch Set: Unittest update Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 = false);
danakj 2017/07/25 17:58:56 Can you avoid default parameter values?
malaykeshav 2017/07/25 22:57:57 Done
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
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 bool is_pixel_canvas() const { return is_pixel_canvas_; }
380
378 private: 381 private:
379 friend class base::RefCounted<Compositor>; 382 friend class base::RefCounted<Compositor>;
380 383
381 // CompositorLockDelegate implementation. 384 // CompositorLockDelegate implementation.
382 void RemoveCompositorLock(CompositorLock* lock) override; 385 void RemoveCompositorLock(CompositorLock* lock) override;
383 386
384 // Causes all active CompositorLocks to be timed out. 387 // Causes all active CompositorLocks to be timed out.
385 void TimeoutLocks(); 388 void TimeoutLocks();
386 389
387 gfx::Size size_; 390 gfx::Size size_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 scoped_refptr<cc::AnimationTimeline> animation_timeline_; 431 scoped_refptr<cc::AnimationTimeline> animation_timeline_;
429 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_; 432 std::unique_ptr<ScopedAnimationDurationScaleMode> slow_animations_;
430 433
431 gfx::ColorSpace output_color_space_; 434 gfx::ColorSpace output_color_space_;
432 gfx::ColorSpace blending_color_space_; 435 gfx::ColorSpace blending_color_space_;
433 436
434 // The estimated time that the locks will timeout. 437 // The estimated time that the locks will timeout.
435 base::TimeTicks scheduled_timeout_; 438 base::TimeTicks scheduled_timeout_;
436 // If true, the |scheduled_timeout_| might be recalculated and extended. 439 // If true, the |scheduled_timeout_| might be recalculated and extended.
437 bool allow_locks_to_extend_timeout_; 440 bool allow_locks_to_extend_timeout_;
441 // If true, all paint commands are recorded at pixel size instead of DIP.
danakj 2017/07/25 17:58:56 Can you also comment on the accessor method?
malaykeshav 2017/07/25 22:57:57 Done
442 bool is_pixel_canvas_;
danakj 2017/07/25 17:58:56 const
malaykeshav 2017/07/25 22:57:57 Done
438 443
439 base::WeakPtrFactory<Compositor> weak_ptr_factory_; 444 base::WeakPtrFactory<Compositor> weak_ptr_factory_;
440 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_; 445 base::WeakPtrFactory<Compositor> lock_timeout_weak_ptr_factory_;
441 446
442 DISALLOW_COPY_AND_ASSIGN(Compositor); 447 DISALLOW_COPY_AND_ASSIGN(Compositor);
443 }; 448 };
444 449
445 } // namespace ui 450 } // namespace ui
446 451
447 #endif // UI_COMPOSITOR_COMPOSITOR_H_ 452 #endif // UI_COMPOSITOR_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698