OLD | NEW |
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "net/spdy/spdy_http_stream.h" | 37 #include "net/spdy/spdy_http_stream.h" |
38 #include "net/spdy/spdy_session.h" | 38 #include "net/spdy/spdy_session.h" |
39 #include "net/spdy/spdy_session_pool.h" | 39 #include "net/spdy/spdy_session_pool.h" |
40 #include "net/ssl/ssl_cert_request_info.h" | 40 #include "net/ssl/ssl_cert_request_info.h" |
41 | 41 |
42 namespace net { | 42 namespace net { |
43 | 43 |
44 // Returns parameters associated with the start of a HTTP stream job. | 44 // Returns parameters associated with the start of a HTTP stream job. |
45 Value* NetLogHttpStreamJobCallback(const GURL* original_url, | 45 Value* NetLogHttpStreamJobCallback(const GURL* original_url, |
46 const GURL* url, | 46 const GURL* url, |
| 47 RequestPriority priority, |
47 NetLog::LogLevel /* log_level */) { | 48 NetLog::LogLevel /* log_level */) { |
48 DictionaryValue* dict = new DictionaryValue(); | 49 DictionaryValue* dict = new DictionaryValue(); |
49 dict->SetString("original_url", original_url->GetOrigin().spec()); | 50 dict->SetString("original_url", original_url->GetOrigin().spec()); |
50 dict->SetString("url", url->GetOrigin().spec()); | 51 dict->SetString("url", url->GetOrigin().spec()); |
| 52 dict->SetInteger("priority", priority); |
51 return dict; | 53 return dict; |
52 } | 54 } |
53 | 55 |
54 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP | 56 // Returns parameters associated with the Proto (with NPN negotiation) of a HTTP |
55 // stream. | 57 // stream. |
56 Value* NetLogHttpStreamProtoCallback( | 58 Value* NetLogHttpStreamProtoCallback( |
57 const SSLClientSocket::NextProtoStatus status, | 59 const SSLClientSocket::NextProtoStatus status, |
58 const std::string* proto, | 60 const std::string* proto, |
59 const std::string* server_protos, | 61 const std::string* server_protos, |
60 NetLog::LogLevel /* log_level */) { | 62 NetLog::LogLevel /* log_level */) { |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 573 |
572 int HttpStreamFactoryImpl::Job::DoStart() { | 574 int HttpStreamFactoryImpl::Job::DoStart() { |
573 int port = request_info_.url.EffectiveIntPort(); | 575 int port = request_info_.url.EffectiveIntPort(); |
574 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); | 576 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); |
575 origin_url_ = stream_factory_->ApplyHostMappingRules( | 577 origin_url_ = stream_factory_->ApplyHostMappingRules( |
576 request_info_.url, &origin_); | 578 request_info_.url, &origin_); |
577 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); | 579 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); |
578 | 580 |
579 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, | 581 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, |
580 base::Bind(&NetLogHttpStreamJobCallback, | 582 base::Bind(&NetLogHttpStreamJobCallback, |
581 &request_info_.url, &origin_url_)); | 583 &request_info_.url, &origin_url_, |
| 584 priority_)); |
582 | 585 |
583 // Don't connect to restricted ports. | 586 // Don't connect to restricted ports. |
584 bool is_port_allowed = IsPortAllowedByDefault(port); | 587 bool is_port_allowed = IsPortAllowedByDefault(port); |
585 if (request_info_.url.SchemeIs("ftp")) { | 588 if (request_info_.url.SchemeIs("ftp")) { |
586 // Never share connection with other jobs for FTP requests. | 589 // Never share connection with other jobs for FTP requests. |
587 DCHECK(!waiting_job_); | 590 DCHECK(!waiting_job_); |
588 | 591 |
589 is_port_allowed = IsPortAllowedByFtp(port); | 592 is_port_allowed = IsPortAllowedByFtp(port); |
590 } | 593 } |
591 if (!is_port_allowed && !IsPortAllowedByOverride(port)) { | 594 if (!is_port_allowed && !IsPortAllowedByOverride(port)) { |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | | 1356 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | |
1354 net::LOAD_IS_DOWNLOAD)) { | 1357 net::LOAD_IS_DOWNLOAD)) { |
1355 // Avoid pipelining resources that may be streamed for a long time. | 1358 // Avoid pipelining resources that may be streamed for a long time. |
1356 return false; | 1359 return false; |
1357 } | 1360 } |
1358 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( | 1361 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( |
1359 *http_pipelining_key_.get()); | 1362 *http_pipelining_key_.get()); |
1360 } | 1363 } |
1361 | 1364 |
1362 } // namespace net | 1365 } // namespace net |
OLD | NEW |