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

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

Issue 13933029: Add SimpleCache index file heuristics (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Returns a scoped_ptr for a newly allocated Pickle containing the serialized 61 // Returns a scoped_ptr for a newly allocated Pickle containing the serialized
62 // data to be written to a file. 62 // data to be written to a file.
63 static scoped_ptr<Pickle> Serialize( 63 static scoped_ptr<Pickle> Serialize(
64 const SimpleIndexFile::IndexMetadata& index_metadata, 64 const SimpleIndexFile::IndexMetadata& index_metadata,
65 const SimpleIndex::EntrySet& entries); 65 const SimpleIndex::EntrySet& entries);
66 66
67 // Write the serialized data from |pickle| into the index file. 67 // Write the serialized data from |pickle| into the index file.
68 static void WriteToDisk(const base::FilePath& index_filename, 68 static void WriteToDisk(const base::FilePath& index_filename,
69 const Pickle& pickle); 69 const Pickle& pickle);
70 70
71 // Using mtime of the file and the path, it detects if the index file is
gavinp 2013/04/19 11:30:17 // Using the mtime of the file and its mtime, dete
felipeg 2013/04/19 12:20:29 Done.
72 // stale.
73 static bool IsIndexFileStale(const base::FilePath& index_filename);
74
71 private: 75 private:
72 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, Serialize); 76 FRIEND_TEST_ALL_PREFIXES(SimpleIndexFileTest, Serialize);
73 77
74 // Deserialize() is separate from LoadFromDisk() for easier testing. 78 // Deserialize() is separate from LoadFromDisk() for easier testing.
75 static scoped_ptr<SimpleIndex::EntrySet> Deserialize(const char* data, 79 static scoped_ptr<SimpleIndex::EntrySet> Deserialize(const char* data,
76 int data_len); 80 int data_len);
77 81
78 struct PickleHeader : public Pickle::Header { 82 struct PickleHeader : public Pickle::Header {
79 uint32 crc; 83 uint32 crc;
80 }; 84 };
81 85
82 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile); 86 DISALLOW_COPY_AND_ASSIGN(SimpleIndexFile);
83 }; 87 };
84 88
85 89
86 } // namespace disk_cache 90 } // namespace disk_cache
87 91
88 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_ 92 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698