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 <cmath> |
| 8 |
8 #include "base/values.h" | 9 #include "base/values.h" |
9 #include "content/common/android/gin_java_bridge_value.h" | 10 #include "content/common/android/gin_java_bridge_value.h" |
10 #include "content/renderer/java/gin_java_bridge_object.h" | 11 #include "content/renderer/java/gin_java_bridge_object.h" |
11 #include "gin/array_buffer.h" | 12 #include "gin/array_buffer.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 GinJavaBridgeValueConverter::GinJavaBridgeValueConverter() | 16 GinJavaBridgeValueConverter::GinJavaBridgeValueConverter() |
16 : converter_(V8ValueConverter::create()) { | 17 : converter_(V8ValueConverter::create()) { |
17 converter_->SetDateAllowed(false); | 18 converter_->SetDateAllowed(false); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 *out = result; | 142 *out = result; |
142 scoped_ptr<TypedArraySerializer> serializer( | 143 scoped_ptr<TypedArraySerializer> serializer( |
143 TypedArraySerializer::Create(value.As<v8::TypedArray>())); | 144 TypedArraySerializer::Create(value.As<v8::TypedArray>())); |
144 serializer->serializeTo(data, data_length, result); | 145 serializer->serializeTo(data, data_length, result); |
145 return true; | 146 return true; |
146 } | 147 } |
147 | 148 |
148 bool GinJavaBridgeValueConverter::FromV8Number(v8::Handle<v8::Number> value, | 149 bool GinJavaBridgeValueConverter::FromV8Number(v8::Handle<v8::Number> value, |
149 base::Value** out) const { | 150 base::Value** out) const { |
150 double double_value = value->Value(); | 151 double double_value = value->Value(); |
151 if (base::IsFinite(double_value)) | 152 if (std::isfinite(double_value)) |
152 return false; | 153 return false; |
153 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); | 154 *out = GinJavaBridgeValue::CreateNonFiniteValue(double_value).release(); |
154 return true; | 155 return true; |
155 } | 156 } |
156 | 157 |
157 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { | 158 bool GinJavaBridgeValueConverter::FromV8Undefined(base::Value** out) const { |
158 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); | 159 *out = GinJavaBridgeValue::CreateUndefinedValue().release(); |
159 return true; | 160 return true; |
160 } | 161 } |
161 | 162 |
162 } // namespace content | 163 } // namespace content |
OLD | NEW |