OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 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 | 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 "bindings/core/v8/V8BindingForTesting.h" | 5 #include "bindings/core/v8/V8BindingForTesting.h" |
6 | 6 |
7 #include "core/frame/Settings.h" | 7 #include "core/frame/Settings.h" |
8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create( | 12 PassRefPtr<ScriptStateForTesting> ScriptStateForTesting::create( |
13 v8::Local<v8::Context> context, | 13 v8::Local<v8::Context> context, |
14 PassRefPtr<DOMWrapperWorld> world) { | 14 PassRefPtr<DOMWrapperWorld> world) { |
15 RefPtr<ScriptStateForTesting> scriptState = | 15 RefPtr<ScriptStateForTesting> scriptState = |
16 adoptRef(new ScriptStateForTesting(context, world)); | 16 adoptRef(new ScriptStateForTesting(context, world)); |
17 // This ref() is for keeping this ScriptState alive as long as the v8::Context
is alive. | 17 // This ref() is for keeping this ScriptState alive as long as the v8::Context |
18 // This is deref()ed in the weak callback of the v8::Context. | 18 // is alive. This is deref()ed in the weak callback of the v8::Context. |
19 scriptState->ref(); | 19 scriptState->ref(); |
20 return scriptState; | 20 return scriptState; |
21 } | 21 } |
22 | 22 |
23 ScriptStateForTesting::ScriptStateForTesting(v8::Local<v8::Context> context, | 23 ScriptStateForTesting::ScriptStateForTesting(v8::Local<v8::Context> context, |
24 PassRefPtr<DOMWrapperWorld> world) | 24 PassRefPtr<DOMWrapperWorld> world) |
25 : ScriptState(context, world) {} | 25 : ScriptState(context, world) {} |
26 | 26 |
27 ExecutionContext* ScriptStateForTesting::getExecutionContext() const { | 27 ExecutionContext* ScriptStateForTesting::getExecutionContext() const { |
28 return m_executionContext; | 28 return m_executionContext; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // TODO(yukishiino): We put this statement here to clear an exception from | 78 // TODO(yukishiino): We put this statement here to clear an exception from |
79 // the isolate. Otherwise, the leak detector complains. Really mysterious | 79 // the isolate. Otherwise, the leak detector complains. Really mysterious |
80 // hack. | 80 // hack. |
81 v8::Function::New(context(), nullptr); | 81 v8::Function::New(context(), nullptr); |
82 | 82 |
83 if (m_holder->document().frame()) | 83 if (m_holder->document().frame()) |
84 getScriptState()->disposePerContextData(); | 84 getScriptState()->disposePerContextData(); |
85 } | 85 } |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
OLD | NEW |