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

Unified Diff: components/arc/arc_bridge_service_impl.h

Issue 2577373002: Refactor ArcBridgeServiceImpl part 2. (Closed)
Patch Set: 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
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 f8d589a8d740a463f3f837cde12b6022b3a2c084..9a4e5ba6d4c0680288a667432809b8cd1ea821cc 100644
--- a/components/arc/arc_bridge_service_impl.h
+++ b/components/arc/arc_bridge_service_impl.h
@@ -6,18 +6,20 @@
#define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
#include <memory>
-#include <string>
-#include <vector>
-#include "base/files/scoped_file.h"
+#include "base/callback.h"
#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"
+
+template <typename T>
+class scoped_refptr;
+
+namespace base {
+class TaskRunner;
+} // namespace base
namespace arc {
@@ -53,11 +55,6 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
void SetRestartDelayForTesting(const base::TimeDelta& restart_delay);
private:
- // If all pre-requisites are true (ARC is available, it has been enabled, and
- // the session has started), and ARC is stopped, start ARC. If ARC is running
- // and the pre-requisites stop being true, stop ARC.
- void PrerequisitesChanged();
-
// Starts to run an ARC instance.
void StartArcSession();
@@ -68,10 +65,8 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
void OnSessionReady() override;
void OnSessionStopped(StopReason reason) override;
- std::unique_ptr<ArcSession> arc_session_;
-
- // If the user's session has started.
- bool session_started_;
+ // Whether a client requests to run session or not.
+ bool running_ = false;
Luis Héctor Chávez 2016/12/16 23:20:12 nit: I'd call this |run_requested_|, because it is
hidehiko 2016/12/19 08:05:11 Wow, good suggestion. Thank you!
// 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.
@@ -81,8 +76,12 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
// Factory to inject a fake ArcSession instance for testing.
ArcSessionFactory factory_;
+ // ArcSession object for currently running ARC instance. This should be
+ // nullptr if the state is STOPPED, otherwise non-nullptr.
+ std::unique_ptr<ArcSession> arc_session_;
+
// WeakPtrFactory to use callbacks.
- base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
+ base::WeakPtrFactory<ArcBridgeServiceImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
};

Powered by Google App Engine
This is Rietveld 408576698