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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 518 |
519 // Convert a value to a single precision float, which might fail. | 519 // Convert a value to a single precision float, which might fail. |
520 float toFloat(v8::Handle<v8::Value>, ExceptionState&); | 520 float toFloat(v8::Handle<v8::Value>, ExceptionState&); |
521 | 521 |
522 // Convert a value to a single precision float assuming the conversion cannot fa
il. | 522 // Convert a value to a single precision float assuming the conversion cannot fa
il. |
523 inline float toFloat(v8::Local<v8::Value> value) | 523 inline float toFloat(v8::Local<v8::Value> value) |
524 { | 524 { |
525 return static_cast<float>(value->NumberValue()); | 525 return static_cast<float>(value->NumberValue()); |
526 } | 526 } |
527 | 527 |
| 528 // Converts a value to a String, throwing if any code unit is outside 0-255. |
| 529 String toByteString(v8::Handle<v8::Value>, ExceptionState&); |
| 530 |
528 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) | 531 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) |
529 { | 532 { |
530 return value ? v8::True(isolate) : v8::False(isolate); | 533 return value ? v8::True(isolate) : v8::False(isolate); |
531 } | 534 } |
532 | 535 |
533 inline double toCoreDate(v8::Handle<v8::Value> object) | 536 inline double toCoreDate(v8::Handle<v8::Value> object) |
534 { | 537 { |
535 if (object->IsDate()) | 538 if (object->IsDate()) |
536 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); | 539 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
537 if (object->IsNumber()) | 540 if (object->IsNumber()) |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 m_block.Reset(); | 963 m_block.Reset(); |
961 } | 964 } |
962 | 965 |
963 private: | 966 private: |
964 v8::TryCatch& m_block; | 967 v8::TryCatch& m_block; |
965 }; | 968 }; |
966 | 969 |
967 } // namespace WebCore | 970 } // namespace WebCore |
968 | 971 |
969 #endif // V8Binding_h | 972 #endif // V8Binding_h |
OLD | NEW |