| 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 3fb144944bcf16c57d38a87e20d2f8bcc5b393cf..b650b4d7c2cd8aa459f4a369bf9629c60a820358 100644
|
| --- a/services/ui/public/cpp/gpu_service.cc
|
| +++ b/services/ui/public/cpp/gpu_service.cc
|
| @@ -23,8 +23,7 @@ GpuService::GpuService(service_manager::Connector* connector,
|
| io_task_runner_(std::move(task_runner)),
|
| connector_(connector),
|
| shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
| - base::WaitableEvent::InitialState::NOT_SIGNALED),
|
| - gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager) {
|
| + base::WaitableEvent::InitialState::NOT_SIGNALED) {
|
| DCHECK(main_task_runner_);
|
| DCHECK(connector_);
|
| if (!io_task_runner_) {
|
| @@ -49,7 +48,16 @@ GpuService::~GpuService() {
|
| std::unique_ptr<GpuService> GpuService::Create(
|
| service_manager::Connector* connector,
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
|
| - return base::WrapUnique(new GpuService(connector, std::move(task_runner)));
|
| + auto service =
|
| + base::WrapUnique(new GpuService(connector, std::move(task_runner)));
|
| + service->SetUpConnection();
|
| + return service;
|
| +}
|
| +
|
| +void GpuService::SetUpConnection() {
|
| + connector_->ConnectToInterface("service:ui", &gpu_service_);
|
| + gpu_memory_buffer_manager_ =
|
| + base::MakeUnique<MojoGpuMemoryBufferManager>(gpu_service_.get());
|
| }
|
|
|
| void GpuService::EstablishGpuChannel(
|
| @@ -62,10 +70,6 @@ void GpuService::EstablishGpuChannel(
|
| return;
|
| }
|
| establish_callbacks_.push_back(callback);
|
| - if (gpu_service_)
|
| - return;
|
| -
|
| - connector_->ConnectToInterface("service:ui", &gpu_service_);
|
| gpu_service_->EstablishGpuChannel(
|
| base::Bind(&GpuService::OnEstablishedGpuChannel, base::Unretained(this)));
|
| }
|
| @@ -78,7 +82,7 @@ scoped_refptr<gpu::GpuChannelHost> GpuService::EstablishGpuChannelSync() {
|
| int client_id = 0;
|
| mojo::ScopedMessagePipeHandle channel_handle;
|
| gpu::GPUInfo gpu_info;
|
| - connector_->ConnectToInterface("service:ui", &gpu_service_);
|
| + // connector_->ConnectToInterface("service:ui", &gpu_service_);
|
|
|
| mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
|
| if (!gpu_service_->EstablishGpuChannel(&client_id, &channel_handle,
|
| @@ -118,7 +122,6 @@ void GpuService::OnEstablishedGpuChannel(
|
| &shutdown_event_, gpu_memory_buffer_manager_.get());
|
| }
|
|
|
| - gpu_service_.reset();
|
| for (const auto& i : establish_callbacks_)
|
| i.Run(gpu_channel_);
|
| establish_callbacks_.clear();
|
|
|