| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // GROUP_PASSIVE worker does work on sync_loop_. But sync_loop_ is not | 87 // GROUP_PASSIVE worker does work on sync_loop_. But sync_loop_ is not |
| 88 // stopped until all workers have stopped. To break the cycle, use UI loop | 88 // stopped until all workers have stopped. To break the cycle, use UI loop |
| 89 // instead. | 89 // instead. |
| 90 workers_[syncer::GROUP_PASSIVE] = | 90 workers_[syncer::GROUP_PASSIVE] = |
| 91 new syncer::PassiveModelWorker(sync_thread_->message_loop(), this); | 91 new syncer::PassiveModelWorker(sync_thread_->message_loop(), this); |
| 92 workers_[syncer::GROUP_PASSIVE]->RegisterForLoopDestruction(); | 92 workers_[syncer::GROUP_PASSIVE]->RegisterForLoopDestruction(); |
| 93 | 93 |
| 94 // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. | 94 // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. |
| 95 tracked_objects::ScopedTracker tracker2(FROM_HERE_WITH_EXPLICIT_FUNCTION( | 95 tracked_objects::ScopedTracker tracker2(FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 96 "426272 SyncBackendRegistrar::ctor history")); | 96 "426272 SyncBackendRegistrar::ctor history")); |
| 97 HistoryService* history_service = | 97 HistoryService* history_service = HistoryServiceFactory::GetForProfile( |
| 98 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 98 profile, ServiceAccessType::IMPLICIT_ACCESS); |
| 99 if (history_service) { | 99 if (history_service) { |
| 100 workers_[syncer::GROUP_HISTORY] = | 100 workers_[syncer::GROUP_HISTORY] = |
| 101 new HistoryModelWorker(history_service->AsWeakPtr(), this); | 101 new HistoryModelWorker(history_service->AsWeakPtr(), this); |
| 102 workers_[syncer::GROUP_HISTORY]->RegisterForLoopDestruction(); | 102 workers_[syncer::GROUP_HISTORY]->RegisterForLoopDestruction(); |
| 103 | 103 |
| 104 } | 104 } |
| 105 | 105 |
| 106 // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. | 106 // TODO(pavely): Remove ScopedTracker below once crbug.com/426272 is fixed. |
| 107 tracked_objects::ScopedTracker tracker3(FROM_HERE_WITH_EXPLICIT_FUNCTION( | 107 tracked_objects::ScopedTracker tracker3(FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 108 "426272 SyncBackendRegistrar::ctor passwords")); | 108 "426272 SyncBackendRegistrar::ctor passwords")); |
| 109 scoped_refptr<password_manager::PasswordStore> password_store = | 109 scoped_refptr<password_manager::PasswordStore> password_store = |
| 110 PasswordStoreFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 110 PasswordStoreFactory::GetForProfile(profile, |
| 111 ServiceAccessType::IMPLICIT_ACCESS); |
| 111 if (password_store.get()) { | 112 if (password_store.get()) { |
| 112 workers_[syncer::GROUP_PASSWORD] = | 113 workers_[syncer::GROUP_PASSWORD] = |
| 113 new PasswordModelWorker(password_store, this); | 114 new PasswordModelWorker(password_store, this); |
| 114 workers_[syncer::GROUP_PASSWORD]->RegisterForLoopDestruction(); | 115 workers_[syncer::GROUP_PASSWORD]->RegisterForLoopDestruction(); |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 | 118 |
| 118 void SyncBackendRegistrar::SetInitialTypes(syncer::ModelTypeSet initial_types) { | 119 void SyncBackendRegistrar::SetInitialTypes(syncer::ModelTypeSet initial_types) { |
| 119 base::AutoLock lock(lock_); | 120 base::AutoLock lock(lock_); |
| 120 | 121 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 base::Bind(&SyncBackendRegistrar::OnWorkerUnregistrationDone, | 378 base::Bind(&SyncBackendRegistrar::OnWorkerUnregistrationDone, |
| 378 base::Unretained(this))); | 379 base::Unretained(this))); |
| 379 } | 380 } |
| 380 } | 381 } |
| 381 | 382 |
| 382 base::Thread* SyncBackendRegistrar::sync_thread() { | 383 base::Thread* SyncBackendRegistrar::sync_thread() { |
| 383 return sync_thread_.get(); | 384 return sync_thread_.get(); |
| 384 } | 385 } |
| 385 | 386 |
| 386 } // namespace browser_sync | 387 } // namespace browser_sync |
| OLD | NEW |