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

Unified Diff: net/disk_cache/blockfile/mapped_file_posix.cc

Issue 372113003: simplify posix MappedFile::Init and add useful logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/mapped_file_posix.cc
diff --git a/net/disk_cache/blockfile/mapped_file_posix.cc b/net/disk_cache/blockfile/mapped_file_posix.cc
index 966fc72686e7b6e2f33bcc4ac4e824027f81806e..159bb95de820d7c2e2e1d6cfdfb2fc4ce2ff6600 100644
--- a/net/disk_cache/blockfile/mapped_file_posix.cc
+++ b/net/disk_cache/blockfile/mapped_file_posix.cc
@@ -5,6 +5,7 @@
#include "net/disk_cache/blockfile/mapped_file.h"
#include <errno.h>
+#include <string.h>
rvargas (doing something else) 2014/07/07 23:30:32 (and this should not be needed)
Mostyn Bramley-Moore 2014/07/08 08:07:19 Done.
#include <sys/mman.h>
#include "base/files/file_path.h"
@@ -26,8 +27,9 @@ void* MappedFile::Init(const base::FilePath& name, size_t size) {
platform_file(), 0);
init_ = true;
view_size_ = size;
- DCHECK(reinterpret_cast<intptr_t>(buffer_) != -1);
- if (reinterpret_cast<intptr_t>(buffer_) == -1)
+ DLOG_IF(FATAL, buffer_ == MAP_FAILED) << "Failed to mmap " << name.value()
+ << ": " << strerror(errno);
rvargas (doing something else) 2014/07/07 23:30:32 nit: use DPLOG_IF instead
Mostyn Bramley-Moore 2014/07/08 08:07:19 I hadn't noticed the P logging macros before- nice
+ if (buffer_ == MAP_FAILED)
buffer_ = 0;
// Make sure we detect hardware failures reading the headers.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698