Remove base::Value::IsType

https://chromium-review.googlesource.com/659798
This commit is contained in:
Aleksei Kuzmin 2018-04-10 16:05:36 +02:00 committed by Samuel Attard
parent 48c3340d95
commit a315d6330c
8 changed files with 13 additions and 13 deletions

View file

@ -57,11 +57,11 @@ void AskForOptions(v8::Isolate* isolate,
}
bool IsErrorOptions(base::Value* value, int* error) {
if (value->IsType(base::Value::Type::DICTIONARY)) {
if (value->is_dict()) {
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value);
if (dict->GetInteger("error", error))
return true;
} else if (value->IsType(base::Value::Type::INTEGER)) {
} else if (value->is_int()) {
if (value->GetAsInteger(error))
return true;
}

View file

@ -18,10 +18,10 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
base::FilePath::StringType file_path;
if (options->IsType(base::Value::Type::DICTIONARY)) {
if (options->is_dict()) {
static_cast<base::DictionaryValue*>(options.get())
->GetString("path", &file_path);
} else if (options->IsType(base::Value::Type::STRING)) {
} else if (options->is_string()) {
options->GetAsString(&file_path);
}

View file

@ -35,13 +35,13 @@ URLRequestBufferJob::~URLRequestBufferJob() = default;
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
const base::Value* binary = nullptr;
if (options->IsType(base::Value::Type::DICTIONARY)) {
if (options->is_dict()) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_);
dict->GetString("charset", &charset_);
dict->GetBinary("data", &binary);
} else if (options->IsType(base::Value::Type::BINARY)) {
} else if (options->is_blob()) {
binary = options.get();
}

View file

@ -109,7 +109,7 @@ void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
}
void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
if (!options->IsType(base::Value::Type::DICTIONARY)) {
if (!options->is_dict()) {
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
net::ERR_NOT_IMPLEMENTED));
return;

View file

@ -18,13 +18,13 @@ URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
URLRequestStringJob::~URLRequestStringJob() = default;
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
if (options->IsType(base::Value::Type::DICTIONARY)) {
if (options->is_dict()) {
base::DictionaryValue* dict =
static_cast<base::DictionaryValue*>(options.get());
dict->GetString("mimeType", &mime_type_);
dict->GetString("charset", &charset_);
dict->GetString("data", &data_);
} else if (options->IsType(base::Value::Type::STRING)) {
} else if (options->is_string()) {
options->GetAsString(&data_);
}
net::URLRequestSimpleJob::Start();

View file

@ -188,7 +188,7 @@ bool Archive::Init() {
std::string error;
base::JSONReader reader;
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
if (!value || !value->IsType(base::Value::Type::DICTIONARY)) {
if (!value || !value->is_dict()) {
LOG(ERROR) << "Failed to parse header: " << error;
return false;
}

View file

@ -481,7 +481,7 @@ base::Value* V8ValueConverter::FromV8Object(v8::Local<v8::Object> val,
// there *is* a "windowId" property, but since it should be an int, code
// on the browser which doesn't additionally check for null will fail.
// We can avoid all bugs related to this by stripping null.
if (strip_null_from_objects_ && child->IsType(base::Value::Type::NONE))
if (strip_null_from_objects_ && child->is_none())
continue;
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),

View file

@ -15,7 +15,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
atom::V8ValueConverter converter;
std::unique_ptr<base::Value> value(
converter.FromV8Value(val, isolate->GetCurrentContext()));
if (value && value->IsType(base::Value::Type::DICTIONARY)) {
if (value && value->is_dict()) {
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
return true;
} else {
@ -36,7 +36,7 @@ bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
atom::V8ValueConverter converter;
std::unique_ptr<base::Value> value(
converter.FromV8Value(val, isolate->GetCurrentContext()));
if (value->IsType(base::Value::Type::LIST)) {
if (value->is_list()) {
out->Swap(static_cast<base::ListValue*>(value.get()));
return true;
} else {