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

Unified Diff: components/sync/model_impl/processor_entity_tracker.cc

Issue 2781863004: [Sync] Implement EstimateMemoryUsage for SharedModelTypeProcessor and ModelTypeWorker (Closed)
Patch Set: Address comments 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/model_impl/processor_entity_tracker.cc
diff --git a/components/sync/model_impl/processor_entity_tracker.cc b/components/sync/model_impl/processor_entity_tracker.cc
index ec12df89ae446939328f6ae56a924d91f2cb4b00..c468d464f482399defc4b40469a4251996dd29b0 100644
--- a/components/sync/model_impl/processor_entity_tracker.cc
+++ b/components/sync/model_impl/processor_entity_tracker.cc
@@ -6,8 +6,10 @@
#include "base/base64.h"
#include "base/sha1.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/non_blocking_sync_common.h"
+#include "components/sync/protocol/proto_memory_estimations.h"
namespace syncer {
@@ -239,6 +241,15 @@ void ProcessorEntityTracker::IncrementSequenceNumber() {
metadata_.set_sequence_number(metadata_.sequence_number() + 1);
}
+size_t ProcessorEntityTracker::EstimateMemoryUsage() const {
+ using base::trace_event::EstimateMemoryUsage;
+ size_t memory_usage = 0;
+ memory_usage += EstimateMemoryUsage(storage_key_);
+ memory_usage += EstimateMemoryUsage(metadata_);
+ memory_usage += EstimateMemoryUsage(commit_data_);
+ return memory_usage;
+}
+
bool ProcessorEntityTracker::MatchesSpecificsHash(
const sync_pb::EntitySpecifics& specifics) const {
DCHECK(!metadata_.is_deleted());
« no previous file with comments | « components/sync/model_impl/processor_entity_tracker.h ('k') | components/sync/model_impl/shared_model_type_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698