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> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "cc/layers/layer.h" | 32 #include "cc/layers/layer.h" |
33 #include "cc/output/begin_frame_args.h" | 33 #include "cc/output/begin_frame_args.h" |
34 #include "cc/output/copy_output_request.h" | 34 #include "cc/output/copy_output_request.h" |
35 #include "cc/output/copy_output_result.h" | 35 #include "cc/output/copy_output_result.h" |
36 #include "cc/output/latency_info_swap_promise.h" | 36 #include "cc/output/latency_info_swap_promise.h" |
37 #include "cc/output/swap_promise.h" | 37 #include "cc/output/swap_promise.h" |
38 #include "cc/proto/compositor_message.pb.h" | 38 #include "cc/proto/compositor_message.pb.h" |
39 #include "cc/resources/single_release_callback.h" | 39 #include "cc/resources/single_release_callback.h" |
40 #include "cc/scheduler/begin_frame_source.h" | 40 #include "cc/scheduler/begin_frame_source.h" |
41 #include "cc/trees/latency_info_swap_promise_monitor.h" | 41 #include "cc/trees/latency_info_swap_promise_monitor.h" |
42 #include "cc/trees/layer_tree_host.h" | 42 #include "cc/trees/layer_tree_host_in_process.h" |
43 #include "cc/trees/remote_proto_channel.h" | 43 #include "cc/trees/remote_proto_channel.h" |
44 #include "content/common/content_switches_internal.h" | 44 #include "content/common/content_switches_internal.h" |
45 #include "content/common/gpu/client/context_provider_command_buffer.h" | 45 #include "content/common/gpu/client/context_provider_command_buffer.h" |
46 #include "content/common/layer_tree_settings_factory.h" | 46 #include "content/common/layer_tree_settings_factory.h" |
47 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
48 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
49 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 49 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
50 #include "content/renderer/input/input_handler_manager.h" | 50 #include "content/renderer/input/input_handler_manager.h" |
51 #include "gpu/command_buffer/client/gles2_interface.h" | 51 #include "gpu/command_buffer/client/gles2_interface.h" |
52 #include "gpu/command_buffer/service/gpu_switches.h" | 52 #include "gpu/command_buffer/service/gpu_switches.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), | 225 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), |
226 never_visible_(false), | 226 never_visible_(false), |
227 layout_and_paint_async_callback_(nullptr), | 227 layout_and_paint_async_callback_(nullptr), |
228 remote_proto_channel_receiver_(nullptr), | 228 remote_proto_channel_receiver_(nullptr), |
229 weak_factory_(this) {} | 229 weak_factory_(this) {} |
230 | 230 |
231 void RenderWidgetCompositor::Initialize(float device_scale_factor) { | 231 void RenderWidgetCompositor::Initialize(float device_scale_factor) { |
232 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 232 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
233 cc::LayerTreeSettings settings = | 233 cc::LayerTreeSettings settings = |
234 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor); | 234 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor); |
235 cc::LayerTreeHost::InitParams params; | 235 cc::LayerTreeHostInProcess::InitParams params; |
236 params.client = this; | 236 params.client = this; |
237 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager(); | 237 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager(); |
238 params.gpu_memory_buffer_manager = | 238 params.gpu_memory_buffer_manager = |
239 compositor_deps_->GetGpuMemoryBufferManager(); | 239 compositor_deps_->GetGpuMemoryBufferManager(); |
240 params.settings = &settings; | 240 params.settings = &settings; |
241 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); | 241 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); |
242 params.main_task_runner = | 242 params.main_task_runner = |
243 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 243 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
244 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 244 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
245 DCHECK(settings.use_compositor_frame_sink_begin_frame_source); | 245 DCHECK(settings.use_compositor_frame_sink_begin_frame_source); |
246 | 246 |
247 if (cmd->HasSwitch(switches::kUseRemoteCompositing)) { | 247 if (cmd->HasSwitch(switches::kUseRemoteCompositing)) { |
248 DCHECK(!threaded_); | 248 DCHECK(!threaded_); |
249 params.image_serialization_processor = | 249 params.image_serialization_processor = |
250 compositor_deps_->GetImageSerializationProcessor(); | 250 compositor_deps_->GetImageSerializationProcessor(); |
251 layer_tree_host_ = cc::LayerTreeHost::CreateRemoteServer(this, ¶ms); | 251 layer_tree_host_ = |
| 252 cc::LayerTreeHostInProcess::CreateRemoteServer(this, ¶ms); |
252 } else if (!threaded_) { | 253 } else if (!threaded_) { |
253 // Single-threaded layout tests. | 254 // Single-threaded layout tests. |
254 layer_tree_host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); | 255 layer_tree_host_ = |
| 256 cc::LayerTreeHostInProcess::CreateSingleThreaded(this, ¶ms); |
255 } else { | 257 } else { |
256 layer_tree_host_ = cc::LayerTreeHost::CreateThreaded( | 258 layer_tree_host_ = cc::LayerTreeHostInProcess::CreateThreaded( |
257 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); | 259 compositor_deps_->GetCompositorImplThreadTaskRunner(), ¶ms); |
258 } | 260 } |
259 DCHECK(layer_tree_host_); | 261 DCHECK(layer_tree_host_); |
260 } | 262 } |
261 | 263 |
262 RenderWidgetCompositor::~RenderWidgetCompositor() = default; | 264 RenderWidgetCompositor::~RenderWidgetCompositor() = default; |
263 | 265 |
264 // static | 266 // static |
265 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( | 267 cc::LayerTreeSettings RenderWidgetCompositor::GenerateLayerTreeSettings( |
266 const base::CommandLine& cmd, | 268 const base::CommandLine& cmd, |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 float device_scale) { | 1139 float device_scale) { |
1138 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1140 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1139 } | 1141 } |
1140 | 1142 |
1141 void RenderWidgetCompositor::SetDeviceColorSpace( | 1143 void RenderWidgetCompositor::SetDeviceColorSpace( |
1142 const gfx::ColorSpace& color_space) { | 1144 const gfx::ColorSpace& color_space) { |
1143 // TODO(ccameron): Plumb this to the cc compositor. | 1145 // TODO(ccameron): Plumb this to the cc compositor. |
1144 } | 1146 } |
1145 | 1147 |
1146 } // namespace content | 1148 } // namespace content |
OLD | NEW |