diff options
author | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-29 19:12:41 +0000 |
---|---|---|
committer | skrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-29 19:12:41 +0000 |
commit | f0185941daa7ec11b8521b0a5e2fd710a42612ac (patch) | |
tree | f2289866b3d12b753377074230f5487e1a33e1bf /chrome/browser/webdata/web_data_service.h | |
parent | 0973d960eed1ca6d852e0b4fb9acdfcf2db3adee (diff) | |
download | chromium_src-f0185941daa7ec11b8521b0a5e2fd710a42612ac.zip chromium_src-f0185941daa7ec11b8521b0a5e2fd710a42612ac.tar.gz chromium_src-f0185941daa7ec11b8521b0a5e2fd710a42612ac.tar.bz2 |
Change WDS to use the DB thread rather than its own thread.
This cleanup was requested by brettw and was started to make it easier for the sync service to post tasks to the WDS thread (now the DB thread). This simplifies the WDS a bit since it no longer has to manage its own thread, and can assume that the DB thread is running throughout its lifetime.
One change in behavior that is significant is that previous to this change, the WDS worker thread would always be joined when Shutdown() was called from Profile::~Profile(). Now the Shutdown() method schedules a task that can extend the lifetime of the WDS past the lifetime of the Profile instance.
Review URL: http://codereview.chromium.org/524003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35339 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/web_data_service.h')
-rw-r--r-- | chrome/browser/webdata/web_data_service.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h index 3a6c83b..4421b71 100644 --- a/chrome/browser/webdata/web_data_service.h +++ b/chrome/browser/webdata/web_data_service.h @@ -12,6 +12,7 @@ #include "base/file_path.h" #include "base/lock.h" #include "base/ref_counted.h" +#include "chrome/browser/chrome_thread.h" #include "chrome/browser/search_engines/template_url.h" #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/form_field.h" @@ -145,7 +146,9 @@ template <class T> class WDObjectResult : public WDTypedResult { class WebDataServiceConsumer; -class WebDataService : public base::RefCountedThreadSafe<WebDataService> { +class WebDataService + : public base::RefCountedThreadSafe<WebDataService, + ChromeThread::DeleteOnUIThread> { public: // All requests return an opaque handle of the following type. @@ -429,6 +432,8 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { ////////////////////////////////////////////////////////////////////////////// private: friend class base::RefCountedThreadSafe<WebDataService>; + friend class ChromeThread; + friend class DeleteTask<WebDataService>; friend class ShutdownTask; typedef GenericRequest2<std::vector<const TemplateURL*>, @@ -507,8 +512,6 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { void GetWebAppImagesImpl(GenericRequest<GURL>* request); - base::Thread* thread() { return thread_; } - // Schedule a task on our worker thread. void ScheduleTask(Task* t); @@ -518,8 +521,8 @@ class WebDataService : public base::RefCountedThreadSafe<WebDataService> { // Return the next request handle. int GetNextRequestHandle(); - // Our worker thread. All requests are processed from that thread. - base::Thread* thread_; + // True once initialization has started. + bool is_running_; // The path with which to initialize the database. FilePath path_; |