From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <jeremya@chromium.org>
Date: Fri, 1 May 2020 18:25:59 -0700
Subject: upload_list: add LoadSync method

This allows synchronous loading of the upload list, which is required by
the crashReporter.getUploadedReports() API. The synchronous version is
deprecated, and this API should be removed once the deprecated behavior
is no longer supported.

diff --git a/components/upload_list/upload_list.cc b/components/upload_list/upload_list.cc
index 176f0b70225eab7d692886c241983c43d2e93b86..02e39bf0a6ba63c0a6226ba20e08a94b3df74611 100644
--- a/components/upload_list/upload_list.cc
+++ b/components/upload_list/upload_list.cc
@@ -65,6 +65,10 @@ void UploadList::Load(base::OnceClosure callback) {
       base::BindOnce(&UploadList::OnLoadComplete, this));
 }
 
+void UploadList::LoadSync() {
+  uploads_ = LoadUploadList();
+}
+
 void UploadList::Clear(const base::Time& begin,
                        const base::Time& end,
                        base::OnceClosure callback) {
diff --git a/components/upload_list/upload_list.h b/components/upload_list/upload_list.h
index b4f61f6de22efacec14fa0e6bb702bc6a6eedaaa..5096b558a431969aeb97be73990fda647147bfc0 100644
--- a/components/upload_list/upload_list.h
+++ b/components/upload_list/upload_list.h
@@ -82,6 +82,8 @@ class UploadList : public base::RefCountedThreadSafe<UploadList> {
   // overwrite the previously supplied one, and the first will not be called.
   void Load(base::OnceClosure callback);
 
+  void LoadSync();
+
   // Clears any data associated with the upload list, where the upload time or
   // capture time falls within the given range.
   void Clear(const base::Time& begin,
