diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 01:07:35 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 01:07:35 +0000 |
commit | 19695a2dc9e77d00bf7205225467ebf8ffb16da4 (patch) | |
tree | b9274b10cbf335f8c7f30dad86cbda4ad607ac98 /net/disk_cache/file_posix.cc | |
parent | d217dacf73359389da9bf64bc64742e525338aac (diff) | |
download | chromium_src-19695a2dc9e77d00bf7205225467ebf8ffb16da4.zip chromium_src-19695a2dc9e77d00bf7205225467ebf8ffb16da4.tar.gz chromium_src-19695a2dc9e77d00bf7205225467ebf8ffb16da4.tar.bz2 |
Revert 51456 - Disk cache: Switch the disk cache to use the cache_thread.
Add an InFlightBackendIO class that handles posting of
cacheoperations back and forth between the IO thread and
the cachethread.
BUG=26730
TEST=unit tests
Review URL: http://codereview.chromium.org/2841034
TBR=rvargas@google.com
Review URL: http://codereview.chromium.org/2881010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/file_posix.cc')
-rw-r--r-- | net/disk_cache/file_posix.cc | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 295f744..cf621f4 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -193,9 +193,6 @@ void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len, io_list_.insert(operation.get()); file->AddRef(); // Balanced on InvokeCallback() - if (!callback_thread_) - callback_thread_ = MessageLoop::current(); - WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(operation.get(), &BackgroundIO::Read), true); @@ -210,9 +207,6 @@ void InFlightIO::PostWrite(disk_cache::File* file, const void* buf, io_list_.insert(operation.get()); file->AddRef(); // Balanced on InvokeCallback() - if (!callback_thread_) - callback_thread_ = MessageLoop::current(); - WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(operation.get(), &BackgroundIO::Write, delete_buffer), @@ -225,8 +219,6 @@ void InFlightIO::WaitForPendingIO() { IOList::iterator it = io_list_.begin(); InvokeCallback(*it, true); } - // Unit tests can use different threads. - callback_thread_ = NULL; } // Runs on a worker thread. @@ -380,9 +372,8 @@ size_t File::GetLength() { // Static. void File::WaitForPendingIO(int* num_pending_io) { - // We may be running unit tests so we should allow InFlightIO to reset the - // message loop. - Singleton<InFlightIO>::get()->WaitForPendingIO(); + if (*num_pending_io) + Singleton<InFlightIO>::get()->WaitForPendingIO(); } } // namespace disk_cache |