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

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

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/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('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) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 thread_(thread) { 48 thread_(thread) {
49 } 49 }
50 50
51 HttpCache::DefaultBackend::~DefaultBackend() {} 51 HttpCache::DefaultBackend::~DefaultBackend() {}
52 52
53 // static 53 // static
54 HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) { 54 HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) {
55 return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL); 55 return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL);
56 } 56 }
57 57
58 int HttpCache::DefaultBackend::CreateBackend(NetLog* net_log, 58 int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend,
59 disk_cache::Backend** backend,
60 CompletionCallback* callback) { 59 CompletionCallback* callback) {
61 DCHECK_GE(max_bytes_, 0); 60 DCHECK_GE(max_bytes_, 0);
62 return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, 61 return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true,
63 thread_, net_log, backend, callback); 62 thread_, backend, callback);
64 } 63 }
65 64
66 //----------------------------------------------------------------------------- 65 //-----------------------------------------------------------------------------
67 66
68 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry) 67 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e)
69 : disk_entry(entry), 68 : disk_entry(e),
70 writer(NULL), 69 writer(NULL),
71 will_process_pending_queue(false), 70 will_process_pending_queue(false),
72 doomed(false) { 71 doomed(false) {
73 } 72 }
74 73
75 HttpCache::ActiveEntry::~ActiveEntry() { 74 HttpCache::ActiveEntry::~ActiveEntry() {
76 if (disk_entry) { 75 if (disk_entry) {
77 disk_entry->Close(); 76 disk_entry->Close();
78 disk_entry = NULL; 77 disk_entry = NULL;
79 } 78 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 HttpCache::HttpCache(HostResolver* host_resolver, 281 HttpCache::HttpCache(HostResolver* host_resolver,
283 CertVerifier* cert_verifier, 282 CertVerifier* cert_verifier,
284 DnsRRResolver* dnsrr_resolver, 283 DnsRRResolver* dnsrr_resolver,
285 DnsCertProvenanceChecker* dns_cert_checker_, 284 DnsCertProvenanceChecker* dns_cert_checker_,
286 ProxyService* proxy_service, 285 ProxyService* proxy_service,
287 SSLConfigService* ssl_config_service, 286 SSLConfigService* ssl_config_service,
288 HttpAuthHandlerFactory* http_auth_handler_factory, 287 HttpAuthHandlerFactory* http_auth_handler_factory,
289 HttpNetworkDelegate* network_delegate, 288 HttpNetworkDelegate* network_delegate,
290 NetLog* net_log, 289 NetLog* net_log,
291 BackendFactory* backend_factory) 290 BackendFactory* backend_factory)
292 : net_log_(net_log), 291 : backend_factory_(backend_factory),
293 backend_factory_(backend_factory),
294 building_backend_(false), 292 building_backend_(false),
295 mode_(NORMAL), 293 mode_(NORMAL),
296 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( 294 ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
297 ALLOW_THIS_IN_INITIALIZER_LIST(this))), 295 ALLOW_THIS_IN_INITIALIZER_LIST(this))),
298 network_layer_(HttpNetworkLayer::CreateFactory(host_resolver, 296 network_layer_(HttpNetworkLayer::CreateFactory(host_resolver,
299 cert_verifier, dnsrr_resolver, dns_cert_checker_, 297 cert_verifier, dnsrr_resolver, dns_cert_checker_,
300 ssl_host_info_factory_.get(), 298 ssl_host_info_factory_.get(),
301 proxy_service, ssl_config_service, 299 proxy_service, ssl_config_service,
302 http_auth_handler_factory, network_delegate, net_log)), 300 http_auth_handler_factory, network_delegate, net_log)),
303 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 301 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
304 } 302 }
305 303
306 HttpCache::HttpCache(HttpNetworkSession* session, 304 HttpCache::HttpCache(HttpNetworkSession* session,
307 BackendFactory* backend_factory) 305 BackendFactory* backend_factory)
308 : net_log_(session->net_log()), 306 : backend_factory_(backend_factory),
309 backend_factory_(backend_factory),
310 building_backend_(false), 307 building_backend_(false),
311 mode_(NORMAL), 308 mode_(NORMAL),
312 network_layer_(HttpNetworkLayer::CreateFactory(session)), 309 network_layer_(HttpNetworkLayer::CreateFactory(session)),
313 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 310 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
314 } 311 }
315 312
316 HttpCache::HttpCache(HttpTransactionFactory* network_layer, 313 HttpCache::HttpCache(HttpTransactionFactory* network_layer,
317 NetLog* net_log,
318 BackendFactory* backend_factory) 314 BackendFactory* backend_factory)
319 : net_log_(net_log), 315 : backend_factory_(backend_factory),
320 backend_factory_(backend_factory),
321 building_backend_(false), 316 building_backend_(false),
322 mode_(NORMAL), 317 mode_(NORMAL),
323 network_layer_(network_layer), 318 network_layer_(network_layer),
324 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { 319 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
325 } 320 }
326 321
327 HttpCache::~HttpCache() { 322 HttpCache::~HttpCache() {
328 // If we have any active entries remaining, then we need to deactivate them. 323 // If we have any active entries remaining, then we need to deactivate them.
329 // We may have some pending calls to OnProcessPendingQueue, but since those 324 // We may have some pending calls to OnProcessPendingQueue, but since those
330 // won't run (due to our destruction), we can simply ignore the corresponding 325 // won't run (due to our destruction), we can simply ignore the corresponding
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 pending_op->pending_queue.push_back(item.release()); 457 pending_op->pending_queue.push_back(item.release());
463 return ERR_IO_PENDING; 458 return ERR_IO_PENDING;
464 } 459 }
465 460
466 DCHECK(pending_op->pending_queue.empty()); 461 DCHECK(pending_op->pending_queue.empty());
467 462
468 pending_op->writer = item.release(); 463 pending_op->writer = item.release();
469 BackendCallback* my_callback = new BackendCallback(this, pending_op); 464 BackendCallback* my_callback = new BackendCallback(this, pending_op);
470 pending_op->callback = my_callback; 465 pending_op->callback = my_callback;
471 466
472 int rv = backend_factory_->CreateBackend(net_log_, &pending_op->backend, 467 int rv = backend_factory_->CreateBackend(&pending_op->backend, my_callback);
473 my_callback);
474 if (rv != ERR_IO_PENDING) { 468 if (rv != ERR_IO_PENDING) {
475 pending_op->writer->ClearCallback(); 469 pending_op->writer->ClearCallback();
476 my_callback->Run(rv); 470 my_callback->Run(rv);
477 } 471 }
478 472
479 return rv; 473 return rv;
480 } 474 }
481 475
482 int HttpCache::GetBackendForTransaction(Transaction* trans) { 476 int HttpCache::GetBackendForTransaction(Transaction* trans) {
483 if (disk_cache_.get()) 477 if (disk_cache_.get())
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 building_backend_ = false; 1087 building_backend_ = false;
1094 DeletePendingOp(pending_op); 1088 DeletePendingOp(pending_op);
1095 } 1089 }
1096 1090
1097 // The cache may be gone when we return from the callback. 1091 // The cache may be gone when we return from the callback.
1098 if (!item->DoCallback(result, backend)) 1092 if (!item->DoCallback(result, backend))
1099 item->NotifyTransaction(result, NULL); 1093 item->NotifyTransaction(result, NULL);
1100 } 1094 }
1101 1095
1102 } // namespace net 1096 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698