Chromium Code Reviews| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 v8ContextPerContextDataIndex)); | 131 v8ContextPerContextDataIndex)); |
| 132 // ScriptState::from() must not be called for a context that does not have | 132 // ScriptState::from() must not be called for a context that does not have |
| 133 // valid embedder data in the embedder field. | 133 // valid embedder data in the embedder field. |
| 134 SECURITY_CHECK(scriptState); | 134 SECURITY_CHECK(scriptState); |
| 135 SECURITY_CHECK(scriptState->context() == context); | 135 SECURITY_CHECK(scriptState->context() == context); |
| 136 return scriptState; | 136 return scriptState; |
| 137 } | 137 } |
| 138 | 138 |
| 139 // These methods can return nullptr if the context associated with the | 139 // These methods can return nullptr if the context associated with the |
| 140 // ScriptState has already been detached. | 140 // ScriptState has already been detached. |
| 141 | |
| 142 // DEPRECATED: Use toScriptStateForMainWorld. | |
|
jbroman
2017/04/04 01:16:28
nit: make the implementations of these use toScrip
adithyas
2017/04/04 14:22:42
Done.
| |
| 141 static ScriptState* forMainWorld(LocalFrame*); | 143 static ScriptState* forMainWorld(LocalFrame*); |
| 144 // DEPRECATED: Use toScriptState. | |
| 142 static ScriptState* forWorld(LocalFrame*, DOMWrapperWorld&); | 145 static ScriptState* forWorld(LocalFrame*, DOMWrapperWorld&); |
| 143 | 146 |
| 144 v8::Isolate* isolate() const { return m_isolate; } | 147 v8::Isolate* isolate() const { return m_isolate; } |
| 145 DOMWrapperWorld& world() const { return *m_world; } | 148 DOMWrapperWorld& world() const { return *m_world; } |
| 146 LocalDOMWindow* domWindow() const; | 149 LocalDOMWindow* domWindow() const; |
| 147 virtual ExecutionContext* getExecutionContext() const; | 150 virtual ExecutionContext* getExecutionContext() const; |
| 148 virtual void setExecutionContext(ExecutionContext*); | 151 virtual void setExecutionContext(ExecutionContext*); |
| 149 | 152 |
| 150 // This can return an empty handle if the v8::Context is gone. | 153 // This can return an empty handle if the v8::Context is gone. |
| 151 v8::Local<v8::Context> context() const { | 154 v8::Local<v8::Context> context() const { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 } | 208 } |
| 206 | 209 |
| 207 private: | 210 private: |
| 208 RefPtr<ScriptState> m_scriptState; | 211 RefPtr<ScriptState> m_scriptState; |
| 209 ScopedPersistent<v8::Context> m_context; | 212 ScopedPersistent<v8::Context> m_context; |
| 210 }; | 213 }; |
| 211 | 214 |
| 212 } // namespace blink | 215 } // namespace blink |
| 213 | 216 |
| 214 #endif // ScriptState_h | 217 #endif // ScriptState_h |
| OLD | NEW |