OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "core/dom/MessageEvent.h" | 31 #include "core/dom/MessageEvent.h" |
32 #include "core/dom/ScriptExecutionContext.h" | 32 #include "core/dom/ScriptExecutionContext.h" |
33 #include "core/fileapi/Blob.h" | 33 #include "core/fileapi/Blob.h" |
34 #include "core/platform/mediastream/RTCDataChannelHandler.h" | 34 #include "core/platform/mediastream/RTCDataChannelHandler.h" |
35 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" | 35 #include "core/platform/mediastream/RTCPeerConnectionHandler.h" |
36 #include "wtf/ArrayBuffer.h" | 36 #include "wtf/ArrayBuffer.h" |
37 #include "wtf/ArrayBufferView.h" | 37 #include "wtf/ArrayBufferView.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 PassRefPtr<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext* contex
t, RTCPeerConnectionHandler* peerConnectionHandler, const String& label, bool re
liable, ExceptionCode& ec) | 41 PassRefPtr<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext* contex
t, PassOwnPtr<RTCDataChannelHandler> handler) |
42 { | 42 { |
43 OwnPtr<RTCDataChannelHandler> handler = peerConnectionHandler->createDataCha
nnel(label, reliable); | 43 ASSERT(handler); |
| 44 return adoptRef(new RTCDataChannel(context, handler)); |
| 45 } |
| 46 |
| 47 PassRefPtr<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext* contex
t, RTCPeerConnectionHandler* peerConnectionHandler, const String& label, const W
ebKit::WebRTCDataChannelInit& init, ExceptionCode& ec) |
| 48 { |
| 49 OwnPtr<RTCDataChannelHandler> handler = peerConnectionHandler->createDataCha
nnel(label, init); |
44 if (!handler) { | 50 if (!handler) { |
45 ec = NOT_SUPPORTED_ERR; | 51 ec = NOT_SUPPORTED_ERR; |
46 return 0; | 52 return 0; |
47 } | 53 } |
48 return adoptRef(new RTCDataChannel(context, handler.release())); | 54 return adoptRef(new RTCDataChannel(context, handler.release())); |
49 } | 55 } |
50 | 56 |
51 PassRefPtr<RTCDataChannel> RTCDataChannel::create(ScriptExecutionContext* contex
t, PassOwnPtr<RTCDataChannelHandler> handler) | |
52 { | |
53 ASSERT(handler); | |
54 return adoptRef(new RTCDataChannel(context, handler)); | |
55 } | |
56 | |
57 RTCDataChannel::RTCDataChannel(ScriptExecutionContext* context, PassOwnPtr<RTCDa
taChannelHandler> handler) | 57 RTCDataChannel::RTCDataChannel(ScriptExecutionContext* context, PassOwnPtr<RTCDa
taChannelHandler> handler) |
58 : m_scriptExecutionContext(context) | 58 : m_scriptExecutionContext(context) |
59 , m_handler(handler) | 59 , m_handler(handler) |
60 , m_stopped(false) | 60 , m_stopped(false) |
61 , m_readyState(ReadyStateConnecting) | 61 , m_readyState(ReadyStateConnecting) |
62 , m_binaryType(BinaryTypeArrayBuffer) | 62 , m_binaryType(BinaryTypeArrayBuffer) |
63 , m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired) | 63 , m_scheduledEventTimer(this, &RTCDataChannel::scheduledEventTimerFired) |
64 { | 64 { |
65 ScriptWrappable::init(this); | 65 ScriptWrappable::init(this); |
66 m_handler->setClient(this); | 66 m_handler->setClient(this); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 events.swap(m_scheduledEvents); | 274 events.swap(m_scheduledEvents); |
275 | 275 |
276 Vector<RefPtr<Event> >::iterator it = events.begin(); | 276 Vector<RefPtr<Event> >::iterator it = events.begin(); |
277 for (; it != events.end(); ++it) | 277 for (; it != events.end(); ++it) |
278 dispatchEvent((*it).release()); | 278 dispatchEvent((*it).release()); |
279 | 279 |
280 events.clear(); | 280 events.clear(); |
281 } | 281 } |
282 | 282 |
283 } // namespace WebCore | 283 } // namespace WebCore |
OLD | NEW |