| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 223 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 224 // render_thread may be NULL in tests. | 224 // render_thread may be NULL in tests. |
| 225 if (render_thread) { | 225 if (render_thread) { |
| 226 settings.impl_side_painting = | 226 settings.impl_side_painting = |
| 227 render_thread->is_impl_side_painting_enabled(); | 227 render_thread->is_impl_side_painting_enabled(); |
| 228 settings.gpu_rasterization_forced = | 228 settings.gpu_rasterization_forced = |
| 229 render_thread->is_gpu_rasterization_forced(); | 229 render_thread->is_gpu_rasterization_forced(); |
| 230 settings.gpu_rasterization_enabled = | 230 settings.gpu_rasterization_enabled = |
| 231 render_thread->is_gpu_rasterization_enabled(); | 231 render_thread->is_gpu_rasterization_enabled(); |
| 232 settings.create_low_res_tiling = render_thread->is_low_res_tiling_enabled(); | |
| 233 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); | 232 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); |
| 234 settings.use_distance_field_text = | 233 settings.use_distance_field_text = |
| 235 render_thread->is_distance_field_text_enabled(); | 234 render_thread->is_distance_field_text_enabled(); |
| 236 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); | 235 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); |
| 237 settings.use_one_copy = render_thread->is_one_copy_enabled(); | 236 settings.use_one_copy = render_thread->is_one_copy_enabled(); |
| 238 } | 237 } |
| 239 | 238 |
| 240 if (cmd->HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) { | 239 if (cmd->HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) { |
| 241 settings.recording_mode = cc::LayerTreeSettings::RecordWithSkRecord; | 240 settings.recording_mode = cc::LayerTreeSettings::RecordWithSkRecord; |
| 242 } | 241 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } else { | 384 } else { |
| 386 // On other devices we have increased memory excessively to avoid | 385 // On other devices we have increased memory excessively to avoid |
| 387 // raster-on-demand already, so now we reserve 50% _only_ to avoid | 386 // raster-on-demand already, so now we reserve 50% _only_ to avoid |
| 388 // raster-on-demand, and use 50% of the memory otherwise. | 387 // raster-on-demand, and use 50% of the memory otherwise. |
| 389 settings.max_memory_for_prepaint_percentage = 50; | 388 settings.max_memory_for_prepaint_percentage = 50; |
| 390 } | 389 } |
| 391 // Webview does not own the surface so should not clear it. | 390 // Webview does not own the surface so should not clear it. |
| 392 settings.should_clear_root_render_pass = | 391 settings.should_clear_root_render_pass = |
| 393 !synchronous_compositor_factory; | 392 !synchronous_compositor_factory; |
| 394 | 393 |
| 394 // TODO(danakj): Only do this on low end devices. |
| 395 settings.create_low_res_tiling = true; |
| 396 |
| 395 #elif !defined(OS_MACOSX) | 397 #elif !defined(OS_MACOSX) |
| 396 if (ui::IsOverlayScrollbarEnabled()) { | 398 if (ui::IsOverlayScrollbarEnabled()) { |
| 397 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; | 399 settings.scrollbar_animator = cc::LayerTreeSettings::Thinning; |
| 398 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 400 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 399 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { | 401 } else if (cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport)) { |
| 400 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay | 402 // use_pinch_zoom_scrollbars is only true on desktop when non-overlay |
| 401 // scrollbars are in use. | 403 // scrollbars are in use. |
| 402 settings.use_pinch_zoom_scrollbars = true; | 404 settings.use_pinch_zoom_scrollbars = true; |
| 403 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; | 405 settings.scrollbar_animator = cc::LayerTreeSettings::LinearFade; |
| 404 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 406 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 405 } | 407 } |
| 406 settings.scrollbar_fade_delay_ms = 500; | 408 settings.scrollbar_fade_delay_ms = 500; |
| 407 settings.scrollbar_fade_duration_ms = 300; | 409 settings.scrollbar_fade_duration_ms = 300; |
| 408 #endif | 410 #endif |
| 409 | 411 |
| 412 if (cmd->HasSwitch(switches::kEnableLowResTiling)) |
| 413 settings.create_low_res_tiling = true; |
| 414 if (cmd->HasSwitch(switches::kDisableLowResTiling)) |
| 415 settings.create_low_res_tiling = false; |
| 416 |
| 410 compositor->Initialize(settings); | 417 compositor->Initialize(settings); |
| 411 | 418 |
| 412 return compositor.Pass(); | 419 return compositor.Pass(); |
| 413 } | 420 } |
| 414 | 421 |
| 415 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, | 422 RenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, |
| 416 bool threaded) | 423 bool threaded) |
| 417 : threaded_(threaded), | 424 : threaded_(threaded), |
| 418 widget_(widget), | 425 widget_(widget), |
| 419 send_v8_idle_notification_after_commit_(false) { | 426 send_v8_idle_notification_after_commit_(false) { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 widget_->OnSwapBuffersAborted(); | 840 widget_->OnSwapBuffersAborted(); |
| 834 } | 841 } |
| 835 | 842 |
| 836 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 843 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 837 cc::ContextProvider* provider = | 844 cc::ContextProvider* provider = |
| 838 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 845 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 839 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 846 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 840 } | 847 } |
| 841 | 848 |
| 842 } // namespace content | 849 } // namespace content |
| OLD | NEW |