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

Side by Side Diff: net/disk_cache/simple/simple_index_file.h

Issue 17265007: Unlink corrupt SimpleCache index files immediately after load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: narrowest! Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_index_file.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 // Doom the entries specified in |entry_hashes|, calling |reply_callback| 85 // Doom the entries specified in |entry_hashes|, calling |reply_callback|
86 // with the result on the current thread when done. 86 // with the result on the current thread when done.
87 virtual void DoomEntrySet(scoped_ptr<std::vector<uint64> > entry_hashes, 87 virtual void DoomEntrySet(scoped_ptr<std::vector<uint64> > entry_hashes,
88 const base::Callback<void(int)>& reply_callback); 88 const base::Callback<void(int)>& reply_callback);
89 89
90 private: 90 private:
91 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, IsIndexFileCorrupt); 91 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, IsIndexFileCorrupt);
92 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, IsIndexFileStale); 92 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, IsIndexFileStale);
93 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, Serialize); 93 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, Serialize);
94 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, WriteThenLoadIndex);
94 95
95 // Using the mtime of the file and its mtime, detects if the index file is 96 // Using the mtime of the file and its mtime, detects if the index file is
96 // stale. 97 // stale.
97 static bool IsIndexFileStale(const base::FilePath& index_filename); 98 static bool IsIndexFileStale(const base::FilePath& index_filename);
98 99
99 // Load the index file from disk, deserializing it and returning the 100 // Load the index file from disk, deserializing it and returning the
100 // corresponding EntrySet in a scoped_ptr<>, if successful. 101 // corresponding EntrySet in a scoped_ptr<>, if successful.
101 // Uppon failure, the scoped_ptr<> will contain NULL. 102 // Uppon failure, the scoped_ptr<> will contain NULL.
102 static scoped_ptr<SimpleIndex::EntrySet> LoadFromDisk( 103 static scoped_ptr<SimpleIndex::EntrySet> LoadFromDisk(
103 const base::FilePath& index_filename); 104 const base::FilePath& index_filename);
(...skipping 26 matching lines...) Expand all
130 131
131 static const char kIndexFileName[]; 132 static const char kIndexFileName[];
132 133
133 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile); 134 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile);
134 }; 135 };
135 136
136 137
137 } // namespace disk_cache 138 } // namespace disk_cache
138 139
139 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 140 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_index_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698