| 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/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/crypto/proof_verifier.h" | 8 #include "net/quic/crypto/proof_verifier.h" |
| 9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // To avoid deleting a stream in mid-operation, we have a simple shim between | 27 // To avoid deleting a stream in mid-operation, we have a simple shim between |
| 28 // us and the stream, so we can delete any streams when we return from | 28 // us and the stream, so we can delete any streams when we return from |
| 29 // processing. | 29 // processing. |
| 30 // | 30 // |
| 31 // We could just override the base methods, but this makes it easier to make | 31 // We could just override the base methods, but this makes it easier to make |
| 32 // sure we don't miss any. | 32 // sure we don't miss any. |
| 33 class VisitorShim : public QuicConnectionVisitorInterface { | 33 class VisitorShim : public QuicConnectionVisitorInterface { |
| 34 public: | 34 public: |
| 35 explicit VisitorShim(QuicSession* session) : session_(session) {} | 35 explicit VisitorShim(QuicSession* session) : session_(session) {} |
| 36 | 36 |
| 37 virtual void OnStreamFrames(const vector<QuicStreamFrame>& frames) OVERRIDE { | 37 virtual void OnStreamFrames(const vector<QuicStreamFrame>& frames) override { |
| 38 session_->OnStreamFrames(frames); | 38 session_->OnStreamFrames(frames); |
| 39 session_->PostProcessAfterData(); | 39 session_->PostProcessAfterData(); |
| 40 } | 40 } |
| 41 virtual void OnRstStream(const QuicRstStreamFrame& frame) OVERRIDE { | 41 virtual void OnRstStream(const QuicRstStreamFrame& frame) override { |
| 42 session_->OnRstStream(frame); | 42 session_->OnRstStream(frame); |
| 43 session_->PostProcessAfterData(); | 43 session_->PostProcessAfterData(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void OnGoAway(const QuicGoAwayFrame& frame) OVERRIDE { | 46 virtual void OnGoAway(const QuicGoAwayFrame& frame) override { |
| 47 session_->OnGoAway(frame); | 47 session_->OnGoAway(frame); |
| 48 session_->PostProcessAfterData(); | 48 session_->PostProcessAfterData(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void OnWindowUpdateFrames(const vector<QuicWindowUpdateFrame>& frames) | 51 virtual void OnWindowUpdateFrames(const vector<QuicWindowUpdateFrame>& frames) |
| 52 OVERRIDE { | 52 override { |
| 53 session_->OnWindowUpdateFrames(frames); | 53 session_->OnWindowUpdateFrames(frames); |
| 54 session_->PostProcessAfterData(); | 54 session_->PostProcessAfterData(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void OnBlockedFrames(const vector<QuicBlockedFrame>& frames) | 57 virtual void OnBlockedFrames(const vector<QuicBlockedFrame>& frames) |
| 58 OVERRIDE { | 58 override { |
| 59 session_->OnBlockedFrames(frames); | 59 session_->OnBlockedFrames(frames); |
| 60 session_->PostProcessAfterData(); | 60 session_->PostProcessAfterData(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 virtual void OnCanWrite() OVERRIDE { | 63 virtual void OnCanWrite() override { |
| 64 session_->OnCanWrite(); | 64 session_->OnCanWrite(); |
| 65 session_->PostProcessAfterData(); | 65 session_->PostProcessAfterData(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 virtual void OnCongestionWindowChange(QuicTime now) OVERRIDE { | 68 virtual void OnCongestionWindowChange(QuicTime now) override { |
| 69 session_->OnCongestionWindowChange(now); | 69 session_->OnCongestionWindowChange(now); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void OnSuccessfulVersionNegotiation( | 72 virtual void OnSuccessfulVersionNegotiation( |
| 73 const QuicVersion& version) OVERRIDE { | 73 const QuicVersion& version) override { |
| 74 session_->OnSuccessfulVersionNegotiation(version); | 74 session_->OnSuccessfulVersionNegotiation(version); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual void OnConnectionClosed( | 77 virtual void OnConnectionClosed( |
| 78 QuicErrorCode error, bool from_peer) OVERRIDE { | 78 QuicErrorCode error, bool from_peer) override { |
| 79 session_->OnConnectionClosed(error, from_peer); | 79 session_->OnConnectionClosed(error, from_peer); |
| 80 // The session will go away, so don't bother with cleanup. | 80 // The session will go away, so don't bother with cleanup. |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void OnWriteBlocked() OVERRIDE { | 83 virtual void OnWriteBlocked() override { |
| 84 session_->OnWriteBlocked(); | 84 session_->OnWriteBlocked(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 virtual bool WillingAndAbleToWrite() const OVERRIDE { | 87 virtual bool WillingAndAbleToWrite() const override { |
| 88 return session_->WillingAndAbleToWrite(); | 88 return session_->WillingAndAbleToWrite(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 virtual bool HasPendingHandshake() const OVERRIDE { | 91 virtual bool HasPendingHandshake() const override { |
| 92 return session_->HasPendingHandshake(); | 92 return session_->HasPendingHandshake(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual bool HasOpenDataStreams() const OVERRIDE { | 95 virtual bool HasOpenDataStreams() const override { |
| 96 return session_->HasOpenDataStreams(); | 96 return session_->HasOpenDataStreams(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 private: | 99 private: |
| 100 QuicSession* session_; | 100 QuicSession* session_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) | 103 QuicSession::QuicSession(QuicConnection* connection, const QuicConfig& config) |
| 104 : connection_(connection), | 104 : connection_(connection), |
| 105 visitor_shim_(new VisitorShim(this)), | 105 visitor_shim_(new VisitorShim(this)), |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 776 |
| 777 // Disable stream level flow control based on negotiated version. Streams may | 777 // Disable stream level flow control based on negotiated version. Streams may |
| 778 // have been created with a different version. | 778 // have been created with a different version. |
| 779 if (version < QUIC_VERSION_21) { | 779 if (version < QUIC_VERSION_21) { |
| 780 GetCryptoStream()->flow_controller()->Disable(); | 780 GetCryptoStream()->flow_controller()->Disable(); |
| 781 headers_stream_->flow_controller()->Disable(); | 781 headers_stream_->flow_controller()->Disable(); |
| 782 } | 782 } |
| 783 } | 783 } |
| 784 | 784 |
| 785 } // namespace net | 785 } // namespace net |
| OLD | NEW |