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

Side by Side Diff: net/disk_cache/simple/simple_index.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
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.cc ('k') | net/disk_cache/simple/simple_index.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_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 static void InsertInEntrySet(const EntryMetadata& entry_metadata, 104 static void InsertInEntrySet(const EntryMetadata& entry_metadata,
105 EntrySet* entry_set); 105 EntrySet* entry_set);
106 106
107 private: 107 private:
108 typedef base::Callback<void(scoped_ptr<EntrySet>, bool force_index_flush)> 108 typedef base::Callback<void(scoped_ptr<EntrySet>, bool force_index_flush)>
109 IndexCompletionCallback; 109 IndexCompletionCallback;
110 110
111 void PostponeWritingToDisk(); 111 void PostponeWritingToDisk();
112 112
113 // Using the mtime of the file and its mtime, detects if the index file is
114 // stale.
115 static bool IsIndexFileStale(const base::FilePath& index_filename);
116
113 static void LoadFromDisk( 117 static void LoadFromDisk(
114 const base::FilePath& index_filename, 118 const base::FilePath& index_filename,
115 base::SingleThreadTaskRunner* io_thread, 119 base::SingleThreadTaskRunner* io_thread,
116 const IndexCompletionCallback& completion_callback); 120 const IndexCompletionCallback& completion_callback);
117 121
118 // Enumerates all entries' files on disk and regenerates the index. 122 // Enumerates all entries' files on disk and regenerates the index.
119 static scoped_ptr<SimpleIndex::EntrySet> RestoreFromDisk( 123 static scoped_ptr<SimpleIndex::EntrySet> RestoreFromDisk(
120 const base::FilePath& index_filename); 124 const base::FilePath& index_filename);
121 125
122 static void WriteToDiskInternal(const base::FilePath& index_filename, 126 static void WriteToDiskInternal(const base::FilePath& index_filename,
(...skipping 23 matching lines...) Expand all
146 // Timestamp of the last time we wrote the index to disk. 150 // Timestamp of the last time we wrote the index to disk.
147 // PostponeWritingToDisk() may give up postponing and allow the write if it 151 // PostponeWritingToDisk() may give up postponing and allow the write if it
148 // has been a while since last time we wrote. 152 // has been a while since last time we wrote.
149 base::Time last_write_to_disk_; 153 base::Time last_write_to_disk_;
150 base::OneShotTimer<SimpleIndex> write_to_disk_timer_; 154 base::OneShotTimer<SimpleIndex> write_to_disk_timer_;
151 }; 155 };
152 156
153 } // namespace disk_cache 157 } // namespace disk_cache
154 158
155 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ 159 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.cc ('k') | net/disk_cache/simple/simple_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698