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/scheduler/begin_frame_source.h" |
21 #include "cc/output/begin_frame_args.h" | 22 #include "cc/output/begin_frame_args.h" |
22 #include "cc/output/context_provider.h" | 23 #include "cc/output/context_provider.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" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 settings.single_thread_proxy_scheduler = false; | 162 settings.single_thread_proxy_scheduler = false; |
162 | 163 |
163 base::TimeTicks before_create = base::TimeTicks::Now(); | 164 base::TimeTicks before_create = base::TimeTicks::Now(); |
164 if (compositor_thread_loop_.get()) { | 165 if (compositor_thread_loop_.get()) { |
165 host_ = cc::LayerTreeHost::CreateThreaded( | 166 host_ = cc::LayerTreeHost::CreateThreaded( |
166 this, | 167 this, |
167 context_factory_->GetSharedBitmapManager(), | 168 context_factory_->GetSharedBitmapManager(), |
168 context_factory_->GetGpuMemoryBufferManager(), | 169 context_factory_->GetGpuMemoryBufferManager(), |
169 settings, | 170 settings, |
170 task_runner_, | 171 task_runner_, |
171 compositor_thread_loop_); | 172 compositor_thread_loop_, |
| 173 nullptr); |
172 } else { | 174 } else { |
173 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 175 host_ = cc::LayerTreeHost::CreateSingleThreaded( |
174 this, | 176 this, |
175 this, | 177 this, |
176 context_factory_->GetSharedBitmapManager(), | 178 context_factory_->GetSharedBitmapManager(), |
177 context_factory_->GetGpuMemoryBufferManager(), | 179 context_factory_->GetGpuMemoryBufferManager(), |
178 settings, | 180 settings, |
179 task_runner_); | 181 task_runner_, |
| 182 nullptr); |
180 } | 183 } |
181 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 184 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
182 base::TimeTicks::Now() - before_create); | 185 base::TimeTicks::Now() - before_create); |
183 host_->SetRootLayer(root_web_layer_); | 186 host_->SetRootLayer(root_web_layer_); |
184 host_->SetLayerTreeHostClientReady(); | 187 host_->SetLayerTreeHostClientReady(); |
185 } | 188 } |
186 | 189 |
187 Compositor::~Compositor() { | 190 Compositor::~Compositor() { |
188 TRACE_EVENT0("shutdown", "Compositor::destructor"); | 191 TRACE_EVENT0("shutdown", "Compositor::destructor"); |
189 | 192 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 // Call ScheduleDraw() instead of Draw() in order to allow other | 481 // Call ScheduleDraw() instead of Draw() in order to allow other |
479 // CompositorObservers to be notified before starting another | 482 // CompositorObservers to be notified before starting another |
480 // draw cycle. | 483 // draw cycle. |
481 ScheduleDraw(); | 484 ScheduleDraw(); |
482 } | 485 } |
483 FOR_EACH_OBSERVER( | 486 FOR_EACH_OBSERVER( |
484 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 487 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
485 } | 488 } |
486 | 489 |
487 } // namespace ui | 490 } // namespace ui |
OLD | NEW |