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

Unified Diff: Source/bindings/v8/V8BindingMacros.h

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
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8StringResource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8BindingMacros.h
diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h
index e5841c9beda84810daf9ed7ea80f01cb7aca48cd..1aa5ced3de2ff738a6a903469cdbd743f6d5dddb 100644
--- a/Source/bindings/v8/V8BindingMacros.h
+++ b/Source/bindings/v8/V8BindingMacros.h
@@ -46,15 +46,18 @@ namespace WebCore {
return block.ReThrow(); \
}
+#define TONATIVE_VOID_INTERNAL(var, value) \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) { \
+ block.ReThrow(); \
+ return; \
+ }
+
#define TONATIVE_VOID(type, var, value) \
type var; \
{ \
v8::TryCatch block; \
- var = (value); \
- if (UNLIKELY(block.HasCaught())) { \
- block.ReThrow(); \
- return; \
- } \
+ TONATIVE_VOID_INTERNAL(var, value); \
}
#define TONATIVE_DEFAULT(type, var, value, retVal) \
@@ -68,15 +71,18 @@ namespace WebCore {
} \
}
-#define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (UNLIKELY(block.HasCaught())) \
- exceptionState.rethrowV8Exception(block.Exception()); \
- if (UNLIKELY(exceptionState.throwIfNeeded())) \
- return; \
+#define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ exceptionState.rethrowV8Exception(block.Exception()); \
+ if (UNLIKELY(exceptionState.throwIfNeeded())) \
+ return;
+
+#define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \
}
#define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal) \
@@ -98,6 +104,18 @@ namespace WebCore {
if (UNLIKELY(!var.prepare())) \
return;
+#define TOSTRING_VOID_INTERNAL(var, value) \
+ var = (value); \
+ if (UNLIKELY(!var.prepare())) \
+ return;
+
+#define TOSTRING_VOID_INTERNAL_RETHROW(var, value, block) \
+ var = (value); \
+ if (UNLIKELY(!var.prepare())) { \
+ block.ReThrow(); \
+ return; \
+ }
+
#define TOSTRING_DEFAULT(type, var, value, retVal) \
type var(value); \
if (UNLIKELY(!var.prepare())) \
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/V8StringResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698