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 StartGoingAway(0, ERR_ABORTED); | |
Ryan Hamilton
2014/06/11 17:05:59
Hm. Handling DCHECKS is verboten in Chrome. (There
Johnny
2014/06/11 17:17:20
Removed.
| |
1605 } else { | |
1606 StartGoingAway(0, err); | |
1607 } | |
1602 DcheckDraining(); | 1608 DcheckDraining(); |
1603 MaybePostWriteLoop(); | 1609 MaybePostWriteLoop(); |
1604 } | 1610 } |
1605 | 1611 |
1606 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { | 1612 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { |
1607 DCHECK(stream); | 1613 DCHECK(stream); |
1608 std::string description = base::StringPrintf( | 1614 std::string description = base::StringPrintf( |
1609 "ABANDONED (stream_id=%d): ", stream->stream_id()) + | 1615 "ABANDONED (stream_id=%d): ", stream->stream_id()) + |
1610 stream->url().spec(); | 1616 stream->url().spec(); |
1611 stream->LogStreamError(status, description); | 1617 stream->LogStreamError(status, description); |
(...skipping 20 matching lines...) Expand all Loading... | |
1632 | 1638 |
1633 SpdyStreamId SpdySession::GetNewStreamId() { | 1639 SpdyStreamId SpdySession::GetNewStreamId() { |
1634 CHECK_LE(stream_hi_water_mark_, kLastStreamId); | 1640 CHECK_LE(stream_hi_water_mark_, kLastStreamId); |
1635 SpdyStreamId id = stream_hi_water_mark_; | 1641 SpdyStreamId id = stream_hi_water_mark_; |
1636 stream_hi_water_mark_ += 2; | 1642 stream_hi_water_mark_ += 2; |
1637 return id; | 1643 return id; |
1638 } | 1644 } |
1639 | 1645 |
1640 void SpdySession::CloseSessionOnError(Error err, | 1646 void SpdySession::CloseSessionOnError(Error err, |
1641 const std::string& description) { | 1647 const std::string& description) { |
1648 DCHECK_LT(err, ERR_IO_PENDING); | |
1642 DoDrainSession(err, description); | 1649 DoDrainSession(err, description); |
1643 } | 1650 } |
1644 | 1651 |
1645 void SpdySession::MakeUnavailable() { | 1652 void SpdySession::MakeUnavailable() { |
1646 if (availability_state_ == STATE_AVAILABLE) { | 1653 if (availability_state_ == STATE_AVAILABLE) { |
1647 availability_state_ = STATE_GOING_AWAY; | 1654 availability_state_ = STATE_GOING_AWAY; |
1648 pool_->MakeSessionUnavailable(GetWeakPtr()); | 1655 pool_->MakeSessionUnavailable(GetWeakPtr()); |
1649 } | 1656 } |
1650 } | 1657 } |
1651 | 1658 |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3009 if (!queue->empty()) { | 3016 if (!queue->empty()) { |
3010 SpdyStreamId stream_id = queue->front(); | 3017 SpdyStreamId stream_id = queue->front(); |
3011 queue->pop_front(); | 3018 queue->pop_front(); |
3012 return stream_id; | 3019 return stream_id; |
3013 } | 3020 } |
3014 } | 3021 } |
3015 return 0; | 3022 return 0; |
3016 } | 3023 } |
3017 | 3024 |
3018 } // namespace net | 3025 } // namespace net |
OLD | NEW |