| 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 #ifndef ScriptState_h | 5 #ifndef ScriptState_h |
| 6 #define ScriptState_h | 6 #define ScriptState_h |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "bindings/core/v8/ScopedPersistent.h" | 10 #include "bindings/core/v8/ScopedPersistent.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // ScriptState::from() must not be called for a context that does not have | 130 // ScriptState::from() must not be called for a context that does not have |
| 131 // valid embedder data in the embedder field. | 131 // valid embedder data in the embedder field. |
| 132 SECURITY_CHECK(scriptState); | 132 SECURITY_CHECK(scriptState); |
| 133 SECURITY_CHECK(scriptState->context() == context); | 133 SECURITY_CHECK(scriptState->context() == context); |
| 134 return scriptState; | 134 return scriptState; |
| 135 } | 135 } |
| 136 | 136 |
| 137 v8::Isolate* isolate() const { return m_isolate; } | 137 v8::Isolate* isolate() const { return m_isolate; } |
| 138 DOMWrapperWorld& world() const { return *m_world; } | 138 DOMWrapperWorld& world() const { return *m_world; } |
| 139 virtual ExecutionContext* getExecutionContext() const; | 139 virtual ExecutionContext* getExecutionContext() const; |
| 140 virtual void setExecutionContext(ExecutionContext*); | |
| 141 | 140 |
| 142 // This can return an empty handle if the v8::Context is gone. | 141 // This can return an empty handle if the v8::Context is gone. |
| 143 v8::Local<v8::Context> context() const { | 142 v8::Local<v8::Context> context() const { |
| 144 return m_context.newLocal(m_isolate); | 143 return m_context.newLocal(m_isolate); |
| 145 } | 144 } |
| 146 bool contextIsValid() const { | 145 bool contextIsValid() const { |
| 147 return !m_context.isEmpty() && m_perContextData; | 146 return !m_context.isEmpty() && m_perContextData; |
| 148 } | 147 } |
| 149 void detachGlobalObject(); | 148 void detachGlobalObject(); |
| 150 void clearContext() { return m_context.clear(); } | 149 void clearContext() { return m_context.clear(); } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 196 } |
| 198 | 197 |
| 199 private: | 198 private: |
| 200 RefPtr<ScriptState> m_scriptState; | 199 RefPtr<ScriptState> m_scriptState; |
| 201 ScopedPersistent<v8::Context> m_context; | 200 ScopedPersistent<v8::Context> m_context; |
| 202 }; | 201 }; |
| 203 | 202 |
| 204 } // namespace blink | 203 } // namespace blink |
| 205 | 204 |
| 206 #endif // ScriptState_h | 205 #endif // ScriptState_h |
| OLD | NEW |