diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index fd4fe4b79ced..8f2d08277aea 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -1022,32 +1022,10 @@ std::vector App::GetAppMetrics(v8::Isolate* isolate) { return result; } -static mate::Dictionary ConvertDictionary( - v8::Isolate* isolate, const base::DictionaryValue &dict) { - auto result = mate::Dictionary::CreateEmpty(isolate); - - for (base::DictionaryValue::Iterator iterator(dict); - !iterator.IsAtEnd(); - iterator.Advance()) { - auto& key = iterator.key(); - auto& value = iterator.value(); - if (value.is_string()) { - std::string strValue; - if (value.GetAsString(&strValue)) { - result.Set(key, strValue); - } - } - } - - return result; -} - -mate::Dictionary App::GetGPUFeatureStatus(v8::Isolate* isolate) { - if (auto status = content::GetFeatureStatus()) { - return ConvertDictionary(isolate, *status); - } else { - return mate::Dictionary::CreateEmpty(isolate); - } +v8::Local App::GetGPUFeatureStatus(v8::Isolate* isolate) { + auto status = content::GetFeatureStatus(); + return mate::ConvertToV8(isolate, + status ? *status : base::DictionaryValue()); } // static diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index eab1dcdf88ab..f97265943509 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -177,7 +177,7 @@ class App : public AtomBrowserClient::Delegate, mate::Arguments* args); std::vector GetAppMetrics(v8::Isolate* isolate); - mate::Dictionary GetGPUFeatureStatus(v8::Isolate* isolate); + v8::Local GetGPUFeatureStatus(v8::Isolate* isolate); #if defined(OS_WIN) // Get the current Jump List settings.