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

Unified Diff: net/disk_cache/file_win.cc

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 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/file.cc ('k') | net/disk_cache/mapped_file.h » ('j') | 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 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;
« no previous file with comments | « net/disk_cache/file.cc ('k') | net/disk_cache/mapped_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698