Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: components/arc/arc_bridge_service.cc

Issue 1817093003: Host-side implementation of ARC audio bridge. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused override and update data type. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index 2dca1709ed03beb0a20d0f1c3c247bd2444674c3..149b10bd5f0f3d8eafb7e876e6aee8fd329911b2 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -60,6 +60,8 @@ void ArcBridgeService::AddObserver(Observer* observer) {
// them explicitly now to avoid a race.
if (app_instance())
observer->OnAppInstanceReady();
+ if (audio_instance())
+ observer->OnAudioInstanceReady();
if (auth_instance())
observer->OnAuthInstanceReady();
if (clipboard_instance())
@@ -113,6 +115,29 @@ void ArcBridgeService::CloseAppChannel() {
FOR_EACH_OBSERVER(Observer, observer_list(), OnAppInstanceClosed());
}
+void ArcBridgeService::OnAudioInstanceReady(AudioInstancePtr audio_ptr) {
+ DCHECK(CalledOnValidThread());
+ temporary_audio_ptr_ = std::move(audio_ptr);
+ temporary_audio_ptr_.QueryVersion(base::Bind(
+ &ArcBridgeService::OnAudioVersionReady, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::OnAudioVersionReady(int32_t version) {
+ DCHECK(CalledOnValidThread());
+ audio_ptr_ = std::move(temporary_audio_ptr_);
+ audio_ptr_.set_connection_error_handler(base::Bind(
+ &ArcBridgeService::CloseAudioChannel, weak_factory_.GetWeakPtr()));
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnAudioInstanceReady());
+}
+
+void ArcBridgeService::CloseAudioChannel() {
+ if (!audio_ptr_)
+ return;
+
+ audio_ptr_.reset();
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnAudioInstanceClosed());
+}
+
void ArcBridgeService::OnAuthInstanceReady(AuthInstancePtr auth_ptr) {
DCHECK(CalledOnValidThread());
temporary_auth_ptr_ = std::move(auth_ptr);
@@ -434,6 +459,7 @@ void ArcBridgeService::CloseAllChannels() {
// Call all the error handlers of all the channels to both close the channel
// and notify any observers that the channel is closed.
CloseAppChannel();
+ CloseAudioChannel();
CloseAuthChannel();
CloseClipboardChannel();
CloseCrashCollectorChannel();
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_service_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698