Chromium Code Reviews| Index: Source/modules/webmidi/MIDIInput.cpp |
| diff --git a/Source/modules/webmidi/MIDIInput.cpp b/Source/modules/webmidi/MIDIInput.cpp |
| index 45da45e39b8ac4e5cc3e3584de1e75edfc0726e7..41d17cf3aa706e00ae7f47b27e92c5ba7cbfcaf0 100644 |
| --- a/Source/modules/webmidi/MIDIInput.cpp |
| +++ b/Source/modules/webmidi/MIDIInput.cpp |
| @@ -50,6 +50,19 @@ MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufac |
| { |
| } |
| +EventListener* MIDIInput::onmidimessage() |
| +{ |
| + return getAttributeEventListener(EventTypeNames::midimessage); |
| +} |
| + |
| +void MIDIInput::setOnmidimessage(PassRefPtr<EventListener> listener) |
| +{ |
| + // Implicit open. It does nothing if the port is already opened. |
|
kouhei (in TOK)
2015/04/02 05:10:52
Please add a link to the spec for "spec" behaviour
Takashi Toyoshima
2015/04/02 05:25:41
Done.
|
| + open(); |
| + |
| + setAttributeEventListener(EventTypeNames::midimessage, listener); |
| +} |
| + |
| void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp) |
| { |
| ASSERT(isMainThread()); |
| @@ -57,6 +70,9 @@ void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data |
| if (!length) |
| return; |
| + if (getConnection() != ConnectionStateOpen) |
| + return; |
| + |
| // Drop sysex message here when the client does not request it. Note that this is not a security check but an |
| // automatic filtering for clients that do not want sysex message. Also note that sysex message will never be sent |
| // unless the current process has an explicit permission to handle sysex message. |