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 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 87 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 88 | 88 |
| 89 cc::LayerTreeSettings settings; | 89 cc::LayerTreeSettings settings; |
| 90 | 90 |
| 91 // For web contents, layer transforms should scale up the contents of layers | 91 // For web contents, layer transforms should scale up the contents of layers |
| 92 // to keep content always crisp when possible. | 92 // to keep content always crisp when possible. |
| 93 settings.layer_transforms_should_scale_layer_contents = true; | 93 settings.layer_transforms_should_scale_layer_contents = true; |
| 94 | 94 |
| 95 settings.accelerate_painting = | 95 settings.accelerate_painting = |
| 96 cmd->HasSwitch(switches::kEnableAcceleratedPainting); | 96 cmd->HasSwitch(switches::kEnableAcceleratedPainting); |
| 97 settings.render_vsync_enabled = !cmd->HasSwitch(switches::kDisableGpuVsync); | 97 settings.throttle_frame_production = |
| 98 settings.render_vsync_notification_enabled = | 98 !cmd->HasSwitch(switches::kDisableGpuVsync); |
| 99 settings.render_parent_drives_begin_impl_frame_ = | |
| 99 cmd->HasSwitch(switches::kEnableVsyncNotification); | 100 cmd->HasSwitch(switches::kEnableVsyncNotification); |
| 100 settings.synchronously_disable_vsync = widget->SynchronouslyDisableVSync(); | 101 settings.using_synchronous_renderer_compositor = |
| 102 widget->UsingSynchronousRendererCompositor(); | |
| 101 settings.per_tile_painting_enabled = | 103 settings.per_tile_painting_enabled = |
| 102 cmd->HasSwitch(cc::switches::kEnablePerTilePainting); | 104 cmd->HasSwitch(cc::switches::kEnablePerTilePainting); |
| 103 settings.accelerated_animation_enabled = | 105 settings.accelerated_animation_enabled = |
| 104 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); | 106 !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); |
| 105 | 107 |
| 106 int default_tile_width = settings.default_tile_size.width(); | 108 int default_tile_width = settings.default_tile_size.width(); |
| 107 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { | 109 if (cmd->HasSwitch(switches::kDefaultTileWidth)) { |
| 108 GetSwitchValueAsInt(*cmd, switches::kDefaultTileWidth, 1, | 110 GetSwitchValueAsInt(*cmd, switches::kDefaultTileWidth, 1, |
| 109 std::numeric_limits<int>::max(), &default_tile_width); | 111 std::numeric_limits<int>::max(), &default_tile_width); |
| 110 } | 112 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 debug_state.show_debug_borders = show; | 497 debug_state.show_debug_borders = show; |
| 496 layer_tree_host_->SetDebugState(debug_state); | 498 layer_tree_host_->SetDebugState(debug_state); |
| 497 } | 499 } |
| 498 | 500 |
| 499 void RenderWidgetCompositor::setContinuousPaintingEnabled(bool enabled) { | 501 void RenderWidgetCompositor::setContinuousPaintingEnabled(bool enabled) { |
| 500 cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); | 502 cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); |
| 501 debug_state.continuous_painting = enabled; | 503 debug_state.continuous_painting = enabled; |
| 502 layer_tree_host_->SetDebugState(debug_state); | 504 layer_tree_host_->SetDebugState(debug_state); |
| 503 } | 505 } |
| 504 | 506 |
| 505 void RenderWidgetCompositor::WillBeginFrame() { | 507 void RenderWidgetCompositor::WillBeginMainFrame() { |
| 506 widget_->InstrumentWillBeginFrame(); | 508 widget_->InstrumentWillBeginFrame(); |
| 507 widget_->willBeginCompositorFrame(); | 509 widget_->willBeginCompositorFrame(); |
|
jamesr
2013/05/16 21:23:40
WillBeginMainFrame() is now inconsistent with the
| |
| 508 } | 510 } |
| 509 | 511 |
| 510 void RenderWidgetCompositor::DidBeginFrame() { | 512 void RenderWidgetCompositor::DidBeginMainFrame() { |
| 511 widget_->InstrumentDidBeginFrame(); | 513 widget_->InstrumentDidBeginFrame(); |
| 512 } | 514 } |
| 513 | 515 |
| 514 void RenderWidgetCompositor::Animate(double frame_begin_time) { | 516 void RenderWidgetCompositor::Animate(double frame_begin_time) { |
| 515 widget_->webwidget()->animate(frame_begin_time); | 517 widget_->webwidget()->animate(frame_begin_time); |
| 516 } | 518 } |
| 517 | 519 |
| 518 void RenderWidgetCompositor::Layout() { | 520 void RenderWidgetCompositor::Layout() { |
| 519 widget_->webwidget()->layout(); | 521 widget_->webwidget()->layout(); |
| 520 } | 522 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 572 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 571 } | 573 } |
| 572 | 574 |
| 573 scoped_refptr<cc::ContextProvider> | 575 scoped_refptr<cc::ContextProvider> |
| 574 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 576 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
| 575 return RenderThreadImpl::current()-> | 577 return RenderThreadImpl::current()-> |
| 576 OffscreenContextProviderForCompositorThread(); | 578 OffscreenContextProviderForCompositorThread(); |
| 577 } | 579 } |
| 578 | 580 |
| 579 } // namespace content | 581 } // namespace content |
| OLD | NEW |