Chromium Code Reviews| Index: Source/bindings/v8/V8BindingMacros.h |
| diff --git a/Source/bindings/v8/V8BindingMacros.h b/Source/bindings/v8/V8BindingMacros.h |
| index 95e3cbbf7a52b3b52101630bc35d3dca56dfce03..90cd84197abc5bc7e7d09570fb07d40e334e2540 100644 |
| --- a/Source/bindings/v8/V8BindingMacros.h |
| +++ b/Source/bindings/v8/V8BindingMacros.h |
| @@ -57,6 +57,19 @@ namespace WebCore { |
| } \ |
| } |
| +#define TONATIVE_VOID_ASYNC(type, var, value, info) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + v8::Isolate* isolate = info.GetIsolate(); \ |
| + ScriptPromise promise = ScriptPromise::reject(block.Exception(), isolate); \ |
| + v8SetReturnValue(info, promise.v8Value()); \ |
| + return; \ |
| + } \ |
| + } |
| + |
| #define TONATIVE_BOOL(type, var, value, retVal) \ |
| type var; \ |
| { \ |
| @@ -79,29 +92,67 @@ namespace WebCore { |
| return; \ |
| } |
| +#define TONATIVE_VOID_EXCEPTIONSTATE_ASYNC(type, var, value, exceptionState, info) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) \ |
| + exceptionState.rethrowV8Exception(block.Exception()); \ |
| + if (UNLIKELY(exceptionState.hadException())) { \ |
| + v8SetReturnValue(info, exceptionState.reject().v8Value()); \ |
| + return; \ |
| + } \ |
| + } |
| + |
| #define TONATIVE_BOOL_EXCEPTIONSTATE(type, var, value, exceptionState, retVal) \ |
|
pneubeck (no reviews)
2014/04/17 09:27:04
As discussed with haraken@, this (and the other _B
Nils Barth (inactive)
2014/04/18 05:27:56
Fix posted:
Rename macros TONATIVE_BOOL* and TOSTR
yhirano
2014/04/18 16:55:54
Thanks!
|
| - type var; \ |
| - { \ |
| - v8::TryCatch block; \ |
| - var = (value); \ |
| - if (UNLIKELY(block.HasCaught())) \ |
| - exceptionState.rethrowV8Exception(block.Exception()); \ |
| - if (UNLIKELY(exceptionState.throwIfNeeded())) \ |
| - return 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_VOID(type, var, value) \ |
| + type var(value); \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var.prepare(); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + block.ReThrow(); \ |
| + return; \ |
| + } \ |
| + } |
| #define TOSTRING_BOOL(type, var, value, retVal) \ |
| - type var(value); \ |
| - if (UNLIKELY(!var.prepare())) \ |
| - return retVal; |
| + type var(value); \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var.prepare(); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + block.ReThrow(); \ |
| + return retVal; \ |
| + } \ |
| + } |
| + |
| +#define TOSTRING_VOID_ASYNC(type, var, value, info) \ |
| + type var(value); \ |
| + { \ |
| + v8::TryCatch block; \ |
| + var.prepare(); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + v8::Isolate* isolate = info.GetIsolate(); \ |
| + ScriptPromise promise = ScriptPromise::reject(block.Exception(), isolate); \ |
| + v8SetReturnValue(info, promise.v8Value()); \ |
| + return; \ |
| + } \ |
| + } |
| } // namespace WebCore |