Chromium Code Reviews| 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_; |
| } |