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*, RTCPeerConnection*, PassOwn
Ptr<WebRTCDataChannelHandler>); | 52 static RTCDataChannel* create(ExecutionContext*, PassOwnPtr<WebRTCDataChanne
lHandler>); |
53 static RTCDataChannel* create(ExecutionContext*, RTCPeerConnection*, WebRTCP
eerConnectionHandler*, const String& label, const WebRTCDataChannelInit&, Except
ionState&); | 53 static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler
*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); |
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 | |
93 // EventTarget | 91 // EventTarget |
94 const AtomicString& interfaceName() const override; | 92 const AtomicString& interfaceName() const override; |
95 ExecutionContext* executionContext() const override; | 93 ExecutionContext* executionContext() const override; |
96 | 94 |
97 void clearWeakMembers(Visitor*); | |
98 | |
99 // Oilpan: need to eagerly finalize m_handler | 95 // Oilpan: need to eagerly finalize m_handler |
100 EAGERLY_FINALIZE(); | 96 EAGERLY_FINALIZE(); |
101 DECLARE_VIRTUAL_TRACE(); | 97 DECLARE_VIRTUAL_TRACE(); |
102 | 98 |
103 // WebRTCDataChannelHandlerClient | 99 // WebRTCDataChannelHandlerClient |
104 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; | 100 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; |
105 void didDecreaseBufferedAmount(unsigned) override; | 101 void didDecreaseBufferedAmount(unsigned) override; |
106 void didReceiveStringData(const WebString&) override; | 102 void didReceiveStringData(const WebString&) override; |
107 void didReceiveRawData(const char*, size_t) override; | 103 void didReceiveRawData(const char*, size_t) override; |
108 void didDetectError() override; | 104 void didDetectError() override; |
109 | 105 |
110 private: | 106 private: |
111 RTCDataChannel(ExecutionContext*, RTCPeerConnection*, PassOwnPtr<WebRTCDataC
hannelHandler>); | 107 RTCDataChannel(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); |
112 | 108 |
113 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 109 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
114 void scheduledEventTimerFired(Timer<RTCDataChannel>*); | 110 void scheduledEventTimerFired(Timer<RTCDataChannel>*); |
115 | 111 |
116 RawPtrWillBeMember<ExecutionContext> m_executionContext; | 112 RawPtrWillBeMember<ExecutionContext> m_executionContext; |
117 | 113 |
118 OwnPtr<WebRTCDataChannelHandler> m_handler; | 114 OwnPtr<WebRTCDataChannelHandler> m_handler; |
119 | 115 |
120 bool m_stopped; | |
121 | |
122 WebRTCDataChannelHandlerClient::ReadyState m_readyState; | 116 WebRTCDataChannelHandlerClient::ReadyState m_readyState; |
123 | 117 |
124 enum BinaryType { | 118 enum BinaryType { |
125 BinaryTypeBlob, | 119 BinaryTypeBlob, |
126 BinaryTypeArrayBuffer | 120 BinaryTypeArrayBuffer |
127 }; | 121 }; |
128 BinaryType m_binaryType; | 122 BinaryType m_binaryType; |
129 | 123 |
130 Timer<RTCDataChannel> m_scheduledEventTimer; | 124 Timer<RTCDataChannel> m_scheduledEventTimer; |
131 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; | 125 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; |
132 | 126 |
133 WeakMember<RTCPeerConnection> m_connection; | |
134 | |
135 unsigned m_bufferedAmountLowThreshold; | 127 unsigned m_bufferedAmountLowThreshold; |
136 | 128 |
137 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); | 129 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); |
138 }; | 130 }; |
139 | 131 |
140 } // namespace blink | 132 } // namespace blink |
141 | 133 |
142 #endif // RTCDataChannel_h | 134 #endif // RTCDataChannel_h |
OLD | NEW |