Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: Source/bindings/core/v8/V8BindingMacros.h

Issue 993333002: bindings: Use Maybe APIs in toXXX() functions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/V8BindingMacros.h
diff --git a/Source/bindings/core/v8/V8BindingMacros.h b/Source/bindings/core/v8/V8BindingMacros.h
index d99f9c09837e53de5e8ad3d50056663507fb35f4..c774bd44e90a19bb14be356d2bc92ed21bf212bd 100644
--- a/Source/bindings/core/v8/V8BindingMacros.h
+++ b/Source/bindings/core/v8/V8BindingMacros.h
@@ -78,14 +78,6 @@ namespace blink {
return retVal;
template <typename T>
-inline bool v8Call(v8::MaybeLocal<T> maybeLocal, v8::Local<T>& outVariable, v8::TryCatch& tryCatch)
-{
- bool success = maybeLocal.ToLocal(&outVariable);
- ASSERT(success || tryCatch.HasCaught());
- return success;
-}
-
-template <typename T>
inline bool getValueFromMaybe(v8::Maybe<T> maybe, T& outVariable)
{
if (maybe.IsNothing())
@@ -100,6 +92,22 @@ inline bool v8CallBoolean(v8::Maybe<bool> maybe)
return getValueFromMaybe(maybe, result) && result;
}
+template <typename T>
+inline bool v8Call(v8::Maybe<T> maybe, T& outVariable, v8::TryCatch& tryCatch)
+{
+ bool success = getValueFromMaybe(maybe, outVariable);
+ ASSERT(success || tryCatch.HasCaught());
+ return success;
+}
+
+template <typename T>
+inline bool v8Call(v8::MaybeLocal<T> maybeLocal, v8::Local<T>& outVariable, v8::TryCatch& tryCatch)
+{
+ bool success = maybeLocal.ToLocal(&outVariable);
+ ASSERT(success || tryCatch.HasCaught());
+ return success;
+}
+
// The last "else" is to avoid dangling else problem.
#define V8_CALL(outVariable, handle, methodCall, failureExpression) \
if (handle.IsEmpty() || !getValueFromMaybe(handle->methodCall, outVariable)) { \
« Source/bindings/core/v8/V8Binding.cpp ('K') | « Source/bindings/core/v8/V8Binding.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698