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

Unified Diff: components/sync/driver/glue/sync_backend_host_core.cc

Issue 2382443006: Sync MDP: implement MemoryDumpProvider
Patch Set: Created 4 years, 3 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/driver/glue/sync_backend_host_core.cc
diff --git a/components/sync/driver/glue/sync_backend_host_core.cc b/components/sync/driver/glue/sync_backend_host_core.cc
index 6bf962a14e09b3ff6231476bc48b148181364e20..22a8ff96fc1c48b15eec65ac1590f025185047d2 100644
--- a/components/sync/driver/glue/sync_backend_host_core.cc
+++ b/components/sync/driver/glue/sync_backend_host_core.cc
@@ -11,6 +11,7 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
+#include "base/trace_event/memory_dump_manager.h"
#include "components/data_use_measurement/core/data_use_user_data.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
@@ -130,6 +131,16 @@ SyncBackendHostCore::~SyncBackendHostCore() {
DCHECK(!sync_manager_.get());
}
+bool SyncBackendHostCore::OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* pmd) {
+ DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread());
+ if (!sync_manager_)
+ return false;
+ sync_manager_->OnMemoryDump(pmd);
+ return true;
+}
+
void SyncBackendHostCore::OnSyncCycleCompleted(
const syncer::SyncCycleSnapshot& snapshot) {
if (!sync_loop_)
@@ -436,6 +447,8 @@ void SyncBackendHostCore::DoInitialize(
args.cancelation_signal = &stop_syncing_signal_;
args.saved_nigori_state = std::move(options->saved_nigori_state);
sync_manager_->Init(&args);
+ base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
+ this, "SyncDirectory", sync_loop_->task_runner());
}
void SyncBackendHostCore::DoUpdateCredentials(
@@ -549,6 +562,9 @@ void SyncBackendHostCore::DoShutdown(syncer::ShutdownReason reason) {
void SyncBackendHostCore::DoDestroySyncManager(syncer::ShutdownReason reason) {
DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread());
+
+ base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
+ this);
if (sync_manager_) {
DisableDirectoryTypeDebugInfoForwarding();
save_changes_timer_.reset();
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.h ('k') | components/sync/protocol/proto_size_estimations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698