| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 NextProto GetProtocol() const override; | 54 NextProto GetProtocol() const override; |
| 55 int64_t GetTotalReceivedBytes() const override; | 55 int64_t GetTotalReceivedBytes() const override; |
| 56 int64_t GetTotalSentBytes() const override; | 56 int64_t GetTotalSentBytes() const override; |
| 57 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; | 57 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 // QuicChromiumClientStream::Delegate implementation: | 60 // QuicChromiumClientStream::Delegate implementation: |
| 61 void OnClose() override; | 61 void OnClose() override; |
| 62 void OnError(int error) override; | 62 void OnError(int error) override; |
| 63 | 63 |
| 64 // Write headers to the stream and returns true on success. Posts a task to |
| 65 // notify the delegate asynchronously and returns false on failure |
| 66 bool WriteHeaders(); |
| 67 |
| 64 void OnStreamReady(int rv); | 68 void OnStreamReady(int rv); |
| 65 void OnSendDataComplete(int rv); | 69 void OnSendDataComplete(int rv); |
| 66 void ReadInitialHeaders(); | 70 void ReadInitialHeaders(); |
| 67 void OnReadInitialHeadersComplete(int rv); | 71 void OnReadInitialHeadersComplete(int rv); |
| 68 void ReadTrailingHeaders(); | 72 void ReadTrailingHeaders(); |
| 69 void OnReadTrailingHeadersComplete(int rv); | 73 void OnReadTrailingHeadersComplete(int rv); |
| 70 void OnReadDataComplete(int rv); | 74 void OnReadDataComplete(int rv); |
| 71 | 75 |
| 72 // Notifies the delegate of an error. | 76 // Notifies the delegate of an error, clears |stream_| and |delegate_|, |
| 77 // and cancels any pending callbacks. |
| 73 void NotifyError(int error); | 78 void NotifyError(int error); |
| 79 // Notifies the delegate of an error, clears |stream_| and |delegate_|, |
| 80 // and cancels any pending callbacks. If |notify_delegate_later| is true |
| 81 // then the delegate will be notified asynchronously via a posted task, |
| 82 // otherwise the notification will be synchronous. |
| 83 void NotifyErrorImpl(int error, bool notify_delegate_later); |
| 74 // Notifies the delegate that the stream is ready. | 84 // Notifies the delegate that the stream is ready. |
| 75 void NotifyStreamReady(); | 85 void NotifyStreamReady(); |
| 76 // Resets the stream and ensures that |delegate_| won't be called back. | 86 // Resets the stream and ensures that |delegate_| won't be called back. |
| 77 void ResetStream(); | 87 void ResetStream(); |
| 88 // Invokes OnFailure(error) on |delegate|. |
| 89 void NotifyFailure(BidirectionalStreamImpl::Delegate* delegate, int error); |
| 78 | 90 |
| 79 const std::unique_ptr<QuicChromiumClientSession::Handle> session_; | 91 const std::unique_ptr<QuicChromiumClientSession::Handle> session_; |
| 80 std::unique_ptr<QuicChromiumClientStream::Handle> stream_; | 92 std::unique_ptr<QuicChromiumClientStream::Handle> stream_; |
| 81 | 93 |
| 82 const BidirectionalStreamRequestInfo* request_info_; | 94 const BidirectionalStreamRequestInfo* request_info_; |
| 83 BidirectionalStreamImpl::Delegate* delegate_; | 95 BidirectionalStreamImpl::Delegate* delegate_; |
| 84 // Saves the response status if the stream is explicitly closed via OnError | 96 // Saves the response status if the stream is explicitly closed via OnError |
| 85 // or OnClose with an error. Once all buffered data has been returned, this | 97 // or OnClose with an error. Once all buffered data has been returned, this |
| 86 // will be used as the final response. | 98 // will be used as the final response. |
| 87 int response_status_; | 99 int response_status_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 bool send_request_headers_automatically_; | 135 bool send_request_headers_automatically_; |
| 124 | 136 |
| 125 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; | 137 base::WeakPtrFactory<BidirectionalStreamQuicImpl> weak_factory_; |
| 126 | 138 |
| 127 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); | 139 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamQuicImpl); |
| 128 }; | 140 }; |
| 129 | 141 |
| 130 } // namespace net | 142 } // namespace net |
| 131 | 143 |
| 132 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ | 144 #endif // NET_QUIC_CHROMIUM_BIDIRECTIONAL_STREAM_QUIC_IMPL_H_ |
| OLD | NEW |