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/shared_model_type_processor.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/shared_model_type_processor.cc
diff --git a/components/sync/model_impl/shared_model_type_processor.cc b/components/sync/model_impl/shared_model_type_processor.cc
index 108aefc5d99089d3a1ba22610ac921ab6151d1e6..f5713235b0bdd690124dda750dee4618346ab90f 100644
--- a/components/sync/model_impl/shared_model_type_processor.cc
+++ b/components/sync/model_impl/shared_model_type_processor.cc
@@ -12,11 +12,13 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "components/sync/base/hash_util.h"
#include "components/sync/engine/activation_context.h"
#include "components/sync/engine/commit_queue.h"
#include "components/sync/engine/model_type_processor_proxy.h"
#include "components/sync/model_impl/processor_entity_tracker.h"
+#include "components/sync/protocol/proto_memory_estimations.h"
namespace syncer {
@@ -664,4 +666,13 @@ ProcessorEntityTracker* SharedModelTypeProcessor::CreateEntity(
return CreateEntity(bridge_->GetStorageKey(data), data);
}
+size_t SharedModelTypeProcessor::EstimateMemoryUsage() const {
+ using base::trace_event::EstimateMemoryUsage;
+ size_t memory_usage = 0;
+ memory_usage += EstimateMemoryUsage(model_type_state_);
+ memory_usage += EstimateMemoryUsage(entities_);
+ memory_usage += EstimateMemoryUsage(storage_key_to_tag_hash_);
+ return memory_usage;
+}
+
} // namespace syncer
« no previous file with comments | « components/sync/model_impl/shared_model_type_processor.h ('k') | components/sync/protocol/proto_memory_estimations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698