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

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

Issue 234403004: Rename V8TRYCATCH_* macros in v8/V8BindingMacros.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: BOOL*_BOOL -> BOOL* Created 6 years, 8 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/v8/V8Binding.cpp ('k') | Source/bindings/v8/V8Initializer.cpp » ('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 f5ab5832bef8783b2b6e8890d6f03dce09915a27..95e3cbbf7a52b3b52101630bc35d3dca56dfce03 100644
--- a/Source/bindings/v8/V8BindingMacros.h
+++ b/Source/bindings/v8/V8BindingMacros.h
@@ -33,38 +33,20 @@
namespace WebCore {
-#define V8TRYCATCH(type, var, value) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (UNLIKELY(block.HasCaught())) \
- return block.ReThrow(); \
- }
+// Naming scheme:
+// TO*_RETURNTYPE[_ARGTYPE]...
+// ...removing RETURNTYPE/ARGTYPE duplicate if an argument is simply returned
-#define V8TRYCATCH_RETURN(type, var, value, retVal) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (UNLIKELY(block.HasCaught())) { \
- block.ReThrow(); \
- return retVal; \
- } \
+#define TONATIVE_EXCEPTION(type, var, value) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ return block.ReThrow(); \
}
-#define V8TRYCATCH_EXCEPTION_RETURN(type, var, value, exceptionState, retVal) \
- type var; \
- { \
- v8::TryCatch block; \
- var = (value); \
- if (UNLIKELY(block.HasCaught())) \
- exceptionState.rethrowV8Exception(block.Exception()); \
- if (UNLIKELY(exceptionState.throwIfNeeded())) \
- return retVal; \
- }
-
-#define V8TRYCATCH_VOID(type, var, value) \
+#define TONATIVE_VOID(type, var, value) \
type var; \
{ \
v8::TryCatch block; \
@@ -75,27 +57,52 @@ namespace WebCore {
} \
}
-#define V8TRYCATCH_EXCEPTION_VOID(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_BOOL(type, var, value, retVal) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) { \
+ block.ReThrow(); \
+ return retVal; \
+ } \
}
-#define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \
- type var(value); \
- if (UNLIKELY(!var.prepare())) \
- return retVal;
+#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 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \
- type var(value); \
- if (UNLIKELY(!var.prepare())) \
+#define TONATIVE_BOOL_EXCEPTIONSTATE(type, var, value, exceptionState, retVal) \
+ type var; \
+ { \
+ v8::TryCatch block; \
+ var = (value); \
+ if (UNLIKELY(block.HasCaught())) \
+ exceptionState.rethrowV8Exception(block.Exception()); \
+ if (UNLIKELY(exceptionState.throwIfNeeded())) \
+ return retVal; \
+ }
+
+// type is an instance of class template V8StringResource<>,
+// but Mode argument varies; using type (not Mode) for consistency
+// with other macros and ease of code generation
+#define TOSTRING_VOID(type, var, value) \
+ type var(value); \
+ if (UNLIKELY(!var.prepare())) \
return;
+#define TOSTRING_BOOL(type, var, value, retVal) \
+ type var(value); \
+ if (UNLIKELY(!var.prepare())) \
+ return retVal;
+
} // namespace WebCore
#endif // V8BindingMacros_h
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/V8Initializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698