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 3 // found in the LICENSE file. 4 5 #ifndef CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ 6 #define CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ 7 8 #include "base/basictypes.h" 9 #include "cc/base/cc_export.h" 10 #include "cc/resources/tile_priority.h" 11 12 namespace cc { 13 14 struct CC_EXPORT ManagedMemoryPolicy { 15 enum PriorityCutoff { 16 CUTOFF_ALLOW_NOTHING, 17 CUTOFF_ALLOW_REQUIRED_ONLY, 18 CUTOFF_ALLOW_NICE_TO_HAVE, 19 CUTOFF_ALLOW_EVERYTHING, 20 }; 21 static const size_t kDefaultNumResourcesLimit; 22 23 explicit ManagedMemoryPolicy(size_t bytes_limit_when_visible); 24 ManagedMemoryPolicy(size_t bytes_limit_when_visible, 25 PriorityCutoff priority_cutoff_when_visible, 26 size_t bytes_limit_when_not_visible, 27 PriorityCutoff priority_cutoff_when_not_visible, 28 size_t num_resources_limit); 29 bool operator==(const ManagedMemoryPolicy&) const; 30 bool operator!=(const ManagedMemoryPolicy&) const; 31 32 size_t bytes_limit_when_visible; 33 PriorityCutoff priority_cutoff_when_visible; 34 size_t bytes_limit_when_not_visible; 35 PriorityCutoff priority_cutoff_when_not_visible; 36 size_t num_resources_limit; 37 38 static int PriorityCutoffToValue(PriorityCutoff priority_cutoff); 39 static TileMemoryLimitPolicy PriorityCutoffToTileMemoryLimitPolicy( 40 PriorityCutoff priority_cutoff); 41 }; 42 43 } // namespace cc 44 45 #endif // CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ 46