[email protected] | fd32d12 | 2013-06-29 13:11:04 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | a0a0084 | 2012-10-22 22:50:28 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | fd32d12 | 2013-06-29 13:11:04 | [diff] [blame] | 5 | #ifndef CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ |
6 | #define CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ | ||||
[email protected] | a0a0084 | 2012-10-22 22:50:28 | [diff] [blame] | 7 | |
avi | 02a4d17 | 2015-12-21 06:14:36 | [diff] [blame^] | 8 | #include <stddef.h> |
9 | |||||
[email protected] | 681ccff | 2013-03-18 06:13:52 | [diff] [blame] | 10 | #include "cc/base/cc_export.h" |
danakj | 92015685 | 2015-05-18 20:22:29 | [diff] [blame] | 11 | #include "cc/tiles/tile_priority.h" |
[email protected] | f44d555 | 2013-10-29 04:56:29 | [diff] [blame] | 12 | #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
[email protected] | a0a0084 | 2012-10-22 22:50:28 | [diff] [blame] | 13 | |
14 | namespace cc { | ||||
15 | |||||
nyquist | 1d29b06 | 2015-12-02 02:48:18 | [diff] [blame] | 16 | namespace proto { |
17 | class ManagedMemoryPolicy; | ||||
18 | } // namespace proto | ||||
19 | |||||
[email protected] | 52347c84 | 2012-11-02 21:06:20 | [diff] [blame] | 20 | struct CC_EXPORT ManagedMemoryPolicy { |
[email protected] | 3f2ff11 | 2013-08-03 02:41:07 | [diff] [blame] | 21 | static const size_t kDefaultNumResourcesLimit; |
[email protected] | 9b0b79a0 | 2013-01-02 22:47:27 | [diff] [blame] | 22 | |
[email protected] | adb0854 | 2013-03-26 18:06:10 | [diff] [blame] | 23 | explicit ManagedMemoryPolicy(size_t bytes_limit_when_visible); |
[email protected] | f44d555 | 2013-10-29 04:56:29 | [diff] [blame] | 24 | explicit ManagedMemoryPolicy( |
25 | const gpu::MemoryAllocation& allocation); | ||||
26 | ManagedMemoryPolicy( | ||||
27 | size_t bytes_limit_when_visible, | ||||
28 | gpu::MemoryAllocation::PriorityCutoff priority_cutoff_when_visible, | ||||
[email protected] | f44d555 | 2013-10-29 04:56:29 | [diff] [blame] | 29 | size_t num_resources_limit); |
[email protected] | 46b8acc | 2013-03-19 22:38:35 | [diff] [blame] | 30 | bool operator==(const ManagedMemoryPolicy&) const; |
31 | bool operator!=(const ManagedMemoryPolicy&) const; | ||||
[email protected] | a0a0084 | 2012-10-22 22:50:28 | [diff] [blame] | 32 | |
nyquist | 1d29b06 | 2015-12-02 02:48:18 | [diff] [blame] | 33 | void ToProtobuf(proto::ManagedMemoryPolicy* proto) const; |
34 | void FromProtobuf(const proto::ManagedMemoryPolicy& proto); | ||||
35 | |||||
[email protected] | 46b8acc | 2013-03-19 22:38:35 | [diff] [blame] | 36 | size_t bytes_limit_when_visible; |
[email protected] | f44d555 | 2013-10-29 04:56:29 | [diff] [blame] | 37 | gpu::MemoryAllocation::PriorityCutoff priority_cutoff_when_visible; |
[email protected] | 3f2ff11 | 2013-08-03 02:41:07 | [diff] [blame] | 38 | size_t num_resources_limit; |
[email protected] | 9b0b79a0 | 2013-01-02 22:47:27 | [diff] [blame] | 39 | |
[email protected] | 46b8acc | 2013-03-19 22:38:35 | [diff] [blame] | 40 | static TileMemoryLimitPolicy PriorityCutoffToTileMemoryLimitPolicy( |
[email protected] | f44d555 | 2013-10-29 04:56:29 | [diff] [blame] | 41 | gpu::MemoryAllocation::PriorityCutoff priority_cutoff); |
[email protected] | a0a0084 | 2012-10-22 22:50:28 | [diff] [blame] | 42 | }; |
43 | |||||
44 | } // namespace cc | ||||
45 | |||||
[email protected] | fd32d12 | 2013-06-29 13:11:04 | [diff] [blame] | 46 | #endif // CC_OUTPUT_MANAGED_MEMORY_POLICY_H_ |