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

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

Issue 1411953002: Store foreign fetch scopes in database with other SW information. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@foreign-fetch-interface
Patch Set: address nhiroki's comments Created 5 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_storage.h
diff --git a/content/browser/service_worker/service_worker_storage.h b/content/browser/service_worker/service_worker_storage.h
index 7c82915cba2e75885bb7fd072d00e41db14b13eb..23f1af7b843459e692ee7943785fd226bfaef492 100644
--- a/content/browser/service_worker/service_worker_storage.h
+++ b/content/browser/service_worker/service_worker_storage.h
@@ -177,6 +177,10 @@ class CONTENT_EXPORT ServiceWorkerStorage
const std::string& key,
const GetUserDataForAllRegistrationsCallback& callback);
+ // Returns true if any service workers at |origin| have registered for foreign
+ // fetch.
+ bool OriginHasForeignFetchRegistrations(const GURL& origin);
+
// Deletes the storage and starts over.
void DeleteAndStartOver(const StatusCallback& callback);
@@ -249,6 +253,7 @@ class CONTENT_EXPORT ServiceWorkerStorage
std::set<GURL> origins;
bool disk_cache_migration_needed;
bool old_disk_cache_deletion_needed;
+ std::set<GURL> foreign_fetch_origins;
InitialData();
~InitialData();
@@ -264,6 +269,16 @@ class CONTENT_EXPORT ServiceWorkerStorage
~DidDeleteRegistrationParams();
};
+ enum class OriginState {
+ // Other registrations with foreign fetch scopes exist for the origin.
+ KEEP_ALL,
+ // Other registrations exist at this origin, but none of them have foreign
+ // fetch scopes.
+ DELETE_FROM_FOREIGN_FETCH,
+ // No other registrations exist at this origin.
+ DELETE_FROM_ALL
+ };
+
typedef std::vector<ServiceWorkerDatabase::RegistrationData> RegistrationList;
typedef std::map<int64, scoped_refptr<ServiceWorkerRegistration> >
RegistrationRefsById;
@@ -278,7 +293,7 @@ class CONTENT_EXPORT ServiceWorkerStorage
const std::vector<int64>& newly_purgeable_resources,
ServiceWorkerDatabase::Status status)> WriteRegistrationCallback;
typedef base::Callback<void(
- bool origin_is_deletable,
+ OriginState origin_state,
const ServiceWorkerDatabase::RegistrationData& deleted_version_data,
const std::vector<int64>& newly_purgeable_resources,
ServiceWorkerDatabase::Status status)> DeleteRegistrationCallback;
@@ -357,7 +372,7 @@ class CONTENT_EXPORT ServiceWorkerStorage
ServiceWorkerDatabase::Status status);
void DidDeleteRegistration(
const DidDeleteRegistrationParams& params,
- bool origin_is_deletable,
+ OriginState origin_state,
const ServiceWorkerDatabase::RegistrationData& deleted_version,
const std::vector<int64>& newly_purgeable_resources,
ServiceWorkerDatabase::Status status);
@@ -494,6 +509,7 @@ class CONTENT_EXPORT ServiceWorkerStorage
// Origins having registations.
std::set<GURL> registered_origins_;
+ std::set<GURL> foreign_fetch_origins_;
// Pending database tasks waiting for initialization.
std::vector<base::Closure> pending_tasks_;

Powered by Google App Engine
This is Rietveld 408576698