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

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

Issue 119189: Add two small features to the HttpCache for benchmarking/debugging.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « no previous file | net/http/http_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) 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 // 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 30 matching lines...) Expand all
41 ~HttpCache(); 41 ~HttpCache();
42 42
43 // The cache mode of operation. 43 // The cache mode of operation.
44 enum Mode { 44 enum Mode {
45 // Normal mode just behaves like a standard web cache. 45 // Normal mode just behaves like a standard web cache.
46 NORMAL = 0, 46 NORMAL = 0,
47 // Record mode caches everything for purposes of offline playback. 47 // Record mode caches everything for purposes of offline playback.
48 RECORD, 48 RECORD,
49 // Playback mode replays from a cache without considering any 49 // Playback mode replays from a cache without considering any
50 // standard invalidations. 50 // standard invalidations.
51 PLAYBACK 51 PLAYBACK,
52 // Disables reads and writes from the cache.
53 // Equivalent to setting LOAD_DISABLE_CACHE on every request.
54 DISABLE
52 }; 55 };
53 56
54 // Initialize the cache from the directory where its data is stored. The 57 // Initialize the cache from the directory where its data is stored. The
55 // disk cache is initialized lazily (by CreateTransaction) in this case. If 58 // disk cache is initialized lazily (by CreateTransaction) in this case. If
56 // |cache_size| is zero, a default value will be calculated automatically. 59 // |cache_size| is zero, a default value will be calculated automatically.
57 HttpCache(ProxyService* proxy_service, 60 HttpCache(ProxyService* proxy_service,
58 const std::wstring& cache_dir, 61 const std::wstring& cache_dir,
59 int cache_size); 62 int cache_size);
60 63
61 // Initialize the cache from the directory where its data is stored. The 64 // Initialize the cache from the directory where its data is stored. The
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const HttpResponseInfo* response_info, 99 const HttpResponseInfo* response_info,
97 bool skip_transient_headers); 100 bool skip_transient_headers);
98 101
99 // Get/Set the cache's mode. 102 // Get/Set the cache's mode.
100 void set_mode(Mode value) { mode_ = value; } 103 void set_mode(Mode value) { mode_ = value; }
101 Mode mode() { return mode_; } 104 Mode mode() { return mode_; }
102 105
103 void set_type(CacheType type) { type_ = type; } 106 void set_type(CacheType type) { type_ = type; }
104 CacheType type() { return type_; } 107 CacheType type() { return type_; }
105 108
109 // Close All Idle Sockets. This is for debugging.
110 void CloseIdleConnections();
111
106 private: 112 private:
107 113
108 // Types -------------------------------------------------------------------- 114 // Types --------------------------------------------------------------------
109 115
110 class Transaction; 116 class Transaction;
111 friend class Transaction; 117 friend class Transaction;
112 118
113 typedef std::list<Transaction*> TransactionList; 119 typedef std::list<Transaction*> TransactionList;
114 120
115 struct ActiveEntry { 121 struct ActiveEntry {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 scoped_ptr<PlaybackCacheMap> playback_cache_map_; 185 scoped_ptr<PlaybackCacheMap> playback_cache_map_;
180 186
181 RevocableStore transactions_; 187 RevocableStore transactions_;
182 188
183 DISALLOW_COPY_AND_ASSIGN(HttpCache); 189 DISALLOW_COPY_AND_ASSIGN(HttpCache);
184 }; 190 };
185 191
186 } // namespace net 192 } // namespace net
187 193
188 #endif // NET_HTTP_HTTP_CACHE_H_ 194 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698