| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_TILE_PRIORITY_H_ | 5 #ifndef CC_RESOURCES_TILE_PRIORITY_H_ |
| 6 #define CC_RESOURCES_TILE_PRIORITY_H_ | 6 #define CC_RESOURCES_TILE_PRIORITY_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ALLOW_NOTHING = 0, | 115 ALLOW_NOTHING = 0, |
| 116 | 116 |
| 117 // You might be made visible, but you're not being interacted with. | 117 // You might be made visible, but you're not being interacted with. |
| 118 ALLOW_ABSOLUTE_MINIMUM = 1, // Tall. | 118 ALLOW_ABSOLUTE_MINIMUM = 1, // Tall. |
| 119 | 119 |
| 120 // You're being interacted with, but we're low on memory. | 120 // You're being interacted with, but we're low on memory. |
| 121 ALLOW_PREPAINT_ONLY = 2, // Grande. | 121 ALLOW_PREPAINT_ONLY = 2, // Grande. |
| 122 | 122 |
| 123 // You're the only thing in town. Go crazy. | 123 // You're the only thing in town. Go crazy. |
| 124 ALLOW_ANYTHING = 3, // Venti. | 124 ALLOW_ANYTHING = 3, // Venti. |
| 125 | |
| 126 NUM_TILE_MEMORY_LIMIT_POLICIES = 4, | |
| 127 | |
| 128 // NOTE: Be sure to update TreePriorityAsValue and kBinPolicyMap when adding | |
| 129 // or reordering fields. | |
| 130 }; | 125 }; |
| 131 scoped_ptr<base::Value> TileMemoryLimitPolicyAsValue( | 126 scoped_ptr<base::Value> TileMemoryLimitPolicyAsValue( |
| 132 TileMemoryLimitPolicy policy); | 127 TileMemoryLimitPolicy policy); |
| 133 | 128 |
| 134 enum TreePriority { | 129 enum TreePriority { |
| 135 SAME_PRIORITY_FOR_BOTH_TREES, | 130 SAME_PRIORITY_FOR_BOTH_TREES, |
| 136 SMOOTHNESS_TAKES_PRIORITY, | 131 SMOOTHNESS_TAKES_PRIORITY, |
| 137 NEW_CONTENT_TAKES_PRIORITY | 132 NEW_CONTENT_TAKES_PRIORITY |
| 138 | |
| 139 // Be sure to update TreePriorityAsValue when adding new fields. | |
| 140 }; | 133 }; |
| 141 scoped_ptr<base::Value> TreePriorityAsValue(TreePriority prio); | 134 scoped_ptr<base::Value> TreePriorityAsValue(TreePriority prio); |
| 142 | 135 |
| 143 class GlobalStateThatImpactsTilePriority { | 136 class GlobalStateThatImpactsTilePriority { |
| 144 public: | 137 public: |
| 145 GlobalStateThatImpactsTilePriority() | 138 GlobalStateThatImpactsTilePriority() |
| 146 : memory_limit_policy(ALLOW_NOTHING), | 139 : memory_limit_policy(ALLOW_NOTHING), |
| 147 soft_memory_limit_in_bytes(0), | 140 soft_memory_limit_in_bytes(0), |
| 148 hard_memory_limit_in_bytes(0), | 141 hard_memory_limit_in_bytes(0), |
| 149 num_resources_limit(0), | 142 num_resources_limit(0), |
| 150 tree_priority(SAME_PRIORITY_FOR_BOTH_TREES) {} | 143 tree_priority(SAME_PRIORITY_FOR_BOTH_TREES) {} |
| 151 | 144 |
| 152 TileMemoryLimitPolicy memory_limit_policy; | 145 TileMemoryLimitPolicy memory_limit_policy; |
| 153 | 146 |
| 154 size_t soft_memory_limit_in_bytes; | 147 size_t soft_memory_limit_in_bytes; |
| 155 size_t hard_memory_limit_in_bytes; | 148 size_t hard_memory_limit_in_bytes; |
| 156 size_t num_resources_limit; | 149 size_t num_resources_limit; |
| 157 | 150 |
| 158 TreePriority tree_priority; | 151 TreePriority tree_priority; |
| 159 | 152 |
| 160 bool operator==(const GlobalStateThatImpactsTilePriority& other) const { | |
| 161 return memory_limit_policy == other.memory_limit_policy && | |
| 162 soft_memory_limit_in_bytes == other.soft_memory_limit_in_bytes && | |
| 163 hard_memory_limit_in_bytes == other.hard_memory_limit_in_bytes && | |
| 164 num_resources_limit == other.num_resources_limit && | |
| 165 tree_priority == other.tree_priority; | |
| 166 } | |
| 167 bool operator!=(const GlobalStateThatImpactsTilePriority& other) const { | |
| 168 return !(*this == other); | |
| 169 } | |
| 170 | |
| 171 scoped_ptr<base::Value> AsValue() const; | 153 scoped_ptr<base::Value> AsValue() const; |
| 172 }; | 154 }; |
| 173 | 155 |
| 174 } // namespace cc | 156 } // namespace cc |
| 175 | 157 |
| 176 #endif // CC_RESOURCES_TILE_PRIORITY_H_ | 158 #endif // CC_RESOURCES_TILE_PRIORITY_H_ |
| OLD | NEW |