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

Side by Side Diff: net/http/http_stream_factory_impl_job.cc

Issue 2699433003: Add net-log entries when HttpStream jobs are forced to wait, and when they're delayed and resumed. (Closed)
Patch Set: Created 3 years, 10 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
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/http/http_stream_factory_impl_job.h" 5 #include "net/http/http_stream_factory_impl_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 127 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
128 if (source.IsValid()) 128 if (source.IsValid())
129 source.AddToEventParameters(dict.get()); 129 source.AddToEventParameters(dict.get());
130 dict->SetString("original_url", original_url->GetOrigin().spec()); 130 dict->SetString("original_url", original_url->GetOrigin().spec());
131 dict->SetString("url", url->GetOrigin().spec()); 131 dict->SetString("url", url->GetOrigin().spec());
132 dict->SetString("alternative_service", alternative_service->ToString()); 132 dict->SetString("alternative_service", alternative_service->ToString());
133 dict->SetString("priority", RequestPriorityToString(priority)); 133 dict->SetString("priority", RequestPriorityToString(priority));
134 return std::move(dict); 134 return std::move(dict);
135 } 135 }
136 136
137 // Returns parameters associated with the start of a HTTP stream job.
138 std::unique_ptr<base::Value> NetLogHttpStreamJobWaitingCallback(
eroman 2017/02/14 21:18:36 Have you considered using NetLog::BoolCallback() ?
Ryan Hamilton 2017/02/14 21:42:37 Oh nice! I didn't know that existed. Thanks!
139 bool should_wait,
140 NetLogCaptureMode /* capture_mode */) {
141 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
142 dict->SetBoolean("should_wait", should_wait);
143 return std::move(dict);
144 }
145
137 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP 146 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP
138 // stream. 147 // stream.
139 std::unique_ptr<base::Value> NetLogHttpStreamProtoCallback( 148 std::unique_ptr<base::Value> NetLogHttpStreamProtoCallback(
140 NextProto negotiated_protocol, 149 NextProto negotiated_protocol,
141 NetLogCaptureMode /* capture_mode */) { 150 NetLogCaptureMode /* capture_mode */) {
142 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 151 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
143 152
144 dict->SetString("proto", NextProtoToString(negotiated_protocol)); 153 dict->SetString("proto", NextProtoToString(negotiated_protocol));
145 return std::move(dict); 154 return std::move(dict);
146 } 155 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 return session_->IsQuicEnabled() && 811 return session_->IsQuicEnabled() &&
803 (base::ContainsKey(session_->params().origins_to_force_quic_on, 812 (base::ContainsKey(session_->params().origins_to_force_quic_on,
804 HostPortPair()) || 813 HostPortPair()) ||
805 base::ContainsKey(session_->params().origins_to_force_quic_on, 814 base::ContainsKey(session_->params().origins_to_force_quic_on,
806 destination_)) && 815 destination_)) &&
807 proxy_info_.is_direct() && origin_url_.SchemeIs(url::kHttpsScheme); 816 proxy_info_.is_direct() && origin_url_.SchemeIs(url::kHttpsScheme);
808 } 817 }
809 818
810 int HttpStreamFactoryImpl::Job::DoWait() { 819 int HttpStreamFactoryImpl::Job::DoWait() {
811 next_state_ = STATE_WAIT_COMPLETE; 820 next_state_ = STATE_WAIT_COMPLETE;
812 if (delegate_->ShouldWait(this)) 821 bool should_wait = delegate_->ShouldWait(this);
822 net_log_.BeginEvent(
823 NetLogEventType::HTTP_STREAM_JOB_WAITING,
824 base::Bind(&NetLogHttpStreamJobWaitingCallback, should_wait));
825 if (should_wait)
813 return ERR_IO_PENDING; 826 return ERR_IO_PENDING;
814 827
815 return OK; 828 return OK;
816 } 829 }
817 830
818 int HttpStreamFactoryImpl::Job::DoWaitComplete(int result) { 831 int HttpStreamFactoryImpl::Job::DoWaitComplete(int result) {
832 net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB_WAITING);
819 DCHECK_EQ(OK, result); 833 DCHECK_EQ(OK, result);
820 next_state_ = STATE_INIT_CONNECTION; 834 next_state_ = STATE_INIT_CONNECTION;
821 return OK; 835 return OK;
822 } 836 }
823 837
824 int HttpStreamFactoryImpl::Job::DoInitConnection() { 838 int HttpStreamFactoryImpl::Job::DoInitConnection() {
825 int result = DoInitConnectionImpl(); 839 int result = DoInitConnectionImpl();
826 if (result != ERR_SPDY_SESSION_ALREADY_EXISTS) 840 if (result != ERR_SPDY_SESSION_ALREADY_EXISTS)
827 delegate_->OnConnectionInitialized(this, result); 841 delegate_->OnConnectionInitialized(this, result);
828 842
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 1548
1535 ConnectionAttempts socket_attempts = connection_->connection_attempts(); 1549 ConnectionAttempts socket_attempts = connection_->connection_attempts();
1536 if (connection_->socket()) { 1550 if (connection_->socket()) {
1537 connection_->socket()->GetConnectionAttempts(&socket_attempts); 1551 connection_->socket()->GetConnectionAttempts(&socket_attempts);
1538 } 1552 }
1539 1553
1540 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts); 1554 delegate_->AddConnectionAttemptsToRequest(this, socket_attempts);
1541 } 1555 }
1542 1556
1543 } // namespace net 1557 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job_controller.h » ('j') | net/http/http_stream_factory_impl_job_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698