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..780b8715d0f795bbf3dd3149f4f8c3a754c7c99f 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 getValueFromMaybe(v8::Maybe<T> maybe, T& outVariable) |
+{ |
+ if (maybe.IsNothing()) |
+ return false; |
+ outVariable = maybe.FromJust(); |
+ return true; |
+} |
+ |
+#define V8_CALL(outVariable, handle, methodCall, failureExpression) \ |
+ if (handle.IsEmpty() || !getValueFromMaybe(handle->methodCall, outVariable)) { \ |
Jens Widell
2015/03/11 07:18:22
Wrap the whole macro body in a do{}while()? Define
bashi
2015/03/11 07:33:43
Done.
|
+ do { \ |
+ failureExpression; \ |
+ } while (false); \ |
+ } |
+ |
} // namespace blink |
#endif // V8BindingMacros_h |