Commit 440f5bdf authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Commit Bot

Remove SequencedTaskRunnerHandle::Get() usages in MojoAudioOutputIPC

This is part of efforts to replace base::ThreadTaskRunnerHandle::Get()
and SequencedTaskRunnerHandle::Get() with other appropriate task runners
in the renderer.

Bug: 827065
Change-Id: I6b4d582ba9e1d53dfddebacc8baec199eb311271
Reviewed-on: https://chromium-review.googlesource.com/985995
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarBill Budge <bbudge@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548683}
parent 91808c04
...@@ -39,7 +39,8 @@ AudioOutputIPCFactory::CreateAudioOutputIPC(int frame_id) const { ...@@ -39,7 +39,8 @@ AudioOutputIPCFactory::CreateAudioOutputIPC(int frame_id) const {
// Unretained is safe due to the contract at the top of the header file. // Unretained is safe due to the contract at the top of the header file.
return std::make_unique<MojoAudioOutputIPC>( return std::make_unique<MojoAudioOutputIPC>(
base::BindRepeating(&AudioOutputIPCFactory::GetRemoteFactory, base::BindRepeating(&AudioOutputIPCFactory::GetRemoteFactory,
base::Unretained(this), frame_id)); base::Unretained(this), frame_id),
io_task_runner_);
} }
return audio_message_filter_->CreateAudioOutputIPC(frame_id); return audio_message_filter_->CreateAudioOutputIPC(frame_id);
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <utility> #include <utility>
#include "base/threading/sequenced_task_runner_handle.h"
#include "media/audio/audio_device_description.h" #include "media/audio/audio_device_description.h"
#include "mojo/public/cpp/bindings/callback_helpers.h" #include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/system/platform_handle.h" #include "mojo/public/cpp/system/platform_handle.h"
...@@ -21,12 +20,13 @@ void TrivialAuthorizedCallback(media::OutputDeviceStatus, ...@@ -21,12 +20,13 @@ void TrivialAuthorizedCallback(media::OutputDeviceStatus,
} // namespace } // namespace
MojoAudioOutputIPC::MojoAudioOutputIPC(FactoryAccessorCB factory_accessor) MojoAudioOutputIPC::MojoAudioOutputIPC(
FactoryAccessorCB factory_accessor,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
: factory_accessor_(std::move(factory_accessor)), : factory_accessor_(std::move(factory_accessor)),
binding_(this), binding_(this),
weak_factory_(this) { io_task_runner_(std::move(io_task_runner)),
DETACH_FROM_THREAD(thread_checker_); weak_factory_(this) {}
}
MojoAudioOutputIPC::~MojoAudioOutputIPC() { MojoAudioOutputIPC::~MojoAudioOutputIPC() {
DCHECK(!AuthorizationRequested() && !StreamCreationRequested()) DCHECK(!AuthorizationRequested() && !StreamCreationRequested())
...@@ -41,7 +41,7 @@ void MojoAudioOutputIPC::RequestDeviceAuthorization( ...@@ -41,7 +41,7 @@ void MojoAudioOutputIPC::RequestDeviceAuthorization(
int session_id, int session_id,
const std::string& device_id, const std::string& device_id,
const url::Origin& security_origin) { const url::Origin& security_origin) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(delegate); DCHECK(delegate);
DCHECK(!delegate_); DCHECK(!delegate_);
DCHECK(!AuthorizationRequested()); DCHECK(!AuthorizationRequested());
...@@ -63,7 +63,7 @@ void MojoAudioOutputIPC::RequestDeviceAuthorization( ...@@ -63,7 +63,7 @@ void MojoAudioOutputIPC::RequestDeviceAuthorization(
void MojoAudioOutputIPC::CreateStream(media::AudioOutputIPCDelegate* delegate, void MojoAudioOutputIPC::CreateStream(media::AudioOutputIPCDelegate* delegate,
const media::AudioParameters& params) { const media::AudioParameters& params) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(delegate); DCHECK(delegate);
DCHECK(!StreamCreationRequested()); DCHECK(!StreamCreationRequested());
if (!AuthorizationRequested()) { if (!AuthorizationRequested()) {
...@@ -94,19 +94,19 @@ void MojoAudioOutputIPC::CreateStream(media::AudioOutputIPCDelegate* delegate, ...@@ -94,19 +94,19 @@ void MojoAudioOutputIPC::CreateStream(media::AudioOutputIPCDelegate* delegate,
} }
void MojoAudioOutputIPC::PlayStream() { void MojoAudioOutputIPC::PlayStream() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(stream_.is_bound()); DCHECK(stream_.is_bound());
stream_->Play(); stream_->Play();
} }
void MojoAudioOutputIPC::PauseStream() { void MojoAudioOutputIPC::PauseStream() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(stream_.is_bound()); DCHECK(stream_.is_bound());
stream_->Pause(); stream_->Pause();
} }
void MojoAudioOutputIPC::CloseStream() { void MojoAudioOutputIPC::CloseStream() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
stream_provider_.reset(); stream_provider_.reset();
stream_.reset(); stream_.reset();
binding_.Close(); binding_.Close();
...@@ -117,13 +117,13 @@ void MojoAudioOutputIPC::CloseStream() { ...@@ -117,13 +117,13 @@ void MojoAudioOutputIPC::CloseStream() {
} }
void MojoAudioOutputIPC::SetVolume(double volume) { void MojoAudioOutputIPC::SetVolume(double volume) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(stream_.is_bound()); DCHECK(stream_.is_bound());
stream_->SetVolume(volume); stream_->SetVolume(volume);
} }
void MojoAudioOutputIPC::OnError() { void MojoAudioOutputIPC::OnError() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(delegate_); DCHECK(delegate_);
delegate_->OnError(); delegate_->OnError();
} }
...@@ -138,7 +138,7 @@ bool MojoAudioOutputIPC::StreamCreationRequested() { ...@@ -138,7 +138,7 @@ bool MojoAudioOutputIPC::StreamCreationRequested() {
media::mojom::AudioOutputStreamProviderRequest media::mojom::AudioOutputStreamProviderRequest
MojoAudioOutputIPC::MakeProviderRequest() { MojoAudioOutputIPC::MakeProviderRequest() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(!AuthorizationRequested()); DCHECK(!AuthorizationRequested());
media::mojom::AudioOutputStreamProviderRequest request = media::mojom::AudioOutputStreamProviderRequest request =
mojo::MakeRequest(&stream_provider_); mojo::MakeRequest(&stream_provider_);
...@@ -161,7 +161,7 @@ void MojoAudioOutputIPC::DoRequestDeviceAuthorization( ...@@ -161,7 +161,7 @@ void MojoAudioOutputIPC::DoRequestDeviceAuthorization(
int session_id, int session_id,
const std::string& device_id, const std::string& device_id,
AuthorizationCB callback) { AuthorizationCB callback) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
auto* factory = factory_accessor_.Run(); auto* factory = factory_accessor_.Run();
if (!factory) { if (!factory) {
LOG(ERROR) << "MojoAudioOutputIPC failed to acquire factory"; LOG(ERROR) << "MojoAudioOutputIPC failed to acquire factory";
...@@ -172,7 +172,7 @@ void MojoAudioOutputIPC::DoRequestDeviceAuthorization( ...@@ -172,7 +172,7 @@ void MojoAudioOutputIPC::DoRequestDeviceAuthorization(
// when the factory is destroyed before reply, i.e. calling // when the factory is destroyed before reply, i.e. calling
// OnDeviceAuthorized with ERROR_INTERNAL in the normal case. // OnDeviceAuthorized with ERROR_INTERNAL in the normal case.
// The AudioOutputIPCDelegate will call CloseStream as necessary. // The AudioOutputIPCDelegate will call CloseStream as necessary.
base::SequencedTaskRunnerHandle::Get()->PostTask( io_task_runner_->PostTask(
FROM_HERE, FROM_HERE,
base::BindOnce([](AuthorizationCB cb) {}, std::move(callback))); base::BindOnce([](AuthorizationCB cb) {}, std::move(callback)));
return; return;
...@@ -188,14 +188,14 @@ void MojoAudioOutputIPC::ReceivedDeviceAuthorization( ...@@ -188,14 +188,14 @@ void MojoAudioOutputIPC::ReceivedDeviceAuthorization(
media::OutputDeviceStatus status, media::OutputDeviceStatus status,
const media::AudioParameters& params, const media::AudioParameters& params,
const std::string& device_id) const { const std::string& device_id) const {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(delegate_); DCHECK(delegate_);
delegate_->OnDeviceAuthorized(status, params, device_id); delegate_->OnDeviceAuthorized(status, params, device_id);
} }
void MojoAudioOutputIPC::StreamCreated( void MojoAudioOutputIPC::StreamCreated(
media::mojom::AudioDataPipePtr data_pipe) { media::mojom::AudioDataPipePtr data_pipe) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(io_task_runner_->RunsTasksInCurrentSequence());
DCHECK(delegate_); DCHECK(delegate_);
base::PlatformFile socket_handle; base::PlatformFile socket_handle;
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/common/media/renderer_audio_output_stream_factory.mojom.h" #include "content/common/media/renderer_audio_output_stream_factory.mojom.h"
#include "media/audio/audio_output_ipc.h" #include "media/audio/audio_output_ipc.h"
...@@ -31,7 +30,9 @@ class CONTENT_EXPORT MojoAudioOutputIPC ...@@ -31,7 +30,9 @@ class CONTENT_EXPORT MojoAudioOutputIPC
// |factory_accessor| is required to provide a // |factory_accessor| is required to provide a
// RendererAudioOutputStreamFactory* if IPC is possible. // RendererAudioOutputStreamFactory* if IPC is possible.
explicit MojoAudioOutputIPC(FactoryAccessorCB factory_accessor); MojoAudioOutputIPC(
FactoryAccessorCB factory_accessor,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
~MojoAudioOutputIPC() override; ~MojoAudioOutputIPC() override;
...@@ -73,12 +74,11 @@ class CONTENT_EXPORT MojoAudioOutputIPC ...@@ -73,12 +74,11 @@ class CONTENT_EXPORT MojoAudioOutputIPC
const FactoryAccessorCB factory_accessor_; const FactoryAccessorCB factory_accessor_;
THREAD_CHECKER(thread_checker_);
mojo::Binding<media::mojom::AudioOutputStreamClient> binding_; mojo::Binding<media::mojom::AudioOutputStreamClient> binding_;
media::mojom::AudioOutputStreamProviderPtr stream_provider_; media::mojom::AudioOutputStreamProviderPtr stream_provider_;
media::mojom::AudioOutputStreamPtr stream_; media::mojom::AudioOutputStreamPtr stream_;
media::AudioOutputIPCDelegate* delegate_ = nullptr; media::AudioOutputIPCDelegate* delegate_ = nullptr;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
// To make sure we don't send an "authorization completed" callback for a // To make sure we don't send an "authorization completed" callback for a
// stream after it's closed, we use this weak factory. // stream after it's closed, we use this weak factory.
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "mojo/public/cpp/system/platform_handle.h" #include "mojo/public/cpp/system/platform_handle.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "url/origin.h" #include "url/origin.h"
using testing::_; using testing::_;
...@@ -205,7 +206,9 @@ TEST(MojoAudioOutputIPC, AuthorizeWithoutFactory_CallsAuthorizedWithError) { ...@@ -205,7 +206,9 @@ TEST(MojoAudioOutputIPC, AuthorizeWithoutFactory_CallsAuthorizedWithError) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(NullAccessor()); std::make_unique<MojoAudioOutputIPC>(
NullAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin()); ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin());
...@@ -224,7 +227,9 @@ TEST(MojoAudioOutputIPC, ...@@ -224,7 +227,9 @@ TEST(MojoAudioOutputIPC,
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(NullAccessor()); std::make_unique<MojoAudioOutputIPC>(
NullAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->CreateStream(&delegate, Params()); ipc->CreateStream(&delegate, Params());
...@@ -240,7 +245,9 @@ TEST(MojoAudioOutputIPC, DeviceAuthorized_Propagates) { ...@@ -240,7 +245,9 @@ TEST(MojoAudioOutputIPC, DeviceAuthorized_Propagates) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr));
...@@ -262,7 +269,9 @@ TEST(MojoAudioOutputIPC, OnDeviceCreated_Propagates) { ...@@ -262,7 +269,9 @@ TEST(MojoAudioOutputIPC, OnDeviceCreated_Propagates) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream));
...@@ -286,7 +295,9 @@ TEST(MojoAudioOutputIPC, ...@@ -286,7 +295,9 @@ TEST(MojoAudioOutputIPC,
StrictMock<MockStream> stream; StrictMock<MockStream> stream;
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
// Note: This call implicitly EXPECTs that authorization is requested, // Note: This call implicitly EXPECTs that authorization is requested,
// and constructing the TestStreamProvider with a |&stream| EXPECTs that the // and constructing the TestStreamProvider with a |&stream| EXPECTs that the
...@@ -312,7 +323,9 @@ TEST(MojoAudioOutputIPC, IsReusable) { ...@@ -312,7 +323,9 @@ TEST(MojoAudioOutputIPC, IsReusable) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
...@@ -341,7 +354,9 @@ TEST(MojoAudioOutputIPC, IsReusableAfterError) { ...@@ -341,7 +354,9 @@ TEST(MojoAudioOutputIPC, IsReusableAfterError) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr));
...@@ -391,7 +406,9 @@ TEST(MojoAudioOutputIPC, DeviceNotAuthorized_Propagates) { ...@@ -391,7 +406,9 @@ TEST(MojoAudioOutputIPC, DeviceNotAuthorized_Propagates) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.RefuseNextRequest(kSessionId, kDeviceId); stream_factory.RefuseNextRequest(kSessionId, kDeviceId);
ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin()); ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin());
...@@ -420,7 +437,9 @@ TEST(MojoAudioOutputIPC, ...@@ -420,7 +437,9 @@ TEST(MojoAudioOutputIPC,
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin()); ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin());
...@@ -450,7 +469,9 @@ TEST(MojoAudioOutputIPC, ...@@ -450,7 +469,9 @@ TEST(MojoAudioOutputIPC,
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin()); ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin());
...@@ -475,7 +496,9 @@ TEST(MojoAudioOutputIPC, AuthorizeNoClose_DCHECKs) { ...@@ -475,7 +496,9 @@ TEST(MojoAudioOutputIPC, AuthorizeNoClose_DCHECKs) {
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(nullptr));
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin()); ipc->RequestDeviceAuthorization(&delegate, kSessionId, kDeviceId, Origin());
EXPECT_DCHECK_DEATH(ipc.reset()); EXPECT_DCHECK_DEATH(ipc.reset());
...@@ -495,7 +518,9 @@ TEST(MojoAudioOutputIPC, CreateNoClose_DCHECKs) { ...@@ -495,7 +518,9 @@ TEST(MojoAudioOutputIPC, CreateNoClose_DCHECKs) {
std::make_unique<TestStreamProvider>(&stream)); std::make_unique<TestStreamProvider>(&stream));
std::unique_ptr<media::AudioOutputIPC> ipc = std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
ipc->CreateStream(&delegate, Params()); ipc->CreateStream(&delegate, Params());
EXPECT_DCHECK_DEATH(ipc.reset()); EXPECT_DCHECK_DEATH(ipc.reset());
...@@ -511,7 +536,9 @@ TEST(MojoAudioOutputIPC, Play_Plays) { ...@@ -511,7 +536,9 @@ TEST(MojoAudioOutputIPC, Play_Plays) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream));
...@@ -537,7 +564,9 @@ TEST(MojoAudioOutputIPC, Pause_Pauses) { ...@@ -537,7 +564,9 @@ TEST(MojoAudioOutputIPC, Pause_Pauses) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream));
...@@ -563,7 +592,9 @@ TEST(MojoAudioOutputIPC, SetVolume_SetsVolume) { ...@@ -563,7 +592,9 @@ TEST(MojoAudioOutputIPC, SetVolume_SetsVolume) {
StrictMock<MockDelegate> delegate; StrictMock<MockDelegate> delegate;
const std::unique_ptr<media::AudioOutputIPC> ipc = const std::unique_ptr<media::AudioOutputIPC> ipc =
std::make_unique<MojoAudioOutputIPC>(stream_factory.GetAccessor()); std::make_unique<MojoAudioOutputIPC>(
stream_factory.GetAccessor(),
blink::scheduler::GetSingleThreadTaskRunnerForTesting());
stream_factory.PrepareProviderForAuthorization( stream_factory.PrepareProviderForAuthorization(
kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream)); kSessionId, kDeviceId, std::make_unique<TestStreamProvider>(&stream));
......
...@@ -252,12 +252,13 @@ TEST_F(RendererAudioOutputStreamFactoryIntegrationTest, StreamIntegrationTest) { ...@@ -252,12 +252,13 @@ TEST_F(RendererAudioOutputStreamFactoryIntegrationTest, StreamIntegrationTest) {
// Wait for factory_ptr to be set. // Wait for factory_ptr to be set.
SyncWith(renderer_ipc_task_runner); SyncWith(renderer_ipc_task_runner);
auto renderer_side_ipc = auto renderer_side_ipc = std::make_unique<MojoAudioOutputIPC>(
std::make_unique<MojoAudioOutputIPC>(base::BindRepeating( base::BindRepeating(
[](mojom::RendererAudioOutputStreamFactory* factory_ptr) { [](mojom::RendererAudioOutputStreamFactory* factory_ptr) {
return factory_ptr; return factory_ptr;
}, },
factory_ptr)); factory_ptr),
renderer_ipc_task_runner);
auto device = base::MakeRefCounted<media::AudioOutputDevice>( auto device = base::MakeRefCounted<media::AudioOutputDevice>(
std::move(renderer_side_ipc), renderer_ipc_task_runner, kNoSessionId, "", std::move(renderer_side_ipc), renderer_ipc_task_runner, kNoSessionId, "",
......
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