From 49220ebc9c99524a640625e21d83e0c04c392d54 Mon Sep 17 00:00:00 2001
From: "mark@chromium.org"
 <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Tue, 11 Aug 2009 03:12:01 +0000
Subject: Re-commit r22981 after backout at r22992.  Contains fixes to relocate
 plugin_carbon_interpose.dylib from the outer browser app bundle to the inner
 helper app bundle.

Provide a separate app bundle for subprocesses like the renderer on the Mac.
Remove LSUIElement and related hacks from the browser's app bundle.

BUG=8044
TEST=Observe one Chromium and one or more Chromium Helper processes in
     Activity Monitor
Review URL: http://codereview.chromium.org/164177
Review URL: http://codereview.chromium.org/164303

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23006 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/plugin_process_host.cc              |  9 ++++----
 .../renderer_host/browser_render_process_host.cc   | 24 ++++++----------------
 chrome/browser/utility_process_host.cc             |  7 +------
 chrome/browser/worker_host/worker_process_host.cc  |  4 ++--
 4 files changed, 14 insertions(+), 30 deletions(-)

(limited to 'chrome/browser')

diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 3c5f169..9a81b94 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -335,11 +335,10 @@ bool PluginProcessHost::Init(const WebPluginInfo& info,
 
   // build command line for plugin, we have to quote the plugin's path to deal
   // with spaces.
-  const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
-  std::wstring exe_path =
-      browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
-  if (exe_path.empty() && !PathService::Get(base::FILE_EXE, &exe_path))
+  std::wstring exe_path = GetChildPath();
+  if (exe_path.empty()) {
     return false;
+  }
 
   CommandLine cmd_line(exe_path);
   if (logging::DialogsAreSuppressed())
@@ -368,6 +367,8 @@ bool PluginProcessHost::Init(const WebPluginInfo& info,
     switches::kEnableStatsTable,
   };
 
+  const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
+
   for (size_t i = 0; i < arraysize(switch_names); ++i) {
     if (browser_command_line.HasSwitch(switch_names[i])) {
       cmd_line.AppendSwitchWithValue(
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 0fc5e05..07b7c7e 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -47,6 +47,7 @@
 #include "chrome/browser/visitedlink_master.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/child_process_info.h"
+#include "chrome/common/child_process_host.h"
 #include "chrome/common/chrome_descriptors.h"
 #include "chrome/common/logging_chrome.h"
 #include "chrome/common/notification_service.h"
@@ -201,16 +202,6 @@ class VisitedLinkUpdater {
   VisitedLinkCommon::Fingerprints pending_;
 };
 
-
-// Used for a View_ID where the renderer has not been attached yet
-const int32 kInvalidViewID = -1;
-
-// Get the path to the renderer executable, which is the same as the
-// current executable.
-bool GetRendererPath(std::wstring* cmd_line) {
-  return PathService::Get(base::FILE_EXE, cmd_line);
-}
-
 BrowserRenderProcessHost::BrowserRenderProcessHost(Profile* profile)
     : RenderProcessHost(profile),
       visible_widgets_(0),
@@ -307,15 +298,12 @@ bool BrowserRenderProcessHost::Init() {
 
   // Build command line for renderer, we have to quote the executable name to
   // deal with spaces.
-  std::wstring renderer_path =
-      browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath);
+  std::wstring renderer_path = ChildProcessHost::GetChildPath();
   if (renderer_path.empty()) {
-    if (!GetRendererPath(&renderer_path)) {
-      // Need to reset the channel we created above or others might think the
-      // connection is live.
-      channel_.reset();
-      return false;
-    }
+    // Need to reset the channel we created above or others might think the
+    // connection is live.
+    channel_.reset();
+    return false;
   }
   CommandLine cmd_line(renderer_path);
   if (logging::DialogsAreSuppressed())
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index 149d296..c06749d 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -52,12 +52,7 @@ bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) {
 }
 
 std::wstring UtilityProcessHost::GetUtilityProcessCmd() {
-  std::wstring exe_path = CommandLine::ForCurrentProcess()->GetSwitchValue(
-      switches::kBrowserSubprocessPath);
-  if (exe_path.empty()) {
-    PathService::Get(base::FILE_EXE, &exe_path);
-  }
-  return exe_path;
+  return GetChildPath();
 }
 
 bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index e1e7829..16cbada 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -88,8 +88,8 @@ bool WorkerProcessHost::Init() {
   if (!CreateChannel())
     return false;
 
-  std::wstring exe_path;
-  if (!PathService::Get(base::FILE_EXE, &exe_path))
+  std::wstring exe_path = GetChildPath();
+  if (exe_path.empty())
     return false;
 
   CommandLine cmd_line(exe_path);
-- 
cgit v1.1