| 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" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void ScriptState::setExecutionContext(ExecutionContext*) { | 75 void ScriptState::setExecutionContext(ExecutionContext*) { |
| 76 ASSERT_NOT_REACHED(); | 76 ASSERT_NOT_REACHED(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 LocalDOMWindow* ScriptState::domWindow() const { | 79 LocalDOMWindow* ScriptState::domWindow() const { |
| 80 v8::HandleScope scope(m_isolate); | 80 v8::HandleScope scope(m_isolate); |
| 81 return toLocalDOMWindow(context()); | 81 return toLocalDOMWindow(context()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) { | 84 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) { |
| 85 return ScriptState::forWorld(frame, DOMWrapperWorld::mainWorld()); | 85 return toScriptStateForMainWorld(frame); |
| 86 } | 86 } |
| 87 | 87 |
| 88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { | 88 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) { |
| 89 ASSERT(frame); | 89 return toScriptState(frame, world); |
| 90 v8::HandleScope handleScope(toIsolate(frame)); | |
| 91 v8::Local<v8::Context> context = toV8Context(frame, world); | |
| 92 if (context.IsEmpty()) | |
| 93 return nullptr; | |
| 94 ScriptState* scriptState = ScriptState::from(context); | |
| 95 ASSERT(scriptState->contextIsValid()); | |
| 96 return scriptState; | |
| 97 } | 90 } |
| 98 | 91 |
| 99 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |