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

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: Forgot to add the changes to cc_messages.h 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)
32 , defaultTileSize(gfx::Size(256, 256)) 33 , defaultTileSize(gfx::Size(256, 256))
33 , maxUntiledLayerSize(gfx::Size(512, 512)) 34 , maxUntiledLayerSize(gfx::Size(512, 512))
34 , minimumOcclusionTrackingSize(gfx::Size(160, 160)) 35 , minimumOcclusionTrackingSize(gfx::Size(160, 160))
35 { 36 {
36 // TODO(danakj): Move this to chromium when we don't go through the WebKit A PI anymore. 37 // 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); 38 compositorFrameMessage = CommandLine::ForCurrentProcess()->HasSwitch(cc::swi tches::kEnableCompositorFrameMessage);
38 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting); 39 implSidePainting = CommandLine::ForCurrentProcess()->HasSwitch(cc::switches: :kEnableImplSidePainting);
39 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap); 40 partialSwapEnabled = CommandLine::ForCurrentProcess()->HasSwitch(switches::k EnablePartialSwap);
40 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard); 41 backgroundColorInsteadOfCheckerboard = CommandLine::ForCurrentProcess()->Has Switch(switches::kBackgroundColorInsteadOfCheckerboard);
41 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw); 42 showOverdrawInTracing = CommandLine::ForCurrentProcess()->HasSwitch(switches ::kTraceOverdraw);
42 43
44 calculateTopControlsPosition = CommandLine::ForCurrentProcess()->HasSwitch(s witches::kEnableTopControlsPositionCalculation);
45 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTopControlsHeight )) {
46 std::string controls_height_str =
47 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kTop ControlsHeight);
48 int controls_height;
49 if (base::StringToInt(controls_height_str, &controls_height) && controls _height > 0)
50 topControlsHeight = controls_height;
51 }
52 if (calculateTopControlsPosition && (topControlsHeight <= 0 || !compositorFr ameMessage)) {
53 DCHECK(false) << "Top controls repositioning enabled without valid heigh t or compositorFrameMessage set.";
54 calculateTopControlsPosition = false;
55 }
56
43 // TODO(alokp): Remove this hard-coded setting. 57 // TODO(alokp): Remove this hard-coded setting.
44 // Platforms that need to disable LCD text must explicitly set this value. 58 // Platforms that need to disable LCD text must explicitly set this value.
45 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
46 canUseLCDText = false; 60 canUseLCDText = false;
47 #endif 61 #endif
48 62
49 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess( )->HasSwitch(cc::switches::kShowPropertyChangedRects); 63 initialDebugState.showPropertyChangedRects = CommandLine::ForCurrentProcess( )->HasSwitch(cc::switches::kShowPropertyChangedRects);
50 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()- >HasSwitch(cc::switches::kShowSurfaceDamageRects); 64 initialDebugState.showSurfaceDamageRects = CommandLine::ForCurrentProcess()- >HasSwitch(cc::switches::kShowSurfaceDamageRects);
51 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H asSwitch(cc::switches::kShowScreenSpaceRects); 65 initialDebugState.showScreenSpaceRects = CommandLine::ForCurrentProcess()->H asSwitch(cc::switches::kShowScreenSpaceRects);
52 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); 66 initialDebugState.showReplicaScreenSpaceRects = CommandLine::ForCurrentProce ss()->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects);
(...skipping 15 matching lines...) Expand all
68 num_raster_threads; 82 num_raster_threads;
69 } 83 }
70 } 84 }
71 } 85 }
72 86
73 LayerTreeSettings::~LayerTreeSettings() 87 LayerTreeSettings::~LayerTreeSettings()
74 { 88 {
75 } 89 }
76 90
77 } // namespace cc 91 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698