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

Unified Diff: Source/modules/webmidi/MIDIInput.cpp

Issue 17619003: Fulfill or reject MIDIAccessPromise from MIDIAccessor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move layout test from fast/webmidi to webmidi Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webmidi/MIDIInput.h ('k') | Source/modules/webmidi/MIDIMessageEvent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webmidi/MIDIInput.cpp
diff --git a/Source/modules/webmidi/MIDIInput.cpp b/Source/modules/webmidi/MIDIInput.cpp
index 606d21c3cf41cdd1a59d310897208530fa5939e7..a5dee099588ff1cf228b26c9234b4e538f9e97da 100644
--- a/Source/modules/webmidi/MIDIInput.cpp
+++ b/Source/modules/webmidi/MIDIInput.cpp
@@ -30,6 +30,7 @@
#include "config.h"
#include "modules/webmidi/MIDIInput.h"
+#include "modules/webmidi/MIDIMessageEvent.h"
namespace WebCore {
@@ -44,4 +45,14 @@ MIDIInput::MIDIInput(ScriptExecutionContext* context, const String& id, const St
ScriptWrappable::init(this);
}
+void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_t length, double timeStamp)
+{
+ ASSERT(isMainThread());
+
+ RefPtr<Uint8Array> array = Uint8Array::create(length);
+ array->setRange(data, length, 0);
+
+ dispatchEvent(MIDIMessageEvent::create(timeStamp, array));
+}
+
} // namespace WebCore
« no previous file with comments | « Source/modules/webmidi/MIDIInput.h ('k') | Source/modules/webmidi/MIDIMessageEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698