Chromium Code Reviews| Index: Source/bindings/v8/V8BindingMacros.h |
| diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h |
| index f5ab5832bef8783b2b6e8890d6f03dce09915a27..04c9a7b5e8a35f88953e473c8d69bee2f40be4f0 100644 |
| --- a/Source/bindings/v8/V8BindingMacros.h |
| +++ b/Source/bindings/v8/V8BindingMacros.h |
| @@ -33,38 +33,19 @@ |
| 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]... |
| -#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 +56,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_BOOL(type, var, value, exceptionState, retVal) \ |
|
haraken
2014/04/11 06:09:26
TONATIVE_BOOL_EXCEPTIONSTATE ?
I understand that
Nils Barth (inactive)
2014/04/11 07:40:16
Agreed, this is clearer (I was thinking the same t
|
| + 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_BOOL(type, var, value, retVal) \ |
|
haraken
2014/04/11 06:09:26
TOSTRING_BOOL ?
If you want to call this TOSTRING
|
| + type var(value); \ |
| + if (UNLIKELY(!var.prepare())) \ |
| + return retVal; |
| + |
| } // namespace WebCore |
| #endif // V8BindingMacros_h |