1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "bindings/v8/MIDIAccessResolver.h"
8 #include "bindings/v8/ScriptPromiseResolver.h"
9 #include "bindings/v8/V8Binding.h"
14 MIDIAccessResolver::MIDIAccessResolver(PassRefPtr<ScriptPromiseResolver> resolver, v8::Isolate* isolate)
15 : m_resolver(resolver)
16 , m_world(DOMWrapperWorld::current(isolate))
20 MIDIAccessResolver::~MIDIAccessResolver()
24 void MIDIAccessResolver::resolve(MIDIAccess* access, ExecutionContext* executionContext)
26 v8::HandleScope handleScope(toIsolate(executionContext));
27 v8::Context::Scope contextScope(toV8Context(executionContext, m_world.get()));
29 m_resolver->resolve(access, executionContext);
32 void MIDIAccessResolver::reject(DOMError* error, ExecutionContext* executionContext)
34 v8::HandleScope handleScope(toIsolate(executionContext));
35 v8::Context::Scope contextScope(toV8Context(executionContext, m_world.get()));
37 m_resolver->reject(error, executionContext);
40 } // namespace WebCore