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

Unified Diff: net/disk_cache/mapped_file_posix.cc

Issue 10454093: Disk cache: Pre-read file headers when opening files (posix). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | net/disk_cache/mapped_file_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/mapped_file_posix.cc
===================================================================
--- net/disk_cache/mapped_file_posix.cc (revision 139948)
+++ net/disk_cache/mapped_file_posix.cc (working copy)
@@ -24,11 +24,16 @@
buffer_ = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
platform_file(), 0);
init_ = true;
+ view_size_ = size;
DCHECK(reinterpret_cast<intptr_t>(buffer_) != -1);
if (reinterpret_cast<intptr_t>(buffer_) == -1)
buffer_ = 0;
- view_size_ = size;
+ // Make sure we detect hardware failures reading the headers.
+ scoped_array<char> temp(new char[size]);
gavinp 2012/06/01 12:00:34 Now there's another difference with windows. When
+ if (!Read(temp.get(), size, 0))
+ return NULL;
+
return buffer_;
}
« no previous file with comments | « no previous file | net/disk_cache/mapped_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698