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() { ...@@ -395,12 +395,6 @@ const net::ProxyServer& NavigationHandleImpl::GetProxyServer() {
return navigation_request_->proxy_server(); 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) { void NavigationHandleImpl::RenderProcessBlockedStateChanged(bool blocked) {
if (blocked) if (blocked)
StopCommitTimeout(); StopCommitTimeout();
......
...@@ -38,8 +38,6 @@ namespace content { ...@@ -38,8 +38,6 @@ namespace content {
class NavigationUIData; class NavigationUIData;
class NavigatorDelegate; class NavigatorDelegate;
class ServiceWorkerContextWrapper;
class ServiceWorkerNavigationHandle;
class SiteInstanceImpl; class SiteInstanceImpl;
// This class keeps track of a single navigation. It is created after the // This class keeps track of a single navigation. It is created after the
...@@ -158,12 +156,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { ...@@ -158,12 +156,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// will not have a NavigationEntry associated with it, and this will return 0. // will not have a NavigationEntry associated with it, and this will return 0.
int pending_nav_entry_id() const { return pending_nav_entry_id_; } 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)> typedef base::OnceCallback<void(NavigationThrottle::ThrottleCheckResult)>
ThrottleChecksFinishedCallback; ThrottleChecksFinishedCallback;
...@@ -264,10 +256,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { ...@@ -264,10 +256,6 @@ class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
// The unique id of the corresponding NavigationEntry. // The unique id of the corresponding NavigationEntry.
int pending_nav_entry_id_; 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. // Stores the reload type, or NONE if it's not a reload.
ReloadType reload_type_; ReloadType reload_type_;
......
...@@ -1690,7 +1690,8 @@ void NavigationRequest::OnStartChecksComplete( ...@@ -1690,7 +1690,8 @@ void NavigationRequest::OnStartChecksComplete(
ServiceWorkerContextWrapper* service_worker_context = ServiceWorkerContextWrapper* service_worker_context =
static_cast<ServiceWorkerContextWrapper*>( static_cast<ServiceWorkerContextWrapper*>(
partition->GetServiceWorkerContext()); partition->GetServiceWorkerContext());
navigation_handle_->InitServiceWorkerHandle(service_worker_context); service_worker_handle_ =
std::make_unique<ServiceWorkerNavigationHandle>(service_worker_context);
} }
if (IsSchemeSupportedForAppCache(common_params_.url)) { if (IsSchemeSupportedForAppCache(common_params_.url)) {
...@@ -1766,10 +1767,9 @@ void NavigationRequest::OnStartChecksComplete( ...@@ -1766,10 +1767,9 @@ void NavigationRequest::OnStartChecksComplete(
: nullptr, : nullptr,
devtools_navigation_token(), devtools_navigation_token(),
frame_tree_node_->devtools_frame_token()), frame_tree_node_->devtools_frame_token()),
std::move(navigation_ui_data), std::move(navigation_ui_data), service_worker_handle_.get(),
navigation_handle_->service_worker_handle(), appcache_handle_.get(), appcache_handle_.get(), std::move(prefetched_signed_exchange_cache_),
std::move(prefetched_signed_exchange_cache_), this, this, std::move(interceptor));
std::move(interceptor));
DCHECK(!render_frame_host_); DCHECK(!render_frame_host_);
} }
...@@ -2040,10 +2040,10 @@ void NavigationRequest::CommitNavigation() { ...@@ -2040,10 +2040,10 @@ void NavigationRequest::CommitNavigation() {
blink::mojom::ServiceWorkerProviderInfoForClientPtr blink::mojom::ServiceWorkerProviderInfoForClientPtr
service_worker_provider_info; service_worker_provider_info;
if (navigation_handle_->service_worker_handle()) { if (service_worker_handle_) {
// Notify the service worker navigation handle that navigation commit is // Notify the service worker navigation handle that navigation commit is
// about to go. // about to go.
navigation_handle_->service_worker_handle()->OnBeginNavigationCommit( service_worker_handle_->OnBeginNavigationCommit(
render_frame_host_->GetProcess()->GetID(), render_frame_host_->GetProcess()->GetID(),
render_frame_host_->GetRoutingID(), &service_worker_provider_info); render_frame_host_->GetRoutingID(), &service_worker_provider_info);
} }
......
...@@ -54,6 +54,7 @@ class NavigationURLLoader; ...@@ -54,6 +54,7 @@ class NavigationURLLoader;
class NavigationUIData; class NavigationUIData;
class NavigatorDelegate; class NavigatorDelegate;
class PrefetchedSignedExchangeCache; class PrefetchedSignedExchangeCache;
class ServiceWorkerNavigationHandle;
class SiteInstanceImpl; class SiteInstanceImpl;
struct SubresourceLoaderParams; struct SubresourceLoaderParams;
...@@ -957,6 +958,10 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate, ...@@ -957,6 +958,10 @@ class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate,
// The unique id to identify the NavigationHandle with. // The unique id to identify the NavigationHandle with.
int64_t navigation_handle_id_ = 0; 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}; base::WeakPtrFactory<NavigationRequest> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NavigationRequest); 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