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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface.cpp ('k') | Source/bindings/tests/results/V8TestNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestNamedConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestNamedConstructor.cpp b/Source/bindings/tests/results/V8TestNamedConstructor.cpp
index f84f4a4823b8566d2ed9e46a84019aaea539c578..c4b0c05c20cf8386c75ed0261a9351792184111f 100644
--- a/Source/bindings/tests/results/V8TestNamedConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestNamedConstructor.cpp
@@ -64,13 +64,17 @@ template <typename T> void V8_USE(T) { }
WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
-static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)
+static void V8TestNamedConstructorConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- if (!args.IsConstructCall())
- return throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
+ if (!args.IsConstructCall()) {
+ throwTypeError("DOM object constructor cannot be called as a function.", args.GetIsolate());
+ return;
+ }
- if (ConstructorMode::current() == ConstructorMode::WrapExistingObject)
- return args.Holder();
+ if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
+ args.GetReturnValue().Set(args.Holder());
+ return;
+ }
Document* document = currentDocument();
@@ -78,20 +82,24 @@ static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8:
// may end up being the only node in the map and get garbage-collected prematurely.
toV8(document, args.Holder(), args.GetIsolate());
- if (args.Length() < 1)
- return throwNotEnoughArgumentsError(args.GetIsolate());
+ if (args.Length() < 1) {
+ throwNotEnoughArgumentsError(args.GetIsolate());
+ return;
+ }
ExceptionCode ec = 0;
- V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str1, args[0]);
- V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str2, args[1]);
- V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, str3, argumentOrNull(args, 2));
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, args[0]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, args[1]);
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str3, argumentOrNull(args, 2));
RefPtr<TestNamedConstructor> impl = TestNamedConstructor::createForJSConstructor(document, str1, str2, str3, ec);
v8::Handle<v8::Object> wrapper = args.Holder();
- if (ec)
- return setDOMException(ec, args.GetIsolate());
+ if (ec) {
+ setDOMException(ec, args.GetIsolate());
+ return;
+ }
V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestNamedConstructorConstructor::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
- return wrapper;
+ args.GetReturnValue().Set(wrapper);
}
v8::Persistent<v8::FunctionTemplate> V8TestNamedConstructorConstructor::GetTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
« 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