| 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 SpdyStreamRequest::SpdyStreamRequest() : weak_ptr_factory_(this) { | 438 SpdyStreamRequest::SpdyStreamRequest() : weak_ptr_factory_(this) { |
| 439 Reset(); | 439 Reset(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 SpdyStreamRequest::~SpdyStreamRequest() { | 442 SpdyStreamRequest::~SpdyStreamRequest() { |
| 443 CancelRequest(); | 443 CancelRequest(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 int SpdyStreamRequest::StartRequest( | 446 int SpdyStreamRequest::StartRequest(SpdyStreamType type, |
| 447 SpdyStreamType type, | 447 const base::WeakPtr<SpdySession>& session, |
| 448 const base::WeakPtr<SpdySession>& session, | 448 const GURL& url, |
| 449 const GURL& url, | 449 RequestPriority priority, |
| 450 RequestPriority priority, | 450 const NetLogWithSource& net_log, |
| 451 const BoundNetLog& net_log, | 451 const CompletionCallback& callback) { |
| 452 const CompletionCallback& callback) { | |
| 453 DCHECK(session); | 452 DCHECK(session); |
| 454 DCHECK(!session_); | 453 DCHECK(!session_); |
| 455 DCHECK(!stream_); | 454 DCHECK(!stream_); |
| 456 DCHECK(callback_.is_null()); | 455 DCHECK(callback_.is_null()); |
| 457 | 456 |
| 458 type_ = type; | 457 type_ = type; |
| 459 session_ = session; | 458 session_ = session; |
| 460 url_ = url; | 459 url_ = url; |
| 461 priority_ = priority; | 460 priority_ = priority; |
| 462 net_log_ = net_log; | 461 net_log_ = net_log; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 DCHECK_NE(rv, OK); | 507 DCHECK_NE(rv, OK); |
| 509 callback.Run(rv); | 508 callback.Run(rv); |
| 510 } | 509 } |
| 511 | 510 |
| 512 void SpdyStreamRequest::Reset() { | 511 void SpdyStreamRequest::Reset() { |
| 513 type_ = SPDY_BIDIRECTIONAL_STREAM; | 512 type_ = SPDY_BIDIRECTIONAL_STREAM; |
| 514 session_.reset(); | 513 session_.reset(); |
| 515 stream_.reset(); | 514 stream_.reset(); |
| 516 url_ = GURL(); | 515 url_ = GURL(); |
| 517 priority_ = MINIMUM_PRIORITY; | 516 priority_ = MINIMUM_PRIORITY; |
| 518 net_log_ = BoundNetLog(); | 517 net_log_ = NetLogWithSource(); |
| 519 callback_.Reset(); | 518 callback_.Reset(); |
| 520 } | 519 } |
| 521 | 520 |
| 522 SpdySession::ActiveStreamInfo::ActiveStreamInfo() | 521 SpdySession::ActiveStreamInfo::ActiveStreamInfo() |
| 523 : stream(NULL), waiting_for_reply_headers_frame(false) {} | 522 : stream(NULL), waiting_for_reply_headers_frame(false) {} |
| 524 | 523 |
| 525 SpdySession::ActiveStreamInfo::ActiveStreamInfo(SpdyStream* stream) | 524 SpdySession::ActiveStreamInfo::ActiveStreamInfo(SpdyStream* stream) |
| 526 : stream(stream), | 525 : stream(stream), |
| 527 waiting_for_reply_headers_frame(stream->type() != SPDY_PUSH_STREAM) {} | 526 waiting_for_reply_headers_frame(stream->type() != SPDY_PUSH_STREAM) {} |
| 528 | 527 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 next_ping_id_(1), | 664 next_ping_id_(1), |
| 666 last_activity_time_(time_func()), | 665 last_activity_time_(time_func()), |
| 667 last_compressed_frame_len_(0), | 666 last_compressed_frame_len_(0), |
| 668 check_ping_status_pending_(false), | 667 check_ping_status_pending_(false), |
| 669 session_send_window_size_(0), | 668 session_send_window_size_(0), |
| 670 session_max_recv_window_size_(session_max_recv_window_size), | 669 session_max_recv_window_size_(session_max_recv_window_size), |
| 671 session_recv_window_size_(0), | 670 session_recv_window_size_(0), |
| 672 session_unacked_recv_window_bytes_(0), | 671 session_unacked_recv_window_bytes_(0), |
| 673 stream_initial_send_window_size_(kDefaultInitialWindowSize), | 672 stream_initial_send_window_size_(kDefaultInitialWindowSize), |
| 674 stream_max_recv_window_size_(stream_max_recv_window_size), | 673 stream_max_recv_window_size_(stream_max_recv_window_size), |
| 675 net_log_(BoundNetLog::Make(net_log, NetLogSourceType::HTTP2_SESSION)), | 674 net_log_( |
| 675 NetLogWithSource::Make(net_log, NetLogSourceType::HTTP2_SESSION)), |
| 676 verify_domain_authentication_(verify_domain_authentication), | 676 verify_domain_authentication_(verify_domain_authentication), |
| 677 enable_sending_initial_data_(enable_sending_initial_data), | 677 enable_sending_initial_data_(enable_sending_initial_data), |
| 678 enable_ping_based_connection_checking_( | 678 enable_ping_based_connection_checking_( |
| 679 enable_ping_based_connection_checking), | 679 enable_ping_based_connection_checking), |
| 680 connection_at_risk_of_loss_time_( | 680 connection_at_risk_of_loss_time_( |
| 681 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), | 681 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), |
| 682 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), | 682 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), |
| 683 proxy_delegate_(proxy_delegate), | 683 proxy_delegate_(proxy_delegate), |
| 684 time_func_(time_func), | 684 time_func_(time_func), |
| 685 weak_factory_(this) { | 685 weak_factory_(this) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 return false; | 760 return false; |
| 761 | 761 |
| 762 SSLInfo ssl_info; | 762 SSLInfo ssl_info; |
| 763 if (!GetSSLInfo(&ssl_info)) | 763 if (!GetSSLInfo(&ssl_info)) |
| 764 return true; // This is not a secure session, so all domains are okay. | 764 return true; // This is not a secure session, so all domains are okay. |
| 765 | 765 |
| 766 return CanPool(transport_security_state_, ssl_info, | 766 return CanPool(transport_security_state_, ssl_info, |
| 767 host_port_pair().host(), domain); | 767 host_port_pair().host(), domain); |
| 768 } | 768 } |
| 769 | 769 |
| 770 int SpdySession::GetPushStream( | 770 int SpdySession::GetPushStream(const GURL& url, |
| 771 const GURL& url, | 771 base::WeakPtr<SpdyStream>* stream, |
| 772 base::WeakPtr<SpdyStream>* stream, | 772 const NetLogWithSource& stream_net_log) { |
| 773 const BoundNetLog& stream_net_log) { | |
| 774 CHECK(!in_io_loop_); | 773 CHECK(!in_io_loop_); |
| 775 | 774 |
| 776 stream->reset(); | 775 stream->reset(); |
| 777 | 776 |
| 778 if (availability_state_ == STATE_DRAINING) | 777 if (availability_state_ == STATE_DRAINING) |
| 779 return ERR_CONNECTION_CLOSED; | 778 return ERR_CONNECTION_CLOSED; |
| 780 | 779 |
| 781 Error err = TryAccessStream(url); | 780 Error err = TryAccessStream(url); |
| 782 if (err != OK) | 781 if (err != OK) |
| 783 return err; | 782 return err; |
| (...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3141 if (!queue->empty()) { | 3140 if (!queue->empty()) { |
| 3142 SpdyStreamId stream_id = queue->front(); | 3141 SpdyStreamId stream_id = queue->front(); |
| 3143 queue->pop_front(); | 3142 queue->pop_front(); |
| 3144 return stream_id; | 3143 return stream_id; |
| 3145 } | 3144 } |
| 3146 } | 3145 } |
| 3147 return 0; | 3146 return 0; |
| 3148 } | 3147 } |
| 3149 | 3148 |
| 3150 } // namespace net | 3149 } // namespace net |
| OLD | NEW |