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

Unified Diff: cc/output/managed_memory_policy.cc

Issue 1490513005: Add support for ManagedMemoryPolicy (de)serialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-settings
Patch Set: Rebase on top of origin/master Created 5 years 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/managed_memory_policy.cc
diff --git a/cc/output/managed_memory_policy.cc b/cc/output/managed_memory_policy.cc
index d46790d5fefb592f6a8a15f2426d860b091c96be..f7ed2149bcc3b369981d0bd78f148868eadfdce3 100644
--- a/cc/output/managed_memory_policy.cc
+++ b/cc/output/managed_memory_policy.cc
@@ -5,6 +5,8 @@
#include "cc/output/managed_memory_policy.h"
#include "base/logging.h"
+#include "cc/proto/gpu_conversions.h"
+#include "cc/proto/managed_memory_policy.pb.h"
namespace cc {
@@ -41,6 +43,21 @@ bool ManagedMemoryPolicy::operator!=(const ManagedMemoryPolicy& other) const {
return !(*this == other);
}
+void ManagedMemoryPolicy::ToProtobuf(proto::ManagedMemoryPolicy* proto) const {
+ proto->set_bytes_limit_when_visible(bytes_limit_when_visible);
+ proto->set_priority_cutoff_when_visible(
+ MemoryAllocationPriorityCutoffToProto(priority_cutoff_when_visible));
+ proto->set_num_resources_limit(num_resources_limit);
+}
+
+void ManagedMemoryPolicy::FromProtobuf(
+ const proto::ManagedMemoryPolicy& proto) {
+ bytes_limit_when_visible = proto.bytes_limit_when_visible();
+ priority_cutoff_when_visible = MemoryAllocationPriorityCutoffFromProto(
+ proto.priority_cutoff_when_visible());
+ num_resources_limit = proto.num_resources_limit();
+}
+
// static
TileMemoryLimitPolicy
ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
« 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