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

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

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 #include "net/socket/ssl_client_socket.h" 37 #include "net/socket/ssl_client_socket.h"
38 #include "net/socket/ssl_client_socket_pool.h" 38 #include "net/socket/ssl_client_socket_pool.h"
39 #include "net/spdy/spdy_http_stream.h" 39 #include "net/spdy/spdy_http_stream.h"
40 #include "net/spdy/spdy_session.h" 40 #include "net/spdy/spdy_session.h"
41 #include "net/spdy/spdy_session_pool.h" 41 #include "net/spdy/spdy_session_pool.h"
42 #include "net/ssl/ssl_cert_request_info.h" 42 #include "net/ssl/ssl_cert_request_info.h"
43 43
44 namespace net { 44 namespace net {
45 45
46 // Returns parameters associated with the start of a HTTP stream job. 46 // Returns parameters associated with the start of a HTTP stream job.
47 base::Value* NetLogHttpStreamJobCallback( 47 scoped_ptr<base::Value> NetLogHttpStreamJobCallback(
48 const GURL* original_url, 48 const GURL* original_url,
49 const GURL* url, 49 const GURL* url,
50 const AlternativeService* alternative_service, 50 const AlternativeService* alternative_service,
51 RequestPriority priority, 51 RequestPriority priority,
52 NetLogCaptureMode /* capture_mode */) { 52 NetLogCaptureMode /* capture_mode */) {
53 base::DictionaryValue* dict = new base::DictionaryValue(); 53 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
54 dict->SetString("original_url", original_url->GetOrigin().spec()); 54 dict->SetString("original_url", original_url->GetOrigin().spec());
55 dict->SetString("url", url->GetOrigin().spec()); 55 dict->SetString("url", url->GetOrigin().spec());
56 dict->SetString("alternative_service", alternative_service->ToString()); 56 dict->SetString("alternative_service", alternative_service->ToString());
57 dict->SetString("priority", RequestPriorityToString(priority)); 57 dict->SetString("priority", RequestPriorityToString(priority));
58 return dict; 58 return dict.Pass();
59 } 59 }
60 60
61 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP 61 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP
62 // stream. 62 // stream.
63 base::Value* NetLogHttpStreamProtoCallback( 63 scoped_ptr<base::Value> NetLogHttpStreamProtoCallback(
64 const SSLClientSocket::NextProtoStatus status, 64 const SSLClientSocket::NextProtoStatus status,
65 const std::string* proto, 65 const std::string* proto,
66 NetLogCaptureMode /* capture_mode */) { 66 NetLogCaptureMode /* capture_mode */) {
67 base::DictionaryValue* dict = new base::DictionaryValue(); 67 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
68 68
69 dict->SetString("next_proto_status", 69 dict->SetString("next_proto_status",
70 SSLClientSocket::NextProtoStatusToString(status)); 70 SSLClientSocket::NextProtoStatusToString(status));
71 dict->SetString("proto", *proto); 71 dict->SetString("proto", *proto);
72 return dict; 72 return dict.Pass();
73 } 73 }
74 74
75 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, 75 HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory,
76 HttpNetworkSession* session, 76 HttpNetworkSession* session,
77 const HttpRequestInfo& request_info, 77 const HttpRequestInfo& request_info,
78 RequestPriority priority, 78 RequestPriority priority,
79 const SSLConfig& server_ssl_config, 79 const SSLConfig& server_ssl_config,
80 const SSLConfig& proxy_ssl_config, 80 const SSLConfig& proxy_ssl_config,
81 NetLog* net_log) 81 NetLog* net_log)
82 : request_(NULL), 82 : request_(NULL),
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } else { 639 } else {
640 server_ = HostPortPair::FromURL(request_info_.url); 640 server_ = HostPortPair::FromURL(request_info_.url);
641 } 641 }
642 origin_url_ = 642 origin_url_ =
643 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_); 643 stream_factory_->ApplyHostMappingRules(request_info_.url, &server_);
644 valid_spdy_session_pool_.reset(new ValidSpdySessionPool( 644 valid_spdy_session_pool_.reset(new ValidSpdySessionPool(
645 session_->spdy_session_pool(), origin_url_, IsSpdyAlternate())); 645 session_->spdy_session_pool(), origin_url_, IsSpdyAlternate()));
646 646
647 net_log_.BeginEvent( 647 net_log_.BeginEvent(
648 NetLog::TYPE_HTTP_STREAM_JOB, 648 NetLog::TYPE_HTTP_STREAM_JOB,
649 base::Bind(&NetLogHttpStreamJobCallback, &request_info_.url, &origin_url_, 649 base::Bind(NetLogHttpStreamJobCallback, &request_info_.url, &origin_url_,
650 &alternative_service_, priority_)); 650 &alternative_service_, priority_));
651 651
652 // Don't connect to restricted ports. 652 // Don't connect to restricted ports.
653 bool is_port_allowed = IsPortAllowedByDefault(server_.port()); 653 bool is_port_allowed = IsPortAllowedByDefault(server_.port());
654 if (request_info_.url.SchemeIs("ftp")) { 654 if (request_info_.url.SchemeIs("ftp")) {
655 // Never share connection with other jobs for FTP requests. 655 // Never share connection with other jobs for FTP requests.
656 DCHECK(!waiting_job_); 656 DCHECK(!waiting_job_);
657 657
658 is_port_allowed = IsPortAllowedByFtp(server_.port()); 658 is_port_allowed = IsPortAllowedByFtp(server_.port());
659 } 659 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 SSLClientSocket* ssl_socket = 973 SSLClientSocket* ssl_socket =
974 static_cast<SSLClientSocket*>(connection_->socket()); 974 static_cast<SSLClientSocket*>(connection_->socket());
975 if (ssl_socket->WasNpnNegotiated()) { 975 if (ssl_socket->WasNpnNegotiated()) {
976 was_npn_negotiated_ = true; 976 was_npn_negotiated_ = true;
977 std::string proto; 977 std::string proto;
978 SSLClientSocket::NextProtoStatus status = 978 SSLClientSocket::NextProtoStatus status =
979 ssl_socket->GetNextProto(&proto); 979 ssl_socket->GetNextProto(&proto);
980 protocol_negotiated_ = SSLClientSocket::NextProtoFromString(proto); 980 protocol_negotiated_ = SSLClientSocket::NextProtoFromString(proto);
981 net_log_.AddEvent( 981 net_log_.AddEvent(
982 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO, 982 NetLog::TYPE_HTTP_STREAM_REQUEST_PROTO,
983 base::Bind(&NetLogHttpStreamProtoCallback, 983 base::Bind(NetLogHttpStreamProtoCallback, status, &proto));
984 status, &proto));
985 if (NextProtoIsSPDY(protocol_negotiated_)) 984 if (NextProtoIsSPDY(protocol_negotiated_))
986 SwitchToSpdyMode(); 985 SwitchToSpdyMode();
987 } 986 }
988 } 987 }
989 } else if (proxy_info_.is_https() && connection_->socket() && 988 } else if (proxy_info_.is_https() && connection_->socket() &&
990 result == OK) { 989 result == OK) {
991 ProxyClientSocket* proxy_socket = 990 ProxyClientSocket* proxy_socket =
992 static_cast<ProxyClientSocket*>(connection_->socket()); 991 static_cast<ProxyClientSocket*>(connection_->socket());
993 if (proxy_socket->IsUsingSpdy()) { 992 if (proxy_socket->IsUsingSpdy()) {
994 was_npn_negotiated_ = true; 993 was_npn_negotiated_ = true;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 1527
1529 void HttpStreamFactoryImpl::Job:: 1528 void HttpStreamFactoryImpl::Job::
1530 MaybeCopyConnectionAttemptsFromClientSocketHandleToRequest() { 1529 MaybeCopyConnectionAttemptsFromClientSocketHandleToRequest() {
1531 if (IsOrphaned() || !connection_) 1530 if (IsOrphaned() || !connection_)
1532 return; 1531 return;
1533 1532
1534 request_->AddConnectionAttempts(connection_->connection_attempts()); 1533 request_->AddConnectionAttempts(connection_->connection_attempts());
1535 } 1534 }
1536 1535
1537 } // namespace net 1536 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698