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

Unified Diff: chrome/browser/webdata/autofill_profile_syncable_service.cc

Issue 8274020: Revert 105404 - [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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/webdata/autofill_profile_syncable_service.cc
===================================================================
--- chrome/browser/webdata/autofill_profile_syncable_service.cc (revision 105407)
+++ chrome/browser/webdata/autofill_profile_syncable_service.cc (working copy)
@@ -38,7 +38,8 @@
AutofillProfileSyncableService::AutofillProfileSyncableService(
WebDataService* web_data_service)
- : web_data_service_(web_data_service) {
+ : web_data_service_(web_data_service),
+ sync_processor_(NULL) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
DCHECK(web_data_service_);
notification_registrar_.Add(this,
@@ -51,7 +52,8 @@
}
AutofillProfileSyncableService::AutofillProfileSyncableService()
- : web_data_service_(NULL) {
+ : web_data_service_(NULL),
+ sync_processor_(NULL) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
}
@@ -60,7 +62,7 @@
const SyncDataList& initial_sync_data,
SyncChangeProcessor* sync_processor) {
DCHECK(CalledOnValidThread());
- DCHECK(!sync_processor_.get());
+ DCHECK(sync_processor_ == NULL);
VLOG(1) << "Associating Autofill: MergeDataAndStartSyncing";
if (!LoadAutofillData(&profiles_.get())) {
@@ -83,7 +85,7 @@
}
}
- sync_processor_.reset(sync_processor);
+ sync_processor_ = sync_processor;
GUIDToProfileMap remaining_profiles;
CreateGUIDToProfileMap(profiles_.get(), &remaining_profiles);
@@ -110,9 +112,7 @@
profiles_map_[i->first] = i->second;
}
- SyncError error;
- if (!new_changes.empty())
- error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
+ SyncError error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
WebDataService::NotifyOfMultipleAutofillChanges(web_data_service_);
@@ -121,9 +121,10 @@
void AutofillProfileSyncableService::StopSyncing(syncable::ModelType type) {
DCHECK(CalledOnValidThread());
+ DCHECK(sync_processor_ != NULL);
DCHECK_EQ(type, syncable::AUTOFILL_PROFILE);
- sync_processor_.reset();
+ sync_processor_ = NULL;
profiles_.reset();
profiles_map_.clear();
}
@@ -131,7 +132,7 @@
SyncDataList AutofillProfileSyncableService::GetAllSyncData(
syncable::ModelType type) const {
DCHECK(CalledOnValidThread());
- DCHECK(sync_processor_.get());
+ DCHECK(sync_processor_ != NULL);
DCHECK_EQ(type, syncable::AUTOFILL_PROFILE);
SyncDataList current_data;
@@ -147,7 +148,8 @@
const tracked_objects::Location& from_here,
const SyncChangeList& change_list) {
DCHECK(CalledOnValidThread());
- if (!sync_processor_.get()) {
+ DCHECK(sync_processor_ != NULL);
+ if (sync_processor_ == NULL) {
SyncError error(FROM_HERE, "Models not yet associated.",
syncable::AUTOFILL_PROFILE);
return error;
@@ -194,7 +196,7 @@
// 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_.get())
+ if (!sync_processor_)
return;
AutofillProfileChange* change = Details<AutofillProfileChange>(details).ptr();
@@ -349,7 +351,7 @@
DCHECK((change.type() == AutofillProfileChange::REMOVE &&
!change.profile()) ||
(change.type() != AutofillProfileChange::REMOVE && change.profile()));
- DCHECK(sync_processor_.get());
+ DCHECK(sync_processor_);
SyncChangeList new_changes;
DataBundle bundle;
switch (change.type()) {

Powered by Google App Engine
This is Rietveld 408576698