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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 526493004: Revert of Keep a copy of page id in RenderViewHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 GetProcess()->FilterURL(false, &validated_url); 562 GetProcess()->FilterURL(false, &validated_url);
563 563
564 frame_tree_node_->navigator()->DidFailLoadWithError( 564 frame_tree_node_->navigator()->DidFailLoadWithError(
565 this, validated_url, error_code, error_description); 565 this, validated_url, error_code, error_description);
566 } 566 }
567 567
568 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( 568 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad(
569 int32 page_id, 569 int32 page_id,
570 const GURL& source_url, 570 const GURL& source_url,
571 const GURL& target_url) { 571 const GURL& target_url) {
572 CHECK_EQ(render_view_host_->page_id_, page_id);
573 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( 572 frame_tree_node_->navigator()->DidRedirectProvisionalLoad(
574 this, render_view_host_->page_id_, source_url, target_url); 573 this, page_id, source_url, target_url);
575 } 574 }
576 575
577 // Called when the renderer navigates. For every frame loaded, we'll get this 576 // Called when the renderer navigates. For every frame loaded, we'll get this
578 // notification containing parameters identifying the navigation. 577 // notification containing parameters identifying the navigation.
579 // 578 //
580 // Subframes are identified by the page transition type. For subframes loaded 579 // Subframes are identified by the page transition type. For subframes loaded
581 // as part of a wider page load, the page_id will be the same as for the top 580 // as part of a wider page load, the page_id will be the same as for the top
582 // level frame. If the user explicitly requests a subframe navigation, we will 581 // level frame. If the user explicitly requests a subframe navigation, we will
583 // get a new page_id because we need to create a new navigation entry for that 582 // get a new page_id because we need to create a new navigation entry for that
584 // action. 583 // action.
585 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) { 584 void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) {
586 // Read the parameters out of the IPC message directly to avoid making another 585 // Read the parameters out of the IPC message directly to avoid making another
587 // copy when we filter the URLs. 586 // copy when we filter the URLs.
588 PickleIterator iter(msg); 587 PickleIterator iter(msg);
589 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params; 588 FrameHostMsg_DidCommitProvisionalLoad_Params validated_params;
590 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>:: 589 if (!IPC::ParamTraits<FrameHostMsg_DidCommitProvisionalLoad_Params>::
591 Read(&msg, &iter, &validated_params)) 590 Read(&msg, &iter, &validated_params))
592 return; 591 return;
593 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnNavigate", 592 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnNavigate",
594 "url", validated_params.url.possibly_invalid_spec()); 593 "url", validated_params.url.possibly_invalid_spec());
595 594
596 // Update the RVH's current page ID so that future IPCs from the renderer
597 // correspond to the new page.
598 render_view_host_->page_id_ = validated_params.page_id;
599
600 // If we're waiting for a cross-site beforeunload ack from this renderer and 595 // If we're waiting for a cross-site beforeunload ack from this renderer and
601 // we receive a Navigate message from the main frame, then the renderer was 596 // we receive a Navigate message from the main frame, then the renderer was
602 // navigating already and sent it before hearing the FrameMsg_Stop message. 597 // navigating already and sent it before hearing the FrameMsg_Stop message.
603 // We do not want to cancel the pending navigation in this case, since the 598 // We do not want to cancel the pending navigation in this case, since the
604 // old page will soon be stopped. Instead, treat this as a beforeunload ack 599 // old page will soon be stopped. Instead, treat this as a beforeunload ack
605 // to allow the pending navigation to continue. 600 // to allow the pending navigation to continue.
606 if (render_view_host_->is_waiting_for_beforeunload_ack_ && 601 if (render_view_host_->is_waiting_for_beforeunload_ack_ &&
607 render_view_host_->unload_ack_is_for_cross_site_transition_ && 602 render_view_host_->unload_ack_is_for_cross_site_transition_ &&
608 PageTransitionIsMainFrame(validated_params.transition)) { 603 PageTransitionIsMainFrame(validated_params.transition)) {
609 OnBeforeUnloadACK(true, send_before_unload_start_time_, 604 OnBeforeUnloadACK(true, send_before_unload_start_time_,
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 void RenderFrameHostImpl::OnDidDisownOpener() { 918 void RenderFrameHostImpl::OnDidDisownOpener() {
924 // This message is only sent for top-level frames. TODO(avi): when frame tree 919 // This message is only sent for top-level frames. TODO(avi): when frame tree
925 // mirroring works correctly, add a check here to enforce it. 920 // mirroring works correctly, add a check here to enforce it.
926 delegate_->DidDisownOpener(this); 921 delegate_->DidDisownOpener(this);
927 } 922 }
928 923
929 void RenderFrameHostImpl::OnUpdateTitle( 924 void RenderFrameHostImpl::OnUpdateTitle(
930 int32 page_id, 925 int32 page_id,
931 const base::string16& title, 926 const base::string16& title,
932 blink::WebTextDirection title_direction) { 927 blink::WebTextDirection title_direction) {
933 CHECK_EQ(render_view_host_->page_id_, page_id);
934 // This message is only sent for top-level frames. TODO(avi): when frame tree 928 // This message is only sent for top-level frames. TODO(avi): when frame tree
935 // mirroring works correctly, add a check here to enforce it. 929 // mirroring works correctly, add a check here to enforce it.
936 if (title.length() > kMaxTitleChars) { 930 if (title.length() > kMaxTitleChars) {
937 NOTREACHED() << "Renderer sent too many characters in title."; 931 NOTREACHED() << "Renderer sent too many characters in title.";
938 return; 932 return;
939 } 933 }
940 934
941 delegate_->UpdateTitle(this, render_view_host_->page_id_, title, 935 delegate_->UpdateTitle(this, page_id, title,
942 WebTextDirectionToChromeTextDirection( 936 WebTextDirectionToChromeTextDirection(
943 title_direction)); 937 title_direction));
944 } 938 }
945 939
946 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { 940 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
947 // This message is only sent for top-level frames. TODO(avi): when frame tree 941 // This message is only sent for top-level frames. TODO(avi): when frame tree
948 // mirroring works correctly, add a check here to enforce it. 942 // mirroring works correctly, add a check here to enforce it.
949 delegate_->UpdateEncoding(this, encoding_name); 943 delegate_->UpdateEncoding(this, encoding_name);
950 } 944 }
951 945
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 // Clear any state if a pending navigation is canceled or preempted. 1329 // Clear any state if a pending navigation is canceled or preempted.
1336 if (suspended_nav_params_) 1330 if (suspended_nav_params_)
1337 suspended_nav_params_.reset(); 1331 suspended_nav_params_.reset();
1338 1332
1339 TRACE_EVENT_ASYNC_END0("navigation", 1333 TRACE_EVENT_ASYNC_END0("navigation",
1340 "RenderFrameHostImpl navigation suspended", this); 1334 "RenderFrameHostImpl navigation suspended", this);
1341 navigations_suspended_ = false; 1335 navigations_suspended_ = false;
1342 } 1336 }
1343 1337
1344 } // namespace content 1338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698