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..bc2622b5d98f97794f4cbb46126bcb2f2ac86f62 100644 |
--- a/Source/bindings/core/v8/V8BindingMacros.h |
+++ b/Source/bindings/core/v8/V8BindingMacros.h |
@@ -77,6 +77,24 @@ namespace blink { |
if (UNLIKELY(!var.prepare())) \ |
return retVal; |
+template <typename T> |
+bool inline getValueFromMaybe(v8::Maybe<T> maybe, T& outVariable) |
Yuki
2015/03/11 07:55:22
nit: s/bool inline/inline bool/
bashi
2015/03/11 10:22:35
Done.
|
+{ |
+ if (maybe.IsNothing()) |
+ return false; |
+ outVariable = maybe.FromJust(); |
+ return true; |
+} |
+ |
+#define V8_CALL(outVariable, handle, methodCall, failureExpression) \ |
Yuki
2015/03/11 07:55:22
nit: You cannot use 'break' in failureExpression.
bashi
2015/03/11 10:22:35
Thanks, I took "if (...) { failureExpression; } el
|
+ do { \ |
+ if (handle.IsEmpty() || !getValueFromMaybe(handle->methodCall, outVariable)) { \ |
+ do { \ |
Jens Widell
2015/03/11 07:39:34
This inner do{}while() is OTOH strictly speaking r
bashi
2015/03/11 07:51:18
Oh, right. Done.
|
+ failureExpression; \ |
+ } while (false); \ |
+ } \ |
+ } while (false) |
+ |
} // namespace blink |
#endif // V8BindingMacros_h |