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

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

Issue 1757023003: Document confusing threading requirements in ServiceWorkerContext(Wrapper). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_wrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ef83f7911264d315fc5860f71d1689fd3f5287e9..c99340c6d462837da05cacce5476a6498125547b 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.h
+++ b/content/browser/service_worker/service_worker_context_wrapper.h
@@ -102,11 +102,13 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
void StopAllServiceWorkersForOrigin(const GURL& origin) override;
void ClearAllServiceWorkersForTest(const base::Closure& callback) override;
+ // These methods must only be called from the IO thread.
ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id);
ServiceWorkerVersion* GetLiveVersion(int64_t version_id);
std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo();
std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo();
+ // Must be called from the IO thread.
void HasMainFrameProviderHost(const GURL& origin,
const BoolCallback& callback) const;
@@ -119,6 +121,8 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
// - If the registration does not have the active version but has the waiting
// version, activates the waiting version and runs |callback| when it is
// activated.
+ //
+ // Must be called from the IO thread.
void FindReadyRegistrationForDocument(
const GURL& document_url,
const FindRegistrationCallback& callback);
@@ -132,10 +136,13 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
// - If the registration does not have the active version but has the waiting
// version, activates the waiting version and runs |callback| when it is
// activated.
+ //
+ // Must be called from the IO thread.
void FindReadyRegistrationForId(int64_t registration_id,
const GURL& origin,
const FindRegistrationCallback& callback);
+ // All these methods must be called from the IO thread.
void GetAllRegistrations(const GetRegistrationsInfosCallback& callback);
void GetRegistrationUserData(int64_t registration_id,
const std::string& key,
@@ -152,7 +159,11 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
const std::string& key,
const GetUserDataForAllRegistrationsCallback& callback);
+ // This function can be called from any thread, but the callback will always
+ // be called on the UI thread.
void StartServiceWorker(const GURL& pattern, const StatusCallback& callback);
+
+ // These methods can be called from any thread.
void UpdateRegistration(const GURL& pattern);
void SetForceUpdateOnPageLoad(int64_t registration_id,
bool force_update_on_page_load);
@@ -161,6 +172,7 @@ class CONTENT_EXPORT ServiceWorkerContextWrapper
bool is_incognito() const { return is_incognito_; }
+ // Must be called from the IO thread.
bool OriginHasForeignFetchRegistrations(const GURL& origin);
private:
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698