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" |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 return OK; | 911 return OK; |
912 } | 912 } |
913 | 913 |
914 void SpdySession::CancelStreamRequest( | 914 void SpdySession::CancelStreamRequest( |
915 const base::WeakPtr<SpdyStreamRequest>& request) { | 915 const base::WeakPtr<SpdyStreamRequest>& request) { |
916 DCHECK(request); | 916 DCHECK(request); |
917 RequestPriority priority = request->priority(); | 917 RequestPriority priority = request->priority(); |
918 CHECK_GE(priority, MINIMUM_PRIORITY); | 918 CHECK_GE(priority, MINIMUM_PRIORITY); |
919 CHECK_LE(priority, MAXIMUM_PRIORITY); | 919 CHECK_LE(priority, MAXIMUM_PRIORITY); |
920 | 920 |
921 #if DCHECK_IS_ON | 921 #if DCHECK_IS_ON() |
922 // |request| should not be in a queue not matching its priority. | 922 // |request| should not be in a queue not matching its priority. |
923 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 923 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
924 if (priority == i) | 924 if (priority == i) |
925 continue; | 925 continue; |
926 PendingStreamRequestQueue* queue = &pending_create_stream_queues_[i]; | 926 PendingStreamRequestQueue* queue = &pending_create_stream_queues_[i]; |
927 DCHECK(std::find_if(queue->begin(), | 927 DCHECK(std::find_if(queue->begin(), |
928 queue->end(), | 928 queue->end(), |
929 RequestEquals(request)) == queue->end()); | 929 RequestEquals(request)) == queue->end()); |
930 } | 930 } |
931 #endif | 931 #endif |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 in_flight_write_frame_size_ = 0; | 1624 in_flight_write_frame_size_ = 0; |
1625 in_flight_write_stream_.reset(); | 1625 in_flight_write_stream_.reset(); |
1626 } | 1626 } |
1627 } | 1627 } |
1628 | 1628 |
1629 write_state_ = WRITE_STATE_DO_WRITE; | 1629 write_state_ = WRITE_STATE_DO_WRITE; |
1630 return OK; | 1630 return OK; |
1631 } | 1631 } |
1632 | 1632 |
1633 void SpdySession::DcheckGoingAway() const { | 1633 void SpdySession::DcheckGoingAway() const { |
1634 #if DCHECK_IS_ON | 1634 #if DCHECK_IS_ON() |
1635 DCHECK_GE(availability_state_, STATE_GOING_AWAY); | 1635 DCHECK_GE(availability_state_, STATE_GOING_AWAY); |
1636 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 1636 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
1637 DCHECK(pending_create_stream_queues_[i].empty()); | 1637 DCHECK(pending_create_stream_queues_[i].empty()); |
1638 } | 1638 } |
1639 DCHECK(created_streams_.empty()); | 1639 DCHECK(created_streams_.empty()); |
1640 #endif | 1640 #endif |
1641 } | 1641 } |
1642 | 1642 |
1643 void SpdySession::DcheckDraining() const { | 1643 void SpdySession::DcheckDraining() const { |
1644 DcheckGoingAway(); | 1644 DcheckGoingAway(); |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3241 void SpdySession::ResumeSendStalledStreams() { | 3241 void SpdySession::ResumeSendStalledStreams() { |
3242 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION); | 3242 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION); |
3243 | 3243 |
3244 // We don't have to worry about new streams being queued, since | 3244 // We don't have to worry about new streams being queued, since |
3245 // doing so would cause IsSendStalled() to return true. But we do | 3245 // doing so would cause IsSendStalled() to return true. But we do |
3246 // have to worry about streams being closed, as well as ourselves | 3246 // have to worry about streams being closed, as well as ourselves |
3247 // being closed. | 3247 // being closed. |
3248 | 3248 |
3249 while (!IsSendStalled()) { | 3249 while (!IsSendStalled()) { |
3250 size_t old_size = 0; | 3250 size_t old_size = 0; |
3251 #if DCHECK_IS_ON | 3251 #if DCHECK_IS_ON() |
3252 old_size = GetTotalSize(stream_send_unstall_queue_); | 3252 old_size = GetTotalSize(stream_send_unstall_queue_); |
3253 #endif | 3253 #endif |
3254 | 3254 |
3255 SpdyStreamId stream_id = PopStreamToPossiblyResume(); | 3255 SpdyStreamId stream_id = PopStreamToPossiblyResume(); |
3256 if (stream_id == 0) | 3256 if (stream_id == 0) |
3257 break; | 3257 break; |
3258 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 3258 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |
3259 // The stream may actually still be send-stalled after this (due | 3259 // The stream may actually still be send-stalled after this (due |
3260 // to its own send window) but that's okay -- it'll then be | 3260 // to its own send window) but that's okay -- it'll then be |
3261 // resumed once its send window increases. | 3261 // resumed once its send window increases. |
(...skipping 12 matching lines...) Expand all Loading... |
3274 if (!queue->empty()) { | 3274 if (!queue->empty()) { |
3275 SpdyStreamId stream_id = queue->front(); | 3275 SpdyStreamId stream_id = queue->front(); |
3276 queue->pop_front(); | 3276 queue->pop_front(); |
3277 return stream_id; | 3277 return stream_id; |
3278 } | 3278 } |
3279 } | 3279 } |
3280 return 0; | 3280 return 0; |
3281 } | 3281 } |
3282 | 3282 |
3283 } // namespace net | 3283 } // namespace net |
OLD | NEW |