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 #include "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 Compositor::Compositor(const cc::FrameSinkId& frame_sink_id, | 77 Compositor::Compositor(const cc::FrameSinkId& frame_sink_id, |
78 ui::ContextFactory* context_factory, | 78 ui::ContextFactory* context_factory, |
79 ui::ContextFactoryPrivate* context_factory_private, | 79 ui::ContextFactoryPrivate* context_factory_private, |
80 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
81 : context_factory_(context_factory), | 81 : context_factory_(context_factory), |
82 context_factory_private_(context_factory_private), | 82 context_factory_private_(context_factory_private), |
83 root_layer_(NULL), | 83 root_layer_(NULL), |
84 widget_(gfx::kNullAcceleratedWidget), | 84 widget_(gfx::kNullAcceleratedWidget), |
85 committed_frame_number_(0), | 85 activated_frame_count_(0), |
86 widget_valid_(false), | 86 widget_valid_(false), |
87 compositor_frame_sink_requested_(false), | 87 compositor_frame_sink_requested_(false), |
88 frame_sink_id_(frame_sink_id), | 88 frame_sink_id_(frame_sink_id), |
89 task_runner_(task_runner), | 89 task_runner_(task_runner), |
90 vsync_manager_(new CompositorVSyncManager()), | 90 vsync_manager_(new CompositorVSyncManager()), |
91 device_scale_factor_(0.0f), | 91 device_scale_factor_(0.0f), |
92 locks_will_time_out_(true), | 92 locks_will_time_out_(true), |
93 compositor_lock_(NULL), | 93 compositor_lock_(NULL), |
94 layer_animator_collection_(this), | 94 layer_animator_collection_(this), |
95 weak_ptr_factory_(this) { | 95 weak_ptr_factory_(this) { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 NOTREACHED(); | 523 NOTREACHED(); |
524 } | 524 } |
525 | 525 |
526 void Compositor::DidCommit() { | 526 void Compositor::DidCommit() { |
527 DCHECK(!IsLocked()); | 527 DCHECK(!IsLocked()); |
528 for (auto& observer : observer_list_) | 528 for (auto& observer : observer_list_) |
529 observer.OnCompositingDidCommit(this); | 529 observer.OnCompositingDidCommit(this); |
530 } | 530 } |
531 | 531 |
532 void Compositor::DidReceiveCompositorFrameAck() { | 532 void Compositor::DidReceiveCompositorFrameAck() { |
533 ++committed_frame_number_; | 533 ++activated_frame_count_; |
534 for (auto& observer : observer_list_) | |
535 observer.OnCompositingEnded(this); | |
536 } | 534 } |
537 | 535 |
538 void Compositor::DidSubmitCompositorFrame() { | 536 void Compositor::DidSubmitCompositorFrame() { |
539 base::TimeTicks start_time = base::TimeTicks::Now(); | 537 base::TimeTicks start_time = base::TimeTicks::Now(); |
540 for (auto& observer : observer_list_) | 538 for (auto& observer : observer_list_) |
541 observer.OnCompositingStarted(this, start_time); | 539 observer.OnCompositingStarted(this, start_time); |
542 } | 540 } |
543 | 541 |
544 void Compositor::SetOutputIsSecure(bool output_is_secure) { | 542 void Compositor::SetOutputIsSecure(bool output_is_secure) { |
545 if (context_factory_private_) | 543 if (context_factory_private_) |
(...skipping 30 matching lines...) Expand all Loading... |
576 for (auto& observer : observer_list_) | 574 for (auto& observer : observer_list_) |
577 observer.OnCompositingLockStateChanged(this); | 575 observer.OnCompositingLockStateChanged(this); |
578 } | 576 } |
579 | 577 |
580 void Compositor::CancelCompositorLock() { | 578 void Compositor::CancelCompositorLock() { |
581 if (compositor_lock_) | 579 if (compositor_lock_) |
582 compositor_lock_->CancelLock(); | 580 compositor_lock_->CancelLock(); |
583 } | 581 } |
584 | 582 |
585 } // namespace ui | 583 } // namespace ui |
OLD | NEW |