OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ | 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ |
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ | 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 void set_message_loop_type(base::MessageLoop::Type type); | 37 void set_message_loop_type(base::MessageLoop::Type type); |
38 | 38 |
39 // Once the various parameters have been set above, use Run to initialize an | 39 // Once the various parameters have been set above, use Run to initialize an |
40 // ServiceContext wired to the provided delegate, and run a MessageLoop until | 40 // ServiceContext wired to the provided delegate, and run a MessageLoop until |
41 // the service exits. | 41 // the service exits. |
42 // | 42 // |
43 // Iff |init_base| is true, the runner will perform some initialization of | 43 // Iff |init_base| is true, the runner will perform some initialization of |
44 // base globals (e.g. CommandLine and AtExitManager) before starting the | 44 // base globals (e.g. CommandLine and AtExitManager) before starting the |
45 // service. | 45 // service. |
46 MojoResult Run(MojoHandle shell_handle, bool init_base); | 46 MojoResult Run(MojoHandle service_manager_handle, bool init_base); |
47 | 47 |
48 // Calls Run above with |init_base| set to |true|. | 48 // Calls Run above with |init_base| set to |true|. |
49 MojoResult Run(MojoHandle shell_handle); | 49 MojoResult Run(MojoHandle service_manager_handle); |
50 | 50 |
51 // Allows the caller to shut down the connection with the Service Manager. | 51 // Allows the caller to shut down the connection with the Service Manager. |
52 // After the Service Manager notices the pipe has closed, it will no longer | 52 // After the Service Manager notices the pipe has closed, it will no longer |
53 // track an instance of this service, though this service may continue to run | 53 // track an instance of this service, though this service may continue to run |
54 // and handle requests from others. | 54 // and handle requests from others. |
55 void DestroyServiceContext(); | 55 void DestroyServiceContext(); |
56 | 56 |
57 // Allows the caller to explicitly quit the service. Must be called from | 57 // Allows the caller to explicitly quit the service. Must be called from |
58 // the thread which created the ServiceRunner. | 58 // the thread which created the ServiceRunner. |
59 void Quit(); | 59 void Quit(); |
60 | 60 |
61 private: | 61 private: |
62 std::unique_ptr<Service> service_; | 62 std::unique_ptr<Service> service_; |
63 | 63 |
64 // MessageLoop type. Default is TYPE_DEFAULT. | 64 // MessageLoop type. Default is TYPE_DEFAULT. |
65 base::MessageLoop::Type message_loop_type_; | 65 base::MessageLoop::Type message_loop_type_; |
66 // Whether Run() has been called. | 66 // Whether Run() has been called. |
67 bool has_run_; | 67 bool has_run_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(ServiceRunner); | 69 DISALLOW_COPY_AND_ASSIGN(ServiceRunner); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace service_manager | 72 } // namespace service_manager |
73 | 73 |
74 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ | 74 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_RUNNER_H_ |
OLD | NEW |