| Index: components/arc/arc_bridge_service.h
|
| diff --git a/components/arc/arc_bridge_service.h b/components/arc/arc_bridge_service.h
|
| index 3d719694314ee0219463b873144255e23136cbde..b6b9322348f6d8285488062f1986feab95edcee2 100644
|
| --- a/components/arc/arc_bridge_service.h
|
| +++ b/components/arc/arc_bridge_service.h
|
| @@ -21,8 +21,6 @@ class CommandLine;
|
|
|
| namespace arc {
|
|
|
| -class ArcBridgeBootstrap;
|
| -
|
| // The Chrome-side service that handles ARC instances and ARC bridge creation.
|
| // This service handles the lifetime of ARC instances and sets up the
|
| // communication channel (the ARC bridge) used to send and receive messages.
|
| @@ -63,14 +61,32 @@ class ArcBridgeService : public mojom::ArcBridgeHost {
|
| STOPPING,
|
| };
|
|
|
| + // Describes the reason the bridge is stopped.
|
| + enum class StopReason {
|
| + // ARC instance has been gracefully shut down.
|
| + SHUTDOWN,
|
| +
|
| + // Errors occurred during the ARC instance boot. This includes any failures
|
| + // before the instance is actually attempted to be started, and also
|
| + // failures on bootstrapping IPC channels with Android.
|
| + GENERIC_BOOT_FAILURE,
|
| +
|
| + // ARC instance has crashed.
|
| + CRASH,
|
| + };
|
| +
|
| // Notifies life cycle events of ArcBridgeService.
|
| class Observer {
|
| public:
|
| // Called whenever the state of the bridge has changed.
|
| // TODO(lchavez): Rename to OnStateChangedForTest
|
| virtual void OnStateChanged(State state) {}
|
| +
|
| + // Called whenever the bridge is ready.
|
| virtual void OnBridgeReady() {}
|
| - virtual void OnBridgeStopped() {}
|
| +
|
| + // Called whenever the bridge is stopped.
|
| + virtual void OnBridgeStopped(StopReason reason) {}
|
|
|
| // Called whenever ARC's availability has changed for this system.
|
| virtual void OnAvailableChanged(bool available) {}
|
| @@ -298,6 +314,11 @@ class ArcBridgeService : public mojom::ArcBridgeHost {
|
| // Changes the current availability and notifies all observers.
|
| void SetAvailable(bool availability);
|
|
|
| + // Sets the reason the bridge is stopped. This function must be always called
|
| + // before SetState(State::STOPPED) to report a correct reason with
|
| + // Observer::OnBridgeStopped().
|
| + void SetStopReason(StopReason stop_reason);
|
| +
|
| base::ObserverList<Observer>& observer_list() { return observer_list_; }
|
|
|
| bool CalledOnValidThread();
|
| @@ -311,6 +332,7 @@ class ArcBridgeService : public mojom::ArcBridgeHost {
|
| FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Prerequisites);
|
| FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, ShutdownMidStartup);
|
| FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart);
|
| + FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, OnBridgeStopped);
|
|
|
| // Called when one of the individual channels is closed.
|
| void CloseAppChannel();
|
| @@ -411,6 +433,9 @@ class ArcBridgeService : public mojom::ArcBridgeHost {
|
| // The current state of the bridge.
|
| ArcBridgeService::State state_;
|
|
|
| + // The reason the bridge is stopped.
|
| + StopReason stop_reason_;
|
| +
|
| // WeakPtrFactory to use callbacks.
|
| base::WeakPtrFactory<ArcBridgeService> weak_factory_;
|
|
|
|
|