| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // routing_info, if it does not already exist. | 130 // routing_info, if it does not already exist. |
| 131 if (routing_info_.count(*it) == 0) { | 131 if (routing_info_.count(*it) == 0) { |
| 132 routing_info_[*it] = GROUP_PASSIVE; | 132 routing_info_[*it] = GROUP_PASSIVE; |
| 133 newly_added_types.insert(*it); | 133 newly_added_types.insert(*it); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 for (syncable::ModelTypeSet::const_iterator it = types_to_remove.begin(); | 136 for (syncable::ModelTypeSet::const_iterator it = types_to_remove.begin(); |
| 137 it != types_to_remove.end(); ++it) { | 137 it != types_to_remove.end(); ++it) { |
| 138 routing_info_.erase(*it); | 138 routing_info_.erase(*it); |
| 139 } | 139 } |
| 140 |
| 141 VLOG(1) << "Adding types " << syncable::ModelTypeSetToString(types_to_add) |
| 142 << " (with newly-added types " |
| 143 << syncable::ModelTypeSetToString(newly_added_types) |
| 144 << ") and removing types " |
| 145 << syncable::ModelTypeSetToString(types_to_remove) |
| 146 << " to get new routing info " |
| 147 << ModelSafeRoutingInfoToString(routing_info_); |
| 148 |
| 140 return newly_added_types; | 149 return newly_added_types; |
| 141 } | 150 } |
| 142 | 151 |
| 143 void SyncBackendRegistrar::StopOnUIThread() { | 152 void SyncBackendRegistrar::StopOnUIThread() { |
| 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 145 DCHECK(!stopped_on_ui_thread_); | 154 DCHECK(!stopped_on_ui_thread_); |
| 146 ui_worker_->Stop(); | 155 ui_worker_->Stop(); |
| 147 stopped_on_ui_thread_ = true; | 156 stopped_on_ui_thread_ = true; |
| 148 } | 157 } |
| 149 | 158 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 247 } |
| 239 | 248 |
| 240 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( | 249 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( |
| 241 syncable::ModelType model_type) const { | 250 syncable::ModelType model_type) const { |
| 242 lock_.AssertAcquired(); | 251 lock_.AssertAcquired(); |
| 243 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); | 252 return IsOnThreadForGroup(GetGroupForModelType(model_type, routing_info_)); |
| 244 } | 253 } |
| 245 | 254 |
| 246 } // namespace browser_sync | 255 } // namespace browser_sync |
| 247 | 256 |
| OLD | NEW |