diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 05:39:31 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-07 05:39:31 +0000 |
commit | d93ad24560fc76f2d7912095aa6efd009a2e9b04 (patch) | |
tree | f05e06b60fcc62435ee9da27a88d5acd47c643af /chrome/browser | |
parent | cef3ea564024b93a2067742164feed870ee3fef2 (diff) | |
download | chromium_src-d93ad24560fc76f2d7912095aa6efd009a2e9b04.zip chromium_src-d93ad24560fc76f2d7912095aa6efd009a2e9b04.tar.gz chromium_src-d93ad24560fc76f2d7912095aa6efd009a2e9b04.tar.bz2 |
Revert 116816 - Hook up the SequencedWorkerPool to the browser thread.
This does some refactoring of the static data in the browser thread so we only have one global object instead of a bunch fo separate arrays.
It also hooks up the visited link master's I/O to use this new system as a proof of concept.
Review URL: http://codereview.chromium.org/9065009
TBR=brettw@chromium.org
Review URL: http://codereview.chromium.org/9122022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116817 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/crash_upload_list.cc | 4 | ||||
-rw-r--r-- | chrome/browser/visitedlink/visitedlink_master.cc | 22 | ||||
-rw-r--r-- | chrome/browser/visitedlink/visitedlink_master.h | 8 |
3 files changed, 15 insertions, 19 deletions
diff --git a/chrome/browser/crash_upload_list.cc b/chrome/browser/crash_upload_list.cc index 30c04f8..bc74d8e 100644 --- a/chrome/browser/crash_upload_list.cc +++ b/chrome/browser/crash_upload_list.cc @@ -39,7 +39,8 @@ CrashUploadList::CrashUploadList(Delegate* delegate) : delegate_(delegate) {} CrashUploadList::~CrashUploadList() {} void CrashUploadList::LoadCrashListAsynchronously() { - BrowserThread::PostBlockingPoolTask( + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, base::Bind(&CrashUploadList::LoadCrashListAndInformDelegateOfCompletion, this)); @@ -59,6 +60,7 @@ void CrashUploadList::LoadCrashListAndInformDelegateOfCompletion() { } void CrashUploadList::LoadCrashList() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); FilePath crash_dir_path; PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_dir_path); FilePath upload_log_path = crash_dir_path.AppendASCII("uploads.log"); diff --git a/chrome/browser/visitedlink/visitedlink_master.cc b/chrome/browser/visitedlink/visitedlink_master.cc index 38c87ca..f3fbc85 100644 --- a/chrome/browser/visitedlink/visitedlink_master.cc +++ b/chrome/browser/visitedlink/visitedlink_master.cc @@ -191,7 +191,6 @@ void VisitedLinkMaster::InitMembers(Listener* listener, Profile* profile) { history_service_override_ = NULL; suppress_rebuild_ = false; profile_ = profile; - sequence_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); #ifndef NDEBUG posted_asynchronous_operation_ = false; @@ -243,12 +242,6 @@ VisitedLinkMaster::Hash VisitedLinkMaster::TryToAddURL(const GURL& url) { return AddFingerprint(fingerprint, true); } -void VisitedLinkMaster::PostIOTask(const tracked_objects::Location& from_here, - const base::Closure& task) { - BrowserThread::GetBlockingPool()->PostSequencedWorkerTask(sequence_token_, - from_here, task); -} - void VisitedLinkMaster::AddURL(const GURL& url) { Hash index = TryToAddURL(url); if (!table_builder_ && index != null_hash_) { @@ -487,7 +480,10 @@ bool VisitedLinkMaster::WriteFullTable() { hash_table_, table_length_ * sizeof(Fingerprint)); // The hash table may have shrunk, so make sure this is the end. - PostIOTask(FROM_HERE, base::Bind(base::IgnoreResult(&TruncateFile), file_)); + BrowserThread::PostTask( + BrowserThread::FILE, + FROM_HERE, + base::Bind(base::IgnoreResult(&TruncateFile), file_)); return true; } @@ -677,7 +673,11 @@ void VisitedLinkMaster::FreeURLTable() { } if (!file_) return; - PostIOTask(FROM_HERE, base::Bind(base::IgnoreResult(&fclose), file_)); + + BrowserThread::PostTask( + BrowserThread::FILE, + FROM_HERE, + base::Bind(base::IgnoreResult(&fclose), file_)); } bool VisitedLinkMaster::ResizeTableIfNecessary() { @@ -860,7 +860,9 @@ void VisitedLinkMaster::WriteToFile(FILE* file, #ifndef NDEBUG posted_asynchronous_operation_ = true; #endif - PostIOTask(FROM_HERE, + + BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, base::Bind(&AsyncWrite, file, offset, std::string(static_cast<const char*>(data), data_size))); } diff --git a/chrome/browser/visitedlink/visitedlink_master.h b/chrome/browser/visitedlink/visitedlink_master.h index 1771afe..c84e809 100644 --- a/chrome/browser/visitedlink/visitedlink_master.h +++ b/chrome/browser/visitedlink/visitedlink_master.h @@ -17,7 +17,6 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/shared_memory.h" -#include "base/threading/sequenced_worker_pool.h" #include "chrome/browser/history/history.h" #include "chrome/common/visitedlink_common.h" @@ -164,10 +163,6 @@ class VisitedLinkMaster : public VisitedLinkCommon { // File I/O functions // ------------------ - // Posts the given task to the blocking worker pool with our options. - void PostIOTask(const tracked_objects::Location& from_here, - const base::Closure& task); - // Writes the entire table to disk, returning true on success. It will leave // the table file open and the handle to it in file_ bool WriteFullTable(); @@ -317,9 +312,6 @@ class VisitedLinkMaster : public VisitedLinkCommon { // (it knows the path to where the data is stored) Profile* profile_; - // Lazily initialized sequence token for posting file tasks. - base::SequencedWorkerPool::SequenceToken sequence_token_; - // When non-NULL, indicates we are in database rebuild mode and points to // the class collecting fingerprint information from the history system. // The pointer is owned by this class, but it must remain valid while the |