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

Side by Side Diff: Source/bindings/tests/results/V8TestOverloadedConstructors.cpp

Issue 15877002: move constructors to new style callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 6 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
1 /* 1 /*
2 This file is part of the Blink open source project. 2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 #if defined(OS_WIN) 56 #if defined(OS_WIN)
57 namespace WebCore { 57 namespace WebCore {
58 #endif 58 #endif
59 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstruct ors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0, V8TestOver loadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPr ototype }; 59 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstruct ors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0, V8TestOver loadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPr ototype };
60 60
61 namespace TestOverloadedConstructorsV8Internal { 61 namespace TestOverloadedConstructorsV8Internal {
62 62
63 template <typename T> void V8_USE(T) { } 63 template <typename T> void V8_USE(T) { }
64 64
65 static v8::Handle<v8::Value> constructor1(const v8::Arguments& args) 65 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& args)
66 { 66 {
67 V8TRYCATCH(ArrayBuffer*, arrayBuffer, V8ArrayBuffer::HasInstance(args[0], ar gs.GetIsolate(), worldType(args.GetIsolate())) ? V8ArrayBuffer::toNative(v8::Han dle<v8::Object>::Cast(args[0])) : 0); 67 V8TRYCATCH_VOID(ArrayBuffer*, arrayBuffer, V8ArrayBuffer::HasInstance(args[0 ], args.GetIsolate(), worldType(args.GetIsolate())) ? V8ArrayBuffer::toNative(v8 ::Handle<v8::Object>::Cast(args[0])) : 0);
68 68
69 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (arrayBuffer); 69 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (arrayBuffer);
70 v8::Handle<v8::Object> wrapper = args.Holder(); 70 v8::Handle<v8::Object> wrapper = args.Holder();
71 71
72 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 72 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
73 return wrapper; 73 args.GetReturnValue().Set(wrapper);
74 } 74 }
75 75
76 static v8::Handle<v8::Value> constructor2(const v8::Arguments& args) 76 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& args)
77 { 77 {
78 V8TRYCATCH(ArrayBufferView*, arrayBufferView, V8ArrayBufferView::HasInstance (args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8ArrayBufferView:: toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 78 V8TRYCATCH_VOID(ArrayBufferView*, arrayBufferView, V8ArrayBufferView::HasIns tance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8ArrayBufferV iew::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
79 79
80 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (arrayBufferView); 80 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (arrayBufferView);
81 v8::Handle<v8::Object> wrapper = args.Holder(); 81 v8::Handle<v8::Object> wrapper = args.Holder();
82 82
83 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 83 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
84 return wrapper; 84 args.GetReturnValue().Set(wrapper);
85 } 85 }
86 86
87 static v8::Handle<v8::Value> constructor3(const v8::Arguments& args) 87 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& args)
88 { 88 {
89 V8TRYCATCH(Blob*, blob, V8Blob::HasInstance(args[0], args.GetIsolate(), worl dType(args.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(args[0 ])) : 0); 89 V8TRYCATCH_VOID(Blob*, blob, V8Blob::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate())) ? V8Blob::toNative(v8::Handle<v8::Object>::Cast(a rgs[0])) : 0);
90 90
91 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (blob); 91 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (blob);
92 v8::Handle<v8::Object> wrapper = args.Holder(); 92 v8::Handle<v8::Object> wrapper = args.Holder();
93 93
94 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 94 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
95 return wrapper; 95 args.GetReturnValue().Set(wrapper);
96 } 96 }
97 97
98 static v8::Handle<v8::Value> constructor4(const v8::Arguments& args) 98 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& args)
99 { 99 {
100 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, string, args[0]); 100 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, string, args[0]);
101 101
102 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (string); 102 RefPtr<TestOverloadedConstructors> impl = TestOverloadedConstructors::create (string);
103 v8::Handle<v8::Object> wrapper = args.Holder(); 103 v8::Handle<v8::Object> wrapper = args.Holder();
104 104
105 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent); 105 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestOverloadedCo nstructors::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
106 return wrapper; 106 args.GetReturnValue().Set(wrapper);
107 } 107 }
108 108
109 static v8::Handle<v8::Value> constructor(const v8::Arguments& args) 109 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
110 { 110 {
111 if ((args.Length() == 1 && (V8ArrayBuffer::HasInstance(args[0], args.GetIsol ate(), worldType(args.GetIsolate()))))) 111 if ((args.Length() == 1 && (V8ArrayBuffer::HasInstance(args[0], args.GetIsol ate(), worldType(args.GetIsolate()))))) {
112 return TestOverloadedConstructorsV8Internal::constructor1(args); 112 TestOverloadedConstructorsV8Internal::constructor1(args);
113 if ((args.Length() == 1 && (V8ArrayBufferView::HasInstance(args[0], args.Get Isolate(), worldType(args.GetIsolate()))))) 113 return;
114 return TestOverloadedConstructorsV8Internal::constructor2(args); 114 }
115 if ((args.Length() == 1 && (V8Blob::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))))) 115 if ((args.Length() == 1 && (V8ArrayBufferView::HasInstance(args[0], args.Get Isolate(), worldType(args.GetIsolate()))))) {
116 return TestOverloadedConstructorsV8Internal::constructor3(args); 116 TestOverloadedConstructorsV8Internal::constructor2(args);
117 if (args.Length() == 1) 117 return;
118 return TestOverloadedConstructorsV8Internal::constructor4(args); 118 }
119 if (args.Length() < 1) 119 if ((args.Length() == 1 && (V8Blob::HasInstance(args[0], args.GetIsolate(), worldType(args.GetIsolate()))))) {
120 return throwNotEnoughArgumentsError(args.GetIsolate()); 120 TestOverloadedConstructorsV8Internal::constructor3(args);
121 return throwTypeError(0, args.GetIsolate()); 121 return;
122 }
123 if (args.Length() == 1) {
124 TestOverloadedConstructorsV8Internal::constructor4(args);
125 return;
126 }
127 if (args.Length() < 1) {
128 throwNotEnoughArgumentsError(args.GetIsolate());
129 return;
130 }
131 throwTypeError(0, args.GetIsolate());
132 return;
122 } 133 }
123 134
124 } // namespace TestOverloadedConstructorsV8Internal 135 } // namespace TestOverloadedConstructorsV8Internal
125 136
126 v8::Handle<v8::Value> V8TestOverloadedConstructors::constructorCallback(const v8 ::Arguments& args) 137 void V8TestOverloadedConstructors::constructorCallback(const v8::FunctionCallbac kInfo<v8::Value>& args)
127 { 138 {
128 if (!args.IsConstructCall()) 139 if (!args.IsConstructCall()) {
129 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate()); 140 throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
141 return;
142 }
130 143
131 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) 144 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
132 return args.Holder(); 145 args.GetReturnValue().Set(args.Holder());
146 return;
147 }
133 148
134 return TestOverloadedConstructorsV8Internal::constructor(args); 149 TestOverloadedConstructorsV8Internal::constructor(args);
135 } 150 }
136 151
137 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestOverloadedConstructor sTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, Wrapp erWorldType currentWorldType) 152 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestOverloadedConstructor sTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, Wrapp erWorldType currentWorldType)
138 { 153 {
139 desc->ReadOnlyPrototype(); 154 desc->ReadOnlyPrototype();
140 155
141 v8::Local<v8::Signature> defaultSignature; 156 v8::Local<v8::Signature> defaultSignature;
142 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestOverload edConstructors", v8::Persistent<v8::FunctionTemplate>(), V8TestOverloadedConstru ctors::internalFieldCount, 157 defaultSignature = V8DOMConfiguration::configureTemplate(desc, "TestOverload edConstructors", v8::Persistent<v8::FunctionTemplate>(), V8TestOverloadedConstru ctors::internalFieldCount,
143 0, 0, 158 0, 0,
144 0, 0, isolate, currentWorldType); 159 0, 0, isolate, currentWorldType);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 installPerContextProperties(wrapper, impl.get(), isolate); 205 installPerContextProperties(wrapper, impl.get(), isolate);
191 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, Wrap perConfiguration::Independent); 206 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, Wrap perConfiguration::Independent);
192 return wrapper; 207 return wrapper;
193 } 208 }
194 void V8TestOverloadedConstructors::derefObject(void* object) 209 void V8TestOverloadedConstructors::derefObject(void* object)
195 { 210 {
196 static_cast<TestOverloadedConstructors*>(object)->deref(); 211 static_cast<TestOverloadedConstructors*>(object)->deref();
197 } 212 }
198 213
199 } // namespace WebCore 214 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestOverloadedConstructors.h ('k') | Source/bindings/tests/results/V8TestTypedefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698