Index: Source/bindings/core/v8/V8Binding.h |
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h |
index 9b6b2fdf371356204a539ee315c72835bd7dab68..13bc55f0272bdc22be4b60bb37088cc4eeaa4532 100644 |
--- a/Source/bindings/core/v8/V8Binding.h |
+++ b/Source/bindings/core/v8/V8Binding.h |
@@ -387,6 +387,18 @@ enum IntegerConversionConfiguration { |
Clamp |
}; |
+// Convert a value to a boolean. |
+inline bool toBoolean(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) |
+{ |
+ if (value->IsBoolean()) |
vivekg
2015/04/10 05:43:47
Shall we split this into fast (inline toBoolean) a
vivekg
2015/04/10 05:47:36
Or may be wrap it using
inline bool toBoolean(v8
haraken
2015/04/10 05:48:01
Yeah, it's good to minimize the inlined part. We c
bashi
2015/04/10 06:39:54
Done.
|
+ return value.As<v8::Boolean>()->Value(); |
+ v8::TryCatch block; |
+ bool result = false; |
+ if (!v8Call(value->BooleanValue(isolate->GetCurrentContext()), result, block)) |
+ exceptionState.rethrowV8Exception(block.Exception()); |
+ return result; |
+} |
+ |
// Convert a value to a 8-bit signed integer. The conversion fails if the |
// value cannot be converted to a number or the range violated per WebIDL: |
// http://www.w3.org/TR/WebIDL/#es-byte |