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

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: 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
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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 uint32_t sequenceLength = lengthValue->Int32Value(); 797 uint32_t sequenceLength = lengthValue->Int32Value();
798 if (block.HasCaught()) { 798 if (block.HasCaught()) {
799 exceptionState.rethrowV8Exception(block.Exception()); 799 exceptionState.rethrowV8Exception(block.Exception());
800 return false; 800 return false;
801 } 801 }
802 802
803 length = sequenceLength; 803 length = sequenceLength;
804 return true; 804 return true;
805 } 805 }
806 806
807 template <typename T>
808 T script_value_cast(const v8::Local<v8::Value>& value, v8::Isolate* isolate, Exc eptionState& exceptionState)
haraken 2015/03/14 01:27:19 Why does this need to be defined in V8Binding.h? C
809 {
810 return NativeValueTraits<T>::nativeValue(value, isolate, exceptionState);
811 }
812
807 template<> 813 template<>
808 struct NativeValueTraits<String> { 814 struct NativeValueTraits<String> {
809 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState) 815 static inline String nativeValue(const v8::Local<v8::Value>& value, v8::Isol ate* isolate, ExceptionState& exceptionState)
810 { 816 {
811 V8StringResource<> stringValue(value); 817 V8StringResource<> stringValue(value);
812 if (!stringValue.prepare(exceptionState)) 818 if (!stringValue.prepare(exceptionState))
813 return String(); 819 return String();
814 return stringValue; 820 return stringValue;
815 } 821 }
816 }; 822 };
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 1030
1025 // Callback functions used by generated code. 1031 // Callback functions used by generated code.
1026 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1032 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1027 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); 1033 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&);
1028 1034
1029 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1035 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1030 1036
1031 } // namespace blink 1037 } // namespace blink
1032 1038
1033 #endif // V8Binding_h 1039 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698