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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(TypedArraySerializerImpl); | 99 DISALLOW_COPY_AND_ASSIGN(TypedArraySerializerImpl); |
100 }; | 100 }; |
101 | 101 |
102 // static | 102 // static |
103 scoped_ptr<TypedArraySerializer> TypedArraySerializer::Create( | 103 scoped_ptr<TypedArraySerializer> TypedArraySerializer::Create( |
104 v8::Local<v8::TypedArray> typed_array) { | 104 v8::Local<v8::TypedArray> typed_array) { |
105 if (typed_array->IsInt8Array() || | 105 if (typed_array->IsInt8Array() || |
106 typed_array->IsUint8Array() || | 106 typed_array->IsUint8Array() || |
107 typed_array->IsUint8ClampedArray()) { | 107 typed_array->IsUint8ClampedArray()) { |
108 return TypedArraySerializerImpl<char, int>::Create(typed_array).Pass(); | 108 return TypedArraySerializerImpl<char, int>::Create(typed_array); |
109 } else if (typed_array->IsInt16Array() || typed_array->IsUint16Array()) { | 109 } else if (typed_array->IsInt16Array() || typed_array->IsUint16Array()) { |
110 return TypedArraySerializerImpl<int16_t, int>::Create(typed_array).Pass(); | 110 return TypedArraySerializerImpl<int16_t, int>::Create(typed_array); |
111 } else if (typed_array->IsInt32Array() || typed_array->IsUint32Array()) { | 111 } else if (typed_array->IsInt32Array() || typed_array->IsUint32Array()) { |
112 return TypedArraySerializerImpl<int32_t, int>::Create(typed_array).Pass(); | 112 return TypedArraySerializerImpl<int32_t, int>::Create(typed_array); |
113 } else if (typed_array->IsFloat32Array()) { | 113 } else if (typed_array->IsFloat32Array()) { |
114 return TypedArraySerializerImpl<float, double>::Create(typed_array).Pass(); | 114 return TypedArraySerializerImpl<float, double>::Create(typed_array); |
115 } else if (typed_array->IsFloat64Array()) { | 115 } else if (typed_array->IsFloat64Array()) { |
116 return TypedArraySerializerImpl<double, double>::Create(typed_array).Pass(); | 116 return TypedArraySerializerImpl<double, double>::Create(typed_array); |
117 } | 117 } |
118 NOTREACHED(); | 118 NOTREACHED(); |
119 return scoped_ptr<TypedArraySerializer>(); | 119 return scoped_ptr<TypedArraySerializer>(); |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 bool GinJavaBridgeValueConverter::FromV8ArrayBuffer( | 124 bool GinJavaBridgeValueConverter::FromV8ArrayBuffer( |
125 v8::Local<v8::Object> value, | 125 v8::Local<v8::Object> value, |
126 base::Value** out, | 126 base::Value** out, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); | 158 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); |
159 return true; | 159 return true; |
160 } | 160 } |
161 | 161 |
162 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { | 162 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { |
163 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); | 163 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); |
164 return true; | 164 return true; |
165 } | 165 } |
166 | 166 |
167 } // namespace content | 167 } // namespace content |
OLD | NEW |