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