Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 5 #ifndef NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| 6 #define NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 6 #define NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 class Timer; | 23 class Timer; |
| 24 } // namespace base | 24 } // namespace base |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 struct BidirectionalStreamRequestInfo; | 28 struct BidirectionalStreamRequestInfo; |
| 29 class IOBuffer; | 29 class IOBuffer; |
| 30 | 30 |
| 31 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl | 31 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl |
| 32 : public BidirectionalStreamImpl, | 32 : public BidirectionalStreamImpl, |
| 33 public QuicChromiumClientStream::Delegate, | 33 public QuicChromiumClientStream::Delegate { |
| 34 public QuicChromiumClientSession::Observer { | |
| 35 public: | 34 public: |
| 36 explicit BidirectionalStreamQuicImpl( | 35 explicit BidirectionalStreamQuicImpl( |
| 37 const base::WeakPtr<QuicChromiumClientSession>& session); | 36 QuicChromiumClientSession::Handle session); |
| 38 | 37 |
| 39 ~BidirectionalStreamQuicImpl() override; | 38 ~BidirectionalStreamQuicImpl() override; |
| 40 | 39 |
| 41 // BidirectionalStreamImpl implementation: | 40 // BidirectionalStreamImpl implementation: |
| 42 void Start(const BidirectionalStreamRequestInfo* request_info, | 41 void Start(const BidirectionalStreamRequestInfo* request_info, |
| 43 const NetLogWithSource& net_log, | 42 const NetLogWithSource& net_log, |
| 44 bool send_request_headers_automatically, | 43 bool send_request_headers_automatically, |
| 45 BidirectionalStreamImpl::Delegate* delegate, | 44 BidirectionalStreamImpl::Delegate* delegate, |
| 46 std::unique_ptr<base::Timer> timer) override; | 45 std::unique_ptr<base::Timer> timer) override; |
| 47 void SendRequestHeaders() override; | 46 void SendRequestHeaders() override; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 // QuicChromiumClientStream::Delegate implementation: | 60 // QuicChromiumClientStream::Delegate implementation: |
| 62 void OnHeadersAvailable(const SpdyHeaderBlock& headers, | 61 void OnHeadersAvailable(const SpdyHeaderBlock& headers, |
| 63 size_t frame_len) override; | 62 size_t frame_len) override; |
| 64 void OnDataAvailable() override; | 63 void OnDataAvailable() override; |
| 65 void OnClose() override; | 64 void OnClose() override; |
| 66 void OnError(int error) override; | 65 void OnError(int error) override; |
| 67 bool HasSendHeadersComplete() override; | 66 bool HasSendHeadersComplete() override; |
| 68 | 67 |
| 69 // QuicChromiumClientSession::Observer implementation: | |
| 70 void OnCryptoHandshakeConfirmed() override; | |
| 71 void OnSuccessfulVersionNegotiation(const QuicVersion& version) override; | |
| 72 void OnSessionClosed(int error, bool port_migration_detected) override; | |
| 73 | |
| 74 void OnStreamReady(int rv); | 68 void OnStreamReady(int rv); |
| 75 void OnSendDataComplete(int rv); | 69 void OnSendDataComplete(int rv); |
| 76 void OnReadDataComplete(int rv); | 70 void OnReadDataComplete(int rv); |
| 77 | 71 |
| 78 // Notifies the delegate of an error. | 72 // Notifies the delegate of an error. |
| 79 void NotifyError(int error); | 73 void NotifyError(int error); |
| 80 // Notifies the delegate that the stream is ready. | 74 // Notifies the delegate that the stream is ready. |
| 81 void NotifyStreamReady(); | 75 void NotifyStreamReady(); |
| 82 // Resets the stream and ensures that |delegate_| won't be called back. | 76 // Resets the stream and ensures that |delegate_| won't be called back. |
| 83 void ResetStream(); | 77 void ResetStream(); |
| 84 | 78 |
| 85 base::WeakPtr<QuicChromiumClientSession> session_; | 79 QuicChromiumClientSession::Handle session_; |
|
xunjieli
2017/05/04 16:54:42
nit: can this be a const member?
Ryan Hamilton
2017/05/05 03:50:24
If it were const then I couldn't call non-const me
| |
| 86 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | |
| 87 std::unique_ptr<QuicChromiumClientSession::StreamRequest> stream_request_; | 80 std::unique_ptr<QuicChromiumClientSession::StreamRequest> stream_request_; |
| 88 QuicChromiumClientStream* stream_; // Non-owning. | 81 QuicChromiumClientStream* stream_; // Non-owning. |
| 89 | 82 |
| 90 const BidirectionalStreamRequestInfo* request_info_; | 83 const BidirectionalStreamRequestInfo* request_info_; |
| 91 BidirectionalStreamImpl::Delegate* delegate_; | 84 BidirectionalStreamImpl::Delegate* delegate_; |
| 92 // Saves the response status if the stream is explicitly closed via OnError | 85 // Saves the response status if the stream is explicitly closed via OnError |
| 93 // or OnClose with an error. Once all buffered data has been returned, this | 86 // or OnClose with an error. Once all buffered data has been returned, this |
| 94 // will be used as the final response. | 87 // will be used as the final response. |
| 95 int response_status_; | 88 int response_status_; |
| 96 | 89 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 bool send_request_headers_automatically_; | 123 bool send_request_headers_automatically_; |
| 131 | 124 |
| 132 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; | 125 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; |
| 133 | 126 |
| 134 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); | 127 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); |
| 135 }; | 128 }; |
| 136 | 129 |
| 137 } // namespace net | 130 } // namespace net |
| 138 | 131 |
| 139 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 132 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| OLD | NEW |