Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: components/crash/content/app/crashpad.cc

Issue 2070993002: List all crashes in chrome://crashes, including those not uploaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittest Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/content/app/crashpad.h" 5 #include "components/crash/content/app/crashpad.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #if BUILDFLAG(ENABLE_KASKO) 10 #if BUILDFLAG(ENABLE_KASKO)
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 crashpad::Settings* settings = g_database->GetSettings(); 262 crashpad::Settings* settings = g_database->GetSettings();
263 bool enable_uploads; 263 bool enable_uploads;
264 if (settings->GetUploadsEnabled(&enable_uploads)) { 264 if (settings->GetUploadsEnabled(&enable_uploads)) {
265 return enable_uploads; 265 return enable_uploads;
266 } 266 }
267 } 267 }
268 268
269 return false; 269 return false;
270 } 270 }
271 271
272 void GetUploadedReports(std::vector<UploadedReport>* uploaded_reports) { 272 void GetReports(std::vector<Report>* reports) {
273 uploaded_reports->clear(); 273 reports->clear();
274 274
275 if (!g_database) { 275 if (!g_database) {
276 return; 276 return;
277 } 277 }
278 278
279 std::vector<crashpad::CrashReportDatabase::Report> completed_reports; 279 std::vector<crashpad::CrashReportDatabase::Report> completed_reports;
280 crashpad::CrashReportDatabase::OperationStatus status = 280 crashpad::CrashReportDatabase::OperationStatus status =
281 g_database->GetCompletedReports(&completed_reports); 281 g_database->GetCompletedReports(&completed_reports);
282 if (status != crashpad::CrashReportDatabase::kNoError) { 282 if (status != crashpad::CrashReportDatabase::kNoError) {
283 return; 283 return;
284 } 284 }
285 285
286 std::vector<crashpad::CrashReportDatabase::Report> pending_reports;
287 status = g_database->GetPendingReports(&pending_reports);
Mark Mentovai 2016/06/20 17:55:21 This is fine right now, but we may want to add an
scottmg 2016/06/20 21:08:55 Yup, good point.
288 if (status != crashpad::CrashReportDatabase::kNoError) {
289 return;
290 }
291
286 for (const crashpad::CrashReportDatabase::Report& completed_report : 292 for (const crashpad::CrashReportDatabase::Report& completed_report :
287 completed_reports) { 293 completed_reports) {
288 if (completed_report.uploaded) { 294 Report report;
289 UploadedReport uploaded_report; 295 report.local_id = completed_report.uuid.ToString();
290 uploaded_report.local_id = completed_report.uuid.ToString(); 296 report.remote_id = completed_report.id;
291 uploaded_report.remote_id = completed_report.id; 297 report.creation_time = completed_report.creation_time;
292 uploaded_report.creation_time = completed_report.creation_time; 298 report.state = completed_report.uploaded ? ReportUploadState::Uploaded
293 299 : ReportUploadState::NotUploaded;
294 uploaded_reports->push_back(uploaded_report); 300 reports->push_back(report);
295 }
296 } 301 }
297 302
298 std::sort(uploaded_reports->begin(), uploaded_reports->end(), 303 for (const crashpad::CrashReportDatabase::Report& pending_report :
299 [](const UploadedReport& a, const UploadedReport& b) { 304 pending_reports) {
305 Report report;
306 report.local_id = pending_report.uuid.ToString();
307 report.creation_time = pending_report.creation_time;
308 report.state = ReportUploadState::Pending;
309 reports->push_back(report);
310 }
311
312 std::sort(reports->begin(), reports->end(),
313 [](const Report& a, const Report& b) {
300 return a.creation_time > b.creation_time; 314 return a.creation_time > b.creation_time;
301 }); 315 });
302 } 316 }
303 317
304 #if BUILDFLAG(ENABLE_KASKO) 318 #if BUILDFLAG(ENABLE_KASKO)
305 319
306 void GetCrashKeysForKasko(std::vector<kasko::api::CrashKey>* crash_keys) { 320 void GetCrashKeysForKasko(std::vector<kasko::api::CrashKey>* crash_keys) {
307 // Get the platform annotations. 321 // Get the platform annotations.
308 std::map<std::string, std::string> annotations; 322 std::map<std::string, std::string> annotations;
309 internal::GetPlatformCrashpadAnnotations(&annotations); 323 internal::GetPlatformCrashpadAnnotations(&annotations);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 base::UTF16ToUTF8(value)); 419 base::UTF16ToUTF8(value));
406 } 420 }
407 421
408 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { 422 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) {
409 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); 423 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key));
410 } 424 }
411 425
412 } // extern "C" 426 } // extern "C"
413 427
414 #endif // OS_WIN 428 #endif // OS_WIN
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698