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/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/surfaces/surface_id_allocator.h" | 24 #include "cc/surfaces/surface_id_allocator.h" |
24 #include "cc/trees/layer_tree_host.h" | 25 #include "cc/trees/layer_tree_host.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "ui/compositor/compositor_observer.h" | 27 #include "ui/compositor/compositor_observer.h" |
27 #include "ui/compositor/compositor_switches.h" | 28 #include "ui/compositor/compositor_switches.h" |
28 #include "ui/compositor/compositor_vsync_manager.h" | 29 #include "ui/compositor/compositor_vsync_manager.h" |
29 #include "ui/compositor/dip_util.h" | 30 #include "ui/compositor/dip_util.h" |
30 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
31 #include "ui/compositor/layer_animator_collection.h" | 32 #include "ui/compositor/layer_animator_collection.h" |
32 #include "ui/gfx/frame_time.h" | 33 #include "ui/gfx/frame_time.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 settings.single_thread_proxy_scheduler = false; | 138 settings.single_thread_proxy_scheduler = false; |
138 | 139 |
139 base::TimeTicks before_create = base::TimeTicks::Now(); | 140 base::TimeTicks before_create = base::TimeTicks::Now(); |
140 if (compositor_thread_loop_.get()) { | 141 if (compositor_thread_loop_.get()) { |
141 host_ = cc::LayerTreeHost::CreateThreaded( | 142 host_ = cc::LayerTreeHost::CreateThreaded( |
142 this, | 143 this, |
143 context_factory_->GetSharedBitmapManager(), | 144 context_factory_->GetSharedBitmapManager(), |
144 context_factory_->GetGpuMemoryBufferManager(), | 145 context_factory_->GetGpuMemoryBufferManager(), |
145 settings, | 146 settings, |
146 task_runner_, | 147 task_runner_, |
147 compositor_thread_loop_); | 148 compositor_thread_loop_, |
| 149 nullptr); |
148 } else { | 150 } else { |
149 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 151 host_ = cc::LayerTreeHost::CreateSingleThreaded( |
150 this, | 152 this, |
151 this, | 153 this, |
152 context_factory_->GetSharedBitmapManager(), | 154 context_factory_->GetSharedBitmapManager(), |
153 context_factory_->GetGpuMemoryBufferManager(), | 155 context_factory_->GetGpuMemoryBufferManager(), |
154 settings, | 156 settings, |
155 task_runner_); | 157 task_runner_, |
| 158 nullptr); |
156 } | 159 } |
157 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 160 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
158 base::TimeTicks::Now() - before_create); | 161 base::TimeTicks::Now() - before_create); |
159 host_->SetRootLayer(root_web_layer_); | 162 host_->SetRootLayer(root_web_layer_); |
160 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); | 163 host_->set_surface_id_namespace(surface_id_allocator_->id_namespace()); |
161 host_->SetLayerTreeHostClientReady(); | 164 host_->SetLayerTreeHostClientReady(); |
162 } | 165 } |
163 | 166 |
164 Compositor::~Compositor() { | 167 Compositor::~Compositor() { |
165 TRACE_EVENT0("shutdown", "Compositor::destructor"); | 168 TRACE_EVENT0("shutdown", "Compositor::destructor"); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // Call ScheduleDraw() instead of Draw() in order to allow other | 454 // Call ScheduleDraw() instead of Draw() in order to allow other |
452 // CompositorObservers to be notified before starting another | 455 // CompositorObservers to be notified before starting another |
453 // draw cycle. | 456 // draw cycle. |
454 ScheduleDraw(); | 457 ScheduleDraw(); |
455 } | 458 } |
456 FOR_EACH_OBSERVER( | 459 FOR_EACH_OBSERVER( |
457 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 460 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
458 } | 461 } |
459 | 462 |
460 } // namespace ui | 463 } // namespace ui |
OLD | NEW |