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

Unified Diff: chrome/browser/api/webdata/web_data_service_base.h

Issue 12494020: Remove knowledge of Chrome-specific SyncableService classes from WebDataService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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: chrome/browser/api/webdata/web_data_service_base.h
diff --git a/chrome/browser/api/webdata/web_data_service_base.h b/chrome/browser/api/webdata/web_data_service_base.h
index 3db395e4ba0d78a285ed8f0b6a81ba48c396bbfd..d018cdea1077465c9212205cb83c6aaab8fe30b3 100644
--- a/chrome/browser/api/webdata/web_data_service_base.h
+++ b/chrome/browser/api/webdata/web_data_service_base.h
@@ -9,6 +9,7 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/supports_user_data.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_source.h"
#include "sql/init_status.h"
@@ -69,8 +70,15 @@ class WebDataServiceBase
// DBThread.
virtual WebDatabase* GetDatabase();
+ // Returns a SupportsUserData objects that may be used to store data
+ // owned by the DB thread on this object. Should be called only from
+ // the DB thread, and will be destroyed on the DB thread soon after
+ // |ShutdownOnUIThread()| is called.
+ base::SupportsUserData* GetDBUserData();
+
protected:
virtual ~WebDataServiceBase();
+ virtual void ShutdownOnDBThread();
// Our database service.
scoped_ptr<WebDatabaseService> wdbs_;
@@ -85,6 +93,11 @@ class WebDataServiceBase
ProfileErrorCallback profile_error_callback_;
+ // 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()|.
+ scoped_ptr<base::SupportsUserData> db_thread_user_data_;
+
void DBInitFailed(sql::InitStatus sql_status);
void NotifyDatabaseLoadedOnUIThread();
void DatabaseInitOnDB(sql::InitStatus status);

Powered by Google App Engine
This is Rietveld 408576698