mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-10 17:10:55 +01:00
macOS: Support crash reporting from unbundled apps (issue #1532)
This commit is contained in:
parent
da2209a6d8
commit
3561b8dfdb
@ -108,6 +108,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,24 +59,26 @@ 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);
|
||||
|
||||
// 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,
|
||||
// the helper should always have a --type switch.
|
||||
//
|
||||
// This check is done this late so there is already a call to
|
||||
// base::mac::IsBackgroundOnlyProcess(), so there is no change in
|
||||
// startup/initialization order.
|
||||
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,
|
||||
// the helper should always have a --type switch.
|
||||
//
|
||||
// This check is done this late so there is already a call to
|
||||
// base::mac::IsBackgroundOnlyProcess(), so there is no change in
|
||||
// startup/initialization order.
|
||||
|
||||
// The helper's Info.plist marks it as a background only app.
|
||||
if (base::mac::IsBackgroundOnlyProcess()) {
|
||||
CHECK(command_line.HasSwitch(switches::kProcessType) &&
|
||||
!process_type.empty())
|
||||
<< "Helper application requires --type.";
|
||||
} else {
|
||||
CHECK(!command_line.HasSwitch(switches::kProcessType) &&
|
||||
process_type.empty())
|
||||
<< "Main application forbids --type, saw " << process_type;
|
||||
// The helper's Info.plist marks it as a background only app.
|
||||
if (base::mac::IsBackgroundOnlyProcess()) {
|
||||
CHECK(command_line.HasSwitch(switches::kProcessType) &&
|
||||
!process_type.empty())
|
||||
<< "Helper application requires --type.";
|
||||
} else {
|
||||
CHECK(!command_line.HasSwitch(switches::kProcessType) &&
|
||||
process_type.empty())
|
||||
<< "Main application forbids --type, saw " << process_type;
|
||||
}
|
||||
}
|
||||
|
||||
g_crash_reporting_enabled = true;
|
||||
|
@ -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…
x
Reference in New Issue
Block a user