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

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

Issue 16951005: Add support for byte and octet Web IDL types to the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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/v8/V8Binding.h
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index e2c8c944f86589048bc26638d62801fcca04aaa2..fbe62a7a2d3b742a0fa5acd0ce995170df692219 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -282,6 +282,32 @@ namespace WebCore {
// FIXME: Implement Clamp
};
+ // 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
+ int8_t toInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
+ inline int8_t toInt8(v8::Handle<v8::Value> value, bool& ok) { return toInt8(value, NormalConversion, ok); }
+
+ // Convert a value to a 8-bit integer assuming the conversion cannot fail.
+ inline int8_t toInt8(v8::Handle<v8::Value> value)
+ {
+ bool ok;
+ return toInt8(value, NormalConversion, ok);
+ }
+
+ // Convert a value to a 8-bit unsigned 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-octet
+ uint8_t toUInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
+ inline uint8_t toUInt8(v8::Handle<v8::Value> value, bool& ok) { return toUInt8(value, NormalConversion, ok); }
+
+ // Convert a value to a 8-bit unsigned integer assuming the conversion cannot fail.
+ inline uint8_t toUInt8(v8::Handle<v8::Value> value)
+ {
+ bool ok;
+ return toUInt8(value, NormalConversion, ok);
+ }
+
// Convert a value to a 32-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-long

Powered by Google App Engine
This is Rietveld 408576698