From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp 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 c5c8119703c245132433f95fbd3764cfff41f8c3..9aa707d8b13b9c91a21ff5f38e680a7f6446503c 100644 --- a/components/upload_list/upload_list.cc +++ b/components/upload_list/upload_list.cc @@ -72,6 +72,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 c9dee47c8bb0917cd662d0565702890e953cdeea..b914d133df43fc2458af111a4dc83285bfc1aa02 100644 --- a/components/upload_list/upload_list.h +++ b/components/upload_list/upload_list.h @@ -75,6 +75,8 @@ class UploadList : public base::RefCountedThreadSafe { // 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,