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

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

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments from falken@ Created 4 years, 2 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_context_wrapper.h
diff --git a/content/browser/service_worker/service_worker_context_wrapper.h b/content/browser/service_worker/service_worker_context_wrapper.h
index 12c8b7220cd833464c774c76357a7bb6408573c5..82c9c73bf5ba48f81f410e67026bf71fbef8c01f 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.h
+++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -112,6 +112,10 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
blink::WebNavigationHintType type,
int render_process_id,
const ResultCallback& callback) override;
+ bool IncrementPendingActivity(int64_t service_worker_version_id,
+ const std::string& request_uuid) override;
+ bool DecrementPendingActivity(int64_t service_worker_version_id,
+ const std::string& request_uuid) override;
// These methods must only be called from the IO thread.
ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id);
@@ -196,6 +200,7 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
friend class EmbeddedWorkerTestHelper;
friend class EmbeddedWorkerBrowserTest;
+ friend class ServiceWorkerContext;
michaeln 2016/10/05 19:22:53 is this needed?
lazyboy 2016/10/06 01:02:06 Not anymore, removed.
friend class ServiceWorkerDispatcherHost;
friend class ServiceWorkerInternalsUI;
friend class ServiceWorkerNavigationHandleCore;
@@ -256,6 +261,17 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
const ResultCallback& callback,
bool result);
+ void ExternalRequestErrorCallback(int64_t service_worker_version_id,
Devlin 2016/10/05 17:02:25 drive-by: function comment?
lazyboy 2016/10/06 01:02:06 Obsolete now with new patch.
+ const std::string& request_uuid,
+ ServiceWorkerStatusCode status);
+
+ // Removes a pending external request identified by |request_uuid|.
+ // Returns true if the request was found. Also returns |request_id| in that
+ // case.
+ bool RemovePendingExternalRequest(int64_t service_worker_version_id,
+ const std::string& request_uuid,
+ int* request_id);
+
// The core context is only for use on the IO thread.
// Can be null before/during init, during/after shutdown, and after
// DeleteAndStartOver fails.
@@ -279,6 +295,13 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
// Must be touched on the UI thread.
std::map<int, int> navigation_hint_task_count_per_process_;
+ // Container for pending external requests of a service worker.
+ // Each request is (key, value): (request uuid, request id).
+ using RequestUUIDToRequestID = std::map<std::string, int>;
+ // Maps service worker version id -> RequestUUIDToRequestID.
+ // IO thread.
+ std::map<int64_t, RequestUUIDToRequestID> pending_external_requests_;
michaeln 2016/10/05 19:22:53 Please consider moving this mapping of external_re
lazyboy 2016/10/06 01:02:06 Done.
+
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper);
};

Powered by Google App Engine
This is Rietveld 408576698