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

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: Clean up 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 87b967ca94bb2283270198968fe60b21399cfbf4..fe51f800f679ea8be1b9d24bb8ce93cb5e6c73a8 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"
@@ -31,11 +32,15 @@ class AutofillWebDataBackend;
class AutofillWebDataServiceObserverOnDBThread;
class AutofillWebDataServiceObserverOnUIThread;
class CreditCard;
+class SyncableServiceDelegate;
// API for Autofill web data.
class AutofillWebDataService : public AutofillWebData,
public WebDataServiceBase {
public:
+ typedef base::Callback<void(base::WeakPtr<SyncableServiceDelegate>)>
+ DelegateOnDBCallback;
+
AutofillWebDataService();
AutofillWebDataService(scoped_refptr<WebDatabaseService> wdbs,
@@ -96,11 +101,21 @@ class AutofillWebDataService : public AutofillWebData,
// |ShutdownOnUIThread()| is called.
base::SupportsUserData* GetDBUserData();
+ // Asynchronously gets an instance of |AutofillBackendDelegate|, which can be
+ // used to do work on the DB thread. This method is meant to be called from
+ // the UI thread, but the callback will be called on the DB thread.
+ // The delegate instance is owned by |AutofillWebDataBackend|, and so has the
+ // same lifetime as |AutofillWebDataService|.
+ void GetDelegateOnDB(const DelegateOnDBCallback& del_callback);
Ilya Sherman 2013/05/07 00:02:43 nit: Please don't use abbreviations like "del" in
+
protected:
virtual ~AutofillWebDataService();
virtual void ShutdownOnDBThread();
+ // All vended weak pointers are invalidated in ShutdownDatabase().
Jói 2013/05/06 23:08:39 Suggest documenting which thread this factory is u
Cait (Slow) 2013/05/07 19:22:07 Done.
+ base::WeakPtrFactory<AutofillWebDataService> weak_ptr_factory_;
+
private:
// This makes the destructor public, and thus allows us to aggregate
// SupportsUserData. It is private by default to prevent incorrect

Powered by Google App Engine
This is Rietveld 408576698