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/context_provider.h" | 21 #include "cc/output/context_provider.h" |
22 #include "cc/trees/layer_tree_host.h" | 22 #include "cc/trees/layer_tree_host.h" |
| 23 #include "cc/trees/main_thread_task_runner.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" |
31 #include "ui/gl/gl_context.h" | 32 #include "ui/gl/gl_context.h" |
32 #include "ui/gl/gl_switches.h" | 33 #include "ui/gl/gl_switches.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 136 |
136 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); | 137 settings.impl_side_painting = IsUIImplSidePaintingEnabled(); |
137 settings.use_zero_copy = IsUIZeroCopyEnabled(); | 138 settings.use_zero_copy = IsUIZeroCopyEnabled(); |
138 | 139 |
139 base::TimeTicks before_create = base::TimeTicks::Now(); | 140 base::TimeTicks before_create = base::TimeTicks::Now(); |
140 if (compositor_thread_loop_) { | 141 if (compositor_thread_loop_) { |
141 host_ = cc::LayerTreeHost::CreateThreaded( | 142 host_ = cc::LayerTreeHost::CreateThreaded( |
142 this, | 143 this, |
143 context_factory_->GetSharedBitmapManager(), | 144 context_factory_->GetSharedBitmapManager(), |
144 settings, | 145 settings, |
| 146 make_scoped_refptr(new cc::DefaultMainThreadTaskRunner()), |
145 compositor_thread_loop_); | 147 compositor_thread_loop_); |
146 } else { | 148 } else { |
147 host_ = cc::LayerTreeHost::CreateSingleThreaded( | 149 host_ = cc::LayerTreeHost::CreateSingleThreaded( |
148 this, this, context_factory_->GetSharedBitmapManager(), settings); | 150 this, this, context_factory_->GetSharedBitmapManager(), settings, |
| 151 make_scoped_refptr(new cc::DefaultMainThreadTaskRunner())); |
149 } | 152 } |
150 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 153 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
151 base::TimeTicks::Now() - before_create); | 154 base::TimeTicks::Now() - before_create); |
152 host_->SetRootLayer(root_web_layer_); | 155 host_->SetRootLayer(root_web_layer_); |
153 host_->SetLayerTreeHostClientReady(); | 156 host_->SetLayerTreeHostClientReady(); |
154 } | 157 } |
155 | 158 |
156 Compositor::~Compositor() { | 159 Compositor::~Compositor() { |
157 TRACE_EVENT0("shutdown", "Compositor::destructor"); | 160 TRACE_EVENT0("shutdown", "Compositor::destructor"); |
158 | 161 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // CompositorObservers to be notified before starting another | 407 // CompositorObservers to be notified before starting another |
405 // draw cycle. | 408 // draw cycle. |
406 ScheduleDraw(); | 409 ScheduleDraw(); |
407 } | 410 } |
408 FOR_EACH_OBSERVER(CompositorObserver, | 411 FOR_EACH_OBSERVER(CompositorObserver, |
409 observer_list_, | 412 observer_list_, |
410 OnCompositingEnded(this)); | 413 OnCompositingEnded(this)); |
411 } | 414 } |
412 | 415 |
413 } // namespace ui | 416 } // namespace ui |
OLD | NEW |