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

Unified Diff: components/sync/engine_impl/model_type_worker.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/engine_impl/model_type_worker.cc
diff --git a/components/sync/engine_impl/model_type_worker.cc b/components/sync/engine_impl/model_type_worker.cc
index e7f364d1b9433224b5b97b91cd316db06f8f3748..3f0856f9a03bafe38786551eb60e009d417b13f1 100644
--- a/components/sync/engine_impl/model_type_worker.cc
+++ b/components/sync/engine_impl/model_type_worker.cc
@@ -16,11 +16,13 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "components/sync/base/time.h"
#include "components/sync/engine/model_type_processor.h"
#include "components/sync/engine_impl/commit_contribution.h"
#include "components/sync/engine_impl/non_blocking_type_commit_contribution.h"
#include "components/sync/engine_impl/worker_entity_tracker.h"
+#include "components/sync/protocol/proto_memory_estimations.h"
#include "components/sync/syncable/syncable_util.h"
namespace syncer {
@@ -330,6 +332,15 @@ void ModelTypeWorker::AbortMigration() {
nudge_handler_->NudgeForInitialDownload(type_);
}
+size_t ModelTypeWorker::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(pending_updates_);
+ return memory_usage;
+}
+
base::WeakPtr<ModelTypeWorker> ModelTypeWorker::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
« no previous file with comments | « components/sync/engine_impl/model_type_worker.h ('k') | components/sync/engine_impl/worker_entity_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698