| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/metrics/sparse_histogram.h" | 17 #include "base/metrics/sparse_histogram.h" |
| 18 #include "base/metrics/stats_counters.h" | |
| 19 #include "base/profiler/scoped_tracker.h" | 18 #include "base/profiler/scoped_tracker.h" |
| 20 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 21 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 23 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 26 #include "base/values.h" | 25 #include "base/values.h" |
| 27 #include "crypto/ec_private_key.h" | 26 #include "crypto/ec_private_key.h" |
| 28 #include "crypto/ec_signature_creator.h" | 27 #include "crypto/ec_signature_creator.h" |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 DCHECK_EQ(read_state_, READ_STATE_DO_READ); | 710 DCHECK_EQ(read_state_, READ_STATE_DO_READ); |
| 712 DCHECK_EQ(write_state_, WRITE_STATE_IDLE); | 711 DCHECK_EQ(write_state_, WRITE_STATE_IDLE); |
| 713 DCHECK(!connection_); | 712 DCHECK(!connection_); |
| 714 | 713 |
| 715 DCHECK(certificate_error_code == OK || | 714 DCHECK(certificate_error_code == OK || |
| 716 certificate_error_code < ERR_IO_PENDING); | 715 certificate_error_code < ERR_IO_PENDING); |
| 717 // TODO(akalin): Check connection->is_initialized() instead. This | 716 // TODO(akalin): Check connection->is_initialized() instead. This |
| 718 // requires re-working CreateFakeSpdySession(), though. | 717 // requires re-working CreateFakeSpdySession(), though. |
| 719 DCHECK(connection->socket()); | 718 DCHECK(connection->socket()); |
| 720 | 719 |
| 721 base::StatsCounter spdy_sessions("spdy.sessions"); | |
| 722 spdy_sessions.Increment(); | |
| 723 | |
| 724 connection_ = connection.Pass(); | 720 connection_ = connection.Pass(); |
| 725 is_secure_ = is_secure; | 721 is_secure_ = is_secure; |
| 726 certificate_error_code_ = certificate_error_code; | 722 certificate_error_code_ = certificate_error_code; |
| 727 | 723 |
| 728 NextProto protocol_negotiated = | 724 NextProto protocol_negotiated = |
| 729 connection_->socket()->GetNegotiatedProtocol(); | 725 connection_->socket()->GetNegotiatedProtocol(); |
| 730 if (protocol_negotiated != kProtoUnknown) { | 726 if (protocol_negotiated != kProtoUnknown) { |
| 731 protocol_ = protocol_negotiated; | 727 protocol_ = protocol_negotiated; |
| 732 stream_initial_send_window_size_ = GetInitialWindowSize(protocol_); | 728 stream_initial_send_window_size_ = GetInitialWindowSize(protocol_); |
| 733 } | 729 } |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(syn_stream)); | 1073 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(syn_stream)); |
| 1078 } else { | 1074 } else { |
| 1079 SpdyHeadersIR headers(stream_id); | 1075 SpdyHeadersIR headers(stream_id); |
| 1080 headers.set_priority(spdy_priority); | 1076 headers.set_priority(spdy_priority); |
| 1081 headers.set_has_priority(true); | 1077 headers.set_has_priority(true); |
| 1082 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0); | 1078 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0); |
| 1083 headers.set_name_value_block(block); | 1079 headers.set_name_value_block(block); |
| 1084 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(headers)); | 1080 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(headers)); |
| 1085 } | 1081 } |
| 1086 | 1082 |
| 1087 base::StatsCounter spdy_requests("spdy.requests"); | |
| 1088 spdy_requests.Increment(); | |
| 1089 streams_initiated_count_++; | 1083 streams_initiated_count_++; |
| 1090 | 1084 |
| 1091 if (net_log().IsLogging()) { | 1085 if (net_log().IsLogging()) { |
| 1092 net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_SYN_STREAM, | 1086 net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_SYN_STREAM, |
| 1093 base::Bind(&NetLogSpdySynStreamSentCallback, | 1087 base::Bind(&NetLogSpdySynStreamSentCallback, |
| 1094 &block, | 1088 &block, |
| 1095 (flags & CONTROL_FLAG_FIN) != 0, | 1089 (flags & CONTROL_FLAG_FIN) != 0, |
| 1096 (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0, | 1090 (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0, |
| 1097 spdy_priority, | 1091 spdy_priority, |
| 1098 stream_id)); | 1092 stream_id)); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 } | 1455 } |
| 1462 | 1456 |
| 1463 DCHECK_EQ(buffered_spdy_framer_->error_code(), SpdyFramer::SPDY_NO_ERROR); | 1457 DCHECK_EQ(buffered_spdy_framer_->error_code(), SpdyFramer::SPDY_NO_ERROR); |
| 1464 } | 1458 } |
| 1465 | 1459 |
| 1466 read_state_ = READ_STATE_DO_READ; | 1460 read_state_ = READ_STATE_DO_READ; |
| 1467 return OK; | 1461 return OK; |
| 1468 } | 1462 } |
| 1469 | 1463 |
| 1470 void SpdySession::PumpWriteLoop(WriteState expected_write_state, int result) { | 1464 void SpdySession::PumpWriteLoop(WriteState expected_write_state, int result) { |
| 1465 // TODO(pkasting): Remove ScopedTracker below once crbug.com/457517 is fixed. |
| 1466 tracked_objects::ScopedTracker tracking_profile( |
| 1467 FROM_HERE_WITH_EXPLICIT_FUNCTION("457517 SpdySession::PumpWriteLoop")); |
| 1471 CHECK(!in_io_loop_); | 1468 CHECK(!in_io_loop_); |
| 1472 DCHECK_EQ(write_state_, expected_write_state); | 1469 DCHECK_EQ(write_state_, expected_write_state); |
| 1473 | 1470 |
| 1474 DoWriteLoop(expected_write_state, result); | 1471 DoWriteLoop(expected_write_state, result); |
| 1475 | 1472 |
| 1476 if (availability_state_ == STATE_DRAINING && !in_flight_write_ && | 1473 if (availability_state_ == STATE_DRAINING && !in_flight_write_ && |
| 1477 write_queue_.IsEmpty()) { | 1474 write_queue_.IsEmpty()) { |
| 1478 pool_->RemoveUnavailableSession(GetWeakPtr()); // Destroys |this|. | 1475 pool_->RemoveUnavailableSession(GetWeakPtr()); // Destroys |this|. |
| 1479 return; | 1476 return; |
| 1480 } | 1477 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 break; | 1509 break; |
| 1513 } | 1510 } |
| 1514 | 1511 |
| 1515 CHECK(in_io_loop_); | 1512 CHECK(in_io_loop_); |
| 1516 in_io_loop_ = false; | 1513 in_io_loop_ = false; |
| 1517 | 1514 |
| 1518 return result; | 1515 return result; |
| 1519 } | 1516 } |
| 1520 | 1517 |
| 1521 int SpdySession::DoWrite() { | 1518 int SpdySession::DoWrite() { |
| 1519 // TODO(pkasting): Remove ScopedTracker below once crbug.com/457517 is fixed. |
| 1520 tracked_objects::ScopedTracker tracking_profile( |
| 1521 FROM_HERE_WITH_EXPLICIT_FUNCTION("457517 SpdySession::DoWrite")); |
| 1522 CHECK(in_io_loop_); | 1522 CHECK(in_io_loop_); |
| 1523 | 1523 |
| 1524 DCHECK(buffered_spdy_framer_); | 1524 DCHECK(buffered_spdy_framer_); |
| 1525 if (in_flight_write_) { | 1525 if (in_flight_write_) { |
| 1526 DCHECK_GT(in_flight_write_->GetRemainingSize(), 0u); | 1526 DCHECK_GT(in_flight_write_->GetRemainingSize(), 0u); |
| 1527 } else { | 1527 } else { |
| 1528 // Grab the next frame to send. | 1528 // Grab the next frame to send. |
| 1529 SpdyFrameType frame_type = DATA; | 1529 SpdyFrameType frame_type = DATA; |
| 1530 scoped_ptr<SpdyBufferProducer> producer; | 1530 scoped_ptr<SpdyBufferProducer> producer; |
| 1531 base::WeakPtr<SpdyStream> stream; | 1531 base::WeakPtr<SpdyStream> stream; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 scoped_refptr<IOBuffer> write_io_buffer = | 1575 scoped_refptr<IOBuffer> write_io_buffer = |
| 1576 in_flight_write_->GetIOBufferForRemainingData(); | 1576 in_flight_write_->GetIOBufferForRemainingData(); |
| 1577 return connection_->socket()->Write( | 1577 return connection_->socket()->Write( |
| 1578 write_io_buffer.get(), | 1578 write_io_buffer.get(), |
| 1579 in_flight_write_->GetRemainingSize(), | 1579 in_flight_write_->GetRemainingSize(), |
| 1580 base::Bind(&SpdySession::PumpWriteLoop, | 1580 base::Bind(&SpdySession::PumpWriteLoop, |
| 1581 weak_factory_.GetWeakPtr(), WRITE_STATE_DO_WRITE_COMPLETE)); | 1581 weak_factory_.GetWeakPtr(), WRITE_STATE_DO_WRITE_COMPLETE)); |
| 1582 } | 1582 } |
| 1583 | 1583 |
| 1584 int SpdySession::DoWriteComplete(int result) { | 1584 int SpdySession::DoWriteComplete(int result) { |
| 1585 // TODO(pkasting): Remove ScopedTracker below once crbug.com/457517 is fixed. |
| 1586 tracked_objects::ScopedTracker tracking_profile( |
| 1587 FROM_HERE_WITH_EXPLICIT_FUNCTION("457517 SpdySession::DoWriteComplete")); |
| 1585 CHECK(in_io_loop_); | 1588 CHECK(in_io_loop_); |
| 1586 DCHECK_NE(result, ERR_IO_PENDING); | 1589 DCHECK_NE(result, ERR_IO_PENDING); |
| 1587 DCHECK_GT(in_flight_write_->GetRemainingSize(), 0u); | 1590 DCHECK_GT(in_flight_write_->GetRemainingSize(), 0u); |
| 1588 | 1591 |
| 1589 last_activity_time_ = time_func_(); | 1592 last_activity_time_ = time_func_(); |
| 1590 | 1593 |
| 1591 if (result < 0) { | 1594 if (result < 0) { |
| 1592 DCHECK_NE(result, ERR_IO_PENDING); | 1595 DCHECK_NE(result, ERR_IO_PENDING); |
| 1593 in_flight_write_.reset(); | 1596 in_flight_write_.reset(); |
| 1594 in_flight_write_frame_type_ = DATA; | 1597 in_flight_write_frame_type_ = DATA; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 | 1645 |
| 1643 void SpdySession::DcheckDraining() const { | 1646 void SpdySession::DcheckDraining() const { |
| 1644 DcheckGoingAway(); | 1647 DcheckGoingAway(); |
| 1645 DCHECK_EQ(availability_state_, STATE_DRAINING); | 1648 DCHECK_EQ(availability_state_, STATE_DRAINING); |
| 1646 DCHECK(active_streams_.empty()); | 1649 DCHECK(active_streams_.empty()); |
| 1647 DCHECK(unclaimed_pushed_streams_.empty()); | 1650 DCHECK(unclaimed_pushed_streams_.empty()); |
| 1648 } | 1651 } |
| 1649 | 1652 |
| 1650 void SpdySession::StartGoingAway(SpdyStreamId last_good_stream_id, | 1653 void SpdySession::StartGoingAway(SpdyStreamId last_good_stream_id, |
| 1651 Error status) { | 1654 Error status) { |
| 1655 // TODO(pkasting): Remove ScopedTracker below once crbug.com/457517 is fixed. |
| 1656 tracked_objects::ScopedTracker tracking_profile( |
| 1657 FROM_HERE_WITH_EXPLICIT_FUNCTION("457517 SpdySession::StartGoingAway")); |
| 1652 DCHECK_GE(availability_state_, STATE_GOING_AWAY); | 1658 DCHECK_GE(availability_state_, STATE_GOING_AWAY); |
| 1653 | 1659 |
| 1654 // The loops below are carefully written to avoid reentrancy problems. | 1660 // The loops below are carefully written to avoid reentrancy problems. |
| 1655 | 1661 |
| 1656 while (true) { | 1662 while (true) { |
| 1657 size_t old_size = GetTotalSize(pending_create_stream_queues_); | 1663 size_t old_size = GetTotalSize(pending_create_stream_queues_); |
| 1658 base::WeakPtr<SpdyStreamRequest> pending_request = | 1664 base::WeakPtr<SpdyStreamRequest> pending_request = |
| 1659 GetNextPendingStreamRequest(); | 1665 GetNextPendingStreamRequest(); |
| 1660 if (!pending_request) | 1666 if (!pending_request) |
| 1661 break; | 1667 break; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 // stream isn't active (i.e., it hasn't written anything to the wire | 1767 // stream isn't active (i.e., it hasn't written anything to the wire |
| 1762 // yet) then it's as if it never existed. If it is active, then | 1768 // yet) then it's as if it never existed. If it is active, then |
| 1763 // LogAbandonedActiveStream() will increment the counters. | 1769 // LogAbandonedActiveStream() will increment the counters. |
| 1764 } | 1770 } |
| 1765 | 1771 |
| 1766 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, | 1772 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, |
| 1767 Error status) { | 1773 Error status) { |
| 1768 DCHECK_GT(it->first, 0u); | 1774 DCHECK_GT(it->first, 0u); |
| 1769 LogAbandonedStream(it->second.stream, status); | 1775 LogAbandonedStream(it->second.stream, status); |
| 1770 ++streams_abandoned_count_; | 1776 ++streams_abandoned_count_; |
| 1771 base::StatsCounter abandoned_streams("spdy.abandoned_streams"); | |
| 1772 abandoned_streams.Increment(); | |
| 1773 if (it->second.stream->type() == SPDY_PUSH_STREAM && | 1777 if (it->second.stream->type() == SPDY_PUSH_STREAM && |
| 1774 unclaimed_pushed_streams_.find(it->second.stream->url()) != | 1778 unclaimed_pushed_streams_.find(it->second.stream->url()) != |
| 1775 unclaimed_pushed_streams_.end()) { | 1779 unclaimed_pushed_streams_.end()) { |
| 1776 base::StatsCounter abandoned_push_streams("spdy.abandoned_push_streams"); | |
| 1777 abandoned_push_streams.Increment(); | |
| 1778 } | 1780 } |
| 1779 } | 1781 } |
| 1780 | 1782 |
| 1781 SpdyStreamId SpdySession::GetNewStreamId() { | 1783 SpdyStreamId SpdySession::GetNewStreamId() { |
| 1782 CHECK_LE(stream_hi_water_mark_, kLastStreamId); | 1784 CHECK_LE(stream_hi_water_mark_, kLastStreamId); |
| 1783 SpdyStreamId id = stream_hi_water_mark_; | 1785 SpdyStreamId id = stream_hi_water_mark_; |
| 1784 stream_hi_water_mark_ += 2; | 1786 stream_hi_water_mark_ += 2; |
| 1785 return id; | 1787 return id; |
| 1786 } | 1788 } |
| 1787 | 1789 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 | 1957 |
| 1956 write_queue_.RemovePendingWritesForStream(stream->GetWeakPtr()); | 1958 write_queue_.RemovePendingWritesForStream(stream->GetWeakPtr()); |
| 1957 stream->OnClose(status); | 1959 stream->OnClose(status); |
| 1958 | 1960 |
| 1959 if (availability_state_ == STATE_AVAILABLE) { | 1961 if (availability_state_ == STATE_AVAILABLE) { |
| 1960 ProcessPendingStreamRequests(); | 1962 ProcessPendingStreamRequests(); |
| 1961 } | 1963 } |
| 1962 } | 1964 } |
| 1963 | 1965 |
| 1964 base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) { | 1966 base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) { |
| 1965 base::StatsCounter used_push_streams("spdy.claimed_push_streams"); | |
| 1966 | |
| 1967 PushedStreamMap::iterator unclaimed_it = unclaimed_pushed_streams_.find(url); | 1967 PushedStreamMap::iterator unclaimed_it = unclaimed_pushed_streams_.find(url); |
| 1968 if (unclaimed_it == unclaimed_pushed_streams_.end()) | 1968 if (unclaimed_it == unclaimed_pushed_streams_.end()) |
| 1969 return base::WeakPtr<SpdyStream>(); | 1969 return base::WeakPtr<SpdyStream>(); |
| 1970 | 1970 |
| 1971 SpdyStreamId stream_id = unclaimed_it->second.stream_id; | 1971 SpdyStreamId stream_id = unclaimed_it->second.stream_id; |
| 1972 unclaimed_pushed_streams_.erase(unclaimed_it); | 1972 unclaimed_pushed_streams_.erase(unclaimed_it); |
| 1973 | 1973 |
| 1974 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); | 1974 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); |
| 1975 if (active_it == active_streams_.end()) { | 1975 if (active_it == active_streams_.end()) { |
| 1976 NOTREACHED(); | 1976 NOTREACHED(); |
| 1977 return base::WeakPtr<SpdyStream>(); | 1977 return base::WeakPtr<SpdyStream>(); |
| 1978 } | 1978 } |
| 1979 | 1979 |
| 1980 net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM, | 1980 net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_ADOPTED_PUSH_STREAM, |
| 1981 base::Bind(&NetLogSpdyAdoptedPushStreamCallback, | 1981 base::Bind(&NetLogSpdyAdoptedPushStreamCallback, |
| 1982 active_it->second.stream->stream_id(), &url)); | 1982 active_it->second.stream->stream_id(), &url)); |
| 1983 used_push_streams.Increment(); | |
| 1984 return active_it->second.stream->GetWeakPtr(); | 1983 return active_it->second.stream->GetWeakPtr(); |
| 1985 } | 1984 } |
| 1986 | 1985 |
| 1987 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, | 1986 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, |
| 1988 bool* was_npn_negotiated, | 1987 bool* was_npn_negotiated, |
| 1989 NextProto* protocol_negotiated) { | 1988 NextProto* protocol_negotiated) { |
| 1990 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); | 1989 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); |
| 1991 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); | 1990 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); |
| 1992 return connection_->socket()->GetSSLInfo(ssl_info); | 1991 return connection_->socket()->GetSSLInfo(ssl_info); |
| 1993 } | 1992 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 if (!TryCreatePushStream( | 2247 if (!TryCreatePushStream( |
| 2249 stream_id, associated_stream_id, priority, request_headers)) | 2248 stream_id, associated_stream_id, priority, request_headers)) |
| 2250 return; | 2249 return; |
| 2251 | 2250 |
| 2252 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); | 2251 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); |
| 2253 if (active_it == active_streams_.end()) { | 2252 if (active_it == active_streams_.end()) { |
| 2254 NOTREACHED(); | 2253 NOTREACHED(); |
| 2255 return; | 2254 return; |
| 2256 } | 2255 } |
| 2257 | 2256 |
| 2258 if (OnInitialResponseHeadersReceived(response_headers, | 2257 OnInitialResponseHeadersReceived(response_headers, response_time, |
| 2259 response_time, | 2258 recv_first_byte_time, |
| 2260 recv_first_byte_time, | 2259 active_it->second.stream); |
| 2261 active_it->second.stream) != OK) | |
| 2262 return; | |
| 2263 | |
| 2264 base::StatsCounter push_requests("spdy.pushed_streams"); | |
| 2265 push_requests.Increment(); | |
| 2266 } | 2260 } |
| 2267 | 2261 |
| 2268 void SpdySession::DeleteExpiredPushedStreams() { | 2262 void SpdySession::DeleteExpiredPushedStreams() { |
| 2269 if (unclaimed_pushed_streams_.empty()) | 2263 if (unclaimed_pushed_streams_.empty()) |
| 2270 return; | 2264 return; |
| 2271 | 2265 |
| 2272 // Check that adequate time has elapsed since the last sweep. | 2266 // Check that adequate time has elapsed since the last sweep. |
| 2273 if (time_func_() < next_unclaimed_push_stream_sweep_time_) | 2267 if (time_func_() < next_unclaimed_push_stream_sweep_time_) |
| 2274 return; | 2268 return; |
| 2275 | 2269 |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 base::Bind(&NetLogSpdyPushPromiseReceivedCallback, | 2745 base::Bind(&NetLogSpdyPushPromiseReceivedCallback, |
| 2752 &headers, | 2746 &headers, |
| 2753 stream_id, | 2747 stream_id, |
| 2754 promised_stream_id)); | 2748 promised_stream_id)); |
| 2755 } | 2749 } |
| 2756 | 2750 |
| 2757 // Any priority will do. | 2751 // Any priority will do. |
| 2758 // TODO(baranovich): pass parent stream id priority? | 2752 // TODO(baranovich): pass parent stream id priority? |
| 2759 if (!TryCreatePushStream(promised_stream_id, stream_id, 0, headers)) | 2753 if (!TryCreatePushStream(promised_stream_id, stream_id, 0, headers)) |
| 2760 return; | 2754 return; |
| 2761 | |
| 2762 base::StatsCounter push_requests("spdy.pushed_streams"); | |
| 2763 push_requests.Increment(); | |
| 2764 } | 2755 } |
| 2765 | 2756 |
| 2766 void SpdySession::SendStreamWindowUpdate(SpdyStreamId stream_id, | 2757 void SpdySession::SendStreamWindowUpdate(SpdyStreamId stream_id, |
| 2767 uint32 delta_window_size) { | 2758 uint32 delta_window_size) { |
| 2768 CHECK_GE(flow_control_state_, FLOW_CONTROL_STREAM); | 2759 CHECK_GE(flow_control_state_, FLOW_CONTROL_STREAM); |
| 2769 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 2760 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |
| 2770 CHECK(it != active_streams_.end()); | 2761 CHECK(it != active_streams_.end()); |
| 2771 CHECK_EQ(it->second.stream->stream_id(), stream_id); | 2762 CHECK_EQ(it->second.stream->stream_id(), stream_id); |
| 2772 SendWindowUpdateFrame( | 2763 SendWindowUpdateFrame( |
| 2773 stream_id, delta_window_size, it->second.stream->priority()); | 2764 stream_id, delta_window_size, it->second.stream->priority()); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3291 if (!queue->empty()) { | 3282 if (!queue->empty()) { |
| 3292 SpdyStreamId stream_id = queue->front(); | 3283 SpdyStreamId stream_id = queue->front(); |
| 3293 queue->pop_front(); | 3284 queue->pop_front(); |
| 3294 return stream_id; | 3285 return stream_id; |
| 3295 } | 3286 } |
| 3296 } | 3287 } |
| 3297 return 0; | 3288 return 0; |
| 3298 } | 3289 } |
| 3299 | 3290 |
| 3300 } // namespace net | 3291 } // namespace net |
| OLD | NEW |