OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 scoped_ptr<WebSocketFrame> frame) WARN_UNUSED_RESULT; | 193 scoped_ptr<WebSocketFrame> frame) WARN_UNUSED_RESULT; |
194 | 194 |
195 // Handles a frame that the object has received enough of to process. May call | 195 // Handles a frame that the object has received enough of to process. May call |
196 // |event_interface_| methods, send responses to the server, and change the | 196 // |event_interface_| methods, send responses to the server, and change the |
197 // value of |state_|. | 197 // value of |state_|. |
198 ChannelState HandleFrame(const WebSocketFrameHeader::OpCode opcode, | 198 ChannelState HandleFrame(const WebSocketFrameHeader::OpCode opcode, |
199 bool final, | 199 bool final, |
200 const scoped_refptr<IOBuffer>& data_buffer, | 200 const scoped_refptr<IOBuffer>& data_buffer, |
201 size_t size) WARN_UNUSED_RESULT; | 201 size_t size) WARN_UNUSED_RESULT; |
202 | 202 |
203 // Forward a received data frame to the renderer, if connected. If | |
204 // |expecting_continuation| is not equal to |expecting_to_read_continuation_|, | |
205 // will fail the channel. Also checks the UTF-8 validity of text frames. | |
206 ChannelState HandleDataFrame(const WebSocketFrameHeader::OpCode opcode, | |
207 bool final, | |
208 const scoped_refptr<IOBuffer>& data_buffer, | |
209 size_t size, | |
210 bool expecting_continuation); | |
211 | |
203 // Low-level method to send a single frame. Used for both data and control | 212 // Low-level method to send a single frame. Used for both data and control |
204 // frames. Either sends the frame immediately or buffers it to be scheduled | 213 // frames. Either sends the frame immediately or buffers it to be scheduled |
205 // when the current write finishes. |fin| and |op_code| are defined as for | 214 // when the current write finishes. |fin| and |op_code| are defined as for |
206 // SendFrame() above, except that |op_code| may also be a control frame | 215 // SendFrame() above, except that |op_code| may also be a control frame |
207 // opcode. | 216 // opcode. |
208 ChannelState SendIOBuffer(bool fin, | 217 ChannelState SendIOBuffer(bool fin, |
209 WebSocketFrameHeader::OpCode op_code, | 218 WebSocketFrameHeader::OpCode op_code, |
210 const scoped_refptr<IOBuffer>& buffer, | 219 const scoped_refptr<IOBuffer>& buffer, |
211 size_t size) WARN_UNUSED_RESULT; | 220 size_t size) WARN_UNUSED_RESULT; |
212 | 221 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 scoped_ptr<HandshakeNotificationSender> notification_sender_; | 321 scoped_ptr<HandshakeNotificationSender> notification_sender_; |
313 | 322 |
314 // UTF-8 validator for outgoing Text messages. | 323 // UTF-8 validator for outgoing Text messages. |
315 base::StreamingUtf8Validator outgoing_utf8_validator_; | 324 base::StreamingUtf8Validator outgoing_utf8_validator_; |
316 bool sending_text_message_; | 325 bool sending_text_message_; |
317 | 326 |
318 // UTF-8 validator for incoming Text messages. | 327 // UTF-8 validator for incoming Text messages. |
319 base::StreamingUtf8Validator incoming_utf8_validator_; | 328 base::StreamingUtf8Validator incoming_utf8_validator_; |
320 bool receiving_text_message_; | 329 bool receiving_text_message_; |
321 | 330 |
331 // True if we are in the middle of receiving a message. | |
332 bool expecting_to_read_continuation_; | |
tyoshino (SeeGerritForStatus)
2014/02/18 06:24:12
In this class, "Read" is used for receiving data f
Adam Rice
2014/02/18 11:12:43
Done.
| |
333 | |
322 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); | 334 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); |
323 }; | 335 }; |
324 | 336 |
325 } // namespace net | 337 } // namespace net |
326 | 338 |
327 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 339 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
OLD | NEW |