[Background Fetch] Initialize context with pending fetches.
Create JobControllers with the incomplete fetches on startup.
Bug: 853058
Change-Id: Iaaed4d4cab5cf86e7cc89fb00ce5eceb6778ce5f
Reviewed-on: https://chromium-review.googlesource.com/1103157
Commit-Queue: Rayan Kanso <[email protected]>
Reviewed-by: Peter Beverloo <[email protected]>
Cr-Commit-Position: refs/heads/master@{#572981}
diff --git a/content/browser/background_fetch/background_fetch_context.h b/content/browser/background_fetch/background_fetch_context.h
index 9a1f817..cd70bd5c 100644
--- a/content/browser/background_fetch/background_fetch_context.h
+++ b/content/browser/background_fetch/background_fetch_context.h
@@ -15,6 +15,7 @@
#include "base/memory/weak_ptr.h"
#include "content/browser/background_fetch/background_fetch_delegate_proxy.h"
#include "content/browser/background_fetch/background_fetch_event_dispatcher.h"
+#include "content/browser/background_fetch/storage/get_initialization_data_task.h"
#include "content/browser/service_worker/service_worker_context_core_observer.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
@@ -54,7 +55,6 @@
const scoped_refptr<content::CacheStorageContextImpl>&
cache_storage_context);
- // Adds service worker context observer and initializes |data_manager_|.
void InitializeOnIOThread();
// Called by the StoragePartitionImpl destructor.
@@ -134,17 +134,11 @@
const BackgroundFetchRegistrationId& registration_id,
const BackgroundFetchOptions& options,
const SkBitmap& icon,
+ size_t num_completed_requests,
size_t num_requests,
+ const std::vector<std::string>& outstanding_guids,
std::unique_ptr<BackgroundFetchRegistration> registration);
- // Initializes the new Job Controller.
- void InitializeController(
- const std::string& unique_id,
- std::unique_ptr<BackgroundFetchJobController> controller,
- std::unique_ptr<BackgroundFetchRegistration> registration,
- size_t total_downloads,
- size_t completed_downloads);
-
// Called when an existing registration has been retrieved from the data
// manager. If the registration does not exist then |registration| is nullptr.
void DidGetRegistration(
@@ -195,6 +189,12 @@
// with |unique_id| is activated.
void DispatchClickEvent(const std::string& unique_id);
+ // Called when the data manager finishes getting the initialization data.
+ void DidGetInitializationData(
+ blink::mojom::BackgroundFetchError error,
+ std::vector<background_fetch::BackgroundFetchInitializationData>
+ initialization_data);
+
// Called when all processing for the |registration_id| has been finished and
// the job is ready to be deleted. |blob_handles| are unused, but some callers
// use it to keep blobs alive for the right duration.