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..14601dd9b40db85bd74ac1a8d1d8ab8366a530d8 100644 |
| --- a/Source/bindings/core/v8/V8BindingMacros.h |
| +++ b/Source/bindings/core/v8/V8BindingMacros.h |
| @@ -77,6 +77,22 @@ namespace blink { |
| if (UNLIKELY(!var.prepare())) \ |
| return retVal; |
| +template <typename T> |
| +bool inline v8Maybe(v8::Maybe<T> maybe, T& outVariable) |
| +{ |
| + if (maybe.IsNothing()) |
| + return false; |
| + outVariable = maybe.FromJust(); |
| + return true; |
| +} |
| + |
| +#define V8_MAYBE(outVariable, handle, methodCall, failureExpression) \ |
| + if (handle.IsEmpty() || !v8Maybe(handle->methodCall, outVariable)) { \ |
|
haraken
2015/03/11 02:43:21
Do we need the handle.IsEmpty() check? It could be
bashi
2015/03/11 03:46:26
I think IsEmpty() check reduces many hand-written
|
| + do { \ |
| + failureExpression; \ |
| + } while (false); \ |
| + } |
| + |
| } // namespace blink |
| #endif // V8BindingMacros_h |