Chromium Code Reviews| Index: Source/modules/webmidi/MIDIConnectionEvent.h |
| diff --git a/Source/modules/webmidi/MIDIMessageEvent.h b/Source/modules/webmidi/MIDIConnectionEvent.h |
| similarity index 55% |
| copy from Source/modules/webmidi/MIDIMessageEvent.h |
| copy to Source/modules/webmidi/MIDIConnectionEvent.h |
| index dcc3bd825fbf7abef67e133b23ded2477ca36bb2..068dfa6753a3bd2d22b399e8ba334c5e8ba0cf21 100644 |
| --- a/Source/modules/webmidi/MIDIMessageEvent.h |
| +++ b/Source/modules/webmidi/MIDIConnectionEvent.h |
| @@ -28,70 +28,78 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef MIDIMessageEvent_h |
| -#define MIDIMessageEvent_h |
| +#ifndef MIDIConnectionEvent_h |
| +#define MIDIConnectionEvent_h |
| #include "core/dom/Event.h" |
| -#include "wtf/Uint8Array.h" |
| +#include "modules/webmidi/MIDIPort.h" |
| namespace WebCore { |
| -struct MIDIMessageEventInit : public EventInit { |
| - MIDIMessageEventInit() |
| - : receivedTime(0.0) |
| +struct MIDIConnectionEventInit : public EventInit { |
| + MIDIConnectionEventInit() |
|
haraken
2013/04/25 06:33:00
You need to initialize port to 0.
Takashi Toyoshima
2013/04/25 07:20:27
Done.
|
| { |
| }; |
| - double receivedTime; |
| - RefPtr<Uint8Array> data; |
| + RefPtr<MIDIPort> port; |
| }; |
| -class MIDIMessageEvent : public Event { |
| +class MIDIConnectionEvent : public Event { |
| public: |
| - static PassRefPtr<MIDIMessageEvent> create() |
| + static PassRefPtr<MIDIConnectionEvent> create() |
| { |
| - return adoptRef(new MIDIMessageEvent()); |
| + return adoptRef(new MIDIConnectionEvent()); |
| } |
| - static PassRefPtr<MIDIMessageEvent> create(double receivedTime, PassRefPtr<Uint8Array> data) |
| + static PassRefPtr<MIDIConnectionEvent> create(const AtomicString& type) |
| { |
| - return adoptRef(new MIDIMessageEvent(receivedTime, data)); |
| + return adoptRef(new MIDIConnectionEvent(type)); |
| } |
| - static PassRefPtr<MIDIMessageEvent> create(const AtomicString& type, const MIDIMessageEventInit& initializer) |
| + static PassRefPtr<MIDIConnectionEvent> create(const AtomicString& type, PassRefPtr<MIDIPort> port) |
| { |
| - return adoptRef(new MIDIMessageEvent(type, initializer)); |
| + return adoptRef(new MIDIConnectionEvent(type, port)); |
| } |
| - double receivedTime() { return m_receivedTime; } |
| - PassRefPtr<Uint8Array> data() { return m_data; } |
| + static PassRefPtr<MIDIConnectionEvent> create(const AtomicString& type, const MIDIConnectionEventInit& initializer) |
| + { |
| + return adoptRef(new MIDIConnectionEvent(type, initializer)); |
| + } |
| + |
| + RefPtr<MIDIPort> port() { return m_port; } |
| + |
| + // Event: |
|
haraken
2013/04/25 06:33:00
Nit: Remove the comment.
Takashi Toyoshima
2013/04/25 07:20:27
Done.
|
| + virtual const AtomicString& interfaceName() const OVERRIDE { return eventNames().interfaceForMIDIConnectionEvent; } |
| private: |
| - MIDIMessageEvent() |
| - : m_receivedTime(0.0) |
| + MIDIConnectionEvent() |
| + { |
| + ScriptWrappable::init(this); |
| + } |
| + |
| + MIDIConnectionEvent(const AtomicString& type) |
| + : Event(type, false, false) |
| { |
| ScriptWrappable::init(this); |
| } |
| - MIDIMessageEvent(double receivedTime, PassRefPtr<Uint8Array> data) |
| - : m_receivedTime(receivedTime) |
| - , m_data(data) |
| + MIDIConnectionEvent(const AtomicString& type, PassRefPtr<MIDIPort> port) |
|
haraken
2013/04/25 06:33:00
Do you really need all of MIDIConnectionEvent(), M
Takashi Toyoshima
2013/04/25 07:20:27
First one is used by auto-generated code.
The seco
|
| + : Event(type, false, false) |
| + , m_port(port) |
| { |
| ScriptWrappable::init(this); |
| } |
| - MIDIMessageEvent(const AtomicString& type, const MIDIMessageEventInit& initializer) |
| + MIDIConnectionEvent(const AtomicString& type, const MIDIConnectionEventInit& initializer) |
| : Event(type, initializer) |
| - , m_receivedTime(initializer.receivedTime) |
| - , m_data(initializer.data) |
| + , m_port(initializer.port) |
| { |
| ScriptWrappable::init(this); |
| } |
| - double m_receivedTime; |
| - RefPtr<Uint8Array> m_data; |
| + RefPtr<MIDIPort> m_port; |
| }; |
| } // namespace WebCore |
| -#endif // MIDIMessageEvent_h |
| +#endif // MIDIConnectionEvent_h |