| 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 23 matching lines...) Expand all Loading... |
| 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.h" |
| 43 #include "cc/trees/remote_proto_channel.h" | 43 #include "cc/trees/remote_proto_channel.h" |
| 44 #include "content/common/compositor_util.h" |
| 44 #include "content/common/content_switches_internal.h" | 45 #include "content/common/content_switches_internal.h" |
| 45 #include "content/common/gpu/client/context_provider_command_buffer.h" | 46 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 46 #include "content/public/common/content_client.h" | 47 #include "content/public/common/content_client.h" |
| 47 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
| 48 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 49 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
| 49 #include "content/renderer/input/input_handler_manager.h" | 50 #include "content/renderer/input/input_handler_manager.h" |
| 50 #include "gpu/command_buffer/client/gles2_interface.h" | 51 #include "gpu/command_buffer/client/gles2_interface.h" |
| 51 #include "gpu/command_buffer/service/gpu_switches.h" | 52 #include "gpu/command_buffer/service/gpu_switches.h" |
| 52 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | 53 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" |
| 53 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" | 54 #include "third_party/WebKit/public/platform/WebCompositorMutatorClient.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 settings.use_partial_raster = compositor_deps->IsPartialRasterEnabled(); | 338 settings.use_partial_raster = compositor_deps->IsPartialRasterEnabled(); |
| 338 settings.enable_elastic_overscroll = | 339 settings.enable_elastic_overscroll = |
| 339 compositor_deps->IsElasticOverscrollEnabled(); | 340 compositor_deps->IsElasticOverscrollEnabled(); |
| 340 settings.renderer_settings.use_gpu_memory_buffer_resources = | 341 settings.renderer_settings.use_gpu_memory_buffer_resources = |
| 341 compositor_deps->IsGpuMemoryBufferCompositorResourcesEnabled(); | 342 compositor_deps->IsGpuMemoryBufferCompositorResourcesEnabled(); |
| 342 settings.renderer_settings.buffer_to_texture_target_map = | 343 settings.renderer_settings.buffer_to_texture_target_map = |
| 343 compositor_deps->GetBufferToTextureTargetMap(); | 344 compositor_deps->GetBufferToTextureTargetMap(); |
| 344 settings.image_decode_tasks_enabled = | 345 settings.image_decode_tasks_enabled = |
| 345 compositor_deps->AreImageDecodeTasksEnabled(); | 346 compositor_deps->AreImageDecodeTasksEnabled(); |
| 346 | 347 |
| 347 if (cmd.HasSwitch(cc::switches::kTopControlsShowThreshold)) { | 348 // Build LayerTreeSettings from command line args. |
| 348 std::string top_threshold_str = | 349 CompositorUtil::SetTopControlsSettings(settings, cmd); |
| 349 cmd.GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); | |
| 350 double show_threshold; | |
| 351 if (base::StringToDouble(top_threshold_str, &show_threshold) && | |
| 352 show_threshold >= 0.f && show_threshold <= 1.f) | |
| 353 settings.top_controls_show_threshold = show_threshold; | |
| 354 } | |
| 355 | |
| 356 if (cmd.HasSwitch(cc::switches::kTopControlsHideThreshold)) { | |
| 357 std::string top_threshold_str = | |
| 358 cmd.GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); | |
| 359 double hide_threshold; | |
| 360 if (base::StringToDouble(top_threshold_str, &hide_threshold) && | |
| 361 hide_threshold >= 0.f && hide_threshold <= 1.f) | |
| 362 settings.top_controls_hide_threshold = hide_threshold; | |
| 363 } | |
| 364 | 350 |
| 365 settings.use_layer_lists = cmd.HasSwitch(cc::switches::kEnableLayerLists); | 351 settings.use_layer_lists = cmd.HasSwitch(cc::switches::kEnableLayerLists); |
| 366 | 352 |
| 367 settings.renderer_settings.allow_antialiasing &= | 353 settings.renderer_settings.allow_antialiasing &= |
| 368 !cmd.HasSwitch(cc::switches::kDisableCompositedAntialiasing); | 354 !cmd.HasSwitch(cc::switches::kDisableCompositedAntialiasing); |
| 369 // The means the renderer compositor has 2 possible modes: | 355 // The means the renderer compositor has 2 possible modes: |
| 370 // - Threaded compositing with a scheduler. | 356 // - Threaded compositing with a scheduler. |
| 371 // - Single threaded compositing without a scheduler (for layout tests only). | 357 // - Single threaded compositing without a scheduler (for layout tests only). |
| 372 // Using the scheduler in layout tests introduces additional composite steps | 358 // Using the scheduler in layout tests introduces additional composite steps |
| 373 // that create flakiness. | 359 // that create flakiness. |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 | 1138 |
| 1153 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); | 1139 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); |
| 1154 } | 1140 } |
| 1155 | 1141 |
| 1156 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1142 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
| 1157 float device_scale) { | 1143 float device_scale) { |
| 1158 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1144 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
| 1159 } | 1145 } |
| 1160 | 1146 |
| 1161 } // namespace content | 1147 } // namespace content |
| OLD | NEW |