| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void dispatchQueuedEvents(); | 156 void dispatchQueuedEvents(); |
| 157 void resumeTimerFired(Timer<EventQueue>*); | 157 void resumeTimerFired(Timer<EventQueue>*); |
| 158 | 158 |
| 159 State m_state; | 159 State m_state; |
| 160 EventTarget* m_target; | 160 EventTarget* m_target; |
| 161 // FIXME: oilpan: This should be HeapDeque once it's implemented. | 161 // FIXME: oilpan: This should be HeapDeque once it's implemented. |
| 162 Deque<RefPtrWillBePersistent<Event> > m_events; | 162 Deque<RefPtrWillBePersistent<Event> > m_events; |
| 163 Timer<EventQueue> m_resumeTimer; | 163 Timer<EventQueue> m_resumeTimer; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 enum WebSocketSendType { |
| 167 WebSocketSendTypeString, |
| 168 WebSocketSendTypeArrayBuffer, |
| 169 WebSocketSendTypeArrayBufferView, |
| 170 WebSocketSendTypeBlob, |
| 171 WebSocketSendTypeMax, |
| 172 }; |
| 173 |
| 166 explicit WebSocket(ExecutionContext*); | 174 explicit WebSocket(ExecutionContext*); |
| 167 | 175 |
| 168 // Adds a console message with JSMessageSource and ErrorMessageLevel. | 176 // Adds a console message with JSMessageSource and ErrorMessageLevel. |
| 169 void logError(const String& message); | 177 void logError(const String& message); |
| 170 | 178 |
| 171 // Handle the JavaScript close method call. close() methods on this class | 179 // Handle the JavaScript close method call. close() methods on this class |
| 172 // are just for determining if the optional code argument is supplied or | 180 // are just for determining if the optional code argument is supplied or |
| 173 // not. | 181 // not. |
| 174 void closeInternal(int, const String&, ExceptionState&); | 182 void closeInternal(int, const String&, ExceptionState&); |
| 175 | 183 |
| 176 size_t getFramingOverhead(size_t payloadSize); | 184 size_t getFramingOverhead(size_t payloadSize); |
| 177 | 185 |
| 178 // Checks the result of WebSocketChannel::send() method, and shows console | 186 // Checks the result of WebSocketChannel::send() method, and: |
| 179 // message and sets ec appropriately. | 187 // - shows console message |
| 180 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&); | 188 // - sets ExceptionState appropriately |
| 189 // - reports data for UMA. |
| 190 void handleSendResult(WebSocketChannel::SendResult, ExceptionState&, WebSock
etSendType); |
| 181 | 191 |
| 182 // Updates m_bufferedAmountAfterClose given the amount of data passed to | 192 // Updates m_bufferedAmountAfterClose given the amount of data passed to |
| 183 // send() method after the state changed to CLOSING or CLOSED. | 193 // send() method after the state changed to CLOSING or CLOSED. |
| 184 void updateBufferedAmountAfterClose(unsigned long); | 194 void updateBufferedAmountAfterClose(unsigned long); |
| 185 | 195 |
| 186 void releaseChannel(); | 196 void releaseChannel(); |
| 187 | 197 |
| 188 enum BinaryType { | 198 enum BinaryType { |
| 189 BinaryTypeBlob, | 199 BinaryTypeBlob, |
| 190 BinaryTypeArrayBuffer | 200 BinaryTypeArrayBuffer |
| 191 }; | 201 }; |
| 192 | 202 |
| 193 RefPtr<WebSocketChannel> m_channel; | 203 RefPtr<WebSocketChannel> m_channel; |
| 194 | 204 |
| 195 State m_state; | 205 State m_state; |
| 196 KURL m_url; | 206 KURL m_url; |
| 197 unsigned long m_bufferedAmount; | 207 unsigned long m_bufferedAmount; |
| 198 unsigned long m_bufferedAmountAfterClose; | 208 unsigned long m_bufferedAmountAfterClose; |
| 199 BinaryType m_binaryType; | 209 BinaryType m_binaryType; |
| 200 // The subprotocol the server selected. | 210 // The subprotocol the server selected. |
| 201 String m_subprotocol; | 211 String m_subprotocol; |
| 202 String m_extensions; | 212 String m_extensions; |
| 203 | 213 |
| 204 RefPtr<EventQueue> m_eventQueue; | 214 RefPtr<EventQueue> m_eventQueue; |
| 205 }; | 215 }; |
| 206 | 216 |
| 207 } // namespace WebCore | 217 } // namespace WebCore |
| 208 | 218 |
| 209 #endif // WebSocket_h | 219 #endif // WebSocket_h |
| OLD | NEW |