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 "base/float_util.h" | 7 #include "base/float_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/common/android/gin_java_bridge_value.h" | 9 #include "content/common/android/gin_java_bridge_value.h" |
10 #include "content/renderer/java/gin_java_bridge_object.h" | 10 #include "content/renderer/java/gin_java_bridge_object.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 public: | 68 public: |
69 static scoped_ptr<TypedArraySerializer> Create( | 69 static scoped_ptr<TypedArraySerializer> Create( |
70 v8::Handle<v8::TypedArray> typed_array) { | 70 v8::Handle<v8::TypedArray> typed_array) { |
71 scoped_ptr<TypedArraySerializerImpl<ElementType, ListType> > result( | 71 scoped_ptr<TypedArraySerializerImpl<ElementType, ListType> > result( |
72 new TypedArraySerializerImpl<ElementType, ListType>(typed_array)); | 72 new TypedArraySerializerImpl<ElementType, ListType>(typed_array)); |
73 return result.template PassAs<TypedArraySerializer>(); | 73 return result.template PassAs<TypedArraySerializer>(); |
74 } | 74 } |
75 | 75 |
76 virtual void serializeTo(char* data, | 76 virtual 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 } |
87 } | 87 } |
88 | 88 |
(...skipping 65 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 |