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

Side by Side 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: Take Joshua's feedback into consideration 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 v8::Handle<v8::Value> v8Array(PassRefPtr<DOMStringList>, v8::Isolate*); 276 v8::Handle<v8::Value> v8Array(PassRefPtr<DOMStringList>, v8::Isolate*);
277 277
278 // Conversion flags, used in toIntXX/toUIntXX. 278 // Conversion flags, used in toIntXX/toUIntXX.
279 enum IntegerConversionConfiguration { 279 enum IntegerConversionConfiguration {
280 NormalConversion, 280 NormalConversion,
281 EnforceRange, 281 EnforceRange,
282 // FIXME: Implement Clamp 282 // FIXME: Implement Clamp
283 }; 283 };
284 284
285 // Convert a value to a 8-bit signed integer. The conversion fails if the
286 // value cannot be converted to a number or the range violated per WebIDL:
287 // http://www.w3.org/TR/WebIDL/#es-byte
288 int8_t toInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& o k);
289 inline int8_t toInt8(v8::Handle<v8::Value> value, bool& ok) { return toInt8( value, NormalConversion, ok); }
290
291 // Convert a value to a 8-bit integer assuming the conversion cannot fail.
292 inline int8_t toInt8(v8::Handle<v8::Value> value)
293 {
294 bool ok;
295 return toInt8(value, NormalConversion, ok);
296 }
297
298 // Convert a value to a 8-bit unsigned integer. The conversion fails if the
299 // value cannot be converted to a number or the range violated per WebIDL:
300 // http://www.w3.org/TR/WebIDL/#es-octet
301 uint8_t toUInt8(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
302 inline uint8_t toUInt8(v8::Handle<v8::Value> value, bool& ok) { return toUIn t8(value, NormalConversion, ok); }
303
304 // Convert a value to a 8-bit unsigned integer assuming the conversion canno t fail.
305 inline uint8_t toUInt8(v8::Handle<v8::Value> value)
306 {
307 bool ok;
308 return toUInt8(value, NormalConversion, ok);
309 }
310
285 // Convert a value to a 32-bit signed integer. The conversion fails if the 311 // Convert a value to a 32-bit signed integer. The conversion fails if the
286 // value cannot be converted to a number or the range violated per WebIDL: 312 // value cannot be converted to a number or the range violated per WebIDL:
287 // http://www.w3.org/TR/WebIDL/#es-long 313 // http://www.w3.org/TR/WebIDL/#es-long
288 int32_t toInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok); 314 int32_t toInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
289 inline int32_t toInt32(v8::Handle<v8::Value> value, bool& ok) { return toInt 32(value, NormalConversion, ok); } 315 inline int32_t toInt32(v8::Handle<v8::Value> value, bool& ok) { return toInt 32(value, NormalConversion, ok); }
290 316
291 // Convert a value to a 32-bit integer assuming the conversion cannot fail. 317 // Convert a value to a 32-bit integer assuming the conversion cannot fail.
292 inline int32_t toInt32(v8::Handle<v8::Value> value) 318 inline int32_t toInt32(v8::Handle<v8::Value> value)
293 { 319 {
294 bool ok; 320 bool ok;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 template <class T> 566 template <class T>
541 v8::Handle<T> unsafeHandleFromRawValue(const T* value) 567 v8::Handle<T> unsafeHandleFromRawValue(const T* value)
542 { 568 {
543 const v8::Handle<T>* handle = reinterpret_cast<const v8::Handle<T>*>(&va lue); 569 const v8::Handle<T>* handle = reinterpret_cast<const v8::Handle<T>*>(&va lue);
544 return *handle; 570 return *handle;
545 } 571 }
546 572
547 } // namespace WebCore 573 } // namespace WebCore
548 574
549 #endif // V8Binding_h 575 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestObject.cpp ('k') | Source/bindings/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698