Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: content/browser/background_fetch/background_fetch_context.h

Issue 2786783002: Dispatch a bare Service Worker event for a finished Background Fetch (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/background_fetch/background_fetch_context.h
diff --git a/content/browser/background_fetch/background_fetch_context.h b/content/browser/background_fetch/background_fetch_context.h
index e7d959cc9399197e9b0fef10dadb875b01e83b96..e4d6ac5bd25a2b296ef6a62908d7c63495c20936 100644
--- a/content/browser/background_fetch/background_fetch_context.h
+++ b/content/browser/background_fetch/background_fetch_context.h
@@ -26,10 +26,12 @@ class Origin;
namespace content {
class BackgroundFetchDataManager;
+class BackgroundFetchEventDispatcher;
class BackgroundFetchJobController;
struct BackgroundFetchOptions;
class BackgroundFetchRegistrationId;
class BackgroundFetchRequestInfo;
+class BlobHandle;
class BrowserContext;
class DownloadManager;
class ServiceWorkerContextWrapper;
@@ -46,10 +48,9 @@ class CONTENT_EXPORT BackgroundFetchContext
public:
// The BackgroundFetchContext will watch the ServiceWorkerContextWrapper so
// that it can respond to service worker events such as unregister.
- BackgroundFetchContext(
- BrowserContext* browser_context,
- StoragePartitionImpl* storage_partition,
- const scoped_refptr<ServiceWorkerContextWrapper>& context);
+ BackgroundFetchContext(BrowserContext* browser_context,
+ StoragePartitionImpl* storage_partition,
+ scoped_refptr<ServiceWorkerContextWrapper> context);
// Shutdown must be called before deleting this. Call on the UI thread.
void Shutdown();
@@ -100,17 +101,29 @@ class CONTENT_EXPORT BackgroundFetchContext
blink::mojom::BackgroundFetchError error,
std::vector<BackgroundFetchRequestInfo> initial_requests);
- // Called when a the given |controller| has finished processing its job.
+ // Called when the given |controller| has finished processing its job.
void DidCompleteJob(BackgroundFetchJobController* controller);
+ // Called when the sequence of settled fetches for |registration_id| have been
+ // retrieved from storage, and the Service Worker event can be invoked.
+ void DidGetSettledFetches(
+ const BackgroundFetchRegistrationId& registration_id,
+ blink::mojom::BackgroundFetchError error,
+ std::vector<BackgroundFetchSettledFetch> settled_fetches,
+ std::vector<std::unique_ptr<BlobHandle>> blob_handles);
+
+ // Called when all processing for the |registration_id| has been finished and
+ // the job, including its associated data, is ready to be deleted.
+ void DeleteRegistration(const BackgroundFetchRegistrationId& registration_id);
+
// |this| is owned, indirectly, by the BrowserContext.
BrowserContext* browser_context_;
DownloadManager* download_manager_;
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
- std::unique_ptr<BackgroundFetchDataManager> background_fetch_data_manager_;
+ std::unique_ptr<BackgroundFetchDataManager> data_manager_;
+ std::unique_ptr<BackgroundFetchEventDispatcher> event_dispatcher_;
// Map of the Background Fetch fetches that are currently in-progress.
std::map<BackgroundFetchRegistrationId,

Powered by Google App Engine
This is Rietveld 408576698