Chromium Code Reviews| Index: Source/modules/webmidi/MIDIOutputMap.h |
| diff --git a/Source/modules/webmidi/MIDIOutputMap.h b/Source/modules/webmidi/MIDIOutputMap.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..060ece3ac0649bd4c74d5c27c15e62db73b471a4 |
| --- /dev/null |
| +++ b/Source/modules/webmidi/MIDIOutputMap.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 MIDIOutputMap_h |
| +#define MIDIOutputMap_h |
| + |
| +#include "bindings/core/v8/ScriptWrappable.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| +#include "modules/webmidi/MIDIOutput.h" |
| +#include "modules/webmidi/MIDIPortMap.h" |
| + |
| +namespace blink { |
| + |
| +class MIDIOutputMap : public MIDIPortMap<MIDIOutput>, public ScriptWrappable { |
| +public: |
| + MIDIOutputMap(HeapHashMap<String, Member<MIDIOutput> > map) |
| + : MIDIPortMap<MIDIOutput>(map) { ScriptWrappable::init(this); } |
| + |
| + ScriptValue getPublic(ScriptState* scriptState, const String& id) |
| + { |
| + MIDIOutput* result = get(id); |
| + if (result) |
| + return ScriptValue(scriptState, V8ValueTraits<MIDIOutput*>::toV8Value(result, scriptState->context()->Global(), scriptState->isolate())); |
|
haraken
2014/08/29 06:19:42
Why can't we just call toV8() instead of V8ValueTr
yhirano
2014/08/29 07:29:13
That's because we don't include V8MIDIOutput.h.
I
yhirano
2014/08/29 07:31:50
Sorry for the poor English. I meant "Because we do
haraken
2014/08/31 07:18:57
It's confusing to have multiple ways to convert a
yhirano
2014/09/01 02:22:10
OK, I understand including bindings/{core, modules
haraken
2014/09/01 07:17:47
That's technically possible, but in what cases do
yhirano
2014/09/01 07:31:35
I am reviewing a CL doing it and I want to underst
|
| + return ScriptValue(scriptState, v8::Undefined(scriptState->isolate())); |
| + } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif |