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

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

Issue 2730183003: bindings: Add C++ versions of WebIDL types and generalize NativeValueTraits. (Closed)
Patch Set: Fix IDLSequence checks and make them easier to understand 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8Binding.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
index 1df7fae7726c68025efbae99fb7607a1ef7a794a..f61a6e961da0f0c0c72c713e9898f3e9fd0ab001 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Binding.h
@@ -40,6 +40,7 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/ScriptWrappable.h"
+#include "bindings/core/v8/SerializedScriptValue.h"
#include "bindings/core/v8/V8BindingMacros.h"
#include "bindings/core/v8/V8PerIsolateData.h"
#include "bindings/core/v8/V8ScriptRunner.h"
@@ -761,12 +762,12 @@ HeapVector<Member<T>> toMemberNativeArray(v8::Local<v8::Value> value,
// Converts a JavaScript value to an array as per the Web IDL specification:
// http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-array
-template <typename VectorType>
+template <typename VectorType,
+ typename ValueType = typename VectorType::ValueType>
VectorType toImplArray(v8::Local<v8::Value> value,
int argumentIndex,
v8::Isolate* isolate,
ExceptionState& exceptionState) {
- typedef typename VectorType::ValueType ValueType;
typedef NativeValueTraits<ValueType> TraitsType;
uint32_t length = 0;
@@ -904,6 +905,22 @@ inline bool toV8Sequence(v8::Local<v8::Value> value,
}
template <>
+struct NativeValueTraits<SerializedScriptValue>
haraken 2017/03/06 19:10:29 Yeah, I'd prefer moving this to SerializedScriptVa
Raphael Kubo da Costa (rakuco) 2017/03/06 19:40:48 Done in patch v6 \o/
+ : public NativeValueTraitsBase<SerializedScriptValue> {
+ CORE_EXPORT static inline PassRefPtr<SerializedScriptValue> nativeValue(
+ v8::Isolate* isolate,
+ v8::Local<v8::Value> value,
+ ExceptionState& exceptionState) {
+ return SerializedScriptValue::serialize(isolate, value, nullptr, nullptr,
+ exceptionState);
+ }
+};
+
+// TODO(rakuco): remove the specializations below (and consequently the
+// non-IDLBase version of NativeValueTraitsBase) once we manage to convert all
+// uses of NativeValueTraits to types that derive from IDLBase or for generated
+// IDL interfaces/dictionaries/unions.
+template <>
struct NativeValueTraits<String> {
static inline String nativeValue(v8::Isolate* isolate,
v8::Local<v8::Value> value,

Powered by Google App Engine
This is Rietveld 408576698