| 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" | |
| 26 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 28 #include "base/values.h" | 25 #include "base/values.h" |
| 29 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 30 #include "cc/animation/animation_host.h" | 27 #include "cc/animation/animation_host.h" |
| 31 #include "cc/animation/animation_timeline.h" | 28 #include "cc/animation/animation_timeline.h" |
| 32 #include "cc/base/switches.h" | 29 #include "cc/base/switches.h" |
| 33 #include "cc/blimp/engine_picture_cache.h" | 30 #include "cc/blimp/engine_picture_cache.h" |
| 34 #include "cc/blimp/image_serialization_processor.h" | 31 #include "cc/blimp/image_serialization_processor.h" |
| 35 #include "cc/blimp/layer_tree_host_remote.h" | 32 #include "cc/blimp/layer_tree_host_remote.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 params.settings = &settings; | 238 params.settings = &settings; |
| 242 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); | 239 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); |
| 243 } else { | 240 } else { |
| 244 cc::LayerTreeHostInProcess::InitParams params; | 241 cc::LayerTreeHostInProcess::InitParams params; |
| 245 params.client = this; | 242 params.client = this; |
| 246 params.settings = &settings; | 243 params.settings = &settings; |
| 247 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); | 244 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); |
| 248 params.main_task_runner = | 245 params.main_task_runner = |
| 249 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 246 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
| 250 params.mutator_host = animation_host_.get(); | 247 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 } | |
| 259 if (!threaded_) { | 248 if (!threaded_) { |
| 260 // Single-threaded layout tests. | 249 // Single-threaded layout tests. |
| 261 layer_tree_host_ = | 250 layer_tree_host_ = |
| 262 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); | 251 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
| 263 } else { | 252 } else { |
| 264 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( | 253 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( |
| 265 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); | 254 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); |
| 266 } | 255 } |
| 267 } | 256 } |
| 268 | 257 |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 float device_scale) { | 1125 float device_scale) { |
| 1137 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1126 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
| 1138 } | 1127 } |
| 1139 | 1128 |
| 1140 void RenderWidgetCompositor::SetDeviceColorSpace( | 1129 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1141 const gfx::ColorSpace& color_space) { | 1130 const gfx::ColorSpace& color_space) { |
| 1142 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1131 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
| 1143 } | 1132 } |
| 1144 | 1133 |
| 1145 } // namespace content | 1134 } // namespace content |
| OLD | NEW |