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

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

Issue 2720763002: PlzNavigate: preserve SourceLocation when navigating (Closed)
Patch Set: PlzNavigate: preserve SourceLocation when navigating 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
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 // because it is loaded immediately by the FrameLoader. 668 // because it is loaded immediately by the FrameLoader.
669 FrameMsg_Navigate_Type::Value navigation_type = 669 FrameMsg_Navigate_Type::Value navigation_type =
670 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; 670 FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT;
671 if (info.navigationType == blink::WebNavigationTypeReload) { 671 if (info.navigationType == blink::WebNavigationTypeReload) {
672 if (load_flags & net::LOAD_BYPASS_CACHE) 672 if (load_flags & net::LOAD_BYPASS_CACHE)
673 navigation_type = FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; 673 navigation_type = FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE;
674 else 674 else
675 navigation_type = FrameMsg_Navigate_Type::RELOAD; 675 navigation_type = FrameMsg_Navigate_Type::RELOAD;
676 } 676 }
677 677
678 base::Optional<SourceLocation> source_location;
679 if (info.hasSourceLocation) {
680 source_location = SourceLocation(info.sourceLocation.url.latin1(),
681 info.sourceLocation.lineNumber,
682 info.sourceLocation.columnNumber);
683 }
684
678 const RequestExtraData* extra_data = 685 const RequestExtraData* extra_data =
679 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); 686 static_cast<RequestExtraData*>(info.urlRequest.getExtraData());
680 DCHECK(extra_data); 687 DCHECK(extra_data);
681 return CommonNavigationParams( 688 return CommonNavigationParams(
682 info.urlRequest.url(), referrer, extra_data->transition_type(), 689 info.urlRequest.url(), referrer, extra_data->transition_type(),
683 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, 690 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp,
684 report_type, GURL(), GURL(), 691 report_type, GURL(), GURL(),
685 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), 692 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
686 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), 693 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
687 GetRequestBodyForWebURLRequest(info.urlRequest)); 694 GetRequestBodyForWebURLRequest(info.urlRequest), source_location);
688 } 695 }
689 696
690 media::Context3D GetSharedMainThreadContext3D( 697 media::Context3D GetSharedMainThreadContext3D(
691 scoped_refptr<ui::ContextProviderCommandBuffer> provider) { 698 scoped_refptr<ui::ContextProviderCommandBuffer> provider) {
692 if (!provider) 699 if (!provider)
693 return media::Context3D(); 700 return media::Context3D();
694 return media::Context3D(provider->ContextGL(), provider->GrContext()); 701 return media::Context3D(provider->ContextGL(), provider->GrContext());
695 } 702 }
696 703
697 WebFrameLoadType ReloadFrameLoadTypeFor( 704 WebFrameLoadType ReloadFrameLoadTypeFor(
(...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 navigation_state->request_params().navigation_timing.fetch_start); 3415 navigation_state->request_params().navigation_timing.fetch_start);
3409 3416
3410 datasource->updateNavigation( 3417 datasource->updateNavigation(
3411 redirect_start, redirect_end, fetch_start, 3418 redirect_start, redirect_end, fetch_start,
3412 !navigation_state->request_params().redirects.empty()); 3419 !navigation_state->request_params().redirects.empty());
3413 // TODO(clamy) We need to provide additional timing values for the 3420 // TODO(clamy) We need to provide additional timing values for the
3414 // Navigation Timing API to work with browser-side navigations. 3421 // Navigation Timing API to work with browser-side navigations.
3415 // UnloadEventStart and UnloadEventEnd are still missing. 3422 // UnloadEventStart and UnloadEventEnd are still missing.
3416 } 3423 }
3417 3424
3425 // PlzNavigate: update the source location before processing the navigation
3426 // commit.
3427 if (IsBrowserSideNavigationEnabled() &&
3428 navigation_state->common_params().source_location.has_value()) {
3429 blink::WebSourceLocation source_location;
3430 source_location.url = WebString::fromLatin1(
3431 navigation_state->common_params().source_location->url);
3432 source_location.lineNumber =
3433 navigation_state->common_params().source_location->line_number;
3434 source_location.columnNumber =
3435 navigation_state->common_params().source_location->column_number;
3436 datasource->setSourceLocation(source_location);
3437 }
3438
3418 // Create the serviceworker's per-document network observing object if it 3439 // Create the serviceworker's per-document network observing object if it
3419 // does not exist (When navigation happens within a page, the provider already 3440 // does not exist (When navigation happens within a page, the provider already
3420 // exists). 3441 // exists).
3421 if (ServiceWorkerNetworkProvider::FromDocumentState( 3442 if (ServiceWorkerNetworkProvider::FromDocumentState(
3422 DocumentState::FromDataSource(datasource))) 3443 DocumentState::FromDataSource(datasource)))
3423 return; 3444 return;
3424 3445
3425 ServiceWorkerNetworkProvider::AttachToDocumentState( 3446 ServiceWorkerNetworkProvider::AttachToDocumentState(
3426 DocumentState::FromDataSource(datasource), 3447 DocumentState::FromDataSource(datasource),
3427 ServiceWorkerNetworkProvider::CreateForNavigation( 3448 ServiceWorkerNetworkProvider::CreateForNavigation(
(...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after
6072 // false, and the frame may not have been set in a loading state. Do not 6093 // false, and the frame may not have been set in a loading state. Do not
6073 // send a stop message if a history navigation is loading in this frame 6094 // send a stop message if a history navigation is loading in this frame
6074 // nonetheless. This behavior will go away with subframe navigation 6095 // nonetheless. This behavior will go away with subframe navigation
6075 // entries. 6096 // entries.
6076 if (frame_ && !frame_->isLoading() && !has_history_navigation_in_frame) 6097 if (frame_ && !frame_->isLoading() && !has_history_navigation_in_frame)
6077 Send(new FrameHostMsg_DidStopLoading(routing_id_)); 6098 Send(new FrameHostMsg_DidStopLoading(routing_id_));
6078 } 6099 }
6079 6100
6080 // In case LoadRequest failed before didCreateDataSource was called. 6101 // In case LoadRequest failed before didCreateDataSource was called.
6081 pending_navigation_params_.reset(); 6102 pending_navigation_params_.reset();
6103
6104 // PlzNavigate: reset the source location now that the commit checks have been
6105 // processed.
6106 if (IsBrowserSideNavigationEnabled()) {
6107 frame_->dataSource()->resetSourceLocation();
Nate Chapin 2017/03/01 23:22:19 Rather than needing to expose resetSourceLocation(
clamy 2017/03/02 13:34:32 The problem is that we're going to do an IPC befor
Nate Chapin 2017/03/03 00:17:05 So the flow of that case would be: * Start navigat
clamy 2017/03/06 13:27:53 That's the case I'm concerned about. Given how the
Nate Chapin 2017/03/13 17:45:42 Ok, I think I can live with this. The combination
6108 if (frame_->provisionalDataSource())
6109 frame_->provisionalDataSource()->resetSourceLocation();
6110 }
6082 } 6111 }
6083 6112
6084 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, 6113 void RenderFrameImpl::UpdateEncoding(WebFrame* frame,
6085 const std::string& encoding_name) { 6114 const std::string& encoding_name) {
6086 // Only update main frame's encoding_name. 6115 // Only update main frame's encoding_name.
6087 if (!frame->parent()) 6116 if (!frame->parent())
6088 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); 6117 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name));
6089 } 6118 }
6090 6119
6091 void RenderFrameImpl::SyncSelectionIfRequired() { 6120 void RenderFrameImpl::SyncSelectionIfRequired() {
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
6849 // event target. Potentially a Pepper plugin will receive the event. 6878 // event target. Potentially a Pepper plugin will receive the event.
6850 // In order to tell whether a plugin gets the last mouse event and which it 6879 // In order to tell whether a plugin gets the last mouse event and which it
6851 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6880 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6852 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6881 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6853 // |pepper_last_mouse_event_target_|. 6882 // |pepper_last_mouse_event_target_|.
6854 pepper_last_mouse_event_target_ = nullptr; 6883 pepper_last_mouse_event_target_ = nullptr;
6855 #endif 6884 #endif
6856 } 6885 }
6857 6886
6858 } // namespace content 6887 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698