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

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

Issue 2521793004: service worker: Persist NavigationPreloadState (Closed)
Patch Set: expect_ name Created 4 years, 1 month 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.h
diff --git a/content/browser/service_worker/service_worker_database.h b/content/browser/service_worker/service_worker_database.h
index d3a622f6f9b64c36211cc11cb2e73b905e8598aa..2a609d9353336bf40b642ffcf511013b49ac8ed9 100644
--- a/content/browser/service_worker/service_worker_database.h
+++ b/content/browser/service_worker/service_worker_database.h
@@ -22,6 +22,7 @@
#include "content/common/content_export.h"
#include "content/common/origin_trials/trial_token_validator.h"
#include "content/common/service_worker/service_worker_status_code.h"
+#include "content/common/service_worker/service_worker_types.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -73,6 +74,7 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
std::vector<GURL> foreign_fetch_scopes;
std::vector<url::Origin> foreign_fetch_origins;
base::Optional<TrialTokenValidator::FeatureToTokensMap> origin_trial_tokens;
+ NavigationPreloadState navigation_preload_state;
// Not populated until ServiceWorkerStorage::StoreRegistration is called.
int64_t resources_total_size_bytes;
@@ -164,6 +166,15 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
const GURL& origin,
const base::Time& time);
+ // Updates the navigation preload state for the specified registration.
+ // Returns OK if it's successfully updated. Otherwise, returns an error.
+ Status UpdateNavigationPreloadEnabled(int64_t registration_id,
+ const GURL& origin,
+ bool enable);
+ Status UpdateNavigationPreloadHeader(int64_t registration_id,
+ const GURL& origin,
+ const std::string& value);
+
// Deletes a registration for |registration_id| and moves resource records
// associated with it into the purgeable list. If deletion occurred, sets
// |version_id| to the id of the version that was deleted and
@@ -271,6 +282,8 @@ class CONTENT_EXPORT ServiceWorkerDatabase {
const std::string& serialized,
RegistrationData* out);
+ // Populates |batch| with operations to write |registration|. It does not
+ // actually write to db yet.
void WriteRegistrationDataInBatch(const RegistrationData& registration,
leveldb::WriteBatch* batch);

Powered by Google App Engine
This is Rietveld 408576698