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

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: send increment/decrement request from renderer/ process Created 4 years, 3 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..d8ac7a22c97746718e7699b9b80f5c5d5fd874b8 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.h
+++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -112,6 +112,8 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
blink::WebNavigationHintType type,
int render_process_id,
const ResultCallback& callback) override;
+ bool IncrementPendingActivity(int64_t service_worker_version_id) override;
+ bool DecrementPendingActivity(int64_t service_worker_version_id) override;
// These methods must only be called from the IO thread.
ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id);
@@ -196,6 +198,7 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>;
friend class EmbeddedWorkerTestHelper;
friend class EmbeddedWorkerBrowserTest;
+ friend class ServiceWorkerContext;
friend class ServiceWorkerDispatcherHost;
friend class ServiceWorkerInternalsUI;
friend class ServiceWorkerNavigationHandleCore;
@@ -206,6 +209,9 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
~ServiceWorkerContextWrapper() override;
+ bool IncrementPendingActivityOnIO(int64_t service_worker_version_id);
+ bool DecrementPendingActivityOnIO(int64_t service_worker_version_id);
+
void InitInternal(
const base::FilePath& user_data_directory,
std::unique_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager,
@@ -279,6 +285,10 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
// Must be touched on the UI thread.
std::map<int, int> navigation_hint_task_count_per_process_;
+ // Maps service worker version id -> set of pending request ids.
+ // IO thread.
+ std::map<int64_t, std::set<int>> pending_external_requests_;
+
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper);
};

Powered by Google App Engine
This is Rietveld 408576698