OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/v8/MIDIAccessResolver.h" | 6 #include "bindings/v8/MIDIAccessResolver.h" |
7 | 7 |
8 #include "bindings/v8/ScriptPromiseResolver.h" | 8 #include "bindings/v8/ScriptPromiseResolver.h" |
9 #include "bindings/v8/V8Binding.h" | 9 #include "bindings/v8/V8Binding.h" |
10 #include <v8.h> | 10 #include <v8.h> |
11 | 11 |
12 namespace WebCore { | 12 namespace WebCore { |
13 | 13 |
14 MIDIAccessResolver::MIDIAccessResolver(PassRefPtr<ScriptPromiseResolver> resolve
r, v8::Isolate* isolate) | 14 MIDIAccessResolver::MIDIAccessResolver(PassRefPtr<ScriptPromiseResolver> resolve
r, v8::Isolate* isolate) |
15 : m_resolver(resolver) | 15 : m_resolver(resolver) |
16 , m_world(DOMWrapperWorld::current(isolate)) | 16 , m_world(DOMWrapperWorld::current(isolate)) |
17 { | 17 { |
18 } | 18 } |
19 | 19 |
20 MIDIAccessResolver::~MIDIAccessResolver() | 20 MIDIAccessResolver::~MIDIAccessResolver() |
21 { | 21 { |
22 } | 22 } |
23 | 23 |
24 void MIDIAccessResolver::resolve(MIDIAccess* access, ExecutionContext* execution
Context) | 24 void MIDIAccessResolver::resolve(MIDIAccess* access, ExecutionContext* execution
Context) |
25 { | 25 { |
26 v8::HandleScope handleScope(toIsolate(executionContext)); | 26 v8::HandleScope handleScope(toIsolate(executionContext)); |
27 v8::Context::Scope contextScope(toV8Context(executionContext, m_world.get())
); | 27 v8::Context::Scope contextScope(toV8Context(executionContext, *m_world)); |
28 | 28 |
29 m_resolver->resolve(access, executionContext); | 29 m_resolver->resolve(access, executionContext); |
30 } | 30 } |
31 | 31 |
32 void MIDIAccessResolver::reject(DOMError* error, ExecutionContext* executionCont
ext) | 32 void MIDIAccessResolver::reject(DOMError* error, ExecutionContext* executionCont
ext) |
33 { | 33 { |
34 v8::HandleScope handleScope(toIsolate(executionContext)); | 34 v8::HandleScope handleScope(toIsolate(executionContext)); |
35 v8::Context::Scope contextScope(toV8Context(executionContext, m_world.get())
); | 35 v8::Context::Scope contextScope(toV8Context(executionContext, *m_world)); |
36 | 36 |
37 m_resolver->reject(error, executionContext); | 37 m_resolver->reject(error, executionContext); |
38 } | 38 } |
39 | 39 |
40 } // namespace WebCore | 40 } // namespace WebCore |
OLD | NEW |