Commit 53db36ef authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Commit Bot

Fixed threading for GPU interface for ArcOemCrypto

This fixes a DCHECK crash where we were making a call to bind the GPU
interface that wasn't called on the IO thread. It now makes a call on
the IO thread to get the interface which then posts a task back to the
original thread to then complete the Mojo call.

Bug: 829045
Test: Verified DCHECK is gone and L1 DRM still works
Change-Id: Ia10ce58a2ecef071f33cfc48a49c72af3bc23a8c
Reviewed-on: https://chromium-review.googlesource.com/998530
Commit-Queue: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548611}
parent a47da1e4
......@@ -14,6 +14,7 @@
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_browser_context_keyed_service_factory_base.h"
#include "components/arc/common/protected_buffer_manager.mojom.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/gpu_service_registry.h"
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/outgoing_broker_client_invitation.h"
......@@ -42,6 +43,14 @@ class ArcOemCryptoBridgeFactory
~ArcOemCryptoBridgeFactory() override = default;
};
mojom::ProtectedBufferManagerPtr 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));
return gpu_buffer_manager;
}
} // namespace
// static
......@@ -133,10 +142,19 @@ void ArcOemCryptoBridge::Connect(mojom::OemCryptoServiceRequest request) {
void ArcOemCryptoBridge::ConnectToDaemon(
mojom::OemCryptoServiceRequest request) {
// 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));
// We need to get the GPU interface on the IO thread, then after that is
// done it will run the Mojo call on our thread.
base::PostTaskAndReplyWithResult(
content::BrowserThread::GetTaskRunnerForThread(content::BrowserThread::IO)
.get(),
FROM_HERE, base::BindOnce(&GetGpuBufferManagerOnIOThread),
base::BindOnce(&ArcOemCryptoBridge::FinishConnectingToDaemon,
weak_factory_.GetWeakPtr(), std::move(request)));
}
void ArcOemCryptoBridge::FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager) {
oemcrypto_host_daemon_ptr_->Connect(std::move(request),
std::move(gpu_buffer_manager));
}
......
......@@ -41,6 +41,9 @@ class ArcOemCryptoBridge : public KeyedService,
void OnBootstrapMojoConnection(mojom::OemCryptoServiceRequest request,
bool result);
void ConnectToDaemon(mojom::OemCryptoServiceRequest request);
void FinishConnectingToDaemon(
mojom::OemCryptoServiceRequest request,
mojom::ProtectedBufferManagerPtr gpu_buffer_manager);
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
arc_oemcrypto::mojom::OemCryptoHostDaemonPtr oemcrypto_host_daemon_ptr_;
......
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