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

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

Issue 2376403004: Store Origin-Trial tokens to ServiceWorkerDataBase (Closed)
Patch Set: incorporated iclelland's comment Created 4 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_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index 5026700bcbe09f5a78f3a83a27c1700d9fe29a70..39ced7a0f2d5b8610b875a14eab6a271067756e1 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -33,6 +33,7 @@
#include "content/browser/service_worker/service_worker_metrics.h"
#include "content/browser/service_worker/service_worker_script_cache_map.h"
#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 "ipc/ipc_message.h"
@@ -353,6 +354,19 @@ class CONTENT_EXPORT ServiceWorkerVersion
pause_after_download_ = pause_after_download;
}
+ // Returns nullptr if the main script is not loaded yet and:
+ // 1) The worker is a new one.
+ // OR
+ // 2) The worker is an existing one but the entry in ServiceWorkerDatabase
+ // was written by old version of Chrome (< M56), so |origin_trial_tokens|
+ // wasn't set in the entry.
+ const TrialTokenValidator::FeatureToTokensMap* origin_trial_tokens() const {
+ return origin_trial_tokens_.get();
+ }
+ // Set valid tokens in |tokens|. Invalid tokens in |tokens| are ignored.
+ void SetValidOriginTrialTokens(
+ const TrialTokenValidator::FeatureToTokensMap& tokens);
+
void SetDevToolsAttached(bool attached);
// Sets the HttpResponseInfo used to load the main script.
@@ -748,6 +762,8 @@ class CONTENT_EXPORT ServiceWorkerVersion
std::vector<int> pending_skip_waiting_requests_;
std::unique_ptr<net::HttpResponseInfo> main_script_http_info_;
+ std::unique_ptr<TrialTokenValidator::FeatureToTokensMap> origin_trial_tokens_;
+
// If not OK, the reason that StartWorker failed. Used for
// running |start_callbacks_|.
ServiceWorkerStatusCode start_worker_status_ = SERVICE_WORKER_OK;

Powered by Google App Engine
This is Rietveld 408576698