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

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

Issue 5386001: Cache certificate verification results in memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add unit tests. Ready for review. Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "net/http/http_cache.h" 5 #include "net/http/http_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void HttpCache::MetadataWriter::OnIOComplete(int result) { 256 void HttpCache::MetadataWriter::OnIOComplete(int result) {
257 if (!verified_) 257 if (!verified_)
258 return VerifyResponse(result); 258 return VerifyResponse(result);
259 SelfDestroy(); 259 SelfDestroy();
260 } 260 }
261 261
262 //----------------------------------------------------------------------------- 262 //-----------------------------------------------------------------------------
263 263
264 class HttpCache::SSLHostInfoFactoryAdaptor : public SSLHostInfoFactory { 264 class HttpCache::SSLHostInfoFactoryAdaptor : public SSLHostInfoFactory {
265 public: 265 public:
266 SSLHostInfoFactoryAdaptor(HttpCache* http_cache) 266 explicit SSLHostInfoFactoryAdaptor(HttpCache* http_cache)
267 : http_cache_(http_cache) { 267 : http_cache_(http_cache) {
268 } 268 }
269 269
270 SSLHostInfo* GetForHost(const std::string& hostname, 270 SSLHostInfo* GetForHost(const std::string& hostname,
271 const SSLConfig& ssl_config) { 271 const SSLConfig& ssl_config) {
272 return new DiskCacheBasedSSLHostInfo(hostname, ssl_config, http_cache_); 272 return new DiskCacheBasedSSLHostInfo(hostname, ssl_config, http_cache_);
273 } 273 }
274 274
275 private: 275 private:
276 HttpCache* const http_cache_; 276 HttpCache* const http_cache_;
277 }; 277 };
278 278
279 //----------------------------------------------------------------------------- 279 //-----------------------------------------------------------------------------
280 280
281 HttpCache::HttpCache(HostResolver* host_resolver, 281 HttpCache::HttpCache(HostResolver* host_resolver,
282 CertVerifier* cert_verifier,
282 DnsRRResolver* dnsrr_resolver, 283 DnsRRResolver* dnsrr_resolver,
283 DnsCertProvenanceChecker* dns_cert_checker_, 284 DnsCertProvenanceChecker* dns_cert_checker_,
284 ProxyService* proxy_service, 285 ProxyService* proxy_service,
285 SSLConfigService* ssl_config_service, 286 SSLConfigService* ssl_config_service,
286 HttpAuthHandlerFactory* http_auth_handler_factory, 287 HttpAuthHandlerFactory* http_auth_handler_factory,
287 HttpNetworkDelegate* network_delegate, 288 HttpNetworkDelegate* network_delegate,
288 NetLog* net_log, 289 NetLog* net_log,
289 BackendFactory* backend_factory) 290 BackendFactory* backend_factory)
290 : backend_factory_(backend_factory), 291 : backend_factory_(backend_factory),
291 building_backend_(false), 292 building_backend_(false),
292 mode_(NORMAL), 293 mode_(NORMAL),
293 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( 294 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
294 ALLOW_THIS_IN_INITIALIZER_LIST(this))), 295 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
295 network_layer_(HttpNetworkLayer::CreateFactory(host_resolver, 296 network_layer_(HttpNetworkLayer::CreateFactory(host_resolver,
296 dnsrr_resolver, dns_cert_checker_, 297 cert_verifier, dnsrr_resolver, dns_cert_checker_,
297 ssl_host_info_factory_.get(), 298 ssl_host_info_factory_.get(),
298 proxy_service, ssl_config_service, 299 proxy_service, ssl_config_service,
299 http_auth_handler_factory, network_delegate, net_log)), 300 http_auth_handler_factory, network_delegate, net_log)),
300 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 301 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
301 } 302 }
302 303
303 HttpCache::HttpCache(HttpNetworkSession* session, 304 HttpCache::HttpCache(HttpNetworkSession* session,
304 BackendFactory* backend_factory) 305 BackendFactory* backend_factory)
305 : backend_factory_(backend_factory), 306 : backend_factory_(backend_factory),
306 building_backend_(false), 307 building_backend_(false),
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 building_backend_ = false; 1087 building_backend_ = false;
1087 DeletePendingOp(pending_op); 1088 DeletePendingOp(pending_op);
1088 } 1089 }
1089 1090
1090 // The cache may be gone when we return from the callback. 1091 // The cache may be gone when we return from the callback.
1091 if (!item->DoCallback(result, backend)) 1092 if (!item->DoCallback(result, backend))
1092 item->NotifyTransaction(result, NULL); 1093 item->NotifyTransaction(result, NULL);
1093 } 1094 }
1094 1095
1095 } // namespace net 1096 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698