Chromium Code Reviews| Index: net/http/http_cache_transaction.cc |
| =================================================================== |
| --- net/http/http_cache_transaction.cc (revision 150909) |
| +++ net/http/http_cache_transaction.cc (working copy) |
| @@ -745,12 +745,15 @@ |
| if (rv != OK) |
| return rv; |
| + ReportNetworkActionStart(); |
|
mmenke
2012/08/15 15:09:53
I'm a bit concerned about mismatched Report*() cal
tburkard
2012/08/15 16:50:46
I can add that to the HttpTransactionDelegateImpl,
mmenke
2012/08/15 18:45:41
When the state was solely for use elsewhere, I tho
mmenke
2012/08/15 19:08:34
Actually, my real objection is that it was in net/
tburkard
2012/08/15 20:42:24
Done.
|
| next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| rv = network_trans_->Start(request_, io_callback_, net_log_); |
| return rv; |
| } |
| int HttpCache::Transaction::DoSendRequestComplete(int result) { |
| + ReportNetworkActionFinish(); |
| + |
| if (!cache_) |
| return ERR_UNEXPECTED; |
| @@ -839,6 +842,7 @@ |
| } |
| int HttpCache::Transaction::DoNetworkRead() { |
| + ReportNetworkActionStart(); |
| next_state_ = STATE_NETWORK_READ_COMPLETE; |
| return network_trans_->Read(read_buf_, io_buf_len_, io_callback_); |
| } |
| @@ -846,6 +850,8 @@ |
| int HttpCache::Transaction::DoNetworkReadComplete(int result) { |
| DCHECK(mode_ & WRITE || mode_ == NONE); |
| + ReportNetworkActionFinish(); |
| + |
| if (!cache_) |
| return ERR_UNEXPECTED; |
| @@ -1319,7 +1325,7 @@ |
| int HttpCache::Transaction::DoCacheWriteTruncatedResponse() { |
| if (entry_) { |
| - if (net_log_.IsLoggingAllEvents() && entry_) |
| + if (net_log_.IsLoggingAllEvents()) |
| net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO); |
| ReportCacheActionStart(); |
| } |
| @@ -1773,6 +1779,7 @@ |
| DCHECK(network_trans_.get()); |
| DCHECK_EQ(STATE_NONE, next_state_); |
| + ReportNetworkActionStart(); |
| next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| int rv = network_trans_->RestartIgnoringLastError(io_callback_); |
| if (rv != ERR_IO_PENDING) |
| @@ -1786,6 +1793,7 @@ |
| DCHECK(network_trans_.get()); |
| DCHECK_EQ(STATE_NONE, next_state_); |
| + ReportNetworkActionStart(); |
| next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| int rv = network_trans_->RestartWithCertificate(client_cert, io_callback_); |
| if (rv != ERR_IO_PENDING) |
| @@ -1799,6 +1807,7 @@ |
| DCHECK(network_trans_.get()); |
| DCHECK_EQ(STATE_NONE, next_state_); |
| + ReportNetworkActionStart(); |
| next_state_ = STATE_SEND_REQUEST_COMPLETE; |
| int rv = network_trans_->RestartWithAuth(credentials, io_callback_); |
| if (rv != ERR_IO_PENDING) |
| @@ -2083,6 +2092,11 @@ |
| response_.headers->HasHeaderValue("cache-control", "no-store")) || |
| net::IsCertStatusError(response_.ssl_info.cert_status)) { |
| DoneWritingToEntry(false); |
| + ReportCacheActionFinish(); |
| + if (net_log_.IsLoggingAllEvents()) { |
| + net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, |
| + OK); |
|
mmenke
2012/08/15 15:09:53
optional nit: Can just use EndEvent. "OK" is ign
tburkard
2012/08/15 16:50:46
Done.
|
| + } |
| return OK; |
| } |
| @@ -2232,6 +2246,16 @@ |
| transaction_delegate_->OnCacheActionFinish(); |
| } |
| +void HttpCache::Transaction::ReportNetworkActionStart() { |
| + if (transaction_delegate_) |
| + transaction_delegate_->OnNetworkActionStart(); |
| +} |
| + |
| +void HttpCache::Transaction::ReportNetworkActionFinish() { |
| + if (transaction_delegate_) |
| + transaction_delegate_->OnNetworkActionFinish(); |
| +} |
| + |
| void HttpCache::Transaction::UpdateTransactionPattern( |
| TransactionPattern new_transaction_pattern) { |
| if (transaction_pattern_ == PATTERN_NOT_COVERED) |