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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 explicit HttpTransactionDelegateImpl(URLRequest* request) 81 explicit HttpTransactionDelegateImpl(URLRequest* request)
82 : request_(request), 82 : request_(request),
83 network_delegate_(request->context()->network_delegate()) { 83 network_delegate_(request->context()->network_delegate()) {
84 } 84 }
85 virtual ~HttpTransactionDelegateImpl() { 85 virtual ~HttpTransactionDelegateImpl() {
86 OnDetachRequest(); 86 OnDetachRequest();
87 } 87 }
88 void OnDetachRequest() { 88 void OnDetachRequest() {
89 if (request_ == NULL || network_delegate_ == NULL) 89 if (request_ == NULL || network_delegate_ == NULL)
90 return; 90 return;
91 network_delegate_->NotifyCacheWaitStateChange( 91 network_delegate_->NotifyRequestWaitStateChange(
92 *request_, 92 *request_,
93 NetworkDelegate::CACHE_WAIT_STATE_RESET); 93 NetworkDelegate::REQUEST_WAIT_STATE_RESET);
94 request_ = NULL; 94 request_ = NULL;
95 } 95 }
96 virtual void OnCacheActionStart() OVERRIDE { 96 virtual void OnCacheActionStart() OVERRIDE {
97 if (request_ == NULL || network_delegate_ == NULL) 97 if (request_ == NULL || network_delegate_ == NULL)
98 return; 98 return;
99 network_delegate_->NotifyCacheWaitStateChange( 99 network_delegate_->NotifyRequestWaitStateChange(
100 *request_, 100 *request_,
101 NetworkDelegate::CACHE_WAIT_STATE_START); 101 NetworkDelegate::REQUEST_WAIT_STATE_CACHE_START);
102 } 102 }
103 virtual void OnCacheActionFinish() OVERRIDE { 103 virtual void OnCacheActionFinish() OVERRIDE {
104 if (request_ == NULL || network_delegate_ == NULL) 104 if (request_ == NULL || network_delegate_ == NULL)
105 return; 105 return;
106 network_delegate_->NotifyCacheWaitStateChange( 106 network_delegate_->NotifyRequestWaitStateChange(
107 *request_, 107 *request_,
108 NetworkDelegate::CACHE_WAIT_STATE_FINISH); 108 NetworkDelegate::REQUEST_WAIT_STATE_CACHE_FINISH);
109 }
110 virtual void OnNetworkActionStart() OVERRIDE {
111 if (request_ == NULL || network_delegate_ == NULL)
112 return;
113 network_delegate_->NotifyRequestWaitStateChange(
114 *request_,
115 NetworkDelegate::REQUEST_WAIT_STATE_NETWORK_START);
116 }
117 virtual void OnNetworkActionFinish() OVERRIDE {
118 if (request_ == NULL || network_delegate_ == NULL)
119 return;
120 network_delegate_->NotifyRequestWaitStateChange(
121 *request_,
122 NetworkDelegate::REQUEST_WAIT_STATE_NETWORK_FINISH);
109 } 123 }
110 private: 124 private:
111 URLRequest* request_; 125 URLRequest* request_;
112 NetworkDelegate* network_delegate_; 126 NetworkDelegate* network_delegate_;
113 }; 127 };
114 128
115 URLRequestHttpJob::HttpFilterContext::HttpFilterContext(URLRequestHttpJob* job) 129 URLRequestHttpJob::HttpFilterContext::HttpFilterContext(URLRequestHttpJob* job)
116 : job_(job) { 130 : job_(job) {
117 DCHECK(job_); 131 DCHECK(job_);
118 } 132 }
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 request_info_.extra_headers.SetHeaderIfMissing( 894 request_info_.extra_headers.SetHeaderIfMissing(
881 HttpRequestHeaders::kUserAgent, 895 HttpRequestHeaders::kUserAgent,
882 request_->context()->GetUserAgent(request_->url())); 896 request_->context()->GetUserAgent(request_->url()));
883 } 897 }
884 898
885 AddExtraHeaders(); 899 AddExtraHeaders();
886 AddCookieHeaderAndStart(); 900 AddCookieHeaderAndStart();
887 } 901 }
888 902
889 void URLRequestHttpJob::Kill() { 903 void URLRequestHttpJob::Kill() {
904 http_transaction_delegate_->OnDetachRequest();
905
890 if (!transaction_.get()) 906 if (!transaction_.get())
891 return; 907 return;
892 908
893 weak_factory_.InvalidateWeakPtrs(); 909 weak_factory_.InvalidateWeakPtrs();
894 DestroyTransaction(); 910 DestroyTransaction();
895 URLRequestJob::Kill(); 911 URLRequestJob::Kill();
896 } 912 }
897 913
898 LoadState URLRequestHttpJob::GetLoadState() const { 914 LoadState URLRequestHttpJob::GetLoadState() const {
899 return transaction_.get() ? 915 return transaction_.get() ?
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 1490
1475 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1491 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1476 awaiting_callback_ = false; 1492 awaiting_callback_ = false;
1477 } 1493 }
1478 1494
1479 void URLRequestHttpJob::OnDetachRequest() { 1495 void URLRequestHttpJob::OnDetachRequest() {
1480 http_transaction_delegate_->OnDetachRequest(); 1496 http_transaction_delegate_->OnDetachRequest();
1481 } 1497 }
1482 1498
1483 } // namespace net 1499 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698