| Index: services/ui/public/cpp/gpu_service.cc
|
| diff --git a/services/ui/public/cpp/gpu_service.cc b/services/ui/public/cpp/gpu_service.cc
|
| index 6c70440f940189eca61194151bf4c52152597284..71c973f1d9e1d1ea6674e3b721072a7262565bc3 100644
|
| --- a/services/ui/public/cpp/gpu_service.cc
|
| +++ b/services/ui/public/cpp/gpu_service.cc
|
| @@ -35,15 +35,11 @@ GpuService::GpuService(shell::Connector* connector)
|
| connector_(connector),
|
| shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
| base::WaitableEvent::InitialState::NOT_SIGNALED),
|
| - io_thread_("GPUIOThread"),
|
| gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager),
|
| is_establishing_(false),
|
| establishing_condition_(&lock_) {
|
| DCHECK(main_task_runner_);
|
| DCHECK(connector_);
|
| - base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
|
| - thread_options.priority = base::ThreadPriority::NORMAL;
|
| - CHECK(io_thread_.StartWithOptions(thread_options));
|
| }
|
|
|
| GpuService::~GpuService() {
|
| @@ -58,6 +54,12 @@ std::unique_ptr<GpuService> GpuService::Initialize(
|
| return base::WrapUnique(new GpuService(connector));
|
| }
|
|
|
| +void GpuService::SetIOThreadTaskRunner(
|
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
|
| + DCHECK(!io_task_runner_);
|
| + io_task_runner_ = std::move(task_runner);
|
| +}
|
| +
|
| void GpuService::EstablishGpuChannel(
|
| const gpu::GpuChannelEstablishedCallback& callback) {
|
| base::AutoLock auto_lock(lock_);
|
| @@ -205,7 +207,14 @@ bool GpuService::IsMainThread() {
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner>
|
| GpuService::GetIOThreadTaskRunner() {
|
| - return io_thread_.task_runner();
|
| + if (!io_task_runner_) {
|
| + io_thread_.reset(new base::Thread("GPUIOThread"));
|
| + base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
|
| + thread_options.priority = base::ThreadPriority::NORMAL;
|
| + CHECK(io_thread_->StartWithOptions(thread_options));
|
| + io_task_runner_ = io_thread_->task_runner();
|
| + }
|
| + return io_task_runner_;
|
| }
|
|
|
| std::unique_ptr<base::SharedMemory> GpuService::AllocateSharedMemory(
|
|
|