Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1123)

Side by Side Diff: services/shell/public/cpp/service_runner.h

Issue 2192263002: MojoMain() -> ServiceMain() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_ 6 #define SERVICES_SHELL_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"
11 #include "mojo/public/cpp/system/core.h" 11 #include "mojo/public/cpp/system/core.h"
12 12
13 namespace shell { 13 namespace shell {
14 14
15 class Service; 15 class Service;
16 class ServiceContext; 16 class ServiceContext;
17 17
18 // A utility for running a chromium based mojo Service. The typical use 18 // A utility for running a Service that uses //base. The typical use case is to
19 // case is to use when writing your MojoMain: 19 // use from your ServiceMain:
20 // 20 //
21 // MojoResult MojoMain(MojoHandle shell_handle) { 21 // MojoResult ServiceMain(MojoHandle service_request_handle) {
22 // shell::ServiceRunner runner(new MyService); 22 // shell::ServiceRunner runner(new MyService);
23 // return runner.Run(shell_handle); 23 // return runner.Run(service_request_handle);
24 // } 24 // }
25 // 25 //
26 // ServiceRunner takes care of chromium environment initialization and 26 // ServiceRunner takes care of chromium environment initialization and
27 // shutdown, and starting a MessageLoop from which your service can run and 27 // shutdown, and starting a base::MessageLoop from which your service can run
28 // ultimately Quit(). 28 // and ultimately Quit().
29 class ServiceRunner { 29 class ServiceRunner {
30 public: 30 public:
31 // Takes ownership of |service|. 31 // Takes ownership of |service|.
32 explicit ServiceRunner(Service* service); 32 explicit ServiceRunner(Service* service);
33 ~ServiceRunner(); 33 ~ServiceRunner();
34 34
35 static void InitBaseCommandLine(); 35 static void InitBaseCommandLine();
36 36
37 void set_message_loop_type(base::MessageLoop::Type type); 37 void set_message_loop_type(base::MessageLoop::Type type);
38 38
(...skipping 27 matching lines...) Expand all
66 base::MessageLoop::Type message_loop_type_; 66 base::MessageLoop::Type message_loop_type_;
67 // Whether Run() has been called. 67 // Whether Run() has been called.
68 bool has_run_; 68 bool has_run_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(ServiceRunner); 70 DISALLOW_COPY_AND_ASSIGN(ServiceRunner);
71 }; 71 };
72 72
73 } // namespace shell 73 } // namespace shell
74 74
75 #endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_ 75 #endif // SERVICES_SHELL_PUBLIC_CPP_SERVICE_RUNNER_H_
OLDNEW
« no previous file with comments | « services/shell/public/cpp/service_context.h ('k') | services/shell/runner/host/native_application_support.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698