Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: Source/WebCore/bindings/scripts/test/V8/V8TestObj.h

Issue 13937004: Move bindings-tests to bindings/tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. 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 V8TestObj_h
22 #define V8TestObj_h
23
24 #include "TestObj.h"
25 #include "V8Binding.h"
26 #include "V8DOMWrapper.h"
27 #include "WrapperTypeInfo.h"
28 #include <v8.h>
29 #include <wtf/HashMap.h>
30 #include <wtf/text/StringHash.h>
31
32 namespace WebCore {
33
34 class V8TestObj {
35 public:
36 static const bool hasDependentLifetime = false;
37 static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldTyp e);
38 static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
39 static v8::Persistent<v8::FunctionTemplate> GetTemplate(v8::Isolate*, Wrappe rWorldType);
40 static TestObj* toNative(v8::Handle<v8::Object> object)
41 {
42 return reinterpret_cast<TestObj*>(object->GetAlignedPointerFromInternalF ield(v8DOMWrapperObjectIndex));
43 }
44 static void derefObject(void*);
45 static WrapperTypeInfo info;
46 static v8::Handle<v8::Value> customMethodMethodCustom(const v8::Arguments&);
47 static v8::Handle<v8::Value> customMethodWithArgsMethodCustom(const v8::Argu ments&);
48 static v8::Handle<v8::Value> classMethod2MethodCustom(const v8::Arguments&);
49 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
50 static v8::Handle<v8::Value> customAttrAttrGetterCustom(v8::Local<v8::String > name, const v8::AccessorInfo&);
51 static void customAttrAttrSetterCustom(v8::Local<v8::String> name, v8::Local <v8::Value>, const v8::AccessorInfo&);
52 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0 ;
53 static void installPerContextProperties(v8::Handle<v8::Object>, TestObj*, v8 ::Isolate*);
54 static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8: :Isolate*);
55 private:
56 friend v8::Handle<v8::Object> wrap(TestObj*, v8::Handle<v8::Object> creation Context, v8::Isolate*);
57 static v8::Handle<v8::Object> createWrapper(PassRefPtr<TestObj>, v8::Handle< v8::Object> creationContext, v8::Isolate*);
58 };
59
60 template<>
61 class WrapperTypeTraits<TestObj > {
62 public:
63 static WrapperTypeInfo* info() { return &V8TestObj::info; }
64 };
65
66
67 inline v8::Handle<v8::Object> wrap(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
68 {
69 ASSERT(impl);
70 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
71 return V8TestObj::createWrapper(impl, creationContext, isolate);
72 }
73
74 inline v8::Handle<v8::Value> toV8(TestObj* impl, v8::Handle<v8::Object> creation Context, v8::Isolate* isolate)
75 {
76 if (UNLIKELY(!impl))
77 return v8NullWithCheck(isolate);
78 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
79 if (!wrapper.IsEmpty())
80 return wrapper;
81 return wrap(impl, creationContext, isolate);
82 }
83
84 inline v8::Handle<v8::Value> toV8ForMainWorld(TestObj* impl, v8::Handle<v8::Obje ct> creationContext, v8::Isolate* isolate)
85 {
86 ASSERT(worldType(isolate) == MainWorld);
87 if (UNLIKELY(!impl))
88 return v8NullWithCheck(isolate);
89 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
90 if (!wrapper.IsEmpty())
91 return wrapper;
92 return wrap(impl, creationContext, isolate);
93 }
94
95 template<class HolderContainer, class Wrappable>
96 inline v8::Handle<v8::Value> toV8Fast(TestObj* impl, const HolderContainer& cont ainer, Wrappable* wrappable)
97 {
98 if (UNLIKELY(!impl))
99 return v8Null(container.GetIsolate());
100 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, containe r, wrappable);
101 if (!wrapper.IsEmpty())
102 return wrapper;
103 return wrap(impl, container.Holder(), container.GetIsolate());
104 }
105
106 template<class HolderContainer, class Wrappable>
107 inline v8::Handle<v8::Value> toV8FastForMainWorld(TestObj* impl, const HolderCon tainer& container, Wrappable* wrappable)
108 {
109 ASSERT(worldType(container.GetIsolate()) == MainWorld);
110 if (UNLIKELY(!impl))
111 return v8Null(container.GetIsolate());
112 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
113 if (!wrapper.IsEmpty())
114 return wrapper;
115 return wrap(impl, container.Holder(), container.GetIsolate());
116 }
117
118 template<class HolderContainer, class Wrappable>
119 inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< TestObj > impl, co nst HolderContainer& container, Wrappable* wrappable)
120 {
121 return toV8FastForMainWorld(impl.get(), container, wrappable);
122 }
123
124
125 template<class HolderContainer, class Wrappable>
126 inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< TestObj > impl, const HolderCo ntainer& container, Wrappable* wrappable)
127 {
128 return toV8Fast(impl.get(), container, wrappable);
129 }
130
131 inline v8::Handle<v8::Value> toV8(PassRefPtr< TestObj > impl, v8::Handle<v8::Obj ect> creationContext, v8::Isolate* isolate)
132 {
133 return toV8(impl.get(), creationContext, isolate);
134 }
135
136 }
137
138 #endif // V8TestObj_h
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp ('k') | Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698