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 3 // found in the LICENSE file. 4 5 #ifndef V8HiddenValue_h 6 #define V8HiddenValue_h 7 8 #include "bindings/core/v8/ScopedPersistent.h" 9 #include "bindings/core/v8/ScriptPromiseProperties.h" 10 #include <v8.h> 11 12 namespace blink { 13 14 class ScriptWrappable; 15 16 #define V8_HIDDEN_VALUES(V) \ 17 V(arrayBufferData) \ 18 V(privateScriptObjectIsInitialized) \ 19 V(customElementAttachedCallback) \ 20 V(customElementAttributeChangedCallback) \ 21 V(customElementCreatedCallback) \ 22 V(customElementDetachedCallback) \ 23 V(customElementDocument) \ 24 V(customElementIsInterfacePrototypeObject) \ 25 V(customElementNamespaceURI) \ 26 V(customElementTagName) \ 27 V(customElementType) \ 28 V(callback) \ 29 V(condition) \ 30 V(data) \ 31 V(detail) \ 32 V(document) \ 33 V(error) \ 34 V(event) \ 35 V(idbCursorRequest) \ 36 V(port1) \ 37 V(port2) \ 38 V(state) \ 39 V(stringData) \ 40 V(scriptState) \ 41 V(thenableHiddenPromise) \ 42 V(toStringString) \ 43 SCRIPT_PROMISE_PROPERTIES(V, Promise) \ 44 SCRIPT_PROMISE_PROPERTIES(V, Resolver) 45 46 class V8HiddenValue { 47 public: 48 #define V8_DECLARE_METHOD(name) static v8::Handle<v8::String> name(v8::Isolate* isolate); 49 V8_HIDDEN_VALUES(V8_DECLARE_METHOD); 50 #undef V8_DECLARE_METHOD 51 52 static v8::Local<v8::Value> getHiddenValue(v8::Isolate*, v8::Handle<v8::Object>, v8::Handle<v8::String>); 53 static bool setHiddenValue(v8::Isolate*, v8::Handle<v8::Object>, v8::Handle<v8::String>, v8::Handle<v8::Value>); 54 static bool deleteHiddenValue(v8::Isolate*, v8::Handle<v8::Object>, v8::Handle<v8::String>); 55 static v8::Local<v8::Value> getHiddenValueFromMainWorldWrapper(v8::Isolate*, ScriptWrappable*, v8::Handle<v8::String>); 56 57 private: 58 #define V8_DECLARE_FIELD(name) ScopedPersistent<v8::String> m_##name; 59 V8_HIDDEN_VALUES(V8_DECLARE_FIELD); 60 #undef V8_DECLARE_FIELD 61 }; 62 63 } // namespace blink 64 65 #endif // V8HiddenValue_h 66