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

Unified Diff: mojo/environment/scoped_chromium_init.h

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 | « mojo/environment/BUILD.gn ('k') | mojo/environment/scoped_chromium_init.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/environment/scoped_chromium_init.h
diff --git a/mojo/environment/scoped_chromium_init.h b/mojo/environment/scoped_chromium_init.h
new file mode 100644
index 0000000000000000000000000000000000000000..4908cb4bbd91ba419665776a1c70d1b1e056fd9f
--- /dev/null
+++ b/mojo/environment/scoped_chromium_init.h
@@ -0,0 +1,42 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_
+#define MOJO_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_
+
+#include "base/at_exit.h"
+#include "base/macros.h"
+
+namespace mojo {
+
+// Using code from //base typically requires that a number of things be
+// initialized/present. In particular the global |base::CommandLine| singleton
+// should be initialized and an |AtExitManager| should be present.
+//
+// This class is a simple helper that does these things (and tears down the
+// |AtExitManager| on destruction). Typically, it should be used in |MojoMain()|
+// as follows:
+//
+// MojoResult MojoMain(MojoHandle application_request) {
+// mojo::ScopedBaseInit init;
+// ...
+// }
+//
+// TODO(vtl): Maybe this should be called |ScopedBaseInit|, but for now I'm
+// being consistent with everything else that refers to things that use //base
+// as "chromium".
+class ScopedChromiumInit {
+ public:
+ ScopedChromiumInit();
+ ~ScopedChromiumInit();
+
+ private:
+ base::AtExitManager at_exit_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedChromiumInit);
+};
+
+} // namespace mojo
+
+#endif // MOJO_ENVIRONMENT_SCOPED_CHROMIUM_INIT_H_
« no previous file with comments | « mojo/environment/BUILD.gn ('k') | mojo/environment/scoped_chromium_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698