| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |