diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 00:51:02 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 00:51:02 +0000 |
commit | 961306dca553f6e7b5262e384317a73351a77985 (patch) | |
tree | dbba7e1e9d1774eaf03c5254bbeb71a42c914fda /chrome | |
parent | d04d10a3b93b428d5e4fe636be4ab6ffd94424d9 (diff) | |
download | chromium_src-961306dca553f6e7b5262e384317a73351a77985.zip chromium_src-961306dca553f6e7b5262e384317a73351a77985.tar.gz chromium_src-961306dca553f6e7b5262e384317a73351a77985.tar.bz2 |
Back out r22981, it may have caused Windows test failures.
Review URL: http://codereview.chromium.org/164298
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/app-Info.plist | 2 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 9 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 24 | ||||
-rw-r--r-- | chrome/browser/utility_process_host.cc | 7 | ||||
-rw-r--r-- | chrome/browser/worker_host/worker_process_host.cc | 4 | ||||
-rw-r--r-- | chrome/chrome.gyp | 137 | ||||
-rw-r--r-- | chrome/common/child_process_host.cc | 65 | ||||
-rw-r--r-- | chrome/common/child_process_host.h | 7 |
8 files changed, 69 insertions, 186 deletions
diff --git a/chrome/app/app-Info.plist b/chrome/app/app-Info.plist index 3a8e686..51594c3 100644 --- a/chrome/app/app-Info.plist +++ b/chrome/app/app-Info.plist @@ -190,6 +190,8 @@ <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/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 9a81b94..3c5f169 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -335,10 +335,11 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, // build command line for plugin, we have to quote the plugin's path to deal // with spaces. - std::wstring exe_path = GetChildPath(); - if (exe_path.empty()) { + 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)) return false; - } CommandLine cmd_line(exe_path); if (logging::DialogsAreSuppressed()) @@ -367,8 +368,6 @@ 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 07b7c7e..0fc5e05 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -47,7 +47,6 @@ #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" @@ -202,6 +201,16 @@ 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), @@ -298,12 +307,15 @@ bool BrowserRenderProcessHost::Init() { // Build command line for renderer, we have to quote the executable name to // deal with spaces. - std::wstring renderer_path = ChildProcessHost::GetChildPath(); + std::wstring renderer_path = + browser_command_line.GetSwitchValue(switches::kBrowserSubprocessPath); if (renderer_path.empty()) { - // Need to reset the channel we created above or others might think the - // connection is live. - channel_.reset(); - return false; + if (!GetRendererPath(&renderer_path)) { + // 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 c06749d..149d296 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -52,7 +52,12 @@ bool UtilityProcessHost::StartWebResourceUnpacker(const std::string& data) { } std::wstring UtilityProcessHost::GetUtilityProcessCmd() { - return GetChildPath(); + std::wstring exe_path = CommandLine::ForCurrentProcess()->GetSwitchValue( + switches::kBrowserSubprocessPath); + if (exe_path.empty()) { + PathService::Get(base::FILE_EXE, &exe_path); + } + return exe_path; } 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 16cbada..e1e7829 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 = GetChildPath(); - if (exe_path.empty()) + std::wstring exe_path; + if (!PathService::Get(base::FILE_EXE, &exe_path)) return false; CommandLine cmd_line(exe_path); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index b98860f..ab3333d 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -65,18 +65,7 @@ '../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', @@ -3022,6 +3011,9 @@ '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/', @@ -3033,6 +3025,9 @@ ], }, { # 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/', @@ -3085,12 +3080,8 @@ 'CHROMIUM_BUNDLE_ID': '<(bundle_id)', 'CHROMIUM_SHORT_NAME': '<(branding)', }, - 'mac_bundle_resources': [ - '<(PRODUCT_DIR)/<(mac_product_name) Helper.app', - ], + # Bring in pdfsqueeze and run it on all pdfs 'dependencies': [ - 'helper_app', - # Bring in pdfsqueeze and run it on all pdfs '../build/temp_gyp/pdfsqueeze.gyp:pdfsqueeze', 'interpose_dependency_shim', ], @@ -3113,23 +3104,6 @@ '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': [ @@ -3147,6 +3121,34 @@ }], ], }], + ['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 +4398,7 @@ # app bundle, the only dependent of this target. # TODO(mark): Fix. 'mac_bundle_resources/': [ - ['exclude', '.*'], + ['exclude', ''], ], 'direct_dependent_settings': { 'mac_bundle_resources': [ @@ -4475,71 +4477,6 @@ ['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 ca0f972..b7cab7f 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -4,17 +4,13 @@ #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" @@ -69,67 +65,6 @@ 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 95b97b6..926bdd2 100644 --- a/chrome/common/child_process_host.h +++ b/chrome/common/child_process_host.h @@ -22,13 +22,6 @@ 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); |