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 87b967ca94bb2283270198968fe60b21399cfbf4..66a9c6bcb4553e419d9447952253ef906e9cf523 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; |
@@ -96,6 +98,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(); |
@@ -123,7 +131,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); |
}; |