Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: net/spdy/bidirectional_stream_spdy_impl.h

Issue 2462463002: Make net::BidirectionalStream handle RST_STREAM_NO_ERROR (Closed)
Patch Set: Address comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override; 67 void OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) override;
68 void OnDataSent() override; 68 void OnDataSent() override;
69 void OnTrailers(const SpdyHeaderBlock& trailers) override; 69 void OnTrailers(const SpdyHeaderBlock& trailers) override;
70 void OnClose(int status) override; 70 void OnClose(int status) override;
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 NotifyDataSent();
77 void ResetStream(); 78 void ResetStream();
78 void ScheduleBufferedRead(); 79 void ScheduleBufferedRead();
79 void DoBufferedRead(); 80 void DoBufferedRead();
80 bool ShouldWaitForMoreBufferedData() const; 81 bool ShouldWaitForMoreBufferedData() const;
82 // Handles the case where stream is closed when SendData()/SendvData() is
83 // called. Return true if stream is closed.
84 bool MaybeHandleStreamClosedInSendData();
81 85
82 const base::WeakPtr<SpdySession> spdy_session_; 86 const base::WeakPtr<SpdySession> spdy_session_;
83 const BidirectionalStreamRequestInfo* request_info_; 87 const BidirectionalStreamRequestInfo* request_info_;
84 BidirectionalStreamImpl::Delegate* delegate_; 88 BidirectionalStreamImpl::Delegate* delegate_;
85 std::unique_ptr<base::Timer> timer_; 89 std::unique_ptr<base::Timer> timer_;
86 SpdyStreamRequest stream_request_; 90 SpdyStreamRequest stream_request_;
87 base::WeakPtr<SpdyStream> stream_; 91 base::WeakPtr<SpdyStream> stream_;
88 92
89 NextProto negotiated_protocol_; 93 NextProto negotiated_protocol_;
90 94
91 // Buffers the data as it arrives asynchronously from the stream. 95 // Buffers the data as it arrives asynchronously from the stream.
92 SpdyReadQueue read_data_queue_; 96 SpdyReadQueue read_data_queue_;
93 // Whether received more data has arrived since started waiting. 97 // Whether received more data has arrived since started waiting.
94 bool more_read_data_pending_; 98 bool more_read_data_pending_;
95 // User provided read buffer for ReadData() response. 99 // User provided read buffer for ReadData() response.
96 scoped_refptr<IOBuffer> read_buffer_; 100 scoped_refptr<IOBuffer> read_buffer_;
97 int read_buffer_len_; 101 int read_buffer_len_;
98 102
103 // Whether client has written the end of stream flag in request headers or
104 // in SendData()/SendvData().
105 bool written_end_of_stream_;
106 // Whether a SendData() or SendvData() is pending.
107 bool write_pending_;
108
99 // Whether OnClose has been invoked. 109 // Whether OnClose has been invoked.
100 bool stream_closed_; 110 bool stream_closed_;
101 // Status reported in OnClose. 111 // Status reported in OnClose.
102 int closed_stream_status_; 112 int closed_stream_status_;
103 // After |stream_| has been closed, this keeps track of the total number of 113 // 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. 114 // bytes received over the network for |stream_| while it was open.
105 int64_t closed_stream_received_bytes_; 115 int64_t closed_stream_received_bytes_;
106 // After |stream_| has been closed, this keeps track of the total number of 116 // 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. 117 // bytes sent over the network for |stream_| while it was open.
108 int64_t closed_stream_sent_bytes_; 118 int64_t closed_stream_sent_bytes_;
109 // True if |stream_| has LoadTimingInfo when it is closed. 119 // True if |stream_| has LoadTimingInfo when it is closed.
110 bool closed_has_load_timing_info_; 120 bool closed_has_load_timing_info_;
111 // LoadTimingInfo populated when |stream_| is closed. 121 // LoadTimingInfo populated when |stream_| is closed.
112 LoadTimingInfo closed_load_timing_info_; 122 LoadTimingInfo closed_load_timing_info_;
113 123
114 // This is the combined buffer of buffers passed in through SendvData. 124 // This is the combined buffer of buffers passed in through SendvData.
115 // Keep a reference here so it is alive until OnDataSent is invoked. 125 // Keep a reference here so it is alive until OnDataSent is invoked.
116 scoped_refptr<IOBuffer> pending_combined_buffer_; 126 scoped_refptr<IOBuffer> pending_combined_buffer_;
117 127
118 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; 128 base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_;
119 129
120 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); 130 DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl);
121 }; 131 };
122 132
123 } // namespace net 133 } // namespace net
124 134
125 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ 135 #endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/bidirectional_stream_spdy_impl.cc » ('j') | net/spdy/bidirectional_stream_spdy_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698