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

Unified Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 111373003: Migrate bindings constructors to the new ExceptionState model. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
Index: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index fafa147dbfbf4316450e6ae06852f44b89c4aea6..f9b0cf534ddb421420e4a3b34879bb0f17e7765a 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2723,6 +2723,7 @@ sub GenerateSingleConstructorCallback
my $interface = shift;
my $function = shift;
+ my $interfaceName = $interface->name;
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $overloadedIndexString = "";
@@ -2747,7 +2748,7 @@ END
if ($raisesExceptions) {
AddToImplIncludes("bindings/v8/ExceptionState.h");
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::ConstructionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
}
# FIXME: Currently [Constructor(...)] does not yet support optional arguments without [Default=...]
@@ -2863,6 +2864,7 @@ sub GenerateConstructor
sub GenerateEventConstructor
{
my $interface = shift;
+
jochen (gone - plz use gerrit) 2013/12/10 11:41:19 spurious?
Mike West 2013/12/10 11:51:27 Yes (though I think it's probably good practice to
my $interfaceName = $interface->name;
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
@@ -2884,8 +2886,10 @@ sub GenerateEventConstructor
$implementation{nameSpaceInternal}->add(<<END);
static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ConstructionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());
if (info.Length() < 1) {
- throwTypeError(ExceptionMessages::failedToConstruct("$interfaceName", "An event name must be provided."), info.GetIsolate());
+ exceptionState.throwTypeError("An event name must be provided.");
+ exceptionState.throwIfNeeded();
return;
}
@@ -2900,7 +2904,6 @@ END
${implClassName}Init eventInit;
if (info.Length() >= 2) {
V8TRYCATCH_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate()));
- ExceptionState exceptionState(info.Holder(), info.GetIsolate());
if (!initialize${implClassName}(eventInit, options, exceptionState)) {
exceptionState.throwIfNeeded();
return;
@@ -2923,10 +2926,6 @@ END
my $exceptionStateArgument = "";
if ($constructorRaisesException) {
${exceptionStateArgument} = ", exceptionState";
- AddToImplIncludes("bindings/v8/ExceptionState.h");
- $implementation{nameSpaceInternal}->add(<<END);
- ExceptionState exceptionState(info.Holder(), info.GetIsolate());
-END
}
$implementation{nameSpaceInternal}->add(<<END);
@@ -3038,6 +3037,7 @@ sub GenerateNamedConstructor
my $function = shift;
my $interface = shift;
+ my $interfaceName = $interface->name;
my $implClassName = GetImplName($interface);
my $v8ClassName = GetV8ClassName($interface);
my $constructorRaisesException = $interface->extendedAttributes->{"RaisesException"} && $interface->extendedAttributes->{"RaisesException"} eq "Constructor";
@@ -3087,7 +3087,7 @@ END
if ($raisesExceptions) {
AddToImplIncludes("bindings/v8/ExceptionState.h");
- $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
+ $code .= " ExceptionState exceptionState(ExceptionState::ConstructionContext, \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
}
my ($parameterCheckString, $paramIndex, %replacements) = GenerateParametersCheck($function, $interface);

Powered by Google App Engine
This is Rietveld 408576698