| 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 15 matching lines...) Expand all Loading... |
| 26 #ifndef V8PerIsolateData_h | 26 #ifndef V8PerIsolateData_h |
| 27 #define V8PerIsolateData_h | 27 #define V8PerIsolateData_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScopedPersistent.h" | 29 #include "bindings/core/v8/ScopedPersistent.h" |
| 30 #include "bindings/core/v8/ScriptState.h" | 30 #include "bindings/core/v8/ScriptState.h" |
| 31 #include "bindings/core/v8/V8HiddenValue.h" | 31 #include "bindings/core/v8/V8HiddenValue.h" |
| 32 #include "bindings/core/v8/WrapperTypeInfo.h" | 32 #include "bindings/core/v8/WrapperTypeInfo.h" |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "gin/public/isolate_holder.h" | 34 #include "gin/public/isolate_holder.h" |
| 35 #include "gin/public/v8_idle_task_runner.h" | 35 #include "gin/public/v8_idle_task_runner.h" |
| 36 #include "platform/heap/Handle.h" |
| 36 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 37 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
| 38 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 #include <v8.h> | 41 #include <v8.h> |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 45 class ActiveScriptWrappable; |
| 44 class DOMDataStore; | 46 class DOMDataStore; |
| 45 class ThreadDebugger; | 47 class ThreadDebugger; |
| 46 class StringCache; | 48 class StringCache; |
| 47 struct WrapperTypeInfo; | 49 struct WrapperTypeInfo; |
| 48 | 50 |
| 49 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; | 51 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; |
| 50 | 52 |
| 51 class CORE_EXPORT V8PerIsolateData { | 53 class CORE_EXPORT V8PerIsolateData { |
| 52 USING_FAST_MALLOC(V8PerIsolateData); | 54 USING_FAST_MALLOC(V8PerIsolateData); |
| 53 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); | 55 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // to C++ from script, after executing a script task (e.g. callback, | 133 // to C++ from script, after executing a script task (e.g. callback, |
| 132 // event) or microtasks (e.g. promise). This is explicitly needed for | 134 // event) or microtasks (e.g. promise). This is explicitly needed for |
| 133 // Indexed DB transactions per spec, but should in general be avoided. | 135 // Indexed DB transactions per spec, but should in general be avoided. |
| 134 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); | 136 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); |
| 135 void runEndOfScopeTasks(); | 137 void runEndOfScopeTasks(); |
| 136 void clearEndOfScopeTasks(); | 138 void clearEndOfScopeTasks(); |
| 137 | 139 |
| 138 void setThreadDebugger(PassOwnPtr<ThreadDebugger>); | 140 void setThreadDebugger(PassOwnPtr<ThreadDebugger>); |
| 139 ThreadDebugger* threadDebugger(); | 141 ThreadDebugger* threadDebugger(); |
| 140 | 142 |
| 143 using ActiveScriptWrappableSet = HeapHashSet<WeakMember<ActiveScriptWrappabl
e>>; |
| 144 void addActiveScriptWrappable(ActiveScriptWrappable*); |
| 145 const ActiveScriptWrappableSet& activeScriptWrappables() const { return *m_a
ctiveScriptWrappables; } |
| 146 |
| 141 private: | 147 private: |
| 142 V8PerIsolateData(); | 148 V8PerIsolateData(); |
| 143 ~V8PerIsolateData(); | 149 ~V8PerIsolateData(); |
| 144 | 150 |
| 145 static void useCounterCallback(v8::Isolate*, v8::Isolate::UseCounterFeature)
; | 151 static void useCounterCallback(v8::Isolate*, v8::Isolate::UseCounterFeature)
; |
| 146 | 152 |
| 147 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> V8FunctionTe
mplateMap; | 153 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> V8FunctionTe
mplateMap; |
| 148 V8FunctionTemplateMap& selectInterfaceTemplateMap(const DOMWrapperWorld&); | 154 V8FunctionTemplateMap& selectInterfaceTemplateMap(const DOMWrapperWorld&); |
| 149 V8FunctionTemplateMap& selectOperationTemplateMap(const DOMWrapperWorld&); | 155 V8FunctionTemplateMap& selectOperationTemplateMap(const DOMWrapperWorld&); |
| 150 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, V8F
unctionTemplateMap&); | 156 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, V8F
unctionTemplateMap&); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 170 friend class ConstructorMode; | 176 friend class ConstructorMode; |
| 171 | 177 |
| 172 bool m_useCounterDisabled; | 178 bool m_useCounterDisabled; |
| 173 friend class UseCounterDisabledScope; | 179 friend class UseCounterDisabledScope; |
| 174 | 180 |
| 175 bool m_isHandlingRecursionLevelError; | 181 bool m_isHandlingRecursionLevelError; |
| 176 bool m_isReportingException; | 182 bool m_isReportingException; |
| 177 | 183 |
| 178 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; | 184 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; |
| 179 OwnPtr<ThreadDebugger> m_threadDebugger; | 185 OwnPtr<ThreadDebugger> m_threadDebugger; |
| 186 |
| 187 Persistent<ActiveScriptWrappableSet> m_activeScriptWrappables; |
| 180 }; | 188 }; |
| 181 | 189 |
| 182 } // namespace blink | 190 } // namespace blink |
| 183 | 191 |
| 184 #endif // V8PerIsolateData_h | 192 #endif // V8PerIsolateData_h |
| OLD | NEW |