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