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

Unified Diff: chrome/browser/sync/glue/autofill_profile_syncable_service.cc

Issue 8065016: [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reffffactor Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/autofill_profile_syncable_service.cc
diff --git a/chrome/browser/sync/glue/autofill_profile_syncable_service.cc b/chrome/browser/sync/glue/autofill_profile_syncable_service.cc
index b0bcb7d9f2fe8b34d46be5b405811d85db71c445..4d3faccad7a6495aaf619b3d75f32e21037873aa 100644
--- a/chrome/browser/sync/glue/autofill_profile_syncable_service.cc
+++ b/chrome/browser/sync/glue/autofill_profile_syncable_service.cc
@@ -42,8 +42,7 @@ AutofillProfileSyncableService::AutofillProfileSyncableService(
WebDatabase* web_database,
Profile* profile)
: web_database_(web_database),
- profile_(profile),
- sync_processor_(NULL) {
+ profile_(profile) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(web_database_);
DCHECK(profile);
@@ -59,8 +58,7 @@ AutofillProfileSyncableService::~AutofillProfileSyncableService() {
AutofillProfileSyncableService::AutofillProfileSyncableService()
: web_database_(NULL),
- profile_(NULL),
- sync_processor_(NULL) {
+ profile_(NULL) {
}
SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
@@ -68,7 +66,7 @@ SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
const SyncDataList& initial_sync_data,
SyncChangeProcessor* sync_processor) {
DCHECK(CalledOnValidThread());
- DCHECK(sync_processor_ == NULL);
+ DCHECK(!sync_processor_.get());
VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing";
if (!LoadAutofillData(&profiles_.get())) {
@@ -91,7 +89,7 @@ SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
}
}
- sync_processor_ = sync_processor;
+ sync_processor_.reset(sync_processor);
GUIDToProfileMap remaining_profiles;
CreateGUIDToProfileMap(profiles_.get(), &remaining_profiles);
@@ -127,10 +125,9 @@ SyncError AutofillProfileSyncableService::MergeDataAndStartSyncing(
void AutofillProfileSyncableService::StopSyncing(syncable::ModelType type) {
DCHECK(CalledOnValidThread());
- DCHECK(sync_processor_ != NULL);
DCHECK_EQ(type, syncable::AUTOFILL_PROFILE);
- sync_processor_ = NULL;
+ sync_processor_.reset();
profiles_.reset();
profiles_map_.clear();
}
@@ -138,7 +135,7 @@ void AutofillProfileSyncableService::StopSyncing(syncable::ModelType type) {
SyncDataList AutofillProfileSyncableService::GetAllSyncData(
syncable::ModelType type) const {
DCHECK(CalledOnValidThread());
- DCHECK(sync_processor_ != NULL);
+ DCHECK(sync_processor_.get());
DCHECK_EQ(type, syncable::AUTOFILL_PROFILE);
SyncDataList current_data;
@@ -154,8 +151,7 @@ SyncError AutofillProfileSyncableService::ProcessSyncChanges(
const tracked_objects::Location& from_here,
const SyncChangeList& change_list) {
DCHECK(CalledOnValidThread());
- DCHECK(sync_processor_ != NULL);
- if (sync_processor_ == NULL) {
+ if (!sync_processor_.get()) {
SyncError error(FROM_HERE, "Models not yet associated.",
syncable::AUTOFILL_PROFILE);
return error;
@@ -201,7 +197,7 @@ void AutofillProfileSyncableService::Observe(int type,
// up we are going to process all when MergeData..() is called. If we receive
// notification after the sync exited, it will be sinced next time Chrome
// starts.
- if (!sync_processor_)
+ if (!sync_processor_.get())
return;
WebDataService* wds = Source<WebDataService>(source).ptr();
@@ -360,7 +356,7 @@ void AutofillProfileSyncableService::ActOnChange(
DCHECK((change.type() == AutofillProfileChange::REMOVE &&
!change.profile()) ||
(change.type() != AutofillProfileChange::REMOVE && change.profile()));
- DCHECK(sync_processor_);
+ DCHECK(sync_processor_.get());
SyncChangeList new_changes;
DataBundle bundle;
switch (change.type()) {

Powered by Google App Engine
This is Rietveld 408576698