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

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

Issue 946973005: IDL: Drop value conversion (V8 -> C++) macros from generated code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index abbd3fdcb5e710b26fa3e970e9fbc827d746710e..7655d64c235c57dcffc99a7151bc92b45b3ff7b8 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -362,6 +362,25 @@ inline v8::Handle<v8::Value> v8Undefined()
return v8::Handle<v8::Value>();
}
+// Used in generated code as e.g.
+//
+// if (!convertAndThrow(target = toInt32(..., exceptionState), exceptionState))
+// return;
+//
+// for conversion to types where the conversion function returns the converted
+// value (except via a macro that just expects an expression returning false in
+// case of an error.)
+template <typename T>
+bool convertAndCheck(T, ExceptionState& exceptionState)
+{
+ return !exceptionState.hadException();
+}
+template <typename T>
+bool convertAndThrow(T, ExceptionState& exceptionState)
bashi 2015/02/23 23:44:06 convertOrThrow?
+{
+ return !exceptionState.throwIfNeeded();
+}
+
// Conversion flags, used in toIntXX/toUIntXX.
enum IntegerConversionConfiguration {
NormalConversion,

Powered by Google App Engine
This is Rietveld 408576698