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

Unified Diff: content/browser/service_worker/service_worker_database.cc

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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_database.cc
diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc
index 9f1bc46069a7bd360b55c7390bd5a971127f5610..a1b48dfb33dbab5f52586dac83caf55c825c146b 100644
--- a/content/browser/service_worker/service_worker_database.cc
+++ b/content/browser/service_worker/service_worker_database.cc
@@ -277,11 +277,11 @@ const char* ServiceWorkerDatabase::StatusToString(
ServiceWorkerDatabase::RegistrationData::RegistrationData()
: registration_id(kInvalidServiceWorkerRegistrationId),
+ update_via_cache(blink::WebServiceWorkerUpdateViaCache::kImports),
version_id(kInvalidServiceWorkerVersionId),
is_active(false),
has_fetch_handler(false),
- resources_total_size_bytes(0) {
-}
+ resources_total_size_bytes(0) {}
ServiceWorkerDatabase::RegistrationData::RegistrationData(
const RegistrationData& other) = default;
@@ -1403,6 +1403,10 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ParseRegistrationData(
for (uint32_t feature : data.used_features())
out->used_features.insert(feature);
+ if (data.has_update_via_cache())
+ out->update_via_cache = static_cast<blink::WebServiceWorkerUpdateViaCache>(
+ data.update_via_cache());
+
return ServiceWorkerDatabase::STATUS_OK;
}
@@ -1452,6 +1456,9 @@ void ServiceWorkerDatabase::WriteRegistrationDataInBatch(
for (uint32_t feature : registration.used_features)
data.add_used_features(feature);
+ data.set_update_via_cache(
+ static_cast<uint32_t>(registration.update_via_cache));
+
std::string value;
bool success = data.SerializeToString(&value);
DCHECK(success);

Powered by Google App Engine
This is Rietveld 408576698