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 77a7faafd9a59fd952e4ad244a637f205fda3013..78b27d28ed5110ecea13db7dadb055ff6a57c667 100644 |
| --- a/Source/bindings/core/v8/V8BindingMacros.h |
| +++ b/Source/bindings/core/v8/V8BindingMacros.h |
| @@ -77,6 +77,19 @@ namespace blink { |
| if (UNLIKELY(!var.prepare())) \ |
| return retVal; |
| +// Use this macro to call V8 APIs which return MaybeLocal<T>. |
| +#define CALL_V8_MAYBELOCAL(outVariable, isolate, callExpression, exceptionState, failureReturnValue) \ |
|
haraken
2015/03/06 02:44:07
Do we need the isolate parameter?
haraken
2015/03/06 02:44:07
Nit: I'd prefer calling this CALL_V8, since we don
bashi
2015/03/06 02:54:44
It seems that v8::V8::IsExecutionTerminating() is
bashi
2015/03/06 02:54:44
I'm fine with dropping _MAYBELOCAL, but what the n
|
| + { \ |
| + v8::TryCatch block; \ |
|
haraken
2015/03/06 02:44:07
Why do we need this TryCatch block?
- It's heavy
bashi
2015/03/06 02:54:44
Yeah, this is my concern, but...
Yuki
2015/03/06 04:30:03
Maybe, we'd better ask V8 team to make ToLocal() r
bashi
2015/03/06 05:11:37
@dcarney, WDYT?
haraken
2015/03/06 05:30:51
I'm confused. ToLocal() already returns false when
|
| + if ((callExpression).ToLocal(&outVariable)) { \ |
|
Yuki
2015/03/06 04:30:03
Did you mean?:
if (!(...))
I thought that ToLoc
bashi
2015/03/06 05:11:37
ToLocal() returns true when the MaybeLocal<T> is e
|
| + if (isolate->IsExecutionTerminating()) \ |
| + return failureReturnValue; \ |
| + if (block.HasCaught()) \ |
| + exceptionState.rethrowV8Exception(block.Exception()); \ |
| + return failureReturnValue; \ |
| + } \ |
| + } |
| + |
| } // namespace blink |
| #endif // V8BindingMacros_h |