Index: net/disk_cache/file_win.cc |
=================================================================== |
--- net/disk_cache/file_win.cc (revision 232523) |
+++ net/disk_cache/file_win.cc (working copy) |
@@ -31,23 +31,19 @@ |
// Helper class to handle the IO completion notifications from the message loop. |
class CompletionHandler : public base::MessageLoopForIO::IOHandler { |
virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
- DWORD actual_bytes, |
- DWORD error); |
+ DWORD actual_bytes, DWORD error); |
}; |
static base::LazyInstance<CompletionHandler> g_completion_handler = |
LAZY_INSTANCE_INITIALIZER; |
-void CompletionHandler::OnIOCompleted( |
- base::MessageLoopForIO::IOContext* context, |
- DWORD actual_bytes, |
- DWORD error) { |
+void CompletionHandler::OnIOCompleted(base::MessageLoopForIO::IOContext* context, |
+ DWORD actual_bytes, DWORD error) { |
MyOverlapped* data = reinterpret_cast<MyOverlapped*>(context); |
if (error) { |
DCHECK(!actual_bytes); |
actual_bytes = static_cast<DWORD>(net::ERR_CACHE_READ_FAILURE); |
- NOTREACHED(); |
} |
if (data->callback_) |
@@ -70,7 +66,10 @@ |
namespace disk_cache { |
File::File(base::PlatformFile file) |
- : init_(true), mixed_(true), platform_file_(INVALID_HANDLE_VALUE), |
+ : init_(true), |
+ mixed_(true), |
+ force_creation_(false), |
+ platform_file_(INVALID_HANDLE_VALUE), |
sync_platform_file_(file) { |
} |
@@ -81,8 +80,9 @@ |
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; |
DWORD access = GENERIC_READ | GENERIC_WRITE | DELETE; |
+ DWORD mode = force_creation_ ? OPEN_ALWAYS : OPEN_EXISTING; |
platform_file_ = CreateFile(name.value().c_str(), access, sharing, NULL, |
- OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); |
+ mode, FILE_FLAG_OVERLAPPED, NULL); |
if (INVALID_HANDLE_VALUE == platform_file_) |
return false; |