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

Unified Diff: content/child/service_worker/service_worker_network_provider.cc

Issue 2638313002: Manage ServiceWorkerDispatcherHost in ServiceWorkerContextCore (Closed)
Patch Set: Remove a break line 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/child/service_worker/service_worker_network_provider.cc
diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc
index 9e36b7d41cdabc50f686860e94e39510a721abf3..3dfbf300e4b7a2ad50a48ddc0d82b6e2bde0d900 100644
--- a/content/child/service_worker/service_worker_network_provider.cc
+++ b/content/child/service_worker/service_worker_network_provider.cc
@@ -9,6 +9,7 @@
#include "content/child/service_worker/service_worker_provider_context.h"
#include "content/common/navigation_params.h"
#include "content/common/service_worker/service_worker_messages.h"
+#include "content/common/service_worker/service_worker_provider.h"
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "ipc/ipc_sync_channel.h"
@@ -126,18 +127,14 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
return;
if (!ChildThreadImpl::current())
return; // May be null in some tests.
+ ServiceWorkerProviderHostInfo host_info(provider_id_, route_id, provider_type,
+ is_parent_frame_secure);
context_ = new ServiceWorkerProviderContext(
provider_id_, provider_type,
ChildThreadImpl::current()->thread_safe_sender());
- if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) {
- ChildThreadImpl::current()->channel()->GetRemoteAssociatedInterface(
- &dispatcher_host_);
- dispatcher_host_->OnProviderCreated(provider_id_, route_id, provider_type,
- is_parent_frame_secure);
- } else {
- ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_ProviderCreated(
- provider_id_, route_id, provider_type, is_parent_frame_secure));
- }
+ ChildThreadImpl::current()->channel()->GetRemoteAssociatedInterface(
+ &dispatcher_host_);
+ dispatcher_host_->OnProviderCreated(std::move(host_info));
}
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
@@ -157,12 +154,7 @@ ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() {
return;
if (!ChildThreadImpl::current())
return; // May be null in some tests.
- if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) {
falken 2017/02/08 06:53:51 BTW, do we still need this function to exist?
shimazu 2017/02/13 03:25:56 Yes, we do. IsMojoForServiceWorkerEnabled is still
- dispatcher_host_->OnProviderDestroyed(provider_id());
- } else {
- ChildThreadImpl::current()->Send(
- new ServiceWorkerHostMsg_ProviderDestroyed(provider_id_));
- }
+ dispatcher_host_->OnProviderDestroyed(provider_id());
}
void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId(
@@ -171,13 +163,8 @@ void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId(
DCHECK_NE(kInvalidServiceWorkerProviderId, provider_id_);
if (!ChildThreadImpl::current())
return; // May be null in some tests.
- if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) {
- dispatcher_host_->OnSetHostedVersionId(provider_id(), version_id,
- embedded_worker_id);
- } else {
- ChildThreadImpl::current()->Send(new ServiceWorkerHostMsg_SetVersionId(
- provider_id_, version_id, embedded_worker_id));
- }
+ dispatcher_host_->OnSetHostedVersionId(provider_id(), version_id,
+ embedded_worker_id);
}
bool ServiceWorkerNetworkProvider::IsControlledByServiceWorker() const {

Powered by Google App Engine
This is Rietveld 408576698