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

Unified Diff: net/http/http_stream_factory_impl_job.cc

Issue 1006643002: Plumb connection attempts from (non-proxy) ConnectJobs to HttpNetworkTransaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 8 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
Index: net/http/http_stream_factory_impl_job.cc
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index bea544759f1b3e570fd9b7e23454019cb07fab2b..5f220684a9c26c6d4835673624405c2a9718ea7e 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -296,6 +296,9 @@ void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
DCHECK(stream_.get());
DCHECK(!IsPreconnecting());
DCHECK(!stream_factory_->for_websockets_);
+
+ MaybeAddConnectionAttempts();
+
if (IsOrphaned()) {
stream_factory_->OnOrphanedJobComplete(this);
} else {
@@ -316,6 +319,9 @@ void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() {
// An orphaned WebSocket job will be closed immediately and
// never be ready.
DCHECK(!IsOrphaned());
+
+ MaybeAddConnectionAttempts();
+
request_->Complete(was_npn_negotiated(),
protocol_negotiated(),
using_spdy(),
@@ -336,6 +342,8 @@ void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() {
base::WeakPtr<SpdySession> spdy_session = new_spdy_session_;
new_spdy_session_.reset();
+ MaybeAddConnectionAttempts();
+
// TODO(jgraettinger): Notify the factory, and let that notify |request_|,
// rather than notifying |request_| directly.
if (IsOrphaned()) {
@@ -354,6 +362,9 @@ void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() {
void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) {
DCHECK(!IsPreconnecting());
+
+ MaybeAddConnectionAttempts();
+
if (IsOrphaned())
stream_factory_->OnOrphanedJobComplete(this);
else
@@ -364,6 +375,9 @@ void HttpStreamFactoryImpl::Job::OnStreamFailedCallback(int result) {
void HttpStreamFactoryImpl::Job::OnCertificateErrorCallback(
int result, const SSLInfo& ssl_info) {
DCHECK(!IsPreconnecting());
+
+ MaybeAddConnectionAttempts();
+
if (IsOrphaned())
stream_factory_->OnOrphanedJobComplete(this);
else
@@ -1504,4 +1518,11 @@ HttpStreamFactoryImpl::Job::GetSocketGroup() const {
return ClientSocketPoolManager::NORMAL_GROUP;
}
+void HttpStreamFactoryImpl::Job::MaybeAddConnectionAttempts() {
+ if (IsOrphaned() || !connection_)
+ return;
+
+ request_->AddConnectionAttempts(connection_->connection_attempts());
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698