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

Unified Diff: Source/bindings/tests/results/V8TestTypedefs.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/V8TestTypedefs.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/tests/results/V8TestTypedefs.cpp
diff --git a/Source/bindings/tests/results/V8TestTypedefs.cpp b/Source/bindings/tests/results/V8TestTypedefs.cpp
index 46b08a1fa47beecb18fc0ea809c5256d3cb72e26..307d8e41f59f07104f70eb73087530d3824fdc87 100644
--- a/Source/bindings/tests/results/V8TestTypedefs.cpp
+++ b/Source/bindings/tests/results/V8TestTypedefs.cpp
@@ -404,20 +404,24 @@ static v8::Handle<v8::Value> methodWithExceptionMethodCallback(const v8::Argumen
return TestTypedefsV8Internal::methodWithExceptionMethod(args);
}
-static v8::Handle<v8::Value> constructor(const v8::Arguments& args)
+static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- if (args.Length() < 2)
- return throwNotEnoughArgumentsError(args.GetIsolate());
- V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, hello, args[0]);
- if (args.Length() <= 1 || !args[1]->IsFunction())
- return throwTypeError(0, args.GetIsolate());
+ if (args.Length() < 2) {
+ throwNotEnoughArgumentsError(args.GetIsolate());
+ return;
+ }
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, args[0]);
+ if (args.Length() <= 1 || !args[1]->IsFunction()) {
+ throwTypeError(0, args.GetIsolate());
+ return;
+ }
RefPtr<TestCallback> testCallback = V8TestCallback::create(args[1], getScriptExecutionContext());
RefPtr<TestTypedefs> impl = TestTypedefs::create(hello, testCallback);
v8::Handle<v8::Object> wrapper = args.Holder();
V8DOMWrapper::associateObjectWithWrapper(impl.release(), &V8TestTypedefs::info, wrapper, args.GetIsolate(), WrapperConfiguration::Dependent);
- return wrapper;
+ args.GetReturnValue().Set(wrapper);
}
} // namespace TestTypedefsV8Internal
@@ -451,15 +455,19 @@ static const V8DOMConfiguration::BatchedMethod V8TestTypedefsMethods[] = {
{"methodWithException", TestTypedefsV8Internal::methodWithExceptionMethodCallback, 0, 0},
};
-v8::Handle<v8::Value> V8TestTypedefs::constructorCallback(const v8::Arguments& args)
+void V8TestTypedefs::constructorCallback(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;
+ }
- return TestTypedefsV8Internal::constructor(args);
+ TestTypedefsV8Internal::constructor(args);
}
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestTypedefsTemplate(v8::Persistent<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType currentWorldType)
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698