Commit d476f83e authored by Wez's avatar Wez Committed by Commit Bot

Terminate GPU process via ExitProcess rather than RunLoop::QuitCurrent.

Quitting the RunLoop with QuitCurrent*Deprecated() triggers the DCHECK
against mixing the deprecated quit APIs with use of QuitClosure.

Use the GpuServiceImpl::ExitProcess() helper to quit the process
gracefully, instead.

Also removes the |is_exiting_| flag in favour of checking whether
|exit_callback_| is set, and adds a DCHECK for a non-null
|exit_callback| being passed at construction.

Bug: 882068
Cq-Include-Trybots: luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Id8a87e4648fbac3283f41ce2f80cf03a153227ab
Reviewed-on: https://chromium-review.googlesource.com/1214750
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590061}
parent 5f306543
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/memory/shared_memory.h" #include "base/memory/shared_memory.h"
#include "base/run_loop.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task_runner_util.h" #include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
...@@ -159,6 +158,8 @@ GpuServiceImpl::GpuServiceImpl( ...@@ -159,6 +158,8 @@ GpuServiceImpl::GpuServiceImpl(
bindings_(std::make_unique<mojo::BindingSet<mojom::GpuService>>()), bindings_(std::make_unique<mojo::BindingSet<mojom::GpuService>>()),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(!io_runner_->BelongsToCurrentThread()); DCHECK(!io_runner_->BelongsToCurrentThread());
DCHECK(exit_callback_);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
protected_buffer_manager_ = new arc::ProtectedBufferManager(); protected_buffer_manager_ = new arc::ProtectedBufferManager();
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
...@@ -540,9 +541,8 @@ void GpuServiceImpl::GetGpuSupportedRuntimeVersion( ...@@ -540,9 +541,8 @@ void GpuServiceImpl::GetGpuSupportedRuntimeVersion(
gpu::RecordGpuSupportedRuntimeVersionHistograms(&gpu_info_); gpu::RecordGpuSupportedRuntimeVersionHistograms(&gpu_info_);
std::move(callback).Run(gpu_info_); std::move(callback).Run(gpu_info_);
if (!in_host_process()) { if (!in_host_process()) {
// The unsandboxed GPU process fulfilled its duty. Rest // The unsandboxed GPU process fulfilled its duty. Bye bye.
// in peace. ExitProcess();
base::RunLoop().QuitCurrentWhenIdleDeprecated();
} }
#endif #endif
} }
...@@ -566,9 +566,8 @@ void GpuServiceImpl::RequestCompleteGpuInfo( ...@@ -566,9 +566,8 @@ void GpuServiceImpl::RequestCompleteGpuInfo(
std::move(callback).Run(gpu_service->gpu_info_); std::move(callback).Run(gpu_service->gpu_info_);
#if defined(OS_WIN) #if defined(OS_WIN)
if (!gpu_service->in_host_process()) { if (!gpu_service->in_host_process()) {
// The unsandboxed GPU process fulfilled its duty. Rest // The unsandboxed GPU process fulfilled its duty. Bye bye.
// in peace. gpu_service->ExitProcess();
base::RunLoop::QuitCurrentWhenIdleDeprecated();
} }
#endif #endif
}, },
...@@ -684,11 +683,8 @@ void GpuServiceImpl::StoreShaderToDisk(int client_id, ...@@ -684,11 +683,8 @@ void GpuServiceImpl::StoreShaderToDisk(int client_id,
} }
void GpuServiceImpl::ExitProcess() { void GpuServiceImpl::ExitProcess() {
if (is_exiting_) if (exit_callback_)
return; std::move(exit_callback_).Run();
is_exiting_ = true;
std::move(exit_callback_).Run();
} }
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -301,7 +301,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate, ...@@ -301,7 +301,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
// Callback that safely exits GPU process. // Callback that safely exits GPU process.
base::OnceClosure exit_callback_; base::OnceClosure exit_callback_;
bool is_exiting_ = false;
base::Time start_time_; base::Time start_time_;
......
...@@ -78,8 +78,6 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain { ...@@ -78,8 +78,6 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain {
DISALLOW_COPY_AND_ASSIGN(ExternalDependencies); DISALLOW_COPY_AND_ASSIGN(ExternalDependencies);
}; };
// TODO(kylechar): Provide a quit closure for the appropriate RunLoop instance
// to stop the thread and remove base::RunLoop::QuitCurrentDeprecated() usage.
VizMainImpl(Delegate* delegate, VizMainImpl(Delegate* delegate,
ExternalDependencies dependencies, ExternalDependencies dependencies,
std::unique_ptr<gpu::GpuInit> gpu_init = nullptr); std::unique_ptr<gpu::GpuInit> gpu_init = nullptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment