Commit f7916e86 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Migrate Gpu to the new Mojo types

This CL converts old Mojo types to the new Mojo types.

  - Apply pending_receiver to CreateGpuMemoryBufferFactory

Bug: 955171
Change-Id: I84cb8e73efcfa2d499bc8f568d5586744e8be7dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792023
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarJonathan Backer <backer@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694861}
parent c0ff20af
...@@ -211,8 +211,8 @@ void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, ...@@ -211,8 +211,8 @@ void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
} }
void GpuClient::CreateGpuMemoryBufferFactory( void GpuClient::CreateGpuMemoryBufferFactory(
mojom::GpuMemoryBufferFactoryRequest request) { mojo::PendingReceiver<mojom::GpuMemoryBufferFactory> receiver) {
gpu_memory_buffer_factory_bindings_.AddBinding(this, std::move(request)); gpu_memory_buffer_factory_receivers_.Add(this, std::move(receiver));
} }
} // namespace viz } // namespace viz
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "components/viz/host/gpu_host_impl.h" #include "components/viz/host/gpu_host_impl.h"
#include "components/viz/host/viz_host_export.h" #include "components/viz/host/viz_host_export.h"
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/viz/public/mojom/gpu.mojom.h" #include "services/viz/public/mojom/gpu.mojom.h"
namespace viz { namespace viz {
...@@ -52,7 +53,7 @@ class VIZ_HOST_EXPORT GpuClient : public mojom::GpuMemoryBufferFactory, ...@@ -52,7 +53,7 @@ class VIZ_HOST_EXPORT GpuClient : public mojom::GpuMemoryBufferFactory,
// mojom::Gpu overrides: // mojom::Gpu overrides:
void CreateGpuMemoryBufferFactory( void CreateGpuMemoryBufferFactory(
mojom::GpuMemoryBufferFactoryRequest request) override; mojo::PendingReceiver<mojom::GpuMemoryBufferFactory> receiver) override;
void EstablishGpuChannel(EstablishGpuChannelCallback callback) override; void EstablishGpuChannel(EstablishGpuChannelCallback callback) override;
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -83,8 +84,8 @@ class VIZ_HOST_EXPORT GpuClient : public mojom::GpuMemoryBufferFactory, ...@@ -83,8 +84,8 @@ class VIZ_HOST_EXPORT GpuClient : public mojom::GpuMemoryBufferFactory,
std::unique_ptr<GpuClientDelegate> delegate_; std::unique_ptr<GpuClientDelegate> delegate_;
const int client_id_; const int client_id_;
const uint64_t client_tracing_id_; const uint64_t client_tracing_id_;
mojo::BindingSet<mojom::GpuMemoryBufferFactory> mojo::ReceiverSet<mojom::GpuMemoryBufferFactory>
gpu_memory_buffer_factory_bindings_; gpu_memory_buffer_factory_receivers_;
mojo::BindingSet<mojom::Gpu> gpu_bindings_; mojo::BindingSet<mojom::Gpu> gpu_bindings_;
bool gpu_channel_requested_ = false; bool gpu_channel_requested_ = false;
EstablishGpuChannelCallback callback_; EstablishGpuChannelCallback callback_;
......
...@@ -30,16 +30,16 @@ class Gpu::GpuPtrIO { ...@@ -30,16 +30,16 @@ class Gpu::GpuPtrIO {
GpuPtrIO() { DETACH_FROM_THREAD(thread_checker_); } GpuPtrIO() { DETACH_FROM_THREAD(thread_checker_); }
~GpuPtrIO() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } ~GpuPtrIO() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); }
void Initialize( void Initialize(mojom::GpuPtrInfo ptr_info,
mojom::GpuPtrInfo ptr_info, mojo::PendingReceiver<mojom::GpuMemoryBufferFactory>
mojom::GpuMemoryBufferFactoryRequest memory_buffer_factory_request) { memory_buffer_factory_receiver) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
gpu_ptr_.Bind(std::move(ptr_info)); gpu_ptr_.Bind(std::move(ptr_info));
gpu_ptr_.set_connection_error_handler( gpu_ptr_.set_connection_error_handler(
base::BindOnce(&GpuPtrIO::ConnectionError, base::Unretained(this))); base::BindOnce(&GpuPtrIO::ConnectionError, base::Unretained(this)));
gpu_ptr_->CreateGpuMemoryBufferFactory( gpu_ptr_->CreateGpuMemoryBufferFactory(
std::move(memory_buffer_factory_request)); std::move(memory_buffer_factory_receiver));
} }
void EstablishGpuChannel(scoped_refptr<EstablishRequest> establish_request) { void EstablishGpuChannel(scoped_refptr<EstablishRequest> establish_request) {
......
...@@ -37,7 +37,7 @@ class TestGpuImpl : public mojom::Gpu { ...@@ -37,7 +37,7 @@ class TestGpuImpl : public mojom::Gpu {
// mojom::Gpu overrides: // mojom::Gpu overrides:
void CreateGpuMemoryBufferFactory( void CreateGpuMemoryBufferFactory(
mojom::GpuMemoryBufferFactoryRequest request) override {} mojo::PendingReceiver<mojom::GpuMemoryBufferFactory> receiver) override {}
void EstablishGpuChannel(EstablishGpuChannelCallback callback) override { void EstablishGpuChannel(EstablishGpuChannelCallback callback) override {
if (close_binding_on_request_) { if (close_binding_on_request_) {
......
...@@ -30,7 +30,8 @@ interface GpuMemoryBufferFactory { ...@@ -30,7 +30,8 @@ interface GpuMemoryBufferFactory {
interface Gpu { interface Gpu {
// Note: The bound-to GpuMemoryBufferFactory instance is only guaranteed to // Note: The bound-to GpuMemoryBufferFactory instance is only guaranteed to
// stay alive for as long as the invoked Gpu instance. // stay alive for as long as the invoked Gpu instance.
CreateGpuMemoryBufferFactory(GpuMemoryBufferFactory& request); CreateGpuMemoryBufferFactory(
pending_receiver<GpuMemoryBufferFactory> receiver);
// Tells the GPU service to create a new channel for communication with a // Tells the GPU service to create a new channel for communication with a
// client. The GPU service responds with client ID, IPC handle and // client. The GPU service responds with client ID, IPC handle and
......
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