| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 17 #include "cc/base/latency_info_swap_promise.h" | 17 #include "cc/base/latency_info_swap_promise.h" |
| 18 #include "cc/base/switches.h" | 18 #include "cc/base/switches.h" |
| 19 #include "cc/input/input_handler.h" | 19 #include "cc/input/input_handler.h" |
| 20 #include "cc/layers/layer.h" | 20 #include "cc/layers/layer.h" |
| 21 #include "cc/output/begin_frame_args.h" |
| 21 #include "cc/output/context_provider.h" | 22 #include "cc/output/context_provider.h" |
| 22 #include "cc/trees/layer_tree_host.h" | 23 #include "cc/trees/layer_tree_host.h" |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "ui/compositor/compositor_observer.h" | 25 #include "ui/compositor/compositor_observer.h" |
| 25 #include "ui/compositor/compositor_switches.h" | 26 #include "ui/compositor/compositor_switches.h" |
| 26 #include "ui/compositor/compositor_vsync_manager.h" | 27 #include "ui/compositor/compositor_vsync_manager.h" |
| 27 #include "ui/compositor/dip_util.h" | 28 #include "ui/compositor/dip_util.h" |
| 28 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
| 29 #include "ui/compositor/layer_animator_collection.h" | 30 #include "ui/compositor/layer_animator_collection.h" |
| 30 #include "ui/gfx/frame_time.h" | 31 #include "ui/gfx/frame_time.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 267 |
| 267 void Compositor::RemoveAnimationObserver( | 268 void Compositor::RemoveAnimationObserver( |
| 268 CompositorAnimationObserver* observer) { | 269 CompositorAnimationObserver* observer) { |
| 269 animation_observer_list_.RemoveObserver(observer); | 270 animation_observer_list_.RemoveObserver(observer); |
| 270 } | 271 } |
| 271 | 272 |
| 272 bool Compositor::HasAnimationObserver(CompositorAnimationObserver* observer) { | 273 bool Compositor::HasAnimationObserver(CompositorAnimationObserver* observer) { |
| 273 return animation_observer_list_.HasObserver(observer); | 274 return animation_observer_list_.HasObserver(observer); |
| 274 } | 275 } |
| 275 | 276 |
| 276 void Compositor::Animate(base::TimeTicks frame_begin_time) { | 277 void Compositor::BeginMainFrame(const cc::BeginFrameArgs& args) { |
| 277 FOR_EACH_OBSERVER(CompositorAnimationObserver, | 278 FOR_EACH_OBSERVER(CompositorAnimationObserver, |
| 278 animation_observer_list_, | 279 animation_observer_list_, |
| 279 OnAnimationStep(frame_begin_time)); | 280 OnAnimationStep(args.frame_time)); |
| 280 if (animation_observer_list_.might_have_observers()) | 281 if (animation_observer_list_.might_have_observers()) |
| 281 host_->SetNeedsAnimate(); | 282 host_->SetNeedsAnimate(); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void Compositor::Layout() { | 285 void Compositor::Layout() { |
| 285 // We're sending damage that will be addressed during this composite | 286 // We're sending damage that will be addressed during this composite |
| 286 // cycle, so we don't need to schedule another composite to address it. | 287 // cycle, so we don't need to schedule another composite to address it. |
| 287 disable_schedule_composite_ = true; | 288 disable_schedule_composite_ = true; |
| 288 if (root_layer_) | 289 if (root_layer_) |
| 289 root_layer_->SendDamagedRects(); | 290 root_layer_->SendDamagedRects(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 observer_list_, | 360 observer_list_, |
| 360 OnCompositingLockStateChanged(this)); | 361 OnCompositingLockStateChanged(this)); |
| 361 } | 362 } |
| 362 | 363 |
| 363 void Compositor::CancelCompositorLock() { | 364 void Compositor::CancelCompositorLock() { |
| 364 if (compositor_lock_) | 365 if (compositor_lock_) |
| 365 compositor_lock_->CancelLock(); | 366 compositor_lock_->CancelLock(); |
| 366 } | 367 } |
| 367 | 368 |
| 368 } // namespace ui | 369 } // namespace ui |
| OLD | NEW |