Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: content/child/v8_value_converter_impl.cc

Issue 2841623003: Remove base::Value::Get{Buffer,Size} (Closed)
Patch Set: std::vector::assign instead of std::vector::operator= Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action.cc ('k') | content/common/android/gin_java_bridge_value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698