Commit d861dad1 authored by Olivier Li's avatar Olivier Li Committed by Commit Bot

SyncEngineBackend::OnMemoryDump should not assume Thread affinity.

This is ground work for experimenting with running ProfileSyncEngine's backend work on the ThreadPool.

This is done as the last mile of the chrome-wide effort to coalesce as much work as possible
to the ThreadPool.

For the change that will enable the experiment please refer to: https://chromium-review.googlesource.com/c/chromium/src/+/1856922

Bug: 1014464
Change-Id: I60e8081eefe40c90fc258aa9ac0467f910ca3356
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872410Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Oliver Li <olivierli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708173}
parent 48d4fdc9
......@@ -10,8 +10,8 @@
#include "base/files/file_util.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
#include "base/sequenced_task_runner.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
......@@ -80,7 +80,7 @@ SyncEngineBackend::SyncEngineBackend(const std::string& name,
const base::WeakPtr<SyncEngineImpl>& host)
: name_(name), sync_data_folder_(sync_data_folder), host_(host) {
DCHECK(host);
// This is constructed on the UI thread but used from the sync thread.
// This is constructed on the UI thread but used from another thread.
DETACH_FROM_SEQUENCE(sequence_checker_);
}
......@@ -380,8 +380,9 @@ void SyncEngineBackend::DoInitialize(SyncEngine::InitParams params) {
args.birthday = params.birthday;
args.bag_of_chips = params.bag_of_chips;
sync_manager_->Init(&args);
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
this, "SyncDirectory", base::ThreadTaskRunnerHandle::Get());
base::trace_event::MemoryDumpManager::GetInstance()
->RegisterDumpProviderWithSequencedTaskRunner(
this, "SyncDirectory", base::SequencedTaskRunnerHandle::Get(), {});
}
void SyncEngineBackend::DoUpdateCredentials(
......@@ -389,7 +390,7 @@ void SyncEngineBackend::DoUpdateCredentials(
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// UpdateCredentials can be called during backend initialization, possibly
// when backend initialization has failed but hasn't notified the UI thread
// yet. In that case, the sync manager may have been destroyed on the sync
// yet. In that case, the sync manager may have been destroyed on another
// thread before this task was executed, so we do nothing.
if (sync_manager_) {
sync_manager_->UpdateCredentials(credentials);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment