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

Unified Diff: components/sync/driver/shared_change_processor.cc

Issue 2769113002: [Sync] Stop accessing BrowserContextKeyedServiceFactory on non-UI thread. (Closed)
Patch Set: Rebase and removing dependent patch set. 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/driver/shared_change_processor.cc
diff --git a/components/sync/driver/shared_change_processor.cc b/components/sync/driver/shared_change_processor.cc
index 6e473b5c8bd8e085297c9e62cf39cfc6aa215c5c..1a5ae1151c0e878223b7787206ee93f75db2c031 100644
--- a/components/sync/driver/shared_change_processor.cc
+++ b/components/sync/driver/shared_change_processor.cc
@@ -12,7 +12,6 @@
#include "components/sync/driver/generic_change_processor.h"
#include "components/sync/driver/generic_change_processor_factory.h"
#include "components/sync/driver/shared_change_processor_ref.h"
-#include "components/sync/driver/sync_client.h"
#include "components/sync/model/sync_change.h"
#include "components/sync/model/syncable_service.h"
@@ -51,8 +50,9 @@ SharedChangeProcessor::~SharedChangeProcessor() {
}
void SharedChangeProcessor::StartAssociation(
- StartDoneCallback start_done,
- SyncClient* const sync_client,
+ const StartDoneCallback& start_done,
+ const SyncClient::ServiceProvider& service_provider,
+ SyncApiComponentFactory* driver_factory,
GenericChangeProcessorFactory* processor_factory,
UserShare* user_share,
std::unique_ptr<DataTypeErrorHandler> error_handler) {
@@ -67,7 +67,7 @@ void SharedChangeProcessor::StartAssociation(
// disconnected at this point, so all our accesses to the syncer from this
// point on are through it.
local_service_ =
- Connect(sync_client, processor_factory, user_share,
+ Connect(service_provider, driver_factory, processor_factory, user_share,
std::move(error_handler), weak_ptr_factory.GetWeakPtr());
if (!local_service_.get()) {
SyncError error(FROM_HERE, SyncError::DATATYPE_ERROR,
@@ -139,31 +139,31 @@ void SharedChangeProcessor::StartAssociation(
}
base::WeakPtr<SyncableService> SharedChangeProcessor::Connect(
- SyncClient* sync_client,
+ const SyncClient::ServiceProvider& service_provider,
+ SyncApiComponentFactory* driver_factory,
GenericChangeProcessorFactory* processor_factory,
UserShare* user_share,
std::unique_ptr<DataTypeErrorHandler> error_handler,
const base::WeakPtr<SyncMergeResult>& merge_result) {
- DCHECK(sync_client);
DCHECK(error_handler);
backend_task_runner_ = base::SequencedTaskRunnerHandle::Get();
AutoLock lock(monitor_lock_);
if (disconnected_)
return base::WeakPtr<SyncableService>();
error_handler_ = std::move(error_handler);
- base::WeakPtr<SyncableService> local_service =
- sync_client->GetSyncableServiceForType(type_);
+ base::WeakPtr<SyncableService> local_service = service_provider.Run();
if (!local_service.get()) {
LOG(WARNING) << "SyncableService destroyed before DTC was stopped.";
disconnected_ = true;
return base::WeakPtr<SyncableService>();
}
- generic_change_processor_ = processor_factory
- ->CreateGenericChangeProcessor(
- type_, user_share, error_handler_->Copy(),
- local_service, merge_result, sync_client)
- .release();
+ generic_change_processor_ =
+ processor_factory
+ ->CreateGenericChangeProcessor(type_, user_share,
+ error_handler_->Copy(), local_service,
+ merge_result, driver_factory)
+ .release();
// If available, propagate attachment service to the syncable service.
std::unique_ptr<AttachmentService> attachment_service =
generic_change_processor_->GetAttachmentService();
« no previous file with comments | « components/sync/driver/shared_change_processor.h ('k') | components/sync/driver/shared_change_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698