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 @@ ...@@ -18,6 +18,7 @@
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_service_registry.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/platform/platform_channel.h"
#include "mojo/public/cpp/system/invitation.h" #include "mojo/public/cpp/system/invitation.h"
...@@ -43,11 +44,13 @@ class ArcOemCryptoBridgeFactory ...@@ -43,11 +44,13 @@ class ArcOemCryptoBridgeFactory
~ArcOemCryptoBridgeFactory() override = default; ~ArcOemCryptoBridgeFactory() override = default;
}; };
mojom::ProtectedBufferManagerPtr GetGpuBufferManagerOnIOThread() { mojo::PendingRemote<mojom::ProtectedBufferManager>
GetGpuBufferManagerOnIOThread() {
// Get the Mojo interface from the GPU for dealing with secure buffers and // Get the Mojo interface from the GPU for dealing with secure buffers and
// pass that to the daemon as well in our Connect call. // pass that to the daemon as well in our Connect call.
mojom::ProtectedBufferManagerPtr gpu_buffer_manager; mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager;
content::BindInterfaceInGpuProcess(mojo::MakeRequest(&gpu_buffer_manager)); content::BindInterfaceInGpuProcess(
gpu_buffer_manager.InitWithNewPipeAndPassReceiver());
return gpu_buffer_manager; return gpu_buffer_manager;
} }
...@@ -156,7 +159,7 @@ void ArcOemCryptoBridge::ConnectToDaemon( ...@@ -156,7 +159,7 @@ void ArcOemCryptoBridge::ConnectToDaemon(
void ArcOemCryptoBridge::FinishConnectingToDaemon( void ArcOemCryptoBridge::FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request, mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager) { mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager) {
if (!oemcrypto_host_daemon_ptr_) { if (!oemcrypto_host_daemon_ptr_) {
VLOG(1) << "Mojo connection is already lost."; VLOG(1) << "Mojo connection is already lost.";
return; return;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "components/arc/mojom/oemcrypto.mojom.h" #include "components/arc/mojom/oemcrypto.mojom.h"
#include "components/arc/mojom/oemcrypto_daemon.mojom.h" #include "components/arc/mojom/oemcrypto_daemon.mojom.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
namespace content { namespace content {
class BrowserContext; class BrowserContext;
...@@ -43,7 +44,7 @@ class ArcOemCryptoBridge : public KeyedService, ...@@ -43,7 +44,7 @@ class ArcOemCryptoBridge : public KeyedService,
void ConnectToDaemon(mojom::OemCryptoServiceRequest request); void ConnectToDaemon(mojom::OemCryptoServiceRequest request);
void FinishConnectingToDaemon( void FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request, mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager); mojo::PendingRemote<mojom::ProtectedBufferManager> gpu_buffer_manager);
void OnMojoConnectionError(); void OnMojoConnectionError();
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
......
...@@ -20,6 +20,7 @@ import "components/arc/mojom/protected_buffer_manager.mojom"; ...@@ -20,6 +20,7 @@ import "components/arc/mojom/protected_buffer_manager.mojom";
// Chrome OS and has Connect called from the Browser process in Chrome. // Chrome OS and has Connect called from the Browser process in Chrome.
// Next Method ID: 1 // Next Method ID: 1
interface OemCryptoHostDaemon { interface OemCryptoHostDaemon {
Connect@0(arc.mojom.OemCryptoService& oemcryptor, Connect@0(
arc.mojom.ProtectedBufferManager protected_buffer_manager); arc.mojom.OemCryptoService& oemcryptor,
pending_remote<arc.mojom.ProtectedBufferManager> protected_buffer_manager);
}; };
...@@ -56,8 +56,9 @@ void StartUtilityProcessOnIOThread(mojom::PowerMonitorTestRequest request) { ...@@ -56,8 +56,9 @@ void StartUtilityProcessOnIOThread(mojom::PowerMonitorTestRequest request) {
BindInterface(host, std::move(request)); BindInterface(host, std::move(request));
} }
void BindInterfaceForGpuOnIOThread(mojom::PowerMonitorTestRequest request) { void BindInterfaceForGpuOnIOThread(
BindInterfaceInGpuProcess(std::move(request)); mojo::PendingReceiver<mojom::PowerMonitorTest> receiver) {
BindInterfaceInGpuProcess(std::move(receiver));
} }
class MockPowerMonitorMessageBroadcaster : public device::mojom::PowerMonitor { class MockPowerMonitorMessageBroadcaster : public device::mojom::PowerMonitor {
......
...@@ -6,9 +6,10 @@ ...@@ -6,9 +6,10 @@
#define CONTENT_PUBLIC_BROWSER_GPU_INTERFACE_REGISTRY_H_ #define CONTENT_PUBLIC_BROWSER_GPU_INTERFACE_REGISTRY_H_
#include <string> #include <string>
#include <utility>
#include "content/common/content_export.h" #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" #include "mojo/public/cpp/system/message_pipe.h"
namespace content { namespace content {
...@@ -19,9 +20,8 @@ CONTENT_EXPORT void BindInterfaceInGpuProcess( ...@@ -19,9 +20,8 @@ CONTENT_EXPORT void BindInterfaceInGpuProcess(
// Bind to an interface exposed by the GPU process. // Bind to an interface exposed by the GPU process.
template <typename Interface> template <typename Interface>
void BindInterfaceInGpuProcess(mojo::InterfaceRequest<Interface> request) { void BindInterfaceInGpuProcess(mojo::PendingReceiver<Interface> receiver) {
BindInterfaceInGpuProcess(Interface::Name_, BindInterfaceInGpuProcess(Interface::Name_, receiver.PassPipe());
std::move(request.PassMessagePipe()));
} }
} // namespace content } // 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