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

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

Issue 718273002: Use uint16 for port numbers, net/ edition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 6 years, 1 month 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 void HttpStreamFactoryImpl::Job::Start(Request* request) { 127 void HttpStreamFactoryImpl::Job::Start(Request* request) {
128 DCHECK(request); 128 DCHECK(request);
129 request_ = request; 129 request_ = request;
130 StartInternal(); 130 StartInternal();
131 } 131 }
132 132
133 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) { 133 int HttpStreamFactoryImpl::Job::Preconnect(int num_streams) {
134 DCHECK_GT(num_streams, 0); 134 DCHECK_GT(num_streams, 0);
135 HostPortPair origin_server = 135 HostPortPair origin_server =
136 HostPortPair(request_info_.url.HostNoBrackets(), 136 HostPortPair(request_info_.url.HostNoBrackets(),
137 request_info_.url.EffectiveIntPort()); 137 static_cast<uint16>(request_info_.url.EffectiveIntPort()));
mmenke 2014/11/18 21:06:39 HostPortPair::FromURL
Peter Kasting 2014/11/18 23:38:42 Done.
138 base::WeakPtr<HttpServerProperties> http_server_properties = 138 base::WeakPtr<HttpServerProperties> http_server_properties =
139 session_->http_server_properties(); 139 session_->http_server_properties();
140 if (http_server_properties && 140 if (http_server_properties &&
141 http_server_properties->SupportsSpdy(origin_server)) { 141 http_server_properties->SupportsSpdy(origin_server)) {
142 num_streams_ = 1; 142 num_streams_ = 1;
143 } else { 143 } else {
144 num_streams_ = num_streams; 144 num_streams_ = num_streams;
145 } 145 }
146 return StartInternal(); 146 return StartInternal();
147 } 147 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 610
611 int HttpStreamFactoryImpl::Job::StartInternal() { 611 int HttpStreamFactoryImpl::Job::StartInternal() {
612 CHECK_EQ(STATE_NONE, next_state_); 612 CHECK_EQ(STATE_NONE, next_state_);
613 next_state_ = STATE_START; 613 next_state_ = STATE_START;
614 int rv = RunLoop(OK); 614 int rv = RunLoop(OK);
615 DCHECK_EQ(ERR_IO_PENDING, rv); 615 DCHECK_EQ(ERR_IO_PENDING, rv);
616 return rv; 616 return rv;
617 } 617 }
618 618
619 int HttpStreamFactoryImpl::Job::DoStart() { 619 int HttpStreamFactoryImpl::Job::DoStart() {
620 int port = request_info_.url.EffectiveIntPort(); 620 uint16 port = static_cast<uint16>(request_info_.url.EffectiveIntPort());
mmenke 2014/11/18 21:06:39 HostPortPair::FromURL
Peter Kasting 2014/11/18 23:38:42 Done.
621 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); 621 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port);
622 origin_url_ = stream_factory_->ApplyHostMappingRules( 622 origin_url_ = stream_factory_->ApplyHostMappingRules(
623 request_info_.url, &origin_); 623 request_info_.url, &origin_);
624 624
625 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, 625 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB,
626 base::Bind(&NetLogHttpStreamJobCallback, 626 base::Bind(&NetLogHttpStreamJobCallback,
627 &request_info_.url, &origin_url_, 627 &request_info_.url, &origin_url_,
628 priority_)); 628 priority_));
629 629
630 // Don't connect to restricted ports. 630 // Don't connect to restricted ports.
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 1467
1468 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1468 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1469 HistogramBrokenAlternateProtocolLocation( 1469 HistogramBrokenAlternateProtocolLocation(
1470 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1470 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1471 session_->http_server_properties()->SetBrokenAlternateProtocol( 1471 session_->http_server_properties()->SetBrokenAlternateProtocol(
1472 HostPortPair::FromURL(request_info_.url)); 1472 HostPortPair::FromURL(request_info_.url));
1473 } 1473 }
1474 } 1474 }
1475 1475
1476 } // namespace net 1476 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698