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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1257553002: [Proof-of-concept] PlzNavigate and Service Worker Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass navigation_provider_id Created 5 years, 5 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/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 2633f27a3118f58ecf4884471f41ed5e3aff591b..e4ef9f97ba8a5d4da734c3e5a94c97cca4a2f783 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -413,6 +413,7 @@ bool IsNonLocalTopLevelNavigation(const GURL& url,
WebURLRequest CreateURLRequestForNavigation(
const CommonNavigationParams& common_params,
scoped_ptr<StreamOverrideParameters> stream_override,
+ int navigation_provider_id,
bool is_view_source_mode_enabled) {
WebURLRequest request(common_params.url);
if (is_view_source_mode_enabled)
@@ -429,6 +430,7 @@ WebURLRequest CreateURLRequestForNavigation(
RequestExtraData* extra_data = new RequestExtraData();
extra_data->set_stream_override(stream_override.Pass());
+ extra_data->set_navigation_provider_id(navigation_provider_id);
request.setExtraData(extra_data);
// Set the ui timestamp for this navigation. Currently the timestamp here is
@@ -1077,7 +1079,8 @@ void RenderFrameImpl::OnNavigate(
TRACE_EVENT2("navigation", "RenderFrameImpl::OnNavigate", "id", routing_id_,
"url", common_params.url.possibly_invalid_spec());
NavigateInternal(common_params, start_params, request_params,
- scoped_ptr<StreamOverrideParameters>());
+ scoped_ptr<StreamOverrideParameters>(),
+ kInvalidServiceWorkerProviderId);
}
void RenderFrameImpl::NavigateToSwappedOutURL() {
@@ -2510,8 +2513,17 @@ void RenderFrameImpl::didCreateDataSource(blink::WebLocalFrame* frame,
blink::WebSandboxFlags::Origin) {
provider_type = SERVICE_WORKER_PROVIDER_FOR_SANDBOXED_FRAME;
}
+ const WebURLRequest& original_request = datasource->originalRequest();
+ int navigation_provider_id = kInvalidServiceWorkerProviderId;
+ if (original_request.extraData()) {
+ RequestExtraData* extra_data =
+ static_cast<RequestExtraData*>(original_request.extraData());
+ navigation_provider_id = extra_data->navigation_provider_id();
+ }
scoped_ptr<ServiceWorkerNetworkProvider> network_provider(
- new ServiceWorkerNetworkProvider(routing_id_, provider_type));
+ new ServiceWorkerNetworkProvider(routing_id_, provider_type,
+ navigation_provider_id));
+
ServiceWorkerNetworkProvider::AttachToDocumentState(
DocumentState::FromDataSource(datasource),
network_provider.Pass());
@@ -3198,6 +3210,7 @@ void RenderFrameImpl::willSendRequest(
WebString custom_user_agent;
WebString requested_with;
scoped_ptr<StreamOverrideParameters> stream_override;
+ int navigation_provider_id = kInvalidServiceWorkerProviderId;
if (request.extraData()) {
RequestExtraData* old_extra_data =
static_cast<RequestExtraData*>(request.extraData());
@@ -3218,6 +3231,7 @@ void RenderFrameImpl::willSendRequest(
request.setHTTPHeaderField("X-Requested-With", requested_with);
}
stream_override = old_extra_data->TakeStreamOverrideOwnership();
+ navigation_provider_id = old_extra_data->navigation_provider_id();
}
// Add the default accept header for frame request if it has not been set
@@ -3297,6 +3311,7 @@ void RenderFrameImpl::willSendRequest(
navigation_state->start_params().transferred_request_request_id);
extra_data->set_service_worker_provider_id(provider_id);
extra_data->set_stream_override(stream_override.Pass());
+ extra_data->set_navigation_provider_id(navigation_provider_id);
request.setExtraData(extra_data);
// TODO(creis): Update prefetching to work with out-of-process iframes.
@@ -4117,7 +4132,8 @@ void RenderFrameImpl::OnCommitNavigation(
const ResourceResponseHead& response,
const GURL& stream_url,
const CommonNavigationParams& common_params,
- const RequestNavigationParams& request_params) {
+ const RequestNavigationParams& request_params,
+ int navigation_provider_id) {
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
// This will override the url requested by the WebURLLoader, as well as
@@ -4128,7 +4144,7 @@ void RenderFrameImpl::OnCommitNavigation(
stream_override->response = response;
NavigateInternal(common_params, StartNavigationParams(), request_params,
- stream_override.Pass());
+ stream_override.Pass(), navigation_provider_id);
}
void RenderFrameImpl::OnFailedNavigation(
@@ -4158,7 +4174,7 @@ void RenderFrameImpl::OnFailedNavigation(
CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code);
WebURLRequest failed_request = CreateURLRequestForNavigation(
common_params, scoped_ptr<StreamOverrideParameters>(),
- frame_->isViewSourceModeEnabled());
+ kInvalidServiceWorkerProviderId, frame_->isViewSourceModeEnabled());
SendFailedProvisionalLoad(failed_request, error, frame_);
if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) {
@@ -4418,7 +4434,8 @@ void RenderFrameImpl::NavigateInternal(
const CommonNavigationParams& common_params,
const StartNavigationParams& start_params,
const RequestNavigationParams& request_params,
- scoped_ptr<StreamOverrideParameters> stream_params) {
+ scoped_ptr<StreamOverrideParameters> stream_params,
+ int navigation_provider_id) {
bool browser_side_navigation =
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation);
@@ -4453,7 +4470,8 @@ void RenderFrameImpl::NavigateInternal(
bool should_load_request = false;
WebHistoryItem item_for_history_navigation;
WebURLRequest request = CreateURLRequestForNavigation(
- common_params, stream_params.Pass(), frame_->isViewSourceModeEnabled());
+ common_params, stream_params.Pass(), navigation_provider_id,
nasko 2015/08/07 17:51:12 Why do we need to pass this? The stream is the res
kinuko 2015/08/11 14:43:04 This is mainly to associate browser-side SW object
+ frame_->isViewSourceModeEnabled());
// PlzNavigate: Make sure that Blink's loader will not try to use browser side
// navigation for this request (since it already went to the browser).

Powered by Google App Engine
This is Rietveld 408576698