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

Side by Side Diff: webrtc/api/quicdatachannel.h

Issue 2146133002: Revert of Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months 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
« no previous file with comments | « no previous file | webrtc/api/quicdatachannel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Message stores buffered data from the incoming QUIC stream. The QUIC stream 81 // Message stores buffered data from the incoming QUIC stream. The QUIC stream
82 // is provided so that remaining data can be received from the remote peer. 82 // is provided so that remaining data can be received from the remote peer.
83 struct Message { 83 struct Message {
84 uint64_t id; 84 uint64_t id;
85 rtc::CopyOnWriteBuffer buffer; 85 rtc::CopyOnWriteBuffer buffer;
86 cricket::ReliableQuicStream* stream; 86 cricket::ReliableQuicStream* stream;
87 }; 87 };
88 88
89 QuicDataChannel(rtc::Thread* signaling_thread, 89 QuicDataChannel(rtc::Thread* signaling_thread,
90 rtc::Thread* worker_thread, 90 rtc::Thread* worker_thread,
91 rtc::Thread* network_thread,
92 const std::string& label, 91 const std::string& label,
93 const DataChannelInit& config); 92 const DataChannelInit& config);
94 ~QuicDataChannel() override; 93 ~QuicDataChannel() override;
95 94
96 // DataChannelInterface overrides. 95 // DataChannelInterface overrides.
97 std::string label() const override { return label_; } 96 std::string label() const override { return label_; }
98 bool reliable() const override { return true; } 97 bool reliable() const override { return true; }
99 bool ordered() const override { return false; } 98 bool ordered() const override { return false; }
100 uint16_t maxRetransmitTime() const override { return -1; } 99 uint16_t maxRetransmitTime() const override { return -1; }
101 uint16_t maxRetransmits() const override { return -1; } 100 uint16_t maxRetransmits() const override { return -1; }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void OnIncomingQueuedStreamClosed(net::QuicStreamId stream_id, int error); 148 void OnIncomingQueuedStreamClosed(net::QuicStreamId stream_id, int error);
150 // Called when a write blocked QUIC stream in |write_blocked_quic_streams_| 149 // Called when a write blocked QUIC stream in |write_blocked_quic_streams_|
151 // has written previously queued data. 150 // has written previously queued data.
152 void OnQueuedBytesWritten(net::QuicStreamId stream_id, 151 void OnQueuedBytesWritten(net::QuicStreamId stream_id,
153 uint64_t queued_bytes_written); 152 uint64_t queued_bytes_written);
154 153
155 // Callbacks from |quic_transport_channel_|. 154 // Callbacks from |quic_transport_channel_|.
156 void OnReadyToSend(cricket::TransportChannel* channel); 155 void OnReadyToSend(cricket::TransportChannel* channel);
157 void OnConnectionClosed(); 156 void OnConnectionClosed();
158 157
159 // Network thread methods. 158 // Worker thread methods.
160 // Sends the data buffer to the remote peer using an outgoing QUIC stream. 159 // Sends the data buffer to the remote peer using an outgoing QUIC stream.
161 // Returns true if the data buffer can be successfully sent, or if it is 160 // Returns true if the data buffer can be successfully sent, or if it is
162 // queued to be sent later. 161 // queued to be sent later.
163 bool Send_n(const DataBuffer& buffer); 162 bool Send_w(const DataBuffer& buffer);
164
165 // Worker thread methods.
166 // Connects the |quic_transport_channel_| signals to this QuicDataChannel, 163 // Connects the |quic_transport_channel_| signals to this QuicDataChannel,
167 // then returns the new QuicDataChannel state. 164 // then returns the new QuicDataChannel state.
168 DataState SetTransportChannel_w(); 165 DataState SetTransportChannel_w();
169 // Closes the QUIC streams associated with this QuicDataChannel. 166 // Closes the QUIC streams associated with this QuicDataChannel.
170 void Close_w(); 167 void Close_w();
171 // Sets |buffered_amount_|. 168 // Sets |buffered_amount_|.
172 void SetBufferedAmount_w(uint64_t buffered_amount); 169 void SetBufferedAmount_w(uint64_t buffered_amount);
173 170
174 // Signaling thread methods. 171 // Signaling thread methods.
175 // Triggers QuicDataChannelObserver::OnMessage when a message from the remote 172 // Triggers QuicDataChannelObserver::OnMessage when a message from the remote
176 // peer is ready to be read. 173 // peer is ready to be read.
177 void OnMessage_s(const DataBuffer& received_data); 174 void OnMessage_s(const DataBuffer& received_data);
178 // Triggers QuicDataChannel::OnStateChange if the state change is valid. 175 // Triggers QuicDataChannel::OnStateChange if the state change is valid.
179 // Otherwise does nothing if |state| == |state_| or |state| != kClosed when 176 // Otherwise does nothing if |state| == |state_| or |state| != kClosed when
180 // the data channel is closing. 177 // the data channel is closing.
181 void SetState_s(DataState state); 178 void SetState_s(DataState state);
182 // Triggers QuicDataChannelObserver::OnBufferedAmountChange when the total 179 // Triggers QuicDataChannelObserver::OnBufferedAmountChange when the total
183 // buffered data changes for a QUIC stream. 180 // buffered data changes for a QUIC stream.
184 void OnBufferedAmountChange_s(uint64_t buffered_amount); 181 void OnBufferedAmountChange_s(uint64_t buffered_amount);
185 182
186 // QUIC transport channel which owns the QUIC session. It is used to create 183 // QUIC transport channel which owns the QUIC session. It is used to create
187 // a QUIC stream for sending outgoing messages. 184 // a QUIC stream for sending outgoing messages.
188 cricket::QuicTransportChannel* quic_transport_channel_ = nullptr; 185 cricket::QuicTransportChannel* quic_transport_channel_ = nullptr;
189 // Signaling thread for DataChannelInterface methods. 186 // Signaling thread for DataChannelInterface methods.
190 rtc::Thread* const signaling_thread_; 187 rtc::Thread* const signaling_thread_;
191 // Worker thread for |quic_transport_channel_| callbacks. 188 // Worker thread for sending data and |quic_transport_channel_| callbacks.
192 rtc::Thread* const worker_thread_; 189 rtc::Thread* const worker_thread_;
193 // Network thread for sending data and |quic_transport_channel_| callbacks.
194 rtc::Thread* const network_thread_;
195 rtc::AsyncInvoker invoker_; 190 rtc::AsyncInvoker invoker_;
196 // Map of QUIC stream ID => ReliableQuicStream* for write blocked QUIC 191 // Map of QUIC stream ID => ReliableQuicStream* for write blocked QUIC
197 // streams. 192 // streams.
198 std::unordered_map<net::QuicStreamId, cricket::ReliableQuicStream*> 193 std::unordered_map<net::QuicStreamId, cricket::ReliableQuicStream*>
199 write_blocked_quic_streams_; 194 write_blocked_quic_streams_;
200 // Map of QUIC stream ID => Message for each incoming QUIC stream. 195 // Map of QUIC stream ID => Message for each incoming QUIC stream.
201 std::unordered_map<net::QuicStreamId, Message> incoming_quic_messages_; 196 std::unordered_map<net::QuicStreamId, Message> incoming_quic_messages_;
202 // Handles received data from the remote peer and data channel state changes. 197 // Handles received data from the remote peer and data channel state changes.
203 DataChannelObserver* observer_ = nullptr; 198 DataChannelObserver* observer_ = nullptr;
204 // QuicDataChannel ID. 199 // QuicDataChannel ID.
205 int id_; 200 int id_;
206 // Connectivity state of the QuicDataChannel. 201 // Connectivity state of the QuicDataChannel.
207 DataState state_; 202 DataState state_;
208 // Total bytes that are buffered among the QUIC streams. 203 // Total bytes that are buffered among the QUIC streams.
209 uint64_t buffered_amount_; 204 uint64_t buffered_amount_;
210 // Counter for number of sent messages that is used for message IDs. 205 // Counter for number of sent messages that is used for message IDs.
211 uint64_t next_message_id_; 206 uint64_t next_message_id_;
212 207
213 // Variables for application use. 208 // Variables for application use.
214 const std::string& label_; 209 const std::string& label_;
215 const std::string& protocol_; 210 const std::string& protocol_;
216 }; 211 };
217 212
218 } // namespace webrtc 213 } // namespace webrtc
219 214
220 #endif // WEBRTC_API_QUICDATACHANNEL_H_ 215 #endif // WEBRTC_API_QUICDATACHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/quicdatachannel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698