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

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

Issue 2725673002: WIP bindings: Expand usage of NativeValueTraits. (Closed)
Patch Set: Created 3 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 static inline v8::Local<v8::Value> nativeValue( 968 static inline v8::Local<v8::Value> nativeValue(
969 v8::Isolate* isolate, 969 v8::Isolate* isolate,
970 v8::Local<v8::Value> value, 970 v8::Local<v8::Value> value,
971 ExceptionState& exceptionState) { 971 ExceptionState& exceptionState) {
972 return value; 972 return value;
973 } 973 }
974 }; 974 };
975 975
976 template <> 976 template <>
977 struct NativeValueTraits<ScriptValue> { 977 struct NativeValueTraits<ScriptValue> {
978 using ImplType = ScriptValue;
978 static inline ScriptValue nativeValue(v8::Isolate* isolate, 979 static inline ScriptValue nativeValue(v8::Isolate* isolate,
979 v8::Local<v8::Value> value, 980 v8::Local<v8::Value> value,
980 ExceptionState& exceptionState) { 981 ExceptionState& exceptionState) {
981 return ScriptValue(ScriptState::current(isolate), value); 982 return ScriptValue(ScriptState::current(isolate), value);
982 } 983 }
983 }; 984 };
984 985
986 class Promise;
987 template <>
988 struct NativeValueTraits<Promise> {
989 using ImplType = ScriptPromise;
990 static inline ScriptPromise nativeValue(v8::Isolate* isolate,
991 v8::Local<v8::Value> value,
992 ExceptionState& exceptionState) {
993 return ScriptPromise::cast(ScriptState::current(isolate), value);
994 }
995 };
996
985 template <typename T> 997 template <typename T>
986 struct NativeValueTraits<Vector<T>> { 998 struct NativeValueTraits<Vector<T>> {
987 static inline Vector<T> nativeValue(v8::Isolate* isolate, 999 static inline Vector<T> nativeValue(v8::Isolate* isolate,
988 v8::Local<v8::Value> value, 1000 v8::Local<v8::Value> value,
989 ExceptionState& exceptionState) { 1001 ExceptionState& exceptionState) {
990 return toImplArray<Vector<T>>(value, 0, isolate, exceptionState); 1002 return toImplArray<Vector<T>>(value, 0, isolate, exceptionState);
991 } 1003 }
992 }; 1004 };
993 1005
994 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*); 1006 CORE_EXPORT v8::Isolate* toIsolate(ExecutionContext*);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 // If the argument isn't an object, this will crash. 1172 // If the argument isn't an object, this will crash.
1161 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, 1173 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>,
1162 v8::Isolate*); 1174 v8::Isolate*);
1163 1175
1164 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, 1176 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*,
1165 const String& stringifiedJSON, 1177 const String& stringifiedJSON,
1166 ExceptionState&); 1178 ExceptionState&);
1167 } // namespace blink 1179 } // namespace blink
1168 1180
1169 #endif // V8Binding_h 1181 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698