Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

Issue 440243003: Add NativeValueTraits for ScriptValue to V8Bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 }; 602 };
603 603
604 template<> 604 template<>
605 struct NativeValueTraits<v8::Handle<v8::Value> > { 605 struct NativeValueTraits<v8::Handle<v8::Value> > {
606 static inline v8::Handle<v8::Value> nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate) 606 static inline v8::Handle<v8::Value> nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate)
607 { 607 {
608 return value; 608 return value;
609 } 609 }
610 }; 610 };
611 611
612 template<>
613 struct NativeValueTraits<ScriptValue> {
614 static inline ScriptValue nativeValue(const v8::Handle<v8::Value>& value, v8 ::Isolate* isolate)
615 {
616 return ScriptValue(ScriptState::current(isolate), value);
haraken 2014/08/06 00:55:10 I'm a bit concerned about this. In order to call S
617 }
618 };
619
612 v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8:: Isolate*); 620 v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8:: Isolate*);
613 621
614 // Converts a JavaScript value to an array as per the Web IDL specification: 622 // Converts a JavaScript value to an array as per the Web IDL specification:
615 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array 623 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array
616 template <class T, class V8T> 624 template <class T, class V8T>
617 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, ui nt32_t length, v8::Isolate* isolate, bool* success = 0) 625 Vector<RefPtr<T> > toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, ui nt32_t length, v8::Isolate* isolate, bool* success = 0)
618 { 626 {
619 Vector<RefPtr<T> > result; 627 Vector<RefPtr<T> > result;
620 result.reserveInitialCapacity(length); 628 result.reserveInitialCapacity(length);
621 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); 629 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 m_block.Reset(); 973 m_block.Reset();
966 } 974 }
967 975
968 private: 976 private:
969 v8::TryCatch& m_block; 977 v8::TryCatch& m_block;
970 }; 978 };
971 979
972 } // namespace blink 980 } // namespace blink
973 981
974 #endif // V8Binding_h 982 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698