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

Unified Diff: components/arc/arc_bridge_service_impl.h

Issue 2582003002: Refactor ArcBridgeServiceImpl part 1. (Closed)
Patch Set: Fix the latest bug. Created 4 years 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 | « no previous file | components/arc/arc_bridge_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service_impl.h
diff --git a/components/arc/arc_bridge_service_impl.h b/components/arc/arc_bridge_service_impl.h
index 62df0b25a40d3d9e31fb3188729211c9a51c1320..f8d589a8d740a463f3f837cde12b6022b3a2c084 100644
--- a/components/arc/arc_bridge_service_impl.h
+++ b/components/arc/arc_bridge_service_impl.h
@@ -13,6 +13,8 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/task_runner.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
#include "components/arc/arc_bridge_service.h"
#include "components/arc/arc_session_observer.h"
#include "mojo/public/cpp/bindings/binding.h"
@@ -45,10 +47,10 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
// Returns the current ArcSession instance for testing purpose.
ArcSession* GetArcSessionForTesting() { return arc_session_.get(); }
- // Normally, reconnecting after connection shutdown happens after a short
- // delay. When testing, however, we'd like it to happen immediately to avoid
- // adding unnecessary delays.
- void DisableReconnectDelayForTesting();
+ // Normally, automatic restarting happens after a short delay. When testing,
+ // however, we'd like it to happen immediately to avoid adding unnecessary
+ // delays.
+ void SetRestartDelayForTesting(const base::TimeDelta& restart_delay);
private:
// If all pre-requisites are true (ARC is available, it has been enabled, and
@@ -56,6 +58,9 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
// and the pre-requisites stop being true, stop ARC.
void PrerequisitesChanged();
+ // Starts to run an ARC instance.
+ void StartArcSession();
+
// Stops the running instance.
void StopInstance();
@@ -68,12 +73,10 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
// If the user's session has started.
bool session_started_;
- // If the instance had already been started but the connection to it was
- // lost. This should make the instance restart.
- bool reconnect_ = false;
-
- // Delay the reconnection.
- bool use_delay_before_reconnecting_ = true;
+ // Instead of immediately trying to restart the container, give it some time
+ // to finish tearing down in case it is still in the process of stopping.
+ base::TimeDelta restart_delay_;
+ base::OneShotTimer restart_timer_;
// Factory to inject a fake ArcSession instance for testing.
ArcSessionFactory factory_;
« no previous file with comments | « no previous file | components/arc/arc_bridge_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698