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

Unified Diff: components/sync/engine_impl/worker_entity_tracker.cc

Issue 2781863004: [Sync] Implement EstimateMemoryUsage for SharedModelTypeProcessor and ModelTypeWorker (Closed)
Patch Set: Fix lint errors Created 3 years, 9 months 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
Index: components/sync/engine_impl/worker_entity_tracker.cc
diff --git a/components/sync/engine_impl/worker_entity_tracker.cc b/components/sync/engine_impl/worker_entity_tracker.cc
index 67f2aa945f044b7822717188aa63a49eca504edd..5bdcb2d6032e81153146d189aa12945afdab6998 100644
--- a/components/sync/engine_impl/worker_entity_tracker.cc
+++ b/components/sync/engine_impl/worker_entity_tracker.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "components/sync/base/model_type.h"
#include "components/sync/base/time.h"
#include "components/sync/syncable/syncable_util.h"
@@ -177,6 +178,21 @@ void WorkerEntityTracker::ClearEncryptedUpdate() {
encrypted_update_.reset();
}
+size_t WorkerEntityTracker::EstimateMemoryUsage() const {
+ using base::trace_event::EstimateMemoryUsage;
+ size_t memory_usage = 0;
+ memory_usage += EstimateMemoryUsage(client_tag_hash_);
+ memory_usage += EstimateMemoryUsage(id_);
+ memory_usage += sizeof(sequence_number_);
+ memory_usage += sizeof(base_version_);
+ memory_usage += sizeof(highest_commit_response_version_);
+ memory_usage += sizeof(highest_gu_response_version_);
+ memory_usage += EstimateMemoryUsage(pending_commit_);
+ memory_usage += EstimateMemoryUsage(pending_commit_specifics_hash_);
+ memory_usage += EstimateMemoryUsage(encrypted_update_);
+ return memory_usage;
+}
+
bool WorkerEntityTracker::IsInConflict() const {
if (!HasPendingCommit())
return false;

Powered by Google App Engine
This is Rietveld 408576698