| 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 26 matching lines...) Expand all Loading... |
| 37 #include "cc/proto/compositor_message.pb.h" | 37 #include "cc/proto/compositor_message.pb.h" |
| 38 #include "cc/resources/single_release_callback.h" | 38 #include "cc/resources/single_release_callback.h" |
| 39 #include "cc/scheduler/begin_frame_source.h" | 39 #include "cc/scheduler/begin_frame_source.h" |
| 40 #include "cc/trees/latency_info_swap_promise_monitor.h" | 40 #include "cc/trees/latency_info_swap_promise_monitor.h" |
| 41 #include "cc/trees/layer_tree_host.h" | 41 #include "cc/trees/layer_tree_host.h" |
| 42 #include "cc/trees/remote_proto_channel.h" | 42 #include "cc/trees/remote_proto_channel.h" |
| 43 #include "components/scheduler/renderer/renderer_scheduler.h" | 43 #include "components/scheduler/renderer/renderer_scheduler.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/input/input_event_utils.h" | 46 #include "content/common/input/input_event_utils.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/WebLayoutAndPaintAsyncCallback.h" | 54 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" |
| 54 #include "third_party/WebKit/public/platform/WebSize.h" | 55 #include "third_party/WebKit/public/platform/WebSize.h" |
| 55 #include "third_party/WebKit/public/web/WebKit.h" | 56 #include "third_party/WebKit/public/web/WebKit.h" |
| 56 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 57 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 57 #include "third_party/WebKit/public/web/WebSelection.h" | 58 #include "third_party/WebKit/public/web/WebSelection.h" |
| 58 #include "ui/gl/gl_switches.h" | 59 #include "ui/gl/gl_switches.h" |
| 59 #include "ui/native_theme/native_theme_switches.h" | 60 #include "ui/native_theme/native_theme_switches.h" |
| 60 | 61 |
| 61 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
| 62 #include "base/android/build_info.h" | 63 #include "base/android/build_info.h" |
| 63 #include "content/renderer/android/synchronous_compositor_factory.h" | |
| 64 #include "ui/gfx/android/device_display_info.h" | 64 #include "ui/gfx/android/device_display_info.h" |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 namespace base { | 67 namespace base { |
| 68 class Value; | 68 class Value; |
| 69 } | 69 } |
| 70 | 70 |
| 71 namespace cc { | 71 namespace cc { |
| 72 class Layer; | 72 class Layer; |
| 73 } | 73 } |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 const int kMaxSlowDownScaleFactor = INT_MAX; | 361 const int kMaxSlowDownScaleFactor = INT_MAX; |
| 362 GetSwitchValueAsInt( | 362 GetSwitchValueAsInt( |
| 363 *cmd, | 363 *cmd, |
| 364 cc::switches::kSlowDownRasterScaleFactor, | 364 cc::switches::kSlowDownRasterScaleFactor, |
| 365 kMinSlowDownScaleFactor, | 365 kMinSlowDownScaleFactor, |
| 366 kMaxSlowDownScaleFactor, | 366 kMaxSlowDownScaleFactor, |
| 367 &settings.initial_debug_state.slow_down_raster_scale_factor); | 367 &settings.initial_debug_state.slow_down_raster_scale_factor); |
| 368 } | 368 } |
| 369 | 369 |
| 370 #if defined(OS_ANDROID) | 370 #if defined(OS_ANDROID) |
| 371 DCHECK(!SynchronousCompositorFactory::GetInstance() || | |
| 372 !cmd->HasSwitch(switches::kIPCSyncCompositing)); | |
| 373 bool using_synchronous_compositor = | 371 bool using_synchronous_compositor = |
| 374 SynchronousCompositorFactory::GetInstance() || | 372 GetContentClient()->UsingSynchronousCompositing(); |
| 375 cmd->HasSwitch(switches::kIPCSyncCompositing); | |
| 376 | 373 |
| 377 // We can't use GPU rasterization on low-end devices, because the Ganesh | 374 // We can't use GPU rasterization on low-end devices, because the Ganesh |
| 378 // cache would consume too much memory. | 375 // cache would consume too much memory. |
| 379 if (base::SysInfo::IsLowEndDevice()) | 376 if (base::SysInfo::IsLowEndDevice()) |
| 380 settings.gpu_rasterization_enabled = false; | 377 settings.gpu_rasterization_enabled = false; |
| 381 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; | 378 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; |
| 382 if (using_synchronous_compositor) { | 379 if (using_synchronous_compositor) { |
| 383 // Android WebView uses system scrollbars, so make ours invisible. | 380 // Android WebView uses system scrollbars, so make ours invisible. |
| 384 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | 381 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; |
| 385 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | 382 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 #endif | 1127 #endif |
| 1131 return actual; | 1128 return actual; |
| 1132 } | 1129 } |
| 1133 | 1130 |
| 1134 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( | 1131 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( |
| 1135 float device_scale) { | 1132 float device_scale) { |
| 1136 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); | 1133 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); |
| 1137 } | 1134 } |
| 1138 | 1135 |
| 1139 } // namespace content | 1136 } // namespace content |
| OLD | NEW |