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 <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" | 43 #include "third_party/WebKit/public/platform/WebLayoutAndPaintAsyncCallback.h" |
44 #include "third_party/WebKit/public/platform/WebSize.h" | 44 #include "third_party/WebKit/public/platform/WebSize.h" |
45 #include "third_party/WebKit/public/web/WebKit.h" | 45 #include "third_party/WebKit/public/web/WebKit.h" |
46 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 46 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
47 #include "third_party/WebKit/public/web/WebSelection.h" | 47 #include "third_party/WebKit/public/web/WebSelection.h" |
48 #include "third_party/WebKit/public/web/WebWidget.h" | 48 #include "third_party/WebKit/public/web/WebWidget.h" |
49 #include "ui/gl/gl_switches.h" | 49 #include "ui/gl/gl_switches.h" |
50 #include "ui/native_theme/native_theme_switches.h" | 50 #include "ui/native_theme/native_theme_switches.h" |
51 | 51 |
52 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
| 53 #include "base/android/build_info.h" |
53 #include "content/renderer/android/synchronous_compositor_factory.h" | 54 #include "content/renderer/android/synchronous_compositor_factory.h" |
54 #include "ui/gfx/android/device_display_info.h" | 55 #include "ui/gfx/android/device_display_info.h" |
55 #endif | 56 #endif |
56 | 57 |
57 namespace base { | 58 namespace base { |
58 class Value; | 59 class Value; |
59 } | 60 } |
60 | 61 |
61 namespace cc { | 62 namespace cc { |
62 class Layer; | 63 class Layer; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 } | 172 } |
172 #elif defined(OS_CHROMEOS) | 173 #elif defined(OS_CHROMEOS) |
173 // Use 512 for high DPI (dsf=2.0f) devices. | 174 // Use 512 for high DPI (dsf=2.0f) devices. |
174 if (widget->screen_info().deviceScaleFactor >= 2.0f) | 175 if (widget->screen_info().deviceScaleFactor >= 2.0f) |
175 default_tile_size = 512; | 176 default_tile_size = 512; |
176 #endif | 177 #endif |
177 | 178 |
178 return gfx::Size(default_tile_size, default_tile_size); | 179 return gfx::Size(default_tile_size, default_tile_size); |
179 } | 180 } |
180 | 181 |
181 int GetMaxBytesPerCopyOperation() { | |
182 const int kMegabyte = 1024 * 1024; | |
183 | |
184 // 4MiB is the size of 4 512x512 tiles, which has proven to be a good | |
185 // default batch size for copy operations. | |
186 return kMegabyte * 4; | |
187 } | |
188 | |
189 // Check cc::TopControlsState, and blink::WebTopControlsState | 182 // Check cc::TopControlsState, and blink::WebTopControlsState |
190 // are kept in sync. | 183 // are kept in sync. |
191 static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH), | 184 static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH), |
192 "mismatching enums: BOTH"); | 185 "mismatching enums: BOTH"); |
193 static_assert(int(blink::WebTopControlsHidden) == int(cc::HIDDEN), | 186 static_assert(int(blink::WebTopControlsHidden) == int(cc::HIDDEN), |
194 "mismatching enums: HIDDEN"); | 187 "mismatching enums: HIDDEN"); |
195 static_assert(int(blink::WebTopControlsShown) == int(cc::SHOWN), | 188 static_assert(int(blink::WebTopControlsShown) == int(cc::SHOWN), |
196 "mismatching enums: SHOWN"); | 189 "mismatching enums: SHOWN"); |
197 | 190 |
198 static cc::TopControlsState ConvertTopControlsState( | 191 static cc::TopControlsState ConvertTopControlsState( |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 settings.create_low_res_tiling = false; | 453 settings.create_low_res_tiling = false; |
461 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 454 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
462 settings.use_external_begin_frame_source = true; | 455 settings.use_external_begin_frame_source = true; |
463 | 456 |
464 if (widget_->for_oopif()) { | 457 if (widget_->for_oopif()) { |
465 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 458 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
466 // See crbug.com/471411. | 459 // See crbug.com/471411. |
467 settings.use_external_begin_frame_source = false; | 460 settings.use_external_begin_frame_source = false; |
468 } | 461 } |
469 | 462 |
470 settings.max_bytes_per_copy_operation = GetMaxBytesPerCopyOperation(); | |
471 | |
472 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = | 463 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = |
473 compositor_deps_->GetCompositorImplThreadTaskRunner(); | 464 compositor_deps_->GetCompositorImplThreadTaskRunner(); |
474 scoped_refptr<base::SingleThreadTaskRunner> | 465 scoped_refptr<base::SingleThreadTaskRunner> |
475 main_thread_compositor_task_runner = | 466 main_thread_compositor_task_runner = |
476 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 467 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
477 cc::SharedBitmapManager* shared_bitmap_manager = | 468 cc::SharedBitmapManager* shared_bitmap_manager = |
478 compositor_deps_->GetSharedBitmapManager(); | 469 compositor_deps_->GetSharedBitmapManager(); |
479 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = | 470 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = |
480 compositor_deps_->GetGpuMemoryBufferManager(); | 471 compositor_deps_->GetGpuMemoryBufferManager(); |
481 cc::TaskGraphRunner* task_graph_runner = | 472 cc::TaskGraphRunner* task_graph_runner = |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 return; | 1001 return; |
1011 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 1002 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
1012 } | 1003 } |
1013 | 1004 |
1014 void RenderWidgetCompositor::SetSurfaceIdNamespace( | 1005 void RenderWidgetCompositor::SetSurfaceIdNamespace( |
1015 uint32_t surface_id_namespace) { | 1006 uint32_t surface_id_namespace) { |
1016 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); | 1007 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); |
1017 } | 1008 } |
1018 | 1009 |
1019 } // namespace content | 1010 } // namespace content |
OLD | NEW |