Chromium Code Reviews| 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/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 Loading... | |
| 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 if (pending_report.upload_explicitly_requested) |
| 282 report.state = ReportUploadState::UserRequested; | |
| 283 else | |
| 284 report.state = ReportUploadState::Pending; | |
| 282 reports->push_back(report); | 285 reports->push_back(report); |
| 283 } | 286 } |
| 284 | 287 |
| 285 std::sort(reports->begin(), reports->end(), | 288 std::sort(reports->begin(), reports->end(), |
| 286 [](const Report& a, const Report& b) { | 289 [](const Report& a, const Report& b) { |
| 287 return a.capture_time > b.capture_time; | 290 return a.capture_time > b.capture_time; |
| 288 }); | 291 }); |
| 289 } | 292 } |
| 290 | 293 |
| 294 void RequestSingleCrashUpload(const std::string& local_id) { | |
| 295 if (!g_database) | |
| 296 return; | |
| 297 crashpad::UUID uuid; | |
| 298 uuid.InitializeFromString(local_id); | |
| 299 crashpad::CrashReportDatabase::OperationStatus status = | |
| 300 g_database->RequestUpload(uuid); | |
| 301 } | |
| 302 | |
| 291 } // namespace crash_reporter | 303 } // namespace crash_reporter |
| 292 | 304 |
| 293 #if defined(OS_WIN) | 305 #if defined(OS_WIN) |
| 294 | 306 |
| 295 extern "C" { | 307 extern "C" { |
| 296 | 308 |
| 297 // This function is used in chrome_metrics_services_manager_client.cc to trigger | 309 // 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 | 310 // 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 | 311 // are initialized, and when the user changes their consent for uploads. See |
| 300 // crash_reporter::SetUploadConsent for effects. | 312 // crash_reporter::SetUploadConsent for effects. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 311 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, | 323 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, |
| 312 const wchar_t* value) { | 324 const wchar_t* value) { |
| 313 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), | 325 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), |
| 314 base::UTF16ToUTF8(value)); | 326 base::UTF16ToUTF8(value)); |
| 315 } | 327 } |
| 316 | 328 |
| 317 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { | 329 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { |
| 318 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); | 330 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); |
| 319 } | 331 } |
| 320 | 332 |
| 333 // This helper is invoked by code in chrome.dll to retrieve the crash reports. | |
| 334 // See CrashUploadListCrashpad. Note that we do not pass an std::vector here, | |
|
jwd
2016/08/23 19:14:30
I think this note about the vector and returned po
gayane -on leave until 09-2017
2016/08/23 20:57:45
Opps. copy paste.
| |
| 335 // because we do not want to allocate/free in different modules. The returned | |
| 336 // pointer is read-only. | |
| 337 void __declspec(dllexport) void RequestSingleCrashUploadImpl( | |
| 338 const std::string& local_id) { | |
| 339 crash_reporter::RequestSingleCrashUpload(local_id); | |
| 340 } | |
| 321 } // extern "C" | 341 } // extern "C" |
| 322 | 342 |
| 323 #endif // OS_WIN | 343 #endif // OS_WIN |
| OLD | NEW |