summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild/mac/dump_app_syms79
-rwxr-xr-xbuild/mac/tweak_app_infoplist67
-rw-r--r--chrome/app/app-Info.plist2
-rw-r--r--chrome/app/helper-Info.plist28
-rwxr-xr-xchrome/app/make_mac_app_symlinks18
-rw-r--r--chrome/browser/plugin_process_host.cc9
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc24
-rw-r--r--chrome/browser/utility_process_host.cc7
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc4
-rw-r--r--chrome/chrome.gyp137
-rw-r--r--chrome/common/child_process_host.cc65
-rw-r--r--chrome/common/child_process_host.h7
12 files changed, 331 insertions, 116 deletions
diff --git a/build/mac/dump_app_syms b/build/mac/dump_app_syms
index cd6e626..130b5a0 100755
--- a/build/mac/dump_app_syms
+++ b/build/mac/dump_app_syms
@@ -1,9 +1,26 @@
-#!/bin/sh
+#!/bin/bash
# Copyright (c) 2009 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.
+# This script expects the following environment variables to be set. Xcode
+# normally sets them:
+#
+# CONFIGURATION - Release or Debug; this script only operates when Release.
+# SRCROOT - /path/to/chrome/src/chrome
+# BUILT_PRODUTS_DIR - /path/to/chrome/src/xcodebuild/Release
+#
+# The script also takes a single argument defining the branding type.
+#
+# To test this script without running an entire build:
+#
+# cd /path/to/chrome/src/chrome
+# CONFIGURATION=Release \
+# SRCROOT=$(pwd) \
+# BUILT_PRODUCTS_DIR=$(pwd)/../xcodebuild/Release \
+# ../build/mac/dump_app_syms Chromium
+
# Make sure we got the header to write into passed to us
if [ $# -ne 1 ]; then
echo "error: missing branding as an argument" >&2
@@ -25,37 +42,43 @@ SRC_APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
. "${TOP}/chrome/VERSION"
BREAKPAD_DUMP_SYMS="${BUILT_PRODUCTS_DIR}/dump_syms"
-BREAKPAD_PRODUCT_ID="${BUILD_BRANDING}_Mac"
FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
-SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.app"
-# Created by the build/mac/strip_from_xcode script.
-UNSTRIPPED_APP="${SRC_APP_PATH}.dSYM/Contents/Resources/DWARF/${SRC_APP_NAME}"
-APP_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}-${FULL_VERSION}-i386.breakpad"
-
-# Only run dump_syms if the file has changed since we last did a dump.
-if [ "${UNSTRIPPED_APP}" -nt "${APP_SYMBOL_FILE}" ] ; then
- "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${APP_SYMBOL_FILE}"
-fi
-APP_DSYM_NAME="${SRC_APP_NAME}.app.dSYM"
+ARCH="i386"
-# Do the same thing for chrome_dll.
+DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.dSYM.tar.bz2"
-SRC_DYLIB_NAME="${SRC_APP_NAME} Framework"
-SRC_DYLIB_PATH="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}.framework"
-UNSTRIPPED_DYLIB="${SRC_DYLIB_PATH}.dSYM/Contents/Resources/DWARF/${SRC_DYLIB_NAME}"
-DYLIB_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}-${FULL_VERSION}-i386.breakpad"
-if [ "${UNSTRIPPED_DYLIB}" -nt "${DYLIB_SYMBOL_FILE}" ] ; then
- "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_DYLIB}" > "${DYLIB_SYMBOL_FILE}"
-fi
-DYLIB_DSYM_NAME="${SRC_DYLIB_NAME}.framework.dSYM"
+declare -a DSYMS
+
+for SRC_BUNDLE in "${SRC_APP_NAME}.app" \
+ "${SRC_APP_NAME} Framework.framework" \
+ "${SRC_APP_NAME} Helper.app" ; do
+ SRC_STEM=$(echo "${SRC_BUNDLE}" | sed -Ee 's/^(.*)\..*$/\1/')
+ SRC_BUNDLE_PATH="${BUILT_PRODUCTS_DIR}/${SRC_BUNDLE}"
+ DSYM_NAME="${SRC_BUNDLE}.dSYM"
+ DSYM_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}"
+ DWARF_PATH="${DSYM_PATH}/Contents/Resources/DWARF/${SRC_STEM}"
+ BPAD_SYM_NAME="${SRC_STEM}-${FULL_VERSION}-${ARCH}.breakpad"
+ BPAD_SYM_PATH="${BUILT_PRODUCTS_DIR}/${BPAD_SYM_NAME}"
+
+ # Only run dump_syms if the file has changed since the last dump.
+ if [ "${DWARF_PATH}" -nt "${BPAD_SYM_PATH}" ] ; then
+ "${BREAKPAD_DUMP_SYMS}" -a "${ARCH}" "${DWARF_PATH}" > "${BPAD_SYM_PATH}"
+ fi
+
+ # Remove the .dSYM archive if the file has changed since the archive was
+ # last generated. This will cause a new .dSYM archive to be created.
+ if [ "${DWARF_PATH}" -nt "${DSYM_TAR_PATH}" ] ; then
+ rm -f "${DSYM_TAR_PATH}"
+ fi
-DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}.tar.bz2"
+ # Push the .dSYM bundle onto the DSYMS array so that it will be included in
+ # the .dSYM archive if a new one is needed
+ DSYMS[${#DSYMS[@]}]="${DSYM_NAME}"
+done
-# Make a .tar.bz2 out of the .dSYM
-if [ "${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ||
- [ "${BUILT_PRODUCTS_DIR}/${DYLIB_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ; then
- # Change directory so when building the tar, we don't include the build dir
- # in the tar paths.
+# Create the archive of .dSYM bundles.
+if [ ! -e "${DSYM_TAR_PATH}" ] ; then
+ # Change directory so that absolute paths aren't included in the archive.
(cd "${BUILT_PRODUCTS_DIR}" &&
- tar -jcf "${DSYM_TAR_PATH}" "${APP_DSYM_NAME}" "${DYLIB_DSYM_NAME}")
+ tar --owner 0 --group 0 -jcf "${DSYM_TAR_PATH}" "${DSYMS[@]}")
fi
diff --git a/build/mac/tweak_app_infoplist b/build/mac/tweak_app_infoplist
index 845fc7e..120c3c8 100755
--- a/build/mac/tweak_app_infoplist
+++ b/build/mac/tweak_app_infoplist
@@ -9,8 +9,9 @@ set -e
# Pull off the optional args
USE_BREAKPAD=0
USE_KEYSTONE=0
+USE_SVN=1
OPTERR=0
-while getopts ":b:k:" an_opt ; do
+while getopts ":b:k:s:" an_opt ; do
case $an_opt in
b)
USE_BREAKPAD=$OPTARG
@@ -18,6 +19,9 @@ while getopts ":b:k:" an_opt ; do
k)
USE_KEYSTONE=$OPTARG
;;
+ s)
+ USE_SVN=$OPTARG
+ ;;
\?)
echo "Unknown option $OPTARG"
exit 1
@@ -34,7 +38,7 @@ while getopts ":b:k:" an_opt ; do
done
shift $(($OPTIND - 1))
-# Make sure we got the header to write into passed to us
+# Make sure the branding argument was supplied.
if [ $# -ne 1 ]; then
echo "error: missing branding as an argument" >&2
exit 1
@@ -45,7 +49,7 @@ fi
# because:
#
# 1. Xcode wants to do the Info.plist work before it runs any build phases,
-# this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER
+# this means if we were to generate a .h file for INFOPLIST_PREFIX_HEADER
# we'd have to put it in another target so it runs in time.
# 2. Xcode also doesn't check to see if the header being used as a prefix for
# the Info.plist has changed. So even if we updated it, it's only looking
@@ -63,23 +67,37 @@ BRAND_SCRIPT="${TOP}/build/branding_value.sh"
set -x
APP_NAME=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" PRODUCT_FULLNAME)
-SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${APP_NAME}.app"
-
-# Visible in the about:version page.
-SVN_REVISION=$(svn info "${SRCROOT}" | grep "Revision:" | cut -d" " -f2-)
-if [ -z "${SVN_REVISION}" ] ; then
- echo "Could not determine svn revision. This may be OK." >&2
- # TODO: check for git, and get the version number from it?
+SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}"
+
+if [ "${USE_SVN}" = "1" ] ; then
+ # Visible in the about:version page.
+ SVN_INFO=$(svn info "${TOP}")
+ SVN_REVISION=$(echo "${SVN_INFO}" | sed -Ene 's/^Revision: (.*)$/\1/p')
+ if [ -z "${SVN_REVISION}" ] ; then
+ echo "Could not determine svn revision. This may be OK." >&2
+ # TODO: check for git, and get the version number from it?
+ fi
+
+ # Grab the path to the source root in the Subversion repository by taking the
+ # URL to the source root directory and the repository root, and removing the
+ # latter from the former. This ensures that SVN_PATH will contain a useful
+ # path regardless of the Subversion server, mirror, and authentication scheme
+ # in use.
+ SVN_URL=$(echo "${SVN_INFO}" | sed -Ene 's/^URL: (.*)$/\1/p')
+ SVN_ROOT=$(echo "${SVN_INFO}" | sed -Ene 's/^Repository Root: (.*)$/\1/p')
+ if [ -n "${SVN_ROOT}" ] && \
+ [ "${SVN_URL:0:${#SVN_ROOT}}" = "${SVN_ROOT}" ] ; then
+ SVN_PATH="${SVN_URL:${#SVN_ROOT}}"
+ fi
fi
-# Pull in the chrome version number
+# Pull in the Chrome version number.
. "${TOP}/chrome/VERSION"
FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
-SHORT_VERSION="${MAJOR}.${MINOR}.${BUILD}"
-# Fetch the copyright
+# Fetch the copyright.
COPYRIGHT_STRING=$("${BRAND_SCRIPT}" "${BUILD_BRANDING}" COPYRIGHT)
-# Map (c) or (C) to the copyright sign
+# Map (c) or (C) to the copyright symbol.
COPYRIGHT_STRING=$(echo "${COPYRIGHT_STRING}" | sed -e $'s/([cC])/\302\251/g')
# Build the full copyright string
@@ -92,17 +110,25 @@ TMP_INFO_PLIST_DEFAULTS="${TEMP_DIR}/Info"
TMP_INFO_PLIST="${TMP_INFO_PLIST_DEFAULTS}.plist"
cp "${SRC_APP_PATH}/${INFO_PLIST_PATH}" "${TMP_INFO_PLIST}"
-# Save off the svn version number in case we need it
+# Save off the Subversion revision number and source root path in case they're
+# needed.
if [ ! -z "${SVN_REVISION}" ] ; then
defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
- SVNRevision -string "${SVN_REVISION}"
+ SVNRevision -string "${SVN_REVISION}"
+else
+ defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNRevision || true
+fi
+if [ ! -z "${SVN_PATH}" ] ; then
+ defaults write "${TMP_INFO_PLIST_DEFAULTS}" SVNPath -string "${SVN_PATH}"
+else
+ defaults delete "${TMP_INFO_PLIST_DEFAULTS}" SVNPath || true
fi
# Add public version info so "Get Info" works
defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
CFBundleGetInfoString -string "${LONG_COPYRIGHT}"
defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
- CFBundleShortVersionString -string "${SHORT_VERSION}"
+ CFBundleShortVersionString -string "${FULL_VERSION}"
# Honor the 429496.72.95 limit. The maximum comes from splitting 2^32 - 1 into
# 6, 2, 2 digits. The limitation was present in Tiger, but it could have been
# fixed in later OS release, but hasn't been tested (it's easy enough to find
@@ -115,7 +141,7 @@ defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
NSHumanReadableCopyright -string "${COPYRIGHT_STRING}"
-# Add/Remove the breakpad keys
+# Add or remove the Breakpad keys.
if [ "${USE_BREAKPAD}" = "1" ] ; then
defaults write "${TMP_INFO_PLIST_DEFAULTS}" \
BreakpadURL "https://clients2.google.com/cr/report"
@@ -139,7 +165,7 @@ else
defaults delete "${TMP_INFO_PLIST_DEFAULTS}" BreakpadSkipConfirm || true
fi
-# Add/Remove keystone keys (only supported in release builds)
+# Add or remove the Keystone keys (only supported in release builds).
if [ "${USE_KEYSTONE}" = "1" ] && [ "${CONFIGURATION}" = "Release" ] ; then
KEYSTONE_URL="https://tools.google.com/service/update2"
KEYSTONE_APP_ID=$(defaults read "${TMP_INFO_PLIST_DEFAULTS}" \
@@ -160,3 +186,6 @@ fi
# might have done.
plutil -convert xml1 "${TMP_INFO_PLIST}"
cp "${TMP_INFO_PLIST}" "${SRC_APP_PATH}/${INFO_PLIST_PATH}"
+
+# Clean up.
+rm -f "${TMP_INFO_PLIST}"
diff --git a/chrome/app/app-Info.plist b/chrome/app/app-Info.plist
index 51594c3..3a8e686 100644
--- a/chrome/app/app-Info.plist
+++ b/chrome/app/app-Info.plist
@@ -190,8 +190,6 @@
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
- <key>LSUIElement</key>
- <string>1</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
diff --git a/chrome/app/helper-Info.plist b/chrome/app/helper-Info.plist
new file mode 100644
index 0000000..9aeacff
--- /dev/null
+++ b/chrome/app/helper-Info.plist
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${CHROMIUM_BUNDLE_ID}.helper</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${CHROMIUM_SHORT_NAME} Helper</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>0.1</string>
+ <key>LSFileQuarantineEnabled</key>
+ <true/>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.5.0</string>
+ <key>LSUIElement</key>
+ <string>1</string>
+</dict>
+</plist>
diff --git a/chrome/app/make_mac_app_symlinks b/chrome/app/make_mac_app_symlinks
new file mode 100755
index 0000000..5f3c040
--- /dev/null
+++ b/chrome/app/make_mac_app_symlinks
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Copyright (c) 2009 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.
+
+# This script is intended to run from a "postbuild" action from within Xcode.
+# It sets up symbolic links for an app bundle's Resources and Frameworks
+# directories. This is intended to be used for app bundles that live within
+# the Resources directory of a larger app bundle, when the sub-app's
+# Resources and Frameworks directories should point to the enclosing app's.
+
+set -e
+
+CONTENTS_PATH="${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/Contents"
+
+ln -fhs ../.. "${CONTENTS_PATH}/Resources"
+ln -fhs ../../../Frameworks "${CONTENTS_PATH}/Frameworks"
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);
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index f1d5200..122c1e5 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -65,7 +65,18 @@
'../views/controls/label_unittest.cc',
'../views/controls/table/table_view_unittest.cc',
'../views/grid_layout_unittest.cc',
- ]
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'bundle_id': 'com.google.Chrome',
+ }, { # else: branding!="Chrome"
+ 'bundle_id': 'org.chromium.Chromium',
+ }], # branding
+ ], # conditions
+ }], # OS=="mac"
+ ], # conditions
},
'includes': [
'../build/common.gypi',
@@ -3009,9 +3020,6 @@
'conditions': [
['branding=="Chrome"', {
'mac_bundle_resources': ['app/theme/google_chrome/app.icns'],
- 'variables': {
- 'bundle_id': 'com.google.Chrome',
- },
'copies': [
{
'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/MacOS/',
@@ -3023,9 +3031,6 @@
],
}, { # else: 'branding!="Chrome"
'mac_bundle_resources': ['app/theme/chromium/app.icns'],
- 'variables': {
- 'bundle_id': 'org.chromium.Chromium',
- },
'copies': [
{
'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/MacOS/',
@@ -3078,8 +3083,12 @@
'CHROMIUM_BUNDLE_ID': '<(bundle_id)',
'CHROMIUM_SHORT_NAME': '<(branding)',
},
- # Bring in pdfsqueeze and run it on all pdfs
+ 'mac_bundle_resources': [
+ '<(PRODUCT_DIR)/<(mac_product_name) Helper.app',
+ ],
'dependencies': [
+ 'helper_app',
+ # Bring in pdfsqueeze and run it on all pdfs
'../build/temp_gyp/pdfsqueeze.gyp:pdfsqueeze',
'interpose_dependency_shim',
],
@@ -3102,6 +3111,23 @@
'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Frameworks',
'files': ['<(PRODUCT_DIR)/<(mac_product_name) Framework.framework'],
},
+ {
+ # Copy web inspector resources to the Contents/Resources folder.
+ 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Resources',
+ 'files': ['<(PRODUCT_DIR)/resources/inspector/'],
+ },
+ ],
+ 'postbuilds': [
+ {
+ # Modify the Info.plist as needed. The script explains why this
+ # is needed. This is also done in the helper_app target.
+ 'postbuild_name': 'Tweak Info.plist',
+ 'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
+ '-b<(mac_breakpad)',
+ '-k<(mac_keystone)',
+ '-s1', # Include Subversion information
+ '<(branding)'],
+ },
],
}, { # else: OS != "mac"
'conditions': [
@@ -3119,34 +3145,6 @@
}],
],
}],
- ['OS=="mac"', {
- 'actions': [
- {
- # Mac adds an action to modify the Info.plist to meet our needs
- # (see the script for why this is done).
- 'action_name': 'tweak_app_infoplist',
- # We don't list any inputs or outputs because we always want
- # the script to run. Why? Because it does thinks like record
- # the svn revision into the info.plist, so there is no file to
- # depend on that will change when ever that changes.
- 'inputs': [],
- 'outputs': [],
- 'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
- '-b<(mac_breakpad)',
- '-k<(mac_keystone)',
- '<(branding)'],
- },
- ],
- }],
- ['OS=="mac"', {
- # Copy web inspector resources to the Contents/Resources folder.
- 'copies': [
- {
- 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Resources',
- 'files': ['<(PRODUCT_DIR)/resources/inspector/'],
- },
- ],
- }],
['OS=="linux"', {
'conditions': [
['branding=="Chrome"', {
@@ -4396,7 +4394,7 @@
# app bundle, the only dependent of this target.
# TODO(mark): Fix.
'mac_bundle_resources/': [
- ['exclude', ''],
+ ['exclude', '.*'],
],
'direct_dependent_settings': {
'mac_bundle_resources': [
@@ -4475,6 +4473,71 @@
['OS=="mac"',
{ 'targets': [
{
+ 'target_name': 'helper_app',
+ 'type': 'executable',
+ 'product_name': '<(mac_product_name) Helper',
+ 'mac_bundle': 1,
+ 'dependencies': [
+ 'chrome_dll',
+ ],
+ 'sources': [
+ # chrome_exe_main.mm's main() is the entry point for the "chrome"
+ # (browser app) target. All it does is jump to chrome_dll's
+ # ChromeMain. This is appropriate for helper processes too,
+ # because the logic to discriminate between process types at run
+ # time is actually directed by the --type command line argument
+ # processed by ChromeMain. Sharing chrome_exe_main.mm with the
+ # browser app will suffice for now.
+ 'app/chrome_exe_main.mm',
+ 'app/helper-Info.plist',
+ ],
+ # TODO(mark): Come up with a fancier way to do this. It should only
+ # be necessary to list app-Info.plist once, not the three times it is
+ # listed here.
+ 'mac_bundle_resources!': [
+ 'app/helper-Info.plist',
+ ],
+ # TODO(mark): For now, don't put any resources into this app. Its
+ # resources directory will be a symbolic link to the browser app's
+ # resources directory.
+ 'mac_bundle_resources/': [
+ ['exclude', '.*'],
+ ],
+ 'xcode_settings': {
+ 'CHROMIUM_BUNDLE_ID': '<(bundle_id)',
+ 'CHROMIUM_SHORT_NAME': '<(branding)',
+ 'INFOPLIST_FILE': 'app/helper-Info.plist',
+ },
+ 'postbuilds': [
+ {
+ 'postbuild_name': 'Make Symbolic Links',
+ 'action': ['app/make_mac_app_symlinks'],
+ },
+ {
+ # Modify the Info.plist as needed. The script explains why this
+ # is needed. This is also done in the chrome target. In
+ # this case, -k0 is always used because Keystone never runs
+ # within the helper app. -s0 is used to avoid placing Subversion
+ # data in the helper app's Info.plist. It will be present in
+ # the main app's Info.plist, which is sufficient.
+ 'postbuild_name': 'Tweak Info.plist',
+ 'action': ['<(DEPTH)/build/mac/tweak_app_infoplist',
+ '-b<(mac_breakpad)',
+ '-k0',
+ '-s0',
+ '<(branding)'],
+ },
+ ],
+ 'conditions': [
+ ['mac_breakpad==1', {
+ 'variables': {
+ # A real .dSYM is needed for dump_syms to operate on.
+ 'mac_real_dsym': 1,
+ },
+ }],
+ ],
+ },
+ {
# Convenience target to build a disk image.
'target_name': 'build_app_dmg',
# Don't place this in the 'all' list; most won't want it.
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index b7cab7f..ca0f972 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -4,13 +4,17 @@
#include "chrome/common/child_process_host.h"
+#include "base/command_line.h"
#include "base/compiler_specific.h"
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/path_service.h"
#include "base/process_util.h"
#include "base/singleton.h"
#include "base/waitable_event.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/plugin_messages.h"
@@ -65,6 +69,67 @@ ChildProcessHost::~ChildProcessHost() {
ProcessWatcher::EnsureProcessTerminated(handle());
}
+// static
+std::wstring ChildProcessHost::GetChildPath() {
+ std::wstring child_path = CommandLine::ForCurrentProcess()->GetSwitchValue(
+ switches::kBrowserSubprocessPath);
+ if (!child_path.empty())
+ return child_path;
+
+#if !defined(OS_MACOSX)
+ // On most platforms, the child executable is the same as the current
+ // executable.
+ PathService::Get(base::FILE_EXE, &child_path);
+ return child_path;
+#else
+ // On the Mac, the child executable lives at a predefined location within
+ // the current app bundle.
+
+ FilePath path;
+ if (!PathService::Get(base::FILE_EXE, &path))
+ return child_path;
+
+ // Figure out the current executable name. In a browser, this will be
+ // "Chromium" or "Google Chrome". The child name will be the browser
+ // executable name with " Helper" appended. The child app bundle name will
+ // be that name with ".app" appended.
+ FilePath::StringType child_exe_name = path.BaseName().value();
+ const FilePath::StringType child_suffix = FILE_PATH_LITERAL(" Helper");
+
+ if (child_exe_name.size() > child_suffix.size()) {
+ size_t test_suffix_pos = child_exe_name.size() - child_suffix.size();
+ const FilePath::CharType* test_suffix =
+ child_exe_name.c_str() + test_suffix_pos;
+ if (strcmp(test_suffix, child_suffix.c_str()) == 0) {
+ // FILE_EXE already ends with the child suffix and therefore already
+ // refers to the child process path. Just return it.
+ return path.ToWStringHack();
+ }
+ }
+
+ child_exe_name.append(child_suffix);
+ FilePath::StringType child_app_name = child_exe_name;
+ child_app_name.append(FILE_PATH_LITERAL(".app"));
+ // The renderer app bundle lives in the browser app bundle's Resources
+ // directory. Take off the executable name.
+ path = path.DirName();
+
+ // Take off the MacOS component, after verifying that's what's there.
+ FilePath::StringType macos = path.BaseName().value();
+ DCHECK_EQ(macos, FILE_PATH_LITERAL("MacOS"));
+ path = path.DirName();
+
+ // Append the components to get to the sub-app bundle's executable.
+ path = path.Append(FILE_PATH_LITERAL("Resources"));
+ path = path.Append(child_app_name);
+ path = path.Append(FILE_PATH_LITERAL("Contents"));
+ path = path.Append(FILE_PATH_LITERAL("MacOS"));
+ path = path.Append(child_exe_name);
+
+ return path.ToWStringHack();
+#endif // OS_MACOSX
+}
+
bool ChildProcessHost::CreateChannel() {
channel_id_ = GenerateRandomChannelID(this);
channel_.reset(new IPC::Channel(
diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h
index 926bdd2..95b97b6 100644
--- a/chrome/common/child_process_host.h
+++ b/chrome/common/child_process_host.h
@@ -22,6 +22,13 @@ class ChildProcessHost : public ResourceDispatcherHost::Receiver,
public:
virtual ~ChildProcessHost();
+ // Returns the pathname to be used for a child process. If a subprocess
+ // pathname was specified on the command line, that will be used. Otherwise,
+ // the default child process pathname will be returned. On most platforms,
+ // this will be the same as the currently-executing process. On failure,
+ // returns an empty wstring.
+ static std::wstring GetChildPath();
+
// ResourceDispatcherHost::Receiver implementation:
virtual bool Send(IPC::Message* msg);