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

Side by Side Diff: chrome/browser/sync/notifier/registration_manager.cc

Issue 8919021: [Sync] Rename ModelEnumSet to ModelTypeSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
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/notifier/registration_manager.h" 5 #include "chrome/browser/sync/notifier/registration_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstddef> 8 #include <cstddef>
9 #include <string> 9 #include <string>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 status->model_type = model_type; 63 status->model_type = model_type;
64 status->registration_manager = this; 64 status->registration_manager = this;
65 } 65 }
66 } 66 }
67 67
68 RegistrationManager::~RegistrationManager() { 68 RegistrationManager::~RegistrationManager() {
69 DCHECK(non_thread_safe_.CalledOnValidThread()); 69 DCHECK(non_thread_safe_.CalledOnValidThread());
70 } 70 }
71 71
72 void RegistrationManager::SetRegisteredTypes( 72 void RegistrationManager::SetRegisteredTypes(
73 syncable::ModelEnumSet types) { 73 syncable::ModelTypeSet types) {
74 DCHECK(non_thread_safe_.CalledOnValidThread()); 74 DCHECK(non_thread_safe_.CalledOnValidThread());
75 75
76 for (int i = syncable::FIRST_REAL_MODEL_TYPE; 76 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
77 i < syncable::MODEL_TYPE_COUNT; ++i) { 77 i < syncable::MODEL_TYPE_COUNT; ++i) {
78 syncable::ModelType model_type = syncable::ModelTypeFromInt(i); 78 syncable::ModelType model_type = syncable::ModelTypeFromInt(i);
79 if (types.Has(model_type)) { 79 if (types.Has(model_type)) {
80 if (!IsTypeRegistered(model_type)) { 80 if (!IsTypeRegistered(model_type)) {
81 TryRegisterType(model_type, false /* is_retry */); 81 TryRegisterType(model_type, false /* is_retry */);
82 } 82 }
83 } else { 83 } else {
(...skipping 27 matching lines...) Expand all
111 } 111 }
112 } 112 }
113 113
114 void RegistrationManager::DisableType(syncable::ModelType model_type) { 114 void RegistrationManager::DisableType(syncable::ModelType model_type) {
115 DCHECK(non_thread_safe_.CalledOnValidThread()); 115 DCHECK(non_thread_safe_.CalledOnValidThread());
116 RegistrationStatus* status = &registration_statuses_[model_type]; 116 RegistrationStatus* status = &registration_statuses_[model_type];
117 LOG(INFO) << "Disabling " << syncable::ModelTypeToString(model_type); 117 LOG(INFO) << "Disabling " << syncable::ModelTypeToString(model_type);
118 status->Disable(); 118 status->Disable();
119 } 119 }
120 120
121 syncable::ModelEnumSet RegistrationManager::GetRegisteredTypes() const { 121 syncable::ModelTypeSet RegistrationManager::GetRegisteredTypes() const {
122 DCHECK(non_thread_safe_.CalledOnValidThread()); 122 DCHECK(non_thread_safe_.CalledOnValidThread());
123 syncable::ModelEnumSet registered_types; 123 syncable::ModelTypeSet registered_types;
124 for (int i = syncable::FIRST_REAL_MODEL_TYPE; 124 for (int i = syncable::FIRST_REAL_MODEL_TYPE;
125 i < syncable::MODEL_TYPE_COUNT; ++i) { 125 i < syncable::MODEL_TYPE_COUNT; ++i) {
126 syncable::ModelType model_type = syncable::ModelTypeFromInt(i); 126 syncable::ModelType model_type = syncable::ModelTypeFromInt(i);
127 if (IsTypeRegistered(model_type)) { 127 if (IsTypeRegistered(model_type)) {
128 registered_types.Put(model_type); 128 registered_types.Put(model_type);
129 } 129 }
130 } 130 }
131 return registered_types; 131 return registered_types;
132 } 132 }
133 133
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 266
267 bool RegistrationManager::IsTypeRegistered( 267 bool RegistrationManager::IsTypeRegistered(
268 syncable::ModelType model_type) const { 268 syncable::ModelType model_type) const {
269 DCHECK(non_thread_safe_.CalledOnValidThread()); 269 DCHECK(non_thread_safe_.CalledOnValidThread());
270 return registration_statuses_[model_type].state == 270 return registration_statuses_[model_type].state ==
271 invalidation::InvalidationListener::REGISTERED; 271 invalidation::InvalidationListener::REGISTERED;
272 } 272 }
273 273
274 } // namespace sync_notifier 274 } // namespace sync_notifier
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/registration_manager.h ('k') | chrome/browser/sync/notifier/registration_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698