Commit 834c0430 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert AudioFocusManagerDebug to new Mojo types

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

Bug: 955171
Change-Id: I9b219438be413d57b0c97e635d39b48d8a2352b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849734
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#704995}
parent 8a743026
...@@ -94,7 +94,7 @@ void MediaInternalsAudioFocusHelper::SetEnabled(bool enabled) { ...@@ -94,7 +94,7 @@ void MediaInternalsAudioFocusHelper::SetEnabled(bool enabled) {
if (!enabled) { if (!enabled) {
audio_focus_.reset(); audio_focus_.reset();
audio_focus_debug_ptr_.reset(); audio_focus_debug_.reset();
receiver_.reset(); receiver_.reset();
} }
} }
...@@ -119,10 +119,10 @@ bool MediaInternalsAudioFocusHelper::EnsureServiceConnection() { ...@@ -119,10 +119,10 @@ bool MediaInternalsAudioFocusHelper::EnsureServiceConnection() {
} }
// Connect to the media session service debug interface. // Connect to the media session service debug interface.
if (!audio_focus_debug_ptr_.is_bound()) { if (!audio_focus_debug_.is_bound()) {
connector->BindInterface(media_session::mojom::kServiceName, connector->Connect(media_session::mojom::kServiceName,
mojo::MakeRequest(&audio_focus_debug_ptr_)); audio_focus_debug_.BindNewPipeAndPassReceiver());
audio_focus_debug_ptr_.set_connection_error_handler( audio_focus_debug_.set_disconnect_handler(
base::BindRepeating(&MediaInternalsAudioFocusHelper::OnDebugMojoError, base::BindRepeating(&MediaInternalsAudioFocusHelper::OnDebugMojoError,
base::Unretained(this))); base::Unretained(this)));
} }
...@@ -144,7 +144,7 @@ void MediaInternalsAudioFocusHelper::OnMojoError() { ...@@ -144,7 +144,7 @@ void MediaInternalsAudioFocusHelper::OnMojoError() {
} }
void MediaInternalsAudioFocusHelper::OnDebugMojoError() { void MediaInternalsAudioFocusHelper::OnDebugMojoError() {
audio_focus_debug_ptr_.reset(); audio_focus_debug_.reset();
} }
void MediaInternalsAudioFocusHelper::DidGetAudioFocusRequestList( void MediaInternalsAudioFocusHelper::DidGetAudioFocusRequestList(
...@@ -171,7 +171,7 @@ void MediaInternalsAudioFocusHelper::DidGetAudioFocusRequestList( ...@@ -171,7 +171,7 @@ void MediaInternalsAudioFocusHelper::DidGetAudioFocusRequestList(
request_state_.emplace(id_string, session.Clone()); request_state_.emplace(id_string, session.Clone());
audio_focus_debug_ptr_->GetDebugInfoForRequest( audio_focus_debug_->GetDebugInfoForRequest(
session->request_id.value(), session->request_id.value(),
base::BindOnce( base::BindOnce(
&MediaInternalsAudioFocusHelper::DidGetAudioFocusDebugInfo, &MediaInternalsAudioFocusHelper::DidGetAudioFocusDebugInfo,
......
...@@ -65,7 +65,7 @@ class MediaInternalsAudioFocusHelper ...@@ -65,7 +65,7 @@ class MediaInternalsAudioFocusHelper
// Holds a remote to the media session service and it's debug interface. // Holds a remote to the media session service and it's debug interface.
mojo::Remote<media_session::mojom::AudioFocusManager> audio_focus_; mojo::Remote<media_session::mojom::AudioFocusManager> audio_focus_;
media_session::mojom::AudioFocusManagerDebugPtr audio_focus_debug_ptr_; mojo::Remote<media_session::mojom::AudioFocusManagerDebug> audio_focus_debug_;
// Must only be accessed on the UI thread. // Must only be accessed on the UI thread.
base::DictionaryValue audio_focus_data_; base::DictionaryValue audio_focus_data_;
......
...@@ -295,9 +295,9 @@ void AudioFocusManager::BindToInterface( ...@@ -295,9 +295,9 @@ void AudioFocusManager::BindToInterface(
} }
void AudioFocusManager::BindToDebugInterface( void AudioFocusManager::BindToDebugInterface(
mojom::AudioFocusManagerDebugRequest request) { mojo::PendingReceiver<mojom::AudioFocusManagerDebug> receiver) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
debug_bindings_.AddBinding(this, std::move(request)); debug_receivers_.Add(this, std::move(receiver));
} }
void AudioFocusManager::BindToControllerManagerInterface( void AudioFocusManager::BindToControllerManagerInterface(
......
...@@ -93,8 +93,9 @@ class AudioFocusManager : public mojom::AudioFocusManager, ...@@ -93,8 +93,9 @@ class AudioFocusManager : public mojom::AudioFocusManager,
void BindToInterface( void BindToInterface(
mojo::PendingReceiver<mojom::AudioFocusManager> receiver); mojo::PendingReceiver<mojom::AudioFocusManager> receiver);
// Bind to a mojom::AudioFocusManagerDebugRequest. // Bind to a receiver of mojom::AudioFocusManagerDebug.
void BindToDebugInterface(mojom::AudioFocusManagerDebugRequest request); void BindToDebugInterface(
mojo::PendingReceiver<mojom::AudioFocusManagerDebug> receiver);
// Bind to a mojom::MediaControllerManagerRequest. // Bind to a mojom::MediaControllerManagerRequest.
void BindToControllerManagerInterface( void BindToControllerManagerInterface(
...@@ -162,8 +163,8 @@ class AudioFocusManager : public mojom::AudioFocusManager, ...@@ -162,8 +163,8 @@ class AudioFocusManager : public mojom::AudioFocusManager,
mojo::ReceiverSet<mojom::AudioFocusManager, std::unique_ptr<ReceiverContext>> mojo::ReceiverSet<mojom::AudioFocusManager, std::unique_ptr<ReceiverContext>>
receivers_; receivers_;
// Holds mojo bindings for the Audio Focus Manager Debug API. // Holds mojo receivers for the Audio Focus Manager Debug API.
mojo::BindingSet<mojom::AudioFocusManagerDebug> debug_bindings_; mojo::ReceiverSet<mojom::AudioFocusManagerDebug> debug_receivers_;
// Holds mojo bindings for the Media Controller Manager API. // Holds mojo bindings for the Media Controller Manager API.
mojo::BindingSet<mojom::MediaControllerManager> controller_bindings_; mojo::BindingSet<mojom::MediaControllerManager> controller_bindings_;
......
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