| 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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1695 // stream isn't active (i.e., it hasn't written anything to the wire | 1695 // stream isn't active (i.e., it hasn't written anything to the wire |
| 1696 // yet) then it's as if it never existed. If it is active, then | 1696 // yet) then it's as if it never existed. If it is active, then |
| 1697 // LogAbandonedActiveStream() will increment the counters. | 1697 // LogAbandonedActiveStream() will increment the counters. |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, | 1700 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, |
| 1701 Error status) { | 1701 Error status) { |
| 1702 DCHECK_GT(it->first, 0u); | 1702 DCHECK_GT(it->first, 0u); |
| 1703 LogAbandonedStream(it->second.stream, status); | 1703 LogAbandonedStream(it->second.stream, status); |
| 1704 ++streams_abandoned_count_; | 1704 ++streams_abandoned_count_; |
| 1705 if (it->second.stream->type() == SPDY_PUSH_STREAM && | |
| 1706 unclaimed_pushed_streams_.find(it->second.stream->url()) != | |
| 1707 unclaimed_pushed_streams_.end()) { | |
| 1708 } | |
| 1709 } | 1705 } |
| 1710 | 1706 |
| 1711 SpdyStreamId SpdySession::GetNewStreamId() { | 1707 SpdyStreamId SpdySession::GetNewStreamId() { |
| 1712 CHECK_LE(stream_hi_water_mark_, kLastStreamId); | 1708 CHECK_LE(stream_hi_water_mark_, kLastStreamId); |
| 1713 SpdyStreamId id = stream_hi_water_mark_; | 1709 SpdyStreamId id = stream_hi_water_mark_; |
| 1714 stream_hi_water_mark_ += 2; | 1710 stream_hi_water_mark_ += 2; |
| 1715 return id; | 1711 return id; |
| 1716 } | 1712 } |
| 1717 | 1713 |
| 1718 void SpdySession::CloseSessionOnError(Error err, | 1714 void SpdySession::CloseSessionOnError(Error err, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 } | 1887 } |
| 1892 | 1888 |
| 1893 write_queue_.RemovePendingWritesForStream(stream->GetWeakPtr()); | 1889 write_queue_.RemovePendingWritesForStream(stream->GetWeakPtr()); |
| 1894 stream->OnClose(status); | 1890 stream->OnClose(status); |
| 1895 | 1891 |
| 1896 if (availability_state_ == STATE_AVAILABLE) { | 1892 if (availability_state_ == STATE_AVAILABLE) { |
| 1897 ProcessPendingStreamRequests(); | 1893 ProcessPendingStreamRequests(); |
| 1898 } | 1894 } |
| 1899 } | 1895 } |
| 1900 | 1896 |
| 1897 SpdyStreamId SpdySession::GetStreamIdForPush(const GURL& url) { |
| 1898 UnclaimedPushedStreamContainer::const_iterator unclaimed_it = |
| 1899 unclaimed_pushed_streams_.find(url); |
| 1900 if (unclaimed_it == unclaimed_pushed_streams_.end()) |
| 1901 return 0; |
| 1902 return unclaimed_it->second.stream_id; |
| 1903 } |
| 1904 |
| 1901 base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) { | 1905 base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) { |
| 1902 UnclaimedPushedStreamContainer::const_iterator unclaimed_it = | 1906 UnclaimedPushedStreamContainer::const_iterator unclaimed_it = |
| 1903 unclaimed_pushed_streams_.find(url); | 1907 unclaimed_pushed_streams_.find(url); |
| 1904 if (unclaimed_it == unclaimed_pushed_streams_.end()) | 1908 if (unclaimed_it == unclaimed_pushed_streams_.end()) |
| 1905 return base::WeakPtr<SpdyStream>(); | 1909 return base::WeakPtr<SpdyStream>(); |
| 1906 | 1910 |
| 1907 SpdyStreamId stream_id = unclaimed_it->second.stream_id; | 1911 SpdyStreamId stream_id = unclaimed_it->second.stream_id; |
| 1908 unclaimed_pushed_streams_.erase(unclaimed_it); | 1912 unclaimed_pushed_streams_.erase(unclaimed_it); |
| 1909 | 1913 |
| 1910 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); | 1914 ActiveStreamMap::iterator active_it = active_streams_.find(stream_id); |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 if (!queue->empty()) { | 3144 if (!queue->empty()) { |
| 3141 SpdyStreamId stream_id = queue->front(); | 3145 SpdyStreamId stream_id = queue->front(); |
| 3142 queue->pop_front(); | 3146 queue->pop_front(); |
| 3143 return stream_id; | 3147 return stream_id; |
| 3144 } | 3148 } |
| 3145 } | 3149 } |
| 3146 return 0; | 3150 return 0; |
| 3147 } | 3151 } |
| 3148 | 3152 |
| 3149 } // namespace net | 3153 } // namespace net |
| OLD | NEW |