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

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 test failures. 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 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 Send(new FrameHostMsg_DidStartProvisionalLoad( 3486 Send(new FrameHostMsg_DidStartProvisionalLoad(
3489 routing_id_, ds->getRequest().url(), navigation_start)); 3487 routing_id_, data_source->getRequest().url(), navigation_start));
3490 } 3488 }
3491 3489
3492 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( 3490 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad(
3493 blink::WebLocalFrame* frame) { 3491 blink::WebLocalFrame* frame) {
3494 DCHECK_EQ(frame_, frame); 3492 DCHECK_EQ(frame_, frame);
3495 3493
3496 // TODO(creis): Determine if this can be removed or if we need to clear any 3494 // TODO(creis): Determine if this can be removed or if we need to clear any
3497 // local state here to fix https://crbug.com/671276. 3495 // local state here to fix https://crbug.com/671276.
3498 } 3496 }
3499 3497
(...skipping 3330 matching lines...) Expand 10 before | Expand all | Expand 10 after
6830 // event target. Potentially a Pepper plugin will receive the event. 6828 // event target. Potentially a Pepper plugin will receive the event.
6831 // In order to tell whether a plugin gets the last mouse event and which it 6829 // In order to tell whether a plugin gets the last mouse event and which it
6832 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6830 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6833 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6831 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6834 // |pepper_last_mouse_event_target_|. 6832 // |pepper_last_mouse_event_target_|.
6835 pepper_last_mouse_event_target_ = nullptr; 6833 pepper_last_mouse_event_target_ = nullptr;
6836 #endif 6834 #endif
6837 } 6835 }
6838 6836
6839 } // namespace content 6837 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698