Chromium Code Reviews| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 // http://www.w3.org/TR/WebIDL/#es-unsigned-long-long | 471 // http://www.w3.org/TR/WebIDL/#es-unsigned-long-long |
| 472 uint64_t toUInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, Excepti onState&); | 472 uint64_t toUInt64(v8::Handle<v8::Value>, IntegerConversionConfiguration, Excepti onState&); |
| 473 inline uint64_t toUInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate) | 473 inline uint64_t toUInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate) |
| 474 { | 474 { |
| 475 return toUInt64(value, NormalConversion, exceptionState); | 475 return toUInt64(value, NormalConversion, exceptionState); |
| 476 } | 476 } |
| 477 | 477 |
| 478 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f ail. | 478 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f ail. |
| 479 uint64_t toUInt64(v8::Handle<v8::Value>); | 479 uint64_t toUInt64(v8::Handle<v8::Value>); |
| 480 | 480 |
| 481 // Convert a value to a single precision float, which might fail. | |
| 482 float toFloat(v8::Handle<v8::Value>, ExceptionState&); | |
| 483 | |
| 484 // Convert a value to a single precision float, throwing on non-finite values. | |
| 485 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); | |
| 486 | |
| 487 // Convert a value to a single precision float assuming the conversion cannot fa il. | |
| 488 inline float toFloat(v8::Local<v8::Value> value) | |
| 489 { | |
| 490 return static_cast<float>(value->NumberValue()); | |
| 491 } | |
| 492 | |
| 493 // Convert a value to a double precision float, which might fail. | 481 // Convert a value to a double precision float, which might fail. |
| 494 double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&); | 482 double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&); |
| 495 | 483 |
| 496 inline double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te) | 484 inline double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te) |
| 497 { | 485 { |
| 498 if (value->IsNumber()) | 486 if (value->IsNumber()) |
| 499 return value->NumberValue(); | 487 return value->NumberValue(); |
| 500 return toDoubleSlow(value, exceptionState); | 488 return toDoubleSlow(value, exceptionState); |
| 501 } | 489 } |
| 502 | 490 |
| 503 // Convert a value to a double precision float, throwing on non-finite values. | 491 // Convert a value to a double precision float, throwing on non-finite values. |
| 504 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); | 492 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); |
| 505 | 493 |
| 494 // Convert a value to a single precision float, which might fail. | |
| 495 inline float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState ) | |
| 496 { | |
| 497 return static_cast<float>(toDouble(value, exceptionState)); | |
| 498 } | |
| 499 | |
| 500 // Convert a value to a single precision float assuming the conversion cannot fa il. | |
| 501 inline float toFloat(v8::Local<v8::Value> value) | |
|
Jens Widell
2015/03/02 13:40:25
AFAICT, this function is not used. I don't think i
| |
| 502 { | |
| 503 return static_cast<float>(value->NumberValue()); | |
| 504 } | |
| 505 | |
| 506 // Convert a value to a single precision float, throwing on non-finite values. | |
| 507 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); | |
| 508 | |
| 506 // Converts a value to a String, throwing if any code unit is outside 0-255. | 509 // Converts a value to a String, throwing if any code unit is outside 0-255. |
| 507 String toByteString(v8::Handle<v8::Value>, ExceptionState&); | 510 String toByteString(v8::Handle<v8::Value>, ExceptionState&); |
| 508 | 511 |
| 509 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl acement characters. | 512 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl acement characters. |
| 510 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); | 513 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); |
| 511 | 514 |
| 512 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) | 515 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) |
| 513 { | 516 { |
| 514 return value ? v8::True(isolate) : v8::False(isolate); | 517 return value ? v8::True(isolate) : v8::False(isolate); |
| 515 } | 518 } |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 | 1012 |
| 1010 private: | 1013 private: |
| 1011 v8::TryCatch& m_block; | 1014 v8::TryCatch& m_block; |
| 1012 }; | 1015 }; |
| 1013 | 1016 |
| 1014 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); | 1017 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); |
| 1015 | 1018 |
| 1016 } // namespace blink | 1019 } // namespace blink |
| 1017 | 1020 |
| 1018 #endif // V8Binding_h | 1021 #endif // V8Binding_h |
| OLD | NEW |