OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <limits> | 10 #include <limits> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/numerics/safe_conversions.h" | 18 #include "base/numerics/safe_conversions.h" |
19 #include "base/single_thread_task_runner.h" | 19 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 23 #include "base/task_scheduler/post_task.h" |
| 24 #include "base/task_scheduler/task_scheduler.h" |
| 25 #include "base/task_scheduler/task_traits.h" |
23 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
24 #include "base/time/time.h" | 27 #include "base/time/time.h" |
25 #include "base/values.h" | 28 #include "base/values.h" |
26 #include "build/build_config.h" | 29 #include "build/build_config.h" |
27 #include "cc/animation/animation_host.h" | 30 #include "cc/animation/animation_host.h" |
28 #include "cc/animation/animation_timeline.h" | 31 #include "cc/animation/animation_timeline.h" |
29 #include "cc/base/switches.h" | 32 #include "cc/base/switches.h" |
30 #include "cc/blimp/engine_picture_cache.h" | 33 #include "cc/blimp/engine_picture_cache.h" |
31 #include "cc/blimp/image_serialization_processor.h" | 34 #include "cc/blimp/image_serialization_processor.h" |
32 #include "cc/blimp/layer_tree_host_remote.h" | 35 #include "cc/blimp/layer_tree_host_remote.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 params.settings = &settings; | 241 params.settings = &settings; |
239 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); | 242 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); |
240 } else { | 243 } else { |
241 cc::LayerTreeHostInProcess::InitParams params; | 244 cc::LayerTreeHostInProcess::InitParams params; |
242 params.client = this; | 245 params.client = this; |
243 params.settings = &settings; | 246 params.settings = &settings; |
244 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); | 247 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); |
245 params.main_task_runner = | 248 params.main_task_runner = |
246 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 249 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
247 params.mutator_host = animation_host_.get(); | 250 params.mutator_host = animation_host_.get(); |
| 251 if (base::TaskScheduler::GetInstance()) { |
| 252 params.image_worker_task_runner = |
| 253 base::CreateSequencedTaskRunnerWithTraits( |
| 254 base::TaskTraits() |
| 255 .WithPriority(base::TaskPriority::BACKGROUND) |
| 256 .WithShutdownBehavior( |
| 257 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); |
| 258 } |
248 if (!threaded_) { | 259 if (!threaded_) { |
249 // Single-threaded layout tests. | 260 // Single-threaded layout tests. |
250 layer_tree_host_ = | 261 layer_tree_host_ = |
251 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); | 262 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
252 } else { | 263 } else { |
253 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( | 264 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( |
254 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); | 265 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); |
255 } | 266 } |
256 } | 267 } |
257 | 268 |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 float device_scale) { | 1139 float device_scale) { |
1129 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1140 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1130 } | 1141 } |
1131 | 1142 |
1132 void RenderWidgetCompositor::SetDeviceColorSpace( | 1143 void RenderWidgetCompositor::SetDeviceColorSpace( |
1133 const gfx::ColorSpace& color_space) { | 1144 const gfx::ColorSpace& color_space) { |
1134 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1145 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1135 } | 1146 } |
1136 | 1147 |
1137 } // namespace content | 1148 } // namespace content |
OLD | NEW |