Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2413063002: content/blimp: Set up hooks for enabling LTHRemote in the renderer. (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/numerics/safe_conversions.h" 15 #include "base/numerics/safe_conversions.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/sys_info.h" 19 #include "base/sys_info.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "cc/animation/animation_host.h" 24 #include "cc/animation/animation_host.h"
25 #include "cc/animation/animation_timeline.h" 25 #include "cc/animation/animation_timeline.h"
26 #include "cc/animation/layer_tree_mutator.h" 26 #include "cc/animation/layer_tree_mutator.h"
27 #include "cc/base/switches.h" 27 #include "cc/base/switches.h"
28 #include "cc/blimp/engine_picture_cache.h"
29 #include "cc/blimp/image_serialization_processor.h"
30 #include "cc/blimp/layer_tree_host_remote.h"
31 #include "cc/blimp/remote_compositor_bridge.h"
28 #include "cc/blink/web_layer_impl.h" 32 #include "cc/blink/web_layer_impl.h"
29 #include "cc/debug/layer_tree_debug_state.h" 33 #include "cc/debug/layer_tree_debug_state.h"
30 #include "cc/debug/micro_benchmark.h" 34 #include "cc/debug/micro_benchmark.h"
31 #include "cc/input/layer_selection_bound.h" 35 #include "cc/input/layer_selection_bound.h"
32 #include "cc/layers/layer.h" 36 #include "cc/layers/layer.h"
33 #include "cc/output/begin_frame_args.h" 37 #include "cc/output/begin_frame_args.h"
34 #include "cc/output/copy_output_request.h" 38 #include "cc/output/copy_output_request.h"
35 #include "cc/output/copy_output_result.h" 39 #include "cc/output/copy_output_result.h"
36 #include "cc/output/latency_info_swap_promise.h" 40 #include "cc/output/latency_info_swap_promise.h"
37 #include "cc/output/swap_promise.h" 41 #include "cc/output/swap_promise.h"
38 #include "cc/proto/compositor_message.pb.h" 42 #include "cc/proto/compositor_message.pb.h"
39 #include "cc/resources/single_release_callback.h" 43 #include "cc/resources/single_release_callback.h"
40 #include "cc/scheduler/begin_frame_source.h" 44 #include "cc/scheduler/begin_frame_source.h"
41 #include "cc/trees/latency_info_swap_promise_monitor.h" 45 #include "cc/trees/latency_info_swap_promise_monitor.h"
42 #include "cc/trees/layer_tree_host_in_process.h" 46 #include "cc/trees/layer_tree_host_in_process.h"
43 #include "cc/trees/remote_proto_channel.h" 47 #include "cc/trees/remote_proto_channel.h"
44 #include "content/common/content_switches_internal.h" 48 #include "content/common/content_switches_internal.h"
45 #include "content/common/gpu/client/context_provider_command_buffer.h" 49 #include "content/common/gpu/client/context_provider_command_buffer.h"
46 #include "content/common/layer_tree_settings_factory.h" 50 #include "content/common/layer_tree_settings_factory.h"
47 #include "content/public/common/content_client.h" 51 #include "content/public/common/content_client.h"
48 #include "content/public/common/content_switches.h" 52 #include "content/public/common/content_switches.h"
53 #include "content/public/renderer/content_renderer_client.h"
49 #include "content/renderer/gpu/render_widget_compositor_delegate.h" 54 #include "content/renderer/gpu/render_widget_compositor_delegate.h"
50 #include "content/renderer/input/input_handler_manager.h" 55 #include "content/renderer/input/input_handler_manager.h"
51 #include "gpu/command_buffer/client/gles2_interface.h" 56 #include "gpu/command_buffer/client/gles2_interface.h"
52 #include "gpu/command_buffer/service/gpu_switches.h" 57 #include "gpu/command_buffer/service/gpu_switches.h"
53 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h" 58 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac k.h"
54 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" 59 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h"
55 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" 60 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h"
56 #include "third_party/WebKit/public/platform/WebSize.h" 61 #include "third_party/WebKit/public/platform/WebSize.h"
57 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 62 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
58 #include "third_party/WebKit/public/web/WebKit.h" 63 #include "third_party/WebKit/public/web/WebKit.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), 231 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()),
227 never_visible_(false), 232 never_visible_(false),
228 layout_and_paint_async_callback_(nullptr), 233 layout_and_paint_async_callback_(nullptr),
229 remote_proto_channel_receiver_(nullptr), 234 remote_proto_channel_receiver_(nullptr),
230 weak_factory_(this) {} 235 weak_factory_(this) {}
231 236
232 void RenderWidgetCompositor::Initialize(float device_scale_factor) { 237 void RenderWidgetCompositor::Initialize(float device_scale_factor) {
233 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 238 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
234 cc::LayerTreeSettings settings = 239 cc::LayerTreeSettings settings =
235 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor); 240 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor);
241
242 if (cmd->HasSwitch(switches::kUseRemoteCompositing) &&
243 cmd->HasSwitch(switches::kUseLayerTreeHostRemote)) {
244 DCHECK(!threaded_);
245
246 cc::LayerTreeHostRemote::InitParams params;
247 params.client = this;
248 params.main_task_runner =
249 compositor_deps_->GetCompositorMainThreadTaskRunner();
250 params.animation_host = cc::AnimationHost::CreateMainInstance();
251 params.remote_compositor_bridge =
252 GetContentClient()->renderer()->CreateRemoteCompositorBridge(
253 this, params.main_task_runner);
254 params.engine_picture_cache =
255 compositor_deps_->GetImageSerializationProcessor()
256 ->CreateEnginePictureCache();
257 params.settings = &settings;
258 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(&params);
259 return;
260 }
261
236 cc::LayerTreeHostInProcess::InitParams params; 262 cc::LayerTreeHostInProcess::InitParams params;
237 params.client = this; 263 params.client = this;
238 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager(); 264 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager();
239 params.gpu_memory_buffer_manager = 265 params.gpu_memory_buffer_manager =
240 compositor_deps_->GetGpuMemoryBufferManager(); 266 compositor_deps_->GetGpuMemoryBufferManager();
241 params.settings = &settings; 267 params.settings = &settings;
242 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); 268 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner();
243 params.main_task_runner = 269 params.main_task_runner =
244 compositor_deps_->GetCompositorMainThreadTaskRunner(); 270 compositor_deps_->GetCompositorMainThreadTaskRunner();
245 params.animation_host = cc::AnimationHost::CreateMainInstance(); 271 params.animation_host = cc::AnimationHost::CreateMainInstance();
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 float device_scale) { 1151 float device_scale) {
1126 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); 1152 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale);
1127 } 1153 }
1128 1154
1129 void RenderWidgetCompositor::SetDeviceColorSpace( 1155 void RenderWidgetCompositor::SetDeviceColorSpace(
1130 const gfx::ColorSpace& color_space) { 1156 const gfx::ColorSpace& color_space) {
1131 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); 1157 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space);
1132 } 1158 }
1133 1159
1134 } // namespace content 1160 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698