OLD | NEW |
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 AT_LAST_AND_ACTIVE_BIN = 5, // Only do this after all other bins. |
26 NEVER_BIN = 6, // Dont bother. | 26 AT_LAST_BIN = 6, // Only do this after all other bins. |
27 NUM_BINS = 7 | 27 NEVER_BIN = 7, // Dont bother. |
| 28 NUM_BINS = 8 |
28 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding | 29 // NOTE: Be sure to update ManagedTileBinAsValue and kBinPolicyMap when adding |
29 // or reordering fields. | 30 // or reordering fields. |
30 }; | 31 }; |
31 scoped_ptr<base::Value> ManagedTileBinAsValue( | 32 scoped_ptr<base::Value> ManagedTileBinAsValue( |
32 ManagedTileBin bin); | 33 ManagedTileBin bin); |
33 | 34 |
34 enum ManagedTileBinPriority { | 35 enum ManagedTileBinPriority { |
35 HIGH_PRIORITY_BIN = 0, | 36 HIGH_PRIORITY_BIN = 0, |
36 LOW_PRIORITY_BIN = 1, | 37 LOW_PRIORITY_BIN = 1, |
37 NUM_BIN_PRIORITIES = 2 | 38 NUM_BIN_PRIORITIES = 2 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 125 |
125 ManagedTileState(); | 126 ManagedTileState(); |
126 ~ManagedTileState(); | 127 ~ManagedTileState(); |
127 | 128 |
128 scoped_ptr<base::Value> AsValue() const; | 129 scoped_ptr<base::Value> AsValue() const; |
129 | 130 |
130 // Persisted state: valid all the time. | 131 // Persisted state: valid all the time. |
131 TileVersion tile_versions[NUM_RASTER_MODES]; | 132 TileVersion tile_versions[NUM_RASTER_MODES]; |
132 RasterMode raster_mode; | 133 RasterMode raster_mode; |
133 | 134 |
134 // Ephemeral state, valid only during TileManager::ManageTiles. | 135 ManagedTileBin bin; |
135 bool is_in_never_bin_on_both_trees() const { | |
136 return (bin[HIGH_PRIORITY_BIN] == NEVER_BIN || | |
137 bin[HIGH_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN) && | |
138 (bin[LOW_PRIORITY_BIN] == NEVER_BIN || | |
139 bin[LOW_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN); | |
140 } | |
141 | |
142 ManagedTileBin bin[NUM_BIN_PRIORITIES]; | |
143 ManagedTileBin tree_bin[NUM_TREES]; | 136 ManagedTileBin tree_bin[NUM_TREES]; |
144 | 137 |
145 // The bin that the tile would have if the GPU memory manager had | 138 // The bin that the tile would have if the GPU memory manager had |
146 // a maximally permissive policy, send to the GPU memory manager | 139 // a maximally permissive policy, send to the GPU memory manager |
147 // to determine policy. | 140 // to determine policy. |
148 ManagedTileBin gpu_memmgr_stats_bin; | 141 ManagedTileBin gpu_memmgr_stats_bin; |
149 TileResolution resolution; | 142 TileResolution resolution; |
150 bool required_for_activation; | 143 bool required_for_activation; |
151 float time_to_needed_in_seconds; | 144 float time_to_needed_in_seconds; |
152 float distance_to_visible_in_pixels; | 145 float distance_to_visible_in_pixels; |
153 bool visible_and_ready_to_draw; | 146 bool visible_and_ready_to_draw; |
154 | 147 |
155 // Priority for this state from the last time we assigned memory. | 148 // Priority for this state from the last time we assigned memory. |
156 unsigned scheduled_priority; | 149 unsigned scheduled_priority; |
157 }; | 150 }; |
158 | 151 |
159 } // namespace cc | 152 } // namespace cc |
160 | 153 |
161 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 154 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
OLD | NEW |