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

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

Issue 15877002: move constructors to new style callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemp late, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMOb ject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, Wra pperTypeObjectPrototype }; 57 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemp late, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMOb ject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, Wra pperTypeObjectPrototype };
58 58
59 namespace TestNamedConstructorV8Internal { 59 namespace TestNamedConstructorV8Internal {
60 60
61 template <typename T> void V8_USE(T) { } 61 template <typename T> void V8_USE(T) { }
62 62
63 } // namespace TestNamedConstructorV8Internal 63 } // namespace TestNamedConstructorV8Internal
64 64
65 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstruct orConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedCons tructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextProto typeProperties, 0, WrapperTypeObjectPrototype }; 65 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstruct orConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedCons tructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextProto typeProperties, 0, WrapperTypeObjectPrototype };
66 66
67 static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8: :Arguments& args) 67 static void V8TestNamedConstructorConstructorCallback(const v8::FunctionCallback Info<v8::Value>& args)
68 { 68 {
69 if (!args.IsConstructCall()) 69 if (!args.IsConstructCall()) {
70 return throwTypeError("DOM object constructor cannot be called as a func tion.", args.GetIsolate()); 70 throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
71 return;
72 }
71 73
72 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) 74 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
73 return args.Holder(); 75 args.GetReturnValue().Set(args.Holder());
76 return;
77 }
74 78
75 Document* document = currentDocument(); 79 Document* document = currentDocument();
76 80
77 // Make sure the document is added to the DOM Node map. Otherwise, the TestN amedConstructor instance 81 // Make sure the document is added to the DOM Node map. Otherwise, the TestN amedConstructor instance
78 // may end up being the only node in the map and get garbage-collected prema turely. 82 // may end up being the only node in the map and get garbage-collected prema turely.
79 toV8(document, args.Holder(), args.GetIsolate()); 83 toV8(document, args.Holder(), args.GetIsolate());
80 84
81 if (args.Length() < 1) 85 if (args.Length() < 1) {
82 return throwNotEnoughArgumentsError(args.GetIsolate()); 86 throwNotEnoughArgumentsError(args.GetIsolate());
87 return;
88 }
83 ExceptionCode ec = 0; 89 ExceptionCode ec = 0;
84 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str1, args[0]); 90 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, args[0]);
85 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str2, args[1]); 91 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, args[1]);
86 V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str3, argumentOrNull(arg s, 2)); 92 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNul l(args, 2));
87 93
88 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru ctor(document, str1, str2, str3, ec); 94 RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstru ctor(document, str1, str2, str3, ec);
89 v8::Handle<v8::Object> wrapper = args.Holder(); 95 v8::Handle<v8::Object> wrapper = args.Holder();
90 if (ec) 96 if (ec) {
91 return setDOMException(ec, args.GetIsolate()); 97 setDOMException(ec, args.GetIsolate());
98 return;
99 }
92 100
93 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNamedConstru ctorConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Depende nt); 101 V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNamedConstru ctorConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Depende nt);
94 return wrapper; 102 args.GetReturnValue().Set(wrapper);
95 } 103 }
96 104
97 v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTempl ate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 105 v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTempl ate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
98 { 106 {
99 static v8::Persistent<v8::FunctionTemplate> cachedTemplate; 107 static v8::Persistent<v8::FunctionTemplate> cachedTemplate;
100 if (!cachedTemplate.IsEmpty()) 108 if (!cachedTemplate.IsEmpty())
101 return cachedTemplate; 109 return cachedTemplate;
102 110
103 v8::HandleScope scope; 111 v8::HandleScope scope;
104 v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8TestNam edConstructorConstructorCallback); 112 v8::Local<v8::FunctionTemplate> result = v8::FunctionTemplate::New(V8TestNam edConstructorConstructorCallback);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 installPerContextProperties(wrapper, impl.get(), isolate); 179 installPerContextProperties(wrapper, impl.get(), isolate);
172 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, Wrap perConfiguration::Dependent); 180 V8DOMWrapper::associateObjectWithWrapper(impl, &info, wrapper, isolate, Wrap perConfiguration::Dependent);
173 return wrapper; 181 return wrapper;
174 } 182 }
175 void V8TestNamedConstructor::derefObject(void* object) 183 void V8TestNamedConstructor::derefObject(void* object)
176 { 184 {
177 static_cast<TestNamedConstructor*>(object)->deref(); 185 static_cast<TestNamedConstructor*>(object)->deref();
178 } 186 }
179 187
180 } // namespace WebCore 188 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/bindings/tests/results/V8TestNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698