| 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 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/numerics/safe_conversions.h" | 15 #include "base/numerics/safe_conversions.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "base/task_scheduler/post_task.h" |
| 21 #include "base/task_scheduler/task_scheduler.h" |
| 22 #include "base/task_scheduler/task_traits.h" |
| 20 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 21 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 22 #include "base/values.h" | 25 #include "base/values.h" |
| 23 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 24 #include "cc/animation/animation_host.h" | 27 #include "cc/animation/animation_host.h" |
| 25 #include "cc/animation/animation_timeline.h" | 28 #include "cc/animation/animation_timeline.h" |
| 26 #include "cc/base/switches.h" | 29 #include "cc/base/switches.h" |
| 27 #include "cc/blimp/engine_picture_cache.h" | 30 #include "cc/blimp/engine_picture_cache.h" |
| 28 #include "cc/blimp/image_serialization_processor.h" | 31 #include "cc/blimp/image_serialization_processor.h" |
| 29 #include "cc/blimp/layer_tree_host_remote.h" | 32 #include "cc/blimp/layer_tree_host_remote.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 params.settings = &settings; | 260 params.settings = &settings; |
| 258 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); | 261 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); |
| 259 } else { | 262 } else { |
| 260 cc::LayerTreeHostInProcess::InitParams params; | 263 cc::LayerTreeHostInProcess::InitParams params; |
| 261 params.client = this; | 264 params.client = this; |
| 262 params.settings = &settings; | 265 params.settings = &settings; |
| 263 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); | 266 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); |
| 264 params.main_task_runner = | 267 params.main_task_runner = |
| 265 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 268 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
| 266 params.mutator_host = animation_host_.get(); | 269 params.mutator_host = animation_host_.get(); |
| 270 if (base::TaskScheduler::GetInstance()) { |
| 271 params.image_worker_task_runner = |
| 272 base::CreateSequencedTaskRunnerWithTraits( |
| 273 base::TaskTraits() |
| 274 .WithPriority(base::TaskPriority::BACKGROUND) |
| 275 .WithShutdownBehavior( |
| 276 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); |
| 277 } |
| 267 if (!threaded_) { | 278 if (!threaded_) { |
| 268 // Single-threaded layout tests. | 279 // Single-threaded layout tests. |
| 269 layer_tree_host_ = | 280 layer_tree_host_ = |
| 270 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); | 281 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
| 271 } else { | 282 } else { |
| 272 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( | 283 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( |
| 273 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); | 284 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); |
| 274 } | 285 } |
| 275 } | 286 } |
| 276 | 287 |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 float device_scale) { | 1142 float device_scale) { |
| 1132 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1143 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
| 1133 } | 1144 } |
| 1134 | 1145 |
| 1135 void RenderWidgetCompositor::SetDeviceColorSpace( | 1146 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1136 const gfx::ColorSpace& color_space) { | 1147 const gfx::ColorSpace& color_space) { |
| 1137 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1148 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
| 1138 } | 1149 } |
| 1139 | 1150 |
| 1140 } // namespace content | 1151 } // namespace content |
| OLD | NEW |