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 "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
9 #include "bindings/core/v8/ScriptPromiseProperties.h" | 9 #include "bindings/core/v8/ScriptPromiseProperties.h" |
10 #include "bindings/core/v8/V8BindingMacros.h" | 10 #include "bindings/core/v8/V8BindingMacros.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Usage 1) Fast path to use a pre-registered symbol. | 53 // Usage 1) Fast path to use a pre-registered symbol. |
54 // auto private = V8PrivateProperty::getMessageEventCachedData(isolate); | 54 // auto private = V8PrivateProperty::getMessageEventCachedData(isolate); |
55 // v8::Local<v8::Context> context = ...; | 55 // v8::Local<v8::Context> context = ...; |
56 // v8::Local<v8::Object> object = ...; | 56 // v8::Local<v8::Object> object = ...; |
57 // v8::Local<v8::Value> value = private.get(context, object); | 57 // v8::Local<v8::Value> value = private.get(context, object); |
58 // value = ...; | 58 // value = ...; |
59 // private.set(context, object, value); | 59 // private.set(context, object, value); |
60 // | 60 // |
61 // Usage 2) Slow path to create a global private symbol. | 61 // Usage 2) Slow path to create a global private symbol. |
62 // const char symbolName[] = "Interface#PrivateKeyName"; | 62 // const char symbolName[] = "Interface#PrivateKeyName"; |
63 // auto private = V8PrivateProperty::createSymbol(isolate, symbolName, sizeof
symbolName); | 63 // auto private = V8PrivateProperty::createSymbol(isolate, symbolName, |
| 64 // sizeof symbolName); |
64 // ... | 65 // ... |
65 class CORE_EXPORT V8PrivateProperty { | 66 class CORE_EXPORT V8PrivateProperty { |
66 USING_FAST_MALLOC(V8PrivateProperty); | 67 USING_FAST_MALLOC(V8PrivateProperty); |
67 WTF_MAKE_NONCOPYABLE(V8PrivateProperty); | 68 WTF_MAKE_NONCOPYABLE(V8PrivateProperty); |
68 | 69 |
69 public: | 70 public: |
70 // Provides fast access to V8's private properties. | 71 // Provides fast access to V8's private properties. |
71 // | 72 // |
72 // Retrieving/creating a global private symbol from a string is very | 73 // Retrieving/creating a global private symbol from a string is very |
73 // expensive compared to get or set a private property. This class | 74 // expensive compared to get or set a private property. This class |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ | 167 #define V8_PRIVATE_PROPERTY_DECLARE_MEMBER(InterfaceName, KeyName) \ |
167 ScopedPersistent<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \ | 168 ScopedPersistent<v8::Private> V8_PRIVATE_PROPERTY_MEMBER_NAME( \ |
168 InterfaceName, KeyName); // NOLINT(readability/naming/underscores) | 169 InterfaceName, KeyName); // NOLINT(readability/naming/underscores) |
169 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) | 170 V8_PRIVATE_PROPERTY_FOR_EACH(V8_PRIVATE_PROPERTY_DECLARE_MEMBER) |
170 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER | 171 #undef V8_PRIVATE_PROPERTY_DECLARE_MEMBER |
171 }; | 172 }; |
172 | 173 |
173 } // namespace blink | 174 } // namespace blink |
174 | 175 |
175 #endif // V8PrivateProperty_h | 176 #endif // V8PrivateProperty_h |
OLD | NEW |