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

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: Remove CHECK for redirect chain as the redirects may not be populated for provisional loads for ren… 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | extensions/renderer/extension_frame_helper.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 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 DocumentState::FromDataSource(datasource))) 3442 DocumentState::FromDataSource(datasource)))
3443 return; 3443 return;
3444 3444
3445 ServiceWorkerNetworkProvider::AttachToDocumentState( 3445 ServiceWorkerNetworkProvider::AttachToDocumentState(
3446 DocumentState::FromDataSource(datasource), 3446 DocumentState::FromDataSource(datasource),
3447 ServiceWorkerNetworkProvider::CreateForNavigation( 3447 ServiceWorkerNetworkProvider::CreateForNavigation(
3448 routing_id_, navigation_state->request_params(), frame, 3448 routing_id_, navigation_state->request_params(), frame,
3449 content_initiated)); 3449 content_initiated));
3450 } 3450 }
3451 3451
3452 void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame) { 3452 void RenderFrameImpl::didStartProvisionalLoad(
3453 DCHECK_EQ(frame_, frame); 3453 blink::WebDataSource* data_source) {
3454 WebDataSource* ds = frame->provisionalDataSource();
3455
3456 // In fast/loader/stop-provisional-loads.html, we abort the load before this 3454 // In fast/loader/stop-provisional-loads.html, we abort the load before this
3457 // callback is invoked. 3455 // callback is invoked.
3458 if (!ds) 3456 if (!data_source)
3459 return; 3457 return;
3460 3458
3461 TRACE_EVENT2("navigation,benchmark,rail", 3459 TRACE_EVENT2("navigation,benchmark,rail",
3462 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, 3460 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_,
3463 "url", ds->getRequest().url().string().utf8()); 3461 "url", data_source->getRequest().url().string().utf8());
3464 DocumentState* document_state = DocumentState::FromDataSource(ds); 3462 DocumentState* document_state = DocumentState::FromDataSource(data_source);
3465 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( 3463 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>(
3466 document_state->navigation_state()); 3464 document_state->navigation_state());
3467 bool is_top_most = !frame->parent(); 3465 bool is_top_most = !frame_->parent();
3468 if (is_top_most) { 3466 if (is_top_most) {
3469 render_view_->set_navigation_gesture( 3467 render_view_->set_navigation_gesture(
3470 WebUserGestureIndicator::isProcessingUserGesture() ? 3468 WebUserGestureIndicator::isProcessingUserGesture() ?
3471 NavigationGestureUser : NavigationGestureAuto); 3469 NavigationGestureUser : NavigationGestureAuto);
3472 } else if (ds->replacesCurrentHistoryItem()) { 3470 } else if (data_source->replacesCurrentHistoryItem()) {
3473 // Subframe navigations that don't add session history items must be 3471 // Subframe navigations that don't add session history items must be
3474 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we 3472 // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we
3475 // handle loading of error pages. 3473 // handle loading of error pages.
3476 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); 3474 navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME);
3477 } 3475 }
3478 3476
3479 base::TimeTicks navigation_start = 3477 base::TimeTicks navigation_start =
3480 navigation_state->common_params().navigation_start; 3478 navigation_state->common_params().navigation_start;
3481 DCHECK(!navigation_start.is_null()); 3479 DCHECK(!navigation_start.is_null());
3482 3480
3483 for (auto& observer : render_view_->observers()) 3481 for (auto& observer : render_view_->observers())
3484 observer.DidStartProvisionalLoad(frame); 3482 observer.DidStartProvisionalLoad(frame_);
3485 for (auto& observer : observers_) 3483 for (auto& observer : observers_)
3486 observer.DidStartProvisionalLoad(); 3484 observer.DidStartProvisionalLoad(data_source);
3487 3485
3488 std::vector<GURL> redirect_chain; 3486 std::vector<GURL> redirect_chain;
3489 GetRedirectChain(ds, &redirect_chain); 3487 GetRedirectChain(data_source, &redirect_chain);
3490 CHECK(!redirect_chain.empty()); 3488
3491 Send(new FrameHostMsg_DidStartProvisionalLoad( 3489 Send(new FrameHostMsg_DidStartProvisionalLoad(
3492 routing_id_, ds->getRequest().url(), redirect_chain, navigation_start)); 3490 routing_id_, data_source->getRequest().url(), redirect_chain,
3491 navigation_start));
3493 } 3492 }
3494 3493
3495 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 3494 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
3496 blink::WebLocalFrame* frame) { 3495 blink::WebLocalFrame* frame) {
3497 DCHECK_EQ(frame_, frame); 3496 DCHECK_EQ(frame_, frame);
3498 3497
3499 // TODO(creis): Determine if this can be removed or if we need to clear any 3498 // TODO(creis): Determine if this can be removed or if we need to clear any
3500 // local state here to fix https://crbug.com/671276. 3499 // local state here to fix https://crbug.com/671276.
3501 } 3500 }
3502 3501
(...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after
6834 // event target. Potentially a Pepper plugin will receive the event. 6833 // event target. Potentially a Pepper plugin will receive the event.
6835 // 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
6836 // 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
6837 // 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
6838 // |pepper_last_mouse_event_target_|. 6837 // |pepper_last_mouse_event_target_|.
6839 pepper_last_mouse_event_target_ = nullptr; 6838 pepper_last_mouse_event_target_ = nullptr;
6840 #endif 6839 #endif
6841 } 6840 }
6842 6841
6843 } // namespace content 6842 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | extensions/renderer/extension_frame_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698