blob: 04f20cdef040232e2cea72800f52da32622775ed [file] [log] [blame]
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +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 V8TestActiveDOMObject_h
22#define V8TestActiveDOMObject_h
23
24#include "bindings/bindings/tests/idls/TestActiveDOMObject.h"
25#include "bindings/v8/V8Binding.h"
26#include "bindings/v8/V8DOMWrapper.h"
27#include "bindings/v8/WrapperTypeInfo.h"
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010028
29namespace WebCore {
30
31class V8TestActiveDOMObject {
32public:
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010033 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 TestActiveDOMObject* toNative(v8::Handle<v8::Object> object)
37 {
38 return reinterpret_cast<TestActiveDOMObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
39 }
40 static void derefObject(void*);
41 static WrapperTypeInfo info;
42 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
43 static void installPerContextProperties(v8::Handle<v8::Object>, TestActiveDOMObject*, v8::Isolate*) { }
44 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*) { }
45private:
46 friend v8::Handle<v8::Object> wrap(TestActiveDOMObject*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
47 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestActiveDOMObject>, v8::Handle<v8::Object> creationContext, v8::Isolate*);
48};
49
50template<>
51class WrapperTypeTraits<TestActiveDOMObject > {
52public:
53 static WrapperTypeInfo* info() { return &V8TestActiveDOMObject::info; }
54};
55
56
57inline v8::Handle<v8::Object> wrap(TestActiveDOMObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
58{
59 ASSERT(impl);
60 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
Torne (Richard Coles)81a51572013-05-13 16:52:28 +010061 if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
62 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
63 // Might be a XXXConstructor::info instead of an XXX::info. These will both have
64 // the same object de-ref functions, though, so use that as the basis of the check.
Torne (Richard Coles)93ac45c2013-05-29 14:40:20 +010065 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == V8TestActiveDOMObject::info.derefObjectFunction);
Torne (Richard Coles)81a51572013-05-13 16:52:28 +010066 }
Torne (Richard Coles)53e740f2013-05-09 18:38:43 +010067 return V8TestActiveDOMObject::createWrapper(impl, creationContext, isolate);
68}
69
70inline v8::Handle<v8::Value> toV8(TestActiveDOMObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
71{
72 if (UNLIKELY(!impl))
73 return v8NullWithCheck(isolate);
74 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
75 if (!wrapper.IsEmpty())
76 return wrapper;
77 return wrap(impl, creationContext, isolate);
78}
79
80inline v8::Handle<v8::Value> toV8ForMainWorld(TestActiveDOMObject* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
81{
82 ASSERT(worldType(isolate) == MainWorld);
83 if (UNLIKELY(!impl))
84 return v8NullWithCheck(isolate);
85 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
86 if (!wrapper.IsEmpty())
87 return wrapper;
88 return wrap(impl, creationContext, isolate);
89}
90
91template<class HolderContainer, class Wrappable>
92inline v8::Handle<v8::Value> toV8Fast(TestActiveDOMObject* impl, const HolderContainer& container, Wrappable* wrappable)
93{
94 if (UNLIKELY(!impl))
95 return v8Null(container.GetIsolate());
96 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
97 if (!wrapper.IsEmpty())
98 return wrapper;
99 return wrap(impl, container.Holder(), container.GetIsolate());
100}
101
102template<class HolderContainer, class Wrappable>
103inline v8::Handle<v8::Value> toV8FastForMainWorld(TestActiveDOMObject* impl, const HolderContainer& container, Wrappable* wrappable)
104{
105 ASSERT(worldType(container.GetIsolate()) == MainWorld);
106 if (UNLIKELY(!impl))
107 return v8Null(container.GetIsolate());
108 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
109 if (!wrapper.IsEmpty())
110 return wrapper;
111 return wrap(impl, container.Holder(), container.GetIsolate());
112}
113
114template<class HolderContainer, class Wrappable>
115inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestActiveDOMObject > impl, const HolderContainer& container, Wrappable* wrappable)
116{
117 return toV8FastForMainWorld(impl.get(), container, wrappable);
118}
119
120
121template<class HolderContainer, class Wrappable>
122inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestActiveDOMObject > impl, const HolderContainer& container, Wrappable* wrappable)
123{
124 return toV8Fast(impl.get(), container, wrappable);
125}
126
127inline v8::Handle<v8::Value> toV8(PassRefPtr< TestActiveDOMObject > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
128{
129 return toV8(impl.get(), creationContext, isolate);
130}
131
132}
133
134#endif // V8TestActiveDOMObject_h