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

Unified Diff: components/arc/arc_bridge_bootstrap.h

Issue 2194193002: Fix ArcBridgeBootstrap race issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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 | « chrome/browser/policy/policy_browsertest.cc ('k') | components/arc/arc_bridge_bootstrap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_bootstrap.h
diff --git a/components/arc/arc_bridge_bootstrap.h b/components/arc/arc_bridge_bootstrap.h
index 25a59f88dbfe29926e0c741787b1dbade6fb4921..a5666b386913791b5b9df2de61face984b6c6d46 100644
--- a/components/arc/arc_bridge_bootstrap.h
+++ b/components/arc/arc_bridge_bootstrap.h
@@ -18,15 +18,25 @@ namespace arc {
// Starts the ARC instance and bootstraps the bridge connection.
// Clients should implement the Delegate to be notified upon communications
// being available.
+// The instance can be safely removed 1) before Start() is called, or 2) after
+// OnStopped() is called.
+// The number of instances must be at most one. Otherwise, ARC instances will
+// conflict.
+// TODO(hidehiko): This class manages more than "bootstrap" procedure now.
+// Rename this to ArcSession.
class ArcBridgeBootstrap {
public:
+ // TODO(hidehiko): Switch to Observer style, which fits more for this design.
class Delegate {
public:
// Called when the connection with ARC instance has been established.
+ // TODO(hidehiko): Moving ArcBridgeHost to the ArcBridgeBootstrapImpl
+ // so that this can be replaced by OnReady() simply.
virtual void OnConnectionEstablished(
mojom::ArcBridgeInstancePtr instance_ptr) = 0;
- // Called when ARC instance is stopped.
+ // Called when ARC instance is stopped. This is called exactly once
+ // per instance which is Start()ed.
virtual void OnStopped(ArcBridgeService::StopReason reason) = 0;
};
@@ -41,9 +51,11 @@ class ArcBridgeBootstrap {
// Starts and bootstraps a connection with the instance. The Delegate's
// OnConnectionEstablished() will be called if the bootstrapping is
// successful, or OnStopped() if it is not.
+ // Start() should not be called twice or more.
virtual void Start() = 0;
- // Stops the currently-running instance.
+ // Requests to stop the currently-running instance.
+ // The completion is notified via OnStopped() of the Delegate.
virtual void Stop() = 0;
protected:
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | components/arc/arc_bridge_bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698