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

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

Issue 2121663002: Add IMMEDIATE_CRASH to measure how much V8 APIs return empty MaybeLocal handles Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h b/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h
index 6f84252260e02cd6de62abffa92ec447a3b66562..583266b7225600ba8c74f3a20179b1706d4e13cf 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.h
@@ -54,11 +54,15 @@ namespace blink {
(value->IsArrayBufferView() && (value.As<v8::ArrayBufferView>()->ByteLength() <= 64) ? \
alloca(value.As<v8::ArrayBufferView>()->ByteLength()) : nullptr)
+void emptyMaybeHandleReturned();
+
template <typename T>
inline bool v8Call(v8::Maybe<T> maybe, T& outVariable)
{
- if (maybe.IsNothing())
+ if (maybe.IsNothing()) {
+ emptyMaybeHandleReturned();
return false;
+ }
outVariable = maybe.FromJust();
return true;
}
@@ -74,13 +78,18 @@ inline bool v8Call(v8::Maybe<T> maybe, T& outVariable, v8::TryCatch& tryCatch)
{
bool success = v8Call(maybe, outVariable);
ASSERT(success || tryCatch.HasCaught());
+ if (!success)
+ emptyMaybeHandleReturned();
return success;
}
template <typename T>
inline bool v8Call(v8::MaybeLocal<T> maybeLocal, v8::Local<T>& outVariable)
{
- return maybeLocal.ToLocal(&outVariable);
+ bool success = maybeLocal.ToLocal(&outVariable);
+ if (!success)
+ emptyMaybeHandleReturned();
+ return success;
}
template <typename T>
@@ -88,6 +97,8 @@ inline bool v8Call(v8::MaybeLocal<T> maybeLocal, v8::Local<T>& outVariable, v8::
{
bool success = maybeLocal.ToLocal(&outVariable);
ASSERT(success || tryCatch.HasCaught());
+ if (!success)
+ emptyMaybeHandleReturned();
return success;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/V8BindingMacros.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698