| Index: mojo/public/cpp/application/run_application.h
|
| diff --git a/mojo/public/cpp/application/run_application.h b/mojo/public/cpp/application/run_application.h
|
| index 98f0ef18fab3797fc5f5528704ead34162b44305..5bfbbd57f2cde6299567585c0a36dd0ad8053aae 100644
|
| --- a/mojo/public/cpp/application/run_application.h
|
| +++ b/mojo/public/cpp/application/run_application.h
|
| @@ -13,15 +13,15 @@ namespace mojo {
|
| class ApplicationImplBase;
|
|
|
| // Sets up a message (run) loop and runs the provided application
|
| -// implementation.
|
| +// implementation. The return value will be the one provided to
|
| +// |TerminateApplication()|.
|
| //
|
| // Typical use (where |MyApplicationImpl| is an implementation of
|
| // |ApplicationImplBase|):
|
| //
|
| // MojoResult MojoMain(MojoHandle application_request_handle) {
|
| // MyApplicationImpl my_app;
|
| -// mojo::RunApplication(application_request_handle, &my_app);
|
| -// return MOJO_RESULT_OK;
|
| +// return mojo::RunApplication(application_request_handle, &my_app);
|
| // }
|
| //
|
| // Note that this may actually be used on any thread (that is not already
|
| @@ -30,23 +30,21 @@ class ApplicationImplBase;
|
| // |*application_impl| must remain alive until the message loop starts running
|
| // (thus it may own itself).
|
| //
|
| -// TODO(vtl): Possibly this should return a |MojoResult| and
|
| -// |TerminateApplication()| should take a |MojoResult| argument (which this
|
| -// returns), but to communicate that value requires TLS.
|
| // TODO(vtl): Maybe this should be like |Environment|, with different possible
|
| // implementations (e.g., "standalone" vs "chromium"). However,
|
| // |ApplicationRunnerChromium| currently has additional goop specific to the
|
| -// main thread. Probably we should have additional "MainRunApplication()" and
|
| -// "MainTerminateApplication()" functions.
|
| -void RunApplication(MojoHandle application_request_handle,
|
| - ApplicationImplBase* application_impl);
|
| +// main thread. Probably we should have additional "RunMainApplication()" and
|
| +// "TerminateMainApplication()" functions.
|
| +MojoResult RunApplication(MojoHandle application_request_handle,
|
| + ApplicationImplBase* application_impl);
|
|
|
| // Terminates the currently-running application. This may only be called from
|
| // "inside" |RunApplication()| (i.e., it is on the stack, which means that the
|
| // message loop is running). This will cause |RunApplication()| to return "soon"
|
| -// (assuming the message loop is not blocked processing some task). This may
|
| -// cause queued work to *not* be executed.
|
| -void TerminateApplication();
|
| +// (assuming the message loop is not blocked processing some task), with return
|
| +// value |result|. This may cause queued work to *not* be executed. This should
|
| +// be executed at most once (per |RunApplication()|).
|
| +void TerminateApplication(MojoResult result);
|
|
|
| } // namespace mojo
|
|
|
|
|