OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/child/v8_value_converter_impl.h" | 5 #include "content/child/v8_value_converter_impl.h" |
6 | 6 |
| 7 #include <cmath> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/float_util.h" | |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "third_party/WebKit/public/web/WebArrayBuffer.h" | 15 #include "third_party/WebKit/public/web/WebArrayBuffer.h" |
16 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" | 16 #include "third_party/WebKit/public/web/WebArrayBufferConverter.h" |
17 #include "third_party/WebKit/public/web/WebArrayBufferView.h" | 17 #include "third_party/WebKit/public/web/WebArrayBufferView.h" |
18 #include "v8/include/v8.h" | 18 #include "v8/include/v8.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 base::Value* out = NULL; | 302 base::Value* out = NULL; |
303 if (strategy_->FromV8Number(val.As<v8::Number>(), &out)) | 303 if (strategy_->FromV8Number(val.As<v8::Number>(), &out)) |
304 return out; | 304 return out; |
305 } | 305 } |
306 | 306 |
307 if (val->IsInt32()) | 307 if (val->IsInt32()) |
308 return new base::FundamentalValue(val->ToInt32(isolate)->Value()); | 308 return new base::FundamentalValue(val->ToInt32(isolate)->Value()); |
309 | 309 |
310 if (val->IsNumber()) { | 310 if (val->IsNumber()) { |
311 double val_as_double = val.As<v8::Number>()->Value(); | 311 double val_as_double = val.As<v8::Number>()->Value(); |
312 if (!base::IsFinite(val_as_double)) | 312 if (!std::isfinite(val_as_double)) |
313 return NULL; | 313 return NULL; |
314 return new base::FundamentalValue(val_as_double); | 314 return new base::FundamentalValue(val_as_double); |
315 } | 315 } |
316 | 316 |
317 if (val->IsString()) { | 317 if (val->IsString()) { |
318 v8::String::Utf8Value utf8(val); | 318 v8::String::Utf8Value utf8(val); |
319 return new base::StringValue(std::string(*utf8, utf8.length())); | 319 return new base::StringValue(std::string(*utf8, utf8.length())); |
320 } | 320 } |
321 | 321 |
322 if (val->IsUndefined()) { | 322 if (val->IsUndefined()) { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 continue; | 548 continue; |
549 | 549 |
550 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), | 550 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), |
551 child.release()); | 551 child.release()); |
552 } | 552 } |
553 | 553 |
554 return result.release(); | 554 return result.release(); |
555 } | 555 } |
556 | 556 |
557 } // namespace content | 557 } // namespace content |
OLD | NEW |