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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2734633002: PlzNavigate: Fix the http/tests/loading/307-after-303-after-post.html and the http/tests/loading/re… (Closed)
Patch Set: Clear pending_navigation_info_ in NavigateInternal() Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/web_frame_test_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 DocumentState::FromDataSource(datasource))) 3416 DocumentState::FromDataSource(datasource)))
3417 return; 3417 return;
3418 3418
3419 ServiceWorkerNetworkProvider::AttachToDocumentState( 3419 ServiceWorkerNetworkProvider::AttachToDocumentState(
3420 DocumentState::FromDataSource(datasource), 3420 DocumentState::FromDataSource(datasource),
3421 ServiceWorkerNetworkProvider::CreateForNavigation( 3421 ServiceWorkerNetworkProvider::CreateForNavigation(
3422 routing_id_, navigation_state->request_params(), frame, 3422 routing_id_, navigation_state->request_params(), frame,
3423 content_initiated)); 3423 content_initiated));
3424 } 3424 }
3425 3425
3426 void RenderFrameImpl::didStartProvisionalLoad( 3426 void RenderFrameImpl::didStartProvisionalLoad(blink::WebDataSource* data_source,
3427 blink::WebDataSource* data_source) { 3427 blink::WebURLRequest& request) {
3428 // In fast/loader/stop-provisional-loads.html, we abort the load before this 3428 // In fast/loader/stop-provisional-loads.html, we abort the load before this
3429 // callback is invoked. 3429 // callback is invoked.
3430 if (!data_source) 3430 if (!data_source)
3431 return; 3431 return;
3432 3432
3433 TRACE_EVENT2("navigation,benchmark,rail", 3433 TRACE_EVENT2("navigation,benchmark,rail",
3434 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 3434 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
3435 "url", data_source->getRequest().url().string().utf8()); 3435 "url", data_source->getRequest().url().string().utf8());
3436
3437 // PlzNavigate:
3438 // If we have pending navigation to be sent to the browser, do it here.
clamy 2017/03/13 16:03:33 nit: s/pending navigation/a pending navigation
ananta 2017/03/13 19:57:07 Thanks Done.
3439 if (pending_navigation_info_.get()) {
3440 DCHECK(IsBrowserSideNavigationEnabled());
3441 NavigationPolicyInfo info(request);
3442 info.navigationType = pending_navigation_info_->navigation_type;
3443 info.defaultPolicy = pending_navigation_info_->policy;
3444 info.replacesCurrentHistoryItem =
3445 pending_navigation_info_->replaces_current_history_item;
3446 info.isHistoryNavigationInNewChildFrame =
3447 pending_navigation_info_->history_navigation_in_new_child_frame;
3448 info.isClientRedirect = pending_navigation_info_->client_redirect;
3449 info.isCacheDisabled = pending_navigation_info_->cache_disabled;
3450 info.form = pending_navigation_info_->form;
3451
3452 pending_navigation_info_.reset(nullptr);
3453
3454 BeginNavigation(info);
3455 }
3456
3436 DocumentState* document_state = DocumentState::FromDataSource(data_source); 3457 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3437 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( 3458 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
3438 document_state->navigation_state()); 3459 document_state->navigation_state());
3439 bool is_top_most = !frame_->parent(); 3460 bool is_top_most = !frame_->parent();
3440 if (is_top_most) { 3461 if (is_top_most) {
3441 render_view_->set_navigation_gesture( 3462 render_view_->set_navigation_gesture(
3442 WebUserGestureIndicator::isProcessingUserGesture() ? 3463 WebUserGestureIndicator::isProcessingUserGesture() ?
3443 NavigationGestureUser : NavigationGestureAuto); 3464 NavigationGestureUser : NavigationGestureAuto);
3444 } else if (data_source->replacesCurrentHistoryItem()) { 3465 } else if (data_source->replacesCurrentHistoryItem()) {
3445 // Subframe navigations that don't add session history items must be 3466 // Subframe navigations that don't add session history items must be
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
5470 base::TimeTicks::Now(); 5491 base::TimeTicks::Now();
5471 } 5492 }
5472 } 5493 }
5473 5494
5474 // PlzNavigate: if the navigation is not synchronous, send it to the browser. 5495 // PlzNavigate: if the navigation is not synchronous, send it to the browser.
5475 // This includes navigations with no request being sent to the network stack. 5496 // This includes navigations with no request being sent to the network stack.
5476 if (IsBrowserSideNavigationEnabled() && 5497 if (IsBrowserSideNavigationEnabled() &&
5477 info.urlRequest.checkForBrowserSideNavigation() && 5498 info.urlRequest.checkForBrowserSideNavigation() &&
5478 ShouldMakeNetworkRequestForURL(url)) { 5499 ShouldMakeNetworkRequestForURL(url)) {
5479 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) { 5500 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) {
5480 BeginNavigation(info); 5501 // The BeginNavigation() call happens in didStartProvisionalLoad(). We
5502 // need to save information about the navigation here.
5503 pending_navigation_info_.reset(new PendingNavigationInfo(info));
5481 return blink::WebNavigationPolicyHandledByClient; 5504 return blink::WebNavigationPolicyHandledByClient;
5482 } else { 5505 } else {
5483 LoadURLExternally(info.urlRequest, info.defaultPolicy); 5506 LoadURLExternally(info.urlRequest, info.defaultPolicy);
5484 return blink::WebNavigationPolicyIgnore; 5507 return blink::WebNavigationPolicyIgnore;
5485 } 5508 }
5486 } 5509 }
5487 5510
5488 return info.defaultPolicy; 5511 return info.defaultPolicy;
5489 } 5512 }
5490 5513
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
5848 Send(new FrameHostMsg_OpenURL(routing_id_, params)); 5871 Send(new FrameHostMsg_OpenURL(routing_id_, params));
5849 } 5872 }
5850 5873
5851 void RenderFrameImpl::NavigateInternal( 5874 void RenderFrameImpl::NavigateInternal(
5852 const CommonNavigationParams& common_params, 5875 const CommonNavigationParams& common_params,
5853 const StartNavigationParams& start_params, 5876 const StartNavigationParams& start_params,
5854 const RequestNavigationParams& request_params, 5877 const RequestNavigationParams& request_params,
5855 std::unique_ptr<StreamOverrideParameters> stream_params) { 5878 std::unique_ptr<StreamOverrideParameters> stream_params) {
5856 bool browser_side_navigation = IsBrowserSideNavigationEnabled(); 5879 bool browser_side_navigation = IsBrowserSideNavigationEnabled();
5857 5880
5858 // Lower bound for browser initiated navigation start time. 5881 // PlzNavigate
5882 // Clear pending navigations which weren't sent to the browser because we
5883 // did not get a didStartProvisionalLoad() notification for them.
5884 pending_navigation_info_.reset(nullptr);
5885
5886 // Lower bound for browser initiated navigation start timepending_navigation_i nfo_
clamy 2017/03/13 16:03:33 I think this is an involuntary change :). Remove i
ananta 2017/03/13 19:57:07 Done.
5859 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); 5887 base::TimeTicks renderer_navigation_start = base::TimeTicks::Now();
5860 bool is_reload = 5888 bool is_reload =
5861 FrameMsg_Navigate_Type::IsReload(common_params.navigation_type); 5889 FrameMsg_Navigate_Type::IsReload(common_params.navigation_type);
5862 bool is_history_navigation = request_params.page_state.IsValid(); 5890 bool is_history_navigation = request_params.page_state.IsValid();
5863 WebCachePolicy cache_policy = WebCachePolicy::UseProtocolCachePolicy; 5891 WebCachePolicy cache_policy = WebCachePolicy::UseProtocolCachePolicy;
5864 RenderFrameImpl::PrepareRenderViewForNavigation( 5892 RenderFrameImpl::PrepareRenderViewForNavigation(
5865 common_params.url, request_params); 5893 common_params.url, request_params);
5866 5894
5867 GetContentClient()->SetActiveURL(common_params.url); 5895 GetContentClient()->SetActiveURL(common_params.url);
5868 5896
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
6870 // event target. Potentially a Pepper plugin will receive the event. 6898 // event target. Potentially a Pepper plugin will receive the event.
6871 // In order to tell whether a plugin gets the last mouse event and which it 6899 // In order to tell whether a plugin gets the last mouse event and which it
6872 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6900 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6873 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6901 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6874 // |pepper_last_mouse_event_target_|. 6902 // |pepper_last_mouse_event_target_|.
6875 pepper_last_mouse_event_target_ = nullptr; 6903 pepper_last_mouse_event_target_ = nullptr;
6876 #endif 6904 #endif
6877 } 6905 }
6878 6906
6879 } // namespace content 6907 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/shell/test_runner/web_frame_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698