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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class WebRTCDataChannelHandler; | 42 class WebRTCDataChannelHandler; |
43 class WebRTCPeerConnectionHandler; | 43 class WebRTCPeerConnectionHandler; |
44 struct WebRTCDataChannelInit; | 44 struct WebRTCDataChannelInit; |
45 | 45 |
46 class MODULES_EXPORT RTCDataChannel final | 46 class MODULES_EXPORT RTCDataChannel final |
47 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel> | 47 : public RefCountedGarbageCollectedEventTargetWithInlineData<RTCDataChannel> |
48 , public WebRTCDataChannelHandlerClient { | 48 , public WebRTCDataChannelHandlerClient { |
49 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCDataChannel); | 49 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(RTCDataChannel); |
50 DEFINE_WRAPPERTYPEINFO(); | 50 DEFINE_WRAPPERTYPEINFO(); |
51 public: | 51 public: |
52 static RTCDataChannel* create(ExecutionContext*, PassOwnPtr<WebRTCDataChanne
lHandler>); | 52 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, PassOwn
Ptr<WebRTCDataChannelHandler>); |
53 static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler
*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); | 53 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, WebRTCP
eerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, Except
ionState&); |
54 ~RTCDataChannel() override; | 54 ~RTCDataChannel() override; |
55 | 55 |
56 ReadyState getHandlerState() const; | 56 ReadyState getHandlerState() const; |
57 | 57 |
58 String label() const; | 58 String label() const; |
59 | 59 |
60 // DEPRECATED | 60 // DEPRECATED |
61 bool reliable() const; | 61 bool reliable() const; |
62 | 62 |
63 bool ordered() const; | 63 bool ordered() const; |
(...skipping 17 matching lines...) Expand all Loading... |
81 void send(Blob*, ExceptionState&); | 81 void send(Blob*, ExceptionState&); |
82 | 82 |
83 void close(); | 83 void close(); |
84 | 84 |
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
86 DEFINE_ATTRIBUTE_EVENT_LISTENER(bufferedamountlow); | 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(bufferedamountlow); |
87 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
88 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 88 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
89 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
90 | 90 |
| 91 void stop(); |
| 92 |
91 // EventTarget | 93 // EventTarget |
92 const AtomicString& interfaceName() const override; | 94 const AtomicString& interfaceName() const override; |
93 ExecutionContext* executionContext() const override; | 95 ExecutionContext* executionContext() const override; |
94 | 96 |
| 97 void clearWeakMembers(Visitor*); |
| 98 |
95 // Oilpan: need to eagerly finalize m_handler | 99 // Oilpan: need to eagerly finalize m_handler |
96 EAGERLY_FINALIZE(); | 100 EAGERLY_FINALIZE(); |
97 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
98 | 102 |
99 // WebRTCDataChannelHandlerClient | 103 // WebRTCDataChannelHandlerClient |
100 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; | 104 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; |
101 void didDecreaseBufferedAmount(unsigned) override; | 105 void didDecreaseBufferedAmount(unsigned) override; |
102 void didReceiveStringData(const WebString&) override; | 106 void didReceiveStringData(const WebString&) override; |
103 void didReceiveRawData(const char*, size_t) override; | 107 void didReceiveRawData(const char*, size_t) override; |
104 void didDetectError() override; | 108 void didDetectError() override; |
105 | 109 |
106 private: | 110 private: |
107 RTCDataChannel(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); | 111 RTCDataChannel(ExecutionContext*, RTCPeerConnection*, PassOwnPtr<WebRTCDataC
hannelHandler>); |
108 | 112 |
109 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 113 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
110 void scheduledEventTimerFired(Timer<RTCDataChannel>*); | 114 void scheduledEventTimerFired(Timer<RTCDataChannel>*); |
111 | 115 |
112 RawPtrWillBeMember<ExecutionContext> m_executionContext; | 116 RawPtrWillBeMember<ExecutionContext> m_executionContext; |
113 | 117 |
114 OwnPtr<WebRTCDataChannelHandler> m_handler; | 118 OwnPtr<WebRTCDataChannelHandler> m_handler; |
115 | 119 |
| 120 bool m_stopped; |
| 121 |
116 WebRTCDataChannelHandlerClient::ReadyState m_readyState; | 122 WebRTCDataChannelHandlerClient::ReadyState m_readyState; |
117 | 123 |
118 enum BinaryType { | 124 enum BinaryType { |
119 BinaryTypeBlob, | 125 BinaryTypeBlob, |
120 BinaryTypeArrayBuffer | 126 BinaryTypeArrayBuffer |
121 }; | 127 }; |
122 BinaryType m_binaryType; | 128 BinaryType m_binaryType; |
123 | 129 |
124 Timer<RTCDataChannel> m_scheduledEventTimer; | 130 Timer<RTCDataChannel> m_scheduledEventTimer; |
125 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; | 131 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; |
126 | 132 |
| 133 WeakMember<RTCPeerConnection> m_connection; |
| 134 |
127 unsigned m_bufferedAmountLowThreshold; | 135 unsigned m_bufferedAmountLowThreshold; |
128 | 136 |
129 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); | 137 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); |
130 }; | 138 }; |
131 | 139 |
132 } // namespace blink | 140 } // namespace blink |
133 | 141 |
134 #endif // RTCDataChannel_h | 142 #endif // RTCDataChannel_h |
OLD | NEW |