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

Unified Diff: net/disk_cache/file_win.cc

Issue 3167020: Disk cache: Extend the internal buffering performed by each entry... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 months 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
« net/disk_cache/disk_cache_test_base.cc ('K') | « net/disk_cache/file_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/file_win.cc
===================================================================
--- net/disk_cache/file_win.cc (revision 55505)
+++ net/disk_cache/file_win.cc (working copy)
@@ -15,7 +15,7 @@
struct MyOverlapped {
MyOverlapped(disk_cache::File* file, size_t offset,
disk_cache::FileIOCallback* callback);
- ~MyOverlapped();
+ ~MyOverlapped() {}
OVERLAPPED* overlapped() {
return &context_.overlapped;
}
@@ -23,8 +23,6 @@
MessageLoopForIO::IOContext context_;
scoped_refptr<disk_cache::File> file_;
disk_cache::FileIOCallback* callback_;
- const void* buffer_;
- bool delete_buffer_; // Delete the user buffer at completion.
};
COMPILE_ASSERT(!offsetof(MyOverlapped, context_), starts_with_overlapped);
@@ -60,15 +58,6 @@
callback_ = callback;
}
-MyOverlapped::~MyOverlapped() {
- if (delete_buffer_) {
- DCHECK(!callback_);
- // This whole thing could be updated to use IOBuffer, but PostWrite is not
- // used at the moment. TODO(rvargas): remove or update this code.
- delete[] reinterpret_cast<const char*>(buffer_);
- }
-}
-
} // namespace
namespace disk_cache {
@@ -207,29 +196,18 @@
return Write(buffer, buffer_len, offset);
}
- return AsyncWrite(buffer, buffer_len, offset, true, callback, completed);
+ return AsyncWrite(buffer, buffer_len, offset, callback, completed);
}
-bool File::PostWrite(const void* buffer, size_t buffer_len, size_t offset) {
- DCHECK(init_);
- return AsyncWrite(buffer, buffer_len, offset, false, NULL, NULL);
-}
-
bool File::AsyncWrite(const void* buffer, size_t buffer_len, size_t offset,
- bool notify, FileIOCallback* callback, bool* completed) {
+ FileIOCallback* callback, bool* completed) {
DCHECK(init_);
+ DCHECK(callback);
+ DCHECK(completed);
if (buffer_len > ULONG_MAX || offset > ULONG_MAX)
return false;
MyOverlapped* data = new MyOverlapped(this, offset, callback);
- bool dummy_completed;
- if (!callback) {
- DCHECK(!notify);
- data->delete_buffer_ = true;
- data->buffer_ = buffer;
- completed = &dummy_completed;
- }
-
DWORD size = static_cast<DWORD>(buffer_len);
DWORD actual;
« net/disk_cache/disk_cache_test_base.cc ('K') | « net/disk_cache/file_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698