| Index: chrome/common/crash_keys.cc
|
| diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc
|
| index 1983f0d73ec93b37ac16d974176d59dfb2611c88..bce2dfcc56c29bd09ee225bd7cc5c5f5c0514917 100644
|
| --- a/chrome/common/crash_keys.cc
|
| +++ b/chrome/common/crash_keys.cc
|
| @@ -55,7 +55,13 @@ static_assert(kMediumSize <= kSingleChunkLength,
|
| "mac has medium size crash key chunks");
|
| #endif
|
|
|
| +#if defined(OS_MACOSX)
|
| +// Crashpad owns the "guid" key. Chrome's metrics client ID is a separate ID
|
| +// carried in a distinct "metrics_client_id" field.
|
| +const char kMetricsClientId[] = "metrics_client_id";
|
| +#else
|
| const char kClientId[] = "guid";
|
| +#endif
|
|
|
| const char kChannel[] = "channel";
|
|
|
| @@ -123,7 +129,11 @@ size_t RegisterChromeCrashKeys() {
|
| // The following keys may be chunked by the underlying crash logging system,
|
| // but ultimately constitute a single key-value pair.
|
| base::debug::CrashKey fixed_keys[] = {
|
| +#if defined(OS_MACOSX)
|
| + { kMetricsClientId, kSmallSize },
|
| +#else
|
| { kClientId, kSmallSize },
|
| +#endif
|
| { kChannel, kSmallSize },
|
| { kActiveURL, kLargeSize },
|
| { kNumSwitches, kSmallSize },
|
| @@ -234,6 +244,24 @@ size_t RegisterChromeCrashKeys() {
|
| kSingleChunkLength);
|
| }
|
|
|
| +#if defined(OS_MACOSX)
|
| +
|
| +void SetMetricsClientIdFromGUID(const std::string& metrics_client_guid) {
|
| + std::string stripped_guid(metrics_client_guid);
|
| + // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY.
|
| + ReplaceSubstringsAfterOffset(&stripped_guid, 0, "-", "");
|
| + if (stripped_guid.empty())
|
| + return;
|
| +
|
| + base::debug::SetCrashKeyValue(kMetricsClientId, stripped_guid);
|
| +}
|
| +
|
| +void ClearMetricsClientId() {
|
| + base::debug::ClearCrashKey(kMetricsClientId);
|
| +}
|
| +
|
| +#else
|
| +
|
| void SetCrashClientIdFromGUID(const std::string& client_guid) {
|
| std::string stripped_guid(client_guid);
|
| // Remove all instance of '-' char from the GUID. So BCD-WXY becomes BCDWXY.
|
| @@ -244,6 +272,8 @@ void SetCrashClientIdFromGUID(const std::string& client_guid) {
|
| base::debug::SetCrashKeyValue(kClientId, stripped_guid);
|
| }
|
|
|
| +#endif
|
| +
|
| static bool IsBoringSwitch(const std::string& flag) {
|
| #if defined(OS_WIN)
|
| return StartsWithASCII(flag, "--channel=", true) ||
|
| @@ -271,6 +301,11 @@ static bool IsBoringSwitch(const std::string& flag) {
|
| // (If you need to know can always look at the PEB).
|
| flag == "--flag-switches-begin" ||
|
| flag == "--flag-switches-end";
|
| +#elif defined(OS_MACOSX)
|
| + // These are carried in their own fields.
|
| + return StartsWithASCII(flag, "--channel=", true) ||
|
| + StartsWithASCII(flag, "--type=", true) ||
|
| + StartsWithASCII(flag, "--metrics-client-id=", true);
|
| #elif defined(OS_CHROMEOS)
|
| static const char* const kIgnoreSwitches[] = {
|
| ::switches::kEnableLogging,
|
|
|