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

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

Issue 14679005: Create an AutofillBackend interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix WIN Created 7 years, 7 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.h
diff --git a/components/autofill/browser/webdata/autofill_webdata_service.h b/components/autofill/browser/webdata/autofill_webdata_service.h
index 2ca80ef953f37d4394b25bdcd072e8cf9c91d18d..2a8731749b72baf113037c41ed4424b0c90b3348 100644
--- a/components/autofill/browser/webdata/autofill_webdata_service.h
+++ b/components/autofill/browser/webdata/autofill_webdata_service.h
@@ -8,6 +8,7 @@
#include <vector>
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/supports_user_data.h"
#include "components/autofill/browser/webdata/autofill_webdata.h"
@@ -28,6 +29,7 @@ namespace autofill {
class AutofillChange;
class AutofillProfile;
class AutofillWebDataBackend;
+class AutofillWebDataBackendImpl;
class AutofillWebDataServiceObserverOnDBThread;
class AutofillWebDataServiceObserverOnUIThread;
class CreditCard;
@@ -99,6 +101,12 @@ class AutofillWebDataService : public AutofillWebData,
// |ShutdownOnUIThread()| is called.
base::SupportsUserData* GetDBUserData();
+ // Takes a callback which will be called on the DB thread with a pointer to an
+ // |AutofillWebdataBackend|. This backend can be used to access or update the
+ // WebDatabase directly on the DB thread.
+ void GetAutofillBackend(
+ const base::Callback<void(AutofillWebDataBackend*)>& callback);
+
protected:
virtual ~AutofillWebDataService();
@@ -126,7 +134,11 @@ class AutofillWebDataService : public AutofillWebData,
ObserverList<AutofillWebDataServiceObserverOnUIThread> ui_observer_list_;
- scoped_refptr<AutofillWebDataBackend> autofill_backend_;
+ // This factory is used on the UI thread. All vended weak pointers are
+ // invalidated in ShutdownOnUIThread().
+ base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_;
+
+ scoped_refptr<AutofillWebDataBackendImpl> autofill_backend_;
DISALLOW_COPY_AND_ASSIGN(AutofillWebDataService);
};

Powered by Google App Engine
This is Rietveld 408576698