| 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_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 5 #ifndef NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| 6 #define NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 6 #define NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "net/http/bidirectional_stream_job.h" | 13 #include "net/http/bidirectional_stream_impl.h" |
| 14 #include "net/quic/quic_chromium_client_session.h" | 14 #include "net/quic/quic_chromium_client_session.h" |
| 15 #include "net/quic/quic_chromium_client_stream.h" | 15 #include "net/quic/quic_chromium_client_stream.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class Timer; | 18 class Timer; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 struct BidirectionalStreamRequestInfo; | 23 struct BidirectionalStreamRequestInfo; |
| 24 class BoundNetLog; | 24 class BoundNetLog; |
| 25 class IOBuffer; | 25 class IOBuffer; |
| 26 class SpdyHeaderBlock; | 26 class SpdyHeaderBlock; |
| 27 | 27 |
| 28 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl | 28 class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl |
| 29 : public BidirectionalStreamJob, | 29 : public BidirectionalStreamImpl, |
| 30 public QuicChromiumClientStream::Delegate, | 30 public QuicChromiumClientStream::Delegate, |
| 31 public QuicChromiumClientSession::Observer { | 31 public QuicChromiumClientSession::Observer { |
| 32 public: | 32 public: |
| 33 explicit BidirectionalStreamQuicImpl( | 33 explicit BidirectionalStreamQuicImpl( |
| 34 const base::WeakPtr<QuicChromiumClientSession>& session); | 34 const base::WeakPtr<QuicChromiumClientSession>& session); |
| 35 | 35 |
| 36 ~BidirectionalStreamQuicImpl() override; | 36 ~BidirectionalStreamQuicImpl() override; |
| 37 | 37 |
| 38 // BidirectionalStreamJob implementation: | 38 // BidirectionalStreamImpl implementation: |
| 39 void Start(const BidirectionalStreamRequestInfo* request_info, | 39 void Start(const BidirectionalStreamRequestInfo* request_info, |
| 40 const BoundNetLog& net_log, | 40 const BoundNetLog& net_log, |
| 41 BidirectionalStreamJob::Delegate* delegate, | 41 BidirectionalStreamImpl::Delegate* delegate, |
| 42 scoped_ptr<base::Timer> timer) override; | 42 scoped_ptr<base::Timer> timer) override; |
| 43 int ReadData(IOBuffer* buffer, int buffer_len) override; | 43 int ReadData(IOBuffer* buffer, int buffer_len) override; |
| 44 void SendData(IOBuffer* data, int length, bool end_stream) override; | 44 void SendData(IOBuffer* data, int length, bool end_stream) override; |
| 45 void Cancel() override; | 45 void Cancel() override; |
| 46 NextProto GetProtocol() const override; | 46 NextProto GetProtocol() const override; |
| 47 int64_t GetTotalReceivedBytes() const override; | 47 int64_t GetTotalReceivedBytes() const override; |
| 48 int64_t GetTotalSentBytes() const override; | 48 int64_t GetTotalSentBytes() const override; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // QuicChromiumClientStream::Delegate implementation: | 51 // QuicChromiumClientStream::Delegate implementation: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 void NotifyError(int error); | 70 void NotifyError(int error); |
| 71 // Resets the stream and ensures that |delegate_| won't be called back. | 71 // Resets the stream and ensures that |delegate_| won't be called back. |
| 72 void ResetStream(); | 72 void ResetStream(); |
| 73 | 73 |
| 74 base::WeakPtr<QuicChromiumClientSession> session_; | 74 base::WeakPtr<QuicChromiumClientSession> session_; |
| 75 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. | 75 bool was_handshake_confirmed_; // True if the crypto handshake succeeded. |
| 76 QuicChromiumClientSession::StreamRequest stream_request_; | 76 QuicChromiumClientSession::StreamRequest stream_request_; |
| 77 QuicChromiumClientStream* stream_; // Non-owning. | 77 QuicChromiumClientStream* stream_; // Non-owning. |
| 78 | 78 |
| 79 const BidirectionalStreamRequestInfo* request_info_; | 79 const BidirectionalStreamRequestInfo* request_info_; |
| 80 BidirectionalStreamJob::Delegate* delegate_; | 80 BidirectionalStreamImpl::Delegate* delegate_; |
| 81 // Saves the response status if the stream is explicitly closed via OnError | 81 // Saves the response status if the stream is explicitly closed via OnError |
| 82 // or OnClose with an error. Once all buffered data has been returned, this | 82 // or OnClose with an error. Once all buffered data has been returned, this |
| 83 // will be used as the final response. | 83 // will be used as the final response. |
| 84 int response_status_; | 84 int response_status_; |
| 85 | 85 |
| 86 // The protocol that is negotiated. | 86 // The protocol that is negotiated. |
| 87 NextProto negotiated_protocol_; | 87 NextProto negotiated_protocol_; |
| 88 // User provided read buffer for ReadData() response. | 88 // User provided read buffer for ReadData() response. |
| 89 scoped_refptr<IOBuffer> read_buffer_; | 89 scoped_refptr<IOBuffer> read_buffer_; |
| 90 int read_buffer_len_; | 90 int read_buffer_len_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 105 bool has_received_headers_; | 105 bool has_received_headers_; |
| 106 | 106 |
| 107 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; | 107 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); | 109 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 } // namespace net | 112 } // namespace net |
| 113 | 113 |
| 114 #endif // NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 114 #endif // NET_QUIC_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| OLD | NEW |