Remove base::BinaryValue

https://codereview.chromium.org/2799093006
This commit is contained in:
Aleksei Kuzmin 2017-06-17 00:09:33 +03:00
parent 49fbb52b01
commit cc350efbd8
5 changed files with 8 additions and 9 deletions

View file

@ -33,7 +33,7 @@ URLRequestBufferJob::URLRequestBufferJob(
} }
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) { void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::BinaryValue* binary = nullptr; const base::Value* binary = nullptr;
if (options->IsType(base::Value::Type::DICTIONARY)) { if (options->IsType(base::Value::Type::DICTIONARY)) {
base::DictionaryValue* dict = base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get()); static_cast<base::DictionaryValue*>(options.get());

View file

@ -215,7 +215,7 @@ Converter<scoped_refptr<ResourceRequestBodyImpl>>::ToV8(
auto type = element.type(); auto type = element.type();
if (type == ResourceRequestBodyImpl::Element::TYPE_BYTES) { if (type == ResourceRequestBodyImpl::Element::TYPE_BYTES) {
std::unique_ptr<base::Value> bytes( std::unique_ptr<base::Value> bytes(
base::BinaryValue::CreateWithCopiedBuffer( base::Value::CreateWithCopiedBuffer(
element.bytes(), static_cast<size_t>(element.length()))); element.bytes(), static_cast<size_t>(element.length())));
post_data_dict->SetString("type", "rawData"); post_data_dict->SetString("type", "rawData");
post_data_dict->Set("bytes", std::move(bytes)); post_data_dict->Set("bytes", std::move(bytes));
@ -260,7 +260,7 @@ bool Converter<scoped_refptr<ResourceRequestBodyImpl>>::FromV8(
return false; return false;
dict->GetString("type", &type); dict->GetString("type", &type);
if (type == "rawData") { if (type == "rawData") {
base::BinaryValue* bytes = nullptr; base::Value* bytes = nullptr;
dict->GetBinary("bytes", &bytes); dict->GetBinary("bytes", &bytes);
(*out)->AppendBytes(bytes->GetBuffer(), bytes->GetSize()); (*out)->AppendBytes(bytes->GetBuffer(), bytes->GetSize());
} else if (type == "file") { } else if (type == "file") {

View file

@ -196,7 +196,7 @@ void GetUploadData(base::ListValue* upload_data_list,
const net::UploadBytesElementReader* bytes_reader = const net::UploadBytesElementReader* bytes_reader =
reader->AsBytesReader(); reader->AsBytesReader();
std::unique_ptr<base::Value> bytes( std::unique_ptr<base::Value> bytes(
base::BinaryValue::CreateWithCopiedBuffer(bytes_reader->bytes(), base::Value::CreateWithCopiedBuffer(bytes_reader->bytes(),
bytes_reader->length())); bytes_reader->length()));
upload_data_dict->Set("bytes", std::move(bytes)); upload_data_dict->Set("bytes", std::move(bytes));
} else if (reader->AsFileReader()) { } else if (reader->AsFileReader()) {

View file

@ -205,7 +205,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
case base::Value::Type::BINARY: case base::Value::Type::BINARY:
return ToArrayBuffer(isolate, return ToArrayBuffer(isolate,
static_cast<const base::BinaryValue*>(value)); static_cast<const base::Value*>(value));
default: default:
LOG(ERROR) << "Unexpected value type: " << value->GetType(); LOG(ERROR) << "Unexpected value type: " << value->GetType();
@ -254,7 +254,7 @@ v8::Local<v8::Value> V8ValueConverter::ToV8Object(
} }
v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer( v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer(
v8::Isolate* isolate, const base::BinaryValue* value) const { v8::Isolate* isolate, const base::Value* value) const {
const char* data = value->GetBuffer(); const char* data = value->GetBuffer();
size_t length = value->GetSize(); size_t length = value->GetSize();
@ -420,7 +420,7 @@ base::Value* V8ValueConverter::FromNodeBuffer(
v8::Local<v8::Value> value, v8::Local<v8::Value> value,
FromV8ValueState* state, FromV8ValueState* state,
v8::Isolate* isolate) const { v8::Isolate* isolate) const {
return base::BinaryValue::CreateWithCopiedBuffer( return base::Value::CreateWithCopiedBuffer(
node::Buffer::Data(value), node::Buffer::Length(value)).release(); node::Buffer::Data(value), node::Buffer::Length(value)).release();
} }

View file

@ -13,7 +13,6 @@ namespace base {
class DictionaryValue; class DictionaryValue;
class ListValue; class ListValue;
class Value; class Value;
using BinaryValue = Value;
} }
namespace atom { namespace atom {
@ -44,7 +43,7 @@ class V8ValueConverter {
const base::DictionaryValue* dictionary) const; const base::DictionaryValue* dictionary) const;
v8::Local<v8::Value> ToArrayBuffer( v8::Local<v8::Value> ToArrayBuffer(
v8::Isolate* isolate, v8::Isolate* isolate,
const base::BinaryValue* value) const; const base::Value* value) const;
base::Value* FromV8ValueImpl(FromV8ValueState* state, base::Value* FromV8ValueImpl(FromV8ValueState* state,
v8::Local<v8::Value> value, v8::Local<v8::Value> value,