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

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

Issue 6005015: Revert 70618 - First pass at adding http/backend cache events to the NetLog. ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | 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-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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 #pragma once 10 #pragma once
11 11
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "net/base/cache_type.h" 17 #include "net/base/cache_type.h"
18 #include "net/base/completion_callback.h" 18 #include "net/base/completion_callback.h"
19 19
20 class FilePath; 20 class FilePath;
21 21
22 namespace base { 22 namespace base {
23 class MessageLoopProxy; 23 class MessageLoopProxy;
24 } 24 }
25 25
26 namespace net { 26 namespace net {
27 class IOBuffer; 27 class IOBuffer;
28 class NetLog;
29 } 28 }
30 29
31 namespace disk_cache { 30 namespace disk_cache {
32 31
33 class Entry; 32 class Entry;
34 class Backend; 33 class Backend;
35 typedef net::CompletionCallback CompletionCallback; 34 typedef net::CompletionCallback CompletionCallback;
36 35
37 // Returns an instance of a Backend of the given |type|. |path| points to a 36 // Returns an instance of a Backend of the given |type|. |path| points to a
38 // folder where the cached data will be stored (if appropriate). This cache 37 // folder where the cached data will be stored (if appropriate). This cache
39 // instance must be the only object that will be reading or writing files to 38 // instance must be the only object that will be reading or writing files to
40 // that folder. The returned object should be deleted when not needed anymore. 39 // that folder. The returned object should be deleted when not needed anymore.
41 // If |force| is true, and there is a problem with the cache initialization, the 40 // If |force| is true, and there is a problem with the cache initialization, the
42 // files will be deleted and a new set will be created. |max_bytes| is the 41 // files will be deleted and a new set will be created. |max_bytes| is the
43 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the 42 // maximum size the cache can grow to. If zero is passed in as |max_bytes|, the
44 // cache will determine the value to use. |thread| can be used to perform IO 43 // cache will determine the value to use. |thread| can be used to perform IO
45 // operations if a dedicated thread is required; a valid value is expected for 44 // operations if a dedicated thread is required; a valid value is expected for
46 // any backend that performs operations on a disk. The returned pointer can be 45 // any backend that performs operations on a disk. The returned pointer can be
47 // NULL if a fatal error is found. The actual return value of the function is a 46 // NULL if a fatal error is found. The actual return value of the function is a
48 // net error code. If this function returns ERR_IO_PENDING, the |callback| will 47 // net error code. If this function returns ERR_IO_PENDING, the |callback| will
49 // be invoked when a backend is available or a fatal error condition is reached. 48 // be invoked when a backend is available or a fatal error condition is reached.
50 // The pointer to receive the |backend| must remain valid until the operation 49 // The pointer to receive the |backend| must remain valid until the operation
51 // completes (the callback is notified). 50 // completes (the callback is notified).
52 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, 51 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
53 bool force, base::MessageLoopProxy* thread, 52 bool force, base::MessageLoopProxy* thread,
54 net::NetLog* net_log, Backend** backend, 53 Backend** backend, CompletionCallback* callback);
55 CompletionCallback* callback);
56 54
57 // The root interface for a disk cache instance. 55 // The root interface for a disk cache instance.
58 class Backend { 56 class Backend {
59 public: 57 public:
60 // If the backend is destroyed when there are operations in progress (any 58 // If the backend is destroyed when there are operations in progress (any
61 // callback that has not been invoked yet), this method cancels said 59 // callback that has not been invoked yet), this method cancels said
62 // operations so the callbacks are not invoked, possibly leaving the work 60 // operations so the callbacks are not invoked, possibly leaving the work
63 // half way (for instance, dooming just a few entries). Note that pending IO 61 // half way (for instance, dooming just a few entries). Note that pending IO
64 // for a given Entry (as opposed to the Backend) will still generate a 62 // for a given Entry (as opposed to the Backend) will still generate a
65 // callback from within this method. 63 // callback from within this method.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Note: This method is deprecated. 287 // Note: This method is deprecated.
290 virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0; 288 virtual int ReadyForSparseIO(CompletionCallback* completion_callback) = 0;
291 289
292 protected: 290 protected:
293 virtual ~Entry() {} 291 virtual ~Entry() {}
294 }; 292 };
295 293
296 } // namespace disk_cache 294 } // namespace disk_cache
297 295
298 #endif // NET_DISK_CACHE_DISK_CACHE_H_ 296 #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