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

Side by Side Diff: net/http/http_cache.h

Issue 7529043: Rename NET_API to NET_EXPORT, and rename NET_TEST to NET_EXPORT_PRIVATE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file declares a HttpTransactionFactory implementation that can be 5 // This file declares a HttpTransactionFactory implementation that can be
6 // layered on top of another HttpTransactionFactory to add HTTP caching. The 6 // layered on top of another HttpTransactionFactory to add HTTP caching. The
7 // caching logic follows RFC 2616 (any exceptions are called out in the code). 7 // caching logic follows RFC 2616 (any exceptions are called out in the code).
8 // 8 //
9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for 9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for
10 // the cache storage. 10 // the cache storage.
(...skipping 12 matching lines...) Expand all
23 #include "base/file_path.h" 23 #include "base/file_path.h"
24 #include "base/hash_tables.h" 24 #include "base/hash_tables.h"
25 #include "base/memory/scoped_ptr.h" 25 #include "base/memory/scoped_ptr.h"
26 #include "base/memory/weak_ptr.h" 26 #include "base/memory/weak_ptr.h"
27 #include "base/message_loop_proxy.h" 27 #include "base/message_loop_proxy.h"
28 #include "base/task.h" 28 #include "base/task.h"
29 #include "base/threading/non_thread_safe.h" 29 #include "base/threading/non_thread_safe.h"
30 #include "net/base/cache_type.h" 30 #include "net/base/cache_type.h"
31 #include "net/base/completion_callback.h" 31 #include "net/base/completion_callback.h"
32 #include "net/base/load_states.h" 32 #include "net/base/load_states.h"
33 #include "net/base/net_api.h" 33 #include "net/base/net_export.h"
34 #include "net/http/http_transaction_factory.h" 34 #include "net/http/http_transaction_factory.h"
35 35
36 class GURL; 36 class GURL;
37 37
38 namespace disk_cache { 38 namespace disk_cache {
39 class Backend; 39 class Backend;
40 class Entry; 40 class Entry;
41 } 41 }
42 42
43 namespace net { 43 namespace net {
44 44
45 class CertVerifier; 45 class CertVerifier;
46 class DnsCertProvenanceChecker; 46 class DnsCertProvenanceChecker;
47 class DnsRRResolver; 47 class DnsRRResolver;
48 class HostResolver; 48 class HostResolver;
49 class HttpAuthHandlerFactory; 49 class HttpAuthHandlerFactory;
50 class HttpNetworkSession; 50 class HttpNetworkSession;
51 struct HttpRequestInfo; 51 struct HttpRequestInfo;
52 class HttpResponseInfo; 52 class HttpResponseInfo;
53 class IOBuffer; 53 class IOBuffer;
54 class NetLog; 54 class NetLog;
55 class NetworkDelegate; 55 class NetworkDelegate;
56 class ProxyService; 56 class ProxyService;
57 class SSLConfigService; 57 class SSLConfigService;
58 class ViewCacheHelper; 58 class ViewCacheHelper;
59 59
60 class NET_API HttpCache : public HttpTransactionFactory, 60 class NET_EXPORT HttpCache : public HttpTransactionFactory,
61 public base::SupportsWeakPtr<HttpCache>, 61 public base::SupportsWeakPtr<HttpCache>,
62 NON_EXPORTED_BASE(public base::NonThreadSafe) { 62 NON_EXPORTED_BASE(public base::NonThreadSafe) {
63 public: 63 public:
64 // The cache mode of operation. 64 // The cache mode of operation.
65 enum Mode { 65 enum Mode {
66 // Normal mode just behaves like a standard web cache. 66 // Normal mode just behaves like a standard web cache.
67 NORMAL = 0, 67 NORMAL = 0,
68 // Record mode caches everything for purposes of offline playback. 68 // Record mode caches everything for purposes of offline playback.
69 RECORD, 69 RECORD,
70 // Playback mode replays from a cache without considering any 70 // Playback mode replays from a cache without considering any
71 // standard invalidations. 71 // standard invalidations.
72 PLAYBACK, 72 PLAYBACK,
73 // Disables reads and writes from the cache. 73 // Disables reads and writes from the cache.
74 // Equivalent to setting LOAD_DISABLE_CACHE on every request. 74 // Equivalent to setting LOAD_DISABLE_CACHE on every request.
75 DISABLE 75 DISABLE
76 }; 76 };
77 77
78 // A BackendFactory creates a backend object to be used by the HttpCache. 78 // A BackendFactory creates a backend object to be used by the HttpCache.
79 class NET_API BackendFactory { 79 class NET_EXPORT BackendFactory {
80 public: 80 public:
81 virtual ~BackendFactory() {} 81 virtual ~BackendFactory() {}
82 82
83 // The actual method to build the backend. Returns a net error code. If 83 // The actual method to build the backend. Returns a net error code. If
84 // ERR_IO_PENDING is returned, the |callback| will be notified when the 84 // ERR_IO_PENDING is returned, the |callback| will be notified when the
85 // operation completes, and |backend| must remain valid until the 85 // operation completes, and |backend| must remain valid until the
86 // notification arrives. 86 // notification arrives.
87 // The implementation must not access the factory object after invoking the 87 // The implementation must not access the factory object after invoking the
88 // |callback| because the object can be deleted from within the callback. 88 // |callback| because the object can be deleted from within the callback.
89 virtual int CreateBackend(NetLog* net_log, 89 virtual int CreateBackend(NetLog* net_log,
90 disk_cache::Backend** backend, 90 disk_cache::Backend** backend,
91 CompletionCallback* callback) = 0; 91 CompletionCallback* callback) = 0;
92 }; 92 };
93 93
94 // A default backend factory for the common use cases. 94 // A default backend factory for the common use cases.
95 class NET_API DefaultBackend : public BackendFactory { 95 class NET_EXPORT DefaultBackend : public BackendFactory {
96 public: 96 public:
97 // |path| is the destination for any files used by the backend, and 97 // |path| is the destination for any files used by the backend, and
98 // |cache_thread| is the thread where disk operations should take place. If 98 // |cache_thread| is the thread where disk operations should take place. If
99 // |max_bytes| is zero, a default value will be calculated automatically. 99 // |max_bytes| is zero, a default value will be calculated automatically.
100 DefaultBackend(CacheType type, const FilePath& path, int max_bytes, 100 DefaultBackend(CacheType type, const FilePath& path, int max_bytes,
101 base::MessageLoopProxy* thread); 101 base::MessageLoopProxy* thread);
102 virtual ~DefaultBackend(); 102 virtual ~DefaultBackend();
103 103
104 // Returns a factory for an in-memory cache. 104 // Returns a factory for an in-memory cache.
105 static BackendFactory* InMemory(int max_bytes); 105 static BackendFactory* InMemory(int max_bytes);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 ScopedRunnableMethodFactory<HttpCache> task_factory_; 376 ScopedRunnableMethodFactory<HttpCache> task_factory_;
377 377
378 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 378 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
379 379
380 DISALLOW_COPY_AND_ASSIGN(HttpCache); 380 DISALLOW_COPY_AND_ASSIGN(HttpCache);
381 }; 381 };
382 382
383 } // namespace net 383 } // namespace net
384 384
385 #endif // NET_HTTP_HTTP_CACHE_H_ 385 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698