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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 }; | 608 }; |
609 | 609 |
610 template<> | 610 template<> |
611 struct NativeValueTraits<v8::Handle<v8::Value> > { | 611 struct NativeValueTraits<v8::Handle<v8::Value> > { |
612 static inline v8::Handle<v8::Value> nativeValue(const v8::Handle<v8::Value>&
value, v8::Isolate* isolate) | 612 static inline v8::Handle<v8::Value> nativeValue(const v8::Handle<v8::Value>&
value, v8::Isolate* isolate) |
613 { | 613 { |
614 return value; | 614 return value; |
615 } | 615 } |
616 }; | 616 }; |
617 | 617 |
| 618 template<> |
| 619 struct NativeValueTraits<ScriptValue> { |
| 620 static inline ScriptValue nativeValue(const v8::Handle<v8::Value>& value, v8
::Isolate* isolate) |
| 621 { |
| 622 return ScriptValue(ScriptState::current(isolate), value); |
| 623 } |
| 624 }; |
| 625 |
618 v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::
Isolate*); | 626 v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::
Isolate*); |
619 | 627 |
620 // Converts a JavaScript value to an array as per the Web IDL specification: | 628 // Converts a JavaScript value to an array as per the Web IDL specification: |
621 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array | 629 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array |
622 template <class T, class V8T> | 630 template <class T, class V8T> |
623 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, ui
nt32_t length, v8::Isolate* isolate, bool* success = 0) | 631 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, ui
nt32_t length, v8::Isolate* isolate, bool* success = 0) |
624 { | 632 { |
625 Vector<RefPtr<T> > result; | 633 Vector<RefPtr<T> > result; |
626 result.reserveInitialCapacity(length); | 634 result.reserveInitialCapacity(length); |
627 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); | 635 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 m_block.Reset(); | 979 m_block.Reset(); |
972 } | 980 } |
973 | 981 |
974 private: | 982 private: |
975 v8::TryCatch& m_block; | 983 v8::TryCatch& m_block; |
976 }; | 984 }; |
977 | 985 |
978 } // namespace blink | 986 } // namespace blink |
979 | 987 |
980 #endif // V8Binding_h | 988 #endif // V8Binding_h |
OLD | NEW |