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

Unified Diff: components/autofill/browser/webdata/autofill_webdata_service.cc

Issue 13898011: Move SupportsUserData code into AutofillWebData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and test fix Created 7 years, 8 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: components/autofill/browser/webdata/autofill_webdata_service.cc
diff --git a/components/autofill/browser/webdata/autofill_webdata_service.cc b/components/autofill/browser/webdata/autofill_webdata_service.cc
index 12a6af72e2133b8daa8e44666e656d047d7fccf1..f4bc67ad78d820446f0f4773837444c25628bc88 100644
--- a/components/autofill/browser/webdata/autofill_webdata_service.cc
+++ b/components/autofill/browser/webdata/autofill_webdata_service.cc
@@ -47,6 +47,13 @@ AutofillWebDataService::AutofillWebDataService()
WebDataServiceBase::ProfileErrorCallback()) {
}
+void AutofillWebDataService::ShutdownOnUIThread() {
+ BrowserThread::PostTask(
+ BrowserThread::DB, FROM_HERE,
+ base::Bind(&AutofillWebDataService::ShutdownOnDBThread, this));
+ WebDataServiceBase::ShutdownOnUIThread();
+}
+
void AutofillWebDataService::AddFormFields(
const std::vector<FormFieldData>& fields) {
wdbs_->ScheduleDBTask(FROM_HERE,
@@ -164,7 +171,21 @@ void AutofillWebDataService::RemoveObserver(
ui_observer_list_.RemoveObserver(observer);
}
-AutofillWebDataService::~AutofillWebDataService() {}
+base::SupportsUserData* AutofillWebDataService::GetDBUserData() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ if (!db_thread_user_data_)
+ db_thread_user_data_.reset(new SupportsUserDataAggregatable());
+ return db_thread_user_data_.get();
+}
+
+void AutofillWebDataService::ShutdownOnDBThread() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ db_thread_user_data_.reset();
+}
+
+AutofillWebDataService::~AutofillWebDataService() {
+ DCHECK(!db_thread_user_data_.get()) << "Forgot to call ShutdownOnUIThread?";
+}
////////////////////////////////////////////////////////////////////////////////
//
« no previous file with comments | « components/autofill/browser/webdata/autofill_webdata_service.h ('k') | components/webdata/common/web_data_service_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698