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

Unified Diff: Source/modules/webmidi/MIDIInputMap.h

Issue 513203002: Introduce MIDIInputMap and MIDIOutputMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iterator-adhoc
Patch Set: Created 6 years, 4 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
Index: Source/modules/webmidi/MIDIInputMap.h
diff --git a/Source/modules/webmidi/MIDIInputMap.h b/Source/modules/webmidi/MIDIInputMap.h
new file mode 100644
index 0000000000000000000000000000000000000000..7da55c6c4b72bec1f848a587a99ff833a7d9ed97
--- /dev/null
+++ b/Source/modules/webmidi/MIDIInputMap.h
@@ -0,0 +1,31 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MIDIInputMap_h
+#define MIDIInputMap_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "modules/webmidi/MIDIInput.h"
+#include "modules/webmidi/MIDIPortMap.h"
+
+namespace blink {
+
+class MIDIInputMap : public MIDIPortMap<MIDIInput>, public ScriptWrappable {
+public:
+ MIDIInputMap(const HeapHashMap<String, Member<MIDIInput> >map)
+ : MIDIPortMap<MIDIInput>(map) { ScriptWrappable::init(this); }
+
+ ScriptValue getForBinding(ScriptState* scriptState, const String& id)
+ {
+ MIDIInput* result = get(id);
+ if (result)
+ return ScriptValue(scriptState, V8ValueTraits<MIDIInput*>::toV8Value(result, scriptState->context()->Global(), scriptState->isolate()));
haraken 2014/08/31 07:18:57 You can add MIDIInputMap.cpp and use toV8.
yhirano 2014/09/01 02:22:10 Done.
+ return ScriptValue(scriptState, v8::Undefined(scriptState->isolate()));
+ }
+};
+
+} // namespace blink
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698