OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 5 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 HistoryService* history_service = | 73 HistoryService* history_service = |
74 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 74 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
75 if (history_service) { | 75 if (history_service) { |
76 workers_[syncer::GROUP_HISTORY] = | 76 workers_[syncer::GROUP_HISTORY] = |
77 new HistoryModelWorker(history_service->AsWeakPtr(), this); | 77 new HistoryModelWorker(history_service->AsWeakPtr(), this); |
78 } | 78 } |
79 | 79 |
80 scoped_refptr<PasswordStore> password_store = | 80 scoped_refptr<PasswordStore> password_store = |
81 PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 81 PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
82 if (password_store) { | 82 if (password_store.get()) { |
83 workers_[syncer::GROUP_PASSWORD] = new PasswordModelWorker(password_store, | 83 workers_[syncer::GROUP_PASSWORD] = |
84 this); | 84 new PasswordModelWorker(password_store, this); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void SyncBackendRegistrar::SetInitialTypes(syncer::ModelTypeSet initial_types) { | 88 void SyncBackendRegistrar::SetInitialTypes(syncer::ModelTypeSet initial_types) { |
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
90 base::AutoLock lock(lock_); | 90 base::AutoLock lock(lock_); |
91 | 91 |
92 // This function should be called only once, shortly after construction. The | 92 // This function should be called only once, shortly after construction. The |
93 // routing info at that point is expected to be emtpy. | 93 // routing info at that point is expected to be emtpy. |
94 DCHECK(routing_info_.empty()); | 94 DCHECK(routing_info_.empty()); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // further information. | 241 // further information. |
242 processor->CommitChangesFromSyncModel(); | 242 processor->CommitChangesFromSyncModel(); |
243 } | 243 } |
244 | 244 |
245 void SyncBackendRegistrar::GetWorkers( | 245 void SyncBackendRegistrar::GetWorkers( |
246 std::vector<syncer::ModelSafeWorker*>* out) { | 246 std::vector<syncer::ModelSafeWorker*>* out) { |
247 base::AutoLock lock(lock_); | 247 base::AutoLock lock(lock_); |
248 out->clear(); | 248 out->clear(); |
249 for (WorkerMap::const_iterator it = workers_.begin(); | 249 for (WorkerMap::const_iterator it = workers_.begin(); |
250 it != workers_.end(); ++it) { | 250 it != workers_.end(); ++it) { |
251 out->push_back(it->second); | 251 out->push_back(it->second.get()); |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 void SyncBackendRegistrar::GetModelSafeRoutingInfo( | 255 void SyncBackendRegistrar::GetModelSafeRoutingInfo( |
256 syncer::ModelSafeRoutingInfo* out) { | 256 syncer::ModelSafeRoutingInfo* out) { |
257 base::AutoLock lock(lock_); | 257 base::AutoLock lock(lock_); |
258 syncer::ModelSafeRoutingInfo copy(routing_info_); | 258 syncer::ModelSafeRoutingInfo copy(routing_info_); |
259 out->swap(copy); | 259 out->swap(copy); |
260 } | 260 } |
261 | 261 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 lock_.AssertAcquired(); | 295 lock_.AssertAcquired(); |
296 return IsOnThreadForGroup(model_type, | 296 return IsOnThreadForGroup(model_type, |
297 GetGroupForModelType(model_type, routing_info_)); | 297 GetGroupForModelType(model_type, routing_info_)); |
298 } | 298 } |
299 | 299 |
300 void SyncBackendRegistrar::OnWorkerLoopDestroyed(syncer::ModelSafeGroup group) { | 300 void SyncBackendRegistrar::OnWorkerLoopDestroyed(syncer::ModelSafeGroup group) { |
301 // Do nothing for now. | 301 // Do nothing for now. |
302 } | 302 } |
303 | 303 |
304 } // namespace browser_sync | 304 } // namespace browser_sync |
OLD | NEW |