| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 5 #ifndef COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
| 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 6 #define COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); | 30 explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap); |
| 31 ~ArcBridgeServiceImpl() override; | 31 ~ArcBridgeServiceImpl() override; |
| 32 | 32 |
| 33 void SetDetectedAvailability(bool available) override; | 33 void SetDetectedAvailability(bool available) override; |
| 34 | 34 |
| 35 void HandleStartup() override; | 35 void HandleStartup() override; |
| 36 | 36 |
| 37 void Shutdown() override; | 37 void Shutdown() override; |
| 38 | 38 |
| 39 // Normally, reconnecting after connection shutdown happens after a short |
| 40 // delay. When testing, however, we'd like it to happen immediately to avoid |
| 41 // adding unnecessary delays. |
| 42 void DisableReconnectDelayForTesting(); |
| 43 |
| 39 private: | 44 private: |
| 40 friend class ArcBridgeTest; | 45 friend class ArcBridgeTest; |
| 41 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); | 46 FRIEND_TEST_ALL_PREFIXES(ArcBridgeTest, Restart); |
| 42 | 47 |
| 43 // If all pre-requisites are true (ARC is available, it has been enabled, and | 48 // If all pre-requisites are true (ARC is available, it has been enabled, and |
| 44 // the session has started), and ARC is stopped, start ARC. If ARC is running | 49 // the session has started), and ARC is stopped, start ARC. If ARC is running |
| 45 // and the pre-requisites stop being true, stop ARC. | 50 // and the pre-requisites stop being true, stop ARC. |
| 46 void PrerequisitesChanged(); | 51 void PrerequisitesChanged(); |
| 47 | 52 |
| 48 // Stops the running instance. | 53 // Stops the running instance. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 mojo::Binding<mojom::ArcBridgeHost> binding_; | 67 mojo::Binding<mojom::ArcBridgeHost> binding_; |
| 63 mojom::ArcBridgeInstancePtr instance_ptr_; | 68 mojom::ArcBridgeInstancePtr instance_ptr_; |
| 64 | 69 |
| 65 // If the user's session has started. | 70 // If the user's session has started. |
| 66 bool session_started_; | 71 bool session_started_; |
| 67 | 72 |
| 68 // If the instance had already been started but the connection to it was | 73 // If the instance had already been started but the connection to it was |
| 69 // lost. This should make the instance restart. | 74 // lost. This should make the instance restart. |
| 70 bool reconnect_ = false; | 75 bool reconnect_ = false; |
| 71 | 76 |
| 77 // Delay the reconnection. |
| 78 bool use_delay_before_reconnecting_ = true; |
| 79 |
| 72 // WeakPtrFactory to use callbacks. | 80 // WeakPtrFactory to use callbacks. |
| 73 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; | 81 base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_; |
| 74 | 82 |
| 75 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); | 83 DISALLOW_COPY_AND_ASSIGN(ArcBridgeServiceImpl); |
| 76 }; | 84 }; |
| 77 | 85 |
| 78 } // namespace arc | 86 } // namespace arc |
| 79 | 87 |
| 80 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ | 88 #endif // COMPONENTS_ARC_ARC_BRIDGE_SERVICE_IMPL_H_ |
| OLD | NEW |