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

Unified Diff: Source/bindings/tests/results/V8TestInterfaceConstructor.cpp

Issue 265293004: Create fewer local v8::TryCatch objects in generated bindings code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added comment Created 6 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
Index: Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
index 06f016b15ad98ca9da7584662d64d9d7fd5a846e..ad3297df11a26b335c6eb3967c327b080e428066 100644
--- a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
+++ b/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
@@ -65,24 +65,37 @@ static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Isolate* isolate = info.GetIsolate();
ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), isolate);
- TONATIVE_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()));
- TOSTRING_VOID(V8StringResource<>, stringArg, info[1]);
- TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[2]));
- TONATIVE_VOID(Dictionary, dictionaryArg, Dictionary(info[3], info.GetIsolate()));
- if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
- exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object.");
- exceptionState.throwIfNeeded();
- return;
- }
- TONATIVE_VOID(Vector<String>, sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate()));
- TONATIVE_VOID(Vector<Dictionary>, sequenceDictionaryArg, toNativeArray<Dictionary>(info[5], 6, info.GetIsolate()));
- TONATIVE_VOID(Dictionary, optionalDictionaryArg, Dictionary(info[6], info.GetIsolate()));
- if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
- exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object.");
- exceptionState.throwIfNeeded();
- return;
+ double doubleArg;
+ V8StringResource<> stringArg;
+ TestInterfaceEmpty* testInterfaceEmptyArg;
+ Dictionary dictionaryArg;
+ Vector<String> sequenceStringArg;
+ Vector<Dictionary> sequenceDictionaryArg;
+ Dictionary optionalDictionaryArg;
+ TestInterfaceEmpty* optionalTestInterfaceEmptyArg;
+ {
+ v8::TryCatch block;
+ TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue()));
+ TOSTRING_VOID_INTERNAL_RETHROW(stringArg, info[1], block);
+ TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[2]));
+ TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[3], info.GetIsolate()));
+ if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
+ exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object.");
+ exceptionState.throwIfNeeded();
+ block.ReThrow();
+ return;
+ }
+ TONATIVE_VOID_INTERNAL(sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate()));
+ TONATIVE_VOID_INTERNAL(sequenceDictionaryArg, toNativeArray<Dictionary>(info[5], 6, info.GetIsolate()));
+ TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[6], info.GetIsolate()));
+ if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
+ exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object.");
+ exceptionState.throwIfNeeded();
+ block.ReThrow();
+ return;
+ }
+ TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7]));
}
- TONATIVE_VOID(TestInterfaceEmpty*, optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7]));
ExecutionContext* context = currentExecutionContext(isolate);
Document& document = *toDocument(currentExecutionContext(isolate));
RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequenceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTestInterfaceEmptyArg, exceptionState);
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface2.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698