From 4f57b97ec62fb774f3c3608060a8771616bcc912 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 29 Oct 2020 10:26:43 -0700 Subject: [PATCH] conditionally access CommandLine because crashpad doesn't initialize one. https://chromium-review.googlesource.com/c/chromium/src/+/2490880 --- patches/chromium/.patches | 1 - .../crashpad-initialize-logging.patch | 55 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 76880a212dc49..e6b4cb3a8aa34 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -110,5 +110,4 @@ cherry-pick-30261f9de11e.patch cherry-pick-88f263f401b4.patch cherry-pick-229fdaf8fc05.patch cherry-pick-1ed869ad4bb3.patch -rename_the_v8_context_snapshot_on_arm64_macos_builds.patch crashpad-initialize-logging.patch diff --git a/patches/chromium/crashpad-initialize-logging.patch b/patches/chromium/crashpad-initialize-logging.patch index f33d212d02eec..61b399dc61479 100644 --- a/patches/chromium/crashpad-initialize-logging.patch +++ b/patches/chromium/crashpad-initialize-logging.patch @@ -15,6 +15,61 @@ Change-Id: I0f9004f7de94dd29d555cc7d23c48a63da6b4bba Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2425108 Reviewed-by: Mark Mentovai +diff --git a/base/logging.cc b/base/logging.cc +index b5cf2c4933d0cbb89f2f1b410c5c249a0b8647f0..698dca03914934b294457d05d89722a27cdebb56 100644 +--- a/base/logging.cc ++++ b/base/logging.cc +@@ -369,21 +369,23 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) { + g_log_format = settings.log_format; + #endif + +- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); +- // Don't bother initializing |g_vlog_info| unless we use one of the +- // vlog switches. +- if (command_line->HasSwitch(switches::kV) || +- command_line->HasSwitch(switches::kVModule)) { +- // NOTE: If |g_vlog_info| has already been initialized, it might be in use +- // by another thread. Don't delete the old VLogInfo, just create a second +- // one. We keep track of both to avoid memory leak warnings. +- CHECK(!g_vlog_info_prev); +- g_vlog_info_prev = g_vlog_info; +- +- g_vlog_info = +- new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), +- command_line->GetSwitchValueASCII(switches::kVModule), +- &g_min_log_level); ++ if (base::CommandLine::InitializedForCurrentProcess()) { ++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); ++ // Don't bother initializing |g_vlog_info| unless we use one of the ++ // vlog switches. ++ if (command_line->HasSwitch(switches::kV) || ++ command_line->HasSwitch(switches::kVModule)) { ++ // NOTE: If |g_vlog_info| has already been initialized, it might be in use ++ // by another thread. Don't delete the old VLogInfo, just create a second ++ // one. We keep track of both to avoid memory leak warnings. ++ CHECK(!g_vlog_info_prev); ++ g_vlog_info_prev = g_vlog_info; ++ ++ g_vlog_info = ++ new VlogInfo(command_line->GetSwitchValueASCII(switches::kV), ++ command_line->GetSwitchValueASCII(switches::kVModule), ++ &g_min_log_level); ++ } + } + + g_logging_destination = settings.logging_dest; +@@ -394,7 +396,10 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) { + config.min_severity = FX_LOG_INFO; + config.console_fd = -1; + config.log_service_channel = ZX_HANDLE_INVALID; +- std::string log_tag = command_line->GetProgram().BaseName().AsUTF8Unsafe(); ++ std::string log_tag = base::CommandLine::ForCurrentProcess() ++ ->GetProgram() ++ .BaseName() ++ .AsUTF8Unsafe(); + const char* log_tag_data = log_tag.data(); + config.tags = &log_tag_data; + config.num_tags = 1; diff --git a/third_party/crashpad/crashpad/DEPS b/third_party/crashpad/crashpad/DEPS index 83995e0cdea91522c272415330c57af764d23163..7e83327aac2582e81a38720086a52832de58a37a 100644 --- a/third_party/crashpad/crashpad/DEPS