| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 Compositor::Compositor(const cc::FrameSinkId& frame_sink_id, | 75 Compositor::Compositor(const cc::FrameSinkId& frame_sink_id, |
| 76 ui::ContextFactory* context_factory, | 76 ui::ContextFactory* context_factory, |
| 77 ui::ContextFactoryPrivate* context_factory_private, | 77 ui::ContextFactoryPrivate* context_factory_private, |
| 78 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 78 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
| 79 : context_factory_(context_factory), | 79 : context_factory_(context_factory), |
| 80 context_factory_private_(context_factory_private), | 80 context_factory_private_(context_factory_private), |
| 81 root_layer_(NULL), | 81 root_layer_(NULL), |
| 82 widget_(gfx::kNullAcceleratedWidget), | 82 widget_(gfx::kNullAcceleratedWidget), |
| 83 committed_frame_number_(0), |
| 83 widget_valid_(false), | 84 widget_valid_(false), |
| 84 compositor_frame_sink_requested_(false), | 85 compositor_frame_sink_requested_(false), |
| 85 frame_sink_id_(frame_sink_id), | 86 frame_sink_id_(frame_sink_id), |
| 86 task_runner_(task_runner), | 87 task_runner_(task_runner), |
| 87 vsync_manager_(new CompositorVSyncManager()), | 88 vsync_manager_(new CompositorVSyncManager()), |
| 88 device_scale_factor_(0.0f), | 89 device_scale_factor_(0.0f), |
| 89 locks_will_time_out_(true), | 90 locks_will_time_out_(true), |
| 90 compositor_lock_(NULL), | 91 compositor_lock_(NULL), |
| 91 layer_animator_collection_(this), | 92 layer_animator_collection_(this), |
| 92 weak_ptr_factory_(this) { | 93 weak_ptr_factory_(this) { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 NOTREACHED(); | 500 NOTREACHED(); |
| 500 } | 501 } |
| 501 | 502 |
| 502 void Compositor::DidCommit() { | 503 void Compositor::DidCommit() { |
| 503 DCHECK(!IsLocked()); | 504 DCHECK(!IsLocked()); |
| 504 for (auto& observer : observer_list_) | 505 for (auto& observer : observer_list_) |
| 505 observer.OnCompositingDidCommit(this); | 506 observer.OnCompositingDidCommit(this); |
| 506 } | 507 } |
| 507 | 508 |
| 508 void Compositor::DidReceiveCompositorFrameAck() { | 509 void Compositor::DidReceiveCompositorFrameAck() { |
| 510 ++committed_frame_number_; |
| 509 for (auto& observer : observer_list_) | 511 for (auto& observer : observer_list_) |
| 510 observer.OnCompositingEnded(this); | 512 observer.OnCompositingEnded(this); |
| 511 } | 513 } |
| 512 | 514 |
| 513 void Compositor::DidSubmitCompositorFrame() { | 515 void Compositor::DidSubmitCompositorFrame() { |
| 514 base::TimeTicks start_time = base::TimeTicks::Now(); | 516 base::TimeTicks start_time = base::TimeTicks::Now(); |
| 515 for (auto& observer : observer_list_) | 517 for (auto& observer : observer_list_) |
| 516 observer.OnCompositingStarted(this, start_time); | 518 observer.OnCompositingStarted(this, start_time); |
| 517 } | 519 } |
| 518 | 520 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 for (auto& observer : observer_list_) | 553 for (auto& observer : observer_list_) |
| 552 observer.OnCompositingLockStateChanged(this); | 554 observer.OnCompositingLockStateChanged(this); |
| 553 } | 555 } |
| 554 | 556 |
| 555 void Compositor::CancelCompositorLock() { | 557 void Compositor::CancelCompositorLock() { |
| 556 if (compositor_lock_) | 558 if (compositor_lock_) |
| 557 compositor_lock_->CancelLock(); | 559 compositor_lock_->CancelLock(); |
| 558 } | 560 } |
| 559 | 561 |
| 560 } // namespace ui | 562 } // namespace ui |
| OLD | NEW |