Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2443613002: Rename classes related to top controls (Closed)
Patch Set: fix test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 namespace cc { 74 namespace cc {
75 class Layer; 75 class Layer;
76 } 76 }
77 77
78 using blink::WebFloatPoint; 78 using blink::WebFloatPoint;
79 using blink::WebRect; 79 using blink::WebRect;
80 using blink::WebSelection; 80 using blink::WebSelection;
81 using blink::WebSize; 81 using blink::WebSize;
82 using blink::WebTopControlsState; 82 using blink::WebBrowserControlsState;
83 83
84 namespace content { 84 namespace content {
85 namespace { 85 namespace {
86 86
87 bool GetSwitchValueAsInt(const base::CommandLine& command_line, 87 bool GetSwitchValueAsInt(const base::CommandLine& command_line,
88 const std::string& switch_string, 88 const std::string& switch_string,
89 int min_value, 89 int min_value,
90 int max_value, 90 int max_value,
91 int* result) { 91 int* result) {
92 std::string string_value = command_line.GetSwitchValueASCII(switch_string); 92 std::string string_value = command_line.GetSwitchValueASCII(switch_string);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 #elif defined(OS_CHROMEOS) || defined(OS_MACOSX) 184 #elif defined(OS_CHROMEOS) || defined(OS_MACOSX)
185 // Use 512 for high DPI (dsf=2.0f) devices. 185 // Use 512 for high DPI (dsf=2.0f) devices.
186 if (initial_device_scale_factor >= 2.0f) 186 if (initial_device_scale_factor >= 2.0f)
187 default_tile_size = 512; 187 default_tile_size = 512;
188 #endif 188 #endif
189 189
190 return gfx::Size(default_tile_size, default_tile_size); 190 return gfx::Size(default_tile_size, default_tile_size);
191 } 191 }
192 192
193 // Check cc::TopControlsState, and blink::WebTopControlsState 193 // Check cc::BrowserControlsState, and blink::WebBrowserControlsState
194 // are kept in sync. 194 // are kept in sync.
195 static_assert(int(blink::WebTopControlsBoth) == int(cc::BOTH), 195 static_assert(int(blink::WebBrowserControlsBoth) == int(cc::BOTH),
196 "mismatching enums: BOTH"); 196 "mismatching enums: BOTH");
197 static_assert(int(blink::WebTopControlsHidden) == int(cc::HIDDEN), 197 static_assert(int(blink::WebBrowserControlsHidden) == int(cc::HIDDEN),
198 "mismatching enums: HIDDEN"); 198 "mismatching enums: HIDDEN");
199 static_assert(int(blink::WebTopControlsShown) == int(cc::SHOWN), 199 static_assert(int(blink::WebBrowserControlsShown) == int(cc::SHOWN),
200 "mismatching enums: SHOWN"); 200 "mismatching enums: SHOWN");
201 201
202 static cc::TopControlsState ConvertTopControlsState( 202 static cc::BrowserControlsState ConvertBrowserControlsState(
203 WebTopControlsState state) { 203 WebBrowserControlsState state) {
204 return static_cast<cc::TopControlsState>(state); 204 return static_cast<cc::BrowserControlsState>(state);
205 } 205 }
206 206
207 } // namespace 207 } // namespace
208 208
209 // static 209 // static
210 std::unique_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create( 210 std::unique_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create(
211 RenderWidgetCompositorDelegate* delegate, 211 RenderWidgetCompositorDelegate* delegate,
212 float device_scale_factor, 212 float device_scale_factor,
213 CompositorDependencies* compositor_deps) { 213 CompositorDependencies* compositor_deps) {
214 std::unique_ptr<RenderWidgetCompositor> compositor( 214 std::unique_ptr<RenderWidgetCompositor> compositor(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 settings.renderer_settings.use_gpu_memory_buffer_resources = 328 settings.renderer_settings.use_gpu_memory_buffer_resources =
329 compositor_deps->IsGpuMemoryBufferCompositorResourcesEnabled(); 329 compositor_deps->IsGpuMemoryBufferCompositorResourcesEnabled();
330 settings.enable_color_correct_rendering = 330 settings.enable_color_correct_rendering =
331 cmd.HasSwitch(cc::switches::kEnableColorCorrectRendering); 331 cmd.HasSwitch(cc::switches::kEnableColorCorrectRendering);
332 settings.renderer_settings.buffer_to_texture_target_map = 332 settings.renderer_settings.buffer_to_texture_target_map =
333 compositor_deps->GetBufferToTextureTargetMap(); 333 compositor_deps->GetBufferToTextureTargetMap();
334 settings.image_decode_tasks_enabled = 334 settings.image_decode_tasks_enabled =
335 compositor_deps->AreImageDecodeTasksEnabled(); 335 compositor_deps->AreImageDecodeTasksEnabled();
336 336
337 // Build LayerTreeSettings from command line args. 337 // Build LayerTreeSettings from command line args.
338 LayerTreeSettingsFactory::SetTopControlsSettings(settings, cmd); 338 LayerTreeSettingsFactory::SetBrowserControlsSettings(settings, cmd);
339 339
340 settings.use_layer_lists = cmd.HasSwitch(cc::switches::kEnableLayerLists); 340 settings.use_layer_lists = cmd.HasSwitch(cc::switches::kEnableLayerLists);
341 341
342 settings.renderer_settings.allow_antialiasing &= 342 settings.renderer_settings.allow_antialiasing &=
343 !cmd.HasSwitch(cc::switches::kDisableCompositedAntialiasing); 343 !cmd.HasSwitch(cc::switches::kDisableCompositedAntialiasing);
344 // The means the renderer compositor has 2 possible modes: 344 // The means the renderer compositor has 2 possible modes:
345 // - Threaded compositing with a scheduler. 345 // - Threaded compositing with a scheduler.
346 // - Single threaded compositing without a scheduler (for layout tests only). 346 // - Single threaded compositing without a scheduler (for layout tests only).
347 // Using the scheduler in layout tests introduces additional composite steps 347 // Using the scheduler in layout tests introduces additional composite steps
348 // that create flakiness. 348 // that create flakiness.
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 958 }
959 959
960 void RenderWidgetCompositor::setShowScrollBottleneckRects(bool show) { 960 void RenderWidgetCompositor::setShowScrollBottleneckRects(bool show) {
961 cc::LayerTreeDebugState debug_state = layer_tree_host_->GetDebugState(); 961 cc::LayerTreeDebugState debug_state = layer_tree_host_->GetDebugState();
962 debug_state.show_touch_event_handler_rects = show; 962 debug_state.show_touch_event_handler_rects = show;
963 debug_state.show_wheel_event_handler_rects = show; 963 debug_state.show_wheel_event_handler_rects = show;
964 debug_state.show_non_fast_scrollable_rects = show; 964 debug_state.show_non_fast_scrollable_rects = show;
965 layer_tree_host_->SetDebugState(debug_state); 965 layer_tree_host_->SetDebugState(debug_state);
966 } 966 }
967 967
968 void RenderWidgetCompositor::updateTopControlsState( 968 void RenderWidgetCompositor::updateBrowserControlsState(
969 WebTopControlsState constraints, 969 WebBrowserControlsState constraints,
970 WebTopControlsState current, 970 WebBrowserControlsState current,
971 bool animate) { 971 bool animate) {
972 layer_tree_host_->UpdateTopControlsState(ConvertTopControlsState(constraints), 972 layer_tree_host_->UpdateBrowserControlsState(
973 ConvertTopControlsState(current), 973 ConvertBrowserControlsState(constraints),
974 animate); 974 ConvertBrowserControlsState(current), animate);
975 } 975 }
976 976
977 void RenderWidgetCompositor::setTopControlsHeight(float height, bool shrink) { 977 void RenderWidgetCompositor::setBrowserControlsHeight(float height,
978 layer_tree_host_->GetLayerTree()->SetTopControlsHeight(height, shrink); 978 bool shrink) {
979 layer_tree_host_->GetLayerTree()->SetBrowserControlsHeight(height, shrink);
979 } 980 }
980 981
981 void RenderWidgetCompositor::setTopControlsShownRatio(float ratio) { 982 void RenderWidgetCompositor::setBrowserControlsShownRatio(float ratio) {
982 layer_tree_host_->GetLayerTree()->SetTopControlsShownRatio(ratio); 983 layer_tree_host_->GetLayerTree()->SetBrowserControlsShownRatio(ratio);
983 } 984 }
984 985
985 void RenderWidgetCompositor::setBottomControlsHeight(float height) { 986 void RenderWidgetCompositor::setBottomControlsHeight(float height) {
986 layer_tree_host_->GetLayerTree()->SetBottomControlsHeight(height); 987 layer_tree_host_->GetLayerTree()->SetBottomControlsHeight(height);
987 } 988 }
988 989
989 void RenderWidgetCompositor::WillBeginMainFrame() { 990 void RenderWidgetCompositor::WillBeginMainFrame() {
990 delegate_->WillBeginCompositorFrame(); 991 delegate_->WillBeginCompositorFrame();
991 } 992 }
992 993
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 float device_scale) { 1126 float device_scale) {
1126 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); 1127 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale);
1127 } 1128 }
1128 1129
1129 void RenderWidgetCompositor::SetDeviceColorSpace( 1130 void RenderWidgetCompositor::SetDeviceColorSpace(
1130 const gfx::ColorSpace& color_space) { 1131 const gfx::ColorSpace& color_space) {
1131 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); 1132 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space);
1132 } 1133 }
1133 1134
1134 } // namespace content 1135 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/render_widget_compositor.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698