Chromium Code Reviews| Index: Source/bindings/core/v8/V8BindingMacros.h |
| diff --git a/Source/bindings/core/v8/V8BindingMacros.h b/Source/bindings/core/v8/V8BindingMacros.h |
| index 165d5b7b0144f1c7756a018f4110c2bc2a598063..2756f1d76c74f25a306b99ad4320e4c046461f32 100644 |
| --- a/Source/bindings/core/v8/V8BindingMacros.h |
| +++ b/Source/bindings/core/v8/V8BindingMacros.h |
| @@ -70,6 +70,23 @@ namespace blink { |
| } \ |
| } |
| +#define TONATIVE_VOID_ASYNC_INTERNAL(var, value, info) \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), block.Exception())); \ |
| + rethrow.cancel(); \ |
| + return; \ |
| + } |
| + |
| +#define TONATIVE_VOID_ASYNC(type, var, value, info) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + V8RethrowTryCatchScope rethrow(block); \ |
|
haraken
2014/07/31 07:54:47
Do we need this? It looks redundant to set a V8Ret
yhirano
2014/08/01 02:27:57
We need this to reuse the x_ASYNC_INTERNAL macro i
haraken
2014/08/01 02:42:40
Makes sense. Let's keep the x_ASYNC_INTERNAL macro
|
| + TONATIVE_VOID_ASYNC_INTERNAL(var, value, info); \ |
| + } |
| + |
| + |
| #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \ |
| var = (value); \ |
| if (UNLIKELY(block.HasCaught() || exceptionState.throwIfNeeded())) \ |
| @@ -93,6 +110,26 @@ namespace blink { |
| return retVal; \ |
| } |
| +#define TONATIVE_VOID_EXCEPTIONSTATE_ASYNC_INTERNAL(scriptState, var, value, exceptionState, info) \ |
| + var = (value); \ |
| + if (UNLIKELY(block.HasCaught())) { \ |
| + v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), block.Exception())); \ |
| + rethrow.cancel(); \ |
|
haraken
2014/07/31 07:54:47
Shall we add a comment and mention why we need to
yhirano
2014/08/01 02:27:57
Done.
|
| + return; \ |
| + } \ |
| + if (UNLIKELY(exceptionState.hadException())) { \ |
| + v8SetReturnValue(info, exceptionState.reject(scriptState).v8Value()); \ |
| + return; \ |
| + } |
| + |
| +#define TONATIVE_VOID_EXCEPTIONSTATE_ASYNC(scriptState, type, var, value, exceptionState, info) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + V8RethrowTryCatchScope rethrow(block); \ |
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scriptState, var, value, exceptionState, info); \ |
|
haraken
2014/07/31 07:54:47
Why doesn't this call TONATIVE_VOID_EXCEPTIONSTATE
yhirano
2014/08/01 02:27:57
You're right. Thanks, done.
|
| + } |
| + |
| // 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 |
| @@ -111,6 +148,22 @@ namespace blink { |
| if (UNLIKELY(!var.prepare())) \ |
| return retVal; |
| +#define TOSTRING_VOID_ASYNC_INTERNAL(var, value, info) \ |
| + var = (value); \ |
| + if (UNLIKELY(!var.prepare())) { \ |
| + rethrow.cancel(); \ |
|
haraken
2014/07/31 07:54:47
Just for consistency, let's move rethrow.cancel()
yhirano
2014/08/01 02:27:57
Done.
|
| + info.GetReturnValue().Set(ScriptPromise::rejectRaw(info.GetIsolate(), block.Exception())); \ |
| + return; \ |
| + } |
| + |
| +#define TOSTRING_VOID_ASYNC(type, var, value, info) \ |
| + type var; \ |
| + { \ |
| + v8::TryCatch block; \ |
| + V8RethrowTryCatchScope rethrow(block); \ |
| + TOSTRING_VOID_ASYNC_INTERNAL(type, var, value, info); \ |
| + } |
| + |
| } // namespace blink |
| #endif // V8BindingMacros_h |