Index: net/http/http_cache.cc |
=================================================================== |
--- net/http/http_cache.cc (revision 68857) |
+++ net/http/http_cache.cc (working copy) |
@@ -21,6 +21,7 @@ |
#include "base/string_number_conversions.h" |
#include "base/string_util.h" |
#include "base/stringprintf.h" |
+#include "base/values.h" |
#include "net/base/io_buffer.h" |
#include "net/base/load_flags.h" |
#include "net/base/net_errors.h" |
@@ -55,17 +56,18 @@ |
return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL); |
} |
-int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend, |
+int HttpCache::DefaultBackend::CreateBackend(NetLog* net_log, |
+ disk_cache::Backend** backend, |
CompletionCallback* callback) { |
DCHECK_GE(max_bytes_, 0); |
return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, |
- thread_, backend, callback); |
+ thread_, net_log, backend, callback); |
} |
//----------------------------------------------------------------------------- |
-HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e) |
- : disk_entry(e), |
+HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry) |
+ : disk_entry(entry), |
writer(NULL), |
will_process_pending_queue(false), |
doomed(false) { |
@@ -287,7 +289,8 @@ |
HttpNetworkDelegate* network_delegate, |
NetLog* net_log, |
BackendFactory* backend_factory) |
- : backend_factory_(backend_factory), |
+ : net_log_(net_log), |
+ backend_factory_(backend_factory), |
building_backend_(false), |
mode_(NORMAL), |
ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( |
@@ -302,7 +305,8 @@ |
HttpCache::HttpCache(HttpNetworkSession* session, |
BackendFactory* backend_factory) |
- : backend_factory_(backend_factory), |
+ : net_log_(session->net_log()), |
+ backend_factory_(backend_factory), |
building_backend_(false), |
mode_(NORMAL), |
network_layer_(HttpNetworkLayer::CreateFactory(session)), |
@@ -310,8 +314,10 @@ |
} |
HttpCache::HttpCache(HttpTransactionFactory* network_layer, |
- BackendFactory* backend_factory) |
- : backend_factory_(backend_factory), |
+ BackendFactory* backend_factory, |
+ NetLog* net_log) |
+ : net_log_(net_log), |
+ backend_factory_(backend_factory), |
building_backend_(false), |
mode_(NORMAL), |
network_layer_(network_layer), |
@@ -463,7 +469,8 @@ |
BackendCallback* my_callback = new BackendCallback(this, pending_op); |
pending_op->callback = my_callback; |
- int rv = backend_factory_->CreateBackend(&pending_op->backend, my_callback); |
+ int rv = backend_factory_->CreateBackend(net_log_, &pending_op->backend, |
+ my_callback); |
if (rv != ERR_IO_PENDING) { |
pending_op->writer->ClearCallback(); |
my_callback->Run(rv); |
@@ -732,6 +739,17 @@ |
} |
int HttpCache::AddTransactionToEntry(ActiveEntry* entry, Transaction* trans) { |
+ int result = AddTransactionToEntryInternal(entry, trans); |
+ if (result == ERR_IO_PENDING) { |
+ trans->net_log().BeginEvent( |
+ NetLog::TYPE_ACTIVE_ENTRY_QUEUE, |
rvargas (doing something else)
2010/12/13 23:34:39
This seems to do the same as TYPE_HTTP_CACHE_ADD_T
mmenke
2010/12/14 17:53:43
Removed. If we decide we really want queue length
|
+ new NetLogIntegerParameter("queue_size", entry->pending_queue.size())); |
+ } |
+ return result; |
+} |
+ |
+int HttpCache::AddTransactionToEntryInternal(ActiveEntry* entry, |
+ Transaction* trans) { |
DCHECK(entry); |
DCHECK(entry->disk_entry); |
@@ -956,8 +974,9 @@ |
entry->pending_queue.erase(entry->pending_queue.begin()); |
- int rv = AddTransactionToEntry(entry, next); |
+ int rv = AddTransactionToEntryInternal(entry, next); |
if (rv != ERR_IO_PENDING) { |
+ next->net_log().EndEvent(NetLog::TYPE_ACTIVE_ENTRY_QUEUE, NULL); |
next->io_callback()->Run(rv); |
} |
} |