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

Unified Diff: content/browser/service_worker/service_worker_version.h

Issue 2689693003: Add a helper method to create SW SimpleEventCallbacks. (Closed)
Patch Set: Add a helper method to create SW SimpleEventCallbacks. Created 3 years, 10 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/service_worker/service_worker_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index f8f95eff88a97be3d681e9a1bebfb4d35c49b5d9..deaac57aa7bd3f66f567b6de5b62288fc436fbb1 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -73,6 +73,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
public EmbeddedWorkerInstance::Listener {
public:
using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>;
+ using SimpleEventCallback =
+ base::Callback<void(ServiceWorkerStatusCode, base::Time)>;
// Current version status; some of the status (e.g. INSTALLED and ACTIVATED)
// should be persisted unlike running status.
@@ -275,6 +277,10 @@ class CONTENT_EXPORT ServiceWorkerVersion
// was not found or the worker already terminated.
bool FinishExternalRequest(const std::string& request_uuid);
+ // Creates a callback that is to be used for marking simple events dispatched
+ // through the ServiceWorkerEventDispatcher as finished for the |request_id|.
+ SimpleEventCallback CreateSimpleEventCallback(int request_id);
+
// This must be called when the worker is running.
mojom::ServiceWorkerEventDispatcher* event_dispatcher() {
DCHECK(event_dispatcher_.is_bound());
@@ -424,13 +430,6 @@ class CONTENT_EXPORT ServiceWorkerVersion
return max_request_expiration_time_ - tick_clock_->NowTicks();
}
- // Callback function for simple events dispatched through mojo interface
- // mojom::ServiceWorkerEventDispatcher, once all simple events got dispatched
- // through mojo, OnSimpleEventResponse function could be removed.
- void OnSimpleEventFinished(int request_id,
- ServiceWorkerStatusCode status,
- base::Time dispatch_event_time);
-
// Returns the Navigation Preload support status of the service worker.
// - Origin Trial: Have an effective token.
// Command line
@@ -685,6 +684,13 @@ class CONTENT_EXPORT ServiceWorkerVersion
void DidSkipWaiting(int request_id);
+ // Callback function for simple events dispatched through mojo interface
+ // mojom::ServiceWorkerEventDispatcher. Use CreateSimpleEventCallback() to
+ // create a callback for a given |request_id|.
+ void OnSimpleEventFinished(int request_id,
+ ServiceWorkerStatusCode status,
+ base::Time dispatch_event_time);
+
void OnGetClientFinished(int request_id,
const ServiceWorkerClientInfo& client_info);

Powered by Google App Engine
This is Rietveld 408576698