refactor: use process_util.h helpers (#38574)

refactor: use process_util.h helpers
This commit is contained in:
Milan Burda 2023-06-06 10:19:13 +02:00 committed by GitHub
parent 8d689c565a
commit bb2ba35b51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 41 deletions

View file

@ -28,6 +28,7 @@
#include "shell/common/gin_converters/time_converter.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "shell/common/process_util.h"
#include "shell/common/thread_restrictions.h"
#if !IS_MAS_BUILD()
@ -142,17 +143,13 @@ void Start(const std::string& submit_url,
ElectronCrashReporterClient::Get()->SetShouldRateLimit(rate_limit);
ElectronCrashReporterClient::Get()->SetShouldCompressUploads(compress);
ElectronCrashReporterClient::Get()->SetGlobalAnnotations(global_extra);
auto* command_line = base::CommandLine::ForCurrentProcess();
std::string process_type =
is_node_process
? "node"
: command_line->GetSwitchValueASCII(::switches::kProcessType);
std::string process_type = is_node_process ? "node" : GetProcessType();
#if BUILDFLAG(IS_LINUX)
for (const auto& pair : extra)
electron::crash_keys::SetCrashKey(pair.first, pair.second);
{
electron::ScopedAllowBlockingForElectron allow_blocking;
::crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
::crash_reporter::InitializeCrashpad(IsBrowserProcess(), process_type);
}
if (ignore_system_crash_handler) {
crashpad::CrashpadInfo::GetCrashpadInfo()
@ -161,7 +158,7 @@ void Start(const std::string& submit_url,
#elif BUILDFLAG(IS_MAC)
for (const auto& pair : extra)
electron::crash_keys::SetCrashKey(pair.first, pair.second);
::crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
::crash_reporter::InitializeCrashpad(IsBrowserProcess(), process_type);
if (ignore_system_crash_handler) {
crashpad::CrashpadInfo::GetCrashpadInfo()
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
@ -172,8 +169,8 @@ void Start(const std::string& submit_url,
base::FilePath user_data_dir;
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
::crash_reporter::InitializeCrashpadWithEmbeddedHandler(
process_type.empty(), process_type,
base::WideToUTF8(user_data_dir.value()), base::FilePath());
IsBrowserProcess(), process_type, base::WideToUTF8(user_data_dir.value()),
base::FilePath());
#endif
#endif
}