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