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

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

Issue 49027: Disk cache: First pass to make it possible to have... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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/backend_unittest.cc ('k') | net/disk_cache/disk_cache_perftest.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/disk-cache 6 // http://dev.chromium.org/developers/design-documents/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 <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "net/base/cache_type.h"
17 #include "net/base/completion_callback.h" 18 #include "net/base/completion_callback.h"
18 19
19 namespace net { 20 namespace net {
20 class IOBuffer; 21 class IOBuffer;
21 } 22 }
22 23
23 namespace disk_cache { 24 namespace disk_cache {
24 25
25 class Entry; 26 class Entry;
26 class Backend; 27 class Backend;
27 28
28 // Returns an instance of the Backend. path points to a folder where 29 // Returns an instance of the Backend. path points to a folder where
29 // the cached data will be stored. This cache instance must be the only object 30 // the cached data will be stored. This cache instance must be the only object
30 // that will be reading or writing files to that folder. The returned object 31 // that will be reading or writing files to that folder. The returned object
31 // should be deleted when not needed anymore. If force is true, and there is 32 // should be deleted when not needed anymore. If force is true, and there is
32 // a problem with the cache initialization, the files will be deleted and a 33 // a problem with the cache initialization, the files will be deleted and a
33 // new set will be created. max_bytes is the maximum size the cache can grow to. 34 // new set will be created. max_bytes is the maximum size the cache can grow to.
34 // If zero is passed in as max_bytes, the cache will determine the value to use 35 // If zero is passed in as max_bytes, the cache will determine the value to use
35 // based on the available disk space. The returned pointer can be NULL if a 36 // based on the available disk space. The returned pointer can be NULL if a
36 // fatal error is found. 37 // fatal error is found.
37 Backend* CreateCacheBackend(const std::wstring& path, bool force, 38 Backend* CreateCacheBackend(const std::wstring& path, bool force,
38 int max_bytes); 39 int max_bytes, net::CacheType type);
39 40
40 // Returns an instance of a Backend implemented only in memory. The returned 41 // Returns an instance of a Backend implemented only in memory. The returned
41 // object should be deleted when not needed anymore. max_bytes is the maximum 42 // object should be deleted when not needed anymore. max_bytes is the maximum
42 // size the cache can grow to. If zero is passed in as max_bytes, the cache will 43 // size the cache can grow to. If zero is passed in as max_bytes, the cache will
43 // determine the value to use based on the available memory. The returned 44 // determine the value to use based on the available memory. The returned
44 // pointer can be NULL if a fatal error is found. 45 // pointer can be NULL if a fatal error is found.
45 Backend* CreateInMemoryCacheBackend(int max_bytes); 46 Backend* CreateInMemoryCacheBackend(int max_bytes);
46 47
47 // The root interface for a disk cache instance. 48 // The root interface for a disk cache instance.
48 class Backend { 49 class Backend {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // close the handle after use or there will be a leak. 177 // close the handle after use or there will be a leak.
177 virtual base::PlatformFile GetPlatformFile(int index) = 0; 178 virtual base::PlatformFile GetPlatformFile(int index) = 0;
178 179
179 protected: 180 protected:
180 virtual ~Entry() {} 181 virtual ~Entry() {}
181 }; 182 };
182 183
183 } // namespace disk_cache 184 } // namespace disk_cache
184 185
185 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 186 #endif // NET_DISK_CACHE_DISK_CACHE_H_
OLDNEW
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698