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

Side by Side Diff: cc/resources/managed_tile_state.h

Issue 22875045: cc: Remove unnecessary "default" cases from switch statements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_ 5 #ifndef CC_RESOURCES_MANAGED_TILE_STATE_H_
6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_ 6 #define CC_RESOURCES_MANAGED_TILE_STATE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/resources/platform_color.h" 9 #include "cc/resources/platform_color.h"
10 #include "cc/resources/raster_worker_pool.h" 10 #include "cc/resources/raster_worker_pool.h"
11 #include "cc/resources/resource_pool.h" 11 #include "cc/resources/resource_pool.h"
12 #include "cc/resources/resource_provider.h" 12 #include "cc/resources/resource_provider.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class TileManager; 16 class TileManager;
17 17
18 // Tile manager classifying tiles into a few basic bins: 18 // Tile manager classifying tiles into a few basic bins:
19 enum ManagedTileBin { 19 enum ManagedTileBin {
20 NOW_AND_READY_TO_DRAW_BIN = 0, // Ready to draw and within viewport. 20 NOW_AND_READY_TO_DRAW_BIN = 0, // Ready to draw and within viewport.
21 NOW_BIN = 1, // Needed ASAP. 21 NOW_BIN = 1, // Needed ASAP.
22 SOON_BIN = 2, // Impl-side version of prepainting. 22 SOON_BIN = 2, // Impl-side version of prepainting.
23 EVENTUALLY_AND_ACTIVE_BIN = 3, // Nice to have, and has a task or resource. 23 EVENTUALLY_AND_ACTIVE_BIN = 3, // Nice to have, and has a task or resource.
24 EVENTUALLY_BIN = 4, // Nice to have, if we've got memory and time. 24 EVENTUALLY_BIN = 4, // Nice to have, if we've got memory and time.
25 NEVER_AND_ACTIVE_BIN = 5, // Dont bother, but has a task or resource. 25 NEVER_AND_ACTIVE_BIN = 5, // Dont bother, but has a task or resource.
26 NEVER_BIN = 6, // Dont bother. 26 NEVER_BIN = 6, // Dont bother.
27 NUM_BINS = 7 27 MAX_BIN = NEVER_BIN
vmpstr 2013/08/22 23:33:34 I'd prefer we keep NUM_BINS. Maybe something like
danakj 2013/08/23 00:38:13 This seems like a pretty nice idea to me. Maybe wi
28 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding 28 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding
29 // or reordering fields. 29 // or reordering fields.
30 }; 30 };
31 scoped_ptr<base::Value> ManagedTileBinAsValue( 31 scoped_ptr<base::Value> ManagedTileBinAsValue(
32 ManagedTileBin bin); 32 ManagedTileBin bin);
33 33
34 enum ManagedTileBinPriority { 34 enum ManagedTileBinPriority {
35 HIGH_PRIORITY_BIN = 0, 35 HIGH_PRIORITY_BIN = 0,
36 LOW_PRIORITY_BIN = 1, 36 LOW_PRIORITY_BIN = 1,
37 NUM_BIN_PRIORITIES = 2 37 MAX_BIN_PRIORITY = LOW_PRIORITY_BIN
38 }; 38 };
39 scoped_ptr<base::Value> ManagedTileBinPriorityAsValue( 39 scoped_ptr<base::Value> ManagedTileBinPriorityAsValue(
40 ManagedTileBinPriority bin); 40 ManagedTileBinPriority bin);
41 41
42 // This is state that is specific to a tile that is 42 // This is state that is specific to a tile that is
43 // managed by the TileManager. 43 // managed by the TileManager.
44 class CC_EXPORT ManagedTileState { 44 class CC_EXPORT ManagedTileState {
45 public: 45 public:
46 class CC_EXPORT TileVersion { 46 class CC_EXPORT TileVersion {
47 public: 47 public:
48 enum Mode { 48 enum Mode {
49 RESOURCE_MODE, 49 RESOURCE_MODE,
50 SOLID_COLOR_MODE, 50 SOLID_COLOR_MODE,
51 PICTURE_PILE_MODE, 51 PICTURE_PILE_MODE
52 NUM_MODES
53 }; 52 };
54 53
55 TileVersion(); 54 TileVersion();
56 ~TileVersion(); 55 ~TileVersion();
57 56
58 Mode mode() const { 57 Mode mode() const {
59 return mode_; 58 return mode_;
60 } 59 }
61 60
62 bool IsReadyToDraw() const; 61 bool IsReadyToDraw() const;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 scoped_ptr<ResourcePool::Resource> resource_; 121 scoped_ptr<ResourcePool::Resource> resource_;
123 RasterWorkerPool::RasterTask raster_task_; 122 RasterWorkerPool::RasterTask raster_task_;
124 }; 123 };
125 124
126 ManagedTileState(); 125 ManagedTileState();
127 ~ManagedTileState(); 126 ~ManagedTileState();
128 127
129 scoped_ptr<base::Value> AsValue() const; 128 scoped_ptr<base::Value> AsValue() const;
130 129
131 // Persisted state: valid all the time. 130 // Persisted state: valid all the time.
132 TileVersion tile_versions[NUM_RASTER_MODES]; 131 TileVersion tile_versions[MAX_RASTER_MODE + 1];
133 RasterMode raster_mode; 132 RasterMode raster_mode;
134 133
135 // Ephemeral state, valid only during TileManager::ManageTiles. 134 // Ephemeral state, valid only during TileManager::ManageTiles.
136 bool is_in_never_bin_on_both_trees() const { 135 bool is_in_never_bin_on_both_trees() const {
137 return (bin[HIGH_PRIORITY_BIN] == NEVER_BIN || 136 return (bin[HIGH_PRIORITY_BIN] == NEVER_BIN ||
138 bin[HIGH_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN) && 137 bin[HIGH_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN) &&
139 (bin[LOW_PRIORITY_BIN] == NEVER_BIN || 138 (bin[LOW_PRIORITY_BIN] == NEVER_BIN ||
140 bin[LOW_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN); 139 bin[LOW_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN);
141 } 140 }
142 141
143 ManagedTileBin bin[NUM_BIN_PRIORITIES]; 142 ManagedTileBin bin[MAX_BIN_PRIORITY + 1];
144 ManagedTileBin tree_bin[NUM_TREES]; 143 ManagedTileBin tree_bin[MAX_TREE + 1];
145 144
146 // The bin that the tile would have if the GPU memory manager had 145 // The bin that the tile would have if the GPU memory manager had
147 // a maximally permissive policy, send to the GPU memory manager 146 // a maximally permissive policy, send to the GPU memory manager
148 // to determine policy. 147 // to determine policy.
149 ManagedTileBin gpu_memmgr_stats_bin; 148 ManagedTileBin gpu_memmgr_stats_bin;
150 TileResolution resolution; 149 TileResolution resolution;
151 bool required_for_activation; 150 bool required_for_activation;
152 float time_to_needed_in_seconds; 151 float time_to_needed_in_seconds;
153 float distance_to_visible_in_pixels; 152 float distance_to_visible_in_pixels;
154 bool visible_and_ready_to_draw; 153 bool visible_and_ready_to_draw;
155 154
156 // Priority for this state from the last time we assigned memory. 155 // Priority for this state from the last time we assigned memory.
157 unsigned scheduled_priority; 156 unsigned scheduled_priority;
158 }; 157 };
159 158
160 } // namespace cc 159 } // namespace cc
161 160
162 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ 161 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698