Chromium Code Reviews| 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 class WebRTCDataChannelHandler; | 36 class WebRTCDataChannelHandler; |
| 37 class WebRTCPeerConnectionHandler; | 37 class WebRTCPeerConnectionHandler; |
| 38 struct WebRTCDataChannelInit; | 38 struct WebRTCDataChannelInit; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class Blob; | 43 class Blob; |
| 44 class ExceptionState; | 44 class ExceptionState; |
| 45 | 45 |
| 46 class RTCDataChannel FINAL : public RefCounted<RTCDataChannel>, public ScriptWra ppable, public EventTargetWithInlineData, public blink::WebRTCDataChannelHandler Client { | 46 class RTCDataChannel FINAL : public RefCountedWillBeRefCountedGarbageCollected<R TCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public blink::WebRTCDataChannelHandlerClient { |
| 47 REFCOUNTED_EVENT_TARGET(RTCDataChannel); | 47 DECLARE_GC_INFO; |
| 48 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<R TCDataChannel>); | |
| 48 public: | 49 public: |
| 49 static PassRefPtr<RTCDataChannel> create(ExecutionContext*, PassOwnPtr<blink ::WebRTCDataChannelHandler>); | 50 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, Pass OwnPtr<blink::WebRTCDataChannelHandler>); |
| 50 static PassRefPtr<RTCDataChannel> create(ExecutionContext*, blink::WebRTCPee rConnectionHandler*, const String& label, const blink::WebRTCDataChannelInit&, E xceptionState&); | 51 static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, blin k::WebRTCPeerConnectionHandler*, const String& label, const blink::WebRTCDataCha nnelInit&, ExceptionState&); |
| 51 virtual ~RTCDataChannel(); | 52 virtual ~RTCDataChannel(); |
| 52 | 53 |
| 53 String label() const; | 54 String label() const; |
| 54 | 55 |
| 55 // DEPRECATED | 56 // DEPRECATED |
| 56 bool reliable() const; | 57 bool reliable() const; |
| 57 | 58 |
| 58 bool ordered() const; | 59 bool ordered() const; |
| 59 unsigned short maxRetransmitTime() const; | 60 unsigned short maxRetransmitTime() const; |
| 60 unsigned short maxRetransmits() const; | 61 unsigned short maxRetransmits() const; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 74 | 75 |
| 75 void close(); | 76 void close(); |
| 76 | 77 |
| 77 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); | 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(open); |
| 78 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 79 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); | 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(close); |
| 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
| 81 | 82 |
| 82 void stop(); | 83 void stop(); |
| 83 | 84 |
| 85 void trace(Visitor*) { } | |
| 86 | |
| 84 // EventTarget | 87 // EventTarget |
| 85 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 86 virtual ExecutionContext* executionContext() const OVERRIDE; | 89 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 87 | 90 |
| 88 private: | 91 private: |
| 89 RTCDataChannel(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler >); | 92 RTCDataChannel(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler >); |
| 90 | 93 |
| 91 void scheduleDispatchEvent(PassRefPtr<Event>); | 94 void scheduleDispatchEvent(PassRefPtr<Event>); |
| 92 void scheduledEventTimerFired(Timer<RTCDataChannel>*); | 95 void scheduledEventTimerFired(Timer<RTCDataChannel>*); |
| 93 | 96 |
| 94 ExecutionContext* m_executionContext; | 97 ExecutionContext* m_executionContext; |
|
haraken
2014/02/21 10:47:05
This raw pointer looks safe because it's cleared i
| |
| 95 | 98 |
| 96 // blink::WebRTCDataChannelHandlerClient | 99 // blink::WebRTCDataChannelHandlerClient |
| 97 virtual void didChangeReadyState(blink::WebRTCDataChannelHandlerClient::Read yState) OVERRIDE; | 100 virtual void didChangeReadyState(blink::WebRTCDataChannelHandlerClient::Read yState) OVERRIDE; |
| 98 virtual void didReceiveStringData(const blink::WebString&) OVERRIDE; | 101 virtual void didReceiveStringData(const blink::WebString&) OVERRIDE; |
| 99 virtual void didReceiveRawData(const char*, size_t) OVERRIDE; | 102 virtual void didReceiveRawData(const char*, size_t) OVERRIDE; |
| 100 virtual void didDetectError() OVERRIDE; | 103 virtual void didDetectError() OVERRIDE; |
| 101 | 104 |
| 102 OwnPtr<blink::WebRTCDataChannelHandler> m_handler; | 105 OwnPtr<blink::WebRTCDataChannelHandler> m_handler; |
| 103 | 106 |
| 104 bool m_stopped; | 107 bool m_stopped; |
| 105 | 108 |
| 106 blink::WebRTCDataChannelHandlerClient::ReadyState m_readyState; | 109 blink::WebRTCDataChannelHandlerClient::ReadyState m_readyState; |
| 107 | 110 |
| 108 enum BinaryType { | 111 enum BinaryType { |
| 109 BinaryTypeBlob, | 112 BinaryTypeBlob, |
| 110 BinaryTypeArrayBuffer | 113 BinaryTypeArrayBuffer |
| 111 }; | 114 }; |
| 112 BinaryType m_binaryType; | 115 BinaryType m_binaryType; |
| 113 | 116 |
| 114 Timer<RTCDataChannel> m_scheduledEventTimer; | 117 Timer<RTCDataChannel> m_scheduledEventTimer; |
| 115 Vector<RefPtr<Event> > m_scheduledEvents; | 118 Vector<RefPtr<Event> > m_scheduledEvents; |
| 116 }; | 119 }; |
| 117 | 120 |
| 118 } // namespace WebCore | 121 } // namespace WebCore |
| 119 | 122 |
| 120 #endif // RTCDataChannel_h | 123 #endif // RTCDataChannel_h |
| OLD | NEW |