OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 V8HiddenValue_h | 5 #ifndef V8HiddenValue_h |
6 #define V8HiddenValue_h | 6 #define V8HiddenValue_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 "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PtrUtil.h" |
| 13 #include <memory> |
13 #include <v8.h> | 14 #include <v8.h> |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class ScriptState; | 18 class ScriptState; |
18 class ScriptWrappable; | 19 class ScriptWrappable; |
19 | 20 |
20 #define V8_HIDDEN_VALUES(V) \ | 21 #define V8_HIDDEN_VALUES(V) \ |
21 V(customElementAttachedCallback) \ | 22 V(customElementAttachedCallback) \ |
22 V(customElementAttributeChangedCallback) \ | 23 V(customElementAttributeChangedCallback) \ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 V(webglQueries) \ | 55 V(webglQueries) \ |
55 V(webglSamplers) \ | 56 V(webglSamplers) \ |
56 V(webglShaders) \ | 57 V(webglShaders) \ |
57 SCRIPT_PROMISE_PROPERTIES(V, Promise) \ | 58 SCRIPT_PROMISE_PROPERTIES(V, Promise) \ |
58 SCRIPT_PROMISE_PROPERTIES(V, Resolver) | 59 SCRIPT_PROMISE_PROPERTIES(V, Resolver) |
59 | 60 |
60 class CORE_EXPORT V8HiddenValue { | 61 class CORE_EXPORT V8HiddenValue { |
61 USING_FAST_MALLOC(V8HiddenValue); | 62 USING_FAST_MALLOC(V8HiddenValue); |
62 WTF_MAKE_NONCOPYABLE(V8HiddenValue); | 63 WTF_MAKE_NONCOPYABLE(V8HiddenValue); |
63 public: | 64 public: |
64 static PassOwnPtr<V8HiddenValue> create() { return adoptPtr(new V8HiddenValu
e()); } | 65 static std::unique_ptr<V8HiddenValue> create() { return wrapUnique(new V8Hid
denValue()); } |
65 | 66 |
66 #define V8_DECLARE_METHOD(name) static v8::Local<v8::String> name(v8::Isolate* i
solate); | 67 #define V8_DECLARE_METHOD(name) static v8::Local<v8::String> name(v8::Isolate* i
solate); |
67 V8_HIDDEN_VALUES(V8_DECLARE_METHOD); | 68 V8_HIDDEN_VALUES(V8_DECLARE_METHOD); |
68 #undef V8_DECLARE_METHOD | 69 #undef V8_DECLARE_METHOD |
69 | 70 |
70 static v8::Local<v8::Value> getHiddenValue(ScriptState*, v8::Local<v8::Objec
t>, v8::Local<v8::String>); | 71 static v8::Local<v8::Value> getHiddenValue(ScriptState*, v8::Local<v8::Objec
t>, v8::Local<v8::String>); |
71 static bool setHiddenValue(ScriptState*, v8::Local<v8::Object>, v8::Local<v8
::String>, v8::Local<v8::Value>); | 72 static bool setHiddenValue(ScriptState*, v8::Local<v8::Object>, v8::Local<v8
::String>, v8::Local<v8::Value>); |
72 static bool deleteHiddenValue(ScriptState*, v8::Local<v8::Object>, v8::Local
<v8::String>); | 73 static bool deleteHiddenValue(ScriptState*, v8::Local<v8::Object>, v8::Local
<v8::String>); |
73 static v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(ScriptState*,
ScriptWrappable*, v8::Local<v8::String>); | 74 static v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(ScriptState*,
ScriptWrappable*, v8::Local<v8::String>); |
74 | 75 |
75 private: | 76 private: |
76 V8HiddenValue() { } | 77 V8HiddenValue() { } |
77 | 78 |
78 #define V8_DECLARE_FIELD(name) ScopedPersistent<v8::String> m_##name; | 79 #define V8_DECLARE_FIELD(name) ScopedPersistent<v8::String> m_##name; |
79 V8_HIDDEN_VALUES(V8_DECLARE_FIELD); | 80 V8_HIDDEN_VALUES(V8_DECLARE_FIELD); |
80 #undef V8_DECLARE_FIELD | 81 #undef V8_DECLARE_FIELD |
81 }; | 82 }; |
82 | 83 |
83 } // namespace blink | 84 } // namespace blink |
84 | 85 |
85 #endif // V8HiddenValue_h | 86 #endif // V8HiddenValue_h |
OLD | NEW |