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

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

Issue 549243002: Ensure that the browser’s copy of page id is in sync with the renderer’s. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pageidipc
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
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | content/browser/renderer_host/render_view_host_impl.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/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/debug/crash_logging.h"
10 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
11 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
12 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
14 #include "base/strings/string_number_conversions.h"
13 #include "base/time/time.h" 15 #include "base/time/time.h"
14 #include "content/browser/accessibility/accessibility_mode_helper.h" 16 #include "content/browser/accessibility/accessibility_mode_helper.h"
15 #include "content/browser/accessibility/browser_accessibility_manager.h" 17 #include "content/browser/accessibility/browser_accessibility_manager.h"
16 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 18 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
17 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
18 #include "content/browser/frame_host/cross_process_frame_connector.h" 20 #include "content/browser/frame_host/cross_process_frame_connector.h"
19 #include "content/browser/frame_host/cross_site_transferring_request.h" 21 #include "content/browser/frame_host/cross_site_transferring_request.h"
20 #include "content/browser/frame_host/frame_tree.h" 22 #include "content/browser/frame_host/frame_tree.h"
21 #include "content/browser/frame_host/frame_tree_node.h" 23 #include "content/browser/frame_host/frame_tree_node.h"
22 #include "content/browser/frame_host/navigator.h" 24 #include "content/browser/frame_host/navigator.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 GetProcess()->FilterURL(false, &validated_url); 572 GetProcess()->FilterURL(false, &validated_url);
571 573
572 frame_tree_node_->navigator()->DidFailLoadWithError( 574 frame_tree_node_->navigator()->DidFailLoadWithError(
573 this, validated_url, error_code, error_description); 575 this, validated_url, error_code, error_description);
574 } 576 }
575 577
576 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad( 578 void RenderFrameHostImpl::OnDidRedirectProvisionalLoad(
577 int32 page_id, 579 int32 page_id,
578 const GURL& source_url, 580 const GURL& source_url,
579 const GURL& target_url) { 581 const GURL& target_url) {
582 if (render_view_host_->page_id_ != page_id) {
583 base::debug::SetCrashKeyValue("url1",
584 source_url.possibly_invalid_spec());
585 base::debug::SetCrashKeyValue("url2",
586 target_url.possibly_invalid_spec());
587 base::debug::SetCrashKeyValue(
588 "id1", base::IntToString(render_view_host_->page_id_));
589 base::debug::SetCrashKeyValue("id2",
590 base::IntToString(page_id));
591 CHECK(false);
592 }
580 frame_tree_node_->navigator()->DidRedirectProvisionalLoad( 593 frame_tree_node_->navigator()->DidRedirectProvisionalLoad(
581 this, page_id, source_url, target_url); 594 this, render_view_host_->page_id_, source_url, target_url);
582 } 595 }
583 596
584 // Called when the renderer navigates. For every frame loaded, we'll get this 597 // Called when the renderer navigates. For every frame loaded, we'll get this
585 // notification containing parameters identifying the navigation. 598 // notification containing parameters identifying the navigation.
586 // 599 //
587 // Subframes are identified by the page transition type. For subframes loaded 600 // Subframes are identified by the page transition type. For subframes loaded
588 // as part of a wider page load, the page_id will be the same as for the top 601 // as part of a wider page load, the page_id will be the same as for the top
589 // level frame. If the user explicitly requests a subframe navigation, we will 602 // level frame. If the user explicitly requests a subframe navigation, we will
590 // get a new page_id because we need to create a new navigation entry for that 603 // get a new page_id because we need to create a new navigation entry for that
591 // action. 604 // action.
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 void RenderFrameHostImpl::OnDidAssignPageId(int32 page_id) { 945 void RenderFrameHostImpl::OnDidAssignPageId(int32 page_id) {
933 // Update the RVH's current page ID so that future IPCs from the renderer 946 // Update the RVH's current page ID so that future IPCs from the renderer
934 // correspond to the new page. 947 // correspond to the new page.
935 render_view_host_->page_id_ = page_id; 948 render_view_host_->page_id_ = page_id;
936 } 949 }
937 950
938 void RenderFrameHostImpl::OnUpdateTitle( 951 void RenderFrameHostImpl::OnUpdateTitle(
939 int32 page_id, 952 int32 page_id,
940 const base::string16& title, 953 const base::string16& title,
941 blink::WebTextDirection title_direction) { 954 blink::WebTextDirection title_direction) {
955 if (render_view_host_->page_id_ != page_id) {
956 base::debug::SetCrashKeyValue(
957 "url1", GetLastCommittedURL().possibly_invalid_spec());
958 base::debug::SetCrashKeyValue(
959 "id1", base::IntToString(render_view_host_->page_id_));
960 base::debug::SetCrashKeyValue("id2",
961 base::IntToString(page_id));
962 CHECK(false);
963 }
942 // This message is only sent for top-level frames. TODO(avi): when frame tree 964 // This message is only sent for top-level frames. TODO(avi): when frame tree
943 // mirroring works correctly, add a check here to enforce it. 965 // mirroring works correctly, add a check here to enforce it.
944 if (title.length() > kMaxTitleChars) { 966 if (title.length() > kMaxTitleChars) {
945 NOTREACHED() << "Renderer sent too many characters in title."; 967 NOTREACHED() << "Renderer sent too many characters in title.";
946 return; 968 return;
947 } 969 }
948 970
949 delegate_->UpdateTitle(this, page_id, title, 971 delegate_->UpdateTitle(this, render_view_host_->page_id_, title,
950 WebTextDirectionToChromeTextDirection( 972 WebTextDirectionToChromeTextDirection(
951 title_direction)); 973 title_direction));
952 } 974 }
953 975
954 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) { 976 void RenderFrameHostImpl::OnUpdateEncoding(const std::string& encoding_name) {
955 // This message is only sent for top-level frames. TODO(avi): when frame tree 977 // This message is only sent for top-level frames. TODO(avi): when frame tree
956 // mirroring works correctly, add a check here to enforce it. 978 // mirroring works correctly, add a check here to enforce it.
957 delegate_->UpdateEncoding(this, encoding_name); 979 delegate_->UpdateEncoding(this, encoding_name);
958 } 980 }
959 981
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 // Clear any state if a pending navigation is canceled or preempted. 1365 // Clear any state if a pending navigation is canceled or preempted.
1344 if (suspended_nav_params_) 1366 if (suspended_nav_params_)
1345 suspended_nav_params_.reset(); 1367 suspended_nav_params_.reset();
1346 1368
1347 TRACE_EVENT_ASYNC_END0("navigation", 1369 TRACE_EVENT_ASYNC_END0("navigation",
1348 "RenderFrameHostImpl navigation suspended", this); 1370 "RenderFrameHostImpl navigation suspended", this);
1349 navigations_suspended_ = false; 1371 navigations_suspended_ = false;
1350 } 1372 }
1351 1373
1352 } // namespace content 1374 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698