Chromium Code Reviews| Index: content/public/browser/service_worker_context.h |
| diff --git a/content/public/browser/service_worker_context.h b/content/public/browser/service_worker_context.h |
| index 47f355c734ae46b1a5e17b04968f898a526901c0..e8bb16a33e04d14c5937d4301c25739fa6b84f2e 100644 |
| --- a/content/public/browser/service_worker_context.h |
| +++ b/content/public/browser/service_worker_context.h |
| @@ -33,6 +33,9 @@ class ServiceWorkerContext { |
| typedef base::Callback<void(bool has_service_worker)> |
| CheckHasServiceWorkerCallback; |
| + typedef base::Callback<void(size_t external_request_count)> |
| + GetPendingExternalRequestCountCallback; |
| + |
| // Registers the header name which should not be passed to the ServiceWorker. |
| // Must be called from the IO thread. |
| CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent( |
| @@ -60,6 +63,15 @@ class ServiceWorkerContext { |
| const GURL& script_url, |
| const ResultCallback& callback) = 0; |
| + // Ref count mechanism for embedder to increment/decrement activity count of a |
| + // service worker. |
| + // Must be called from the IO thread. Returns whether or not changing the |
| + // activity count succeeded. |
| + virtual bool IncrementPendingActivity(int64_t service_worker_version_id, |
|
Devlin
2016/10/07 15:13:22
Drive-by: Since these are all associated with a sp
lazyboy
2016/10/07 18:50:10
OK, will do before sending out to content/public r
michaeln
2016/10/07 20:10:30
i was thinking a rename would be good too, maybe m
lazyboy
2016/10/07 21:28:41
Changed the names to reflect this is request inste
|
| + const std::string& request_uuid) = 0; |
| + virtual bool DecrementPendingActivity(int64_t service_worker_version_id, |
| + const std::string& request_uuid) = 0; |
| + |
| // Equivalent to calling navigator.serviceWorker.unregister(pattern) from a |
| // renderer, except that |pattern| is an absolute URL instead of relative to |
| // some current origin. |callback| is passed true when the JS promise is |
| @@ -96,6 +108,12 @@ class ServiceWorkerContext { |
| const GURL& other_url, |
| const CheckHasServiceWorkerCallback& callback) = 0; |
| + // Returns the pending activity count for the worker with the specified |
| + // |origin| via |callback|. |
| + virtual void GetPendingExternalRequestCountForTest( |
|
michaeln
2016/10/07 20:10:30
and this could be something like CountExternalRequ
lazyboy
2016/10/07 21:28:41
Done.
|
| + const GURL& origin, |
| + const GetPendingExternalRequestCountCallback& callback) = 0; |
| + |
| // Stops all running workers on the given |origin|. |
| // |
| // This function can be called from any thread. |