OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 V8PrivateProperty_h | 5 #ifndef V8PrivateProperty_h |
6 #define V8PrivateProperty_h | 6 #define V8PrivateProperty_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "bindings/core/v8/ScriptPromiseProperties.h" | 10 #include "bindings/core/v8/ScriptPromiseProperties.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 X(CustomElement, TagName) \ | 32 X(CustomElement, TagName) \ |
33 X(CustomElement, Type) \ | 33 X(CustomElement, Type) \ |
34 X(DOMException, Error) \ | 34 X(DOMException, Error) \ |
35 X(ErrorEvent, Error) \ | 35 X(ErrorEvent, Error) \ |
36 X(IDBObserver, Callback) \ | 36 X(IDBObserver, Callback) \ |
37 X(IntersectionObserver, Callback) \ | 37 X(IntersectionObserver, Callback) \ |
38 X(MessageEvent, CachedData) \ | 38 X(MessageEvent, CachedData) \ |
39 X(MutationObserver, Callback) \ | 39 X(MutationObserver, Callback) \ |
40 X(NamedConstructor, Initialized) \ | 40 X(NamedConstructor, Initialized) \ |
41 X(PerformanceObserver, Callback) \ | 41 X(PerformanceObserver, Callback) \ |
| 42 X(PopStateEvent, State) \ |
42 X(SameObject, NotificationActions) \ | 43 X(SameObject, NotificationActions) \ |
43 X(SameObject, NotificationData) \ | 44 X(SameObject, NotificationData) \ |
44 X(SameObject, NotificationVibrate) \ | 45 X(SameObject, NotificationVibrate) \ |
45 X(SameObject, PerformanceLongTaskTimingAttribution) \ | 46 X(SameObject, PerformanceLongTaskTimingAttribution) \ |
46 X(V8NodeFilterCondition, Filter) | 47 X(V8NodeFilterCondition, Filter) |
47 | 48 |
48 // The getter's name for a private property. | 49 // The getter's name for a private property. |
49 #define V8_PRIVATE_PROPERTY_GETTER_NAME(InterfaceName, PrivateKeyName) \ | 50 #define V8_PRIVATE_PROPERTY_GETTER_NAME(InterfaceName, PrivateKeyName) \ |
50 get##InterfaceName##PrivateKeyName | 51 get##InterfaceName##PrivateKeyName |
51 | 52 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 privateProp->m_symbolWindowDocumentCachedAccessor.set( | 162 privateProp->m_symbolWindowDocumentCachedAccessor.set( |
162 isolate, createCachedV8Private( | 163 isolate, createCachedV8Private( |
163 isolate, V8_PRIVATE_PROPERTY_SYMBOL_STRING( | 164 isolate, V8_PRIVATE_PROPERTY_SYMBOL_STRING( |
164 "Window", "DocumentCachedAccessor"))); | 165 "Window", "DocumentCachedAccessor"))); |
165 } | 166 } |
166 return Symbol( | 167 return Symbol( |
167 isolate, | 168 isolate, |
168 privateProp->m_symbolWindowDocumentCachedAccessor.newLocal(isolate)); | 169 privateProp->m_symbolWindowDocumentCachedAccessor.newLocal(isolate)); |
169 } | 170 } |
170 | 171 |
171 static Symbol createSymbol(v8::Isolate* isolate, const char* symbol) { | 172 static Symbol getSymbol(v8::Isolate* isolate, const char* symbol) { |
172 return Symbol(isolate, createCachedV8Private(isolate, symbol)); | 173 return Symbol(isolate, createCachedV8Private(isolate, symbol)); |
173 } | 174 } |
174 | 175 |
175 private: | 176 private: |
176 V8PrivateProperty() {} | 177 V8PrivateProperty() {} |
177 | 178 |
178 static v8::Local<v8::Private> createV8Private(v8::Isolate*, | 179 static v8::Local<v8::Private> createV8Private(v8::Isolate*, |
179 const char* symbol); | 180 const char* symbol); |
| 181 // TODO(peria): Remove this method. We should not use v8::Private::ForApi(). |
180 static v8::Local<v8::Private> createCachedV8Private(v8::Isolate*, | 182 static v8::Local<v8::Private> createCachedV8Private(v8::Isolate*, |
181 const char* symbol); | 183 const char* symbol); |
182 | 184 |
183 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ | 185 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ |
184 v8::Eternal<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \ | 186 v8::Eternal<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \ |
185 InterfaceName, KeyName); // NOLINT(readability/naming/underscores) | 187 InterfaceName, KeyName); // NOLINT(readability/naming/underscores) |
186 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) | 188 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) |
187 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER | 189 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER |
188 | 190 |
189 // TODO(peria): Do not use this specialized hack for | 191 // TODO(peria): Do not use this specialized hack for |
190 // Window#DocumentCachedAccessor. This is required to put v8::Private key in | 192 // Window#DocumentCachedAccessor. This is required to put v8::Private key in |
191 // a snapshot, and it cannot be a v8::Eternal<> due to V8 serializer's | 193 // a snapshot, and it cannot be a v8::Eternal<> due to V8 serializer's |
192 // requirement. | 194 // requirement. |
193 ScopedPersistent<v8::Private> m_symbolWindowDocumentCachedAccessor; | 195 ScopedPersistent<v8::Private> m_symbolWindowDocumentCachedAccessor; |
194 }; | 196 }; |
195 | 197 |
196 } // namespace blink | 198 } // namespace blink |
197 | 199 |
198 #endif // V8PrivateProperty_h | 200 #endif // V8PrivateProperty_h |
OLD | NEW |