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

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

Issue 1304363013: Add a size estimation mechanism to StoragePartitionHttpCacheDataRemover. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed some spots again. Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines the public interface of the disk cache. For more details see 5 // Defines the public interface of the disk cache. For more details see
6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache
7 7
8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_
9 #define NET_DISK_CACHE_DISK_CACHE_H_ 9 #define NET_DISK_CACHE_DISK_CACHE_H_
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 base::Time end_time, 138 base::Time end_time,
139 const CompletionCallback& callback) = 0; 139 const CompletionCallback& callback) = 0;
140 140
141 // Marks all entries accessed since |initial_time| for deletion. The return 141 // Marks all entries accessed since |initial_time| for deletion. The return
142 // value is a net error code. If this method returns ERR_IO_PENDING, the 142 // value is a net error code. If this method returns ERR_IO_PENDING, the
143 // |callback| will be invoked when the operation completes. 143 // |callback| will be invoked when the operation completes.
144 // Entries with |initial_time| <= access time are deleted. 144 // Entries with |initial_time| <= access time are deleted.
145 virtual int DoomEntriesSince(base::Time initial_time, 145 virtual int DoomEntriesSince(base::Time initial_time,
146 const CompletionCallback& callback) = 0; 146 const CompletionCallback& callback) = 0;
147 147
148 // Calculate the total size of entries satisfying the condition
149 // |initial_time| <= access_time < |end_time|. The return value is the number
150 // of bytes written or a net error code. If this method returns
151 // ERR_IO_PENDING, the |callback| will be invoked when the operation
152 // completes.
153 virtual int CalculateSizeOfEntriesBetween(
154 base::Time initial_time,
155 base::Time end_time,
156 const CompletionCallback& callback) = 0;
157
148 // Returns an iterator which will enumerate all entries of the cache in an 158 // Returns an iterator which will enumerate all entries of the cache in an
149 // undefined order. 159 // undefined order.
150 virtual scoped_ptr<Iterator> CreateIterator() = 0; 160 virtual scoped_ptr<Iterator> CreateIterator() = 0;
151 161
152 // Return a list of cache statistics. 162 // Return a list of cache statistics.
153 virtual void GetStats(base::StringPairs* stats) = 0; 163 virtual void GetStats(base::StringPairs* stats) = 0;
154 164
155 // Called whenever an external cache in the system reuses the resource 165 // Called whenever an external cache in the system reuses the resource
156 // referred to by |key|. 166 // referred to by |key|.
157 virtual void OnExternalCacheHit(const std::string& key) = 0; 167 virtual void OnExternalCacheHit(const std::string& key) = 0;
(...skipping 18 matching lines...) Expand all
176 186
177 // Returns the time when this cache entry was last used. 187 // Returns the time when this cache entry was last used.
178 virtual base::Time GetLastUsed() const = 0; 188 virtual base::Time GetLastUsed() const = 0;
179 189
180 // Returns the time when this cache entry was last modified. 190 // Returns the time when this cache entry was last modified.
181 virtual base::Time GetLastModified() const = 0; 191 virtual base::Time GetLastModified() const = 0;
182 192
183 // Returns the size of the cache data with the given index. 193 // Returns the size of the cache data with the given index.
184 virtual int32 GetDataSize(int index) const = 0; 194 virtual int32 GetDataSize(int index) const = 0;
185 195
196 // Returns the total size of this entry, a sum of the cached data for each
197 // valid index.
198 virtual int GetEntrySize() const = 0;
pasko 2015/09/04 14:11:50 I think it is a _bad_ interface to use for calcula
msramek 2015/09/04 16:56:47 Makes sense. I removed GetEntrySize from everywher
199
186 // Copies cached data into the given buffer of length |buf_len|. Returns the 200 // Copies cached data into the given buffer of length |buf_len|. Returns the
187 // number of bytes read or a network error code. If this function returns 201 // number of bytes read or a network error code. If this function returns
188 // ERR_IO_PENDING, the completion callback will be called on the current 202 // ERR_IO_PENDING, the completion callback will be called on the current
189 // thread when the operation completes, and a reference to |buf| will be 203 // thread when the operation completes, and a reference to |buf| will be
190 // retained until the callback is called. Note that as long as the function 204 // retained until the callback is called. Note that as long as the function
191 // does not complete immediately, the callback will always be invoked, even 205 // does not complete immediately, the callback will always be invoked, even
192 // after Close has been called; in other words, the caller may close this 206 // after Close has been called; in other words, the caller may close this
193 // entry without having to wait for all the callbacks, and still rely on the 207 // entry without having to wait for all the callbacks, and still rely on the
194 // cleanup performed from the callback code. 208 // cleanup performed from the callback code.
195 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len, 209 virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 entry->Close(); 332 entry->Close();
319 } 333 }
320 }; 334 };
321 335
322 // Automatically closes an entry when it goes out of scope. 336 // Automatically closes an entry when it goes out of scope.
323 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; 337 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr;
324 338
325 } // namespace disk_cache 339 } // namespace disk_cache
326 340
327 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 341 #endif // NET_DISK_CACHE_DISK_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698