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

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: Response to review 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..6db3f99d9c8d8fb53b4bb3508255c203405d2f57 100644
--- a/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
+++ b/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.h
@@ -6,6 +6,7 @@
#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/observer_list.h"
#include "base/supports_user_data.h"
@@ -16,7 +17,10 @@
#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"
+
+namespace base {
+class MessageLoopProxy;
+}
class WebDataServiceBackend;
@@ -32,17 +36,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,
+ scoped_refptr<base::MessageLoopProxy> ui_thread,
+ scoped_refptr<base::MessageLoopProxy> db_thread,
const base::Closure& on_changed_callback);
// AutofillWebDataBackend implementation.
@@ -137,13 +145,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 +160,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