Chromium Code Reviews| 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, |