| 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/core/v8/ScriptState.h" | 6 #include "bindings/core/v8/ScriptState.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
| 9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
| 10 #include "core/frame/LocalDOMWindow.h" | 10 #include "core/frame/LocalDOMWindow.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 ScriptValue ScriptState::getFromGlobalObject(const char* name) | 96 ScriptValue ScriptState::getFromGlobalObject(const char* name) |
| 97 { | 97 { |
| 98 v8::HandleScope handleScope(m_isolate); | 98 v8::HandleScope handleScope(m_isolate); |
| 99 v8::Local<v8::Value> v8Value; | 99 v8::Local<v8::Value> v8Value; |
| 100 if (!context()->Global()->Get(context(), v8AtomicString(isolate(), name)).To
Local(&v8Value)) | 100 if (!context()->Global()->Get(context(), v8AtomicString(isolate(), name)).To
Local(&v8Value)) |
| 101 return ScriptValue(); | 101 return ScriptValue(); |
| 102 return ScriptValue(this, v8Value); | 102 return ScriptValue(this, v8Value); |
| 103 } | 103 } |
| 104 | 104 |
| 105 ScriptValue ScriptState::getFromExtrasExports(const char* name) |
| 106 { |
| 107 v8::HandleScope handleScope(m_isolate); |
| 108 v8::Local<v8::Value> v8Value; |
| 109 if (!context()->GetExtrasExportsObject()->Get(context(), v8AtomicString(isol
ate(), name)).ToLocal(&v8Value)) |
| 110 return ScriptValue(); |
| 111 return ScriptValue(this, v8Value); |
| 112 } |
| 113 |
| 105 ExecutionContext* ScriptState::executionContext() const | 114 ExecutionContext* ScriptState::executionContext() const |
| 106 { | 115 { |
| 107 v8::HandleScope scope(m_isolate); | 116 v8::HandleScope scope(m_isolate); |
| 108 return toExecutionContext(context()); | 117 return toExecutionContext(context()); |
| 109 } | 118 } |
| 110 | 119 |
| 111 void ScriptState::setExecutionContext(ExecutionContext*) | 120 void ScriptState::setExecutionContext(ExecutionContext*) |
| 112 { | 121 { |
| 113 ASSERT_NOT_REACHED(); | 122 ASSERT_NOT_REACHED(); |
| 114 } | 123 } |
| 115 | 124 |
| 116 LocalDOMWindow* ScriptState::domWindow() const | 125 LocalDOMWindow* ScriptState::domWindow() const |
| 117 { | 126 { |
| 118 v8::HandleScope scope(m_isolate); | 127 v8::HandleScope scope(m_isolate); |
| 119 return toLocalDOMWindow(toDOMWindow(context())); | 128 return toLocalDOMWindow(toDOMWindow(context())); |
| 120 } | 129 } |
| 121 | 130 |
| 122 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) | 131 ScriptState* ScriptState::forMainWorld(LocalFrame* frame) |
| 123 { | 132 { |
| 124 v8::Isolate* isolate = toIsolate(frame); | 133 v8::Isolate* isolate = toIsolate(frame); |
| 125 v8::HandleScope handleScope(isolate); | 134 v8::HandleScope handleScope(isolate); |
| 126 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld())); | 135 return ScriptState::from(toV8Context(frame, DOMWrapperWorld::mainWorld())); |
| 127 } | 136 } |
| 128 | 137 |
| 129 } | 138 } |
| OLD | NEW |