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

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

Issue 2452713003: [Sync] Implement MemoryDumpProvider. (Closed)
Patch Set: Fix presumit; fix Windows; git cl format Created 4 years, 1 month 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
« no previous file with comments | « components/sync/driver/glue/sync_backend_host_core.h ('k') | components/sync/engine/fake_sync_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 519b5dff05dab241b9219b11ac506b617cf5b773..9771e18f4ec2414733b61668e877c274dc93b1e2 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"
@@ -128,6 +129,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 SyncCycleSnapshot& snapshot) {
if (!sync_loop_)
@@ -431,6 +442,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(
@@ -544,6 +557,8 @@ void SyncBackendHostCore::DoShutdown(ShutdownReason reason) {
void SyncBackendHostCore::DoDestroySyncManager(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/engine/fake_sync_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698