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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); | 142 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); |
143 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { | 143 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { |
144 std::string controls_height_str = | 144 std::string controls_height_str = |
145 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); | 145 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); |
146 double controls_height; | 146 double controls_height; |
147 if (base::StringToDouble(controls_height_str, &controls_height) && | 147 if (base::StringToDouble(controls_height_str, &controls_height) && |
148 controls_height > 0) | 148 controls_height > 0) |
149 settings.top_controls_height = controls_height; | 149 settings.top_controls_height = controls_height; |
150 } | 150 } |
151 | 151 |
152 settings.compositor_frame_message = | |
153 cmd->HasSwitch(cc::switches::kEnableCompositorFrameMessage) || | |
154 cmd->HasSwitch(cc::switches::kCompositeToMailbox) || | |
155 cmd->HasSwitch(switches::kEnableSoftwareCompositingGLAdapter); | |
156 | |
157 if (settings.calculate_top_controls_position && | 152 if (settings.calculate_top_controls_position && |
158 (settings.top_controls_height <= 0 || | 153 settings.top_controls_height <= 0) { |
159 !settings.compositor_frame_message)) { | 154 DCHECK(false) |
160 DCHECK(false) << "Top controls repositioning enabled without valid height " | 155 << "Top controls repositioning enabled without valid height set."; |
161 "or compositor_frame_message set."; | |
162 settings.calculate_top_controls_position = false; | 156 settings.calculate_top_controls_position = false; |
163 } | 157 } |
164 | 158 |
165 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { | 159 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { |
166 std::string top_threshold_str = | 160 std::string top_threshold_str = |
167 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); | 161 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); |
168 double show_threshold; | 162 double show_threshold; |
169 if (base::StringToDouble(top_threshold_str, &show_threshold) && | 163 if (base::StringToDouble(top_threshold_str, &show_threshold) && |
170 show_threshold >= 0.f && show_threshold <= 1.f) | 164 show_threshold >= 0.f && show_threshold <= 1.f) |
171 settings.top_controls_show_threshold = show_threshold; | 165 settings.top_controls_show_threshold = show_threshold; |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); | 563 return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
570 } | 564 } |
571 | 565 |
572 scoped_refptr<cc::ContextProvider> | 566 scoped_refptr<cc::ContextProvider> |
573 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { | 567 RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { |
574 return RenderThreadImpl::current()-> | 568 return RenderThreadImpl::current()-> |
575 OffscreenContextProviderForCompositorThread(); | 569 OffscreenContextProviderForCompositorThread(); |
576 } | 570 } |
577 | 571 |
578 } // namespace content | 572 } // namespace content |
OLD | NEW |