Commit cc50eb2e authored by Mohamed Abdelhalim's avatar Mohamed Abdelhalim Committed by Commit Bot

Navigation: Move |service_worker_handle_| from NavigationHandleImpl.

This includes removing the related functions, and in-lining them in
NavigationRequest instead.

Bug: 916537
Change-Id: I6c7ca57d533a43067607dc761469738702374669
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720835Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarLowell Manners <lowell@chromium.org>
Commit-Queue: Mohamed Abdelhalim <zetamoo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681757}
parent 50b96770
......@@ -395,12 +395,6 @@ const net::ProxyServer& NavigationHandleImpl::GetProxyServer() {
return navigation_request_->proxy_server();
}
void NavigationHandleImpl::InitServiceWorkerHandle(
ServiceWorkerContextWrapper* service_worker_context) {
service_worker_handle_.reset(
new ServiceWorkerNavigationHandle(service_worker_context));
}
void NavigationHandleImpl::RenderProcessBlockedStateChanged(bool blocked) {
if (blocked)
StopCommitTimeout();
......
......@@ -38,8 +38,6 @@ namespace content {
class NavigationUIData;
class NavigatorDelegate;
class ServiceWorkerContextWrapper;
class ServiceWorkerNavigationHandle;
class SiteInstanceImpl;
// This class keeps track of a single navigation. It is created after the
......@@ -158,12 +156,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// will not have a NavigationEntry associated with it, and this will return 0.
int pending_nav_entry_id() const { return pending_nav_entry_id_; }
void InitServiceWorkerHandle(
ServiceWorkerContextWrapper* service_worker_context);
ServiceWorkerNavigationHandle* service_worker_handle() const {
return service_worker_handle_.get();
}
typedef base::OnceCallback<void(NavigationThrottle::ThrottleCheckResult)>
ThrottleChecksFinishedCallback;
......@@ -264,10 +256,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// The unique id of the corresponding NavigationEntry.
int pending_nav_entry_id_;
// Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
// corresponding provider is created in the renderer.
std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
// Stores the reload type, or NONE if it's not a reload.
ReloadType reload_type_;
......
......@@ -1690,7 +1690,8 @@ void NavigationRequest::OnStartChecksComplete(
ServiceWorkerContextWrapper* service_worker_context =
static_cast<ServiceWorkerContextWrapper*>(
partition->GetServiceWorkerContext());
navigation_handle_->InitServiceWorkerHandle(service_worker_context);
service_worker_handle_ =
std::make_unique<ServiceWorkerNavigationHandle>(service_worker_context);
}
if (IsSchemeSupportedForAppCache(common_params_.url)) {
......@@ -1766,10 +1767,9 @@ void NavigationRequest::OnStartChecksComplete(
: nullptr,
devtools_navigation_token(),
frame_tree_node_->devtools_frame_token()),
std::move(navigation_ui_data),
navigation_handle_->service_worker_handle(), appcache_handle_.get(),
std::move(prefetched_signed_exchange_cache_), this,
std::move(interceptor));
std::move(navigation_ui_data), service_worker_handle_.get(),
appcache_handle_.get(), std::move(prefetched_signed_exchange_cache_),
this, std::move(interceptor));
DCHECK(!render_frame_host_);
}
......@@ -2040,10 +2040,10 @@ void NavigationRequest::CommitNavigation() {
blink::mojom::ServiceWorkerProviderInfoForClientPtr
service_worker_provider_info;
if (navigation_handle_->service_worker_handle()) {
if (service_worker_handle_) {
// Notify the service worker navigation handle that navigation commit is
// about to go.
navigation_handle_->service_worker_handle()->OnBeginNavigationCommit(
service_worker_handle_->OnBeginNavigationCommit(
render_frame_host_->GetProcess()->GetID(),
render_frame_host_->GetRoutingID(), &service_worker_provider_info);
}
......
......@@ -54,6 +54,7 @@ class NavigationURLLoader;
class NavigationUIData;
class NavigatorDelegate;
class PrefetchedSignedExchangeCache;
class ServiceWorkerNavigationHandle;
class SiteInstanceImpl;
struct SubresourceLoaderParams;
......@@ -957,6 +958,10 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate,
// The unique id to identify the NavigationHandle with.
int64_t navigation_handle_id_ = 0;
// Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
// corresponding provider is created in the renderer.
std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
base::WeakPtrFactory<NavigationRequest> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NavigationRequest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment