macOS: Support crash reporting from unbundled apps (issue #1532)
This commit is contained in:
parent
dda50912ed
commit
a56ac9782e
|
@ -96,6 +96,9 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
|||
}),
|
||||
argv.end());
|
||||
|
||||
// HandlerMain expects the first argument to be the program name.
|
||||
argv.insert(argv.begin(), command_line.GetProgram().value());
|
||||
|
||||
std::unique_ptr<char* []> argv_as_utf8(new char*[argv.size() + 1]);
|
||||
std::vector<std::string> storage;
|
||||
storage.reserve(argv.size());
|
||||
|
|
|
@ -59,6 +59,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
|
|||
// framework dylib is even loaded, to catch potential early crashes.
|
||||
crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
|
||||
|
||||
if (base::mac::AmIBundled()) {
|
||||
// Mac Chrome is packaged with a main app bundle and a helper app bundle.
|
||||
// The main app bundle should only be used for the browser process, so it
|
||||
// should never see a --type switch (switches::kProcessType). Likewise,
|
||||
|
@ -78,6 +79,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
|
|||
process_type.empty())
|
||||
<< "Main application forbids --type, saw " << process_type;
|
||||
}
|
||||
}
|
||||
|
||||
g_crash_reporting_enabled = true;
|
||||
#else // !defined(OS_MACOSX)
|
||||
|
|
|
@ -91,16 +91,16 @@ void OverrideFrameworkBundlePath() {
|
|||
}
|
||||
|
||||
void OverrideChildProcessPath() {
|
||||
// ChildProcessHost::GetChildPath() requires either kBrowserSubprocessPath or
|
||||
// CHILD_PROCESS_EXE but not both.
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kBrowserSubprocessPath)) {
|
||||
return;
|
||||
base::FilePath child_process_path =
|
||||
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||
switches::kBrowserSubprocessPath);
|
||||
|
||||
if (child_process_path.empty()) {
|
||||
child_process_path = util_mac::GetChildProcessPath();
|
||||
DCHECK(!child_process_path.empty());
|
||||
}
|
||||
|
||||
base::FilePath child_process_path = util_mac::GetChildProcessPath();
|
||||
DCHECK(!child_process_path.empty());
|
||||
|
||||
// Used by ChildProcessHost::GetChildPath and PlatformCrashpadInitialization.
|
||||
PathService::Override(content::CHILD_PROCESS_EXE, child_process_path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue