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

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

Issue 2118243002: [proof-of-concept] SW thread independent of the main thread Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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 472ebe28ffd72766d4dec9ccb93f9e1fcd5a0263..105ce3774ab592408d7183f69c52ae2ee0c5f8f2 100644
--- a/content/browser/service_worker/service_worker_context_core.h
+++ b/content/browser/service_worker/service_worker_context_core.h
@@ -16,6 +16,7 @@
#include "base/files/file_path.h"
#include "base/id_map.h"
#include "base/macros.h"
+#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "content/browser/service_worker/service_worker_info.h"
@@ -25,6 +26,7 @@
#include "content/browser/service_worker/service_worker_storage.h"
#include "content/common/content_export.h"
#include "content/public/browser/service_worker_context.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker.mojom.h"
class GURL;
@@ -50,6 +52,7 @@ class ServiceWorkerJobCoordinator;
class ServiceWorkerNavigationHandleCore;
class ServiceWorkerProviderHost;
class ServiceWorkerRegistration;
+class ServiceWorkerServiceImpl;
class ServiceWorkerStorage;
// This class manages data associated with service workers.
@@ -287,6 +290,14 @@ class CONTENT_EXPORT ServiceWorkerContextCore
// version. The count resets to zero when the worker successfully starts.
int GetVersionFailureCount(int64_t version_id);
+ // Create a ServiceWorkerServiceImpl that is owned by this. Call on the IO
+ // thread.
+ void CreateService(
+ mojo::InterfaceRequest<blink::mojom::ServiceWorkerService> request);
+ // Called by ServiceWorkerServiceImpl objects so that they can
+ // be deleted. Call on the IO thread.
+ void ServiceHadConnectionError(ServiceWorkerServiceImpl* service);
+
base::WeakPtr<ServiceWorkerContextCore> AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
@@ -367,6 +378,12 @@ class CONTENT_EXPORT ServiceWorkerContextCore
bool was_service_worker_registered_;
scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>>
observer_list_;
+
+ // The services are owned by this. They're either deleted
+ // during the destructor or when the channel is closed via
+ // ServiceHadConnectionError. Only accessed on the IO thread.
+ std::unique_ptr<ScopedVector<ServiceWorkerServiceImpl>> services_;
+
base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore);

Powered by Google App Engine
This is Rietveld 408576698