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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 return OK; | 749 return OK; |
750 } | 750 } |
751 | 751 |
752 void SpdySession::CancelStreamRequest( | 752 void SpdySession::CancelStreamRequest( |
753 const base::WeakPtr<SpdyStreamRequest>& request) { | 753 const base::WeakPtr<SpdyStreamRequest>& request) { |
754 DCHECK(request); | 754 DCHECK(request); |
755 RequestPriority priority = request->priority(); | 755 RequestPriority priority = request->priority(); |
756 CHECK_GE(priority, MINIMUM_PRIORITY); | 756 CHECK_GE(priority, MINIMUM_PRIORITY); |
757 CHECK_LE(priority, MAXIMUM_PRIORITY); | 757 CHECK_LE(priority, MAXIMUM_PRIORITY); |
758 | 758 |
759 if (DCHECK_IS_ON()) { | 759 if (DCHECK_IS_ON) { |
760 // |request| should not be in a queue not matching its priority. | 760 // |request| should not be in a queue not matching its priority. |
761 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 761 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
762 if (priority == i) | 762 if (priority == i) |
763 continue; | 763 continue; |
764 PendingStreamRequestQueue* queue = &pending_create_stream_queues_[i]; | 764 PendingStreamRequestQueue* queue = &pending_create_stream_queues_[i]; |
765 DCHECK(std::find_if(queue->begin(), | 765 DCHECK(std::find_if(queue->begin(), |
766 queue->end(), | 766 queue->end(), |
767 RequestEquals(request)) == queue->end()); | 767 RequestEquals(request)) == queue->end()); |
768 } | 768 } |
769 } | 769 } |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 in_flight_write_stream_.reset(); | 1453 in_flight_write_stream_.reset(); |
1454 } | 1454 } |
1455 } | 1455 } |
1456 | 1456 |
1457 write_state_ = WRITE_STATE_DO_WRITE; | 1457 write_state_ = WRITE_STATE_DO_WRITE; |
1458 return OK; | 1458 return OK; |
1459 } | 1459 } |
1460 | 1460 |
1461 void SpdySession::DcheckGoingAway() const { | 1461 void SpdySession::DcheckGoingAway() const { |
1462 DCHECK_GE(availability_state_, STATE_GOING_AWAY); | 1462 DCHECK_GE(availability_state_, STATE_GOING_AWAY); |
1463 if (DCHECK_IS_ON()) { | 1463 if (DCHECK_IS_ON) { |
1464 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { | 1464 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { |
1465 DCHECK(pending_create_stream_queues_[i].empty()); | 1465 DCHECK(pending_create_stream_queues_[i].empty()); |
1466 } | 1466 } |
1467 } | 1467 } |
1468 DCHECK(created_streams_.empty()); | 1468 DCHECK(created_streams_.empty()); |
1469 } | 1469 } |
1470 | 1470 |
1471 void SpdySession::DcheckClosed() const { | 1471 void SpdySession::DcheckClosed() const { |
1472 DcheckGoingAway(); | 1472 DcheckGoingAway(); |
1473 DCHECK_EQ(availability_state_, STATE_CLOSED); | 1473 DCHECK_EQ(availability_state_, STATE_CLOSED); |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3007 void SpdySession::ResumeSendStalledStreams() { | 3007 void SpdySession::ResumeSendStalledStreams() { |
3008 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION); | 3008 DCHECK_EQ(flow_control_state_, FLOW_CONTROL_STREAM_AND_SESSION); |
3009 | 3009 |
3010 // We don't have to worry about new streams being queued, since | 3010 // We don't have to worry about new streams being queued, since |
3011 // doing so would cause IsSendStalled() to return true. But we do | 3011 // doing so would cause IsSendStalled() to return true. But we do |
3012 // have to worry about streams being closed, as well as ourselves | 3012 // have to worry about streams being closed, as well as ourselves |
3013 // being closed. | 3013 // being closed. |
3014 | 3014 |
3015 while (availability_state_ != STATE_CLOSED && !IsSendStalled()) { | 3015 while (availability_state_ != STATE_CLOSED && !IsSendStalled()) { |
3016 size_t old_size = 0; | 3016 size_t old_size = 0; |
3017 if (DCHECK_IS_ON()) | 3017 if (DCHECK_IS_ON) |
3018 old_size = GetTotalSize(stream_send_unstall_queue_); | 3018 old_size = GetTotalSize(stream_send_unstall_queue_); |
3019 | 3019 |
3020 SpdyStreamId stream_id = PopStreamToPossiblyResume(); | 3020 SpdyStreamId stream_id = PopStreamToPossiblyResume(); |
3021 if (stream_id == 0) | 3021 if (stream_id == 0) |
3022 break; | 3022 break; |
3023 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 3023 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |
3024 // The stream may actually still be send-stalled after this (due | 3024 // The stream may actually still be send-stalled after this (due |
3025 // to its own send window) but that's okay -- it'll then be | 3025 // to its own send window) but that's okay -- it'll then be |
3026 // resumed once its send window increases. | 3026 // resumed once its send window increases. |
3027 if (it != active_streams_.end()) | 3027 if (it != active_streams_.end()) |
(...skipping 11 matching lines...) Expand all Loading... |
3039 if (!queue->empty()) { | 3039 if (!queue->empty()) { |
3040 SpdyStreamId stream_id = queue->front(); | 3040 SpdyStreamId stream_id = queue->front(); |
3041 queue->pop_front(); | 3041 queue->pop_front(); |
3042 return stream_id; | 3042 return stream_id; |
3043 } | 3043 } |
3044 } | 3044 } |
3045 return 0; | 3045 return 0; |
3046 } | 3046 } |
3047 | 3047 |
3048 } // namespace net | 3048 } // namespace net |
OLD | NEW |