Commit d665b5d8 authored by Arthur Hemery's avatar Arthur Hemery Committed by Commit Bot

Reworking DocumentState creation.

Prepares moving DocumentState creation outside of
DidCreateDocumentLoader. It does a few things:

- Separates the paths between using pending_navigation_params_
and not using them to build DocumentState.
- Removes the dependencies on navigation_state in
DidCreateDocumentLoader. Instead we use the pending_navigation_params_
directly. Also removes reliance on default constructed values of
CommonNavigationParams and RequestNavigationParams members.
- Moved as much things as possible out of the main class into
utilities in the anonymous namespace.
- Stripped UpdateNavigationState that is now only used to update same
document navigation states.


Bug: 789577
Change-Id: I18d12d24827c3289ef909d9253fe8bbf6ca5080f
Reviewed-on: https://chromium-review.googlesource.com/1109831Reviewed-by: default avatarCamille Lamy <clamy@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Arthur Hemery <ahemery@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571090}
parent 99ef4c2a
This diff is collapsed.
......@@ -152,7 +152,6 @@ namespace content {
class AssociatedInterfaceProviderImpl;
class BlinkInterfaceRegistryImpl;
class CompositorDependencies;
class DocumentState;
class ExternalPopupMenu;
class HistoryEntry;
class ManifestManager;
......@@ -1185,20 +1184,10 @@ class CONTENT_EXPORT RenderFrameImpl
// Returns the URL being loaded by the |frame_|'s request.
GURL GetLoadingUrl() const;
// If we initiated a navigation, this function will populate |document_state|
// with the navigation information saved in OnNavigate().
void PopulateDocumentStateFromPending(DocumentState* document_state);
// Returns a new NavigationState populated with the navigation information
// saved in OnNavigate().
NavigationState* CreateNavigationStateFromPending();
// Sets the NavigationState on the DocumentState based on
// the value of |pending_navigation_params_|.
void UpdateNavigationState(DocumentState* document_state,
bool was_within_same_document,
bool content_initiated);
#if BUILDFLAG(ENABLE_PLUGINS)
void HandlePepperImeCommit(const base::string16& text);
#endif // ENABLE_PLUGINS
......
......@@ -148,9 +148,8 @@ class WebServiceWorkerNetworkProviderForFrame
std::unique_ptr<blink::WebServiceWorkerNetworkProvider>
ServiceWorkerNetworkProvider::CreateForNavigation(
int route_id,
const RequestNavigationParams& request_params,
const RequestNavigationParams* request_params,
blink::WebLocalFrame* frame,
bool content_initiated,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory) {
// Determine if a ServiceWorkerNetworkProvider should be created and properly
......@@ -159,13 +158,13 @@ ServiceWorkerNetworkProvider::CreateForNavigation(
// however it will have an invalid id.
bool should_create_provider = false;
int provider_id = kInvalidServiceWorkerProviderId;
if (content_initiated) {
if (request_params) {
should_create_provider = request_params->should_create_service_worker;
provider_id = request_params->service_worker_provider_id;
} else {
should_create_provider =
((frame->EffectiveSandboxFlags() & blink::WebSandboxFlags::kOrigin) !=
blink::WebSandboxFlags::kOrigin);
} else {
should_create_provider = request_params.should_create_service_worker;
provider_id = request_params.service_worker_provider_id;
}
// If we shouldn't create a real ServiceWorkerNetworkProvider, return one with
......
......@@ -60,6 +60,14 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
// Creates a ServiceWorkerNetworkProvider for navigation and wraps it
// with WebServiceWorkerNetworkProvider to be owned by Blink.
//
// |request_params| are navigation parameters that were transmitted to the
// renderer by the browser on a navigation commit. It is null if we have not
// yet heard from the browser (currently only during the time it takes from
// having the renderer initiate a navigation until the browser commits it).
// TODO(ahemery): Update this comment when do not create placeholder document
// loaders for renderer-initiated navigations. In this case, this should never
// be null.
//
// For S13nServiceWorker:
// |controller_info| contains the endpoint and object info that is needed to
// set up the controller service worker for the client.
......@@ -70,9 +78,8 @@ class CONTENT_EXPORT ServiceWorkerNetworkProvider {
static std::unique_ptr<blink::WebServiceWorkerNetworkProvider>
CreateForNavigation(
int route_id,
const RequestNavigationParams& request_params,
const RequestNavigationParams* request_params,
blink::WebLocalFrame* frame,
bool content_initiated,
mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory);
......
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