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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "base/gtest_prod_util.h" | 28 #include "base/gtest_prod_util.h" |
29 #include "bindings/core/v8/ActiveScriptWrappable.h" | 29 #include "bindings/core/v8/ActiveScriptWrappable.h" |
30 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
31 #include "modules/EventTargetModules.h" | 31 #include "modules/EventTargetModules.h" |
32 #include "platform/Timer.h" | 32 #include "platform/Timer.h" |
33 #include "platform/heap/Handle.h" | 33 #include "platform/heap/Handle.h" |
34 #include "public/platform/WebRTCDataChannelHandler.h" | 34 #include "public/platform/WebRTCDataChannelHandler.h" |
35 #include "public/platform/WebRTCDataChannelHandlerClient.h" | 35 #include "public/platform/WebRTCDataChannelHandlerClient.h" |
36 #include "wtf/Compiler.h" | 36 #include "wtf/Compiler.h" |
37 #include <memory> | |
38 | 37 |
39 namespace blink { | 38 namespace blink { |
40 | 39 |
41 class Blob; | 40 class Blob; |
42 class DOMArrayBuffer; | 41 class DOMArrayBuffer; |
43 class DOMArrayBufferView; | 42 class DOMArrayBufferView; |
44 class ExceptionState; | 43 class ExceptionState; |
45 class RTCPeerConnection; | 44 class RTCPeerConnection; |
46 class WebRTCDataChannelHandler; | 45 class WebRTCDataChannelHandler; |
47 class WebRTCPeerConnectionHandler; | 46 class WebRTCPeerConnectionHandler; |
48 struct WebRTCDataChannelInit; | 47 struct WebRTCDataChannelInit; |
49 | 48 |
50 class MODULES_EXPORT RTCDataChannel final | 49 class MODULES_EXPORT RTCDataChannel final |
51 : public EventTargetWithInlineData | 50 : public EventTargetWithInlineData |
52 , WTF_NON_EXPORTED_BASE(public WebRTCDataChannelHandlerClient) | 51 , WTF_NON_EXPORTED_BASE(public WebRTCDataChannelHandlerClient) |
53 , public ActiveScriptWrappable | 52 , public ActiveScriptWrappable |
54 , public ActiveDOMObject { | 53 , public ActiveDOMObject { |
55 USING_GARBAGE_COLLECTED_MIXIN(RTCDataChannel); | 54 USING_GARBAGE_COLLECTED_MIXIN(RTCDataChannel); |
56 DEFINE_WRAPPERTYPEINFO(); | 55 DEFINE_WRAPPERTYPEINFO(); |
57 USING_PRE_FINALIZER(RTCDataChannel, dispose); | 56 USING_PRE_FINALIZER(RTCDataChannel, dispose); |
58 public: | 57 public: |
59 static RTCDataChannel* create(ExecutionContext*, std::unique_ptr<WebRTCDataC
hannelHandler>); | 58 static RTCDataChannel* create(ExecutionContext*, PassOwnPtr<WebRTCDataChanne
lHandler>); |
60 static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler
*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); | 59 static RTCDataChannel* create(ExecutionContext*, WebRTCPeerConnectionHandler
*, const String& label, const WebRTCDataChannelInit&, ExceptionState&); |
61 ~RTCDataChannel() override; | 60 ~RTCDataChannel() override; |
62 | 61 |
63 ReadyState getHandlerState() const; | 62 ReadyState getHandlerState() const; |
64 | 63 |
65 String label() const; | 64 String label() const; |
66 | 65 |
67 // DEPRECATED | 66 // DEPRECATED |
68 bool reliable() const; | 67 bool reliable() const; |
69 | 68 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 DECLARE_VIRTUAL_TRACE(); | 109 DECLARE_VIRTUAL_TRACE(); |
111 | 110 |
112 // WebRTCDataChannelHandlerClient | 111 // WebRTCDataChannelHandlerClient |
113 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; | 112 void didChangeReadyState(WebRTCDataChannelHandlerClient::ReadyState) overrid
e; |
114 void didDecreaseBufferedAmount(unsigned) override; | 113 void didDecreaseBufferedAmount(unsigned) override; |
115 void didReceiveStringData(const WebString&) override; | 114 void didReceiveStringData(const WebString&) override; |
116 void didReceiveRawData(const char*, size_t) override; | 115 void didReceiveRawData(const char*, size_t) override; |
117 void didDetectError() override; | 116 void didDetectError() override; |
118 | 117 |
119 private: | 118 private: |
120 RTCDataChannel(ExecutionContext*, std::unique_ptr<WebRTCDataChannelHandler>)
; | 119 RTCDataChannel(ExecutionContext*, PassOwnPtr<WebRTCDataChannelHandler>); |
121 void dispose(); | 120 void dispose(); |
122 | 121 |
123 void scheduleDispatchEvent(Event*); | 122 void scheduleDispatchEvent(Event*); |
124 void scheduledEventTimerFired(Timer<RTCDataChannel>*); | 123 void scheduledEventTimerFired(Timer<RTCDataChannel>*); |
125 | 124 |
126 std::unique_ptr<WebRTCDataChannelHandler> m_handler; | 125 OwnPtr<WebRTCDataChannelHandler> m_handler; |
127 | 126 |
128 WebRTCDataChannelHandlerClient::ReadyState m_readyState; | 127 WebRTCDataChannelHandlerClient::ReadyState m_readyState; |
129 | 128 |
130 enum BinaryType { | 129 enum BinaryType { |
131 BinaryTypeBlob, | 130 BinaryTypeBlob, |
132 BinaryTypeArrayBuffer | 131 BinaryTypeArrayBuffer |
133 }; | 132 }; |
134 BinaryType m_binaryType; | 133 BinaryType m_binaryType; |
135 | 134 |
136 Timer<RTCDataChannel> m_scheduledEventTimer; | 135 Timer<RTCDataChannel> m_scheduledEventTimer; |
137 HeapVector<Member<Event>> m_scheduledEvents; | 136 HeapVector<Member<Event>> m_scheduledEvents; |
138 | 137 |
139 unsigned m_bufferedAmountLowThreshold; | 138 unsigned m_bufferedAmountLowThreshold; |
140 | 139 |
141 bool m_stopped; | 140 bool m_stopped; |
142 | 141 |
143 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); | 142 FRIEND_TEST_ALL_PREFIXES(RTCDataChannelTest, BufferedAmountLow); |
144 }; | 143 }; |
145 | 144 |
146 } // namespace blink | 145 } // namespace blink |
147 | 146 |
148 #endif // RTCDataChannel_h | 147 #endif // RTCDataChannel_h |
OLD | NEW |