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

Unified Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 400493005: Make vector conversion more general in V8Bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: finished self review, PTAL Created 6 years, 5 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: Source/bindings/core/v8/V8Binding.cpp
diff --git a/Source/bindings/core/v8/V8Binding.cpp b/Source/bindings/core/v8/V8Binding.cpp
index ae62da384d8a0686dbacaeca416062d7a1b05374..582cbfbbcd608114bf76479af214e6740e1d4049 100644
--- a/Source/bindings/core/v8/V8Binding.cpp
+++ b/Source/bindings/core/v8/V8Binding.cpp
@@ -147,6 +147,62 @@ v8::ArrayBuffer::Allocator* v8ArrayBufferAllocator()
return &arrayBufferAllocator;
}
+// These explicit specializations of toV8NoInline match up with the explicit specializations of V8ValueTraits in V8Binding.h; they permit
+// vectors of these same types to be converted.
+template <>
+v8::Handle<v8::Value> toV8NoInline<const String>(const String* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<String>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const AtomicString>(const AtomicString* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<AtomicString>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const int>(const int* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<int>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const long>(const long* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<long>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const unsigned>(const unsigned* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<unsigned>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const unsigned long>(const unsigned long* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<unsigned long>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const float>(const float* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<float>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const double>(const double* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<double>::toV8Value(*impl, creationContext, isolate);
+}
+
+template <>
+v8::Handle<v8::Value> toV8NoInline<const bool>(const bool* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return V8ValueTraits<bool>::toV8Value(*impl, creationContext, isolate);
+}
+
PassRefPtrWillBeRawPtr<NodeFilter> toNodeFilter(v8::Handle<v8::Value> callback, v8::Handle<v8::Object> creationContext, ScriptState* scriptState)
{
if (callback->IsNull())

Powered by Google App Engine
This is Rietveld 408576698