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

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

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 8 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_provider_host.h
diff --git a/content/browser/service_worker/service_worker_provider_host.h b/content/browser/service_worker/service_worker_provider_host.h
index 585bc591b6ffc705fd4da1733201cb3391e6e761..f8ab188a30f7b2cbc61f1e0927dbe8f6e621b3e4 100644
--- a/content/browser/service_worker/service_worker_provider_host.h
+++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -12,6 +12,7 @@
#include <memory>
#include <set>
#include <string>
+#include <unordered_map>
#include <vector>
#include "base/gtest_prod_util.h"
@@ -22,6 +23,7 @@
#include "content/common/content_export.h"
#include "content/common/service_worker/service_worker_provider_host_info.h"
#include "content/common/service_worker/service_worker_types.h"
+#include "content/common/worker_url_loader_factory_provider.mojom.h"
#include "content/public/common/request_context_frame_type.h"
#include "content/public/common/request_context_type.h"
#include "content/public/common/resource_type.h"
@@ -285,6 +287,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
// cache.
void NotifyControllerLost();
+ // Binds the ServiceWorkerWorkerClient of a dedicated (or shared) worker to
+ // the parent frame's ServiceWorkerProviderHost. (This is used only when
+ // off-main-thread-fetch is enabled.)
+ void BindWorkerFetchContext(
+ mojom::ServiceWorkerWorkerClientAssociatedPtrInfo client_ptr_info);
+
private:
friend class ForeignFetchRequestHandlerTest;
friend class LinkHeaderServiceWorkerTest;
@@ -361,6 +369,10 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
int frame_routing_id,
ServiceWorkerDispatcherHost* dispatcher_host);
+ // Clears the information of the ServiceWorkerWorkerClient of dedicated (or
+ // shared) worker, when the connection to the worker is disconnected.
+ void UnregisterWorkerFetchContext(mojom::ServiceWorkerWorkerClient*);
+
std::string client_uuid_;
int render_process_id_;
@@ -406,6 +418,12 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
std::vector<base::Closure> queued_events_;
+ // Keeps ServiceWorkerWorkerClient pointers of dedicated or shared workers
+ // which are associated with the ServiceWorkerProviderHost.
+ std::unordered_map<mojom::ServiceWorkerWorkerClient*,
+ mojom::ServiceWorkerWorkerClientAssociatedPtr>
+ worker_clients_;
+
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost);
};

Powered by Google App Engine
This is Rietveld 408576698