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

Side by Side Diff: components/sync/driver/glue/sync_backend_registrar.cc

Issue 2427803002: [Sync] Replacing NULL with nullptr in code and null in comments for components/sync/ (Closed)
Patch Set: Fixing start of sentence capitlization. Created 4 years, 2 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/sync/driver/glue/sync_backend_registrar.h" 5 #include "components/sync/driver/glue/sync_backend_registrar.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstddef> 8 #include <cstddef>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 DCHECK(ui_thread_->BelongsToCurrentThread() || IsControlType(type)); 201 DCHECK(ui_thread_->BelongsToCurrentThread() || IsControlType(type));
202 base::AutoLock lock(lock_); 202 base::AutoLock lock(lock_);
203 203
204 routing_info_.erase(type); 204 routing_info_.erase(type);
205 ignore_result(processors_.erase(type)); 205 ignore_result(processors_.erase(type));
206 DCHECK(!GetProcessorUnsafe(type)); 206 DCHECK(!GetProcessorUnsafe(type));
207 } 207 }
208 208
209 bool SyncBackendRegistrar::IsTypeActivatedForTest(ModelType type) const { 209 bool SyncBackendRegistrar::IsTypeActivatedForTest(ModelType type) const {
210 return GetProcessor(type) != NULL; 210 return GetProcessor(type) != nullptr;
211 } 211 }
212 212
213 void SyncBackendRegistrar::OnChangesApplied( 213 void SyncBackendRegistrar::OnChangesApplied(
214 ModelType model_type, 214 ModelType model_type,
215 int64_t model_version, 215 int64_t model_version,
216 const BaseTransaction* trans, 216 const BaseTransaction* trans,
217 const ImmutableChangeRecordList& changes) { 217 const ImmutableChangeRecordList& changes) {
218 ChangeProcessor* processor = GetProcessor(model_type); 218 ChangeProcessor* processor = GetProcessor(model_type);
219 if (!processor) 219 if (!processor)
220 return; 220 return;
(...skipping 25 matching lines...) Expand all
246 void SyncBackendRegistrar::GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) { 246 void SyncBackendRegistrar::GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) {
247 base::AutoLock lock(lock_); 247 base::AutoLock lock(lock_);
248 ModelSafeRoutingInfo copy(routing_info_); 248 ModelSafeRoutingInfo copy(routing_info_);
249 out->swap(copy); 249 out->swap(copy);
250 } 250 }
251 251
252 ChangeProcessor* SyncBackendRegistrar::GetProcessor(ModelType type) const { 252 ChangeProcessor* SyncBackendRegistrar::GetProcessor(ModelType type) const {
253 base::AutoLock lock(lock_); 253 base::AutoLock lock(lock_);
254 ChangeProcessor* processor = GetProcessorUnsafe(type); 254 ChangeProcessor* processor = GetProcessorUnsafe(type);
255 if (!processor) 255 if (!processor)
256 return NULL; 256 return nullptr;
257 257
258 // We can only check if |processor| exists, as otherwise the type is 258 // We can only check if |processor| exists, as otherwise the type is
259 // mapped to GROUP_PASSIVE. 259 // mapped to GROUP_PASSIVE.
260 CHECK(IsCurrentThreadSafeForModel(type)); 260 CHECK(IsCurrentThreadSafeForModel(type));
261 return processor; 261 return processor;
262 } 262 }
263 263
264 ChangeProcessor* SyncBackendRegistrar::GetProcessorUnsafe( 264 ChangeProcessor* SyncBackendRegistrar::GetProcessorUnsafe(
265 ModelType type) const { 265 ModelType type) const {
266 lock_.AssertAcquired(); 266 lock_.AssertAcquired();
267 std::map<ModelType, ChangeProcessor*>::const_iterator it = 267 std::map<ModelType, ChangeProcessor*>::const_iterator it =
268 processors_.find(type); 268 processors_.find(type);
269 269
270 // Until model association happens for a datatype, it will not 270 // Until model association happens for a datatype, it will not
271 // appear in the processors list. During this time, it is OK to 271 // appear in the processors list. During this time, it is OK to
272 // drop changes on the floor (since model association has not 272 // drop changes on the floor (since model association has not
273 // happened yet). When the data type is activated, model 273 // happened yet). When the data type is activated, model
274 // association takes place then the change processor is added to the 274 // association takes place then the change processor is added to the
275 // |processors_| list. 275 // |processors_| list.
276 if (it == processors_.end()) 276 if (it == processors_.end())
277 return NULL; 277 return nullptr;
278 278
279 return it->second; 279 return it->second;
280 } 280 }
281 281
282 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel( 282 bool SyncBackendRegistrar::IsCurrentThreadSafeForModel(
283 ModelType model_type) const { 283 ModelType model_type) const {
284 lock_.AssertAcquired(); 284 lock_.AssertAcquired();
285 return IsOnThreadForGroup(model_type, 285 return IsOnThreadForGroup(model_type,
286 GetGroupForModelType(model_type, routing_info_)); 286 GetGroupForModelType(model_type, routing_info_));
287 } 287 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 base::Thread* SyncBackendRegistrar::sync_thread() { 374 base::Thread* SyncBackendRegistrar::sync_thread() {
375 return sync_thread_.get(); 375 return sync_thread_.get();
376 } 376 }
377 377
378 ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType( 378 ModelSafeGroup SyncBackendRegistrar::GetInitialGroupForType(
379 ModelType type) const { 379 ModelType type) const {
380 return non_blocking_types_.Has(type) ? GROUP_NON_BLOCKING : GROUP_PASSIVE; 380 return non_blocking_types_.Has(type) ? GROUP_NON_BLOCKING : GROUP_PASSIVE;
381 } 381 }
382 382
383 } // namespace syncer 383 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_registrar.h ('k') | components/sync/driver/glue/sync_backend_registrar_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698