| 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 |
| 203 // Low-level method to send a single frame. Used for both data and control | 211 // 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 | 212 // 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 | 213 // 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 | 214 // SendFrame() above, except that |op_code| may also be a control frame |
| 207 // opcode. | 215 // opcode. |
| 208 ChannelState SendIOBuffer(bool fin, | 216 ChannelState SendIOBuffer(bool fin, |
| 209 WebSocketFrameHeader::OpCode op_code, | 217 WebSocketFrameHeader::OpCode op_code, |
| 210 const scoped_refptr<IOBuffer>& buffer, | 218 const scoped_refptr<IOBuffer>& buffer, |
| 211 size_t size) WARN_UNUSED_RESULT; | 219 size_t size) WARN_UNUSED_RESULT; |
| 212 | 220 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 scoped_ptr<HandshakeNotificationSender> notification_sender_; | 320 scoped_ptr<HandshakeNotificationSender> notification_sender_; |
| 313 | 321 |
| 314 // UTF-8 validator for outgoing Text messages. | 322 // UTF-8 validator for outgoing Text messages. |
| 315 base::StreamingUtf8Validator outgoing_utf8_validator_; | 323 base::StreamingUtf8Validator outgoing_utf8_validator_; |
| 316 bool sending_text_message_; | 324 bool sending_text_message_; |
| 317 | 325 |
| 318 // UTF-8 validator for incoming Text messages. | 326 // UTF-8 validator for incoming Text messages. |
| 319 base::StreamingUtf8Validator incoming_utf8_validator_; | 327 base::StreamingUtf8Validator incoming_utf8_validator_; |
| 320 bool receiving_text_message_; | 328 bool receiving_text_message_; |
| 321 | 329 |
| 330 // True if we are in the middle of receiving a message. |
| 331 bool expecting_to_handle_continuation_; |
| 332 |
| 322 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); | 333 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); |
| 323 }; | 334 }; |
| 324 | 335 |
| 325 } // namespace net | 336 } // namespace net |
| 326 | 337 |
| 327 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 338 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| OLD | NEW |