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 "public/platform/Platform.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 |
44 class DOMDataStore; | 45 class DOMDataStore; |
45 class ThreadDebugger; | 46 class ThreadDebugger; |
46 class StringCache; | 47 class StringCache; |
47 struct WrapperTypeInfo; | 48 struct WrapperTypeInfo; |
48 | 49 |
49 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; | 50 typedef WTF::Vector<DOMDataStore*> DOMDataStoreList; |
50 | 51 |
51 class CORE_EXPORT V8PerIsolateData { | 52 class CORE_EXPORT V8PerIsolateData |
| 53 : public Platform::TraceLogEnabledStateObserver { |
52 USING_FAST_MALLOC(V8PerIsolateData); | 54 USING_FAST_MALLOC(V8PerIsolateData); |
53 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); | 55 WTF_MAKE_NONCOPYABLE(V8PerIsolateData); |
54 public: | 56 public: |
55 class EndOfScopeTask { | 57 class EndOfScopeTask { |
56 USING_FAST_MALLOC(EndOfScopeTask); | 58 USING_FAST_MALLOC(EndOfScopeTask); |
57 public: | 59 public: |
58 virtual ~EndOfScopeTask() { } | 60 virtual ~EndOfScopeTask() { } |
59 virtual void run() = 0; | 61 virtual void run() = 0; |
60 }; | 62 }; |
61 | 63 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // to C++ from script, after executing a script task (e.g. callback, | 117 // to C++ from script, after executing a script task (e.g. callback, |
116 // event) or microtasks (e.g. promise). This is explicitly needed for | 118 // event) or microtasks (e.g. promise). This is explicitly needed for |
117 // Indexed DB transactions per spec, but should in general be avoided. | 119 // Indexed DB transactions per spec, but should in general be avoided. |
118 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); | 120 void addEndOfScopeTask(PassOwnPtr<EndOfScopeTask>); |
119 void runEndOfScopeTasks(); | 121 void runEndOfScopeTasks(); |
120 void clearEndOfScopeTasks(); | 122 void clearEndOfScopeTasks(); |
121 | 123 |
122 void setThreadDebugger(PassOwnPtr<ThreadDebugger>); | 124 void setThreadDebugger(PassOwnPtr<ThreadDebugger>); |
123 ThreadDebugger* threadDebugger(); | 125 ThreadDebugger* threadDebugger(); |
124 | 126 |
| 127 // Platform::TraceLogEnabledStateObserver methods: |
| 128 void onTraceLogEnabled() override; |
| 129 void onTraceLogDisabled() override; |
| 130 |
125 private: | 131 private: |
126 V8PerIsolateData(); | 132 V8PerIsolateData(); |
127 ~V8PerIsolateData(); | 133 ~V8PerIsolateData(); |
128 | 134 |
129 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> DOMTemplateM
ap; | 135 typedef HashMap<const void*, v8::Eternal<v8::FunctionTemplate>> DOMTemplateM
ap; |
130 DOMTemplateMap& currentDOMTemplateMap(); | 136 DOMTemplateMap& currentDOMTemplateMap(); |
131 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, DOM
TemplateMap&); | 137 bool hasInstance(const WrapperTypeInfo* untrusted, v8::Local<v8::Value>, DOM
TemplateMap&); |
132 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>, DOMTemplateMap&); | 138 v8::Local<v8::Object> findInstanceInPrototypeChain(const WrapperTypeInfo*, v
8::Local<v8::Value>, DOMTemplateMap&); |
133 | 139 |
134 bool m_destructionPending; | 140 bool m_destructionPending; |
(...skipping 17 matching lines...) Expand all Loading... |
152 #endif | 158 #endif |
153 bool m_performingMicrotaskCheckpoint; | 159 bool m_performingMicrotaskCheckpoint; |
154 | 160 |
155 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; | 161 Vector<OwnPtr<EndOfScopeTask>> m_endOfScopeTasks; |
156 OwnPtr<ThreadDebugger> m_threadDebugger; | 162 OwnPtr<ThreadDebugger> m_threadDebugger; |
157 }; | 163 }; |
158 | 164 |
159 } // namespace blink | 165 } // namespace blink |
160 | 166 |
161 #endif // V8PerIsolateData_h | 167 #endif // V8PerIsolateData_h |
OLD | NEW |