diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-14 22:05:33 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-14 22:05:33 +0000 |
commit | 55474b575e7e36bea6e7ce2ed18b34ff98a654dc (patch) | |
tree | 5e71656e0795f2372268a5d645d904d0a884e024 /chrome/browser/history | |
parent | 0d219e8c64fd474737eb88737a8af3221893393a (diff) | |
download | chromium_src-55474b575e7e36bea6e7ce2ed18b34ff98a654dc.zip chromium_src-55474b575e7e36bea6e7ce2ed18b34ff98a654dc.tar.gz chromium_src-55474b575e7e36bea6e7ce2ed18b34ff98a654dc.tar.bz2 |
Give each HistoryService instance it's own backend thread.
I had originally planned to push history_thread up to BrowserProcess,
but was scared away by the comment in ~Profile that talks about HistoryService
calling back into the bookmark bar model, and that it depended on join()ing at
that particular time to ensure this doesn't happen after the bookmark bar model has been reset.
I didn't use scoped_ptr for the thread because it makes the little dance
in CleanUp awkward.
TEST=any existing test that exersizes the history service. I added a ProfileManager
test that would fail without this change.
Review URL: http://codereview.chromium.org/73012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/history.cc | 8 | ||||
-rw-r--r-- | chrome/browser/history/history.h | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 7e1130c..1e93694 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -51,6 +51,8 @@ using base::Time; using history::HistoryBackend; +static const char* kHistoryThreadName = "Chrome_HistoryThread"; + // Sends messages from the backend to us on the main thread. This must be a // separate class from the history service so that it can hold a reference to // the history service (otherwise we would have to manually AddRef and @@ -96,7 +98,7 @@ class HistoryService::BackendDelegate : public HistoryBackend::Delegate { const history::StarID HistoryService::kBookmarkBarID = 1; HistoryService::HistoryService() - : thread_(new ChromeThread(ChromeThread::HISTORY)), + : thread_(new base::Thread(kHistoryThreadName)), profile_(NULL), backend_loaded_(false) { // Is NULL when running generate_profile. @@ -108,7 +110,7 @@ HistoryService::HistoryService() } HistoryService::HistoryService(Profile* profile) - : thread_(new ChromeThread(ChromeThread::HISTORY)), + : thread_(new base::Thread(kHistoryThreadName)), profile_(profile), backend_loaded_(false) { NotificationService::current()->AddObserver( @@ -175,7 +177,7 @@ void HistoryService::Cleanup() { // Delete the thread, which joins with the background thread. We defensively // NULL the pointer before deleting it in case somebody tries to use it // during shutdown, but this shouldn't happen. - ChromeThread* thread = thread_; + base::Thread* thread = thread_; thread_ = NULL; delete thread; } diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index eb62217..3804b8e 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -24,7 +24,6 @@ #include "chrome/common/ref_counted_util.h" class BookmarkService; -class ChromeThread; struct DownloadCreateInfo; class FilePath; class GURL; @@ -39,7 +38,8 @@ class SkBitmap; struct ThumbnailScore; namespace base { - class Time; +class Thread; +class Time; } namespace history { @@ -742,7 +742,7 @@ class HistoryService : public CancelableRequestProvider, CancelableRequestConsumer internal_consumer_; // The thread used by the history service to run complicated operations - ChromeThread* thread_; + base::Thread* thread_; // This class has most of the implementation and runs on the 'thread_'. // You MUST communicate with this class ONLY through the thread_'s |