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

Unified Diff: net/disk_cache/mapped_file_win.cc

Issue 7661006: Disk cache: Detect hardware failures when reading the headers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« 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/mapped_file_win.cc
===================================================================
--- net/disk_cache/mapped_file_win.cc (revision 96574)
+++ net/disk_cache/mapped_file_win.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "net/disk_cache/disk_cache.h"
namespace disk_cache {
@@ -26,6 +27,12 @@
DCHECK(buffer_);
view_size_ = size;
+ // Make sure we detect hardware failures reading the headers.
+ size_t temp_len = size ? size : 4096;
+ scoped_array<char> temp(new char[temp_len]);
+ if (!Read(temp.get(), temp_len, 0))
+ return NULL;
gavinp 2011/08/16 17:00:45 Minor Nit: Although this is almost at the end of t
+
return buffer_;
}
« 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