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 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 error_on_close_ = err; | 1591 error_on_close_ = err; |
1592 | 1592 |
1593 net_log_.AddEvent( | 1593 net_log_.AddEvent( |
1594 NetLog::TYPE_SPDY_SESSION_CLOSE, | 1594 NetLog::TYPE_SPDY_SESSION_CLOSE, |
1595 base::Bind(&NetLogSpdySessionCloseCallback, err, &description)); | 1595 base::Bind(&NetLogSpdySessionCloseCallback, err, &description)); |
1596 | 1596 |
1597 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SpdySession.ClosedOnError", -err); | 1597 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SpdySession.ClosedOnError", -err); |
1598 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySession.BytesRead.OtherErrors", | 1598 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySession.BytesRead.OtherErrors", |
1599 total_bytes_received_, 1, 100000000, 50); | 1599 total_bytes_received_, 1, 100000000, 50); |
1600 | 1600 |
1601 StartGoingAway(0, err); | 1601 if (err == OK) { |
| 1602 // We ought to be going away already, as this is a graceful close. |
| 1603 DcheckGoingAway(); |
| 1604 } else { |
| 1605 StartGoingAway(0, err); |
| 1606 } |
1602 DcheckDraining(); | 1607 DcheckDraining(); |
1603 MaybePostWriteLoop(); | 1608 MaybePostWriteLoop(); |
1604 } | 1609 } |
1605 | 1610 |
1606 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { | 1611 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { |
1607 DCHECK(stream); | 1612 DCHECK(stream); |
1608 std::string description = base::StringPrintf( | 1613 std::string description = base::StringPrintf( |
1609 "ABANDONED (stream_id=%d): ", stream->stream_id()) + | 1614 "ABANDONED (stream_id=%d): ", stream->stream_id()) + |
1610 stream->url().spec(); | 1615 stream->url().spec(); |
1611 stream->LogStreamError(status, description); | 1616 stream->LogStreamError(status, description); |
(...skipping 20 matching lines...) Expand all Loading... |
1632 | 1637 |
1633 SpdyStreamId SpdySession::GetNewStreamId() { | 1638 SpdyStreamId SpdySession::GetNewStreamId() { |
1634 CHECK_LE(stream_hi_water_mark_, kLastStreamId); | 1639 CHECK_LE(stream_hi_water_mark_, kLastStreamId); |
1635 SpdyStreamId id = stream_hi_water_mark_; | 1640 SpdyStreamId id = stream_hi_water_mark_; |
1636 stream_hi_water_mark_ += 2; | 1641 stream_hi_water_mark_ += 2; |
1637 return id; | 1642 return id; |
1638 } | 1643 } |
1639 | 1644 |
1640 void SpdySession::CloseSessionOnError(Error err, | 1645 void SpdySession::CloseSessionOnError(Error err, |
1641 const std::string& description) { | 1646 const std::string& description) { |
| 1647 DCHECK_LT(err, ERR_IO_PENDING); |
1642 DoDrainSession(err, description); | 1648 DoDrainSession(err, description); |
1643 } | 1649 } |
1644 | 1650 |
1645 void SpdySession::MakeUnavailable() { | 1651 void SpdySession::MakeUnavailable() { |
1646 if (availability_state_ == STATE_AVAILABLE) { | 1652 if (availability_state_ == STATE_AVAILABLE) { |
1647 availability_state_ = STATE_GOING_AWAY; | 1653 availability_state_ = STATE_GOING_AWAY; |
1648 pool_->MakeSessionUnavailable(GetWeakPtr()); | 1654 pool_->MakeSessionUnavailable(GetWeakPtr()); |
1649 } | 1655 } |
1650 } | 1656 } |
1651 | 1657 |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3009 if (!queue->empty()) { | 3015 if (!queue->empty()) { |
3010 SpdyStreamId stream_id = queue->front(); | 3016 SpdyStreamId stream_id = queue->front(); |
3011 queue->pop_front(); | 3017 queue->pop_front(); |
3012 return stream_id; | 3018 return stream_id; |
3013 } | 3019 } |
3014 } | 3020 } |
3015 return 0; | 3021 return 0; |
3016 } | 3022 } |
3017 | 3023 |
3018 } // namespace net | 3024 } // namespace net |
OLD | NEW |