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

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

Issue 2538023002: [Sync] Pass a TaskRunner into SBHI/SBHC, not a thread or message loop. (Closed)
Patch Set: Created 4 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_IMPL_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 SyncClient* sync_client, 64 SyncClient* sync_client,
65 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, 65 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
66 invalidation::InvalidationService* invalidator, 66 invalidation::InvalidationService* invalidator,
67 const base::WeakPtr<SyncPrefs>& sync_prefs, 67 const base::WeakPtr<SyncPrefs>& sync_prefs,
68 const base::FilePath& sync_folder); 68 const base::FilePath& sync_folder);
69 ~SyncBackendHostImpl() override; 69 ~SyncBackendHostImpl() override;
70 70
71 // SyncBackendHost implementation. 71 // SyncBackendHost implementation.
72 void Initialize( 72 void Initialize(
73 SyncFrontend* frontend, 73 SyncFrontend* frontend,
74 base::Thread* sync_thread, 74 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner,
75 const WeakHandle<JsEventHandler>& event_handler, 75 const WeakHandle<JsEventHandler>& event_handler,
76 const GURL& service_url, 76 const GURL& service_url,
77 const std::string& sync_user_agent, 77 const std::string& sync_user_agent,
78 const SyncCredentials& credentials, 78 const SyncCredentials& credentials,
79 bool delete_sync_data_folder, 79 bool delete_sync_data_folder,
80 bool enable_local_sync_backend, 80 bool enable_local_sync_backend,
81 const base::FilePath& local_sync_backend_folder, 81 const base::FilePath& local_sync_backend_folder,
82 std::unique_ptr<SyncManagerFactory> sync_manager_factory, 82 std::unique_ptr<SyncManagerFactory> sync_manager_factory,
83 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, 83 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
84 const base::Closure& report_unrecoverable_error_function, 84 const base::Closure& report_unrecoverable_error_function,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 void ClearServerDataDoneOnFrontendLoop( 288 void ClearServerDataDoneOnFrontendLoop(
289 const SyncManager::ClearServerDataCallback& frontend_callback); 289 const SyncManager::ClearServerDataCallback& frontend_callback);
290 290
291 // A reference to the TaskRUnner used to construct |this|, so we know how to 291 // A reference to the TaskRUnner used to construct |this|, so we know how to
292 // safely talk back to the SyncFrontend. 292 // safely talk back to the SyncFrontend.
293 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_; 293 scoped_refptr<base::SingleThreadTaskRunner> const frontend_task_runner_;
294 294
295 SyncClient* const sync_client_; 295 SyncClient* const sync_client_;
296 296
297 // A pointer to the sync thread. 297 // The task runner where all the sync engine operations happen.
298 base::Thread* sync_thread_; 298 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner_;
299 299
300 // The UI thread's task runner. 300 // The UI thread's task runner.
301 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_; 301 const scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
302 302
303 // Name used for debugging (set from profile_->GetDebugName()). 303 // Name used for debugging (set from profile_->GetDebugName()).
304 const std::string name_; 304 const std::string name_;
305 305
306 // Our core, which communicates directly to the syncapi. Use refptr instead 306 // Our core, which communicates directly to the syncapi. Use refptr instead
307 // of WeakHandle because |core_| is created on UI loop but released on 307 // of WeakHandle because |core_| is created on UI loop but released on
308 // sync loop. 308 // sync loop.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 bool invalidation_handler_registered_; 348 bool invalidation_handler_registered_;
349 349
350 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_; 350 base::WeakPtrFactory<SyncBackendHostImpl> weak_ptr_factory_;
351 351
352 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl); 352 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostImpl);
353 }; 353 };
354 354
355 } // namespace syncer 355 } // namespace syncer
356 356
357 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_ 357 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698