Chromium Code Reviews| 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> |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 233 |
| 234 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; | 234 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; |
| 235 | 235 |
| 236 cc::LayerTreeHost::InitParams params; | 236 cc::LayerTreeHost::InitParams params; |
| 237 params.client = client; | 237 params.client = client; |
| 238 params.settings = &settings; | 238 params.settings = &settings; |
| 239 params.task_graph_runner = deps->GetTaskGraphRunner(); | 239 params.task_graph_runner = deps->GetTaskGraphRunner(); |
| 240 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); | 240 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); |
| 241 params.mutator_host = mutator_host; | 241 params.mutator_host = mutator_host; |
| 242 if (base::TaskScheduler::GetInstance()) { | 242 if (base::TaskScheduler::GetInstance()) { |
| 243 // The image worker thread needs to allow waiting since it makes discardable | |
| 244 // shared memory allocations which need to make synchronous calls to the | |
| 245 // IO thread. | |
| 243 params.image_worker_task_runner = base::CreateSequencedTaskRunnerWithTraits( | 246 params.image_worker_task_runner = base::CreateSequencedTaskRunnerWithTraits( |
| 244 base::TaskTraits() | 247 base::TaskTraits() |
| 245 .WithPriority(base::TaskPriority::BACKGROUND) | 248 .WithPriority(base::TaskPriority::BACKGROUND) |
| 246 .WithShutdownBehavior( | 249 .WithShutdownBehavior( |
| 247 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); | 250 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN) |
| 251 .WithBaseSyncPrimitives()); | |
|
enne (OOO)
2017/02/25 00:09:12
How did this work before?
Khushal
2017/02/25 00:14:01
It didn't, nobody uses this worker yet. I think on
enne (OOO)
2017/02/25 00:16:30
Oh right right, this was all within cc in previous
Khushal
2017/02/25 02:48:03
We do make sync calls to the worker from only the
enne (OOO)
2017/02/27 20:45:50
Yeah, I think making a comment that this thread be
Khushal
2017/02/27 22:57:05
Done. Thanks!
I was curious and stumbled upon a d
| |
| 248 } | 252 } |
| 249 if (!is_threaded) { | 253 if (!is_threaded) { |
| 250 // Single-threaded layout tests. | 254 // Single-threaded layout tests. |
| 251 layer_tree_host = | 255 layer_tree_host = |
| 252 cc::LayerTreeHost::CreateSingleThreaded(single_thread_client, ¶ms); | 256 cc::LayerTreeHost::CreateSingleThreaded(single_thread_client, ¶ms); |
| 253 } else { | 257 } else { |
| 254 layer_tree_host = cc::LayerTreeHost::CreateThreaded( | 258 layer_tree_host = cc::LayerTreeHost::CreateThreaded( |
| 255 deps->GetCompositorImplThreadTaskRunner(), ¶ms); | 259 deps->GetCompositorImplThreadTaskRunner(), ¶ms); |
| 256 } | 260 } |
| 257 | 261 |
| 258 return layer_tree_host; | 262 return layer_tree_host; |
| 259 } | 263 } |
| 260 | 264 |
| 261 // static | 265 // static |
| 262 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( | 266 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( |
| 263 const base::CommandLine& cmd, | 267 const base::CommandLine& cmd, |
| 264 CompositorDependencies* compositor_deps, | 268 CompositorDependencies* compositor_deps, |
| 265 float device_scale_factor, | 269 float device_scale_factor, |
| 266 const ScreenInfo& screen_info) { | 270 const ScreenInfo& screen_info) { |
| 267 cc::LayerTreeSettings settings; | 271 cc::LayerTreeSettings settings; |
| 268 | 272 |
| 269 // For web contents, layer transforms should scale up the contents of layers | 273 // For web contents, layer transforms should scale up the contents of layers |
| 270 // to keep content always crisp when possible. | 274 // to keep content always crisp when possible. |
| 271 settings.layer_transforms_should_scale_layer_contents = true; | 275 settings.layer_transforms_should_scale_layer_contents = true; |
| 272 | 276 |
| 273 settings.main_frame_before_activation_enabled = | 277 settings.main_frame_before_activation_enabled = |
| 274 cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); | 278 cmd.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation); |
| 275 | 279 |
| 280 settings.enable_checker_imaging = | |
| 281 cmd.HasSwitch(cc::switches::kEnableCheckerImaging); | |
| 282 | |
| 276 // TODO(danakj): This should not be a setting O_O; it should change when the | 283 // TODO(danakj): This should not be a setting O_O; it should change when the |
| 277 // device scale factor on LayerTreeHost changes. | 284 // device scale factor on LayerTreeHost changes. |
| 278 settings.default_tile_size = | 285 settings.default_tile_size = |
| 279 CalculateDefaultTileSize(device_scale_factor, screen_info); | 286 CalculateDefaultTileSize(device_scale_factor, screen_info); |
| 280 if (cmd.HasSwitch(switches::kDefaultTileWidth)) { | 287 if (cmd.HasSwitch(switches::kDefaultTileWidth)) { |
| 281 int tile_width = 0; | 288 int tile_width = 0; |
| 282 GetSwitchValueAsInt(cmd, switches::kDefaultTileWidth, 1, | 289 GetSwitchValueAsInt(cmd, switches::kDefaultTileWidth, 1, |
| 283 std::numeric_limits<int>::max(), &tile_width); | 290 std::numeric_limits<int>::max(), &tile_width); |
| 284 settings.default_tile_size.set_width(tile_width); | 291 settings.default_tile_size.set_width(tile_width); |
| 285 } | 292 } |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1118 void RenderWidgetCompositor::SetDeviceColorSpace( | 1125 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1119 const gfx::ColorSpace& color_space) { | 1126 const gfx::ColorSpace& color_space) { |
| 1120 layer_tree_host_->SetDeviceColorSpace(color_space); | 1127 layer_tree_host_->SetDeviceColorSpace(color_space); |
| 1121 } | 1128 } |
| 1122 | 1129 |
| 1123 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { | 1130 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { |
| 1124 is_for_oopif_ = is_for_oopif; | 1131 is_for_oopif_ = is_for_oopif; |
| 1125 } | 1132 } |
| 1126 | 1133 |
| 1127 } // namespace content | 1134 } // namespace content |
| OLD | NEW |