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

Unified Diff: shell/child_main.cc

Issue 1061413002: Shell: Make a separate binary for child processes. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 8 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
Index: shell/child_main.cc
diff --git a/shell/child_main.cc b/shell/child_main.cc
index b3964a0c73a36658f6bfa08dc0617582311b7d1d..a420096051af9b5149696a2022ebaffedf0ae74f 100644
--- a/shell/child_main.cc
+++ b/shell/child_main.cc
@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "shell/child_main.h"
-
#include <unistd.h>
+#include "base/at_exit.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
@@ -28,7 +27,9 @@
#include "mojo/edk/embedder/simple_platform_support.h"
#include "mojo/public/cpp/system/core.h"
#include "shell/child_controller.mojom.h"
+#include "shell/init.h"
#include "shell/native_application_support.h"
+#include "shell/switches.h"
namespace mojo {
namespace shell {
@@ -276,25 +277,32 @@ class ChildControllerImpl : public ChildController, public ErrorHandler {
} // namespace
-// ChildMain -------------------------------------------------------------------
+} // namespace shell
+} // namespace mojo
+
+int main(int argc, char** argv) {
+ base::AtExitManager at_exit;
+ base::CommandLine::Init(argc, argv);
-int ChildMain() {
- DVLOG(2) << "ChildMain()";
+ mojo::shell::InitializeLogging();
- DCHECK(!base::MessageLoop::current());
+ // Make sure that we're really meant to be invoked as the child process.
+ CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kChildProcess));
DaveMoore 2015/04/07 22:27:30 this seems unnecessary. Why bother with having a s
- embedder::ScopedPlatformHandle platform_channel =
- embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
+ mojo::embedder::ScopedPlatformHandle platform_channel =
+ mojo::embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
*base::CommandLine::ForCurrentProcess());
CHECK(platform_channel.is_valid());
- AppContext app_context;
+ mojo::shell::AppContext app_context;
app_context.Init();
- Blocker blocker;
+ mojo::shell::Blocker blocker;
app_context.controller_runner()->PostTask(
FROM_HERE,
- base::Bind(&ChildControllerImpl::Init, base::Unretained(&app_context),
+ base::Bind(&mojo::shell::ChildControllerImpl::Init,
+ base::Unretained(&app_context),
base::Passed(&platform_channel), blocker.GetUnblocker()));
// This will block, then run whatever the controller wants.
blocker.Block();
@@ -303,6 +311,3 @@ int ChildMain() {
return 0;
}
-
-} // namespace shell
-} // namespace mojo
« no previous file with comments | « shell/child_main.h ('k') | shell/child_process_host.cc » ('j') | shell/desktop/main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698