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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 10834313: Add histograms for network activity, and total/cumulative (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
===================================================================
--- net/url_request/url_request_http_job.cc (revision 152373)
+++ net/url_request/url_request_http_job.cc (working copy)
@@ -80,7 +80,9 @@
public:
explicit HttpTransactionDelegateImpl(URLRequest* request)
: request_(request),
- network_delegate_(request->context()->network_delegate()) {
+ network_delegate_(request->context()->network_delegate()),
+ cache_active_(false),
+ network_active_(false) {
}
virtual ~HttpTransactionDelegateImpl() {
OnDetachRequest();
@@ -88,28 +90,54 @@
void OnDetachRequest() {
if (request_ == NULL || network_delegate_ == NULL)
return;
- network_delegate_->NotifyCacheWaitStateChange(
+ network_delegate_->NotifyRequestWaitStateChange(
*request_,
- NetworkDelegate::CACHE_WAIT_STATE_RESET);
+ NetworkDelegate::REQUEST_WAIT_STATE_RESET);
+ cache_active_ = false;
+ network_active_ = false;
request_ = NULL;
}
virtual void OnCacheActionStart() OVERRIDE {
if (request_ == NULL || network_delegate_ == NULL)
return;
- network_delegate_->NotifyCacheWaitStateChange(
+ DCHECK(!cache_active_ && !network_active_);
+ cache_active_ = true;
+ network_delegate_->NotifyRequestWaitStateChange(
*request_,
- NetworkDelegate::CACHE_WAIT_STATE_START);
+ NetworkDelegate::REQUEST_WAIT_STATE_CACHE_START);
}
virtual void OnCacheActionFinish() OVERRIDE {
if (request_ == NULL || network_delegate_ == NULL)
return;
- network_delegate_->NotifyCacheWaitStateChange(
+ DCHECK(cache_active_ && !network_active_);
+ cache_active_ = false;
+ network_delegate_->NotifyRequestWaitStateChange(
*request_,
- NetworkDelegate::CACHE_WAIT_STATE_FINISH);
+ NetworkDelegate::REQUEST_WAIT_STATE_CACHE_FINISH);
}
+ virtual void OnNetworkActionStart() OVERRIDE {
+ if (request_ == NULL || network_delegate_ == NULL)
+ return;
+ DCHECK(!cache_active_ && !network_active_);
+ network_active_ = true;
+ network_delegate_->NotifyRequestWaitStateChange(
+ *request_,
+ NetworkDelegate::REQUEST_WAIT_STATE_NETWORK_START);
+ }
+ virtual void OnNetworkActionFinish() OVERRIDE {
+ if (request_ == NULL || network_delegate_ == NULL)
+ return;
+ DCHECK(!cache_active_ && network_active_);
+ network_active_ = false;
+ network_delegate_->NotifyRequestWaitStateChange(
+ *request_,
+ NetworkDelegate::REQUEST_WAIT_STATE_NETWORK_FINISH);
+ }
private:
URLRequest* request_;
NetworkDelegate* network_delegate_;
+ bool cache_active_;
+ bool network_active_;
};
URLRequestHttpJob::HttpFilterContext::HttpFilterContext(URLRequestHttpJob* job)
@@ -880,6 +908,8 @@
}
void URLRequestHttpJob::Kill() {
+ http_transaction_delegate_->OnDetachRequest();
+
if (!transaction_.get())
return;
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698