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

Unified Diff: components/arc/arc_session_runner.h

Issue 2574013003: Refactor ArcSessionRunner part 1. (Closed)
Patch Set: Address comments 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 | « components/arc/arc_service_manager.cc ('k') | components/arc/arc_session_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_session_runner.h
diff --git a/components/arc/arc_bridge_service_impl.h b/components/arc/arc_session_runner.h
similarity index 71%
rename from components/arc/arc_bridge_service_impl.h
rename to components/arc/arc_session_runner.h
index c98a97f395ad18b1d876cafa58bbcaccb3c75cc0..9a459cdd8f3760bcd555cc4e03388e8af80c729a 100644
--- a/components/arc/arc_bridge_service_impl.h
+++ b/components/arc/arc_session_runner.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
-#define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
+#ifndef COMPONENTS_ARC_ARC_SESSION_RUNNER_H_
+#define COMPONENTS_ARC_ARC_SESSION_RUNNER_H_
#include <memory>
@@ -25,27 +25,27 @@ namespace arc {
class ArcSession;
-// Real IPC based ArcBridgeService that is used in production.
-class ArcBridgeServiceImpl : public ArcBridgeService,
- public ArcSessionObserver {
+// Accept requests to start/stop ARC instance. Also supports automatic
+// restarting on unexpected ARC instance crash.
+// TODO(hidehiko): Get rid of ArcBridgeService inheritance.
+class ArcSessionRunner : public ArcBridgeService, public ArcSessionObserver {
public:
// This is the factory interface to inject ArcSession instance
// for testing purpose.
using ArcSessionFactory = base::Callback<std::unique_ptr<ArcSession>()>;
- explicit ArcBridgeServiceImpl(
- const scoped_refptr<base::TaskRunner>& blocking_task_runner);
- ~ArcBridgeServiceImpl() override;
+ explicit ArcSessionRunner(scoped_refptr<base::TaskRunner> task_runner);
+
+ // For testing.
+ // TODO(hidehiko): Migrate this and above constructors.
+ explicit ArcSessionRunner(const ArcSessionFactory& factory);
+ ~ArcSessionRunner() override;
// ArcBridgeService overrides:
void RequestStart() override;
void RequestStop() override;
void OnShutdown() override;
- // Inject a factory to create ArcSession instance for testing purpose.
- // |factory| must not be null.
- void SetArcSessionFactoryForTesting(const ArcSessionFactory& factory);
-
// Returns the current ArcSession instance for testing purpose.
ArcSession* GetArcSessionForTesting() { return arc_session_.get(); }
@@ -58,9 +58,6 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
// Starts to run an ARC instance.
void StartArcSession();
- // Stops the running instance.
- void StopInstance();
-
// ArcSessionObserver:
void OnSessionReady() override;
void OnSessionStopped(StopReason reason) override;
@@ -81,11 +78,11 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
std::unique_ptr<ArcSession> arc_session_;
// WeakPtrFactory to use callbacks.
- base::WeakPtrFactory<ArcBridgeServiceImpl> weak_ptr_factory_;
+ base::WeakPtrFactory<ArcSessionRunner> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl);
+ DISALLOW_COPY_AND_ASSIGN(ArcSessionRunner);
};
} // namespace arc
-#endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_
+#endif // COMPONENTS_ARC_ARC_SESSION_RUNNER_H_
« no previous file with comments | « components/arc/arc_service_manager.cc ('k') | components/arc/arc_session_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698