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

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

Issue 2638313002: Manage ServiceWorkerDispatcherHost in ServiceWorkerContextCore (Closed)
Patch Set: Fix an include guard Created 3 years, 10 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 3ed67ba33f4abb82da49716386d9da2e94b86508..d812727470a5d787035c49d9ed8205a28a27bbda 100644
--- a/content/browser/service_worker/service_worker_provider_host.h
+++ b/content/browser/service_worker/service_worker_provider_host.h
@@ -20,6 +20,7 @@
#include "base/memory/weak_ptr.h"
#include "content/browser/service_worker/service_worker_registration.h"
#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/public/common/request_context_frame_type.h"
#include "content/public/common/request_context_type.h"
@@ -71,22 +72,15 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
bool are_ancestors_secure,
const WebContentsGetter& web_contents_getter);
- enum class FrameSecurityLevel { UNINITIALIZED, INSECURE, SECURE };
+ // Used to create a ServiceWorkerProviderHost when the renderer-side provider
+ // is created. This ProviderHost will be created for the process specified by
+ // |process_id|.
+ static std::unique_ptr<ServiceWorkerProviderHost> Create(
+ int process_id,
+ ServiceWorkerProviderHostInfo info,
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ ServiceWorkerDispatcherHost* dispatcher_host);
- // When this provider host is for a Service Worker context, |route_id| is
- // MSG_ROUTING_NONE. When this provider host is for a Document,
- // |route_id| is the frame ID of the Document. When this provider host is for
- // a Shared Worker, |route_id| is the Shared Worker route ID.
- // |provider_type| gives additional information whether the provider is
- // created for controller (ServiceWorker) or controllee (Document or
- // SharedWorker).
- ServiceWorkerProviderHost(int render_process_id,
- int route_id,
- int provider_id,
- ServiceWorkerProviderType provider_type,
- FrameSecurityLevel parent_frame_security_level,
- base::WeakPtr<ServiceWorkerContextCore> context,
- ServiceWorkerDispatcherHost* dispatcher_host);
virtual ~ServiceWorkerProviderHost();
const std::string& client_uuid() const { return client_uuid_; }
@@ -98,15 +92,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
return web_contents_getter_;
}
- bool is_parent_frame_secure() const {
- return parent_frame_security_level_ == FrameSecurityLevel::SECURE;
- }
- void set_parent_frame_secure(bool is_parent_frame_secure) {
- CHECK_EQ(parent_frame_security_level_, FrameSecurityLevel::UNINITIALIZED);
- parent_frame_security_level_ = is_parent_frame_secure
- ? FrameSecurityLevel::SECURE
- : FrameSecurityLevel::INSECURE;
- }
+ bool is_parent_frame_secure() const { return is_parent_frame_secure_; }
// Returns whether this provider host is secure enough to have a service
// worker controller.
@@ -247,7 +233,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
bool GetRegistrationForReady(const GetRegistrationForReadyCallback& callback);
// Methods to support cross site navigations.
- void PrepareForCrossSiteTransfer();
+ std::unique_ptr<ServiceWorkerProviderHost> PrepareForCrossSiteTransfer();
void CompleteCrossSiteTransfer(
int new_process_id,
int new_frame_id,
@@ -324,6 +310,14 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
~OneShotGetReadyCallback();
};
+ ServiceWorkerProviderHost(int render_process_id,
+ int route_id,
+ int provider_id,
+ ServiceWorkerProviderType provider_type,
+ bool is_parent_frame_secure,
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ ServiceWorkerDispatcherHost* dispatcher_host);
+
// ServiceWorkerRegistration::Listener overrides.
void OnVersionAttributesChanged(
ServiceWorkerRegistration* registration,
@@ -383,7 +377,7 @@ class CONTENT_EXPORT ServiceWorkerProviderHost
WebContentsGetter web_contents_getter_;
ServiceWorkerProviderType provider_type_;
- FrameSecurityLevel parent_frame_security_level_;
+ const bool is_parent_frame_secure_;
GURL document_url_;
GURL topmost_frame_url_;

Powered by Google App Engine
This is Rietveld 408576698