| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/java/gin_java_bridge_value_converter.h" | 5 #include "content/renderer/java/gin_java_bridge_value_converter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/common/android/gin_java_bridge_value.h" | 10 #include "content/common/android/gin_java_bridge_value.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 template <typename ElementType, typename ListType> | 67 template <typename ElementType, typename ListType> |
| 68 class TypedArraySerializerImpl : public TypedArraySerializer { | 68 class TypedArraySerializerImpl : public TypedArraySerializer { |
| 69 public: | 69 public: |
| 70 static scoped_ptr<TypedArraySerializer> Create( | 70 static scoped_ptr<TypedArraySerializer> Create( |
| 71 v8::Handle<v8::TypedArray> typed_array) { | 71 v8::Handle<v8::TypedArray> typed_array) { |
| 72 return make_scoped_ptr( | 72 return make_scoped_ptr( |
| 73 new TypedArraySerializerImpl<ElementType, ListType>(typed_array)); | 73 new TypedArraySerializerImpl<ElementType, ListType>(typed_array)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual void serializeTo(char* data, | 76 void serializeTo(char* data, |
| 77 size_t data_length, | 77 size_t data_length, |
| 78 base::ListValue* out) override { | 78 base::ListValue* out) override { |
| 79 DCHECK_EQ(data_length, typed_array_->Length() * sizeof(ElementType)); | 79 DCHECK_EQ(data_length, typed_array_->Length() * sizeof(ElementType)); |
| 80 for (ElementType *element = reinterpret_cast<ElementType*>(data), | 80 for (ElementType *element = reinterpret_cast<ElementType*>(data), |
| 81 *end = element + typed_array_->Length(); | 81 *end = element + typed_array_->Length(); |
| 82 element != end; | 82 element != end; |
| 83 ++element) { | 83 ++element) { |
| 84 const ListType list_value = *element; | 84 const ListType list_value = *element; |
| 85 out->Append(new base::FundamentalValue(list_value)); | 85 out->Append(new base::FundamentalValue(list_value)); |
| 86 } | 86 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); | 154 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); |
| 155 return true; | 155 return true; |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { | 158 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { |
| 159 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); | 159 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); |
| 160 return true; | 160 return true; |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace content | 163 } // namespace content |
| OLD | NEW |