diff options
author | ttuttle <ttuttle@chromium.org> | 2015-05-11 16:41:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-11 23:42:17 +0000 |
commit | 3ae06923eff86f2c91144ac4f41231018e2477af (patch) | |
tree | 0be72f8feb25d5d0a59602df357dad45e748ae94 | |
parent | fe50e76fa445ff8e6fc3d18bb4b8d3a6b1408730 (diff) | |
download | chromium_src-3ae06923eff86f2c91144ac4f41231018e2477af.zip chromium_src-3ae06923eff86f2c91144ac4f41231018e2477af.tar.gz chromium_src-3ae06923eff86f2c91144ac4f41231018e2477af.tar.bz2 |
Plumb ConnectionAttempts from HttpNetworkTransaction to URLRequest.
BUG=480565
Review URL: https://codereview.chromium.org/1097303003
Cr-Commit-Position: refs/heads/master@{#329270}
-rw-r--r-- | net/url_request/url_request.cc | 7 | ||||
-rw-r--r-- | net/url_request/url_request.h | 6 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 7 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request_job.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_job.h | 6 |
6 files changed, 32 insertions, 0 deletions
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index de52560..5c08c81 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -1189,4 +1189,11 @@ const base::debug::StackTrace* URLRequest::stack_trace() const { return stack_trace_.get(); } +void URLRequest::GetConnectionAttempts(ConnectionAttempts* out) const { + if (job_) + job_->GetConnectionAttempts(out); + else + out->clear(); +} + } // namespace net diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index e623c20..16ada0c 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -28,6 +28,7 @@ #include "net/http/http_request_headers.h" #include "net/http/http_response_info.h" #include "net/log/net_log.h" +#include "net/socket/connection_attempts.h" #include "net/url_request/url_request_status.h" #include "url/gurl.h" @@ -608,6 +609,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), return proxy_server_; } + // Gets the connection attempts made in the process of servicing this + // URLRequest. Only guaranteed to be valid if called after the request fails + // or after the response headers are received. + void GetConnectionAttempts(ConnectionAttempts* out) const; + protected: // Allow the URLRequestJob class to control the is_pending() flag. void set_is_pending(bool value) { is_pending_ = value; } diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 3c8b97f..a25afcb 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -279,6 +279,13 @@ void URLRequestHttpJob::Kill() { URLRequestJob::Kill(); } +void URLRequestHttpJob::GetConnectionAttempts(ConnectionAttempts* out) const { + if (transaction_) + transaction_->GetConnectionAttempts(out); + else + out->clear(); +} + void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( const ProxyInfo& proxy_info, HttpRequestHeaders* request_headers) { diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h index f45058e..b169c62f68 100644 --- a/net/url_request/url_request_http_job.h +++ b/net/url_request/url_request_http_job.h @@ -19,6 +19,7 @@ #include "net/cookies/cookie_store.h" #include "net/filter/filter.h" #include "net/http/http_request_info.h" +#include "net/socket/connection_attempts.h" #include "net/url_request/url_request_job.h" #include "net/url_request/url_request_throttler_entry_interface.h" @@ -52,6 +53,7 @@ class NET_EXPORT_PRIVATE URLRequestHttpJob : public URLRequestJob { void SetPriority(RequestPriority priority) override; void Start() override; void Kill() override; + void GetConnectionAttempts(ConnectionAttempts* out) const override; RequestPriority priority() const { return priority_; diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index e466569..1274499 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -273,6 +273,10 @@ void URLRequestJob::OnSuspend() { void URLRequestJob::NotifyURLRequestDestroyed() { } +void URLRequestJob::GetConnectionAttempts(ConnectionAttempts* out) const { + out->clear(); +} + // static GURL URLRequestJob::ComputeReferrerForRedirect( URLRequest::ReferrerPolicy policy, diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index b6ae4bb..e7f4082 100644 --- a/net/url_request/url_request_job.h +++ b/net/url_request/url_request_job.h @@ -19,6 +19,7 @@ #include "net/base/request_priority.h" #include "net/base/upload_progress.h" #include "net/cookies/canonical_cookie.h" +#include "net/socket/connection_attempts.h" #include "net/url_request/redirect_info.h" #include "net/url_request/url_request.h" #include "url/gurl.h" @@ -226,6 +227,11 @@ class NET_EXPORT URLRequestJob // canceled by an explicit NetworkDelegate::NotifyURLRequestDestroyed() call. virtual void NotifyURLRequestDestroyed(); + // Populates |out| with the connection attempts made at the socket layer in + // the course of executing the URLRequestJob. Should be called after the job + // has failed or the response headers have been received. + virtual void GetConnectionAttempts(ConnectionAttempts* out) const; + // Given |policy|, |referrer|, and |redirect_destination|, returns the // referrer URL mandated by |request|'s referrer policy. static GURL ComputeReferrerForRedirect(URLRequest::ReferrerPolicy policy, |