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..af4de06365a5b56a248bafdf28afe1d8097ce1b2 100644 |
| --- a/Source/bindings/v8/V8BindingMacros.h |
| +++ b/Source/bindings/v8/V8BindingMacros.h |
| @@ -33,6 +33,9 @@ |
| namespace WebCore { |
| +// Naming scheme: |
| +// COMMAND[_VOID][_ARG]... |
|
haraken
2014/04/11 02:33:20
COMMAND[_RETURNTYPE][_ARGUMENTTYPE]... ?
Currentl
Nils Barth (inactive)
2014/04/11 03:00:56
How about
TONATIVE[_TYPE][_ARGUMENTTYPE]...
That w
haraken
2014/04/11 03:28:59
Actually, TONATIVE_BOOL and TONATIVE_STRING are di
|
| + |
| #define V8TRYCATCH(type, var, value) \ |
|
haraken
2014/04/11 02:33:20
V8TRYCATCH_EXCEPTION ?
|
| type var; \ |
| { \ |
| @@ -42,6 +45,17 @@ namespace WebCore { |
| return block.ReThrow(); \ |
| } |
| +#define V8TRYCATCH_VOID(type, var, value) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + block.ReThrow(); \ |
| + return; \ |
| + } \ |
| + } |
| + |
| #define V8TRYCATCH_RETURN(type, var, value, retVal) \ |
|
haraken
2014/04/11 02:33:20
V8TRYCATCH_BOOL ?
|
| type var; \ |
| { \ |
| @@ -53,6 +67,17 @@ namespace WebCore { |
| } \ |
| } |
| +#define V8TRYCATCH_VOID_EXCEPTION(type, var, value, exceptionState) \ |
|
haraken
2014/04/11 02:33:20
V8TRYCATCH_VOID_EXCEPTIONSTATE ?
|
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) \ |
| + exceptionState.rethrowV8Exception(block.Exception()); \ |
| + if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| + return; \ |
| + } |
| + |
| #define V8TRYCATCH_EXCEPTION_RETURN(type, var, value, exceptionState, retVal) \ |
|
haraken
2014/04/11 02:33:20
V8TRYCATCH_BOOL_EXCEPTIONSTATE ?
|
| type var; \ |
| { \ |
| @@ -64,38 +89,16 @@ namespace WebCore { |
| return retVal; \ |
| } |
| -#define V8TRYCATCH_VOID(type, var, value) \ |
| - type var; \ |
| - { \ |
| - v8::TryCatch block; \ |
| - var = (value); \ |
| - if (UNLIKELY(block.HasCaught())) { \ |
| - block.ReThrow(); \ |
| - return; \ |
| - } \ |
| - } |
| - |
| -#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 V8STRINGRESOURCE_PREPARE_VOID(type, var, value) \ |
| + type var(value); \ |
|
haraken
2014/04/11 02:33:20
You can drop the |type| parameter, because |type|
Nils Barth (inactive)
2014/04/11 03:00:56
V8StringResource<> is a class template, and is ins
haraken
2014/04/11 03:28:59
Makes sense.
Nils Barth (inactive)
2014/04/11 06:01:38
Anyway, added a comment about usage.
|
| + if (UNLIKELY(!var.prepare())) \ |
| + return; |
| -#define V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(type, var, value, retVal) \ |
| - type var(value); \ |
| - if (UNLIKELY(!var.prepare())) \ |
| +#define V8STRINGRESOURCE_PREPARE_RETURN(type, var, value, retVal) \ |
| + type var(value); \ |
|
haraken
2014/04/11 02:33:20
Ditto.
|
| + if (UNLIKELY(!var.prepare())) \ |
| return retVal; |
| -#define V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(type, var, value) \ |
| - type var(value); \ |
| - if (UNLIKELY(!var.prepare())) \ |
| - return; |
| - |
| } // namespace WebCore |
| #endif // V8BindingMacros_h |