summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp b/chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp
index 748b844e226..10ed596fd29 100644
--- a/chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp
+++ b/chromium/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp
@@ -33,20 +33,19 @@
#include "modules/webmidi/MIDIAccess.h"
#include "modules/webmidi/MIDIMessageEvent.h"
+#include "platform/heap/Handle.h"
namespace WebCore {
-PassRefPtr<MIDIInput> MIDIInput::create(MIDIAccess* access, ExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
+PassRefPtrWillBeRawPtr<MIDIInput> MIDIInput::create(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version)
{
ASSERT(access);
- RefPtr<MIDIInput> input = adoptRef(new MIDIInput(access, context, id, manufacturer, name, version));
- input->suspendIfNeeded();
+ RefPtrWillBeRawPtr<MIDIInput> input = adoptRefWillBeRefCountedGarbageCollected(new MIDIInput(access, id, manufacturer, name, version));
return input.release();
}
-MIDIInput::MIDIInput(MIDIAccess* access, ExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
- : MIDIPort(context, id, manufacturer, name, MIDIPortTypeInput, version)
- , m_access(access)
+MIDIInput::MIDIInput(MIDIAccess* access, const String& id, const String& manufacturer, const String& name, const String& version)
+ : MIDIPort(access, id, manufacturer, name, MIDIPortTypeInput, version)
{
ScriptWrappable::init(this);
}
@@ -58,13 +57,18 @@ void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data
if (!length)
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.
- if (data[0] == 0xf0 && !m_access->sysExEnabled())
+ // 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.
+ if (data[0] == 0xf0 && !midiAccess()->sysexEnabled())
return;
RefPtr<Uint8Array> array = Uint8Array::create(data, length);
dispatchEvent(MIDIMessageEvent::create(timeStamp, array));
}
+void MIDIInput::trace(Visitor* visitor)
+{
+ MIDIPort::trace(visitor);
+}
+
} // namespace WebCore