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

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: Moved race avoidance boilerplate to ArcBridgeService 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
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index cbb8bde97c2481248725325287e778c39ccdde9d..94b71d193dc099af04d1ab6e271f93042f6ab0d3 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) {

Powered by Google App Engine
This is Rietveld 408576698