Commit 7089a457 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert OutputProtection to new Mojo types

This CL converts OutputProtection{Ptr, Request} in media and chrome
to the new Mojo type.

Bug: 955171
Change-Id: Ie7dfdb8fe46b2aec18a576eb6435122b662c1fd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1882263Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#710128}
parent 77add479
......@@ -16,7 +16,7 @@
// static
void OutputProtectionImpl::Create(
content::RenderFrameHost* render_frame_host,
media::mojom::OutputProtectionRequest request) {
mojo::PendingReceiver<media::mojom::OutputProtection> receiver) {
DVLOG(2) << __func__;
// OutputProtectionProxy requires to run on the UI thread.
......@@ -25,13 +25,13 @@ void OutputProtectionImpl::Create(
// The object is bound to the lifetime of |render_frame_host| and the mojo
// connection. See FrameServiceBase for details.
new OutputProtectionImpl(render_frame_host, std::move(request));
new OutputProtectionImpl(render_frame_host, std::move(receiver));
}
OutputProtectionImpl::OutputProtectionImpl(
content::RenderFrameHost* render_frame_host,
media::mojom::OutputProtectionRequest request)
: FrameServiceBase(render_frame_host, std::move(request)),
mojo::PendingReceiver<media::mojom::OutputProtection> receiver)
: FrameServiceBase(render_frame_host, std::move(receiver)),
render_process_id_(render_frame_host->GetProcess()->GetID()),
render_frame_id_(render_frame_host->GetRoutingID()) {}
......
......@@ -7,6 +7,7 @@
#include "content/public/browser/frame_service_base.h"
#include "media/mojo/mojom/output_protection.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
class OutputProtectionProxy;
......@@ -20,11 +21,13 @@ class RenderFrameHost;
class OutputProtectionImpl final
: public content::FrameServiceBase<media::mojom::OutputProtection> {
public:
static void Create(content::RenderFrameHost* render_frame_host,
media::mojom::OutputProtectionRequest request);
static void Create(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<media::mojom::OutputProtection> receiver);
OutputProtectionImpl(content::RenderFrameHost* render_frame_host,
media::mojom::OutputProtectionRequest request);
OutputProtectionImpl(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<media::mojom::OutputProtection> receiver);
// media::mojom::OutputProtection implementation.
void QueryStatus(QueryStatusCallback callback) final;
......
......@@ -69,7 +69,7 @@ void MojoCdmHelper::QueryStatus(QueryStatusCB callback) {
QueryStatusCB scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback), false, 0, 0);
ConnectToOutputProtection();
output_protection_ptr_->QueryStatus(std::move(scoped_callback));
output_protection_->QueryStatus(std::move(scoped_callback));
}
void MojoCdmHelper::EnableProtection(uint32_t desired_protection_mask,
......@@ -77,8 +77,8 @@ void MojoCdmHelper::EnableProtection(uint32_t desired_protection_mask,
EnableProtectionCB scoped_callback =
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false);
ConnectToOutputProtection();
output_protection_ptr_->EnableProtection(desired_protection_mask,
std::move(scoped_callback));
output_protection_->EnableProtection(desired_protection_mask,
std::move(scoped_callback));
}
void MojoCdmHelper::ChallengePlatform(const std::string& service_id,
......@@ -127,9 +127,10 @@ CdmAllocator* MojoCdmHelper::GetAllocator() {
}
void MojoCdmHelper::ConnectToOutputProtection() {
if (!output_protection_ptr_) {
service_manager::GetInterface<mojom::OutputProtection>(
interface_provider_, &output_protection_ptr_);
if (!output_protection_) {
interface_provider_->GetInterface(
mojom::OutputProtection::Name_,
output_protection_.BindNewPipeAndPassReceiver().PassPipe());
}
}
......
......@@ -19,6 +19,7 @@
#include "media/mojo/services/media_mojo_export.h"
#include "media/mojo/services/mojo_cdm_file_io.h"
#include "media/mojo/services/mojo_cdm_proxy.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace service_manager {
namespace mojom {
......@@ -73,7 +74,7 @@ class MEDIA_MOJO_EXPORT MojoCdmHelper final : public CdmAuxiliaryHelper,
// the browser crashed, so there's no point in trying to reconnect.
mojom::CdmStoragePtr cdm_storage_ptr_;
std::unique_ptr<CdmAllocator> allocator_;
mojom::OutputProtectionPtr output_protection_ptr_;
mojo::Remote<mojom::OutputProtection> output_protection_;
mojom::PlatformVerificationPtr platform_verification_ptr_;
FileReadCB file_read_cb_;
......
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