| Index: content/public/browser/gpu_utils.cc
|
| diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc
|
| index 19c6ab65d6297bbf6eeca200f23bed8e0e7037a0..245da16f5a380ddeb9ade1966ba5ed45aeb4c92c 100644
|
| --- a/content/public/browser/gpu_utils.cc
|
| +++ b/content/public/browser/gpu_utils.cc
|
| @@ -5,7 +5,9 @@
|
| #include "content/public/browser/gpu_utils.h"
|
|
|
| #include "base/command_line.h"
|
| +#include "base/single_thread_task_runner.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "content/browser/gpu/gpu_process_host.h"
|
| #include "content/public/common/content_features.h"
|
| #include "content/public/common/content_switches.h"
|
| #include "gpu/command_buffer/service/gpu_switches.h"
|
| @@ -24,6 +26,20 @@ bool GetUintFromSwitch(const base::CommandLine* command_line,
|
| return base::StringToUint(switch_value, value);
|
| }
|
|
|
| +void RunTaskOnTaskRunner(
|
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| + const base::Closure& callback) {
|
| + task_runner->PostTask(FROM_HERE, callback);
|
| +}
|
| +
|
| +void StopGpuProcessImpl(const base::Closure& callback,
|
| + content::GpuProcessHost* host) {
|
| + if (host)
|
| + host->gpu_service()->Stop(callback);
|
| + else
|
| + callback.Run();
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace content {
|
| @@ -116,4 +132,13 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
|
| return gpu_preferences;
|
| }
|
|
|
| +void StopGpuProcess(const base::Closure& callback) {
|
| + content::GpuProcessHost::CallOnIO(
|
| + content::GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
|
| + false /* force_create */,
|
| + base::Bind(&StopGpuProcessImpl,
|
| + base::Bind(RunTaskOnTaskRunner,
|
| + base::ThreadTaskRunnerHandle::Get(), callback)));
|
| +}
|
| +
|
| } // namespace content
|
|
|