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

Side by Side Diff: components/browser_sync/browser/profile_sync_service.cc

Issue 2289143003: [Sync] Convert DTCs to be not RefCounted and NonThreadSafe. (Closed)
Patch Set: Rebase, address comments, remove TestMessageLoop. Created 4 years, 3 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 (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 "components/browser_sync/browser/profile_sync_service.h" 5 #include "components/browser_sync/browser/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 signin()->AddObserver(this); 417 signin()->AddObserver(this);
418 } 418 }
419 419
420 void ProfileSyncService::UnregisterAuthNotifications() { 420 void ProfileSyncService::UnregisterAuthNotifications() {
421 if (signin()) 421 if (signin())
422 signin()->RemoveObserver(this); 422 signin()->RemoveObserver(this);
423 oauth2_token_service_->RemoveObserver(this); 423 oauth2_token_service_->RemoveObserver(this);
424 } 424 }
425 425
426 void ProfileSyncService::RegisterDataTypeController( 426 void ProfileSyncService::RegisterDataTypeController(
427 sync_driver::DataTypeController* data_type_controller) { 427 std::unique_ptr<sync_driver::DataTypeController> data_type_controller) {
428 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U); 428 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
skym 2016/09/02 22:45:28 Ugh, count(...). What do you think of find?
maxbogue 2016/09/03 00:14:51 Didn't compile for some reason... "error: no match
429 data_type_controllers_[data_type_controller->type()] = data_type_controller; 429 data_type_controllers_[data_type_controller->type()] =
430 std::move(data_type_controller);
430 } 431 }
431 432
432 bool ProfileSyncService::IsDataTypeControllerRunning( 433 bool ProfileSyncService::IsDataTypeControllerRunning(
433 syncer::ModelType type) const { 434 syncer::ModelType type) const {
434 DataTypeController::TypeMap::const_iterator iter = 435 DataTypeController::TypeMap::const_iterator iter =
435 data_type_controllers_.find(type); 436 data_type_controllers_.find(type);
436 if (iter == data_type_controllers_.end()) { 437 if (iter == data_type_controllers_.end()) {
437 return false; 438 return false;
438 } 439 }
439 return iter->second->state() == DataTypeController::RUNNING; 440 return iter->second->state() == DataTypeController::RUNNING;
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2530 if (--outstanding_setup_in_progress_handles_ != 0) 2531 if (--outstanding_setup_in_progress_handles_ != 0)
2531 return; 2532 return;
2532 2533
2533 DCHECK(startup_controller_->IsSetupInProgress()); 2534 DCHECK(startup_controller_->IsSetupInProgress());
2534 startup_controller_->SetSetupInProgress(false); 2535 startup_controller_->SetSetupInProgress(false);
2535 2536
2536 if (IsBackendInitialized()) 2537 if (IsBackendInitialized())
2537 ReconfigureDatatypeManager(); 2538 ReconfigureDatatypeManager();
2538 NotifyObservers(); 2539 NotifyObservers();
2539 } 2540 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698