summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp')
-rw-r--r--third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp56
1 files changed, 10 insertions, 46 deletions
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
index 5e05ccc..e9066f0 100644
--- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp
@@ -31,66 +31,30 @@
#include "config.h"
#include "modules/webmidi/MIDIOutput.h"
-#include "core/dom/ExceptionCode.h"
-#include "modules/webmidi/MIDIAccess.h"
-
namespace WebCore {
-PassRefPtr<MIDIOutput> MIDIOutput::create(MIDIAccess* access, unsigned portIndex, ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
+PassRefPtr<MIDIOutput> MIDIOutput::create(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
{
- return adoptRef(new MIDIOutput(access, portIndex, context, id, manufacturer, name, version));
+ return adoptRef(new MIDIOutput(context, id, manufacturer, name, version));
}
-MIDIOutput::MIDIOutput(MIDIAccess* access, unsigned portIndex, ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
+MIDIOutput::MIDIOutput(ScriptExecutionContext* context, const String& id, const String& manufacturer, const String& name, const String& version)
: MIDIPort(context, id, manufacturer, name, MIDIPortTypeOutput, version)
- , m_access(access)
- , m_portIndex(portIndex)
{
ScriptWrappable::init(this);
}
-void MIDIOutput::send(Uint8Array* array, double timestamp, ExceptionCode& ec)
-{
- if (!array)
- return;
-
- const unsigned char* data = array->data();
- size_t length = array->length();
-
- // Filter out System Exclusive messages if we're not allowed.
- // FIXME: implement more extensive filtering.
- if (length > 0 && data[0] >= 0xf0 && !m_access->sysExEnabled()) {
- ec = SecurityError;
- return;
- }
-
- m_access->sendMIDIData(m_portIndex, data, length, timestamp);
-}
-
-void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, ExceptionCode& ec)
-{
- RefPtr<Uint8Array> array = Uint8Array::create(unsignedData.size());
-
- for (size_t i = 0; i < unsignedData.size(); ++i) {
- if (unsignedData[i] > 0xff) {
- ec = InvalidStateError;
- return;
- }
- unsigned char value = unsignedData[i] & 0xff;
- array->set(i, value);
- }
-
- send(array.get(), timestamp, ec);
-}
-
-void MIDIOutput::send(Uint8Array* data, ExceptionCode& ec)
+void MIDIOutput::send(Uint8Array* data, double timestamp)
{
- send(data, 0, ec);
+ // FIXME: Implement MIDI protocol validation here. System exclusive
+ // messages must be checked at the same time.
+ // Actual sending operation will be implemented in core/platform/midi.
}
-void MIDIOutput::send(Vector<unsigned> unsignedData, ExceptionCode& ec)
+void MIDIOutput::send(Vector<unsigned>, double timestamp)
{
- send(unsignedData, 0, ec);
+ // FIXME: Ditto. Implementation will be shared between these two send
+ // functions.
}
} // namespace WebCore