| 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> |
| 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/layer_tree_host_remote.h" |
| 29 #include "cc/blimp/remote_compositor_bridge.h" |
| 28 #include "cc/blink/web_layer_impl.h" | 30 #include "cc/blink/web_layer_impl.h" |
| 29 #include "cc/debug/layer_tree_debug_state.h" | 31 #include "cc/debug/layer_tree_debug_state.h" |
| 30 #include "cc/debug/micro_benchmark.h" | 32 #include "cc/debug/micro_benchmark.h" |
| 31 #include "cc/input/layer_selection_bound.h" | 33 #include "cc/input/layer_selection_bound.h" |
| 32 #include "cc/layers/layer.h" | 34 #include "cc/layers/layer.h" |
| 33 #include "cc/output/begin_frame_args.h" | 35 #include "cc/output/begin_frame_args.h" |
| 34 #include "cc/output/copy_output_request.h" | 36 #include "cc/output/copy_output_request.h" |
| 35 #include "cc/output/copy_output_result.h" | 37 #include "cc/output/copy_output_result.h" |
| 36 #include "cc/output/latency_info_swap_promise.h" | 38 #include "cc/output/latency_info_swap_promise.h" |
| 37 #include "cc/output/swap_promise.h" | 39 #include "cc/output/swap_promise.h" |
| 38 #include "cc/proto/compositor_message.pb.h" | 40 #include "cc/proto/compositor_message.pb.h" |
| 39 #include "cc/resources/single_release_callback.h" | 41 #include "cc/resources/single_release_callback.h" |
| 40 #include "cc/scheduler/begin_frame_source.h" | 42 #include "cc/scheduler/begin_frame_source.h" |
| 41 #include "cc/trees/latency_info_swap_promise_monitor.h" | 43 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 42 #include "cc/trees/layer_tree_host_in_process.h" | 44 #include "cc/trees/layer_tree_host_in_process.h" |
| 43 #include "cc/trees/remote_proto_channel.h" | 45 #include "cc/trees/remote_proto_channel.h" |
| 44 #include "content/common/content_switches_internal.h" | 46 #include "content/common/content_switches_internal.h" |
| 45 #include "content/common/gpu/client/context_provider_command_buffer.h" | 47 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 46 #include "content/common/layer_tree_settings_factory.h" | 48 #include "content/common/layer_tree_settings_factory.h" |
| 47 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
| 48 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
| 51 #include "content/public/renderer/content_renderer_client.h" |
| 49 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 52 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
| 50 #include "content/renderer/input/input_handler_manager.h" | 53 #include "content/renderer/input/input_handler_manager.h" |
| 51 #include "gpu/command_buffer/client/gles2_interface.h" | 54 #include "gpu/command_buffer/client/gles2_interface.h" |
| 52 #include "gpu/command_buffer/service/gpu_switches.h" | 55 #include "gpu/command_buffer/service/gpu_switches.h" |
| 53 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 56 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
| 54 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" | 57 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" |
| 55 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" | 58 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" |
| 56 #include "third_party/WebKit/public/platform/WebSize.h" | 59 #include "third_party/WebKit/public/platform/WebSize.h" |
| 57 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 60 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 58 #include "third_party/WebKit/public/web/WebKit.h" | 61 #include "third_party/WebKit/public/web/WebKit.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), | 228 threaded_(!!compositor_deps_->GetCompositorImplThreadTaskRunner()), |
| 226 never_visible_(false), | 229 never_visible_(false), |
| 227 layout_and_paint_async_callback_(nullptr), | 230 layout_and_paint_async_callback_(nullptr), |
| 228 remote_proto_channel_receiver_(nullptr), | 231 remote_proto_channel_receiver_(nullptr), |
| 229 weak_factory_(this) {} | 232 weak_factory_(this) {} |
| 230 | 233 |
| 231 void RenderWidgetCompositor::Initialize(float device_scale_factor) { | 234 void RenderWidgetCompositor::Initialize(float device_scale_factor) { |
| 232 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 235 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 233 cc::LayerTreeSettings settings = | 236 cc::LayerTreeSettings settings = |
| 234 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor); | 237 GenerateLayerTreeSettings(*cmd, compositor_deps_, device_scale_factor); |
| 238 |
| 239 if (cmd->HasSwitch(switches::kUseRemoteCompositing) && |
| 240 cmd->HasSwitch(switches::kUseLayerTreeHostRemote)) { |
| 241 DCHECK(!threaded_); |
| 242 |
| 243 cc::LayerTreeHostRemote::InitParams params; |
| 244 params.client = this; |
| 245 params.main_task_runner = |
| 246 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
| 247 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| 248 params.remote_compositor_bridge = |
| 249 GetContentClient()->renderer()->CreateRemoteCompositorBridge( |
| 250 this, params.main_task_runner); |
| 251 params.settings = &settings; |
| 252 layer_tree_host_ = base::MakeUnique<cc::LayerTreeHostRemote>(¶ms); |
| 253 return; |
| 254 } |
| 255 |
| 235 cc::LayerTreeHostInProcess::InitParams params; | 256 cc::LayerTreeHostInProcess::InitParams params; |
| 236 params.client = this; | 257 params.client = this; |
| 237 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager(); | 258 params.shared_bitmap_manager = compositor_deps_->GetSharedBitmapManager(); |
| 238 params.gpu_memory_buffer_manager = | 259 params.gpu_memory_buffer_manager = |
| 239 compositor_deps_->GetGpuMemoryBufferManager(); | 260 compositor_deps_->GetGpuMemoryBufferManager(); |
| 240 params.settings = &settings; | 261 params.settings = &settings; |
| 241 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); | 262 params.task_graph_runner = compositor_deps_->GetTaskGraphRunner(); |
| 242 params.main_task_runner = | 263 params.main_task_runner = |
| 243 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 264 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
| 244 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 265 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 float device_scale) { | 1138 float device_scale) { |
| 1118 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1139 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
| 1119 } | 1140 } |
| 1120 | 1141 |
| 1121 void RenderWidgetCompositor::SetDeviceColorSpace( | 1142 void RenderWidgetCompositor::SetDeviceColorSpace( |
| 1122 const gfx::ColorSpace& color_space) { | 1143 const gfx::ColorSpace& color_space) { |
| 1123 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1144 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
| 1124 } | 1145 } |
| 1125 | 1146 |
| 1126 } // namespace content | 1147 } // namespace content |
| OLD | NEW |