| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 void WebSocketImpl::fail(const WebString& reason) | 140 void WebSocketImpl::fail(const WebString& reason) |
| 141 { | 141 { |
| 142 m_private->fail(reason, ErrorMessageLevel, String(), 0); | 142 m_private->fail(reason, ErrorMessageLevel, String(), 0); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void WebSocketImpl::disconnect() | 145 void WebSocketImpl::disconnect() |
| 146 { | 146 { |
| 147 m_private->disconnect(); | 147 m_private->disconnect(); |
| 148 m_client = 0; | 148 m_client = nullptr; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void WebSocketImpl::didConnect(const String& subprotocol, const String& extensio
ns) | 151 void WebSocketImpl::didConnect(const String& subprotocol, const String& extensio
ns) |
| 152 { | 152 { |
| 153 m_client->didConnect(subprotocol, extensions); | 153 m_client->didConnect(subprotocol, extensions); |
| 154 | 154 |
| 155 // FIXME: Deprecate these statements. | 155 // FIXME: Deprecate these statements. |
| 156 m_subprotocol = subprotocol; | 156 m_subprotocol = subprotocol; |
| 157 m_extensions = extensions; | 157 m_extensions = extensions; |
| 158 m_client->didConnect(); | 158 m_client->didConnect(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void WebSocketImpl::didReceiveTextMessage(const String& payload) | 161 void WebSocketImpl::didReceiveTextMessage(const String& payload) |
| 162 { | 162 { |
| 163 m_client->didReceiveMessage(WebString(payload)); | 163 m_client->didReceiveMessage(WebString(payload)); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void WebSocketImpl::didReceiveBinaryMessage(PassOwnPtr<Vector<char> > payload) | 166 void WebSocketImpl::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> payload) |
| 167 { | 167 { |
| 168 switch (m_binaryType) { | 168 switch (m_binaryType) { |
| 169 case BinaryTypeBlob: | 169 case BinaryTypeBlob: |
| 170 // FIXME: Handle Blob after supporting WebBlob. | 170 // FIXME: Handle Blob after supporting WebBlob. |
| 171 break; | 171 break; |
| 172 case BinaryTypeArrayBuffer: | 172 case BinaryTypeArrayBuffer: |
| 173 m_client->didReceiveArrayBuffer(WebArrayBuffer(DOMArrayBuffer::create(pa
yload->data(), payload->size()))); | 173 m_client->didReceiveArrayBuffer(WebArrayBuffer(DOMArrayBuffer::create(pa
yload->data(), payload->size()))); |
| 174 break; | 174 break; |
| 175 } | 175 } |
| 176 } | 176 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 197 void WebSocketImpl::didClose(WebSocketChannelClient::ClosingHandshakeCompletionS
tatus status, unsigned short code, const String& reason) | 197 void WebSocketImpl::didClose(WebSocketChannelClient::ClosingHandshakeCompletionS
tatus status, unsigned short code, const String& reason) |
| 198 { | 198 { |
| 199 m_isClosingOrClosed = true; | 199 m_isClosingOrClosed = true; |
| 200 m_client->didClose(static_cast<WebSocketClient::ClosingHandshakeCompletionSt
atus>(status), code, WebString(reason)); | 200 m_client->didClose(static_cast<WebSocketClient::ClosingHandshakeCompletionSt
atus>(status), code, WebString(reason)); |
| 201 | 201 |
| 202 // FIXME: Deprecate this call. | 202 // FIXME: Deprecate this call. |
| 203 m_client->didClose(m_bufferedAmount - m_bufferedAmountAfterClose, static_cas
t<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(re
ason)); | 203 m_client->didClose(m_bufferedAmount - m_bufferedAmountAfterClose, static_cas
t<WebSocketClient::ClosingHandshakeCompletionStatus>(status), code, WebString(re
ason)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |