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 } |
(...skipping 11 matching lines...) Expand all Loading... |
126 | 135 |
127 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) | 136 ScriptState* ScriptState::forWorld(LocalFrame* frame, DOMWrapperWorld& world) |
128 { | 137 { |
129 ASSERT(frame); | 138 ASSERT(frame); |
130 v8::Isolate* isolate = toIsolate(frame); | 139 v8::Isolate* isolate = toIsolate(frame); |
131 v8::HandleScope handleScope(isolate); | 140 v8::HandleScope handleScope(isolate); |
132 return ScriptState::from(toV8ContextEvenIfDetached(frame, world)); | 141 return ScriptState::from(toV8ContextEvenIfDetached(frame, world)); |
133 } | 142 } |
134 | 143 |
135 } | 144 } |
OLD | NEW |