Update to Chromium revision bc084a8b (#530369)

This commit is contained in:
Marshall Greenblatt
2018-02-14 19:12:09 -05:00
parent ac86b61139
commit 9e644b7538
113 changed files with 1930 additions and 1797 deletions

View File

@@ -1,5 +1,5 @@
diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc
index 631772316423..f00a94403c61 100644
index 5e0eabb..f862908 100644
--- chrome/common/crash_keys.cc
+++ chrome/common/crash_keys.cc
@@ -4,6 +4,8 @@
@@ -10,45 +10,17 @@ index 631772316423..f00a94403c61 100644
+
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/format_macros.h"
@@ -84,7 +86,7 @@ const char kViewCount[] = "view-count";
const char kUserCloudPolicyManagerConnectTrace[] =
"user-cloud-policy-manager-connect-trace";
#include "base/logging.h"
@@ -26,7 +28,7 @@
-size_t RegisterChromeCrashKeys() {
+void GetChromeCrashKeys(std::vector<base::debug::CrashKey>& keys) {
// The following keys may be chunked by the underlying crash logging system,
// but ultimately constitute a single key-value pair.
//
@@ -200,10 +202,16 @@ size_t RegisterChromeCrashKeys() {
// This dynamic set of keys is used for sets of key value pairs when gathering
// a collection of data, like command line switches or extension IDs.
- std::vector<base::debug::CrashKey> keys(
- fixed_keys, fixed_keys + arraysize(fixed_keys));
+ keys.reserve(keys.size() + arraysize(fixed_keys));
+ std::copy(fixed_keys, fixed_keys + arraysize(fixed_keys),
+ std::back_inserter(keys));
crash_keys::GetCrashKeysForCommandLineSwitches(&keys);
+}
+
+size_t RegisterChromeCrashKeys() {
+ std::vector<base::debug::CrashKey> keys;
+ GetChromeCrashKeys(keys);
// Register the extension IDs.
{
@@ -237,7 +245,7 @@ size_t RegisterChromeCrashKeys() {
return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength);
}
namespace crash_keys {
-static bool IsBoringSwitch(const std::string& flag) {
+bool IsBoringChromeSwitch(const std::string& flag) {
static const char* const kIgnoreSwitches[] = {
switches::kEnableLogging,
switches::kFlagSwitchesBegin,
@@ -292,7 +300,7 @@ static bool IsBoringSwitch(const std::string& flag) {
@@ -81,7 +83,7 @@ static bool IsBoringSwitch(const std::string& flag) {
}
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
@@ -58,30 +30,22 @@ index 631772316423..f00a94403c61 100644
void SetActiveExtensions(const std::set<std::string>& extensions) {
diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h
index 38e43f247477..62fe45582661 100644
index a18c8fc..011bcc2 100644
--- chrome/common/crash_keys.h
+++ chrome/common/crash_keys.h
@@ -22,10 +22,18 @@ class CommandLine;
@@ -16,6 +16,10 @@ class CommandLine;
}
namespace crash_keys {
+// Returns the list of potential crash keys that can be sent to the crash
+// server.
+void GetChromeCrashKeys(std::vector<base::debug::CrashKey>& keys);
+
// Registers all of the potential crash keys that can be sent to the crash
// reporting server. Returns the size of the union of all keys.
size_t RegisterChromeCrashKeys();
+
+// Returns true if the specified command-line flag should be excluded from
+// crash reporting.
+bool IsBoringChromeSwitch(const std::string& flag);
+
// Sets the kNumSwitches key and the set of keys named using kSwitchFormat based
// on the given |command_line|.
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line);
diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn
index 60c6636bddf2..7e582f797653 100644
index fd5a28b..df46cb0 100644
--- chrome_elf/BUILD.gn
+++ chrome_elf/BUILD.gn
@@ -7,6 +7,7 @@
@@ -92,7 +56,7 @@ index 60c6636bddf2..7e582f797653 100644
import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni")
@@ -174,9 +175,6 @@ static_library("blacklist") {
@@ -181,9 +182,6 @@ static_library("blacklist") {
static_library("crash") {
sources = [
@@ -102,7 +66,7 @@ index 60c6636bddf2..7e582f797653 100644
"crash/crash_helper.cc",
"crash/crash_helper.h",
]
@@ -184,6 +182,7 @@ static_library("crash") {
@@ -191,6 +189,7 @@ static_library("crash") {
":hook_util",
"//base", # This needs to go. DEP of app, crash_keys, client.
"//base:base_static", # pe_image
@@ -110,8 +74,8 @@ index 60c6636bddf2..7e582f797653 100644
"//chrome/install_static:install_static_util",
"//components/crash/content/app",
"//components/crash/core/common", # crash_keys
@@ -192,6 +191,17 @@ static_library("crash") {
"//gpu/config:crash_keys",
@@ -198,6 +197,17 @@ static_library("crash") {
"//content/public/common:result_codes",
"//third_party/crashpad/crashpad/client", # DumpWithoutCrash
]
+
@@ -129,7 +93,7 @@ index 60c6636bddf2..7e582f797653 100644
static_library("hook_util") {
diff --git chrome_elf/crash/crash_helper.cc chrome_elf/crash/crash_helper.cc
index e8e27dc4ebd7..7cb2149ec41d 100644
index e8e27dc..7cb2149 100644
--- chrome_elf/crash/crash_helper.cc
+++ chrome_elf/crash/crash_helper.cc
@@ -11,12 +11,17 @@
@@ -163,18 +127,18 @@ index e8e27dc4ebd7..7cb2149ec41d 100644
g_crash_helper_enabled = true;
return true;
diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc
index 42a50e8381c1..718f945573a3 100644
index c72cd36..e9a79dd 100644
--- components/crash/content/app/breakpad_linux.cc
+++ components/crash/content/app/breakpad_linux.cc
@@ -29,6 +29,7 @@
@@ -28,6 +28,7 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/debug/crash_logging.h"
#include "base/debug/dump_without_crashing.h"
+#include "base/debug/leak_annotations.h"
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
#include "base/linux_util.h"
@@ -89,6 +90,7 @@ namespace {
@@ -88,6 +89,7 @@ namespace {
#if !defined(OS_CHROMEOS)
const char kUploadURL[] = "https://clients2.google.com/cr/report";
@@ -182,7 +146,7 @@ index 42a50e8381c1..718f945573a3 100644
#endif
bool g_is_crash_reporter_enabled = false;
@@ -686,7 +688,7 @@ bool CrashDone(const MinidumpDescriptor& minidump,
@@ -685,7 +687,7 @@ bool CrashDone(const MinidumpDescriptor& minidump,
info.process_type_length = 7;
info.distro = base::g_linux_distro;
info.distro_length = my_strlen(base::g_linux_distro);
@@ -191,7 +155,7 @@ index 42a50e8381c1..718f945573a3 100644
info.process_start_time = g_process_start_time;
info.oom_size = base::g_oom_size;
info.pid = g_pid;
@@ -1356,7 +1358,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
@@ -1341,7 +1343,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
header_content_encoding,
header_content_type,
post_file,
@@ -200,16 +164,16 @@ index 42a50e8381c1..718f945573a3 100644
"--timeout=10", // Set a timeout so we don't hang forever.
"--tries=1", // Don't retry if the upload fails.
"-O", // Output reply to the file descriptor path.
@@ -1696,10 +1698,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1681,10 +1683,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
writer.AddBoundary();
- writer.AddPairString("prod", product_name);
+ writer.AddPairString("product", product_name);
writer.AddBoundary();
- writer.AddPairString("ver", version);
+ writer.AddBoundary();
+ writer.AddPairString("version", version);
writer.AddBoundary();
- writer.AddPairString("ver", version);
+
+#if defined(ARCH_CPU_32_BITS)
+ const char* platform = "linux32";
@@ -217,13 +181,35 @@ index 42a50e8381c1..718f945573a3 100644
+ const char* platform = "linux64";
+#endif
+ writer.AddPairString("platform", platform);
+ writer.AddBoundary();
writer.AddBoundary();
+
if (info.pid > 0) {
char pid_value_buf[kUint64StringSize];
uint64_t pid_value_len = my_uint64_len(info.pid);
@@ -2017,6 +2028,17 @@ void InitCrashReporter(const std::string& process_type) {
PostEnableBreakpadInitialization();
@@ -1789,10 +1800,20 @@ void HandleCrashDump(const BreakpadInfo& info) {
crash_reporter::internal::TransitionalCrashKeyStorage;
CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys);
const CrashKeyStorage::Entry* entry;
+
+ crash_reporter::CrashReporterClient::ParameterMap parameters;
+
while ((entry = crash_key_iterator.Next())) {
if (g_use_crash_key_white_list && !IsInWhiteList(entry->key))
continue;
- writer.AddPairString(entry->key, entry->value);
+ parameters.insert(std::make_pair(entry->key, entry->value));
+ }
+
+ if (!parameters.empty())
+ parameters = GetCrashReporterClient()->FilterParameters(parameters);
+
+ for (const auto& param : parameters) {
+ writer.AddPairString(param.first.c_str(), param.second.c_str());
writer.AddBoundary();
writer.Flush();
}
@@ -2002,6 +2023,17 @@ void SetChannelCrashKey(const std::string& channel) {
channel_key.Set(channel);
}
+void SetCrashServerURL(const std::string& url) {
@@ -241,12 +227,12 @@ index 42a50e8381c1..718f945573a3 100644
void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) {
SanitizationInfo sanitization_info;
diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h
index 4a2a429fc052..70f3adbc73cf 100644
index 9ee8555..7af55dd 100644
--- components/crash/content/app/breakpad_linux.h
+++ components/crash/content/app/breakpad_linux.h
@@ -16,6 +16,9 @@ namespace breakpad {
// Turns on the crash reporter in any process.
extern void InitCrashReporter(const std::string& process_type);
@@ -19,6 +19,9 @@ extern void InitCrashReporter(const std::string& process_type);
// Sets the product/distribution channel crash key.
void SetChannelCrashKey(const std::string& channel);
+// Set the crash server URL.
+void SetCrashServerURL(const std::string& url);
@@ -255,7 +241,7 @@ index 4a2a429fc052..70f3adbc73cf 100644
extern void InitCrashKeysForTesting();
diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc
index 72849b964f1c..6a78f9b9c832 100644
index a37619c..e13a0f7 100644
--- components/crash/content/app/crash_reporter_client.cc
+++ components/crash/content/app/crash_reporter_client.cc
@@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() {
@@ -280,7 +266,7 @@ index 72849b964f1c..6a78f9b9c832 100644
#if defined(OS_WIN)
bool CrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) {
@@ -149,6 +151,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
@@ -145,6 +147,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
}
#endif
@@ -313,29 +299,36 @@ index 72849b964f1c..6a78f9b9c832 100644
#if defined(OS_ANDROID)
int CrashReporterClient::GetAndroidMinidumpDescriptor() {
return 0;
@@ -179,9 +207,4 @@ bool CrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
@@ -175,9 +203,11 @@ bool CrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
}
#endif
-bool CrashReporterClient::EnableBreakpadForProcess(
- const std::string& process_type) {
- return false;
-}
-
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+CrashReporterClient::ParameterMap
+CrashReporterClient::FilterParameters(const ParameterMap& parameters) {
+ return parameters;
}
+#endif
} // namespace crash_reporter
diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h
index d2a805289c0d..25d026583c37 100644
index 75d3d6d..aa86f45 100644
--- components/crash/content/app/crash_reporter_client.h
+++ components/crash/content/app/crash_reporter_client.h
@@ -8,6 +8,7 @@
#include <stddef.h>
@@ -5,7 +5,9 @@
#ifndef COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_
#define COMPONENTS_CRASH_CONTENT_APP_CRASH_REPORTER_CLIENT_H_
+#include <map>
#include <string>
+#include <vector>
#include "base/strings/string16.h"
#include "build/build_config.h"
@@ -93,12 +94,13 @@ class CrashReporterClient {
@@ -91,12 +93,13 @@ class CrashReporterClient {
virtual int GetResultCodeRespawnFailed();
#endif
@@ -350,15 +343,15 @@ index d2a805289c0d..25d026583c37 100644
virtual base::FilePath GetReporterLogFilename();
// Custom crash minidump handler after the minidump is generated.
@@ -107,6 +109,7 @@ class CrashReporterClient {
// WARNING: this handler runs in a compromised context. It may not call into
@@ -106,6 +109,7 @@ class CrashReporterClient {
// libc nor allocate memory normally.
virtual bool HandleCrashDump(const char* crashdump_filename);
+#endif
#endif
+#endif
// The location where minidump files should be written. Returns true if
@@ -186,6 +189,23 @@ class CrashReporterClient {
// |crash_dir| was set. Windows has to use base::string16 because this code
@@ -180,6 +184,30 @@ class CrashReporterClient {
// Returns true if breakpad should run in the given process type.
virtual bool EnableBreakpadForProcess(const std::string& process_type);
@@ -378,26 +371,33 @@ index d2a805289c0d..25d026583c37 100644
+ // Returns true if forwarding of crashes to the system crash reporter is
+ // enabled for the browser process.
+ virtual bool EnableBrowserCrashForwarding();
+#endif
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ // Provides an oportunity to modify the parameters that will be sent with a
+ // crash upload.
+ using ParameterMap = std::map<std::string, std::string>;
+ virtual ParameterMap FilterParameters(const ParameterMap& parameters);
+#endif
};
} // namespace crash_reporter
diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc
index 6949d5e7dcc4..d9b052382a6a 100644
index dde11ea..1a1f8b0 100644
--- components/crash/content/app/crashpad.cc
+++ components/crash/content/app/crashpad.cc
@@ -137,7 +137,8 @@ void InitializeCrashpadImpl(bool initial_client,
@@ -133,7 +133,8 @@ void InitializeCrashpadImpl(bool initial_client,
// fallback. Forwarding is turned off for debug-mode builds even for the
// browser process, because the system's crash reporter can take a very long
// time to chew on symbols.
- if (!browser_process || is_debug_build) {
+ if (!browser_process || is_debug_build ||
+ !crash_reporter_client->EnableBrowserCrashForwarding()) {
crashpad_info->set_system_crash_reporter_forwarding(
crashpad::TriState::kDisabled);
crashpad::CrashpadInfo::GetCrashpadInfo()
->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled);
}
diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm
index 485c2b4b3e98..3b5f3eaa3926 100644
index 6508c2a..f51ce5a 100644
--- components/crash/content/app/crashpad_mac.mm
+++ components/crash/content/app/crashpad_mac.mm
@@ -16,11 +16,14 @@
@@ -415,7 +415,7 @@ index 485c2b4b3e98..3b5f3eaa3926 100644
#include "third_party/crashpad/crashpad/client/crash_report_database.h"
#include "third_party/crashpad/crashpad/client/crashpad_client.h"
#include "third_party/crashpad/crashpad/client/crashpad_info.h"
@@ -42,9 +45,10 @@ base::FilePath PlatformCrashpadInitialization(
@@ -41,9 +44,10 @@ base::FilePath PlatformCrashpadInitialization(
if (initial_client) {
@autoreleasepool {
@@ -429,7 +429,7 @@ index 485c2b4b3e98..3b5f3eaa3926 100644
// Is there a way to recover if this fails?
CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
@@ -56,16 +60,27 @@ base::FilePath PlatformCrashpadInitialization(
@@ -55,16 +59,27 @@ base::FilePath PlatformCrashpadInitialization(
// crash server won't have symbols for any other build types.
std::string url = "https://clients2.google.com/cr/report";
#else
@@ -462,7 +462,7 @@ index 485c2b4b3e98..3b5f3eaa3926 100644
#if defined(GOOGLE_CHROME_BUILD)
// Empty means stable.
@@ -81,12 +96,16 @@ base::FilePath PlatformCrashpadInitialization(
@@ -80,12 +95,16 @@ base::FilePath PlatformCrashpadInitialization(
process_annotations["channel"] = "";
}
@@ -484,7 +484,7 @@ index 485c2b4b3e98..3b5f3eaa3926 100644
std::vector<std::string> arguments;
@@ -108,6 +127,12 @@ base::FilePath PlatformCrashpadInitialization(
@@ -107,6 +126,12 @@ base::FilePath PlatformCrashpadInitialization(
"--reset-own-crash-exception-port-to-system-default");
}
@@ -498,7 +498,7 @@ index 485c2b4b3e98..3b5f3eaa3926 100644
handler_path, database_path, metrics_path, url, process_annotations,
arguments, true, false);
diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc
index 3a33c9bb8e92..961d600f7452 100644
index a5d1afc..91815d9 100644
--- components/crash/content/app/crashpad_win.cc
+++ components/crash/content/app/crashpad_win.cc
@@ -34,8 +34,8 @@ void GetPlatformCrashpadAnnotations(
@@ -568,7 +568,7 @@ index 3a33c9bb8e92..961d600f7452 100644
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc
index 46954327b9c7..62a7ce8d4e46 100644
index 4695432..62a7ce8 100644
--- content/browser/frame_host/debug_urls.cc
+++ content/browser/frame_host/debug_urls.cc
@@ -139,7 +139,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) {