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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 return result; | 336 return result; |
337 } | 337 } |
338 | 338 |
339 v8::Local<v8::Value> V8ValueConverterImpl::ToArrayBuffer( | 339 v8::Local<v8::Value> V8ValueConverterImpl::ToArrayBuffer( |
340 v8::Isolate* isolate, | 340 v8::Isolate* isolate, |
341 v8::Local<v8::Object> creation_context, | 341 v8::Local<v8::Object> creation_context, |
342 const base::Value* value) const { | 342 const base::Value* value) const { |
343 DCHECK(creation_context->CreationContext() == isolate->GetCurrentContext()); | 343 DCHECK(creation_context->CreationContext() == isolate->GetCurrentContext()); |
344 v8::Local<v8::ArrayBuffer> buffer = | 344 v8::Local<v8::ArrayBuffer> buffer = |
345 v8::ArrayBuffer::New(isolate, value->GetSize()); | 345 v8::ArrayBuffer::New(isolate, value->GetBlob().size()); |
346 memcpy(buffer->GetContents().Data(), value->GetBuffer(), value->GetSize()); | 346 memcpy(buffer->GetContents().Data(), value->GetBlob().data(), |
| 347 value->GetBlob().size()); |
347 return buffer; | 348 return buffer; |
348 } | 349 } |
349 | 350 |
350 std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8ValueImpl( | 351 std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8ValueImpl( |
351 FromV8ValueState* state, | 352 FromV8ValueState* state, |
352 v8::Local<v8::Value> val, | 353 v8::Local<v8::Value> val, |
353 v8::Isolate* isolate) const { | 354 v8::Isolate* isolate) const { |
354 CHECK(!val.IsEmpty()); | 355 CHECK(!val.IsEmpty()); |
355 | 356 |
356 FromV8ValueState::Level state_level(state); | 357 FromV8ValueState::Level state_level(state); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 continue; | 616 continue; |
616 | 617 |
617 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), | 618 result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()), |
618 std::move(child)); | 619 std::move(child)); |
619 } | 620 } |
620 | 621 |
621 return std::move(result); | 622 return std::move(result); |
622 } | 623 } |
623 | 624 |
624 } // namespace content | 625 } // namespace content |
OLD | NEW |