| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 ManagedTileState(); | 127 ManagedTileState(); |
| 127 ~ManagedTileState(); | 128 ~ManagedTileState(); |
| 128 | 129 |
| 129 scoped_ptr<base::Value> AsValue() const; | 130 scoped_ptr<base::Value> AsValue() const; |
| 130 | 131 |
| 131 // Persisted state: valid all the time. | 132 // Persisted state: valid all the time. |
| 132 TileVersion tile_versions[NUM_RASTER_MODES]; | 133 TileVersion tile_versions[NUM_RASTER_MODES]; |
| 133 RasterMode raster_mode; | 134 RasterMode raster_mode; |
| 134 | 135 |
| 135 // Ephemeral state, valid only during TileManager::ManageTiles. | 136 ManagedTileBin bin; |
| 136 bool is_in_never_bin_on_both_trees() const { | |
| 137 return (bin[HIGH_PRIORITY_BIN] == NEVER_BIN || | |
| 138 bin[HIGH_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN) && | |
| 139 (bin[LOW_PRIORITY_BIN] == NEVER_BIN || | |
| 140 bin[LOW_PRIORITY_BIN] == NEVER_AND_ACTIVE_BIN); | |
| 141 } | |
| 142 | |
| 143 ManagedTileBin bin[NUM_BIN_PRIORITIES]; | |
| 144 ManagedTileBin tree_bin[NUM_TREES]; | 137 ManagedTileBin tree_bin[NUM_TREES]; |
| 145 | 138 |
| 146 // The bin that the tile would have if the GPU memory manager had | 139 // The bin that the tile would have if the GPU memory manager had |
| 147 // a maximally permissive policy, send to the GPU memory manager | 140 // a maximally permissive policy, send to the GPU memory manager |
| 148 // to determine policy. | 141 // to determine policy. |
| 149 ManagedTileBin gpu_memmgr_stats_bin; | 142 ManagedTileBin gpu_memmgr_stats_bin; |
| 150 TileResolution resolution; | 143 TileResolution resolution; |
| 151 bool required_for_activation; | 144 bool required_for_activation; |
| 152 float time_to_needed_in_seconds; | 145 float time_to_needed_in_seconds; |
| 153 float distance_to_visible_in_pixels; | 146 float distance_to_visible_in_pixels; |
| 154 bool visible_and_ready_to_draw; | 147 bool visible_and_ready_to_draw; |
| 155 | 148 |
| 156 // Priority for this state from the last time we assigned memory. | 149 // Priority for this state from the last time we assigned memory. |
| 157 unsigned scheduled_priority; | 150 unsigned scheduled_priority; |
| 158 }; | 151 }; |
| 159 | 152 |
| 160 } // namespace cc | 153 } // namespace cc |
| 161 | 154 |
| 162 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ | 155 #endif // CC_RESOURCES_MANAGED_TILE_STATE_H_ |
| OLD | NEW |