Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: Source/modules/mediastream/RTCDataChannel.h

Issue 26878003: Reduce repetitive EventTarget subclassing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nit Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 struct WebRTCDataChannelInit; 35 struct WebRTCDataChannelInit;
36 } 36 }
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 class Blob; 40 class Blob;
41 class ExceptionState; 41 class ExceptionState;
42 class RTCDataChannelHandler; 42 class RTCDataChannelHandler;
43 class RTCPeerConnectionHandler; 43 class RTCPeerConnectionHandler;
44 44
45 class RTCDataChannel : public RefCounted<RTCDataChannel>, public ScriptWrappable , public EventTarget, public RTCDataChannelHandlerClient { 45 class RTCDataChannel : public RefCounted<RTCDataChannel>, public ScriptWrappable , public EventTargetWithInlineData, public RTCDataChannelHandlerClient {
46 public: 46 public:
47 static PassRefPtr<RTCDataChannel> create(ScriptExecutionContext*, PassOwnPtr <RTCDataChannelHandler>); 47 static PassRefPtr<RTCDataChannel> create(ScriptExecutionContext*, PassOwnPtr <RTCDataChannelHandler>);
48 static PassRefPtr<RTCDataChannel> create(ScriptExecutionContext*, RTCPeerCon nectionHandler*, const String& label, const WebKit::WebRTCDataChannelInit&, Exce ptionState&); 48 static PassRefPtr<RTCDataChannel> create(ScriptExecutionContext*, RTCPeerCon nectionHandler*, const String& label, const WebKit::WebRTCDataChannelInit&, Exce ptionState&);
49 ~RTCDataChannel(); 49 ~RTCDataChannel();
50 50
51 String label() const; 51 String label() const;
52 52
53 // DEPRECATED 53 // DEPRECATED
54 bool reliable() const; 54 bool reliable() const;
55 55
(...skipping 30 matching lines...) Expand all
86 using RefCounted<RTCDataChannel>::ref; 86 using RefCounted<RTCDataChannel>::ref;
87 using RefCounted<RTCDataChannel>::deref; 87 using RefCounted<RTCDataChannel>::deref;
88 88
89 private: 89 private:
90 RTCDataChannel(ScriptExecutionContext*, PassOwnPtr<RTCDataChannelHandler>); 90 RTCDataChannel(ScriptExecutionContext*, PassOwnPtr<RTCDataChannelHandler>);
91 91
92 void scheduleDispatchEvent(PassRefPtr<Event>); 92 void scheduleDispatchEvent(PassRefPtr<Event>);
93 void scheduledEventTimerFired(Timer<RTCDataChannel>*); 93 void scheduledEventTimerFired(Timer<RTCDataChannel>*);
94 94
95 // EventTarget 95 // EventTarget
96 virtual EventTargetData* eventTargetData(); 96 virtual void refEventTarget() OVERRIDE { ref(); }
97 virtual EventTargetData* ensureEventTargetData(); 97 virtual void derefEventTarget() OVERRIDE { deref(); }
98 virtual void refEventTarget() { ref(); }
99 virtual void derefEventTarget() { deref(); }
100 EventTargetData m_eventTargetData;
101 ScriptExecutionContext* m_scriptExecutionContext; 98 ScriptExecutionContext* m_scriptExecutionContext;
102 99
103 // RTCDataChannelHandlerClient 100 // RTCDataChannelHandlerClient
104 virtual void didChangeReadyState(ReadyState) OVERRIDE; 101 virtual void didChangeReadyState(ReadyState) OVERRIDE;
105 virtual void didReceiveStringData(const String&) OVERRIDE; 102 virtual void didReceiveStringData(const String&) OVERRIDE;
106 virtual void didReceiveRawData(const char*, size_t) OVERRIDE; 103 virtual void didReceiveRawData(const char*, size_t) OVERRIDE;
107 virtual void didDetectError() OVERRIDE; 104 virtual void didDetectError() OVERRIDE;
108 105
109 OwnPtr<RTCDataChannelHandler> m_handler; 106 OwnPtr<RTCDataChannelHandler> m_handler;
110 107
111 bool m_stopped; 108 bool m_stopped;
112 109
113 ReadyState m_readyState; 110 ReadyState m_readyState;
114 enum BinaryType { 111 enum BinaryType {
115 BinaryTypeBlob, 112 BinaryTypeBlob,
116 BinaryTypeArrayBuffer 113 BinaryTypeArrayBuffer
117 }; 114 };
118 BinaryType m_binaryType; 115 BinaryType m_binaryType;
119 116
120 Timer<RTCDataChannel> m_scheduledEventTimer; 117 Timer<RTCDataChannel> m_scheduledEventTimer;
121 Vector<RefPtr<Event> > m_scheduledEvents; 118 Vector<RefPtr<Event> > m_scheduledEvents;
122 }; 119 };
123 120
124 } // namespace WebCore 121 } // namespace WebCore
125 122
126 #endif // RTCDataChannel_h 123 #endif // RTCDataChannel_h
OLDNEW
« no previous file with comments | « Source/modules/mediastream/RTCDTMFSender.cpp ('k') | Source/modules/mediastream/RTCDataChannel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698