| 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 CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ | 6 #define CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 11 | 13 |
| 12 namespace service_manager { | 14 namespace service_manager { |
| 15 class Connection; |
| 13 class Connector; | 16 class Connector; |
| 14 } | 17 } |
| 15 | 18 |
| 16 namespace content { | 19 namespace content { |
| 17 | 20 |
| 18 // ServiceManagerContext manages the browser's connection to the ServiceManager, | 21 // ServiceManagerContext manages the browser's connection to the ServiceManager, |
| 19 // hosting a new in-process ServiceManagerContext if the browser was not | 22 // hosting a new in-process ServiceManagerContext if the browser was not |
| 20 // launched from an external one. | 23 // launched from an external one. |
| 21 class CONTENT_EXPORT ServiceManagerContext { | 24 class CONTENT_EXPORT ServiceManagerContext { |
| 22 public: | 25 public: |
| 23 ServiceManagerContext(); | 26 ServiceManagerContext(); |
| 24 ~ServiceManagerContext(); | 27 ~ServiceManagerContext(); |
| 25 | 28 |
| 26 // Returns a service_manager::Connector that can be used on the IO thread. | 29 // Returns a service_manager::Connector that can be used on the IO thread. |
| 27 static service_manager::Connector* GetConnectorForIOThread(); | 30 static service_manager::Connector* GetConnectorForIOThread(); |
| 28 | 31 |
| 29 private: | 32 private: |
| 30 class InProcessServiceManagerContext; | 33 class InProcessServiceManagerContext; |
| 31 | 34 |
| 32 scoped_refptr<InProcessServiceManagerContext> in_process_context_; | 35 scoped_refptr<InProcessServiceManagerContext> in_process_context_; |
| 33 | 36 |
| 37 // A connection to device service, will be set up on startup to trigger |
| 38 // creating a device service instance beforehand, as device service is |
| 39 // singletion service, later the same instance will serve all the clients |
| 40 // wanting to connect to device service. |
| 41 std::unique_ptr<service_manager::Connection> device_connection_; |
| 42 |
| 34 DISALLOW_COPY_AND_ASSIGN(ServiceManagerContext); | 43 DISALLOW_COPY_AND_ASSIGN(ServiceManagerContext); |
| 35 }; | 44 }; |
| 36 | 45 |
| 37 } // namespace content | 46 } // namespace content |
| 38 | 47 |
| 39 #endif // CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ | 48 #endif // CONTENT_BROWSER_SERVICE_MANAGER_SERVICE_MANAGER_CONTEXT_H_ |
| OLD | NEW |