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 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/memory/shared_memory.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "base/threading/thread_task_runner_handle.h"
......@@ -159,6 +158,8 @@ GpuServiceImpl::GpuServiceImpl(
bindings_(std::make_unique<mojo::BindingSet<mojom::GpuService>>()),
weak_ptr_factory_(this) {
DCHECK(!io_runner_->BelongsToCurrentThread());
DCHECK(exit_callback_);
#if defined(OS_CHROMEOS)
protected_buffer_manager_ = new arc::ProtectedBufferManager();
#endif // defined(OS_CHROMEOS)
......@@ -540,9 +541,8 @@ void GpuServiceImpl::GetGpuSupportedRuntimeVersion(
gpu::RecordGpuSupportedRuntimeVersionHistograms(&gpu_info_);
std::move(callback).Run(gpu_info_);
if (!in_host_process()) {
// The unsandboxed GPU process fulfilled its duty. Rest
// in peace.
base::RunLoop().QuitCurrentWhenIdleDeprecated();
// The unsandboxed GPU process fulfilled its duty. Bye bye.
ExitProcess();
}
#endif
}
......@@ -566,9 +566,8 @@ void GpuServiceImpl::RequestCompleteGpuInfo(
std::move(callback).Run(gpu_service->gpu_info_);
#if defined(OS_WIN)
if (!gpu_service->in_host_process()) {
// The unsandboxed GPU process fulfilled its duty. Rest
// in peace.
base::RunLoop::QuitCurrentWhenIdleDeprecated();
// The unsandboxed GPU process fulfilled its duty. Bye bye.
gpu_service->ExitProcess();
}
#endif
},
......@@ -684,11 +683,8 @@ void GpuServiceImpl::StoreShaderToDisk(int client_id,
}
void GpuServiceImpl::ExitProcess() {
if (is_exiting_)
return;
is_exiting_ = true;
std::move(exit_callback_).Run();
if (exit_callback_)
std::move(exit_callback_).Run();
}
#if defined(OS_WIN)
......
......@@ -301,7 +301,6 @@ class VIZ_SERVICE_EXPORT GpuServiceImpl : public gpu::GpuChannelManagerDelegate,
// Callback that safely exits GPU process.
base::OnceClosure exit_callback_;
bool is_exiting_ = false;
base::Time start_time_;
......
......@@ -78,8 +78,6 @@ class VizMainImpl : public gpu::GpuSandboxHelper, public mojom::VizMain {
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,
ExternalDependencies dependencies,
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