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

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

Issue 1257553002: [Proof-of-concept] PlzNavigate and Service Worker Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass navigation_provider_id Created 5 years, 5 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.h
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h
index ecffaca878c414174b0822effb9f8cd1e1c12c04..358790b2565cdec27dd5552ca1455127933d1b00 100644
--- a/content/browser/service_worker/service_worker_context_core.h
+++ b/content/browser/service_worker/service_worker_context_core.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/containers/scoped_ptr_hash_map.h"
#include "base/files/file_path.h"
#include "base/id_map.h"
#include "base/memory/scoped_ptr.h"
@@ -65,6 +66,8 @@ class CONTENT_EXPORT ServiceWorkerContextCore
using ProviderByClientUUIDMap =
std::map<std::string, ServiceWorkerProviderHost*>;
+ using NavigationProviderHostMap =
+ base::ScopedPtrHashMap<int, scoped_ptr<ServiceWorkerProviderHost>>;
// Directory for ServiceWorkerStorage and ServiceWorkerCacheManager.
static const base::FilePath::CharType kServiceWorkerDirectory[];
@@ -156,6 +159,14 @@ class CONTENT_EXPORT ServiceWorkerContextCore
scoped_ptr<ProviderHostIterator> GetClientProviderHostIterator(
const GURL& origin);
+ // PlzNavigate:
+ // Creates a new ProviderHost for browser side navitgation.
+ scoped_ptr<ServiceWorkerProviderHost> CreateNavigationProviderHost();
+ void RegisterNavigationProviderHost(
+ scoped_ptr<ServiceWorkerProviderHost> provider_host);
+ scoped_ptr<ServiceWorkerProviderHost> TakeNavigationProviderHost(
+ int navigation_provider_id);
+
// Maintains a map from Client UUID to ProviderHost.
// (Note: instead of maintaining 2 maps we might be able to uniformly use
// UUID instead of process_id+provider_id elsewhere. For now I'm leaving
@@ -267,8 +278,11 @@ class CONTENT_EXPORT ServiceWorkerContextCore
std::map<int64, ServiceWorkerRegistration*> live_registrations_;
std::map<int64, ServiceWorkerVersion*> live_versions_;
std::map<int64, scoped_refptr<ServiceWorkerVersion>> protected_versions_;
+
+ NavigationProviderHostMap navigation_provider_host_map_;
int next_handle_id_;
int next_registration_handle_id_;
+ int next_navigation_provider_host_id_;
scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>>
observer_list_;
base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698