Chromium Code Reviews| 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; |
|
Patrick Noland
2017/03/29 19:42:54
Should cryptographer be included, since the worker
pavely
2017/03/30 01:07:25
I Included fields that can grow arbitrarily large
|
| + 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(); |
| } |