Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: cc/output/managed_memory_policy.cc

Issue 2493853002: cc/blimp: Proto Cleanup. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/managed_memory_policy.h ('k') | cc/output/managed_memory_policy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "cc/output/managed_memory_policy.h" 5 #include "cc/output/managed_memory_policy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/proto/gpu_conversions.h"
11 #include "cc/proto/managed_memory_policy.pb.h"
12 10
13 namespace cc { 11 namespace cc {
14 12
15 const size_t ManagedMemoryPolicy::kDefaultNumResourcesLimit = 10 * 1000 * 1000; 13 const size_t ManagedMemoryPolicy::kDefaultNumResourcesLimit = 10 * 1000 * 1000;
16 14
17 using gpu::MemoryAllocation; 15 using gpu::MemoryAllocation;
18 16
19 ManagedMemoryPolicy::ManagedMemoryPolicy(size_t bytes_limit_when_visible) 17 ManagedMemoryPolicy::ManagedMemoryPolicy(size_t bytes_limit_when_visible)
20 : bytes_limit_when_visible(bytes_limit_when_visible), 18 : bytes_limit_when_visible(bytes_limit_when_visible),
21 priority_cutoff_when_visible(MemoryAllocation::CUTOFF_ALLOW_EVERYTHING), 19 priority_cutoff_when_visible(MemoryAllocation::CUTOFF_ALLOW_EVERYTHING),
(...skipping 16 matching lines...) Expand all
38 bool ManagedMemoryPolicy::operator==(const ManagedMemoryPolicy& other) const { 36 bool ManagedMemoryPolicy::operator==(const ManagedMemoryPolicy& other) const {
39 return bytes_limit_when_visible == other.bytes_limit_when_visible && 37 return bytes_limit_when_visible == other.bytes_limit_when_visible &&
40 priority_cutoff_when_visible == other.priority_cutoff_when_visible && 38 priority_cutoff_when_visible == other.priority_cutoff_when_visible &&
41 num_resources_limit == other.num_resources_limit; 39 num_resources_limit == other.num_resources_limit;
42 } 40 }
43 41
44 bool ManagedMemoryPolicy::operator!=(const ManagedMemoryPolicy& other) const { 42 bool ManagedMemoryPolicy::operator!=(const ManagedMemoryPolicy& other) const {
45 return !(*this == other); 43 return !(*this == other);
46 } 44 }
47 45
48 void ManagedMemoryPolicy::ToProtobuf(proto::ManagedMemoryPolicy* proto) const {
49 proto->set_bytes_limit_when_visible(bytes_limit_when_visible);
50 proto->set_priority_cutoff_when_visible(
51 MemoryAllocationPriorityCutoffToProto(priority_cutoff_when_visible));
52 proto->set_num_resources_limit(num_resources_limit);
53 }
54
55 void ManagedMemoryPolicy::FromProtobuf(
56 const proto::ManagedMemoryPolicy& proto) {
57 bytes_limit_when_visible = proto.bytes_limit_when_visible();
58 priority_cutoff_when_visible = MemoryAllocationPriorityCutoffFromProto(
59 proto.priority_cutoff_when_visible());
60 num_resources_limit = proto.num_resources_limit();
61 }
62
63 // static 46 // static
64 TileMemoryLimitPolicy 47 TileMemoryLimitPolicy
65 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( 48 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
66 gpu::MemoryAllocation::PriorityCutoff priority_cutoff) { 49 gpu::MemoryAllocation::PriorityCutoff priority_cutoff) {
67 switch (priority_cutoff) { 50 switch (priority_cutoff) {
68 case MemoryAllocation::CUTOFF_ALLOW_NOTHING: 51 case MemoryAllocation::CUTOFF_ALLOW_NOTHING:
69 return ALLOW_NOTHING; 52 return ALLOW_NOTHING;
70 case MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY: 53 case MemoryAllocation::CUTOFF_ALLOW_REQUIRED_ONLY:
71 return ALLOW_ABSOLUTE_MINIMUM; 54 return ALLOW_ABSOLUTE_MINIMUM;
72 case MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE: 55 case MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE:
73 return ALLOW_PREPAINT_ONLY; 56 return ALLOW_PREPAINT_ONLY;
74 case MemoryAllocation::CUTOFF_ALLOW_EVERYTHING: 57 case MemoryAllocation::CUTOFF_ALLOW_EVERYTHING:
75 return ALLOW_ANYTHING; 58 return ALLOW_ANYTHING;
76 } 59 }
77 NOTREACHED(); 60 NOTREACHED();
78 return ALLOW_NOTHING; 61 return ALLOW_NOTHING;
79 } 62 }
80 63
81 } // namespace cc 64 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/managed_memory_policy.h ('k') | cc/output/managed_memory_policy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698