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

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

Issue 2489433002: [Sync] Move thread checking into the ModelSafeWorker interface. (Closed)
Patch Set: Improve/add 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 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 #include "components/sync/driver/glue/sync_backend_host_impl.h" 5 #include "components/sync/driver/glue/sync_backend_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 SyncBackendHostImpl::~SyncBackendHostImpl() { 68 SyncBackendHostImpl::~SyncBackendHostImpl() {
69 DCHECK(!core_.get() && !frontend_) << "Must call Shutdown before destructor."; 69 DCHECK(!core_.get() && !frontend_) << "Must call Shutdown before destructor.";
70 DCHECK(!registrar_.get()); 70 DCHECK(!registrar_.get());
71 } 71 }
72 72
73 void SyncBackendHostImpl::Initialize( 73 void SyncBackendHostImpl::Initialize(
74 SyncFrontend* frontend, 74 SyncFrontend* frontend,
75 base::Thread* sync_thread, 75 base::Thread* sync_thread,
76 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread,
77 const scoped_refptr<base::SingleThreadTaskRunner>& file_thread,
78 const WeakHandle<JsEventHandler>& event_handler, 76 const WeakHandle<JsEventHandler>& event_handler,
79 const GURL& sync_service_url, 77 const GURL& sync_service_url,
80 const std::string& sync_user_agent, 78 const std::string& sync_user_agent,
81 const SyncCredentials& credentials, 79 const SyncCredentials& credentials,
82 bool delete_sync_data_folder, 80 bool delete_sync_data_folder,
83 bool enable_local_sync_backend, 81 bool enable_local_sync_backend,
84 const base::FilePath& local_sync_backend_folder, 82 const base::FilePath& local_sync_backend_folder,
85 std::unique_ptr<SyncManagerFactory> sync_manager_factory, 83 std::unique_ptr<SyncManagerFactory> sync_manager_factory,
86 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, 84 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler,
87 const base::Closure& report_unrecoverable_error_function, 85 const base::Closure& report_unrecoverable_error_function,
88 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter, 86 const HttpPostProviderFactoryGetter& http_post_provider_factory_getter,
89 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) { 87 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state) {
90 CHECK(sync_thread); 88 CHECK(sync_thread);
91 sync_thread_ = sync_thread; 89 sync_thread_ = sync_thread;
92 90
93 registrar_ = base::MakeUnique<SyncBackendRegistrar>( 91 registrar_ = base::MakeUnique<SyncBackendRegistrar>(name_, sync_client_);
94 name_, sync_client_, ui_thread_, db_thread, file_thread);
95 92
96 DCHECK(frontend); 93 DCHECK(frontend);
97 frontend_ = frontend; 94 frontend_ = frontend;
98 95
99 std::vector<scoped_refptr<ModelSafeWorker>> workers; 96 std::vector<scoped_refptr<ModelSafeWorker>> workers;
100 registrar_->GetWorkers(&workers); 97 registrar_->GetWorkers(&workers);
101 98
102 EngineComponentsFactory::Switches factory_switches = { 99 EngineComponentsFactory::Switches factory_switches = {
103 EngineComponentsFactory::ENCRYPTION_KEYSTORE, 100 EngineComponentsFactory::ENCRYPTION_KEYSTORE,
104 EngineComponentsFactory::BACKOFF_NORMAL}; 101 EngineComponentsFactory::BACKOFF_NORMAL};
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 const SyncManager::ClearServerDataCallback& frontend_callback) { 805 const SyncManager::ClearServerDataCallback& frontend_callback) {
809 DCHECK(ui_thread_->BelongsToCurrentThread()); 806 DCHECK(ui_thread_->BelongsToCurrentThread());
810 frontend_callback.Run(); 807 frontend_callback.Run();
811 } 808 }
812 809
813 } // namespace syncer 810 } // namespace syncer
814 811
815 #undef SDVLOG 812 #undef SDVLOG
816 813
817 #undef SLOG 814 #undef SLOG
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698