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 25 matching lines...) Expand all Loading... |
36 namespace blink { | 36 namespace blink { |
37 class WebRTCDataChannelHandler; | 37 class WebRTCDataChannelHandler; |
38 class WebRTCPeerConnectionHandler; | 38 class WebRTCPeerConnectionHandler; |
39 struct WebRTCDataChannelInit; | 39 struct WebRTCDataChannelInit; |
40 } | 40 } |
41 | 41 |
42 namespace WebCore { | 42 namespace WebCore { |
43 | 43 |
44 class Blob; | 44 class Blob; |
45 class ExceptionState; | 45 class ExceptionState; |
| 46 class RTCPeerConnection; |
46 | 47 |
47 class RTCDataChannel FINAL : public RefCountedWillBeRefCountedGarbageCollected<R
TCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public
blink::WebRTCDataChannelHandlerClient { | 48 class RTCDataChannel FINAL : public RefCountedWillBeRefCountedGarbageCollected<R
TCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public
blink::WebRTCDataChannelHandlerClient { |
48 REFCOUNTED_EVENT_TARGET(RTCDataChannel); | 49 REFCOUNTED_EVENT_TARGET(RTCDataChannel); |
49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCDataChannel); | 50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCDataChannel); |
50 public: | 51 public: |
51 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, Pass
OwnPtr<blink::WebRTCDataChannelHandler>); | 52 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, Weak
PtrWillBeRawPtr<RTCPeerConnection>, PassOwnPtr<blink::WebRTCDataChannelHandler>)
; |
52 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, blin
k::WebRTCPeerConnectionHandler*, const String& label, const blink::WebRTCDataCha
nnelInit&, ExceptionState&); | 53 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, Weak
PtrWillBeRawPtr<RTCPeerConnection>, blink::WebRTCPeerConnectionHandler*, const S
tring& label, const blink::WebRTCDataChannelInit&, ExceptionState&); |
53 virtual ~RTCDataChannel(); | 54 virtual ~RTCDataChannel(); |
54 | 55 |
55 String label() const; | 56 String label() const; |
56 | 57 |
57 // DEPRECATED | 58 // DEPRECATED |
58 bool reliable() const; | 59 bool reliable() const; |
59 | 60 |
60 bool ordered() const; | 61 bool ordered() const; |
61 unsigned short maxRetransmitTime() const; | 62 unsigned short maxRetransmitTime() const; |
62 unsigned short maxRetransmits() const; | 63 unsigned short maxRetransmits() const; |
(...skipping 20 matching lines...) Expand all Loading... |
83 | 84 |
84 void stop(); | 85 void stop(); |
85 | 86 |
86 // EventTarget | 87 // EventTarget |
87 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const OVERRIDE; |
88 virtual ExecutionContext* executionContext() const OVERRIDE; | 89 virtual ExecutionContext* executionContext() const OVERRIDE; |
89 | 90 |
90 virtual void trace(Visitor*) OVERRIDE; | 91 virtual void trace(Visitor*) OVERRIDE; |
91 | 92 |
92 private: | 93 private: |
93 RTCDataChannel(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler
>); | 94 RTCDataChannel(ExecutionContext*, WeakPtrWillBeRawPtr<RTCPeerConnection>, Pa
ssOwnPtr<blink::WebRTCDataChannelHandler>); |
94 | 95 |
95 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 96 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
96 void scheduledEventTimerFired(Timer<RTCDataChannel>*); | 97 void scheduledEventTimerFired(Timer<RTCDataChannel>*); |
97 | 98 |
98 ExecutionContext* m_executionContext; | 99 ExecutionContext* m_executionContext; |
99 | 100 |
100 // blink::WebRTCDataChannelHandlerClient | 101 // blink::WebRTCDataChannelHandlerClient |
101 virtual void didChangeReadyState(blink::WebRTCDataChannelHandlerClient::Read
yState) OVERRIDE; | 102 virtual void didChangeReadyState(blink::WebRTCDataChannelHandlerClient::Read
yState) OVERRIDE; |
102 virtual void didReceiveStringData(const blink::WebString&) OVERRIDE; | 103 virtual void didReceiveStringData(const blink::WebString&) OVERRIDE; |
103 virtual void didReceiveRawData(const char*, size_t) OVERRIDE; | 104 virtual void didReceiveRawData(const char*, size_t) OVERRIDE; |
104 virtual void didDetectError() OVERRIDE; | 105 virtual void didDetectError() OVERRIDE; |
105 | 106 |
| 107 void stopAndFireCloseEventIfCreatorWasDeleted(); |
| 108 |
106 OwnPtr<blink::WebRTCDataChannelHandler> m_handler; | 109 OwnPtr<blink::WebRTCDataChannelHandler> m_handler; |
107 | 110 |
108 bool m_stopped; | 111 bool m_stopped; |
109 | 112 |
110 blink::WebRTCDataChannelHandlerClient::ReadyState m_readyState; | 113 blink::WebRTCDataChannelHandlerClient::ReadyState m_readyState; |
111 | 114 |
112 enum BinaryType { | 115 enum BinaryType { |
113 BinaryTypeBlob, | 116 BinaryTypeBlob, |
114 BinaryTypeArrayBuffer | 117 BinaryTypeArrayBuffer |
115 }; | 118 }; |
116 BinaryType m_binaryType; | 119 BinaryType m_binaryType; |
117 | 120 |
118 Timer<RTCDataChannel> m_scheduledEventTimer; | 121 Timer<RTCDataChannel> m_scheduledEventTimer; |
119 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 122 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
| 123 |
| 124 WeakPtrWillBeWeakMember<RTCPeerConnection> m_creator; |
120 }; | 125 }; |
121 | 126 |
122 } // namespace WebCore | 127 } // namespace WebCore |
123 | 128 |
124 #endif // RTCDataChannel_h | 129 #endif // RTCDataChannel_h |
OLD | NEW |