Chromium Code Reviews| 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 68% |
| rename from components/arc/arc_bridge_service_impl.h |
| rename to components/arc/arc_session_runner.h |
| index 9a4e5ba6d4c0680288a667432809b8cd1ea821cc..572475a0d1b1325024959c2d38169d4953a04cdb 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,32 +25,32 @@ 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(); } |
| // Normally, automatic restarting happens after a short delay. When testing, |
| - // however, we'd like it to happen immediately to avoid adding unnecessary |
|
Luis Héctor Chávez
2016/12/16 23:31:00
why did you remove this? In this context, "it" ==
hidehiko
2016/12/19 08:27:03
Oh, I misinterprested the sentence. Reverted. Than
|
| + // however, we'd like to happen immediately to avoid adding unnecessary |
| // delays. |
| void SetRestartDelayForTesting(const base::TimeDelta& restart_delay); |
| @@ -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_ |