use a single binary, mozilla-runtime, for all child processes
authorChris Jones <jones.chris.g@gmail.com>
Fri, 10 Jul 2009 14:03:09 -0500
changeset 35766 96a002ef76fa09dd2f77f1ab3ab4670b184bff36
parent 35765 b5822dea95a4f7ce6d673527213dc0d1aa58dc37
child 35767 484699c5aa27bdf3fb922a722b537c71b7600961
push idunknown
push userunknown
push dateunknown
milestone1.9.2a1pre
use a single binary, mozilla-runtime, for all child processes
dom/ipc/Makefile.in
dom/ipc/TabProcessParent.cpp
dom/ipc/TabProcessParent.h
dom/ipc/app/Makefile.in
dom/ipc/app/TabApp.cpp
dom/plugins/Makefile.in
dom/plugins/PluginProcessParent.cpp
dom/plugins/PluginProcessParent.h
dom/plugins/app/Makefile.in
dom/plugins/app/PluginApp.cpp
dom/plugins/app/build.mk
ipc/Makefile.in
ipc/glue/GeckoChildProcessHost.cpp
ipc/glue/GeckoChildProcessHost.h
ipc/glue/Makefile.in
toolkit/xre/nsEmbedFunctions.cpp
xpcom/build/nsXULAppAPI.h
--- a/dom/ipc/Makefile.in
+++ b/dom/ipc/Makefile.in
@@ -13,15 +13,13 @@ EXPORT_LIBRARY = 1
 
 CPPSRCS = \
   TabParent.cpp \
   TabProcessParent.cpp \
   TabChild.cpp \
   TabThread.cpp \
   $(NULL)
 
-TOOL_DIRS = app
-
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DBIN_SUFFIX='"$(BIN_SUFFIX)"'
--- a/dom/ipc/TabProcessParent.cpp
+++ b/dom/ipc/TabProcessParent.cpp
@@ -1,57 +1,23 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: sw=4 ts=4 et : */
 
 #include "TabProcessParent.h"
 
-#include "chrome/common/chrome_switches.h"
+using mozilla::ipc::GeckoChildProcessHost;
 
 namespace mozilla {
 namespace tabs {
 
-char const *const TabProcessParent::kTabProcessName = "gecko-iframe" BIN_SUFFIX;
 
-TabProcessParent::TabProcessParent()
+TabProcessParent::TabProcessParent() :
+    GeckoChildProcessHost(GeckoChildProcess_Tab)
 {
 }
 
 TabProcessParent::~TabProcessParent()
 {
 }
 
-bool TabProcessParent::Launch()
-{
-    if (!CreateChannel())
-        return false;
-
-    FilePath exePath =
-        FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
-    exePath = exePath.DirName();
-    exePath = exePath.AppendASCII(kTabProcessName);
-
-#if defined(OS_POSIX)
-    int srcChannelFd, dstChannelFd;
-    channel().GetClientFileDescriptorMapping(&srcChannelFd, &dstChannelFd);
-    mFileMap.push_back(std::pair<int,int>(srcChannelFd, dstChannelFd));
-#endif
-
-    CommandLine cmdLine(exePath.ToWStringHack());
-    cmdLine.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
-
-    base::ProcessHandle process;
-#if defined(OS_WIN)
-    base::LaunchApp(cmdLine, false, false, &process);
-#elif defined(OS_POSIX)
-    base::LaunchApp(cmdLine.argv(), mFileMap, false, &process);
-#else
-#error Loser
-#endif
-
-    if (!process)
-        return false;
-
-    SetHandle(process);
-    return true;
-}
 
 } // namespace tabs
 } // namespace mozilla
--- a/dom/ipc/TabProcessParent.h
+++ b/dom/ipc/TabProcessParent.h
@@ -5,41 +5,34 @@
 #define mozilla_tabs_TabProcessParent_h
 
 #include "mozilla/ipc/GeckoChildProcessHost.h"
 
 namespace mozilla {
 namespace tabs {
 
 class TabProcessParent
-    : private mozilla::ipc::GeckoChildProcessHost
+    : public mozilla::ipc::GeckoChildProcessHost
 {
 public:
     TabProcessParent();
     ~TabProcessParent();
 
-    /**
-     * Asynchronously launch the plugin process.
-     */
-    bool Launch();
-
     IPC::Channel* GetChannel() {
         return channelp();
     }
 
     virtual bool CanShutdown() {
         return true;
     }
 
     base::WaitableEvent* GetShutDownEvent() {
         return GetProcessEvent();
     }
 
 private:
-    static char const *const kTabProcessName;
-
     DISALLOW_EVIL_CONSTRUCTORS(TabProcessParent);
 };
 
 }
 }
 
 #endif
deleted file mode 100644
--- a/dom/ipc/app/Makefile.in
+++ /dev/null
@@ -1,107 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Plugin App.
-#
-# The Initial Developer of the Original Code is
-#   Ben Turner <bent.mozilla@gmail.com>.
-# Portions created by the Initial Developer are Copyright (C) 2009
-# the Initial Developer. All Rights Reserved.
-#   Chris Jones <jones.chris.g@gmail.com>
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE = dom
-
-##
-## Build the child process that runs plugins
-##
-DEFINES += -DNO_NSPR_10_SUPPORT=1
-
-PROGRAM = gecko-iframe$(BIN_SUFFIX)
-
-CPPSRCS = \
-  TabApp.cpp \
-  $(NULL)
-
-LIBS += \
-  $(XPCOM_LIBS) \
-  $(NSPR_LIBS) \
-  $(NULL)
-
-# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
-# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
-NSDISTMODE = copy
-
-include $(topsrcdir)/config/config.mk
-include $(topsrcdir)/ipc/chromium/chromium-config.mk
-
-ifdef _MSC_VER
-LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
-
-# Always enter a Windows program through wmain, whether or not we're
-# a console application.
-ifdef WINCE
-WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
-else
-WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
-endif
-endif
-
-ifdef WINCE
-EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,corelibc)
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
-OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
-endif
-
-include $(topsrcdir)/config/rules.mk
-
-ifeq ($(OS_ARCH),WINNT)
-#
-# Control the default heap size.
-# This is the heap returned by GetProcessHeap().
-# As we use the CRT heap, the default size is too large and wastes VM.
-#
-# The default heap size is 1MB on Win32.
-# The heap will grow if need be.
-#
-# Set it to 256k.  See bug 127069.
-#
-ifndef GNU_CC
-LDFLAGS += /HEAP:0x40000
-endif
-endif
deleted file mode 100644
--- a/dom/ipc/app/TabApp.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Plugin App.
- *
- * The Initial Developer of the Original Code is
- *   Ben Turner <bent.mozilla@gmail.com>.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Chris Jones <jones.chris.g@gmail.com>.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsXPCOM.h"
-#include "nsXULAppAPI.h"
-
-#ifdef XP_WIN
-#include <windows.h>
-// we want a wmain entry point
-#include "nsWindowsWMain.cpp"
-#endif
-
-class ScopedLogging
-{
-public:
-    ScopedLogging() { NS_LogInit(); }
-    ~ScopedLogging() { NS_LogTerm(); }
-};
-
-int
-main(int argc, char* argv[])
-{
-    ScopedLogging log;
-    nsresult rv = XRE_InitChildProcess(argc, argv, "TabThread");
-    NS_ENSURE_SUCCESS(rv, 1);
-
-    return 0;
-}
--- a/dom/plugins/Makefile.in
+++ b/dom/plugins/Makefile.in
@@ -84,13 +84,11 @@ CPPSRCS =					\
   $(NULL)
 
 LOCAL_INCLUDES =				\
   -I$(topsrcdir)/ipc/chromium/			\
   -I$(topsrcdir)/modules/plugin/base/public/	\
   -I$(topsrcdir)/modules/plugin/base/src/	\
   $(NULL)
 
-TOOL_DIRS = app
-
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/dom/plugins/PluginProcessParent.cpp
+++ b/dom/plugins/PluginProcessParent.cpp
@@ -34,75 +34,37 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozilla/plugins/PluginProcessParent.h"
 
-#include "base/command_line.h"
-#include "base/path_service.h"
-#include "base/process_util.h"
 #include "base/string_util.h"
-#include "chrome/common/chrome_switches.h"
+
+using mozilla::ipc::GeckoChildProcessHost;
 
 namespace mozilla {
 namespace plugins {
 
 
-const char* PluginProcessParent::kPluginProcessName = "gecko-plugin"
-#ifdef OS_WIN
-                                                    ".exe"
-#endif
-                                                    ;
-
 PluginProcessParent::PluginProcessParent(const std::string& aPluginFilePath) :
+    GeckoChildProcessHost(GeckoChildProcess_Plugin),
     mPluginFilePath(aPluginFilePath)
 {
 }
 
 PluginProcessParent::~PluginProcessParent()
 {
 }
 
 bool
 PluginProcessParent::Launch()
 {
-    if (!CreateChannel()) {
-        return false;
-    }
-
-    FilePath exePath =
-        FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
-    exePath = exePath.DirName();
-    exePath = exePath.AppendASCII(kPluginProcessName);
-
-#if defined(OS_POSIX)
-    int srcChannelFd, dstChannelFd;
-    channel().GetClientFileDescriptorMapping(&srcChannelFd, &dstChannelFd);
-    mFileMap.push_back(std::pair<int,int>(srcChannelFd, dstChannelFd));
-#endif
-
-    CommandLine cmdLine(exePath.ToWStringHack());
-    cmdLine.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
-    cmdLine.AppendLooseValue(UTF8ToWide(mPluginFilePath));
-
-    base::ProcessHandle process;
-#if defined(OS_WIN)
-    base::LaunchApp(cmdLine, false, false, &process);
-#elif defined(OS_POSIX)
-    base::LaunchApp(cmdLine.argv(), mFileMap, false, &process);
-#else
-#error Bad!
-#endif
-
-    if (!process) {
-        return false;
-    }
-    SetHandle(process);
-
-    return true;
+    std::vector<std::wstring> args;
+    args.push_back(UTF8ToWide(mPluginFilePath));
+    return mozilla::ipc::GeckoChildProcessHost::Launch(args);
 }
 
 
 } // namespace plugins
 } // namespace mozilla
--- a/dom/plugins/PluginProcessParent.h
+++ b/dom/plugins/PluginProcessParent.h
@@ -78,17 +78,16 @@ public:
     }
 
     base::WaitableEvent* GetShutDownEvent()
     {
         return GetProcessEvent();
     }
 
 private:
-    static const char* kPluginProcessName;
     std::string mPluginFilePath;
 
     DISALLOW_EVIL_CONSTRUCTORS(PluginProcessParent);
 };
 
 
 } // namespace plugins
 } // namespace mozilla
deleted file mode 100644
--- a/dom/plugins/app/Makefile.in
+++ /dev/null
@@ -1,122 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is Mozilla Plugin App.
-#
-# The Initial Developer of the Original Code is
-#   Ben Turner <bent.mozilla@gmail.com>.
-# Portions created by the Initial Developer are Copyright (C) 2009
-# the Initial Developer. All Rights Reserved.
-#   Chris Jones <jones.chris.g@gmail.com>
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE = dom
-
-##
-## Build the child process that runs plugins
-##
-DEFINES += -DNO_NSPR_10_SUPPORT=1
-
-PROGRAM = gecko-plugin$(BIN_SUFFIX)
-
-REQUIRES = \
-  string \
-  xpcom \
-  xulapp \
-  widget \
-  $(NULL)
-
-CPPSRCS = \
-  PluginApp.cpp \
-  $(NULL)
-
-LIBS += \
-  $(XPCOM_LIBS) \
-  $(NSPR_LIBS) \
-  $(NULL)
-
-LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
-
-ifndef MOZ_WINCONSOLE
-ifdef MOZ_DEBUG
-MOZ_WINCONSOLE = 1
-else
-MOZ_WINCONSOLE = 0
-endif
-endif
-
-# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
-# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
-NSDISTMODE = copy
-
-include $(topsrcdir)/config/config.mk
-include $(topsrcdir)/ipc/chromium/chromium-config.mk
-
-ifdef _MSC_VER
-# Always enter a Windows program through wmain, whether or not we're
-# a console application.
-ifdef WINCE
-WIN32_EXE_LDFLAGS += -ENTRY:mainWCRTStartup
-else
-WIN32_EXE_LDFLAGS += -ENTRY:wmainCRTStartup
-endif
-endif
-
-ifdef WINCE
-EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,corelibc)
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
-OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
-endif
-
-include $(topsrcdir)/config/rules.mk
-
-ifeq ($(OS_ARCH),WINNT)
-#
-# Control the default heap size.
-# This is the heap returned by GetProcessHeap().
-# As we use the CRT heap, the default size is too large and wastes VM.
-#
-# The default heap size is 1MB on Win32.
-# The heap will grow if need be.
-#
-# Set it to 256k.  See bug 127069.
-#
-ifndef GNU_CC
-LDFLAGS += /HEAP:0x40000
-endif
-endif
deleted file mode 100644
--- a/dom/plugins/app/PluginApp.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * vim: sw=4 ts=4 et :
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Plugin App.
- *
- * The Initial Developer of the Original Code is
- *   Ben Turner <bent.mozilla@gmail.com>.
- * Portions created by the Initial Developer are Copyright (C) 2009
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Chris Jones <jones.chris.g@gmail.com>.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsXPCOM.h"
-#include "nsXULAppAPI.h"
-
-
-// FIXME/cjones testing
-#if !defined(OS_WIN)
-#include <unistd.h>
-#endif
-
-#ifdef XP_WIN
-#include <windows.h>
-// we want a wmain entry point
-#include "nsWindowsWMain.cpp"
-#endif
-
-class ScopedLogging
-{
-public:
-    ScopedLogging() { NS_LogInit(); }
-    ~ScopedLogging() { NS_LogTerm(); }
-};
-
-int
-main(int argc, char* argv[])
-{
-    ScopedLogging log;
-    nsresult rv = XRE_InitChildProcess(argc, argv, "PluginThreadChild");
-    NS_ENSURE_SUCCESS(rv, 1);
-    return 0;
-}
deleted file mode 100644
--- a/dom/plugins/app/build.mk
+++ /dev/null
@@ -1,73 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is the Mozilla build system.
-#
-# The Initial Developer of the Original Code is
-#   Chris Jones <jones.chris.g@gmail.com>
-# the Mozilla Foundation <http://www.mozilla.org/>.
-# Portions created by the Initial Developer are Copyright (C) 2006
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-TIERS += childapp
-
-tier_childapp_dirs += dom/plugins/app
-
-# installer:
-# 	@$(MAKE) -C browser/installer installer
-
-# package:
-# 	@$(MAKE) -C browser/installer
-
-# install::
-# 	@$(MAKE) -C browser/installer install
-
-# clean::
-# 	@$(MAKE) -C browser/installer clean
-
-# distclean::
-# 	@$(MAKE) -C browser/installer distclean
-
-# source-package::
-# 	@$(MAKE) -C browser/installer source-package
-
-# upload::
-# 	@$(MAKE) -C browser/installer upload
-
-# ifdef ENABLE_TESTS
-# # Implemented in testing/testsuite-targets.mk
-
-# mochitest-browser-chrome:
-# 	$(RUN_MOCHITEST) --browser-chrome
-# 	$(CHECK_TEST_ERROR)
-
-# mochitest:: mochitest-browser-chrome
-
-# .PHONY: mochitest-browser-chrome
-# endif
--- a/ipc/Makefile.in
+++ b/ipc/Makefile.in
@@ -37,10 +37,11 @@
 DEPTH = ..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS += chromium glue
+TOOL_DIRS = app
 
 include $(topsrcdir)/config/rules.mk
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -33,52 +33,59 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "GeckoChildProcessHost.h"
 
 #include "base/command_line.h"
 #include "base/path_service.h"
+#include "base/string_util.h"
 #include "chrome/common/chrome_switches.h"
 
 using mozilla::ipc::GeckoChildProcessHost;
 
-GeckoChildProcessHost::GeckoChildProcessHost(ProcessType type)
-: ChildProcessHost(type)
+GeckoChildProcessHost::GeckoChildProcessHost(GeckoChildProcessType aProcessType)
+  : ChildProcessHost(RENDER_PROCESS), // FIXME/cjones: we should own this enum
+    mProcessType(aProcessType)
 {
 }
 
 bool
-GeckoChildProcessHost::Init()
+GeckoChildProcessHost::Launch(std::vector<std::wstring> aExtraOpts)
 {
   if (!CreateChannel()) {
     return false;
   }
 
   FilePath exePath =
     FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
   exePath = exePath.DirName();
 
-#if defined(OS_WIN)
-  exePath = exePath.AppendASCII("mozilla-runtime.exe");
-  // no fd mapping necessary
-#elif defined(OS_POSIX)
-  exePath = exePath.AppendASCII("mozilla-runtime");
+  exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);
 
+  // remap the IPC socket fd to a well-known int, as the OS does for
+  // STDOUT_FILENO, for example
+#if defined(OS_POSIX)
   int srcChannelFd, dstChannelFd;
   channel().GetClientFileDescriptorMapping(&srcChannelFd, &dstChannelFd);
   mFileMap.push_back(std::pair<int,int>(srcChannelFd, dstChannelFd));
-#else
-#error Bad!
 #endif
 
   CommandLine cmdLine(exePath.ToWStringHack());
   cmdLine.AppendSwitchWithValue(switches::kProcessChannelID, channel_id());
 
+  for (std::vector<std::wstring>::iterator it = aExtraOpts.begin();
+       it != aExtraOpts.end();
+       ++it) {
+    cmdLine.AppendLooseValue((*it).c_str());
+  }
+
+  cmdLine.AppendLooseValue(UTF8ToWide(XRE_ChildProcessTypeToString(mProcessType)));
+
   base::ProcessHandle process;
 #if defined(OS_WIN)
   base::LaunchApp(cmdLine, false, false, &process);
 #elif defined(OS_POSIX)
   base::LaunchApp(cmdLine.argv(), mFileMap, false, &process);
 #else
 #error Bad!
 #endif
--- a/ipc/glue/GeckoChildProcessHost.h
+++ b/ipc/glue/GeckoChildProcessHost.h
@@ -38,33 +38,36 @@
 #define __IPC_GLUE_GECKOCHILDPROCESSHOST_H__
 
 #include "base/file_path.h"
 #include "base/process_util.h"
 #include "base/scoped_ptr.h"
 #include "base/waitable_event.h"
 #include "chrome/common/child_process_host.h"
 
+#include "nsXULAppAPI.h"        // for GeckoChildProcessType
+
 namespace mozilla {
 namespace ipc {
 
 class GeckoChildProcessHost : public ChildProcessHost
 {
 public:
-  GeckoChildProcessHost(ProcessType type=RENDER_PROCESS);
+  GeckoChildProcessHost(GeckoChildProcessType aProcessType=GeckoChildProcess_Default);
 
-  bool Init();
+  bool Launch(std::vector<std::wstring> aExtraOpts=std::vector<std::wstring>());
 
+  // FIXME/cjones: these should probably disappear
   virtual void OnMessageReceived(const IPC::Message& aMsg);
   virtual void OnChannelError();
 
   virtual bool CanShutdown() { return true; }
 
 protected:
-
+  GeckoChildProcessType mProcessType;
   FilePath mProcessPath;
 
 #if defined(OS_POSIX)
   base::file_handle_mapping_vector mFileMap;
 #endif
 
 private:
   DISALLOW_EVIL_CONSTRUCTORS(GeckoChildProcessHost);
--- a/ipc/glue/Makefile.in
+++ b/ipc/glue/Makefile.in
@@ -48,41 +48,34 @@ LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 
 EXPORTS_NAMESPACES = IPC mozilla/ipc
 
 EXPORTS_IPC =					\
   IPCMessageUtils.h 				\
   $(NULL)
 
-# FIXME/cjones: "ChromeThread" is a misnomer
 EXPORTS_mozilla/ipc =				\
   GeckoChildProcessHost.h			\
   GeckoThread.h 				\
   MessageTypes.h 				\
   ProtocolUtils.h				\
   RPCChannel.h					\
   ScopedXREEmbed.h				\
   $(NULL)
 
 ENABLE_CXX_EXCEPTIONS = 1
 
-REQUIRES += \
-  string \
-  widget \
-  xpcom \
-  xulapp \
-  $(NULL)
-
 CPPSRCS += \
   GeckoChildProcessHost.cpp \
   GeckoThread.cpp \
   MessagePump.cpp \
   RPCChannel.cpp \
   ScopedXREEmbed.cpp \
   StringUtil.cpp \
   $(NULL)
 
-#  ChromeThread.cpp \
+include $(topsrcdir)/ipc/app/defs.mk
+DEFINES += -DMOZ_CHILD_PROCESS_NAME="\"$(MOZ_CHILD_PROCESS_NAME)\""
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -185,20 +185,44 @@ XRE_TermEmbedding()
                "XRE_TermEmbedding without XRE_InitEmbedding");
 
   gDirServiceProvider->DoShutdown();
   NS_ShutdownXPCOM(nsnull);
   delete [] sCombined;
   delete gDirServiceProvider;
 }
 
+const char*
+XRE_ChildProcessTypeToString(GeckoChildProcessType aProcessType)
+{
+  return (aProcessType < GeckoChildProcess_End) ?
+    kGeckoChildProcessTypeString[aProcessType] : nsnull;
+}
+
+GeckoChildProcessType
+XRE_StringToChildProcessType(const char* aProcessTypeString)
+{
+  for (int i = 0;
+       i < (int) NS_ARRAY_LENGTH(kGeckoChildProcessTypeString);
+       ++i) {
+    const char* procString = kGeckoChildProcessTypeString[i];
+    if (!procString) {
+      return GeckoChildProcess_Invalid;
+    }
+    if (!strcmp(procString, aProcessTypeString)) {
+      return static_cast<GeckoChildProcessType>(i);
+    }
+  }
+  NS_NOTREACHED("error");
+}
+
 nsresult
 XRE_InitChildProcess(int aArgc,
                      char* aArgv[],
-                     const char* aMainThreadClass)
+                     GeckoChildProcessType aProcess)
 {
   NS_ENSURE_ARG_MIN(aArgc, 1);
   NS_ENSURE_ARG_POINTER(aArgv);
   NS_ENSURE_ARG_POINTER(aArgv[0]);
 
   if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS")) {
 #ifdef OS_POSIX
       printf("\n\nCHILDCHILDCHILDCHILD\n  debug me @%d\n\n", getpid());
@@ -210,24 +234,31 @@ XRE_InitChildProcess(int aArgc,
 
   base::AtExitManager exitManager;
   CommandLine::Init(aArgc, aArgv);
   MessageLoopForIO mainMessageLoop;
 
   {
     GeckoThread* mainThread;
 
-    if (!aMainThreadClass)
+    switch (aProcess) {
+    case GeckoChildProcess_Default:
       mainThread = new GeckoThread();
-    else if (!strcmp("PluginThreadChild", aMainThreadClass))
+      break;
+
+    case GeckoChildProcess_Plugin:
       mainThread = new PluginThreadChild();
-    else if (!strcmp("TabThread", aMainThreadClass))
+      break;
+
+    case GeckoChildProcess_Tab:
       mainThread = new TabThread();
-    else {
-        NS_RUNTIMEABORT("Unknown main thread class");
+      break;
+
+    default:
+      NS_RUNTIMEABORT("Unknown main thread class");
     }
 
     ChildProcess process(mainThread);
 
     // Do IPC event loop
     MessageLoop::current()->Run();
   }
 
@@ -325,17 +356,17 @@ XRE_InitParentProcess(int aArgc,
 
 namespace {
 
 class CreateChildProcess : public Task
 {
 public:
   virtual void Run() {
     GeckoChildProcessHost* host = new GeckoChildProcessHost();
-    if (!host->Init()) {
+    if (!host->Launch()) {
       delete host;
     }
     // ChildProcessHost deletes itself once the child process exits, on windows
     // at least...
   }
 };
 
 } /* anonymous namespace */
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -413,21 +413,44 @@ XRE_API(nsresult,
                            nsXREAppData *aAppData))
 
 /**
  * Free a nsXREAppData structure that was allocated with XRE_CreateAppData.
  */
 XRE_API(void,
         XRE_FreeAppData, (nsXREAppData *aAppData))
 
-// FIXME/cjones: this API sucks
+
+enum GeckoChildProcessType {
+  GeckoChildProcess_Default,
+
+  GeckoChildProcess_Plugin,
+  GeckoChildProcess_Tab,
+
+  GeckoChildProcess_End,
+  GeckoChildProcess_Invalid = GeckoChildProcess_End
+};
+
+static const char* const kGeckoChildProcessTypeString[] = {
+  "default",
+  "plugin",
+  "tab",
+  0
+};
+
+XRE_API(const char*,
+        XRE_ChildProcessTypeToString, (GeckoChildProcessType aProcessType))
+
+XRE_API(GeckoChildProcessType,
+        XRE_StringToChildProcessType, (const char* aProcessTypeString))
+
 XRE_API(nsresult,
         XRE_InitChildProcess, (int aArgc,
                                char* aArgv[],
-                               const char* aMainThreadClass=0))
+                               GeckoChildProcessType aProcess=GeckoChildProcess_Default))
 
 typedef void (*MainFunction)(void* aData);
 
 XRE_API(nsresult,
         XRE_InitParentProcess, (int aArgc,
                                 char* aArgv[],
                                 MainFunction aMainFunction,
                                 void* aMainFunctionExtraData))