blob: 3c0da6042682b40c7adf04a8ed45c1ec904caa79 [file] [log] [blame]
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +01001/*
2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef V8TestCustomAccessors_h
22#define V8TestCustomAccessors_h
23
24#include "bindings/bindings/tests/idls/TestCustomAccessors.h"
25#include "bindings/v8/V8Binding.h"
26#include "bindings/v8/V8DOMWrapper.h"
27#include "bindings/v8/WrapperTypeInfo.h"
28
29namespace WebCore {
30
31class V8TestCustomAccessors {
32public:
33 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldType);
34 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
35 static v8::Persistent<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
36 static TestCustomAccessors* toNative(v8::Handle<v8::Object> object)
37 {
38 return reinterpret_cast<TestCustomAccessors*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
39 }
40 static void derefObject(void*);
41 static WrapperTypeInfo info;
42 static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&);
43 static v8::Handle<v8::Value> indexedPropertySetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&);
44 static v8::Handle<v8::Boolean> indexedPropertyDeleter(uint32_t, const v8::AccessorInfo&);
45 static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
46 static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&);
47 static v8::Handle<v8::Boolean> namedPropertyDeleter(v8::Local<v8::String>, const v8::AccessorInfo&);
48 static v8::Handle<v8::Array> namedPropertyEnumerator(const v8::AccessorInfo&);
49 static v8::Handle<v8::Integer> namedPropertyQuery(v8::Local<v8::String>, const v8::AccessorInfo&);
50 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
51 static void installPerContextProperties(v8::Handle<v8::Object>, TestCustomAccessors*, v8::Isolate*) { }
52 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
53private:
54 friend v8::Handle<v8::Object> wrap(TestCustomAccessors*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
55 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestCustomAccessors>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
56};
57
58template<>
59class WrapperTypeTraits<TestCustomAccessors > {
60public:
61 static WrapperTypeInfo* info() { return &V8TestCustomAccessors::info; }
62};
63
64
65inline v8::Handle<v8::Object> wrap(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
66{
67 ASSERT(impl);
68 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
69 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
70 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
71 // Might be a XXXConstructor::info instead of an XXX::info. These will both have
72 // the same object de-ref functions, though, so use that as the basis of the check.
73 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == V8TestCustomAccessors::info.derefObjectFunction);
74 }
75 return V8TestCustomAccessors::createWrapper(impl, creationContext, isolate);
76}
77
78inline v8::Handle<v8::Value> toV8(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
79{
80 if (UNLIKELY(!impl))
81 return v8NullWithCheck(isolate);
82 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
83 if (!wrapper.IsEmpty())
84 return wrapper;
85 return wrap(impl, creationContext, isolate);
86}
87
88inline v8::Handle<v8::Value> toV8ForMainWorld(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
89{
90 ASSERT(worldType(isolate) == MainWorld);
91 if (UNLIKELY(!impl))
92 return v8NullWithCheck(isolate);
93 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
94 if (!wrapper.IsEmpty())
95 return wrapper;
96 return wrap(impl, creationContext, isolate);
97}
98
99template<class HolderContainer, class Wrappable>
100inline v8::Handle<v8::Value> toV8Fast(TestCustomAccessors* impl, const HolderContainer& container, Wrappable* wrappable)
101{
102 if (UNLIKELY(!impl))
103 return v8Null(container.GetIsolate());
104 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
105 if (!wrapper.IsEmpty())
106 return wrapper;
107 return wrap(impl, container.Holder(), container.GetIsolate());
108}
109
110template<class HolderContainer, class Wrappable>
111inline v8::Handle<v8::Value> toV8FastForMainWorld(TestCustomAccessors* impl, const HolderContainer& container, Wrappable* wrappable)
112{
113 ASSERT(worldType(container.GetIsolate()) == MainWorld);
114 if (UNLIKELY(!impl))
115 return v8Null(container.GetIsolate());
116 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
117 if (!wrapper.IsEmpty())
118 return wrapper;
119 return wrap(impl, container.Holder(), container.GetIsolate());
120}
121
122template<class HolderContainer, class Wrappable>
123inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestCustomAccessors > impl, const HolderContainer& container, Wrappable* wrappable)
124{
125 return toV8FastForMainWorld(impl.get(), container, wrappable);
126}
127
128
129template<class HolderContainer, class Wrappable>
130inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestCustomAccessors > impl, const HolderContainer& container, Wrappable* wrappable)
131{
132 return toV8Fast(impl.get(), container, wrappable);
133}
134
135inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
136{
137 return toV8(impl.get(), creationContext, isolate);
138}
139
140}
141
142#endif // V8TestCustomAccessors_h