| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ | 5 #ifndef NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ |
| 6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ | 6 #define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 int SendRequestHeadersHelper(); | 73 int SendRequestHeadersHelper(); |
| 74 void OnStreamInitialized(int rv); | 74 void OnStreamInitialized(int rv); |
| 75 // Notifies delegate of an error. | 75 // Notifies delegate of an error. |
| 76 void NotifyError(int rv); | 76 void NotifyError(int rv); |
| 77 void ResetStream(); | 77 void ResetStream(); |
| 78 void ScheduleBufferedRead(); | 78 void ScheduleBufferedRead(); |
| 79 void DoBufferedRead(); | 79 void DoBufferedRead(); |
| 80 bool ShouldWaitForMoreBufferedData() const; | 80 bool ShouldWaitForMoreBufferedData() const; |
| 81 // Handles the case where stream is closed when SendData()/SendvData() is |
| 82 // called. Return true if stream is closed. |
| 83 bool MaybeHandleStreamClosedInSendData(); |
| 81 | 84 |
| 82 const base::WeakPtr<SpdySession> spdy_session_; | 85 const base::WeakPtr<SpdySession> spdy_session_; |
| 83 const BidirectionalStreamRequestInfo* request_info_; | 86 const BidirectionalStreamRequestInfo* request_info_; |
| 84 BidirectionalStreamImpl::Delegate* delegate_; | 87 BidirectionalStreamImpl::Delegate* delegate_; |
| 85 std::unique_ptr<base::Timer> timer_; | 88 std::unique_ptr<base::Timer> timer_; |
| 86 SpdyStreamRequest stream_request_; | 89 SpdyStreamRequest stream_request_; |
| 87 base::WeakPtr<SpdyStream> stream_; | 90 base::WeakPtr<SpdyStream> stream_; |
| 88 | 91 |
| 89 NextProto negotiated_protocol_; | 92 NextProto negotiated_protocol_; |
| 90 | 93 |
| 91 // Buffers the data as it arrives asynchronously from the stream. | 94 // Buffers the data as it arrives asynchronously from the stream. |
| 92 SpdyReadQueue read_data_queue_; | 95 SpdyReadQueue read_data_queue_; |
| 93 // Whether received more data has arrived since started waiting. | 96 // Whether received more data has arrived since started waiting. |
| 94 bool more_read_data_pending_; | 97 bool more_read_data_pending_; |
| 95 // User provided read buffer for ReadData() response. | 98 // User provided read buffer for ReadData() response. |
| 96 scoped_refptr<IOBuffer> read_buffer_; | 99 scoped_refptr<IOBuffer> read_buffer_; |
| 97 int read_buffer_len_; | 100 int read_buffer_len_; |
| 98 | 101 |
| 102 // Whether client has written the end of stream flag in request headers or |
| 103 // in SendData()/SendvData(). |
| 104 bool written_end_of_stream_; |
| 105 // Whether a SendData() or SendvData() is pending. |
| 106 bool write_pending_; |
| 107 |
| 99 // Whether OnClose has been invoked. | 108 // Whether OnClose has been invoked. |
| 100 bool stream_closed_; | 109 bool stream_closed_; |
| 101 // Status reported in OnClose. | 110 // Status reported in OnClose. |
| 102 int closed_stream_status_; | 111 int closed_stream_status_; |
| 103 // After |stream_| has been closed, this keeps track of the total number of | 112 // After |stream_| has been closed, this keeps track of the total number of |
| 104 // bytes received over the network for |stream_| while it was open. | 113 // bytes received over the network for |stream_| while it was open. |
| 105 int64_t closed_stream_received_bytes_; | 114 int64_t closed_stream_received_bytes_; |
| 106 // After |stream_| has been closed, this keeps track of the total number of | 115 // After |stream_| has been closed, this keeps track of the total number of |
| 107 // bytes sent over the network for |stream_| while it was open. | 116 // bytes sent over the network for |stream_| while it was open. |
| 108 int64_t closed_stream_sent_bytes_; | 117 int64_t closed_stream_sent_bytes_; |
| 109 // True if |stream_| has LoadTimingInfo when it is closed. | 118 // True if |stream_| has LoadTimingInfo when it is closed. |
| 110 bool closed_has_load_timing_info_; | 119 bool closed_has_load_timing_info_; |
| 111 // LoadTimingInfo populated when |stream_| is closed. | 120 // LoadTimingInfo populated when |stream_| is closed. |
| 112 LoadTimingInfo closed_load_timing_info_; | 121 LoadTimingInfo closed_load_timing_info_; |
| 113 | 122 |
| 114 // This is the combined buffer of buffers passed in through SendvData. | 123 // This is the combined buffer of buffers passed in through SendvData. |
| 115 // Keep a reference here so it is alive until OnDataSent is invoked. | 124 // Keep a reference here so it is alive until OnDataSent is invoked. |
| 116 scoped_refptr<IOBuffer> pending_combined_buffer_; | 125 scoped_refptr<IOBuffer> pending_combined_buffer_; |
| 117 | 126 |
| 118 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; | 127 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; |
| 119 | 128 |
| 120 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); | 129 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); |
| 121 }; | 130 }; |
| 122 | 131 |
| 123 } // namespace net | 132 } // namespace net |
| 124 | 133 |
| 125 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ | 134 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ |
| OLD | NEW |