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

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

Issue 1110943003: Revert of Classify navigations without page id in parallel to the existing classifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/public/test/web_contents_tester.h ('k') | content/renderer/render_view_browsertest.cc » ('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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 bool ignore_cache = (common_params.navigation_type == 1112 bool ignore_cache = (common_params.navigation_type ==
1113 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE); 1113 FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE);
1114 1114
1115 if (reload_original_url) 1115 if (reload_original_url)
1116 frame_->reloadWithOverrideURL(common_params.url, true); 1116 frame_->reloadWithOverrideURL(common_params.url, true);
1117 else 1117 else
1118 frame_->reload(ignore_cache); 1118 frame_->reload(ignore_cache);
1119 } else if (is_history_navigation) { 1119 } else if (is_history_navigation) {
1120 // We must know the page ID of the page we are navigating back to. 1120 // We must know the page ID of the page we are navigating back to.
1121 DCHECK_NE(request_params.page_id, -1); 1121 DCHECK_NE(request_params.page_id, -1);
1122 // We must know the nav entry ID of the page we are navigating back to,
1123 // which should be the case because history navigations are routed via the
1124 // browser.
1125 DCHECK_NE(0, request_params.nav_entry_id);
1126 scoped_ptr<HistoryEntry> entry = 1122 scoped_ptr<HistoryEntry> entry =
1127 PageStateToHistoryEntry(request_params.page_state); 1123 PageStateToHistoryEntry(request_params.page_state);
1128 if (entry) { 1124 if (entry) {
1129 // Ensure we didn't save the swapped out URL in UpdateState, since the 1125 // Ensure we didn't save the swapped out URL in UpdateState, since the
1130 // browser should never be telling us to navigate to swappedout://. 1126 // browser should never be telling us to navigate to swappedout://.
1131 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); 1127 CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL));
1132 scoped_ptr<NavigationParams> navigation_params( 1128 scoped_ptr<NavigationParams> navigation_params(
1133 new NavigationParams(*pending_navigation_params_.get())); 1129 new NavigationParams(*pending_navigation_params_.get()));
1134 render_view_->history_controller()->GoToEntry( 1130 render_view_->history_controller()->GoToEntry(
1135 entry.Pass(), navigation_params.Pass(), cache_policy); 1131 entry.Pass(), navigation_params.Pass(), cache_policy);
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2580 const blink::WebURLError& error, 2576 const blink::WebURLError& error,
2581 blink::WebHistoryCommitType commit_type) { 2577 blink::WebHistoryCommitType commit_type) {
2582 TRACE_EVENT1("navigation", "RenderFrameImpl::didFailProvisionalLoad", 2578 TRACE_EVENT1("navigation", "RenderFrameImpl::didFailProvisionalLoad",
2583 "id", routing_id_); 2579 "id", routing_id_);
2584 DCHECK(!frame_ || frame_ == frame); 2580 DCHECK(!frame_ || frame_ == frame);
2585 WebDataSource* ds = frame->provisionalDataSource(); 2581 WebDataSource* ds = frame->provisionalDataSource();
2586 DCHECK(ds); 2582 DCHECK(ds);
2587 2583
2588 const WebURLRequest& failed_request = ds->request(); 2584 const WebURLRequest& failed_request = ds->request();
2589 2585
2590 DocumentState* document_state = DocumentState::FromDataSource(ds);
2591 NavigationStateImpl* navigation_state =
2592 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2593
2594 // Notify the browser that we failed a provisional load with an error. 2586 // Notify the browser that we failed a provisional load with an error.
2595 // 2587 //
2596 // Note: It is important this notification occur before DidStopLoading so the 2588 // Note: It is important this notification occur before DidStopLoading so the
2597 // SSL manager can react to the provisional load failure before being 2589 // SSL manager can react to the provisional load failure before being
2598 // notified the load stopped. 2590 // notified the load stopped.
2599 // 2591 //
2600 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 2592 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
2601 DidFailProvisionalLoad(frame, error)); 2593 DidFailProvisionalLoad(frame, error));
2602 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 2594 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
2603 DidFailProvisionalLoad(error)); 2595 DidFailProvisionalLoad(error));
2604 2596
2605 SendFailedProvisionalLoad(failed_request, error, frame); 2597 SendFailedProvisionalLoad(failed_request, error, frame);
2606 2598
2607 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) 2599 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL))
2608 return; 2600 return;
2609 2601
2610 // Make sure we never show errors in view source mode. 2602 // Make sure we never show errors in view source mode.
2611 frame->enableViewSourceMode(false); 2603 frame->enableViewSourceMode(false);
2612 2604
2605 DocumentState* document_state = DocumentState::FromDataSource(ds);
2606 NavigationStateImpl* navigation_state =
2607 static_cast<NavigationStateImpl*>(document_state->navigation_state());
2608
2613 // If this is a failed back/forward/reload navigation, then we need to do a 2609 // If this is a failed back/forward/reload navigation, then we need to do a
2614 // 'replace' load. This is necessary to avoid messing up session history. 2610 // 'replace' load. This is necessary to avoid messing up session history.
2615 // Otherwise, we do a normal load, which simulates a 'go' navigation as far 2611 // Otherwise, we do a normal load, which simulates a 'go' navigation as far
2616 // as session history is concerned. 2612 // as session history is concerned.
2617 bool replace = commit_type != blink::WebStandardCommit; 2613 bool replace = commit_type != blink::WebStandardCommit;
2618 2614
2619 // If we failed on a browser initiated request, then make sure that our error 2615 // If we failed on a browser initiated request, then make sure that our error
2620 // page load is regarded as the same browser initiated request. 2616 // page load is regarded as the same browser initiated request.
2621 if (!navigation_state->IsContentInitiated()) { 2617 if (!navigation_state->IsContentInitiated()) {
2622 pending_navigation_params_.reset(new NavigationParams( 2618 pending_navigation_params_.reset(new NavigationParams(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2689 !navigation_state->start_params().should_replace_current_entry) { 2685 !navigation_state->start_params().should_replace_current_entry) {
2690 // Advance our offset in session history, applying the length limit. 2686 // Advance our offset in session history, applying the length limit.
2691 // There is now no forward history. 2687 // There is now no forward history.
2692 render_view_->history_list_offset_++; 2688 render_view_->history_list_offset_++;
2693 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) 2689 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries)
2694 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; 2690 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1;
2695 render_view_->history_list_length_ = 2691 render_view_->history_list_length_ =
2696 render_view_->history_list_offset_ + 1; 2692 render_view_->history_list_offset_ + 1;
2697 } 2693 }
2698 } else { 2694 } else {
2699 if (navigation_state->request_params().page_id != -1) { 2695 // Inspect the navigation_state on this frame to see if the navigation
2696 // corresponds to a session history navigation... Note: |frame| may or
2697 // may not be the toplevel frame, but for the case of capturing session
2698 // history, the first committed frame suffices. We keep track of whether
2699 // we've seen this commit before so that only capture session history once
2700 // per navigation.
2701 //
2702 // Note that we need to check if the page ID changed. In the case of a
2703 // reload, the page ID doesn't change, and UpdateSessionHistory gets the
2704 // previous URL and the current page ID, which would be wrong.
2705 if (navigation_state->request_params().page_id != -1 &&
2706 navigation_state->request_params().page_id != render_view_->page_id_) {
2700 // This is a successful session history navigation! 2707 // This is a successful session history navigation!
2701 render_view_->page_id_ = navigation_state->request_params().page_id; 2708 render_view_->page_id_ = navigation_state->request_params().page_id;
2702 2709
2703 render_view_->history_list_offset_ = 2710 render_view_->history_list_offset_ =
2704 navigation_state->request_params().pending_history_list_offset; 2711 navigation_state->request_params().pending_history_list_offset;
2705 } 2712 }
2706 } 2713 }
2707 2714
2708 bool sent = Send( 2715 bool sent = Send(
2709 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_)); 2716 new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_));
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3847 DocumentState* document_state = DocumentState::FromDataSource(ds); 3854 DocumentState* document_state = DocumentState::FromDataSource(ds);
3848 NavigationStateImpl* navigation_state = 3855 NavigationStateImpl* navigation_state =
3849 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3856 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3850 InternalDocumentStateData* internal_data = 3857 InternalDocumentStateData* internal_data =
3851 InternalDocumentStateData::FromDocumentState(document_state); 3858 InternalDocumentStateData::FromDocumentState(document_state);
3852 3859
3853 FrameHostMsg_DidCommitProvisionalLoad_Params params; 3860 FrameHostMsg_DidCommitProvisionalLoad_Params params;
3854 params.http_status_code = response.httpStatusCode(); 3861 params.http_status_code = response.httpStatusCode();
3855 params.url_is_unreachable = ds->hasUnreachableURL(); 3862 params.url_is_unreachable = ds->hasUnreachableURL();
3856 params.is_post = false; 3863 params.is_post = false;
3857 params.intended_as_new_entry =
3858 navigation_state->request_params().intended_as_new_entry;
3859 params.did_create_new_entry = commit_type == blink::WebStandardCommit;
3860 params.post_id = -1; 3864 params.post_id = -1;
3861 params.page_id = render_view_->page_id_; 3865 params.page_id = render_view_->page_id_;
3862 params.nav_entry_id = navigation_state->request_params().nav_entry_id;
3863 // We need to track the RenderViewHost routing_id because of downstream 3866 // We need to track the RenderViewHost routing_id because of downstream
3864 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, 3867 // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager,
3865 // ResourceDispatcherHostImpl, MediaStreamUIProxy, 3868 // ResourceDispatcherHostImpl, MediaStreamUIProxy,
3866 // SpeechRecognitionDispatcherHost and possibly others). They look up the view 3869 // SpeechRecognitionDispatcherHost and possibly others). They look up the view
3867 // based on the ID stored in the resource requests. Once those dependencies 3870 // based on the ID stored in the resource requests. Once those dependencies
3868 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the 3871 // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the
3869 // client to be based on the routing_id of the RenderFrameHost. 3872 // client to be based on the routing_id of the RenderFrameHost.
3870 params.render_view_routing_id = render_view_->routing_id(); 3873 params.render_view_routing_id = render_view_->routing_id();
3871 params.socket_address.set_host(response.remoteIPAddress().utf8()); 3874 params.socket_address.set_host(response.remoteIPAddress().utf8());
3872 params.socket_address.set_port(response.remotePort()); 3875 params.socket_address.set_port(response.remotePort());
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
4845 #elif defined(ENABLE_BROWSER_CDMS) 4848 #elif defined(ENABLE_BROWSER_CDMS)
4846 cdm_manager_, 4849 cdm_manager_,
4847 #endif 4850 #endif
4848 this); 4851 this);
4849 } 4852 }
4850 4853
4851 return cdm_factory_; 4854 return cdm_factory_;
4852 } 4855 }
4853 4856
4854 } // namespace content 4857 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/web_contents_tester.h ('k') | content/renderer/render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698