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

Side by Side Diff: components/sync/driver/glue/sync_backend_host.h

Issue 2481313002: [Sync] Move sync thread ownership to ProfileSyncService. (Closed)
Patch Set: Address comments. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ~SyncBackendHost() override; 52 ~SyncBackendHost() override;
53 53
54 // Called on the frontend's thread to kick off asynchronous initialization. 54 // Called on the frontend's thread to kick off asynchronous initialization.
55 // Optionally deletes the "Sync Data" folder during init in order to make 55 // Optionally deletes the "Sync Data" folder during init in order to make
56 // sure we're starting fresh. 56 // sure we're starting fresh.
57 // 57 //
58 // |saved_nigori_state| is optional nigori state to restore from a previous 58 // |saved_nigori_state| is optional nigori state to restore from a previous
59 // backend instance. May be null. 59 // backend instance. May be null.
60 virtual void Initialize( 60 virtual void Initialize(
61 SyncFrontend* frontend, 61 SyncFrontend* frontend,
62 std::unique_ptr<base::Thread> sync_thread, 62 base::Thread* sync_thread,
63 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, 63 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
64 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, 64 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread,
65 const WeakHandle<JsEventHandler>& event_handler, 65 const WeakHandle<JsEventHandler>& event_handler,
66 const GURL& service_url, 66 const GURL& service_url,
67 const std::string& sync_user_agent, 67 const std::string& sync_user_agent,
68 const SyncCredentials& credentials, 68 const SyncCredentials& credentials,
69 bool delete_sync_data_folder, 69 bool delete_sync_data_folder,
70 bool enable_local_sync_backend, 70 bool enable_local_sync_backend,
71 const base::FilePath& local_sync_backend_folder, 71 const base::FilePath& local_sync_backend_folder,
72 std::unique_ptr<SyncManagerFactory> sync_manager_factory, 72 std::unique_ptr<SyncManagerFactory> sync_manager_factory,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 WARN_UNUSED_RESULT = 0; 112 WARN_UNUSED_RESULT = 0;
113 113
114 // Called on |frontend_loop_| to kick off shutdown procedure. Attempts to cut 114 // Called on |frontend_loop_| to kick off shutdown procedure. Attempts to cut
115 // short any long-lived or blocking sync thread tasks so that the shutdown on 115 // short any long-lived or blocking sync thread tasks so that the shutdown on
116 // sync thread task that we're about to post won't have to wait very long. 116 // sync thread task that we're about to post won't have to wait very long.
117 virtual void StopSyncingForShutdown() = 0; 117 virtual void StopSyncingForShutdown() = 0;
118 118
119 // Called on |frontend_loop_| to kick off shutdown. 119 // Called on |frontend_loop_| to kick off shutdown.
120 // See the implementation and Core::DoShutdown for details. 120 // See the implementation and Core::DoShutdown for details.
121 // Must be called *after* StopSyncingForShutdown. 121 // Must be called *after* StopSyncingForShutdown.
122 // Transfers ownership of the sync thread to the caller which may reuse it 122 virtual void Shutdown(ShutdownReason reason) = 0;
123 // with a different SyncBackendHost or join it immediately.
124 virtual std::unique_ptr<base::Thread> Shutdown(ShutdownReason reason) = 0;
125 123
126 // Removes all current registrations from the backend on the 124 // Removes all current registrations from the backend on the
127 // InvalidationService. 125 // InvalidationService.
128 virtual void UnregisterInvalidationIds() = 0; 126 virtual void UnregisterInvalidationIds() = 0;
129 127
130 // Changes the set of data types that are currently being synced. 128 // Changes the set of data types that are currently being synced.
131 // The ready_task will be run when configuration is done with the 129 // The ready_task will be run when configuration is done with the
132 // set of all types that failed configuration (i.e., if its argument 130 // set of all types that failed configuration (i.e., if its argument
133 // is non-empty, then an error was encountered). 131 // is non-empty, then an error was encountered).
134 // Returns the set of types that are ready to start without needing any 132 // Returns the set of types that are ready to start without needing any
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 virtual void DisableProtocolEventForwarding() = 0; 187 virtual void DisableProtocolEventForwarding() = 0;
190 188
191 // Enables the sending of directory type debug counters. Also, for every 189 // Enables the sending of directory type debug counters. Also, for every
192 // time it is called, it makes an explicit request that updates to an update 190 // time it is called, it makes an explicit request that updates to an update
193 // for all counters be emitted. 191 // for all counters be emitted.
194 virtual void EnableDirectoryTypeDebugInfoForwarding() = 0; 192 virtual void EnableDirectoryTypeDebugInfoForwarding() = 0;
195 193
196 // Disables the sending of directory type debug counters. 194 // Disables the sending of directory type debug counters.
197 virtual void DisableDirectoryTypeDebugInfoForwarding() = 0; 195 virtual void DisableDirectoryTypeDebugInfoForwarding() = 0;
198 196
199 virtual base::MessageLoop* GetSyncLoopForTesting() = 0;
200
201 // Triggers sync cycle to update |types|. 197 // Triggers sync cycle to update |types|.
202 virtual void RefreshTypesForTest(ModelTypeSet types) = 0; 198 virtual void RefreshTypesForTest(ModelTypeSet types) = 0;
203 199
204 // See SyncManager::ClearServerData. 200 // See SyncManager::ClearServerData.
205 virtual void ClearServerData( 201 virtual void ClearServerData(
206 const SyncManager::ClearServerDataCallback& callback) = 0; 202 const SyncManager::ClearServerDataCallback& callback) = 0;
207 203
208 // Notify the syncer that the cookie jar has changed. 204 // Notify the syncer that the cookie jar has changed.
209 // See SyncManager::OnCookieJarChanged. 205 // See SyncManager::OnCookieJarChanged.
210 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; 206 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0;
211 207
212 private: 208 private:
213 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 209 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
214 }; 210 };
215 211
216 } // namespace syncer 212 } // namespace syncer
217 213
218 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_ 214 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_service_unittest.cc ('k') | components/sync/driver/glue/sync_backend_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698