| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 ~UseCounterDisabledScope() { | 84 ~UseCounterDisabledScope() { |
| 85 m_perIsolateData->m_useCounterDisabled = m_originalUseCounterDisabled; | 85 m_perIsolateData->m_useCounterDisabled = m_originalUseCounterDisabled; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 V8PerIsolateData* m_perIsolateData; | 89 V8PerIsolateData* m_perIsolateData; |
| 90 const bool m_originalUseCounterDisabled; | 90 const bool m_originalUseCounterDisabled; |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 class EntryRealmScope { |
| 94 STACK_ALLOCATED(); |
| 95 |
| 96 public: |
| 97 explicit EntryRealmScope(V8PerIsolateData* perIsolateData, |
| 98 v8::Local<v8::Context> entryContext) |
| 99 : m_perIsolateData(perIsolateData), |
| 100 m_previousEntryContext(m_perIsolateData->m_entryContext) { |
| 101 m_perIsolateData->m_entryContext = entryContext; |
| 102 } |
| 103 ~EntryRealmScope() { |
| 104 m_perIsolateData->m_entryContext = m_previousEntryContext; |
| 105 } |
| 106 |
| 107 private: |
| 108 V8PerIsolateData* m_perIsolateData; |
| 109 v8::Local<v8::Context> m_previousEntryContext; |
| 110 }; |
| 111 |
| 93 // Use this class to abstract away types of members that are pointers to core/ | 112 // Use this class to abstract away types of members that are pointers to core/ |
| 94 // objects, which are simply owned and released by V8PerIsolateData (see | 113 // objects, which are simply owned and released by V8PerIsolateData (see |
| 95 // m_threadDebugger for an example). | 114 // m_threadDebugger for an example). |
| 96 class CORE_EXPORT Data { | 115 class CORE_EXPORT Data { |
| 97 public: | 116 public: |
| 98 virtual ~Data() = default; | 117 virtual ~Data() = default; |
| 99 }; | 118 }; |
| 100 | 119 |
| 101 static v8::Isolate* initialize(WebTaskRunner*); | 120 static v8::Isolate* initialize(WebTaskRunner*); |
| 102 | 121 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 125 } | 144 } |
| 126 void setIsHandlingRecursionLevelError(bool value) { | 145 void setIsHandlingRecursionLevelError(bool value) { |
| 127 m_isHandlingRecursionLevelError = value; | 146 m_isHandlingRecursionLevelError = value; |
| 128 } | 147 } |
| 129 | 148 |
| 130 bool isReportingException() const { return m_isReportingException; } | 149 bool isReportingException() const { return m_isReportingException; } |
| 131 void setReportingException(bool value) { m_isReportingException = value; } | 150 void setReportingException(bool value) { m_isReportingException = value; } |
| 132 | 151 |
| 133 bool isUseCounterDisabled() const { return m_useCounterDisabled; } | 152 bool isUseCounterDisabled() const { return m_useCounterDisabled; } |
| 134 | 153 |
| 154 v8::Local<v8::Context> entryContext() { |
| 155 DCHECK(!m_entryContext.IsEmpty()); |
| 156 if (m_entryContext.IsEmpty()) |
| 157 return isolate()->GetEnteredContext(); |
| 158 return m_entryContext; |
| 159 } |
| 160 |
| 135 V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); } | 161 V8HiddenValue* hiddenValue() { return m_hiddenValue.get(); } |
| 136 V8PrivateProperty* privateProperty() { return m_privateProperty.get(); } | 162 V8PrivateProperty* privateProperty() { return m_privateProperty.get(); } |
| 137 | 163 |
| 138 // Accessors to the cache of interface templates. | 164 // Accessors to the cache of interface templates. |
| 139 v8::Local<v8::FunctionTemplate> findInterfaceTemplate(const DOMWrapperWorld&, | 165 v8::Local<v8::FunctionTemplate> findInterfaceTemplate(const DOMWrapperWorld&, |
| 140 const void* key); | 166 const void* key); |
| 141 void setInterfaceTemplate(const DOMWrapperWorld&, | 167 void setInterfaceTemplate(const DOMWrapperWorld&, |
| 142 const void* key, | 168 const void* key, |
| 143 v8::Local<v8::FunctionTemplate>); | 169 v8::Local<v8::FunctionTemplate>); |
| 144 | 170 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 std::unique_ptr<V8PrivateProperty> m_privateProperty; | 269 std::unique_ptr<V8PrivateProperty> m_privateProperty; |
| 244 ScopedPersistent<v8::Value> m_liveRoot; | 270 ScopedPersistent<v8::Value> m_liveRoot; |
| 245 RefPtr<ScriptState> m_scriptRegexpScriptState; | 271 RefPtr<ScriptState> m_scriptRegexpScriptState; |
| 246 | 272 |
| 247 bool m_constructorMode; | 273 bool m_constructorMode; |
| 248 friend class ConstructorMode; | 274 friend class ConstructorMode; |
| 249 | 275 |
| 250 bool m_useCounterDisabled; | 276 bool m_useCounterDisabled; |
| 251 friend class UseCounterDisabledScope; | 277 friend class UseCounterDisabledScope; |
| 252 | 278 |
| 279 v8::Local<v8::Context> m_entryContext; |
| 280 friend class EntryRealmScope; |
| 281 |
| 253 bool m_isHandlingRecursionLevelError; | 282 bool m_isHandlingRecursionLevelError; |
| 254 bool m_isReportingException; | 283 bool m_isReportingException; |
| 255 | 284 |
| 256 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; | 285 Vector<std::unique_ptr<EndOfScopeTask>> m_endOfScopeTasks; |
| 257 std::unique_ptr<Data> m_threadDebugger; | 286 std::unique_ptr<Data> m_threadDebugger; |
| 258 | 287 |
| 259 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; | 288 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; |
| 260 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor; | 289 std::unique_ptr<ScriptWrappableVisitor> m_scriptWrappableVisitor; |
| 261 }; | 290 }; |
| 262 | 291 |
| 263 } // namespace blink | 292 } // namespace blink |
| 264 | 293 |
| 265 #endif // V8PerIsolateData_h | 294 #endif // V8PerIsolateData_h |
| OLD | NEW |