| 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/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.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/begin_frame_args.h" |
| 22 #include "cc/output/context_provider.h" | 22 #include "cc/output/context_provider.h" |
| 23 #include "cc/scheduler/begin_frame_source.h" | 23 #include "cc/scheduler/begin_frame_source.h" |
| 24 #include "cc/surfaces/surface_id_allocator.h" | 24 #include "cc/surfaces/surface_id_allocator.h" |
| 25 #include "cc/trees/layer_tree_host.h" | 25 #include "cc/trees/layer_tree_host.h" |
| 26 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 27 #include "ui/compositor/compositor_observer.h" | 27 #include "ui/compositor/compositor_observer.h" |
| 28 #include "ui/compositor/compositor_switches.h" | 28 #include "ui/compositor/compositor_switches.h" |
| 29 #include "ui/compositor/compositor_vsync_manager.h" | 29 #include "ui/compositor/compositor_vsync_manager.h" |
| 30 #include "ui/compositor/debug_utils.h" |
| 30 #include "ui/compositor/dip_util.h" | 31 #include "ui/compositor/dip_util.h" |
| 31 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
| 32 #include "ui/compositor/layer_animator_collection.h" | 33 #include "ui/compositor/layer_animator_collection.h" |
| 33 #include "ui/gfx/frame_time.h" | 34 #include "ui/gfx/frame_time.h" |
| 34 #include "ui/gl/gl_context.h" | 35 #include "ui/gl/gl_context.h" |
| 35 #include "ui/gl/gl_switches.h" | 36 #include "ui/gl/gl_switches.h" |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 | 39 |
| 39 const double kDefaultRefreshRate = 60.0; | 40 const double kDefaultRefreshRate = 60.0; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // OnCompositingStarted/OnCompositingEnded messages match. | 351 // OnCompositingStarted/OnCompositingEnded messages match. |
| 351 if (compositor_thread_loop_.get()) { | 352 if (compositor_thread_loop_.get()) { |
| 352 base::TimeTicks start_time = gfx::FrameTime::Now(); | 353 base::TimeTicks start_time = gfx::FrameTime::Now(); |
| 353 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, | 354 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, |
| 354 OnCompositingStarted(this, start_time)); | 355 OnCompositingStarted(this, start_time)); |
| 355 } | 356 } |
| 356 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, | 357 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, |
| 357 OnCompositingEnded(this)); | 358 OnCompositingEnded(this)); |
| 358 } | 359 } |
| 359 | 360 |
| 361 SkTypeface* Compositor::GetHudTypeface() { |
| 362 return ui::GetHudTypeface(); |
| 363 } |
| 364 |
| 360 void Compositor::DidPostSwapBuffers() { | 365 void Compositor::DidPostSwapBuffers() { |
| 361 base::TimeTicks start_time = gfx::FrameTime::Now(); | 366 base::TimeTicks start_time = gfx::FrameTime::Now(); |
| 362 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, | 367 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, |
| 363 OnCompositingStarted(this, start_time)); | 368 OnCompositingStarted(this, start_time)); |
| 364 } | 369 } |
| 365 | 370 |
| 366 void Compositor::DidAbortSwapBuffers() { | 371 void Compositor::DidAbortSwapBuffers() { |
| 367 FOR_EACH_OBSERVER(CompositorObserver, | 372 FOR_EACH_OBSERVER(CompositorObserver, |
| 368 observer_list_, | 373 observer_list_, |
| 369 OnCompositingAborted(this)); | 374 OnCompositingAborted(this)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 observer_list_, | 406 observer_list_, |
| 402 OnCompositingLockStateChanged(this)); | 407 OnCompositingLockStateChanged(this)); |
| 403 } | 408 } |
| 404 | 409 |
| 405 void Compositor::CancelCompositorLock() { | 410 void Compositor::CancelCompositorLock() { |
| 406 if (compositor_lock_) | 411 if (compositor_lock_) |
| 407 compositor_lock_->CancelLock(); | 412 compositor_lock_->CancelLock(); |
| 408 } | 413 } |
| 409 | 414 |
| 410 } // namespace ui | 415 } // namespace ui |
| OLD | NEW |