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 bool WriteHeaders(); | 59 bool WriteHeaders(); |
65 void OnStreamReady(int rv); | 60 void OnStreamReady(int rv); |
66 void OnSendDataComplete(int rv); | 61 void OnSendDataComplete(int rv); |
67 void ReadInitialHeaders(); | 62 void ReadInitialHeaders(); |
68 void OnReadInitialHeadersComplete(int rv); | 63 void OnReadInitialHeadersComplete(int rv); |
69 void ReadTrailingHeaders(); | 64 void ReadTrailingHeaders(); |
70 void OnReadTrailingHeadersComplete(int rv); | 65 void OnReadTrailingHeadersComplete(int rv); |
71 void OnReadDataComplete(int rv); | 66 void OnReadDataComplete(int rv); |
72 | 67 |
73 // Notifies the delegate of an error. | 68 // Notifies the delegate of an error. |
(...skipping 13 matching lines...) Expand all Loading... |
87 // will be used as the final response. | 82 // will be used as the final response. |
88 int response_status_; | 83 int response_status_; |
89 | 84 |
90 // The protocol that is negotiated. | 85 // The protocol that is negotiated. |
91 NextProto negotiated_protocol_; | 86 NextProto negotiated_protocol_; |
92 // Connect timing information for this stream. Populated when headers are | 87 // Connect timing information for this stream. Populated when headers are |
93 // received. | 88 // received. |
94 LoadTimingInfo::ConnectTiming connect_timing_; | 89 LoadTimingInfo::ConnectTiming connect_timing_; |
95 | 90 |
96 SpdyHeaderBlock initial_headers_; | 91 SpdyHeaderBlock initial_headers_; |
| 92 bool expect_trailers_; // True if trailers are expected to arrive. |
97 SpdyHeaderBlock trailing_headers_; | 93 SpdyHeaderBlock trailing_headers_; |
98 | 94 |
99 // User provided read buffer for ReadData() response. | 95 // User provided read buffer for ReadData() response. |
100 scoped_refptr<IOBuffer> read_buffer_; | 96 scoped_refptr<IOBuffer> read_buffer_; |
101 int read_buffer_len_; | 97 int read_buffer_len_; |
102 | 98 |
103 // Number of bytes received by the headers stream on behalf of this stream. | 99 // Number of bytes received by the headers stream on behalf of this stream. |
104 int64_t headers_bytes_received_; | 100 int64_t headers_bytes_received_; |
105 // Number of bytes sent by the headers stream on behalf of this stream. | 101 // Number of bytes sent by the headers stream on behalf of this stream. |
106 int64_t headers_bytes_sent_; | 102 int64_t headers_bytes_sent_; |
(...skipping 17 matching lines...) Expand all Loading... |
124 bool send_request_headers_automatically_; | 120 bool send_request_headers_automatically_; |
125 | 121 |
126 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; | 122 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; |
127 | 123 |
128 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); | 124 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); |
129 }; | 125 }; |
130 | 126 |
131 } // namespace net | 127 } // namespace net |
132 | 128 |
133 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 129 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
OLD | NEW |