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

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

Issue 1399363004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Kinuko'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_context_core.cc
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc
index 45f0a2dcc939c8c0660090efc782a0afd81be459..ec97d0146f854c87a28beb1392eb0780807e1dda 100644
--- a/content/browser/service_worker/service_worker_context_core.cc
+++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -517,6 +517,33 @@ ServiceWorkerVersion* ServiceWorkerContextCore::GetLiveVersion(
return (it != live_versions_.end()) ? it->second : NULL;
}
+// PlzNavigate
+void ServiceWorkerContextCore::AddNavigationHandleCore(
+ int service_worker_provider_id,
+ ServiceWorkerNavigationHandleCore* handle) {
+ auto result = navigation_handle_cores_map_.insert(
+ std::pair<int, ServiceWorkerNavigationHandleCore*>(
+ service_worker_provider_id, handle));
+ DCHECK(result.second)
+ << "Inserting a duplicate ServiceWorkerNavigationHandleCore";
+}
+
+// PlzNavigate
+void ServiceWorkerContextCore::RemoveNavigationHandleCore(
+ int service_worker_provider_id) {
+ navigation_handle_cores_map_.erase(service_worker_provider_id);
+}
+
+// PlzNavigate
+ServiceWorkerNavigationHandleCore*
+ServiceWorkerContextCore::GetNavigationHandleCore(
+ int service_worker_provider_id) {
+ auto result = navigation_handle_cores_map_.find(service_worker_provider_id);
+ if (result == navigation_handle_cores_map_.end())
+ return nullptr;
+ return result->second;
+}
+
void ServiceWorkerContextCore::AddLiveVersion(ServiceWorkerVersion* version) {
// TODO(horo): If we will see crashes here, we have to find the root cause of
// the version ID conflict. Otherwise change CHECK to DCHECK.

Powered by Google App Engine
This is Rietveld 408576698