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

Unified Diff: net/disk_cache/entry_impl.cc

Issue 8156: Switch MessagePumpForIO to use completion ports on Windows.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/entry_impl.cc
===================================================================
--- net/disk_cache/entry_impl.cc (revision 4870)
+++ net/disk_cache/entry_impl.cc (working copy)
@@ -16,25 +16,8 @@
namespace {
-// This is a simple Task to execute the callback (from the message loop instead
-// of the APC).
-class InvokeCallback : public Task {
- public:
- InvokeCallback(net::CompletionCallback* callback, int argument)
- : callback_(callback), argument_(argument) {}
-
- virtual void Run() {
- callback_->Run(argument_);
- }
-
- private:
- net::CompletionCallback* callback_;
- int argument_;
- DISALLOW_EVIL_CONSTRUCTORS(InvokeCallback);
-};
-
-// This class implements FileIOCallback to buffer the callback from an IO
-// operation from the actual IO class.
+// This class implements FileIOCallback to buffer the callback from a file IO
+// operation from the actual net class.
class SyncCallback: public disk_cache::FileIOCallback {
public:
SyncCallback(disk_cache::EntryImpl* entry,
@@ -57,10 +40,8 @@
void SyncCallback::OnFileIOComplete(int bytes_copied) {
entry_->DecrementIoCount();
entry_->Release();
- if (callback_) {
- InvokeCallback* task = new InvokeCallback(callback_, bytes_copied);
- MessageLoop::current()->PostTask(FROM_HERE, task);
- }
+ if (callback_)
+ callback_->Run(bytes_copied);
delete this;
}
@@ -556,9 +537,11 @@
if (files_[index])
files_[index] = NULL; // Releases the object.
- if (!DeleteCacheFile(backend_->GetFileName(address)))
+ if (!DeleteCacheFile(backend_->GetFileName(address))) {
+ UMA_HISTOGRAM_COUNTS(L"DiskCache.DeleteFailed", 1);
LOG(ERROR) << "Failed to delete " << backend_->GetFileName(address) <<
" from the cache.";
+ }
} else {
backend_->DeleteBlock(address, true);
}
@@ -711,7 +694,6 @@
return true;
}
-
// The common scenario is that this is called from the destructor of the entry,
// to write to disk what we have buffered. We don't want to hold the destructor
// until the actual IO finishes, so we'll send an asynchronous write that will
@@ -744,6 +726,13 @@
if (!file)
return false;
+ // TODO(rvargas): figure out if it's worth to re-enable posting operations.
+ // Right now it is only used from GrowUserBuffer, not the destructor, and
+ // it is not accounted for from the point of view of the total number of
+ // pending operations of the cache. It is also racing with the actual write
+ // on the GrowUserBuffer path because there is no code to exclude the range
+ // that is going to be written.
+ async = false;
if (async) {
if (!file->PostWrite(user_buffers_[index].get(), len, offset))
return false;
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698