| 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 // Convert a value to a single precision float, throwing on non-finite values. | 471 // Convert a value to a single precision float, throwing on non-finite values. |
| 472 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); | 472 float toRestrictedFloat(v8::Handle<v8::Value>, ExceptionState&); |
| 473 | 473 |
| 474 // 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. |
| 475 inline float toFloat(v8::Local<v8::Value> value) | 475 inline float toFloat(v8::Local<v8::Value> value) |
| 476 { | 476 { |
| 477 return static_cast<float>(value->NumberValue()); | 477 return static_cast<float>(value->NumberValue()); |
| 478 } | 478 } |
| 479 | 479 |
| 480 // Convert a value to a double precision float, which might fail. | 480 // Convert a value to a double precision float, which might fail. |
| 481 double toDouble(v8::Handle<v8::Value>, ExceptionState&); | 481 double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&); |
| 482 |
| 483 inline double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionSta
te) |
| 484 { |
| 485 if (value->IsNumber()) |
| 486 return value->NumberValue(); |
| 487 return toDoubleSlow(value, exceptionState); |
| 488 } |
| 482 | 489 |
| 483 // Convert a value to a double precision float, throwing on non-finite values. | 490 // Convert a value to a double precision float, throwing on non-finite values. |
| 484 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); | 491 double toRestrictedDouble(v8::Handle<v8::Value>, ExceptionState&); |
| 485 | 492 |
| 486 // Converts a value to a String, throwing if any code unit is outside 0-255. | 493 // Converts a value to a String, throwing if any code unit is outside 0-255. |
| 487 String toByteString(v8::Handle<v8::Value>, ExceptionState&); | 494 String toByteString(v8::Handle<v8::Value>, ExceptionState&); |
| 488 | 495 |
| 489 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl
acement characters. | 496 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl
acement characters. |
| 490 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); | 497 String toUSVString(v8::Handle<v8::Value>, ExceptionState&); |
| 491 | 498 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 996 |
| 990 private: | 997 private: |
| 991 v8::TryCatch& m_block; | 998 v8::TryCatch& m_block; |
| 992 }; | 999 }; |
| 993 | 1000 |
| 994 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); | 1001 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso
late*); |
| 995 | 1002 |
| 996 } // namespace blink | 1003 } // namespace blink |
| 997 | 1004 |
| 998 #endif // V8Binding_h | 1005 #endif // V8Binding_h |
| OLD | NEW |