blob: 7159f54dad563910a2b31c721b11e84834460c7e [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 return V8TestCustomAccessors::createWrapper(impl, creationContext, isolate);
79}
80
81inline v8::Handle<v8::Value> toV8(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
82{
83 if (UNLIKELY(!impl))
84 return v8NullWithCheck(isolate);
Ben Murdoche69819b2013-07-17 14:56:49 +010085 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8TestCustomAccessors>(impl, isolate);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010086 if (!wrapper.IsEmpty())
87 return wrapper;
88 return wrap(impl, creationContext, isolate);
89}
90
91inline v8::Handle<v8::Value> toV8ForMainWorld(TestCustomAccessors* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
92{
93 ASSERT(worldType(isolate) == MainWorld);
94 if (UNLIKELY(!impl))
95 return v8NullWithCheck(isolate);
Ben Murdoche69819b2013-07-17 14:56:49 +010096 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<V8TestCustomAccessors>(impl);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010097 if (!wrapper.IsEmpty())
98 return wrapper;
99 return wrap(impl, creationContext, isolate);
100}
101
Ben Murdoche69819b2013-07-17 14:56:49 +0100102template<class CallbackInfo, class Wrappable>
103inline v8::Handle<v8::Value> toV8Fast(TestCustomAccessors* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100104{
105 if (UNLIKELY(!impl))
Ben Murdoche69819b2013-07-17 14:56:49 +0100106 return v8::Null(callbackInfo.GetIsolate());
107 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<V8TestCustomAccessors>(impl, callbackInfo, wrappable);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100108 if (!wrapper.IsEmpty())
109 return wrapper;
Ben Murdoche69819b2013-07-17 14:56:49 +0100110 return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100111}
112
Ben Murdoch83750172013-07-24 10:36:59 +0100113inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100114{
Ben Murdoch83750172013-07-24 10:36:59 +0100115 return toV8ForMainWorld(impl.get(), creationContext, isolate);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100116}
117
118
Ben Murdoche69819b2013-07-17 14:56:49 +0100119template<class CallbackInfo, class Wrappable>
120inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< 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 return toV8Fast(impl.get(), callbackInfo, wrappable);
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +0100123}
124
125inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomAccessors > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
126{
127 return toV8(impl.get(), creationContext, isolate);
128}
129
130}
131
132#endif // V8TestCustomAccessors_h