Commit e0b9dae3 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Port content::BindInterfaceInGpuProcess to the new Mojo types

This CL ports BindInterfaceInGpuProcess to accept a
mojo::PendingReceiver and makes the minimum changes to get all users to
compile. This is required for later CLs that depend on this function.

Bug: 955171
Change-Id: Ib70d2b5612d7905fabde2e7aeff941c4d219f302
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1801146
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#698453}
parent 050ac990
......@@ -18,6 +18,7 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_service_registry.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h"
......@@ -43,11 +44,13 @@ class ArcOemCryptoBridgeFactory
~ArcOemCryptoBridgeFactory() override = default;
};
mojom::ProtectedBufferManagerPtr GetGpuBufferManagerOnIOThread() {
mojo::PendingRemote<mojom::ProtectedBufferManager>
GetGpuBufferManagerOnIOThread() {
// Get the Mojo interface from the GPU for dealing with secure buffers and
// pass that to the daemon as well in our Connect call.
mojom::ProtectedBufferManagerPtr gpu_buffer_manager;
content::BindInterfaceInGpuProcess(mojo::MakeRequest(&gpu_buffer_manager));
mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager;
content::BindInterfaceInGpuProcess(
gpu_buffer_manager.InitWithNewPipeAndPassReceiver());
return gpu_buffer_manager;
}
......@@ -156,7 +159,7 @@ void ArcOemCryptoBridge::ConnectToDaemon(
void ArcOemCryptoBridge::FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager) {
mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager) {
if (!oemcrypto_host_daemon_ptr_) {
VLOG(1) << "Mojo connection is already lost.";
return;
......
......@@ -13,6 +13,7 @@
#include "components/arc/mojom/oemcrypto.mojom.h"
#include "components/arc/mojom/oemcrypto_daemon.mojom.h"
#include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
namespace content {
class BrowserContext;
......@@ -43,7 +44,7 @@ class ArcOemCryptoBridge : public KeyedService,
void ConnectToDaemon(mojom::OemCryptoServiceRequest request);
void FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager);
mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager);
void OnMojoConnectionError();
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
......
......@@ -20,6 +20,7 @@ import "components/arc/mojom/protected_buffer_manager.mojom";
// Chrome OS and has Connect called from the Browser process in Chrome.
// Next Method ID: 1
interface OemCryptoHostDaemon {
Connect@0(arc.mojom.OemCryptoService& oemcryptor,
arc.mojom.ProtectedBufferManager protected_buffer_manager);
Connect@0(
arc.mojom.OemCryptoService& oemcryptor,
pending_remote<arc.mojom.ProtectedBufferManager> protected_buffer_manager);
};
......@@ -56,8 +56,9 @@ void StartUtilityProcessOnIOThread(mojom::PowerMonitorTestRequest request) {
BindInterface(host, std::move(request));
}
void BindInterfaceForGpuOnIOThread(mojom::PowerMonitorTestRequest request) {
BindInterfaceInGpuProcess(std::move(request));
void BindInterfaceForGpuOnIOThread(
mojo::PendingReceiver<mojom::PowerMonitorTest> receiver) {
BindInterfaceInGpuProcess(std::move(receiver));
}
class MockPowerMonitorMessageBroadcaster : public device::mojom::PowerMonitor {
......
......@@ -6,9 +6,10 @@
#define CONTENT_PUBLIC_BROWSER_GPU_INTERFACE_REGISTRY_H_
#include <string>
#include <utility>
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/system/message_pipe.h"
namespace content {
......@@ -19,9 +20,8 @@ CONTENT_EXPORT void BindInterfaceInGpuProcess(
// Bind to an interface exposed by the GPU process.
template <typename Interface>
void BindInterfaceInGpuProcess(mojo::InterfaceRequest<Interface> request) {
BindInterfaceInGpuProcess(Interface::Name_,
std::move(request.PassMessagePipe()));
void BindInterfaceInGpuProcess(mojo::PendingReceiver<Interface> receiver) {
BindInterfaceInGpuProcess(Interface::Name_, receiver.PassPipe());
}
} // namespace content
......
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