| 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 26 matching lines...) Expand all Loading... |
| 37 #include "cc/input/layer_selection_bound.h" | 37 #include "cc/input/layer_selection_bound.h" |
| 38 #include "cc/layers/layer.h" | 38 #include "cc/layers/layer.h" |
| 39 #include "cc/output/begin_frame_args.h" | 39 #include "cc/output/begin_frame_args.h" |
| 40 #include "cc/output/copy_output_request.h" | 40 #include "cc/output/copy_output_request.h" |
| 41 #include "cc/output/copy_output_result.h" | 41 #include "cc/output/copy_output_result.h" |
| 42 #include "cc/output/latency_info_swap_promise.h" | 42 #include "cc/output/latency_info_swap_promise.h" |
| 43 #include "cc/output/swap_promise.h" | 43 #include "cc/output/swap_promise.h" |
| 44 #include "cc/resources/single_release_callback.h" | 44 #include "cc/resources/single_release_callback.h" |
| 45 #include "cc/scheduler/begin_frame_source.h" | 45 #include "cc/scheduler/begin_frame_source.h" |
| 46 #include "cc/trees/latency_info_swap_promise_monitor.h" | 46 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 47 #include "cc/trees/layer_tree_host_in_process.h" | 47 #include "cc/trees/layer_tree_host.h" |
| 48 #include "cc/trees/layer_tree_mutator.h" | 48 #include "cc/trees/layer_tree_mutator.h" |
| 49 #include "content/common/content_switches_internal.h" | 49 #include "content/common/content_switches_internal.h" |
| 50 #include "content/common/layer_tree_settings_factory.h" | 50 #include "content/common/layer_tree_settings_factory.h" |
| 51 #include "content/public/common/content_client.h" | 51 #include "content/public/common/content_client.h" |
| 52 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
| 53 #include "content/public/common/screen_info.h" | 53 #include "content/public/common/screen_info.h" |
| 54 #include "content/public/renderer/content_renderer_client.h" | 54 #include "content/public/renderer/content_renderer_client.h" |
| 55 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 55 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
| 56 #include "content/renderer/input/input_handler_manager.h" | 56 #include "content/renderer/input/input_handler_manager.h" |
| 57 #include "gpu/command_buffer/client/gles2_interface.h" | 57 #include "gpu/command_buffer/client/gles2_interface.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 float device_scale_factor, | 229 float device_scale_factor, |
| 230 const ScreenInfo& screen_info) { | 230 const ScreenInfo& screen_info) { |
| 231 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 231 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 232 cc::LayerTreeSettings settings = | 232 cc::LayerTreeSettings settings = |
| 233 GenerateLayerTreeSettings(*cmd, deps, device_scale_factor, screen_info); | 233 GenerateLayerTreeSettings(*cmd, deps, device_scale_factor, screen_info); |
| 234 | 234 |
| 235 const bool is_threaded = !!deps->GetCompositorImplThreadTaskRunner(); | 235 const bool is_threaded = !!deps->GetCompositorImplThreadTaskRunner(); |
| 236 | 236 |
| 237 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; | 237 std::unique_ptr<cc::LayerTreeHost> layer_tree_host; |
| 238 | 238 |
| 239 cc::LayerTreeHostInProcess::InitParams params; | 239 cc::LayerTreeHost::InitParams params; |
| 240 params.client = client; | 240 params.client = client; |
| 241 params.settings = &settings; | 241 params.settings = &settings; |
| 242 params.task_graph_runner = deps->GetTaskGraphRunner(); | 242 params.task_graph_runner = deps->GetTaskGraphRunner(); |
| 243 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); | 243 params.main_task_runner = deps->GetCompositorMainThreadTaskRunner(); |
| 244 params.mutator_host = mutator_host; | 244 params.mutator_host = mutator_host; |
| 245 if (base::TaskScheduler::GetInstance()) { | 245 if (base::TaskScheduler::GetInstance()) { |
| 246 params.image_worker_task_runner = base::CreateSequencedTaskRunnerWithTraits( | 246 params.image_worker_task_runner = base::CreateSequencedTaskRunnerWithTraits( |
| 247 base::TaskTraits() | 247 base::TaskTraits() |
| 248 .WithPriority(base::TaskPriority::BACKGROUND) | 248 .WithPriority(base::TaskPriority::BACKGROUND) |
| 249 .WithShutdownBehavior( | 249 .WithShutdownBehavior( |
| 250 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); | 250 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)); |
| 251 } | 251 } |
| 252 if (!is_threaded) { | 252 if (!is_threaded) { |
| 253 // Single-threaded layout tests. | 253 // Single-threaded layout tests. |
| 254 layer_tree_host = cc::LayerTreeHostInProcess::CreateSingleThreaded( | 254 layer_tree_host = |
| 255 single_thread_client, ¶ms); | 255 cc::LayerTreeHost::CreateSingleThreaded(single_thread_client, ¶ms); |
| 256 } else { | 256 } else { |
| 257 layer_tree_host = cc::LayerTreeHostInProcess::CreateThreaded( | 257 layer_tree_host = cc::LayerTreeHost::CreateThreaded( |
| 258 deps->GetCompositorImplThreadTaskRunner(), ¶ms); | 258 deps->GetCompositorImplThreadTaskRunner(), ¶ms); |
| 259 } | 259 } |
| 260 | 260 |
| 261 return layer_tree_host; | 261 return layer_tree_host; |
| 262 } | 262 } |
| 263 | 263 |
| 264 // static | 264 // static |
| 265 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( | 265 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( |
| 266 const base::CommandLine& cmd, | 266 const base::CommandLine& cmd, |
| 267 CompositorDependencies* compositor_deps, | 267 CompositorDependencies* compositor_deps, |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 void RenderWidgetCompositor::SetDeviceColorSpace( | 1130 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1131 const gfx::ColorSpace& color_space) { | 1131 const gfx::ColorSpace& color_space) { |
| 1132 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1132 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
| 1133 } | 1133 } |
| 1134 | 1134 |
| 1135 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { | 1135 void RenderWidgetCompositor::SetIsForOopif(bool is_for_oopif) { |
| 1136 is_for_oopif_ = is_for_oopif; | 1136 is_for_oopif_ = is_for_oopif; |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 } // namespace content | 1139 } // namespace content |
| OLD | NEW |