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

Side by Side Diff: net/disk_cache/block_files.h

Issue 165174: Try again: Check blockfile size before attempting to read the header. (Closed)
Patch Set: Created 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/disk_cache/block_files.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See net/disk_cache/disk_cache.h for the public interface. 5 // See net/disk_cache/disk_cache.h for the public interface.
6 6
7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__ 7 #ifndef NET_DISK_CACHE_BLOCK_FILES_H__
8 #define NET_DISK_CACHE_BLOCK_FILES_H__ 8 #define NET_DISK_CACHE_BLOCK_FILES_H__
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "net/disk_cache/addr.h" 12 #include "net/disk_cache/addr.h"
13 #include "net/disk_cache/mapped_file.h" 13 #include "net/disk_cache/mapped_file.h"
14 #include "testing/gtest/include/gtest/gtest_prod.h"
14 15
15 namespace disk_cache { 16 namespace disk_cache {
16 17
17 class EntryImpl; 18 class EntryImpl;
18 19
19 // This class handles the set of block-files open by the disk cache. 20 // This class handles the set of block-files open by the disk cache.
20 class BlockFiles { 21 class BlockFiles {
21 public: 22 public:
22 explicit BlockFiles(const std::wstring& path) 23 explicit BlockFiles(const std::wstring& path)
23 : init_(false), zero_buffer_(NULL), path_(path) {} 24 : init_(false), zero_buffer_(NULL), path_(path) {}
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool FixBlockFileHeader(MappedFile* file); 69 bool FixBlockFileHeader(MappedFile* file);
69 70
70 // Returns the filename for a given file index. 71 // Returns the filename for a given file index.
71 std::wstring Name(int index); 72 std::wstring Name(int index);
72 73
73 bool init_; 74 bool init_;
74 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries. 75 char* zero_buffer_; // Buffer to speed-up cleaning deleted entries.
75 std::wstring path_; // Path to the backing folder. 76 std::wstring path_; // Path to the backing folder.
76 std::vector<MappedFile*> block_files_; // The actual files. 77 std::vector<MappedFile*> block_files_; // The actual files.
77 78
79 FRIEND_TEST(DiskCacheTest, BlockFiles_ZeroSizeFile);
80
78 DISALLOW_EVIL_CONSTRUCTORS(BlockFiles); 81 DISALLOW_EVIL_CONSTRUCTORS(BlockFiles);
79 }; 82 };
80 83
81 } // namespace disk_cache 84 } // namespace disk_cache
82 85
83 #endif // NET_DISK_CACHE_BLOCK_FILES_H__ 86 #endif // NET_DISK_CACHE_BLOCK_FILES_H__
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/block_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698