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

Unified Diff: services/native_support/main.cc

Issue 2011383002: Get rid of {Run,Terminate}MainApplication(), and more ApplicationDelegate conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/nacl/sfi/content_handler_main.cc ('k') | services/native_viewport/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/native_support/main.cc
diff --git a/services/native_support/main.cc b/services/native_support/main.cc
index e174a3126fa72b3a2b7dc39e5ffb06d9b63781b5..f2deec69c9e91afc0fdb6d337e505d99ac229cf5 100644
--- a/services/native_support/main.cc
+++ b/services/native_support/main.cc
@@ -7,6 +7,7 @@
#include "base/message_loop/message_loop.h"
#include "base/threading/sequenced_worker_pool.h"
#include "mojo/application/run_application_options_chromium.h"
+#include "mojo/environment/scoped_chromium_init.h"
#include "mojo/public/c/system/main.h"
#include "mojo/public/cpp/application/application_impl_base.h"
#include "mojo/public/cpp/application/run_application.h"
@@ -23,9 +24,8 @@ class NativeSupportApp : public mojo::ApplicationImplBase {
public:
NativeSupportApp() {}
~NativeSupportApp() override {
- // TODO(vtl): Doing this here is a bit of a hack, but we may not
- // consistently call |OnQuit()|.
- OnQuit();
+ if (worker_pool_)
+ worker_pool_->Shutdown();
}
private:
@@ -44,13 +44,6 @@ class NativeSupportApp : public mojo::ApplicationImplBase {
return true;
}
- void OnQuit() override {
- if (worker_pool_) {
- worker_pool_->Shutdown();
- worker_pool_ = nullptr;
- }
- }
-
scoped_refptr<base::SequencedWorkerPool> worker_pool_;
DISALLOW_COPY_AND_ASSIGN(NativeSupportApp);
@@ -59,9 +52,10 @@ class NativeSupportApp : public mojo::ApplicationImplBase {
} // namespace native_support
MojoResult MojoMain(MojoHandle application_request) {
+ mojo::ScopedChromiumInit init;
native_support::NativeSupportApp native_support_app;
// We need an I/O message loop, since we'll want to watch FDs.
mojo::RunApplicationOptionsChromium options(base::MessageLoop::TYPE_IO);
- return mojo::RunMainApplication(application_request, &native_support_app,
- &options);
+ return mojo::RunApplication(application_request, &native_support_app,
+ &options);
}
« no previous file with comments | « services/nacl/sfi/content_handler_main.cc ('k') | services/native_viewport/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698