OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015 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. | |
4 | |
5 #include "config.h" | |
6 #include "bindings/core/v8/V8TestingScope.h" | |
7 | |
8 #include "bindings/core/v8/DOMWrapperWorld.h" | |
9 | |
10 namespace blink { | |
11 | |
12 V8TestingScope::V8TestingScope(v8::Isolate* isolate) | |
13 : m_handleScope(isolate) | |
14 , m_contextScope(v8::Context::New(isolate)) | |
15 // We reuse the main world since the main world is guaranteed to be register
ed to ScriptController. | |
16 , m_scriptState(ScriptStateForTesting::create(isolate->GetCurrentContext(),
&DOMWrapperWorld::mainWorld())) | |
17 { | |
18 } | |
19 | |
20 V8TestingScope::~V8TestingScope() | |
21 { | |
22 m_scriptState->disposePerContextData(); | |
23 } | |
24 | |
25 ScriptState* V8TestingScope::scriptState() const | |
26 { | |
27 return m_scriptState.get(); | |
28 } | |
29 | |
30 v8::Isolate* V8TestingScope::isolate() const | |
31 { | |
32 return m_scriptState->isolate(); | |
33 } | |
34 | |
35 } // namespace blink | |
OLD | NEW |