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 "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
12 #include "wtf/Vector.h" | |
13 #include <v8-debug.h> | 12 #include <v8-debug.h> |
14 #include <v8.h> | 13 #include <v8.h> |
15 | 14 |
16 namespace blink { | 15 namespace blink { |
17 | 16 |
18 class LocalDOMWindow; | 17 class LocalDOMWindow; |
19 class DOMWrapperWorld; | 18 class DOMWrapperWorld; |
20 class ExecutionContext; | 19 class ExecutionContext; |
21 class LocalFrame; | 20 class LocalFrame; |
22 class ScriptValue; | 21 class ScriptValue; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bool contextIsValid() const { return !m_context.isEmpty() && m_perContextDat
a; } | 95 bool contextIsValid() const { return !m_context.isEmpty() && m_perContextDat
a; } |
97 void detachGlobalObject(); | 96 void detachGlobalObject(); |
98 void clearContext() { return m_context.clear(); } | 97 void clearContext() { return m_context.clear(); } |
99 #if ENABLE(ASSERT) | 98 #if ENABLE(ASSERT) |
100 bool isGlobalObjectDetached() const { return m_globalObjectDetached; } | 99 bool isGlobalObjectDetached() const { return m_globalObjectDetached; } |
101 #endif | 100 #endif |
102 | 101 |
103 V8PerContextData* perContextData() const { return m_perContextData.get(); } | 102 V8PerContextData* perContextData() const { return m_perContextData.get(); } |
104 void disposePerContextData(); | 103 void disposePerContextData(); |
105 | 104 |
106 bool evalEnabled() const; | |
107 void setEvalEnabled(bool); | |
108 ScriptValue getFromGlobalObject(const char* name); | |
109 ScriptValue getFromExtrasExports(const char* name); | 105 ScriptValue getFromExtrasExports(const char* name); |
110 | 106 |
111 protected: | 107 protected: |
112 ScriptState(v8::Local<v8::Context>, PassRefPtr<DOMWrapperWorld>); | 108 ScriptState(v8::Local<v8::Context>, PassRefPtr<DOMWrapperWorld>); |
113 | 109 |
114 private: | 110 private: |
115 v8::Isolate* m_isolate; | 111 v8::Isolate* m_isolate; |
116 // This persistent handle is weak. | 112 // This persistent handle is weak. |
117 ScopedPersistent<v8::Context> m_context; | 113 ScopedPersistent<v8::Context> m_context; |
118 | 114 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 } | 148 } |
153 | 149 |
154 private: | 150 private: |
155 RefPtr<ScriptState> m_scriptState; | 151 RefPtr<ScriptState> m_scriptState; |
156 ScopedPersistent<v8::Context> m_context; | 152 ScopedPersistent<v8::Context> m_context; |
157 }; | 153 }; |
158 | 154 |
159 } // namespace blink | 155 } // namespace blink |
160 | 156 |
161 #endif // ScriptState_h | 157 #endif // ScriptState_h |
OLD | NEW |