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

Side by Side Diff: Source/modules/mediastream/RTCDTMFSender.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 22 matching lines...) Expand all
33 #include "platform/Timer.h" 33 #include "platform/Timer.h"
34 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
35 35
36 namespace WebCore { 36 namespace WebCore {
37 37
38 class ExceptionState; 38 class ExceptionState;
39 class MediaStreamTrack; 39 class MediaStreamTrack;
40 class RTCDTMFSenderHandler; 40 class RTCDTMFSenderHandler;
41 class RTCPeerConnectionHandler; 41 class RTCPeerConnectionHandler;
42 42
43 class RTCDTMFSender : public RefCounted<RTCDTMFSender>, public ScriptWrappable, public EventTarget, public RTCDTMFSenderHandlerClient, public ActiveDOMObject { 43 class RTCDTMFSender : public RefCounted<RTCDTMFSender>, public ScriptWrappable, public EventTargetWithInlineData, public RTCDTMFSenderHandlerClient, public Acti veDOMObject {
44 public: 44 public:
45 static PassRefPtr<RTCDTMFSender> create(ScriptExecutionContext*, RTCPeerConn ectionHandler*, PassRefPtr<MediaStreamTrack>, ExceptionState&); 45 static PassRefPtr<RTCDTMFSender> create(ScriptExecutionContext*, RTCPeerConn ectionHandler*, PassRefPtr<MediaStreamTrack>, ExceptionState&);
46 ~RTCDTMFSender(); 46 ~RTCDTMFSender();
47 47
48 bool canInsertDTMF() const; 48 bool canInsertDTMF() const;
49 MediaStreamTrack* track() const; 49 MediaStreamTrack* track() const;
50 String toneBuffer() const; 50 String toneBuffer() const;
51 long duration() const { return m_duration; } 51 long duration() const { return m_duration; }
52 long interToneGap() const { return m_interToneGap; } 52 long interToneGap() const { return m_interToneGap; }
53 53
(...skipping 13 matching lines...) Expand all
67 using RefCounted<RTCDTMFSender>::ref; 67 using RefCounted<RTCDTMFSender>::ref;
68 using RefCounted<RTCDTMFSender>::deref; 68 using RefCounted<RTCDTMFSender>::deref;
69 69
70 private: 70 private:
71 RTCDTMFSender(ScriptExecutionContext*, PassRefPtr<MediaStreamTrack>, PassOwn Ptr<RTCDTMFSenderHandler>); 71 RTCDTMFSender(ScriptExecutionContext*, PassRefPtr<MediaStreamTrack>, PassOwn Ptr<RTCDTMFSenderHandler>);
72 72
73 void scheduleDispatchEvent(PassRefPtr<Event>); 73 void scheduleDispatchEvent(PassRefPtr<Event>);
74 void scheduledEventTimerFired(Timer<RTCDTMFSender>*); 74 void scheduledEventTimerFired(Timer<RTCDTMFSender>*);
75 75
76 // EventTarget 76 // EventTarget
77 virtual EventTargetData* eventTargetData() OVERRIDE;
78 virtual EventTargetData* ensureEventTargetData() OVERRIDE;
79 virtual void refEventTarget() OVERRIDE { ref(); } 77 virtual void refEventTarget() OVERRIDE { ref(); }
80 virtual void derefEventTarget() OVERRIDE { deref(); } 78 virtual void derefEventTarget() OVERRIDE { deref(); }
81 EventTargetData m_eventTargetData;
82 79
83 // RTCDTMFSenderHandlerClient 80 // RTCDTMFSenderHandlerClient
84 virtual void didPlayTone(const String&) OVERRIDE; 81 virtual void didPlayTone(const String&) OVERRIDE;
85 82
86 RefPtr<MediaStreamTrack> m_track; 83 RefPtr<MediaStreamTrack> m_track;
87 long m_duration; 84 long m_duration;
88 long m_interToneGap; 85 long m_interToneGap;
89 86
90 OwnPtr<RTCDTMFSenderHandler> m_handler; 87 OwnPtr<RTCDTMFSenderHandler> m_handler;
91 88
92 bool m_stopped; 89 bool m_stopped;
93 90
94 Timer<RTCDTMFSender> m_scheduledEventTimer; 91 Timer<RTCDTMFSender> m_scheduledEventTimer;
95 Vector<RefPtr<Event> > m_scheduledEvents; 92 Vector<RefPtr<Event> > m_scheduledEvents;
96 }; 93 };
97 94
98 } // namespace WebCore 95 } // namespace WebCore
99 96
100 #endif // RTCDTMFSender_h 97 #endif // RTCDTMFSender_h
OLDNEW
« no previous file with comments | « Source/modules/mediastream/MediaStreamTrack.cpp ('k') | Source/modules/mediastream/RTCDTMFSender.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698