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

Side by Side Diff: cc/layer_tree_settings.cc

Issue 11552009: Add support for calculating the position of the top controls in the cc layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove some unnecessary bits after addressing comments. Created 8 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layer_tree_settings.h" 5 #include "cc/layer_tree_settings.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"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "cc/switches.h" 12 #include "cc/switches.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 LayerTreeSettings::LayerTreeSettings() 16 LayerTreeSettings::LayerTreeSettings()
17 : acceleratePainting(false) 17 : acceleratePainting(false)
18 , compositorFrameMessage(false) 18 , compositorFrameMessage(false)
19 , implSidePainting(false) 19 , implSidePainting(false)
20 , renderVSyncEnabled(true) 20 , renderVSyncEnabled(true)
21 , perTilePaintingEnabled(false) 21 , perTilePaintingEnabled(false)
22 , partialSwapEnabled(false) 22 , partialSwapEnabled(false)
23 , acceleratedAnimationEnabled(true) 23 , acceleratedAnimationEnabled(true)
24 , pageScalePinchZoomEnabled(false) 24 , pageScalePinchZoomEnabled(false)
25 , backgroundColorInsteadOfCheckerboard(false) 25 , backgroundColorInsteadOfCheckerboard(false)
26 , showOverdrawInTracing(false) 26 , showOverdrawInTracing(false)
27 , canUseLCDText(true) 27 , canUseLCDText(true)
28 , shouldClearRootRenderPass(true) 28 , shouldClearRootRenderPass(true)
29 , calculateTopControlsPosition(false)
29 , refreshRate(0) 30 , refreshRate(0)
30 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) 31 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
31 , numRasterThreads(1) 32 , numRasterThreads(1)
33 , topControlsHeight(0)
32 , defaultTileSize(gfx::Size(256, 256)) 34 , defaultTileSize(gfx::Size(256, 256))
33 , maxUntiledLayerSize(gfx::Size(512, 512)) 35 , maxUntiledLayerSize(gfx::Size(512, 512))
34 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) 36 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
35 { 37 {
36 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore. 38 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore.
37 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kEnableCompositorFrameMessage); 39 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kEnableCompositorFrameMessage);
38 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting); 40 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting);
39 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap); 41 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap);
40 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard); 42 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard);
41 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw); 43 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw);
42 44
45 calculateTopControlsPosition = CommandLine::ForCurrentProcess()->HasSwitch(s witches::kEnableTopControlsPositionCalculation);
46 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTopControlsHeight )) {
47 std::string controls_height_str =
48 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTop ControlsHeight);
49 int controls_height;
50 if (base::StringToInt(controls_height_str, &controls_height) && controls _height > 0)
51 topControlsHeight = controls_height;
52 }
53 if (calculateTopControlsPosition && (topControlsHeight <= 0 || !compositorFr ameMessage)) {
54 DCHECK(false) << "Top controls repositioning enabled without valid heigh t or compositorFrameMessage set.";
55 calculateTopControlsPosition = false;
56 }
57
43 // TODO(alokp): Remove this hard-coded setting. 58 // TODO(alokp): Remove this hard-coded setting.
44 // Platforms that need to disable LCD text must explicitly set this value. 59 // Platforms that need to disable LCD text must explicitly set this value.
45 #if defined(OS_ANDROID) 60 #if defined(OS_ANDROID)
46 canUseLCDText = false; 61 canUseLCDText = false;
47 #endif 62 #endif
48 63
49 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess( )->HasSwitch(cc::switches::kShowPropertyChangedRects); 64 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess( )->HasSwitch(cc::switches::kShowPropertyChangedRects);
50 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()- >HasSwitch(cc::switches::kShowSurfaceDamageRects); 65 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()- >HasSwitch(cc::switches::kShowSurfaceDamageRects);
51 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H asSwitch(cc::switches::kShowScreenSpaceRects); 66 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H asSwitch(cc::switches::kShowScreenSpaceRects);
52 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); 67 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
(...skipping 15 matching lines...) Expand all
68 num_raster_threads; 83 num_raster_threads;
69 } 84 }
70 } 85 }
71 } 86 }
72 87
73 LayerTreeSettings::~LayerTreeSettings() 88 LayerTreeSettings::~LayerTreeSettings()
74 { 89 {
75 } 90 }
76 91
77 } // namespace cc 92 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698