| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); | 233 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); |
| 234 settings.use_distance_field_text = | 234 settings.use_distance_field_text = |
| 235 render_thread->is_distance_field_text_enabled(); | 235 render_thread->is_distance_field_text_enabled(); |
| 236 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); | 236 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); |
| 237 settings.use_one_copy = render_thread->is_one_copy_enabled(); | 237 settings.use_one_copy = render_thread->is_one_copy_enabled(); |
| 238 settings.use_image_external = render_thread->use_image_external(); | 238 settings.use_image_external = render_thread->use_image_external(); |
| 239 } | 239 } |
| 240 | 240 |
| 241 settings.calculate_top_controls_position = | 241 settings.calculate_top_controls_position = |
| 242 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); | 242 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); |
| 243 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { | |
| 244 std::string controls_height_str = | |
| 245 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); | |
| 246 double controls_height; | |
| 247 if (base::StringToDouble(controls_height_str, &controls_height) && | |
| 248 controls_height > 0) | |
| 249 settings.top_controls_height = controls_height; | |
| 250 } | |
| 251 | |
| 252 if (settings.calculate_top_controls_position && | |
| 253 settings.top_controls_height <= 0) { | |
| 254 DCHECK(false) | |
| 255 << "Top controls repositioning enabled without valid height set."; | |
| 256 settings.calculate_top_controls_position = false; | |
| 257 } | |
| 258 | |
| 259 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { | 243 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { |
| 260 std::string top_threshold_str = | 244 std::string top_threshold_str = |
| 261 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); | 245 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); |
| 262 double show_threshold; | 246 double show_threshold; |
| 263 if (base::StringToDouble(top_threshold_str, &show_threshold) && | 247 if (base::StringToDouble(top_threshold_str, &show_threshold) && |
| 264 show_threshold >= 0.f && show_threshold <= 1.f) | 248 show_threshold >= 0.f && show_threshold <= 1.f) |
| 265 settings.top_controls_show_threshold = show_threshold; | 249 settings.top_controls_show_threshold = show_threshold; |
| 266 } | 250 } |
| 267 | 251 |
| 268 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { | 252 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 439 |
| 456 void RenderWidgetCompositor::UpdateTopControlsState( | 440 void RenderWidgetCompositor::UpdateTopControlsState( |
| 457 cc::TopControlsState constraints, | 441 cc::TopControlsState constraints, |
| 458 cc::TopControlsState current, | 442 cc::TopControlsState current, |
| 459 bool animate) { | 443 bool animate) { |
| 460 layer_tree_host_->UpdateTopControlsState(constraints, | 444 layer_tree_host_->UpdateTopControlsState(constraints, |
| 461 current, | 445 current, |
| 462 animate); | 446 animate); |
| 463 } | 447 } |
| 464 | 448 |
| 465 void RenderWidgetCompositor::SetTopControlsLayoutHeight(float height) { | 449 void RenderWidgetCompositor::SetTopControlsShrinkBlinkSize(bool shrink) { |
| 466 layer_tree_host_->SetTopControlsLayoutHeight(height); | 450 layer_tree_host_->SetTopControlsShrinkBlinkSize(shrink); |
| 451 } |
| 452 |
| 453 void RenderWidgetCompositor::SetTopControlsHeight(float height) { |
| 454 layer_tree_host_->SetTopControlsHeight(height); |
| 467 } | 455 } |
| 468 | 456 |
| 469 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { | 457 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { |
| 470 layer_tree_host_->SetNeedsRedrawRect(damage_rect); | 458 layer_tree_host_->SetNeedsRedrawRect(damage_rect); |
| 471 } | 459 } |
| 472 | 460 |
| 473 void RenderWidgetCompositor::SetNeedsForcedRedraw() { | 461 void RenderWidgetCompositor::SetNeedsForcedRedraw() { |
| 474 layer_tree_host_->SetNextCommitForcesRedraw(); | 462 layer_tree_host_->SetNextCommitForcesRedraw(); |
| 475 setNeedsAnimate(); | 463 setNeedsAnimate(); |
| 476 } | 464 } |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 widget_->OnSwapBuffersAborted(); | 892 widget_->OnSwapBuffersAborted(); |
| 905 } | 893 } |
| 906 | 894 |
| 907 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 895 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
| 908 cc::ContextProvider* provider = | 896 cc::ContextProvider* provider = |
| 909 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 897 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 910 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); | 898 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); |
| 911 } | 899 } |
| 912 | 900 |
| 913 } // namespace content | 901 } // namespace content |
| OLD | NEW |