OLD | NEW |
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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 { | 461 { |
462 return toUInt64(value, NormalConversion, exceptionState); | 462 return toUInt64(value, NormalConversion, exceptionState); |
463 } | 463 } |
464 | 464 |
465 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f
ail. | 465 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f
ail. |
466 uint64_t toUInt64(v8::Handle<v8::Value>); | 466 uint64_t toUInt64(v8::Handle<v8::Value>); |
467 | 467 |
468 // Convert a value to a single precision float, which might fail. | 468 // Convert a value to a single precision float, which might fail. |
469 float toFloat(v8::Handle<v8::Value>, ExceptionState&); | 469 float toFloat(v8::Handle<v8::Value>, ExceptionState&); |
470 | 470 |
| 471 // Convert a value to a single precision float, throwing on non-finite values. |
| 472 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); |
| 473 |
471 // Convert a value to a single precision float assuming the conversion cannot fa
il. | 474 // Convert a value to a single precision float assuming the conversion cannot fa
il. |
472 inline float toFloat(v8::Local<v8::Value> value) | 475 inline float toFloat(v8::Local<v8::Value> value) |
473 { | 476 { |
474 return static_cast<float>(value->NumberValue()); | 477 return static_cast<float>(value->NumberValue()); |
475 } | 478 } |
476 | 479 |
477 // Convert a value to a double precision float, which might fail. | 480 // Convert a value to a double precision float, which might fail. |
478 double toDouble(v8::Handle<v8::Value>, ExceptionState&); | 481 double toDouble(v8::Handle<v8::Value>, ExceptionState&); |
479 | 482 |
| 483 // Convert a value to a double precision float, throwing on non-finite values. |
| 484 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); |
| 485 |
480 // Converts a value to a String, throwing if any code unit is outside 0-255. | 486 // Converts a value to a String, throwing if any code unit is outside 0-255. |
481 String toByteString(v8::Handle<v8::Value>, ExceptionState&); | 487 String toByteString(v8::Handle<v8::Value>, ExceptionState&); |
482 | 488 |
483 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl
acement characters. | 489 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl
acement characters. |
484 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); | 490 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); |
485 | 491 |
486 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) | 492 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) |
487 { | 493 { |
488 return value ? v8::True(isolate) : v8::False(isolate); | 494 return value ? v8::True(isolate) : v8::False(isolate); |
489 } | 495 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 960 |
955 private: | 961 private: |
956 v8::TryCatch& m_block; | 962 v8::TryCatch& m_block; |
957 }; | 963 }; |
958 | 964 |
959 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 965 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
960 | 966 |
961 } // namespace blink | 967 } // namespace blink |
962 | 968 |
963 #endif // V8Binding_h | 969 #endif // V8Binding_h |
OLD | NEW |