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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 length = array_buffer->byteLength(); | 508 length = array_buffer->byteLength(); |
509 } else { | 509 } else { |
510 view.reset(blink::WebArrayBufferView::createFromV8Value(val)); | 510 view.reset(blink::WebArrayBufferView::createFromV8Value(val)); |
511 if (view) { | 511 if (view) { |
512 data = reinterpret_cast<char*>(view->baseAddress()) + view->byteOffset(); | 512 data = reinterpret_cast<char*>(view->baseAddress()) + view->byteOffset(); |
513 length = view->byteLength(); | 513 length = view->byteLength(); |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 if (data) | 517 if (data) |
518 return base::WrapUnique( | 518 return base::BinaryValue::CreateWithCopiedBuffer(data, length); |
519 base::BinaryValue::CreateWithCopiedBuffer(data, length)); | |
520 else | 519 else |
521 return nullptr; | 520 return nullptr; |
522 } | 521 } |
523 | 522 |
524 std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Object( | 523 std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Object( |
525 v8::Local<v8::Object> val, | 524 v8::Local<v8::Object> val, |
526 FromV8ValueState* state, | 525 FromV8ValueState* state, |
527 v8::Isolate* isolate) const { | 526 v8::Isolate* isolate) const { |
528 ScopedUniquenessGuard uniqueness_guard(state, val); | 527 ScopedUniquenessGuard uniqueness_guard(state, val); |
529 if (!uniqueness_guard.is_valid()) | 528 if (!uniqueness_guard.is_valid()) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 continue; | 619 continue; |
621 | 620 |
622 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), | 621 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), |
623 std::move(child)); | 622 std::move(child)); |
624 } | 623 } |
625 | 624 |
626 return std::move(result); | 625 return std::move(result); |
627 } | 626 } |
628 | 627 |
629 } // namespace content | 628 } // namespace content |
OLD | NEW |