Remove base::Value::IsType
https://chromium-review.googlesource.com/659798
This commit is contained in:
parent
48c3340d95
commit
a315d6330c
8 changed files with 13 additions and 13 deletions
|
@ -57,11 +57,11 @@ void AskForOptions(v8::Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsErrorOptions(base::Value* value, int* error) {
|
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);
|
base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(value);
|
||||||
if (dict->GetInteger("error", error))
|
if (dict->GetInteger("error", error))
|
||||||
return true;
|
return true;
|
||||||
} else if (value->IsType(base::Value::Type::INTEGER)) {
|
} else if (value->is_int()) {
|
||||||
if (value->GetAsInteger(error))
|
if (value->GetAsInteger(error))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob(
|
||||||
|
|
||||||
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
|
void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
|
||||||
base::FilePath::StringType file_path;
|
base::FilePath::StringType file_path;
|
||||||
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
if (options->is_dict()) {
|
||||||
static_cast<base::DictionaryValue*>(options.get())
|
static_cast<base::DictionaryValue*>(options.get())
|
||||||
->GetString("path", &file_path);
|
->GetString("path", &file_path);
|
||||||
} else if (options->IsType(base::Value::Type::STRING)) {
|
} else if (options->is_string()) {
|
||||||
options->GetAsString(&file_path);
|
options->GetAsString(&file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@ URLRequestBufferJob::~URLRequestBufferJob() = default;
|
||||||
|
|
||||||
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
|
void URLRequestBufferJob::StartAsync(std::unique_ptr<base::Value> options) {
|
||||||
const base::Value* binary = nullptr;
|
const base::Value* binary = nullptr;
|
||||||
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
if (options->is_dict()) {
|
||||||
base::DictionaryValue* dict =
|
base::DictionaryValue* dict =
|
||||||
static_cast<base::DictionaryValue*>(options.get());
|
static_cast<base::DictionaryValue*>(options.get());
|
||||||
dict->GetString("mimeType", &mime_type_);
|
dict->GetString("mimeType", &mime_type_);
|
||||||
dict->GetString("charset", &charset_);
|
dict->GetString("charset", &charset_);
|
||||||
dict->GetBinary("data", &binary);
|
dict->GetBinary("data", &binary);
|
||||||
} else if (options->IsType(base::Value::Type::BINARY)) {
|
} else if (options->is_blob()) {
|
||||||
binary = options.get();
|
binary = options.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ void URLRequestFetchJob::BeforeStartInUI(v8::Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLRequestFetchJob::StartAsync(std::unique_ptr<base::Value> options) {
|
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,
|
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
|
||||||
net::ERR_NOT_IMPLEMENTED));
|
net::ERR_NOT_IMPLEMENTED));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -18,13 +18,13 @@ URLRequestStringJob::URLRequestStringJob(net::URLRequest* request,
|
||||||
URLRequestStringJob::~URLRequestStringJob() = default;
|
URLRequestStringJob::~URLRequestStringJob() = default;
|
||||||
|
|
||||||
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
|
void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
|
||||||
if (options->IsType(base::Value::Type::DICTIONARY)) {
|
if (options->is_dict()) {
|
||||||
base::DictionaryValue* dict =
|
base::DictionaryValue* dict =
|
||||||
static_cast<base::DictionaryValue*>(options.get());
|
static_cast<base::DictionaryValue*>(options.get());
|
||||||
dict->GetString("mimeType", &mime_type_);
|
dict->GetString("mimeType", &mime_type_);
|
||||||
dict->GetString("charset", &charset_);
|
dict->GetString("charset", &charset_);
|
||||||
dict->GetString("data", &data_);
|
dict->GetString("data", &data_);
|
||||||
} else if (options->IsType(base::Value::Type::STRING)) {
|
} else if (options->is_string()) {
|
||||||
options->GetAsString(&data_);
|
options->GetAsString(&data_);
|
||||||
}
|
}
|
||||||
net::URLRequestSimpleJob::Start();
|
net::URLRequestSimpleJob::Start();
|
||||||
|
|
|
@ -188,7 +188,7 @@ bool Archive::Init() {
|
||||||
std::string error;
|
std::string error;
|
||||||
base::JSONReader reader;
|
base::JSONReader reader;
|
||||||
std::unique_ptr<base::Value> value(reader.ReadToValue(header));
|
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;
|
LOG(ERROR) << "Failed to parse header: " << error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// 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.
|
// on the browser which doesn't additionally check for null will fail.
|
||||||
// We can avoid all bugs related to this by stripping null.
|
// 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;
|
continue;
|
||||||
|
|
||||||
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),
|
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),
|
||||||
|
|
|
@ -15,7 +15,7 @@ bool Converter<base::DictionaryValue>::FromV8(v8::Isolate* isolate,
|
||||||
atom::V8ValueConverter converter;
|
atom::V8ValueConverter converter;
|
||||||
std::unique_ptr<base::Value> value(
|
std::unique_ptr<base::Value> value(
|
||||||
converter.FromV8Value(val, isolate->GetCurrentContext()));
|
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()));
|
out->Swap(static_cast<base::DictionaryValue*>(value.get()));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,7 +36,7 @@ bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
|
||||||
atom::V8ValueConverter converter;
|
atom::V8ValueConverter converter;
|
||||||
std::unique_ptr<base::Value> value(
|
std::unique_ptr<base::Value> value(
|
||||||
converter.FromV8Value(val, isolate->GetCurrentContext()));
|
converter.FromV8Value(val, isolate->GetCurrentContext()));
|
||||||
if (value->IsType(base::Value::Type::LIST)) {
|
if (value->is_list()) {
|
||||||
out->Swap(static_cast<base::ListValue*>(value.get()));
|
out->Swap(static_cast<base::ListValue*>(value.get()));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue