| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/crash/app/crashpad_mac.h" | 5 #include "components/crash/app/crashpad_mac.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // fallback. Forwarding is turned off for debug-mode builds even for the | 151 // fallback. Forwarding is turned off for debug-mode builds even for the |
| 152 // browser process, because the system's crash reporter can take a very long | 152 // browser process, because the system's crash reporter can take a very long |
| 153 // time to chew on symbols. | 153 // time to chew on symbols. |
| 154 if (!browser_process || is_debug_build) { | 154 if (!browser_process || is_debug_build) { |
| 155 crashpad_info->set_system_crash_reporter_forwarding( | 155 crashpad_info->set_system_crash_reporter_forwarding( |
| 156 crashpad::TriState::kDisabled); | 156 crashpad::TriState::kDisabled); |
| 157 } | 157 } |
| 158 | 158 |
| 159 g_simple_string_dictionary = new crashpad::SimpleStringDictionary(); | 159 g_simple_string_dictionary = new crashpad::SimpleStringDictionary(); |
| 160 crashpad_info->set_simple_annotations(g_simple_string_dictionary); | 160 crashpad_info->set_simple_annotations(g_simple_string_dictionary); |
| 161 |
| 162 base::debug::SetCrashKeyReportingFunctions(SetCrashKeyValue, ClearCrashKey); |
| 163 crash_reporter_client->RegisterCrashKeys(); |
| 164 |
| 161 SetCrashKeyValue("ptype", browser_process ? base::StringPiece("browser") | 165 SetCrashKeyValue("ptype", browser_process ? base::StringPiece("browser") |
| 162 : base::StringPiece(process_type)); | 166 : base::StringPiece(process_type)); |
| 163 SetCrashKeyValue("pid", base::StringPrintf("%d", getpid())); | 167 SetCrashKeyValue("pid", base::StringPrintf("%d", getpid())); |
| 164 | 168 |
| 165 logging::SetLogMessageHandler(LogMessageHandler); | 169 logging::SetLogMessageHandler(LogMessageHandler); |
| 166 | 170 |
| 167 // If clients called CRASHPAD_SIMULATE_CRASH() instead of | 171 // If clients called CRASHPAD_SIMULATE_CRASH() instead of |
| 168 // base::debug::DumpWithoutCrashing(), these dumps would appear as crashes in | 172 // base::debug::DumpWithoutCrashing(), these dumps would appear as crashes in |
| 169 // the correct function, at the correct file and line. This would be | 173 // the correct function, at the correct file and line. This would be |
| 170 // preferable to having all occurrences show up in DumpWithoutCrashing() at | 174 // preferable to having all occurrences show up in DumpWithoutCrashing() at |
| 171 // the same file and line. | 175 // the same file and line. |
| 172 base::debug::SetDumpWithoutCrashingFunction(DumpWithoutCrashing); | 176 base::debug::SetDumpWithoutCrashingFunction(DumpWithoutCrashing); |
| 173 | 177 |
| 174 base::debug::SetCrashKeyReportingFunctions(SetCrashKeyValue, ClearCrashKey); | |
| 175 crash_reporter_client->RegisterCrashKeys(); | |
| 176 | |
| 177 if (browser_process) { | 178 if (browser_process) { |
| 178 g_database = | 179 g_database = |
| 179 crashpad::CrashReportDatabase::Initialize(database_path).release(); | 180 crashpad::CrashReportDatabase::Initialize(database_path).release(); |
| 180 | 181 |
| 181 bool enable_uploads = false; | 182 bool enable_uploads = false; |
| 182 if (!crash_reporter_client->ReportingIsEnforcedByPolicy(&enable_uploads)) { | 183 if (!crash_reporter_client->ReportingIsEnforcedByPolicy(&enable_uploads)) { |
| 183 enable_uploads = crash_reporter_client->GetCollectStatsConsent() || | 184 enable_uploads = crash_reporter_client->GetCollectStatsConsent() || |
| 184 crash_reporter_client->IsRunningUnattended(); | 185 crash_reporter_client->IsRunningUnattended(); |
| 185 // Breakpad provided a --disable-breakpad switch here. Should this? | 186 // Breakpad provided a --disable-breakpad switch here. Should this? |
| 186 } | 187 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 237 |
| 237 struct { | 238 struct { |
| 238 bool operator()(const UploadedReport& a, const UploadedReport& b) { | 239 bool operator()(const UploadedReport& a, const UploadedReport& b) { |
| 239 return a.creation_time >= b.creation_time; | 240 return a.creation_time >= b.creation_time; |
| 240 } | 241 } |
| 241 } sort_by_time; | 242 } sort_by_time; |
| 242 std::sort(uploaded_reports->begin(), uploaded_reports->end(), sort_by_time); | 243 std::sort(uploaded_reports->begin(), uploaded_reports->end(), sort_by_time); |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace crash_reporter | 246 } // namespace crash_reporter |
| OLD | NEW |