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

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

Issue 970403003: bindings: Use V8 MaybeLocal APIs in V8DeviceMotionEventCustom (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
« no previous file with comments | « no previous file | Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | Source/bindings/modules/v8/custom/V8DeviceMotionEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698