| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/sync_service_base.h" | 5 #include "components/sync/driver/sync_service_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 observers_.RemoveObserver(observer); | 80 observers_.RemoveObserver(observer); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool SyncServiceBase::HasObserver(const SyncServiceObserver* observer) const { | 83 bool SyncServiceBase::HasObserver(const SyncServiceObserver* observer) const { |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 84 DCHECK(thread_checker_.CalledOnValidThread()); |
| 85 return observers_.HasObserver(observer); | 85 return observers_.HasObserver(observer); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void SyncServiceBase::NotifyObservers() { | 88 void SyncServiceBase::NotifyObservers() { |
| 89 for (auto& observer : observers_) { | 89 for (auto& observer : observers_) { |
| 90 observer.OnStateChanged(); | 90 observer.OnStateChanged(this); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void SyncServiceBase::InitializeEngine() { | 94 void SyncServiceBase::InitializeEngine() { |
| 95 DCHECK(engine_); | 95 DCHECK(engine_); |
| 96 | 96 |
| 97 if (!sync_thread_) { | 97 if (!sync_thread_) { |
| 98 sync_thread_ = base::MakeUnique<base::Thread>("Chrome_SyncThread"); | 98 sync_thread_ = base::MakeUnique<base::Thread>("Chrome_SyncThread"); |
| 99 base::Thread::Options options; | 99 base::Thread::Options options; |
| 100 options.timer_slack = base::TIMER_SLACK_MAXIMUM; | 100 options.timer_slack = base::TIMER_SLACK_MAXIMUM; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void SyncServiceBase::ResetCryptoState() { | 172 void SyncServiceBase::ResetCryptoState() { |
| 173 crypto_ = base::MakeUnique<SyncServiceCrypto>( | 173 crypto_ = base::MakeUnique<SyncServiceCrypto>( |
| 174 base::BindRepeating(&SyncServiceBase::NotifyObservers, | 174 base::BindRepeating(&SyncServiceBase::NotifyObservers, |
| 175 base::Unretained(this)), | 175 base::Unretained(this)), |
| 176 base::BindRepeating(&SyncService::GetPreferredDataTypes, | 176 base::BindRepeating(&SyncService::GetPreferredDataTypes, |
| 177 base::Unretained(this)), | 177 base::Unretained(this)), |
| 178 &sync_prefs_); | 178 &sync_prefs_); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace syncer | 181 } // namespace syncer |
| OLD | NEW |