Commit 0e08edc1 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert KeySystemSupport to new Mojo types

This CL converts KeySystemSupport{Ptr, Request} in content to the
new Mojo type.

Bug: 955171
Change-Id: I84b54952523842d408f13515eeae0649c73895e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1882200Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-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@{#710133}
parent 12612d08
......@@ -21,7 +21,7 @@
#include "media/base/key_systems.h"
#include "media/base/media_switches.h"
#include "media/mojo/buildflags.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
namespace content {
......@@ -136,11 +136,11 @@ void GetHardwareSecureDecryptionCaps(
// static
void KeySystemSupportImpl::Create(
media::mojom::KeySystemSupportRequest request) {
mojo::PendingReceiver<media::mojom::KeySystemSupport> receiver) {
DVLOG(3) << __func__;
// The created object is bound to (and owned by) |request|.
mojo::MakeStrongBinding(std::make_unique<KeySystemSupportImpl>(),
std::move(request));
mojo::MakeSelfOwnedReceiver(std::make_unique<KeySystemSupportImpl>(),
std::move(receiver));
}
// static
......
......@@ -12,6 +12,7 @@
#include "content/common/content_export.h"
#include "content/public/common/cdm_info.h"
#include "media/mojo/mojom/key_system_support.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace content {
......@@ -21,8 +22,9 @@ class CONTENT_EXPORT KeySystemSupportImpl final
KeySystemSupportImpl();
~KeySystemSupportImpl() final;
// Create a KeySystemSupportImpl object and bind it to |request|.
static void Create(media::mojom::KeySystemSupportRequest request);
// Create a KeySystemSupportImpl object and bind it to |receiver|.
static void Create(
mojo::PendingReceiver<media::mojom::KeySystemSupport> receiver);
// Returns CdmInfo registered for |key_system|. Returns null if no CdmInfo is
// registered for |key_system|, or if the CdmInfo registered is invalid.
......
......@@ -17,6 +17,7 @@
#include "content/public/test/browser_task_environment.h"
#include "media/base/decrypt_config.h"
#include "media/base/video_codecs.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
......@@ -58,7 +59,8 @@ class KeySystemSupportTest : public testing::Test {
protected:
void SetUp() final {
DVLOG(1) << __func__;
KeySystemSupportImpl::Create(mojo::MakeRequest(&key_system_support_));
KeySystemSupportImpl::Create(
key_system_support_.BindNewPipeAndPassReceiver());
}
// TODO(xhwang): Add tests for hardware secure video codecs and encryption
......@@ -91,7 +93,7 @@ class KeySystemSupportTest : public testing::Test {
return is_available;
}
media::mojom::KeySystemSupportPtr key_system_support_;
mojo::Remote<media::mojom::KeySystemSupport> key_system_support_;
BrowserTaskEnvironment task_environment_;
// Updated by IsSupported().
......
......@@ -8,6 +8,7 @@
#include "content/public/common/service_names.mojom.h"
#include "content/public/renderer/render_thread.h"
#include "media/mojo/mojom/key_system_support.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/service_manager/public/cpp/connector.h"
namespace content {
......@@ -18,9 +19,9 @@ bool IsKeySystemSupported(
DVLOG(3) << __func__ << " key_system: " << key_system;
bool is_supported = false;
media::mojom::KeySystemSupportPtr key_system_support;
mojo::Remote<media::mojom::KeySystemSupport> key_system_support;
content::RenderThread::Get()->BindHostReceiver(
mojo::MakeRequest(&key_system_support));
key_system_support.BindNewPipeAndPassReceiver());
key_system_support->IsKeySystemSupported(key_system, &is_supported,
key_system_capability);
......
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