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

Unified Diff: components/arc/arc_bridge_service.cc

Issue 1596663002: arc-bridge: Introduce the ArcService class (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased + protected ArcService direct instantiation Created 4 years, 11 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/BUILD.gn ('k') | components/arc/arc_service.h » ('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 d3448c515faef55fe3c529c321f4c617c05a62b2..844f5c88232fcff21e719015f51cfb3a93fd49d1 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -49,6 +49,30 @@ bool ArcBridgeService::GetEnabled(const base::CommandLine* command_line) {
void ArcBridgeService::AddObserver(Observer* observer) {
DCHECK(CalledOnValidThread());
observer_list_.AddObserver(observer);
+
+ // If any of the instances were ready before the call to AddObserver(), the
+ // |observer| won't get any readiness events. For such cases, we have to call
+ // them explicitly now to avoid a race.
+ if (app_instance())
+ observer->OnAppInstanceReady();
+ if (auth_instance())
+ observer->OnAuthInstanceReady();
+ if (clipboard_instance())
+ observer->OnClipboardInstanceReady();
+ if (ime_instance())
+ observer->OnImeInstanceReady();
+ if (input_instance())
+ observer->OnInputInstanceReady();
+ if (notifications_instance())
+ observer->OnNotificationsInstanceReady();
+ if (power_instance())
+ observer->OnPowerInstanceReady();
+ if (process_instance())
+ observer->OnProcessInstanceReady();
+ if (settings_instance())
+ observer->OnSettingsInstanceReady();
+ if (video_instance())
+ observer->OnVideoInstanceReady();
}
void ArcBridgeService::RemoveObserver(Observer* observer) {
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/arc_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698