diff options
7 files changed, 13 insertions, 131 deletions
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index 66c575d..406feaf 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -87,35 +87,7 @@ void AutofillDataTypeController::StartAssociating( ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile( profile()); DCHECK(sync); - scoped_refptr<autofill::AutofillWebDataService> web_data_service = - WebDataServiceFactory::GetAutofillWebDataForProfile( - profile(), Profile::EXPLICIT_ACCESS); - bool cull_expired_entries = sync->current_experiments().autofill_culling; - // First, post the update task to the DB thread, which guarantees us it - // would run before anything StartAssociating does (e.g. - // MergeDataAndStartSyncing). - PostTaskOnBackendThread( - FROM_HERE, - base::Bind( - &AutofillDataTypeController::UpdateAutofillCullingSettings, - this, - cull_expired_entries, - web_data_service)); NonUIDataTypeController::StartAssociating(start_callback); } -void AutofillDataTypeController::UpdateAutofillCullingSettings( - bool cull_expired_entries, - scoped_refptr<autofill::AutofillWebDataService> web_data_service) { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); - AutocompleteSyncableService* service = - AutocompleteSyncableService::FromWebDataService(web_data_service.get()); - if (!service) { - DVLOG(1) << "Can't update culling, no AutocompleteSyncableService."; - return; - } - - service->UpdateCullSetting(cull_expired_entries); -} - } // namespace browser_sync diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.h b/chrome/browser/sync/glue/autofill_data_type_controller.h index b35fbad..91ff0ee 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.h +++ b/chrome/browser/sync/glue/autofill_data_type_controller.h @@ -49,11 +49,6 @@ class AutofillDataTypeController FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSReady); FRIEND_TEST_ALL_PREFIXES(AutofillDataTypeControllerTest, StartWDSNotReady); - // Self-invoked on the DB thread to call the AutocompleteSyncableService with - // an updated value of autofill culling settings. - void UpdateAutofillCullingSettings(bool cull_expired_entries, - scoped_refptr<autofill::AutofillWebDataService> web_data_service); - // Callback once WebDatabase has loaded. void WebDatabaseLoaded(); diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index 479b4879..656fe1b 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -91,22 +91,6 @@ class FakeWebDataService : public AutofillWebDataService { run_loop.Run(); } - void GetAutofillCullingValue(bool* result) { - ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB)); - *result = AutocompleteSyncableService::FromWebDataService( - this)->cull_expired_entries(); - } - - bool CheckAutofillCullingValue() { - bool result = false; - base::RunLoop run_loop; - BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE, - base::Bind(&FakeWebDataService::GetAutofillCullingValue, - base::Unretained(this), &result), run_loop.QuitClosure()); - run_loop.Run(); - return result; - } - private: virtual ~FakeWebDataService() { } @@ -274,36 +258,6 @@ TEST_F(SyncAutofillDataTypeControllerTest, StartWDSNotReady) { EXPECT_EQ(DataTypeController::DISABLED, autofill_dtc_->state()); } -TEST_F(SyncAutofillDataTypeControllerTest, UpdateAutofillCullingSettings) { - FakeWebDataService* web_db = - static_cast<FakeWebDataService*>( - WebDataServiceFactory::GetAutofillWebDataForProfile( - &profile_, Profile::EXPLICIT_ACCESS).get()); - - // Set up the experiments state. - ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile( - &profile_); - syncer::Experiments experiments; - experiments.autofill_culling = true; - sync->OnExperimentsChanged(experiments); - - web_db->LoadDatabase(); - autofill_dtc_->LoadModels( - base::Bind(&SyncAutofillDataTypeControllerTest::OnLoadFinished, - weak_ptr_factory_.GetWeakPtr())); - - EXPECT_FALSE(web_db->CheckAutofillCullingValue()); - - EXPECT_CALL(*change_processor_.get(), Connect(_, _, _, _, _)) - .WillOnce(Return(base::WeakPtr<syncer::SyncableService>())); - autofill_dtc_->StartAssociating( - base::Bind(&SyncAutofillDataTypeControllerTest::OnStartFinished, - weak_ptr_factory_.GetWeakPtr())); - BlockForDBThread(); - - EXPECT_TRUE(web_db->CheckAutofillCullingValue()); -} - } // namespace } // namespace browser_sync diff --git a/chrome/browser/webdata/autocomplete_syncable_service.cc b/chrome/browser/webdata/autocomplete_syncable_service.cc index 0b63f07..c18f0c2 100644 --- a/chrome/browser/webdata/autocomplete_syncable_service.cc +++ b/chrome/browser/webdata/autocomplete_syncable_service.cc @@ -92,8 +92,7 @@ void* UserDataKey() { AutocompleteSyncableService::AutocompleteSyncableService( AutofillWebDataBackend* webdata_backend) : webdata_backend_(webdata_backend), - scoped_observer_(this), - cull_expired_entries_(false) { + scoped_observer_(this) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); DCHECK(webdata_backend_); @@ -121,8 +120,7 @@ AutocompleteSyncableService* AutocompleteSyncableService::FromWebDataService( AutocompleteSyncableService::AutocompleteSyncableService() : webdata_backend_(NULL), - scoped_observer_(this), - cull_expired_entries_(false) { + scoped_observer_(this) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); } @@ -190,14 +188,12 @@ syncer::SyncMergeResult AutocompleteSyncableService::MergeDataAndStartSyncing( merge_result.set_error( sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes)); - if (cull_expired_entries_) { - // This will schedule a deletion operation on the DB thread, which will - // trigger a notification to propagate the deletion to Sync. - // NOTE: This must be called *after* the ProcessSyncChanges call above. - // Otherwise, an item that Sync is not yet aware of might expire, causing a - // Sync error when that item's deletion is propagated to Sync. - webdata_backend_->RemoveExpiredFormElements(); - } + // This will schedule a deletion operation on the DB thread, which will + // trigger a notification to propagate the deletion to Sync. + // NOTE: This must be called *after* the ProcessSyncChanges call above. + // Otherwise, an item that Sync is not yet aware of might expire, causing a + // Sync error when that item's deletion is propagated to Sync. + webdata_backend_->RemoveExpiredFormElements(); return merge_result; } @@ -302,11 +298,9 @@ syncer::SyncError AutocompleteSyncableService::ProcessSyncChanges( webdata_backend_->NotifyOfMultipleAutofillChanges(); - if (cull_expired_entries_) { - // This will schedule a deletion operation on the DB thread, which will - // trigger a notification to propagate the deletion to Sync. - webdata_backend_->RemoveExpiredFormElements(); - } + // This will schedule a deletion operation on the DB thread, which will + // trigger a notification to propagate the deletion to Sync. + webdata_backend_->RemoveExpiredFormElements(); return list_processing_error; } @@ -469,12 +463,6 @@ void AutocompleteSyncableService::ActOnChanges( } } -void AutocompleteSyncableService::UpdateCullSetting( - bool cull_expired_entries) { - DCHECK(CalledOnValidThread()); - cull_expired_entries_ = cull_expired_entries; -} - syncer::SyncData AutocompleteSyncableService::CreateSyncData( const AutofillEntry& entry) const { sync_pb::EntitySpecifics autofill_specifics; diff --git a/chrome/browser/webdata/autocomplete_syncable_service.h b/chrome/browser/webdata/autocomplete_syncable_service.h index 94c8cd3..ecc7592 100644 --- a/chrome/browser/webdata/autocomplete_syncable_service.h +++ b/chrome/browser/webdata/autocomplete_syncable_service.h @@ -76,11 +76,6 @@ class AutocompleteSyncableService virtual void AutofillEntriesChanged( const autofill::AutofillChangeList& changes) OVERRIDE; - // Called via sync to tell us if we should cull expired entries when merging - // and/or processing sync changes. - void UpdateCullSetting(bool cull_expired_entries); - bool cull_expired_entries() const { return cull_expired_entries_; } - // Provides a StartSyncFlare to the SyncableService. See // sync_start_util for more. void InjectStartSyncFlare( @@ -168,10 +163,6 @@ class AutocompleteSyncableService // destroy it in StopSyncing(). scoped_ptr<syncer::SyncErrorFactory> error_handler_; - // Whether we should cull expired autofill entries, can be updated by sync - // via UpdateCullingSetting. - bool cull_expired_entries_; - syncer::SyncableService::StartSyncFlare flare_; DISALLOW_COPY_AND_ASSIGN(AutocompleteSyncableService); diff --git a/sync/internal_api/public/util/experiments.h b/sync/internal_api/public/util/experiments.h index 0be2dd9..4b89e43 100644 --- a/sync/internal_api/public/util/experiments.h +++ b/sync/internal_api/public/util/experiments.h @@ -5,11 +5,8 @@ #ifndef SYNC_UTIL_EXPERIMENTS_ #define SYNC_UTIL_EXPERIMENTS_ -#include "sync/internal_api/public/base/model_type.h" - namespace syncer { -const char kAutofillCullingTag[] = "autofill_culling"; const char kFaviconSyncTag[] = "favicon_sync"; const char kPreCommitUpdateAvoidanceTag[] = "pre_commit_update_avoidance"; const char kGCMChannelTag[] = "gcm_channel"; @@ -22,19 +19,14 @@ struct Experiments { ENABLED, }; - Experiments() : autofill_culling(false), - favicon_sync_limit(200), + Experiments() : favicon_sync_limit(200), gcm_channel_state(UNSET) {} bool Matches(const Experiments& rhs) { - return (autofill_culling == rhs.autofill_culling && - favicon_sync_limit == rhs.favicon_sync_limit && + return (favicon_sync_limit == rhs.favicon_sync_limit && gcm_channel_state == rhs.gcm_channel_state); } - // Enable deletion of expired autofill entries (if autofill sync is enabled). - bool autofill_culling; - // The number of favicons that a client is permitted to sync. int favicon_sync_limit; diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 4575cdb5..1256d0b 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -1193,16 +1193,6 @@ bool SyncManagerImpl::ReceivedExperiment(Experiments* experiments) { } bool found_experiment = false; - ReadNode autofill_culling_node(&trans); - if (autofill_culling_node.InitByClientTagLookup( - syncer::EXPERIMENTS, - syncer::kAutofillCullingTag) == BaseNode::INIT_OK && - autofill_culling_node.GetExperimentsSpecifics(). - autofill_culling().enabled()) { - experiments->autofill_culling = true; - found_experiment = true; - } - ReadNode favicon_sync_node(&trans); if (favicon_sync_node.InitByClientTagLookup( syncer::EXPERIMENTS, |