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 11 matching lines...) Expand all Loading... | |
| 22 namespace base { | 22 namespace base { |
| 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 { | |
| 34 public: | 33 public: |
| 35 explicit BidirectionalStreamQuicImpl( | 34 explicit BidirectionalStreamQuicImpl( |
| 36 std::unique_ptr<QuicChromiumClientSession::Handle> session); | 35 std::unique_ptr<QuicChromiumClientSession::Handle> session); |
| 37 | 36 |
| 38 ~BidirectionalStreamQuicImpl() override; | 37 ~BidirectionalStreamQuicImpl() override; |
| 39 | 38 |
| 40 // BidirectionalStreamImpl implementation: | 39 // BidirectionalStreamImpl implementation: |
| 41 void Start(const BidirectionalStreamRequestInfo* request_info, | 40 void Start(const BidirectionalStreamRequestInfo* request_info, |
| 42 const NetLogWithSource& net_log, | 41 const NetLogWithSource& net_log, |
| 43 bool send_request_headers_automatically, | 42 bool send_request_headers_automatically, |
| 44 BidirectionalStreamImpl::Delegate* delegate, | 43 BidirectionalStreamImpl::Delegate* delegate, |
| 45 std::unique_ptr<base::Timer> timer) override; | 44 std::unique_ptr<base::Timer> timer) override; |
| 46 void SendRequestHeaders() override; | 45 void SendRequestHeaders() override; |
| 47 int ReadData(IOBuffer* buffer, int buffer_len) override; | 46 int ReadData(IOBuffer* buffer, int buffer_len) override; |
| 48 void SendData(const scoped_refptr<IOBuffer>& data, | 47 void SendData(const scoped_refptr<IOBuffer>& data, |
| 49 int length, | 48 int length, |
| 50 bool end_stream) override; | 49 bool end_stream) override; |
| 51 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, | 50 void SendvData(const std::vector<scoped_refptr<IOBuffer>>& buffers, |
| 52 const std::vector<int>& lengths, | 51 const std::vector<int>& lengths, |
| 53 bool end_stream) override; | 52 bool end_stream) override; |
| 54 NextProto GetProtocol() const override; | 53 NextProto GetProtocol() const override; |
| 55 int64_t GetTotalReceivedBytes() const override; | 54 int64_t GetTotalReceivedBytes() const override; |
| 56 int64_t GetTotalSentBytes() const override; | 55 int64_t GetTotalSentBytes() const override; |
| 57 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | 56 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
| 58 | 57 |
| 59 private: | 58 private: |
| 60 // QuicChromiumClientStream::Delegate implementation: | |
| 61 void OnClose() override; | |
| 62 void OnError(int error) override; | |
| 63 | |
| 64 void OnStreamReady(int rv); | 59 void OnStreamReady(int rv); |
| 65 void OnSendDataComplete(int rv); | 60 void OnSendDataComplete(int rv); |
| 66 void OnReadInitialHeadersComplete(int rv); | 61 void OnReadInitialHeadersComplete(int rv); |
| 67 void ReadTrailingHeaders(); | 62 void ReadTrailingHeaders(); |
| 68 void OnReadTrailingHeadersComplete(int rv); | 63 void OnReadTrailingHeadersComplete(int rv); |
| 69 void OnReadDataComplete(int rv); | 64 void OnReadDataComplete(int rv); |
| 70 | 65 |
| 71 // Notifies the delegate of an error. | 66 // Notifies the delegate of an error. |
| 72 void NotifyError(int error); | 67 void NotifyError(int error); |
| 73 // Notifies the delegate that the stream is ready. | 68 // Notifies the delegate that the stream is ready. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 85 // will be used as the final response. | 80 // will be used as the final response. |
| 86 int response_status_; | 81 int response_status_; |
| 87 | 82 |
| 88 // The protocol that is negotiated. | 83 // The protocol that is negotiated. |
| 89 NextProto negotiated_protocol_; | 84 NextProto negotiated_protocol_; |
| 90 // Connect timing information for this stream. Populated when headers are | 85 // Connect timing information for this stream. Populated when headers are |
| 91 // received. | 86 // received. |
| 92 LoadTimingInfo::ConnectTiming connect_timing_; | 87 LoadTimingInfo::ConnectTiming connect_timing_; |
| 93 | 88 |
| 94 SpdyHeaderBlock initial_headers_; | 89 SpdyHeaderBlock initial_headers_; |
| 90 bool expect_trailers_; | |
|
xunjieli
2017/05/31 00:25:22
Can you add a comment on what this bool does? It's
Ryan Hamilton
2017/05/31 02:49:55
Done.
| |
| 95 SpdyHeaderBlock trailing_headers_; | 91 SpdyHeaderBlock trailing_headers_; |
| 96 | 92 |
| 97 // User provided read buffer for ReadData() response. | 93 // User provided read buffer for ReadData() response. |
| 98 scoped_refptr<IOBuffer> read_buffer_; | 94 scoped_refptr<IOBuffer> read_buffer_; |
| 99 int read_buffer_len_; | 95 int read_buffer_len_; |
| 100 | 96 |
| 101 // Number of bytes received by the headers stream on behalf of this stream. | 97 // Number of bytes received by the headers stream on behalf of this stream. |
| 102 int64_t headers_bytes_received_; | 98 int64_t headers_bytes_received_; |
| 103 // Number of bytes sent by the headers stream on behalf of this stream. | 99 // Number of bytes sent by the headers stream on behalf of this stream. |
| 104 int64_t headers_bytes_sent_; | 100 int64_t headers_bytes_sent_; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 122 bool send_request_headers_automatically_; | 118 bool send_request_headers_automatically_; |
| 123 | 119 |
| 124 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; | 120 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; |
| 125 | 121 |
| 126 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); | 122 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); |
| 127 }; | 123 }; |
| 128 | 124 |
| 129 } // namespace net | 125 } // namespace net |
| 130 | 126 |
| 131 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 127 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| OLD | NEW |