Repository: electron/electron
File: shell/browser/api/electron_api_app.cc (C++)

Code before:
  argv.reserve(1 + args.size());

  if (exec_path.empty()) {
    base::FilePath current_exe_path;
    base::PathService::Get(base::FILE_EXE, &current_exe_path);
    argv.push_back(current_exe_path.value());
  } else {
    argv.push_back(exec_path.value());
  }

  argv.insert(argv.end(), args.begin(), args.end());

  return relauncher::RelaunchApp(argv);
}

void App::DisableHardwareAcceleration(gin_helper::ErrorThrower thrower) {
  if (Browser::Get()->is_ready()) {
    thrower.ThrowError(
        "app.disableHardwareAcceleration() can only be called "
        "before app is ready");
    return;
  }

  if (content::GpuDataManager::Initialized())
    content::GpuDataManager::GetInstance()->DisableHardwareAcceleration();
  disable_hw_acceleration_ = true;
}

bool App::IsHardwareAccelerationEnabled() {
  if (content::GpuDataManager::Initialized())
    return content::GpuDataManager::GetInstance()
        ->HardwareAccelerationEnabled();
  return !disable_hw_acceleration_;
}

void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) {
  if (Browser::Get()->is_ready()) {
    thrower.ThrowError(
        "app.disableDomainBlockingFor3DAPIs() can only be called "
        "before app is ready");
    return;
  }
  if (content::GpuDataManager::Initialized()) {
    content::GpuDataManagerImpl::GetInstance()
        ->DisableDomainBlockingFor3DAPIsForTesting();
  } else {
    disable_domain_blocking_for_3DAPIs_ = true;
  }
}

bool App::IsAccessibilitySupportEnabled() {

Review comment (suggestion):
This flag is used elsewhere to determine that disabling hw acceleration has been requested: https://github.com/electron/electron/blob/ee82128f5be5ab46738b1d54ce6b00828d84e2a4/shell/browser/api/electron_api_app.cc#L632

Code after:

  if (!override_argv) {
    const relauncher::StringVector& argv =
        electron::ElectronCommandLine::argv();
    return relauncher::RelaunchApp(argv);
  }

  relauncher::StringVector argv;
  argv.reserve(1 + args.size());

  if (exec_path.empty()) {
    base::FilePath current_exe_path;
    base::PathService::Get(base::FILE_EXE, &current_exe_path);
    argv.push_back(current_exe_path.value());
  } else {
    argv.push_back(exec_path.value());
  }

  argv.insert(argv.end(), args.begin(), args.end());

  return relauncher::RelaunchApp(argv);
}

void App::DisableHardwareAcceleration(gin_helper::ErrorThrower thrower) {
  if (Browser::Get()->is_ready()) {
    thrower.ThrowError(
        "app.disableHardwareAcceleration() can only be called "
        "before app is ready");
    return;
  }

  // If the GpuDataManager is already initialized, disable hardware
  // acceleration immediately. Otherwise, set a flag to disable it in
  // OnPreCreateThreads().
  if (content::GpuDataManager::Initialized()) {
    content::GpuDataManager::GetInstance()->DisableHardwareAcceleration();
  } else {
    disable_hw_acceleration_ = true;
  }
}

bool App::IsHardwareAccelerationEnabled() {
  if (content::GpuDataManager::Initialized())
    return content::GpuDataManager::GetInstance()
        ->HardwareAccelerationEnabled();
  return !disable_hw_acceleration_;
}

void App::DisableDomainBlockingFor3DAPIs(gin_helper::ErrorThrower thrower) {
  if (Browser::Get()->is_ready()) {
    thrower.ThrowError(