blob: 69d658c73594088e3094da1fc29140507bf13acc [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*);
Torne (Richard Coles)5267f702013-06-11 10:57:24 +010035 static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010036 static TestCustomAccessors* toNative(v8::Handle<v8::Object> object)
37 {
Ben Murdoche69819b2013-07-17 14:56:49 +010038 return fromInternalPointer(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010039 }
40 static void derefObject(void*);
41 static WrapperTypeInfo info;
Ben Murdoch591b9582013-07-10 11:41:44 +010042 static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&);
43 static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
44 static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&);
45 static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&);
46 static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
47 static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&);
48 static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8::Array>&);
49 static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010050 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
Ben Murdoche69819b2013-07-17 14:56:49 +010051 static inline void* toInternalPointer(TestCustomAccessors* impl)
52 {
53 return impl;
54 }
55
56 static inline TestCustomAccessors* fromInternalPointer(void* object)
57 {
58 return static_cast<TestCustomAccessors*>(object);
59 }
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010060 static void installPerContextProperties(v8::Handle<v8::Object>, TestCustomAccessors*, v8::Isolate*) { }
61 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
62private:
63 friend v8::Handle<v8::Object> wrap(TestCustomAccessors*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
64 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestCustomAccessors>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
65};
66
67template<>
68class WrapperTypeTraits<TestCustomAccessors > {
69public:
70 static WrapperTypeInfo* info() { return &V8TestCustomAccessors::info; }
71};
72
73
74inline v8::Handle<v8::Object> wrap(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
75{
76 ASSERT(impl);
Ben Murdoche69819b2013-07-17 14:56:49 +010077 ASSERT(DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate).IsEmpty());
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010078 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
79 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
80 // Might be a XXXConstructor::info instead of an XXX::info. These will both have
81 // the same object de-ref functions, though, so use that as the basis of the check.
82 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == V8TestCustomAccessors::info.derefObjectFunction);
83 }
84 return V8TestCustomAccessors::createWrapper(impl, creationContext, isolate);
85}
86
87inline v8::Handle<v8::Value> toV8(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
88{
89 if (UNLIKELY(!impl))
90 return v8NullWithCheck(isolate);
Ben Murdoche69819b2013-07-17 14:56:49 +010091 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010092 if (!wrapper.IsEmpty())
93 return wrapper;
94 return wrap(impl, creationContext, isolate);
95}
96
97inline v8::Handle<v8::Value> toV8ForMainWorld(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
98{
99 ASSERT(worldType(isolate) == MainWorld);
100 if (UNLIKELY(!impl))
101 return v8NullWithCheck(isolate);
Ben Murdoche69819b2013-07-17 14:56:49 +0100102 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100103 if (!wrapper.IsEmpty())
104 return wrapper;
105 return wrap(impl, creationContext, isolate);
106}
107
Ben Murdoche69819b2013-07-17 14:56:49 +0100108template<class CallbackInfo, class Wrappable>
109inline v8::Handle<v8::Value> toV8Fast(TestCustomAccessors* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100110{
111 if (UNLIKELY(!impl))
Ben Murdoche69819b2013-07-17 14:56:49 +0100112 return v8::Null(callbackInfo.GetIsolate());
113 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestCustomAccessors>(impl, callbackInfo, wrappable);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100114 if (!wrapper.IsEmpty())
115 return wrapper;
Ben Murdoche69819b2013-07-17 14:56:49 +0100116 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100117}
118
Ben Murdoche69819b2013-07-17 14:56:49 +0100119template<class CallbackInfo, class Wrappable>
120inline v8::Handle<v8::Value> toV8FastForMainWorld(TestCustomAccessors* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100121{
Ben Murdoche69819b2013-07-17 14:56:49 +0100122 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100123 if (UNLIKELY(!impl))
Ben Murdoche69819b2013-07-17 14:56:49 +0100124 return v8::Null(callbackInfo.GetIsolate());
125 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100126 if (!wrapper.IsEmpty())
127 return wrapper;
Ben Murdoche69819b2013-07-17 14:56:49 +0100128 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100129}
130
Ben Murdoche69819b2013-07-17 14:56:49 +0100131template<class CallbackInfo, class Wrappable>
132inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestCustomAccessors > impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100133{
Ben Murdoche69819b2013-07-17 14:56:49 +0100134 return toV8FastForMainWorld(impl.get(), callbackInfo, wrappable);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100135}
136
137
Ben Murdoche69819b2013-07-17 14:56:49 +0100138template<class CallbackInfo, class Wrappable>
139inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestCustomAccessors > impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100140{
Ben Murdoche69819b2013-07-17 14:56:49 +0100141 return toV8Fast(impl.get(), callbackInfo, wrappable);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100142}
143
144inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
145{
146 return toV8(impl.get(), creationContext, isolate);
147}
148
149}
150
151#endif // V8TestCustomAccessors_h