| 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 "bindings/core/v8/ScriptState.h" | 5 #include "bindings/core/v8/ScriptState.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
| 9 #include "core/frame/LocalDOMWindow.h" | 9 #include "core/frame/LocalDOMWindow.h" |
| 10 #include "core/frame/LocalFrame.h" | |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 | 12 |
| 14 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context, | 13 PassRefPtr<ScriptState> ScriptState::create(v8::Local<v8::Context> context, |
| 15 PassRefPtr<DOMWrapperWorld> world) { | 14 PassRefPtr<DOMWrapperWorld> world) { |
| 16 RefPtr<ScriptState> scriptState = | 15 RefPtr<ScriptState> scriptState = |
| 17 adoptRef(new ScriptState(context, std::move(world))); | 16 adoptRef(new ScriptState(context, std::move(world))); |
| 18 // This ref() is for keeping this ScriptState alive as long as the v8::Context | 17 // This ref() is for keeping this ScriptState alive as long as the v8::Context |
| 19 // is alive. 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. |
| 20 scriptState->ref(); | 19 scriptState->ref(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 73 |
| 75 void ScriptState::setExecutionContext(ExecutionContext*) { | 74 void ScriptState::setExecutionContext(ExecutionContext*) { |
| 76 ASSERT_NOT_REACHED(); | 75 ASSERT_NOT_REACHED(); |
| 77 } | 76 } |
| 78 | 77 |
| 79 LocalDOMWindow* ScriptState::domWindow() const { | 78 LocalDOMWindow* ScriptState::domWindow() const { |
| 80 v8::HandleScope scope(m_isolate); | 79 v8::HandleScope scope(m_isolate); |
| 81 return toLocalDOMWindow(context()); | 80 return toLocalDOMWindow(context()); |
| 82 } | 81 } |
| 83 | 82 |
| 84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) { | |
| 85 return toScriptStateForMainWorld(frame); | |
| 86 } | |
| 87 | |
| 88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { | |
| 89 return toScriptState(frame, world); | |
| 90 } | |
| 91 | |
| 92 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |