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

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

Issue 1009503003: [bindings] Introduce ScriptValue.to<T> to convert to native values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 9 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
« no previous file with comments | « Source/bindings/core/v8/ScriptValue.h ('k') | Source/bindings/core/v8/v8.gypi » ('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 18 matching lines...) Expand all
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef V8Binding_h 32 #ifndef V8Binding_h
33 #define V8Binding_h 33 #define V8Binding_h
34 34
35 #include "bindings/core/v8/DOMDataStore.h" 35 #include "bindings/core/v8/DOMDataStore.h"
36 #include "bindings/core/v8/DOMWrapperWorld.h" 36 #include "bindings/core/v8/DOMWrapperWorld.h"
37 #include "bindings/core/v8/ExceptionMessages.h" 37 #include "bindings/core/v8/ExceptionMessages.h"
38 #include "bindings/core/v8/ExceptionState.h" 38 #include "bindings/core/v8/ExceptionState.h"
39 #include "bindings/core/v8/NativeValueTraits.h"
39 #include "bindings/core/v8/ScriptValue.h" 40 #include "bindings/core/v8/ScriptValue.h"
40 #include "bindings/core/v8/ScriptWrappable.h" 41 #include "bindings/core/v8/ScriptWrappable.h"
41 #include "bindings/core/v8/V8BindingMacros.h" 42 #include "bindings/core/v8/V8BindingMacros.h"
42 #include "bindings/core/v8/V8PerIsolateData.h" 43 #include "bindings/core/v8/V8PerIsolateData.h"
43 #include "bindings/core/v8/V8StringResource.h" 44 #include "bindings/core/v8/V8StringResource.h"
44 #include "bindings/core/v8/V8ThrowException.h" 45 #include "bindings/core/v8/V8ThrowException.h"
45 #include "bindings/core/v8/V8ValueCache.h" 46 #include "bindings/core/v8/V8ValueCache.h"
46 #include "core/CoreExport.h" 47 #include "core/CoreExport.h"
47 #include "platform/heap/Handle.h" 48 #include "platform/heap/Handle.h"
48 #include "wtf/text/AtomicString.h" 49 #include "wtf/text/AtomicString.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 inline v8::Handle<v8::Value> v8DateOrNaN(double value, v8::Isolate* isolate) 535 inline v8::Handle<v8::Value> v8DateOrNaN(double value, v8::Isolate* isolate)
535 { 536 {
536 ASSERT(isolate); 537 ASSERT(isolate);
537 return v8::Date::New(isolate, std::isfinite(value) ? value : std::numeric_li mits<double>::quiet_NaN()); 538 return v8::Date::New(isolate, std::isfinite(value) ? value : std::numeric_li mits<double>::quiet_NaN());
538 } 539 }
539 540
540 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver. 541 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver.
541 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Handl e<v8::Object>, ScriptState*); 542 PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value>, v8::Handl e<v8::Object>, ScriptState*);
542 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate*, v8::Hand le<v8::Value>); 543 PassRefPtrWillBeRawPtr<XPathNSResolver> toXPathNSResolver(v8::Isolate*, v8::Hand le<v8::Value>);
543 544
544 template<class T> struct NativeValueTraits;
545
546 bool toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::Isolate*, Excepti onState&); 545 bool toV8Sequence(v8::Handle<v8::Value>, uint32_t& length, v8::Isolate*, Excepti onState&);
547 546
548 // Converts a JavaScript value to an array as per the Web IDL specification: 547 // Converts a JavaScript value to an array as per the Web IDL specification:
549 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array 548 // http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array
550 template <class T, class V8T> 549 template <class T, class V8T>
551 Vector<RefPtr<T>> toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, uin t32_t length, v8::Isolate* isolate, ExceptionState& exceptionState) 550 Vector<RefPtr<T>> toRefPtrNativeArrayUnchecked(v8::Local<v8::Value> v8Value, uin t32_t length, v8::Isolate* isolate, ExceptionState& exceptionState)
552 { 551 {
553 Vector<RefPtr<T>> result; 552 Vector<RefPtr<T>> result;
554 result.reserveInitialCapacity(length); 553 result.reserveInitialCapacity(length);
555 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); 554 v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1033
1035 // Callback functions used by generated code. 1034 // Callback functions used by generated code.
1036 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1035 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1037 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); 1036 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&);
1038 1037
1039 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1038 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1040 1039
1041 } // namespace blink 1040 } // namespace blink
1042 1041
1043 #endif // V8Binding_h 1042 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptValue.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698