Chromium Code Reviews| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 } | 171 } |
| 172 #elif defined(OS_CHROMEOS) | 172 #elif defined(OS_CHROMEOS) |
| 173 // Use 512 for high DPI (dsf=2.0f) devices. | 173 // Use 512 for high DPI (dsf=2.0f) devices. |
| 174 if (widget->screen_info().deviceScaleFactor >= 2.0f) | 174 if (widget->screen_info().deviceScaleFactor >= 2.0f) |
| 175 default_tile_size = 512; | 175 default_tile_size = 512; |
| 176 #endif | 176 #endif |
| 177 | 177 |
| 178 return gfx::Size(default_tile_size, default_tile_size); | 178 return gfx::Size(default_tile_size, default_tile_size); |
| 179 } | 179 } |
| 180 | 180 |
| 181 size_t GetMaxBytesPerCopyOperation() { | |
|
vmpstr
2015/06/01 18:35:52
Leave a comment here explaining the rationale for
vmpstr
2015/06/02 23:23:27
Can you also make this int?
reveman
2015/06/04 01:19:51
Done.
| |
| 182 const size_t kMegabyte = 1024 * 1024; | |
| 183 return kMegabyte * 4; | |
| 184 } | |
| 185 | |
| 181 // Check cc::TopControlsState, and blink::WebTopControlsState | 186 // Check cc::TopControlsState, and blink::WebTopControlsState |
| 182 // are kept in sync. | 187 // are kept in sync. |
| 183 static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH), | 188 static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH), |
| 184 "mismatching enums: BOTH"); | 189 "mismatching enums: BOTH"); |
| 185 static_assert(int(blink::WebTopControlsHidden) == int(cc::HIDDEN), | 190 static_assert(int(blink::WebTopControlsHidden) == int(cc::HIDDEN), |
| 186 "mismatching enums: HIDDEN"); | 191 "mismatching enums: HIDDEN"); |
| 187 static_assert(int(blink::WebTopControlsShown) == int(cc::SHOWN), | 192 static_assert(int(blink::WebTopControlsShown) == int(cc::SHOWN), |
| 188 "mismatching enums: SHOWN"); | 193 "mismatching enums: SHOWN"); |
| 189 | 194 |
| 190 static cc::TopControlsState ConvertTopControlsState( | 195 static cc::TopControlsState ConvertTopControlsState( |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 settings.create_low_res_tiling = false; | 456 settings.create_low_res_tiling = false; |
| 452 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) | 457 if (cmd->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) |
| 453 settings.use_external_begin_frame_source = true; | 458 settings.use_external_begin_frame_source = true; |
| 454 | 459 |
| 455 if (widget_->for_oopif()) { | 460 if (widget_->for_oopif()) { |
| 456 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. | 461 // TODO(simonhong): Apply BeginFrame scheduling for OOPIF. |
| 457 // See crbug.com/471411. | 462 // See crbug.com/471411. |
| 458 settings.use_external_begin_frame_source = false; | 463 settings.use_external_begin_frame_source = false; |
| 459 } | 464 } |
| 460 | 465 |
| 466 settings.max_bytes_per_copy_operation = GetMaxBytesPerCopyOperation(); | |
| 467 | |
| 461 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = | 468 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = |
| 462 compositor_deps_->GetCompositorImplThreadTaskRunner(); | 469 compositor_deps_->GetCompositorImplThreadTaskRunner(); |
| 463 scoped_refptr<base::SingleThreadTaskRunner> | 470 scoped_refptr<base::SingleThreadTaskRunner> |
| 464 main_thread_compositor_task_runner = | 471 main_thread_compositor_task_runner = |
| 465 compositor_deps_->GetCompositorMainThreadTaskRunner(); | 472 compositor_deps_->GetCompositorMainThreadTaskRunner(); |
| 466 cc::SharedBitmapManager* shared_bitmap_manager = | 473 cc::SharedBitmapManager* shared_bitmap_manager = |
| 467 compositor_deps_->GetSharedBitmapManager(); | 474 compositor_deps_->GetSharedBitmapManager(); |
| 468 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = | 475 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = |
| 469 compositor_deps_->GetGpuMemoryBufferManager(); | 476 compositor_deps_->GetGpuMemoryBufferManager(); |
| 470 cc::TaskGraphRunner* task_graph_runner = | 477 cc::TaskGraphRunner* task_graph_runner = |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 return; | 977 return; |
| 971 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 978 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 972 } | 979 } |
| 973 | 980 |
| 974 void RenderWidgetCompositor::SetSurfaceIdNamespace( | 981 void RenderWidgetCompositor::SetSurfaceIdNamespace( |
| 975 uint32_t surface_id_namespace) { | 982 uint32_t surface_id_namespace) { |
| 976 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); | 983 layer_tree_host_->set_surface_id_namespace(surface_id_namespace); |
| 977 } | 984 } |
| 978 | 985 |
| 979 } // namespace content | 986 } // namespace content |
| OLD | NEW |