| 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 "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/V8PerContextData.h" | 9 #include "bindings/core/v8/V8PerContextData.h" |
| 10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 static ScriptState* forMainWorld(LocalFrame*); | 67 static ScriptState* forMainWorld(LocalFrame*); |
| 68 | 68 |
| 69 v8::Isolate* isolate() const { return m_isolate; } | 69 v8::Isolate* isolate() const { return m_isolate; } |
| 70 DOMWrapperWorld& world() const { return *m_world; } | 70 DOMWrapperWorld& world() const { return *m_world; } |
| 71 LocalDOMWindow* domWindow() const; | 71 LocalDOMWindow* domWindow() const; |
| 72 virtual ExecutionContext* executionContext() const; | 72 virtual ExecutionContext* executionContext() const; |
| 73 virtual void setExecutionContext(ExecutionContext*); | 73 virtual void setExecutionContext(ExecutionContext*); |
| 74 | 74 |
| 75 // This can return an empty handle if the v8::Context is gone. | 75 // This can return an empty handle if the v8::Context is gone. |
| 76 v8::Handle<v8::Context> context() const { return m_context.newLocal(m_isolat
e); } | 76 v8::Handle<v8::Context> context() const { return m_context.newLocal(m_isolat
e); } |
| 77 bool contextIsValid() const { return m_context.isEmpty() || m_globalObjectDe
tached; } | 77 bool contextIsValid() const { return !m_context.isEmpty() && !m_globalObject
Detached; } |
| 78 void detachGlobalObject(); | 78 void detachGlobalObject(); |
| 79 void clearContext() { return m_context.clear(); } | 79 void clearContext() { return m_context.clear(); } |
| 80 | 80 |
| 81 V8PerContextData* perContextData() const { return m_perContextData.get(); } | 81 V8PerContextData* perContextData() const { return m_perContextData.get(); } |
| 82 void disposePerContextData() { m_perContextData = nullptr; } | 82 void disposePerContextData() { m_perContextData = nullptr; } |
| 83 | 83 |
| 84 bool evalEnabled() const; | 84 bool evalEnabled() const; |
| 85 void setEvalEnabled(bool); | 85 void setEvalEnabled(bool); |
| 86 ScriptValue getFromGlobalObject(const char* name); | 86 ScriptValue getFromGlobalObject(const char* name); |
| 87 | 87 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 RefPtr<ScriptState> m_scriptState; | 142 RefPtr<ScriptState> m_scriptState; |
| 143 ScopedPersistent<v8::Context> m_context; | 143 ScopedPersistent<v8::Context> m_context; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } | 146 } |
| 147 | 147 |
| 148 #endif // ScriptState_h | 148 #endif // ScriptState_h |
| OLD | NEW |