Browse Source

Remove base::Value::IsType

https://chromium-review.googlesource.com/659798
Aleksei Kuzmin 7 years ago
parent
commit
a315d6330c

+ 2 - 2
atom/browser/net/js_asker.cc

@@ -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;
   }

+ 2 - 2
atom/browser/net/url_request_async_asar_job.cc

@@ -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);
   }
 

+ 2 - 2
atom/browser/net/url_request_buffer_job.cc

@@ -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();
   }
 

+ 1 - 1
atom/browser/net/url_request_fetch_job.cc

@@ -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;

+ 2 - 2
atom/browser/net/url_request_string_job.cc

@@ -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();

+ 1 - 1
atom/common/asar/archive.cc

@@ -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;
   }

+ 1 - 1
atom/common/native_mate_converters/v8_value_converter.cc

@@ -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()),

+ 2 - 2
atom/common/native_mate_converters/value_converter.cc

@@ -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 {