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

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

Issue 2626173003: Calculate the size of all cache entries between two points in time. (Closed)
Patch Set: revert cache_storage_cache_unittest.cc Created 3 years, 11 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
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/disk_cache.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) 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
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <memory> 13 #include <memory>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "net/base/cache_type.h" 20 #include "net/base/cache_type.h"
21 #include "net/base/completion_callback.h" 21 #include "net/base/completion_callback.h"
22 #include "net/base/net_errors.h"
22 #include "net/base/net_export.h" 23 #include "net/base/net_export.h"
23 24
24 namespace base { 25 namespace base {
25 class FilePath; 26 class FilePath;
26 class SingleThreadTaskRunner; 27 class SingleThreadTaskRunner;
27 } 28 }
28 29
29 namespace net { 30 namespace net {
30 class IOBuffer; 31 class IOBuffer;
31 class NetLog; 32 class NetLog;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Marks all entries accessed since |initial_time| for deletion. The return 143 // Marks all entries accessed since |initial_time| for deletion. The return
143 // value is a net error code. If this method returns ERR_IO_PENDING, the 144 // value is a net error code. If this method returns ERR_IO_PENDING, the
144 // |callback| will be invoked when the operation completes. 145 // |callback| will be invoked when the operation completes.
145 // Entries with |initial_time| <= access time are deleted. 146 // Entries with |initial_time| <= access time are deleted.
146 virtual int DoomEntriesSince(base::Time initial_time, 147 virtual int DoomEntriesSince(base::Time initial_time,
147 const CompletionCallback& callback) = 0; 148 const CompletionCallback& callback) = 0;
148 149
149 // Calculate the total size of the cache. The return value is the size in 150 // Calculate the total size of the cache. The return value is the size in
150 // bytes or a net error code. If this method returns ERR_IO_PENDING, 151 // bytes or a net error code. If this method returns ERR_IO_PENDING,
151 // the |callback| will be invoked when the operation completes. 152 // the |callback| will be invoked when the operation completes.
152 virtual int CalculateSizeOfAllEntries( 153 virtual int CalculateSizeOfAllEntries(const CompletionCallback& callback) = 0;
153 const CompletionCallback& callback) = 0; 154
155 // Calculate the size of all cache entries accessed between |initial_time| and
156 // |end_time|.
157 // The return value is the size in bytes or a net error code. The default
158 // implementation returns ERR_NOT_IMPLEMENTED and should only be overwritten
159 // if there is an efficient way for the backend to determine the size for a
160 // subset of the cache without reading the whole cache from disk.
161 // If this method returns ERR_IO_PENDING, the |callback| will be invoked when
162 // the operation completes.
163 virtual int CalculateSizeOfEntriesBetween(base::Time initial_time,
164 base::Time end_time,
165 const CompletionCallback& callback);
154 166
155 // Returns an iterator which will enumerate all entries of the cache in an 167 // Returns an iterator which will enumerate all entries of the cache in an
156 // undefined order. 168 // undefined order.
157 virtual std::unique_ptr<Iterator> CreateIterator() = 0; 169 virtual std::unique_ptr<Iterator> CreateIterator() = 0;
158 170
159 // Return a list of cache statistics. 171 // Return a list of cache statistics.
160 virtual void GetStats(base::StringPairs* stats) = 0; 172 virtual void GetStats(base::StringPairs* stats) = 0;
161 173
162 // Called whenever an external cache in the system reuses the resource 174 // Called whenever an external cache in the system reuses the resource
163 // referred to by |key|. 175 // referred to by |key|.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 entry->Close(); 343 entry->Close();
332 } 344 }
333 }; 345 };
334 346
335 // Automatically closes an entry when it goes out of scope. 347 // Automatically closes an entry when it goes out of scope.
336 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; 348 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr;
337 349
338 } // namespace disk_cache 350 } // namespace disk_cache
339 351
340 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 352 #endif // NET_DISK_CACHE_DISK_CACHE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/disk_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698