upload_list_add_loadsync_method.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Jeremy Apthorp <[email protected]>
  3. Date: Fri, 1 May 2020 18:25:59 -0700
  4. Subject: upload_list: add LoadSync method
  5. This allows synchronous loading of the upload list, which is required by
  6. the crashReporter.getUploadedReports() API. The synchronous version is
  7. deprecated, and this API should be removed once the deprecated behavior
  8. is no longer supported.
  9. diff --git a/components/upload_list/upload_list.cc b/components/upload_list/upload_list.cc
  10. index b19139c33758758970fd38aa87aaeb351e409edd..73498817f53236091f7be2c20d957c24c15b948e 100644
  11. --- a/components/upload_list/upload_list.cc
  12. +++ b/components/upload_list/upload_list.cc
  13. @@ -65,6 +65,10 @@ void UploadList::Load(base::OnceClosure callback) {
  14. base::BindOnce(&UploadList::OnLoadComplete, this));
  15. }
  16. +void UploadList::LoadSync() {
  17. + uploads_ = LoadUploadList();
  18. +}
  19. +
  20. void UploadList::Clear(const base::Time& begin,
  21. const base::Time& end,
  22. base::OnceClosure callback) {
  23. diff --git a/components/upload_list/upload_list.h b/components/upload_list/upload_list.h
  24. index 3b84761fdd397ec41cd7ed2b675467c95e6d0faf..43b78dfbb0bc0c8897d96c20727cb5502f1f2a12 100644
  25. --- a/components/upload_list/upload_list.h
  26. +++ b/components/upload_list/upload_list.h
  27. @@ -81,6 +81,8 @@ class UploadList : public base::RefCountedThreadSafe<UploadList> {
  28. // overwrite the previously supplied one, and the first will not be called.
  29. void Load(base::OnceClosure callback);
  30. + void LoadSync();
  31. +
  32. // Clears any data associated with the upload list, where the upload time or
  33. // capture time falls within the given range.
  34. void Clear(const base::Time& begin,