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

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

Issue 1342613002: Revert of Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/cert_net/cert_net_fetcher_impl_unittest.cc ('k') | 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) 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 // 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 7234 (any exceptions are called out in the code). 7 // caching logic follows RFC 7234 (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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const base::FilePath path_; 119 const base::FilePath path_;
120 int max_bytes_; 120 int max_bytes_;
121 scoped_refptr<base::SingleThreadTaskRunner> thread_; 121 scoped_refptr<base::SingleThreadTaskRunner> thread_;
122 }; 122 };
123 123
124 // The number of minutes after a resource is prefetched that it can be used 124 // The number of minutes after a resource is prefetched that it can be used
125 // again without validation. 125 // again without validation.
126 static const int kPrefetchReuseMins = 5; 126 static const int kPrefetchReuseMins = 5;
127 127
128 // The disk cache is initialized lazily (by CreateTransaction) in this case. 128 // The disk cache is initialized lazily (by CreateTransaction) in this case.
129 // The HttpCache takes ownership of the |backend_factory|.
130 HttpCache(const HttpNetworkSession::Params& params,
131 BackendFactory* backend_factory);
132
133 // The disk cache is initialized lazily (by CreateTransaction) in this case.
129 // Provide an existing HttpNetworkSession, the cache can construct a 134 // Provide an existing HttpNetworkSession, the cache can construct a
130 // network layer with a shared HttpNetworkSession in order for multiple 135 // network layer with a shared HttpNetworkSession in order for multiple
131 // network layers to share information (e.g. authentication data). The 136 // network layers to share information (e.g. authentication data). The
132 // HttpCache takes ownership of the |backend_factory|. 137 // HttpCache takes ownership of the |backend_factory|.
133 // 138 HttpCache(HttpNetworkSession* session, BackendFactory* backend_factory);
134 // The HttpCache must be destroyed before the HttpNetworkSession.
135 //
136 // If |set_up_quic_server_info| is true, configures the cache to track
137 // information about servers supporting QUIC.
138 HttpCache(HttpNetworkSession* session,
139 BackendFactory* backend_factory,
140 bool set_up_quic_server_info);
141 139
142 // Initialize the cache from its component parts. The lifetime of the 140 // Initialize the cache from its component parts. The lifetime of the
143 // |network_layer| and |backend_factory| are managed by the HttpCache and 141 // |network_layer| and |backend_factory| are managed by the HttpCache and
144 // will be destroyed using |delete| when the HttpCache is destroyed. 142 // will be destroyed using |delete| when the HttpCache is destroyed.
145 HttpCache(HttpTransactionFactory* network_layer, 143 HttpCache(HttpTransactionFactory* network_layer,
146 NetLog* net_log, 144 NetLog* net_log,
147 BackendFactory* backend_factory, 145 BackendFactory* backend_factory);
148 bool set_up_quic_server_info);
149 146
150 ~HttpCache() override; 147 ~HttpCache() override;
151 148
152 HttpTransactionFactory* network_layer() { return network_layer_.get(); } 149 HttpTransactionFactory* network_layer() { return network_layer_.get(); }
153 150
154 DiskBasedCertCache* cert_cache() const { return cert_cache_.get(); } 151 DiskBasedCertCache* cert_cache() const { return cert_cache_.get(); }
155 152
156 // Retrieves the cache backend for this HttpCache instance. If the backend 153 // Retrieves the cache backend for this HttpCache instance. If the backend
157 // is not initialized yet, this method will initialize it. The return value is 154 // is not initialized yet, this method will initialize it. The return value is
158 // a network error code, and it could be ERR_IO_PENDING, in which case the 155 // a network error code, and it could be ERR_IO_PENDING, in which case the
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 scoped_ptr<base::Clock> clock_; 441 scoped_ptr<base::Clock> clock_;
445 442
446 base::WeakPtrFactory<HttpCache> weak_factory_; 443 base::WeakPtrFactory<HttpCache> weak_factory_;
447 444
448 DISALLOW_COPY_AND_ASSIGN(HttpCache); 445 DISALLOW_COPY_AND_ASSIGN(HttpCache);
449 }; 446 };
450 447
451 } // namespace net 448 } // namespace net
452 449
453 #endif // NET_HTTP_HTTP_CACHE_H_ 450 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW
« no previous file with comments | « net/cert_net/cert_net_fetcher_impl_unittest.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698