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

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

Issue 2653493009: Add two interfaces for ServiceWorkerProviderContext/ProviderHost (Closed)
Patch Set: Skip unittest for CrossSiteTransfer when PlzNavigate Created 3 years, 7 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 ffac7fc35d06a88679b35621d00a05bae9302fce..82556e62939e90541ec655af0ec79f4950512e16 100644
--- a/content/child/service_worker/service_worker_network_provider.cc
+++ b/content/child/service_worker/service_worker_network_provider.cc
@@ -15,6 +15,7 @@
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "ipc/ipc_sync_channel.h"
+#include "mojo/public/cpp/bindings/associated_group.h"
#include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
@@ -176,14 +177,21 @@ ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
return;
if (!ChildThreadImpl::current())
return; // May be null in some tests.
- ServiceWorkerProviderHostInfo provider_info(
- provider_id_, route_id, provider_type, is_parent_frame_secure);
+
+ ServiceWorkerProviderHostInfo host_info(provider_id_, route_id, provider_type,
+ is_parent_frame_secure);
+ host_info.host_request = mojo::MakeRequest(&provider_host_);
+ mojom::ServiceWorkerProviderAssociatedRequest client_request =
+ mojo::MakeRequest(&host_info.client_ptr_info);
+
+ DCHECK(host_info.host_request.is_pending());
+ DCHECK(host_info.host_request.handle().is_valid());
context_ = new ServiceWorkerProviderContext(
- provider_id_, provider_type,
+ provider_id_, provider_type, std::move(client_request),
ChildThreadImpl::current()->thread_safe_sender());
ChildThreadImpl::current()->channel()->GetRemoteAssociatedInterface(
&dispatcher_host_);
- dispatcher_host_->OnProviderCreated(std::move(provider_info));
+ dispatcher_host_->OnProviderCreated(std::move(host_info));
}
ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider(
@@ -203,7 +211,7 @@ ServiceWorkerNetworkProvider::~ServiceWorkerNetworkProvider() {
return;
if (!ChildThreadImpl::current())
return; // May be null in some tests.
- dispatcher_host_->OnProviderDestroyed(provider_id());
+ provider_host_.reset();
}
void ServiceWorkerNetworkProvider::SetServiceWorkerVersionId(

Powered by Google App Engine
This is Rietveld 408576698