OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); | 64 return static_cast<V8PerIsolateData*>(isolate->GetData(gin::kEmbedderBli
nk)); |
65 } | 65 } |
66 | 66 |
67 static void willBeDestroyed(v8::Isolate*); | 67 static void willBeDestroyed(v8::Isolate*); |
68 static void destroy(v8::Isolate*); | 68 static void destroy(v8::Isolate*); |
69 static v8::Isolate* mainThreadIsolate(); | 69 static v8::Isolate* mainThreadIsolate(); |
70 | 70 |
71 bool destructionPending() const { return m_destructionPending; } | 71 bool destructionPending() const { return m_destructionPending; } |
72 v8::Isolate* isolate() { return m_isolateHolder->isolate(); } | 72 v8::Isolate* isolate() { return m_isolateHolder->isolate(); } |
73 | 73 |
74 v8::Handle<v8::FunctionTemplate> toStringTemplate(); | 74 v8::Local<v8::FunctionTemplate> toStringTemplate(); |
75 | 75 |
76 StringCache* stringCache() { return m_stringCache.get(); } | 76 StringCache* stringCache() { return m_stringCache.get(); } |
77 | 77 |
78 v8::Persistent<v8::Value>& ensureLiveRoot(); | 78 v8::Persistent<v8::Value>& ensureLiveRoot(); |
79 | 79 |
80 int recursionLevel() const { return m_recursionLevel; } | 80 int recursionLevel() const { return m_recursionLevel; } |
81 int incrementRecursionLevel() { return ++m_recursionLevel; } | 81 int incrementRecursionLevel() { return ++m_recursionLevel; } |
82 int decrementRecursionLevel() { return --m_recursionLevel; } | 82 int decrementRecursionLevel() { return --m_recursionLevel; } |
83 bool isHandlingRecursionLevelError() const { return m_isHandlingRecursionLev
elError; } | 83 bool isHandlingRecursionLevelError() const { return m_isHandlingRecursionLev
elError; } |
84 void setIsHandlingRecursionLevelError(bool value) { m_isHandlingRecursionLev
elError = value; } | 84 void setIsHandlingRecursionLevelError(bool value) { m_isHandlingRecursionLev
elError = value; } |
85 | 85 |
86 bool isReportingException() const { return m_isReportingException; } | 86 bool isReportingException() const { return m_isReportingException; } |
87 void setReportingException(bool value) { m_isReportingException = value; } | 87 void setReportingException(bool value) { m_isReportingException = value; } |
88 | 88 |
89 bool performingMicrotaskCheckpoint() const { return m_performingMicrotaskChe
ckpoint; } | 89 bool performingMicrotaskCheckpoint() const { return m_performingMicrotaskChe
ckpoint; } |
90 void setPerformingMicrotaskCheckpoint(bool performingMicrotaskCheckpoint) {
m_performingMicrotaskCheckpoint = performingMicrotaskCheckpoint; } | 90 void setPerformingMicrotaskCheckpoint(bool performingMicrotaskCheckpoint) {
m_performingMicrotaskCheckpoint = performingMicrotaskCheckpoint; } |
91 | 91 |
92 #if ENABLE(ASSERT) | 92 #if ENABLE(ASSERT) |
93 int internalScriptRecursionLevel() const { return m_internalScriptRecursionL
evel; } | 93 int internalScriptRecursionLevel() const { return m_internalScriptRecursionL
evel; } |
94 int incrementInternalScriptRecursionLevel() { return ++m_internalScriptRecur
sionLevel; } | 94 int incrementInternalScriptRecursionLevel() { return ++m_internalScriptRecur
sionLevel; } |
95 int decrementInternalScriptRecursionLevel() { return --m_internalScriptRecur
sionLevel; } | 95 int decrementInternalScriptRecursionLevel() { return --m_internalScriptRecur
sionLevel; } |
96 #endif | 96 #endif |
97 | 97 |
98 V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); } | 98 V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); } |
99 | 99 |
100 v8::Handle<v8::FunctionTemplate> domTemplate(const void* domTemplateKey, v8:
:FunctionCallback = 0, v8::Handle<v8::Value> data = v8::Handle<v8::Value>(), v8:
:Handle<v8::Signature> = v8::Handle<v8::Signature>(), int length = 0); | 100 v8::Local<v8::FunctionTemplate> domTemplate(const void* domTemplateKey, v8::
FunctionCallback = 0, v8::Local<v8::Value> data = v8::Local<v8::Value>(), v8::Lo
cal<v8::Signature> = v8::Local<v8::Signature>(), int length = 0); |
101 v8::Handle<v8::FunctionTemplate> existingDOMTemplate(const void* domTemplate
Key); | 101 v8::Local<v8::FunctionTemplate> existingDOMTemplate(const void* domTemplateK
ey); |
102 void setDOMTemplate(const void* domTemplateKey, v8::Handle<v8::FunctionTempl
ate>); | 102 void setDOMTemplate(const void* domTemplateKey, v8::Local<v8::FunctionTempla
te>); |
103 | 103 |
104 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Handle<v8::Value>); | 104 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>); |
105 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>); | 105 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>); |
106 | 106 |
107 v8::Local<v8::Context> ensureScriptRegexpContext(); | 107 v8::Local<v8::Context> ensureScriptRegexpContext(); |
108 | 108 |
109 const char* previousSamplingState() const { return m_previousSamplingState;
} | 109 const char* previousSamplingState() const { return m_previousSamplingState;
} |
110 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } | 110 void setPreviousSamplingState(const char* name) { m_previousSamplingState =
name; } |
111 | 111 |
112 // EndOfScopeTasks are run by V8RecursionScope when control is returning | 112 // EndOfScopeTasks are run by V8RecursionScope when control is returning |
113 // to C++ from script, after executing a script task (e.g. callback, | 113 // to C++ from script, after executing a script task (e.g. callback, |
114 // event) or microtasks (e.g. promise). This is explicitly needed for | 114 // event) or microtasks (e.g. promise). This is explicitly needed for |
115 // Indexed DB transactions per spec, but should in general be avoided. | 115 // Indexed DB transactions per spec, but should in general be avoided. |
116 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); | 116 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); |
117 void runEndOfScopeTasks(); | 117 void runEndOfScopeTasks(); |
118 void clearEndOfScopeTasks(); | 118 void clearEndOfScopeTasks(); |
119 | 119 |
120 void setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugServer>); | 120 void setScriptDebugServer(PassOwnPtrWillBeRawPtr<ScriptDebugServer>); |
121 | 121 |
122 private: | 122 private: |
123 V8PerIsolateData(); | 123 V8PerIsolateData(); |
124 ~V8PerIsolateData(); | 124 ~V8PerIsolateData(); |
125 | 125 |
126 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> DOMTemplateM
ap; | 126 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> DOMTemplateM
ap; |
127 DOMTemplateMap& currentDOMTemplateMap(); | 127 DOMTemplateMap& currentDOMTemplateMap(); |
128 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Handle<v8::Value>, DO
MTemplateMap&); | 128 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, DOM
TemplateMap&); |
129 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>, DOMTemplateMap&); | 129 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>, DOMTemplateMap&); |
130 | 130 |
131 bool m_destructionPending; | 131 bool m_destructionPending; |
132 OwnPtr<gin::IsolateHolder> m_isolateHolder; | 132 OwnPtr<gin::IsolateHolder> m_isolateHolder; |
133 DOMTemplateMap m_domTemplateMapForMainWorld; | 133 DOMTemplateMap m_domTemplateMapForMainWorld; |
134 DOMTemplateMap m_domTemplateMapForNonMainWorld; | 134 DOMTemplateMap m_domTemplateMapForNonMainWorld; |
135 ScopedPersistent<v8::FunctionTemplate> m_toStringTemplate; | 135 ScopedPersistent<v8::FunctionTemplate> m_toStringTemplate; |
136 OwnPtr<StringCache> m_stringCache; | 136 OwnPtr<StringCache> m_stringCache; |
137 OwnPtr<V8HiddenValue> m_hiddenValue; | 137 OwnPtr<V8HiddenValue> m_hiddenValue; |
138 ScopedPersistent<v8::Value> m_liveRoot; | 138 ScopedPersistent<v8::Value> m_liveRoot; |
(...skipping 17 matching lines...) Expand all Loading... |
156 #if ENABLE(OILPAN) | 156 #if ENABLE(OILPAN) |
157 CrossThreadPersistent<ScriptDebugServer> m_debugServer; | 157 CrossThreadPersistent<ScriptDebugServer> m_debugServer; |
158 #else | 158 #else |
159 OwnPtr<ScriptDebugServer> m_debugServer; | 159 OwnPtr<ScriptDebugServer> m_debugServer; |
160 #endif | 160 #endif |
161 }; | 161 }; |
162 | 162 |
163 } // namespace blink | 163 } // namespace blink |
164 | 164 |
165 #endif // V8PerIsolateData_h | 165 #endif // V8PerIsolateData_h |
OLD | NEW |