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

Unified Diff: components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h

Issue 25783002: Abstract content::BrowserThread usage out of AutofillWebDataBackendImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
diff --git a/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h b/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
index 8015dd4212c88878c87ad3a3432bcc96c908d1aa..9dc760e4124419988cc5f4843fc8aaa30c23e1bc 100644
--- a/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
+++ b/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
@@ -6,7 +6,9 @@
#define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_AUTOFILL_WEBDATA_BACKEND_IMPL_H_
#include "base/memory/ref_counted.h"
+#include "base/memory/ref_counted_delete_on_message_loop.h"
#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop_proxy.h"
Ilya Sherman 2013/10/02 23:27:01 nit: Seems like this could just be forward-declare
blundell 2013/10/03 05:23:34 Done.
#include "base/observer_list.h"
#include "base/supports_user_data.h"
#include "components/autofill/core/browser/webdata/autofill_webdata.h"
@@ -16,7 +18,6 @@
#include "components/webdata/common/web_data_service_base.h"
#include "components/webdata/common/web_data_service_consumer.h"
#include "components/webdata/common/web_database.h"
-#include "content/public/browser/browser_thread.h"
class WebDataServiceBackend;
@@ -32,17 +33,21 @@ class CreditCard;
// in it should only be called from that thread. Most functions here are just
// the implementations of the corresponding functions in the Autofill
// WebDataService.
+// This class is destroyed on the DB thread.
class AutofillWebDataBackendImpl
- : public base::RefCountedThreadSafe<AutofillWebDataBackendImpl,
- content::BrowserThread::DeleteOnDBThread>,
+ : public base::RefCountedDeleteOnMessageLoop<AutofillWebDataBackendImpl>,
public AutofillWebDataBackend {
public:
// |web_database_backend| is used to access the WebDatabase directly for
- // Sync-related operations. |on_changed_callback| is a closure which can be
- // used to notify the UI thread of changes initiated by Sync (this callback
- // may be called multiple times).
+ // Sync-related operations. |ui_thread| and |db_thread| are the threads that
+ // this class uses as its UI and DB threads respectively.
+ // |on_changed_callback| is a closure which can be used to notify the UI
+ // thread of changes initiated by Sync (this callback may be called multiple
+ // times).
AutofillWebDataBackendImpl(
scoped_refptr<WebDataServiceBackend> web_database_backend,
+ const scoped_refptr<base::MessageLoopProxy>& ui_thread,
+ const scoped_refptr<base::MessageLoopProxy>& db_thread,
Ilya Sherman 2013/10/02 23:27:01 Hmm, should scoped_refptrs really be passed by con
blundell 2013/10/03 05:23:34 Looking through the codebase, both get used. I'll
const base::Closure& on_changed_callback);
// AutofillWebDataBackend implementation.
@@ -137,13 +142,8 @@ class AutofillWebDataBackendImpl
virtual ~AutofillWebDataBackendImpl();
private:
- friend struct content::BrowserThread::DeleteOnThread<
- content::BrowserThread::DB>;
+ friend class base::RefCountedDeleteOnMessageLoop<AutofillWebDataBackendImpl>;
friend class base::DeleteHelper<AutofillWebDataBackendImpl>;
- // We have to friend RCTS<> so WIN shared-lib build is happy
- // (http://crbug/112250).
- friend class base::RefCountedThreadSafe<AutofillWebDataBackendImpl,
- content::BrowserThread::DeleteOnDBThread>;
// This makes the destructor public, and thus allows us to aggregate
// SupportsUserData. It is private by default to prevent incorrect
@@ -157,6 +157,12 @@ class AutofillWebDataBackendImpl
DISALLOW_COPY_AND_ASSIGN(SupportsUserDataAggregatable);
};
+ // The MessageLoopProxy that this class uses as its UI thread.
+ scoped_refptr<base::MessageLoopProxy> ui_thread_;
+
+ // The MessageLoopProxy that this class uses as its DB thread.
+ scoped_refptr<base::MessageLoopProxy> db_thread_;
+
// Storage for user data to be accessed only on the DB thread. May
// be used e.g. for SyncableService subclasses that need to be owned
// by this object. Is created on first call to |GetDBUserData()|.
« no previous file with comments | « no previous file | components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698