| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 459 } |
| 460 | 460 |
| 461 uint64_t toUInt64(v8::Handle<v8::Value> value) | 461 uint64_t toUInt64(v8::Handle<v8::Value> value) |
| 462 { | 462 { |
| 463 NonThrowableExceptionState exceptionState; | 463 NonThrowableExceptionState exceptionState; |
| 464 return toUInt64(value, NormalConversion, exceptionState); | 464 return toUInt64(value, NormalConversion, exceptionState); |
| 465 } | 465 } |
| 466 | 466 |
| 467 float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState) | 467 float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| 468 { | 468 { |
| 469 return static_cast<float>(toDouble(value, exceptionState)); |
| 470 } |
| 471 |
| 472 double toDouble(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| 473 { |
| 469 TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::Number>, numberObject, value->
ToNumber(), exceptionState, 0); | 474 TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::Number>, numberObject, value->
ToNumber(), exceptionState, 0); |
| 470 return numberObject->NumberValue(); | 475 return numberObject->NumberValue(); |
| 471 } | 476 } |
| 472 | 477 |
| 478 bool toBoolean(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| 479 { |
| 480 TONATIVE_DEFAULT_EXCEPTIONSTATE(v8::Local<v8::Boolean>, booleanObject, value
->ToBoolean(), exceptionState, false); |
| 481 return booleanObject->Value(); |
| 482 } |
| 483 |
| 473 String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) | 484 String toByteString(v8::Handle<v8::Value> value, ExceptionState& exceptionState) |
| 474 { | 485 { |
| 475 // Handle null default value. | 486 // Handle null default value. |
| 476 if (value.IsEmpty()) | 487 if (value.IsEmpty()) |
| 477 return String(); | 488 return String(); |
| 478 | 489 |
| 479 // From the Web IDL spec: http://heycam.github.io/webidl/#es-ByteString | 490 // From the Web IDL spec: http://heycam.github.io/webidl/#es-ByteString |
| 480 if (value.IsEmpty()) | 491 if (value.IsEmpty()) |
| 481 return String(); | 492 return String(); |
| 482 | 493 |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 931 |
| 921 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value
> value) | 932 v8::Local<v8::Value> v8IteratorResult(v8::Isolate* isolate, v8::Handle<v8::Value
> value) |
| 922 { | 933 { |
| 923 v8::Local<v8::Object> result = v8::Object::New(isolate); | 934 v8::Local<v8::Object> result = v8::Object::New(isolate); |
| 924 result->Set(v8String(isolate, "value"), value); | 935 result->Set(v8String(isolate, "value"), value); |
| 925 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate)); | 936 result->Set(v8String(isolate, "done"), v8Boolean(false, isolate)); |
| 926 return result; | 937 return result; |
| 927 } | 938 } |
| 928 | 939 |
| 929 } // namespace blink | 940 } // namespace blink |
| OLD | NEW |