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

Unified Diff: components/sync/driver/sync_client.h

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/sync_client.h
diff --git a/components/sync/driver/sync_client.h b/components/sync/driver/sync_client.h
index ddf64d83d97675a279f0ec22c5b5b687b7e78974..c0030b4cc2a9d18614cc90ee9f38b55a019d4209 100644
--- a/components/sync/driver/sync_client.h
+++ b/components/sync/driver/sync_client.h
@@ -59,6 +59,8 @@ class SyncableService;
// to handle these scenarios gracefully.
class SyncClient {
public:
+ using ServiceProvider = base::Callback<base::WeakPtr<SyncableService>()>;
+
SyncClient();
virtual ~SyncClient();
@@ -100,11 +102,10 @@ class SyncClient {
virtual scoped_refptr<ExtensionsActivity> GetExtensionsActivity() = 0;
virtual sync_sessions::SyncSessionsClient* GetSyncSessionsClient() = 0;
- // Returns a weak pointer to the syncable service specified by |type|.
- // Weak pointer may be unset if service is already destroyed.
- // Note: Should only be dereferenced from the model type thread.
- virtual base::WeakPtr<SyncableService> GetSyncableServiceForType(
- ModelType type) = 0;
+ // Returns a callback to retrieve a syncable service specified by |type|.
+ // Both the provider and the resulting weak pointer will only be accessed on
+ // the model thread.
+ virtual ServiceProvider GetSyncableServiceForType(ModelType type) = 0;
// Returns a weak pointer to the ModelTypeSyncBridge specified by |type|. Weak
// pointer may be unset if service is already destroyed.
« no previous file with comments | « components/sync/driver/shared_change_processor_unittest.cc ('k') | ios/chrome/browser/sync/ios_chrome_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698