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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 return create(context, url, protocols, exceptionState); | 253 return create(context, url, protocols, exceptionState); |
254 } | 254 } |
255 | 255 |
256 DOMWebSocket* DOMWebSocket::create(ExecutionContext* context, const String& url,
const Vector<String>& protocols, ExceptionState& exceptionState) | 256 DOMWebSocket* DOMWebSocket::create(ExecutionContext* context, const String& url,
const Vector<String>& protocols, ExceptionState& exceptionState) |
257 { | 257 { |
258 if (url.isNull()) { | 258 if (url.isNull()) { |
259 exceptionState.throwDOMException(SyntaxError, "Failed to create a WebSoc
ket: the provided URL is invalid."); | 259 exceptionState.throwDOMException(SyntaxError, "Failed to create a WebSoc
ket: the provided URL is invalid."); |
260 return nullptr; | 260 return nullptr; |
261 } | 261 } |
262 | 262 |
263 DOMWebSocket* webSocket(adoptRefCountedGarbageCollectedWillBeNoop(new DOMWeb
Socket(context))); | 263 DOMWebSocket* webSocket = new DOMWebSocket(context); |
264 webSocket->suspendIfNeeded(); | 264 webSocket->suspendIfNeeded(); |
265 | 265 |
266 webSocket->connect(url, protocols, exceptionState); | 266 webSocket->connect(url, protocols, exceptionState); |
267 if (exceptionState.hadException()) | 267 if (exceptionState.hadException()) |
268 return nullptr; | 268 return nullptr; |
269 | 269 |
270 return webSocket; | 270 return webSocket; |
271 } | 271 } |
272 | 272 |
273 DOMWebSocket* DOMWebSocket::create(ExecutionContext* context, const String& url,
const String& protocol, ExceptionState& exceptionState) | 273 DOMWebSocket* DOMWebSocket::create(ExecutionContext* context, const String& url,
const String& protocol, ExceptionState& exceptionState) |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 688 |
689 void DOMWebSocket::trace(Visitor* visitor) | 689 void DOMWebSocket::trace(Visitor* visitor) |
690 { | 690 { |
691 visitor->trace(m_channel); | 691 visitor->trace(m_channel); |
692 visitor->trace(m_eventQueue); | 692 visitor->trace(m_eventQueue); |
693 WebSocketChannelClient::trace(visitor); | 693 WebSocketChannelClient::trace(visitor); |
694 EventTargetWithInlineData::trace(visitor); | 694 EventTargetWithInlineData::trace(visitor); |
695 } | 695 } |
696 | 696 |
697 } // namespace blink | 697 } // namespace blink |
OLD | NEW |