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

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

Issue 2661743002: PlzNavigate: Invoke didStartProvisionalLoad() when the renderer initiates a navigation in startLoad( (Closed)
Patch Set: Fix build error Created 3 years, 10 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
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 3430 matching lines...) Expand 10 before | Expand all | Expand 10 after
3441 DocumentState::FromDataSource(datasource))) 3441 DocumentState::FromDataSource(datasource)))
3442 return; 3442 return;
3443 3443
3444 ServiceWorkerNetworkProvider::AttachToDocumentState( 3444 ServiceWorkerNetworkProvider::AttachToDocumentState(
3445 DocumentState::FromDataSource(datasource), 3445 DocumentState::FromDataSource(datasource),
3446 ServiceWorkerNetworkProvider::CreateForNavigation( 3446 ServiceWorkerNetworkProvider::CreateForNavigation(
3447 routing_id_, navigation_state->request_params(), frame, 3447 routing_id_, navigation_state->request_params(), frame,
3448 content_initiated)); 3448 content_initiated));
3449 } 3449 }
3450 3450
3451 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame) { 3451 void RenderFrameImpl::didStartProvisionalLoad(
3452 blink::WebLocalFrame* frame,
3453 const blink::WebURLRequest& request) {
3452 DCHECK_EQ(frame_, frame); 3454 DCHECK_EQ(frame_, frame);
3453 WebDataSource* ds = frame->provisionalDataSource(); 3455 WebDataSource* ds = frame->provisionalDataSource();
3454 3456
3455 // In fast/loader/stop-provisional-loads.html, we abort the load before this 3457 // In fast/loader/stop-provisional-loads.html, we abort the load before this
3456 // callback is invoked. 3458 // callback is invoked.
3457 if (!ds) 3459 if (!ds)
Nate Chapin 2017/01/31 22:13:32 I think this if() statement is dead code, but this
ananta 2017/02/02 01:29:23 Based on our discussion, I moved the call to send
3458 return; 3460 return;
3459 3461
3460 TRACE_EVENT2("navigation,benchmark,rail", 3462 TRACE_EVENT2("navigation,benchmark,rail",
3461 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 3463 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
3462 "url", ds->getRequest().url().string().utf8()); 3464 "url", ds->getRequest().url().string().utf8());
Nate Chapin 2017/01/31 22:13:32 ds->getRequest() -> request ?
ananta 2017/02/02 01:29:23 Not needed with the latest patch
3463 DocumentState* document_state = DocumentState::FromDataSource(ds); 3465 DocumentState* document_state = DocumentState::FromDataSource(ds);
3464 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( 3466 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
3465 document_state->navigation_state()); 3467 document_state->navigation_state());
3466 bool is_top_most = !frame->parent(); 3468 bool is_top_most = !frame->parent();
3467 if (is_top_most) { 3469 if (is_top_most) {
3468 render_view_->set_navigation_gesture( 3470 render_view_->set_navigation_gesture(
3469 WebUserGestureIndicator::isProcessingUserGesture() ? 3471 WebUserGestureIndicator::isProcessingUserGesture() ?
3470 NavigationGestureUser : NavigationGestureAuto); 3472 NavigationGestureUser : NavigationGestureAuto);
3471 } else if (ds->replacesCurrentHistoryItem()) { 3473 } else if (ds->replacesCurrentHistoryItem()) {
Nate Chapin 2017/01/31 22:13:32 As mentioned above, could we plumb this bit?
ananta 2017/02/02 01:29:23 Not needed with the latest patch
3472 // Subframe navigations that don't add session history items must be 3474 // Subframe navigations that don't add session history items must be
3473 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 3475 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
3474 // handle loading of error pages. 3476 // handle loading of error pages.
3475 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); 3477 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
3476 } 3478 }
3477 3479
3478 base::TimeTicks navigation_start = 3480 base::TimeTicks navigation_start =
3479 navigation_state->common_params().navigation_start; 3481 navigation_state->common_params().navigation_start;
3480 DCHECK(!navigation_start.is_null()); 3482 DCHECK(!navigation_start.is_null());
3481 3483
3482 for (auto& observer : render_view_->observers()) 3484 for (auto& observer : render_view_->observers())
3483 observer.DidStartProvisionalLoad(frame); 3485 observer.DidStartProvisionalLoad(frame);
3484 for (auto& observer : observers_) 3486 for (auto& observer : observers_)
3485 observer.DidStartProvisionalLoad(); 3487 observer.DidStartProvisionalLoad();
3486 3488
3487 Send(new FrameHostMsg_DidStartProvisionalLoad( 3489 Send(new FrameHostMsg_DidStartProvisionalLoad(
3488 routing_id_, ds->getRequest().url(), navigation_start)); 3490 routing_id_, ds->getRequest().url(), navigation_start));
Nate Chapin 2017/01/31 22:13:32 ds->getRequest() -> request ?
ananta 2017/02/02 01:29:23 Not needed with the latest patch
3489 } 3491 }
3490 3492
3491 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 3493 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
3492 blink::WebLocalFrame* frame) { 3494 blink::WebLocalFrame* frame) {
3493 DCHECK_EQ(frame_, frame); 3495 DCHECK_EQ(frame_, frame);
3494 3496
3495 // TODO(creis): Determine if this can be removed or if we need to clear any 3497 // TODO(creis): Determine if this can be removed or if we need to clear any
3496 // local state here to fix https://crbug.com/671276. 3498 // local state here to fix https://crbug.com/671276.
3497 } 3499 }
3498 3500
(...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after
6183 if (request_params.should_clear_history_list) { 6185 if (request_params.should_clear_history_list) {
6184 CHECK_EQ(-1, render_view_->history_list_offset_); 6186 CHECK_EQ(-1, render_view_->history_list_offset_);
6185 CHECK_EQ(0, render_view_->history_list_length_); 6187 CHECK_EQ(0, render_view_->history_list_length_);
6186 } 6188 }
6187 } 6189 }
6188 6190
6189 void RenderFrameImpl::BeginNavigation(const NavigationPolicyInfo& info) { 6191 void RenderFrameImpl::BeginNavigation(const NavigationPolicyInfo& info) {
6190 CHECK(IsBrowserSideNavigationEnabled()); 6192 CHECK(IsBrowserSideNavigationEnabled());
6191 browser_side_navigation_pending_ = true; 6193 browser_side_navigation_pending_ = true;
6192 6194
6195 didStartProvisionalLoad(frame_, info.urlRequest);
Nate Chapin 2017/01/31 22:13:32 Instead of adding a new path for calling didStartP
ananta 2017/02/02 01:29:23 Done.
6196
6193 // Note: At this stage, the goal is to apply all the modifications the 6197 // Note: At this stage, the goal is to apply all the modifications the
6194 // renderer wants to make to the request, and then send it to the browser, so 6198 // renderer wants to make to the request, and then send it to the browser, so
6195 // that the actual network request can be started. Ideally, all such 6199 // that the actual network request can be started. Ideally, all such
6196 // modifications should take place in willSendRequest, and in the 6200 // modifications should take place in willSendRequest, and in the
6197 // implementation of willSendRequest for the various InspectorAgents 6201 // implementation of willSendRequest for the various InspectorAgents
6198 // (devtools). 6202 // (devtools).
6199 // 6203 //
6200 // TODO(clamy): Apply devtools override. 6204 // TODO(clamy): Apply devtools override.
6201 // TODO(clamy): Make sure that navigation requests are not modified somewhere 6205 // TODO(clamy): Make sure that navigation requests are not modified somewhere
6202 // else in blink. 6206 // else in blink.
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
6829 // event target. Potentially a Pepper plugin will receive the event. 6833 // event target. Potentially a Pepper plugin will receive the event.
6830 // In order to tell whether a plugin gets the last mouse event and which it 6834 // In order to tell whether a plugin gets the last mouse event and which it
6831 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6835 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6832 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6836 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6833 // |pepper_last_mouse_event_target_|. 6837 // |pepper_last_mouse_event_target_|.
6834 pepper_last_mouse_event_target_ = nullptr; 6838 pepper_last_mouse_event_target_ = nullptr;
6835 #endif 6839 #endif
6836 } 6840 }
6837 6841
6838 } // namespace content 6842 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698