blob: 54fa271d0bf25d1adfed02513ed020e97fe57c12 [file] [log] [blame]
[email protected]fd32d122013-06-29 13:11:041// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]a0a00842012-10-22 22:50:282// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]fd32d122013-06-29 13:11:045#ifndef CC_OUTPUT_MANAGED_MEMORY_POLICY_H_
6#define CC_OUTPUT_MANAGED_MEMORY_POLICY_H_
[email protected]a0a00842012-10-22 22:50:287
avi02a4d172015-12-21 06:14:368#include <stddef.h>
9
[email protected]681ccff2013-03-18 06:13:5210#include "cc/base/cc_export.h"
danakj920156852015-05-18 20:22:2911#include "cc/tiles/tile_priority.h"
[email protected]f44d5552013-10-29 04:56:2912#include "gpu/command_buffer/common/gpu_memory_allocation.h"
[email protected]a0a00842012-10-22 22:50:2813
14namespace cc {
15
nyquist1d29b062015-12-02 02:48:1816namespace proto {
17class ManagedMemoryPolicy;
18} // namespace proto
19
[email protected]52347c842012-11-02 21:06:2020struct CC_EXPORT ManagedMemoryPolicy {
[email protected]3f2ff112013-08-03 02:41:0721 static const size_t kDefaultNumResourcesLimit;
[email protected]9b0b79a02013-01-02 22:47:2722
[email protected]adb08542013-03-26 18:06:1023 explicit ManagedMemoryPolicy(size_t bytes_limit_when_visible);
[email protected]f44d5552013-10-29 04:56:2924 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]f44d5552013-10-29 04:56:2929 size_t num_resources_limit);
[email protected]46b8acc2013-03-19 22:38:3530 bool operator==(const ManagedMemoryPolicy&) const;
31 bool operator!=(const ManagedMemoryPolicy&) const;
[email protected]a0a00842012-10-22 22:50:2832
nyquist1d29b062015-12-02 02:48:1833 void ToProtobuf(proto::ManagedMemoryPolicy* proto) const;
34 void FromProtobuf(const proto::ManagedMemoryPolicy& proto);
35
[email protected]46b8acc2013-03-19 22:38:3536 size_t bytes_limit_when_visible;
[email protected]f44d5552013-10-29 04:56:2937 gpu::MemoryAllocation::PriorityCutoff priority_cutoff_when_visible;
[email protected]3f2ff112013-08-03 02:41:0738 size_t num_resources_limit;
[email protected]9b0b79a02013-01-02 22:47:2739
[email protected]46b8acc2013-03-19 22:38:3540 static TileMemoryLimitPolicy PriorityCutoffToTileMemoryLimitPolicy(
[email protected]f44d5552013-10-29 04:56:2941 gpu::MemoryAllocation::PriorityCutoff priority_cutoff);
[email protected]a0a00842012-10-22 22:50:2842};
43
44} // namespace cc
45
[email protected]fd32d122013-06-29 13:11:0446#endif // CC_OUTPUT_MANAGED_MEMORY_POLICY_H_