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