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) |
Mark Mentovai
2016/08/25 20:25:11
Seems like a good case for the ?: operator.
gayane -on leave until 09-2017
2016/08/26 00:12:55
Done.
| |
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 g_database->RequestUpload(uuid); | |
300 } | |
301 | |
291 } // namespace crash_reporter | 302 } // namespace crash_reporter |
292 | 303 |
293 #if defined(OS_WIN) | 304 #if defined(OS_WIN) |
294 | 305 |
295 extern "C" { | 306 extern "C" { |
296 | 307 |
297 // This function is used in chrome_metrics_services_manager_client.cc to trigger | 308 // 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 | 309 // 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 | 310 // are initialized, and when the user changes their consent for uploads. See |
300 // crash_reporter::SetUploadConsent for effects. | 311 // crash_reporter::SetUploadConsent for effects. |
(...skipping 10 matching lines...) Expand all Loading... | |
311 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, | 322 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, |
312 const wchar_t* value) { | 323 const wchar_t* value) { |
313 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), | 324 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), |
314 base::UTF16ToUTF8(value)); | 325 base::UTF16ToUTF8(value)); |
315 } | 326 } |
316 | 327 |
317 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { | 328 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { |
318 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); | 329 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); |
319 } | 330 } |
320 | 331 |
332 // This helper is invoked by code in chrome.dll to request a single crash report | |
333 // upload. See CrashUploadListCrashpad. | |
334 void __declspec(dllexport) void RequestSingleCrashUploadImpl( | |
335 const std::string& local_id) { | |
336 crash_reporter::RequestSingleCrashUpload(local_id); | |
337 } | |
321 } // extern "C" | 338 } // extern "C" |
322 | 339 |
323 #endif // OS_WIN | 340 #endif // OS_WIN |
OLD | NEW |