Add app.disableHardwareAcceleration() API

This commit is contained in:
Cheng Zhao 2016-06-06 20:19:55 +09:00
parent 3e809901e0
commit 02cfe30df9
3 changed files with 19 additions and 2 deletions

View file

@ -447,6 +447,15 @@ bool App::Relaunch(mate::Arguments* js_args) {
return relauncher::RelaunchApp(argv);
}
void App::DisableHardwareAcceleration(mate::Arguments* args) {
if (Browser::Get()->is_ready()) {
args->ThrowError("app.disableHardwareAcceleration() can only be called "
"before app is ready");
return;
}
content::GpuDataManager::GetInstance()->DisableHardwareAcceleration();
}
#if defined(USE_NSS_CERTS)
void App::ImportCertificate(
const base::DictionaryValue& options,
@ -528,7 +537,9 @@ void App::BuildPrototype(
#endif
.SetMethod("makeSingleInstance", &App::MakeSingleInstance)
.SetMethod("releaseSingleInstance", &App::ReleaseSingleInstance)
.SetMethod("relaunch", &App::Relaunch);
.SetMethod("relaunch", &App::Relaunch)
.SetMethod("disableHardwareAcceleration",
&App::DisableHardwareAcceleration);
}
} // namespace api

View file

@ -111,7 +111,7 @@ class App : public AtomBrowserClient::Delegate,
const ProcessSingleton::NotificationCallback& callback);
void ReleaseSingleInstance();
bool Relaunch(mate::Arguments* args);
void DisableHardwareAcceleration(mate::Arguments* args);
#if defined(USE_NSS_CERTS)
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);