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_SERVICE_MANAGER_H_ | 5 #ifndef COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 6 #define COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 class SequencedTaskRunner; | 14 class SequencedTaskRunner; |
15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
16 | 16 |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace arc { | 19 namespace arc { |
20 | 20 |
21 class ArcBridgeService; | 21 class ArcBridgeService; |
| 22 class ArcInputBridge; |
22 | 23 |
23 // Manages creation and destruction of services that communicate with the ARC | 24 // Manages creation and destruction of services that communicate with the ARC |
24 // instance via the ArcBridgeService. | 25 // instance via the ArcBridgeService. |
25 class ArcServiceManager { | 26 class ArcServiceManager { |
26 public: | 27 public: |
27 ArcServiceManager( | 28 ArcServiceManager( |
28 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 29 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
29 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); | 30 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner); |
30 virtual ~ArcServiceManager(); | 31 virtual ~ArcServiceManager(); |
31 | 32 |
32 // |arc_bridge_service| can only be accessed on the thread that this | 33 // |arc_bridge_service| can only be accessed on the thread that this |
33 // class was created on. | 34 // class was created on. |
34 ArcBridgeService* arc_bridge_service(); | 35 ArcBridgeService* arc_bridge_service(); |
35 | 36 |
36 // Gets the global instance of the ARC Service Manager. This can only be | 37 // Gets the global instance of the ARC Service Manager. This can only be |
37 // called on the thread that this class was created on. | 38 // called on the thread that this class was created on. |
38 static ArcServiceManager* Get(); | 39 static ArcServiceManager* Get(); |
39 | 40 |
40 private: | 41 private: |
| 42 // The arc bridge service should be destroyed last. |
| 43 scoped_ptr<ArcBridgeService> arc_bridge_service_; |
| 44 scoped_ptr<ArcInputBridge> arc_input_bridge_; |
| 45 |
41 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; | 46 scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; |
42 scoped_ptr<ArcBridgeService> arc_bridge_service_; | |
43 | 47 |
44 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); | 48 DISALLOW_COPY_AND_ASSIGN(ArcServiceManager); |
45 }; | 49 }; |
46 | 50 |
47 } // namespace arc | 51 } // namespace arc |
48 | 52 |
49 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ | 53 #endif // COMPONENTS_ARC_ARC_SERVICE_MANAGER_H_ |
OLD | NEW |