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

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: avoid some unused v8::TryCatch objects 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/v8/V8BindingMacros.h
diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h
index e5841c9beda84810daf9ed7ea80f01cb7aca48cd..269c5fa2f4f00421d340f8e58cc85357ddb283a2 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_NO_DECL(var, value) \
haraken 2014/05/08 03:45:06 Nit: _NO_DECL => _INTERNAL ? It's dangerous to al
Jens Widell 2014/05/08 16:38:05 Renamed.
+ 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_NO_DECL(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_NO_DECL(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_NO_DECL(var, value, exceptionState); \
}
#define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal) \
@@ -98,6 +104,11 @@ namespace WebCore {
if (UNLIKELY(!var.prepare())) \
haraken 2014/05/08 03:45:06 Can we use TOSTRING_VOID_NO_DECL here?
Jens Widell 2014/05/08 06:22:06 Make this type var; TOSTRING_VOID_NO_DECL(var
return;
+#define TOSTRING_VOID_NO_DECL(var, value) \
+ var = value; \
+ if (UNLIKELY(!var.prepare())) \
+ return;
+
#define TOSTRING_DEFAULT(type, var, value, retVal) \
type var(value); \
if (UNLIKELY(!var.prepare())) \

Powered by Google App Engine
This is Rietveld 408576698