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

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

Issue 2325713002: Manual crash uploads for mac and win (Closed)
Patch Set: Created 4 years, 3 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 #include <algorithm> 10 #include <algorithm>
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 271 }
272 reports->push_back(report); 272 reports->push_back(report);
273 } 273 }
274 274
275 for (const crashpad::CrashReportDatabase::Report& pending_report : 275 for (const crashpad::CrashReportDatabase::Report& pending_report :
276 pending_reports) { 276 pending_reports) {
277 Report report; 277 Report report;
278 report.local_id = pending_report.uuid.ToString(); 278 report.local_id = pending_report.uuid.ToString();
279 report.capture_time = pending_report.creation_time; 279 report.capture_time = pending_report.creation_time;
280 report.upload_time = 0; 280 report.upload_time = 0;
281 report.state = ReportUploadState::Pending; 281 report.state = pending_report.upload_explicitly_requested
282 ? ReportUploadState::Pending_UserRequested
283 : report.state = ReportUploadState::Pending;
282 reports->push_back(report); 284 reports->push_back(report);
283 } 285 }
284 286
285 std::sort(reports->begin(), reports->end(), 287 std::sort(reports->begin(), reports->end(),
286 [](const Report& a, const Report& b) { 288 [](const Report& a, const Report& b) {
287 return a.capture_time > b.capture_time; 289 return a.capture_time > b.capture_time;
288 }); 290 });
289 } 291 }
290 292
293 void RequestSingleCrashUpload(const std::string& local_id) {
294 if (!g_database)
295 return;
296 crashpad::UUID uuid;
297 uuid.InitializeFromString(local_id);
298 g_database->RequestUpload(uuid);
299 }
300
291 } // namespace crash_reporter 301 } // namespace crash_reporter
292 302
293 #if defined(OS_WIN) 303 #if defined(OS_WIN)
294 304
295 extern "C" { 305 extern "C" {
296 306
297 // This function is used in chrome_metrics_services_manager_client.cc to trigger 307 // This function is used in chrome_metrics_services_manager_client.cc to trigger
298 // changes to the upload-enabled state. This is done when the metrics services 308 // changes to the upload-enabled state. This is done when the metrics services
299 // are initialized, and when the user changes their consent for uploads. See 309 // are initialized, and when the user changes their consent for uploads. See
300 // crash_reporter::SetUploadConsent for effects. 310 // crash_reporter::SetUploadConsent for effects.
(...skipping 10 matching lines...) Expand all
311 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, 321 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key,
312 const wchar_t* value) { 322 const wchar_t* value) {
313 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), 323 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key),
314 base::UTF16ToUTF8(value)); 324 base::UTF16ToUTF8(value));
315 } 325 }
316 326
317 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { 327 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) {
318 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); 328 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key));
319 } 329 }
320 330
331 // This helper is invoked by code in chrome.dll to request a single crash report
332 // upload. See CrashUploadListCrashpad.
333 void __declspec(dllexport)
334 RequestSingleCrashUploadImpl(const std::string& local_id) {
335 crash_reporter::RequestSingleCrashUpload(local_id);
336 }
321 } // extern "C" 337 } // extern "C"
322 338
323 #endif // OS_WIN 339 #endif // OS_WIN
OLDNEW
« no previous file with comments | « components/crash/content/app/crashpad.h ('k') | components/crash/core/browser/crashes_ui_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698