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

Unified Diff: shell/child_main.cc

Issue 1055463004: Replace ChildProcess/AppChildProcess with a simple ChildMain(). (Closed) Base URL: https://github.com/domokit/mojo.git@simplify_child_6-x-simplify_child_5
Patch Set: rebased Created 5 years, 9 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 | « shell/child_main.h ('k') | shell/child_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/child_main.cc
diff --git a/shell/app_child_process.cc b/shell/child_main.cc
similarity index 94%
rename from shell/app_child_process.cc
rename to shell/child_main.cc
index f01409f1026de2cbf2f7f595b1e038144cbb0f85..b3964a0c73a36658f6bfa08dc0617582311b7d1d 100644
--- a/shell/app_child_process.cc
+++ b/shell/child_main.cc
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "shell/app_child_process.h"
+#include "shell/child_main.h"
#include <unistd.h>
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
@@ -21,7 +22,9 @@
#include "base/threading/thread_checker.h"
#include "mojo/common/message_pump_mojo.h"
#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/process_delegate.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
#include "mojo/edk/embedder/simple_platform_support.h"
#include "mojo/public/cpp/system/core.h"
#include "shell/child_controller.mojom.h"
@@ -273,19 +276,18 @@ class ChildControllerImpl : public ChildController, public ErrorHandler {
} // namespace
-// AppChildProcess -------------------------------------------------------------
+// ChildMain -------------------------------------------------------------------
-AppChildProcess::AppChildProcess() {
-}
-
-AppChildProcess::~AppChildProcess() {
-}
-
-void AppChildProcess::Main() {
- DVLOG(2) << "AppChildProcess::Main()";
+int ChildMain() {
+ DVLOG(2) << "ChildMain()";
DCHECK(!base::MessageLoop::current());
+ embedder::ScopedPlatformHandle platform_channel =
+ embedder::PlatformChannelPair::PassClientHandleFromParentProcess(
+ *base::CommandLine::ForCurrentProcess());
+ CHECK(platform_channel.is_valid());
+
AppContext app_context;
app_context.Init();
@@ -293,11 +295,13 @@ void AppChildProcess::Main() {
app_context.controller_runner()->PostTask(
FROM_HERE,
base::Bind(&ChildControllerImpl::Init, base::Unretained(&app_context),
- base::Passed(platform_channel()), blocker.GetUnblocker()));
+ base::Passed(&platform_channel), blocker.GetUnblocker()));
// This will block, then run whatever the controller wants.
blocker.Block();
app_context.Shutdown();
+
+ return 0;
}
} // namespace shell
« no previous file with comments | « shell/child_main.h ('k') | shell/child_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698