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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 493853002: Keep a copy of page id in RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 92725c6aee35690d7f409edde33c8bb333c50bbd..76a1361c65c953b1ef1f2c38a28e0ed05f0a95c6 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -7,9 +7,11 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/containers/hash_tables.h"
+#include "base/debug/crash_logging.h"
#include "base/lazy_instance.h"
#include "base/metrics/histogram.h"
#include "base/metrics/user_metrics_action.h"
+#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "content/browser/accessibility/accessibility_mode_helper.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
@@ -557,8 +559,19 @@ void RenderFrameHostImpl::OnDidRedirectProvisionalLoad(
int32 page_id,
const GURL& source_url,
const GURL& target_url) {
+ if (render_view_host_->page_id_ != page_id) {
+ base::debug::SetCrashKeyValue("url1",
Charlie Reis 2014/08/20 20:22:30 Once we have the data, what will the URL tell us?
Avi (use Gerrit) 2014/08/20 20:29:20 I have no experience in debugging situations like
Charlie Reis 2014/08/20 20:44:47 Well, I could be wrong-- the URL might lead to a r
Avi (use Gerrit) 2014/08/20 21:00:02 No disagreement there.
+ source_url.possibly_invalid_spec());
+ base::debug::SetCrashKeyValue("url2",
+ target_url.possibly_invalid_spec());
+ base::debug::SetCrashKeyValue(
+ "id1", base::IntToString(render_view_host_->page_id_));
+ base::debug::SetCrashKeyValue("id2",
+ base::IntToString(page_id));
+ CHECK(false);
+ }
frame_tree_node_->navigator()->DidRedirectProvisionalLoad(
- this, page_id, source_url, target_url);
+ this, render_view_host_->page_id_, source_url, target_url);
}
// Called when the renderer navigates. For every frame loaded, we'll get this
@@ -578,6 +591,10 @@ void RenderFrameHostImpl::OnNavigate(const IPC::Message& msg) {
Read(&msg, &iter, &validated_params))
return;
+ // Update the RVH's current page ID so that future IPCs from the renderer
+ // correspond to the new page.
+ render_view_host_->page_id_ = validated_params.page_id;
+
// If we're waiting for a cross-site beforeunload ack from this renderer and
// we receive a Navigate message from the main frame, then the renderer was
// navigating already and sent it before hearing the ViewMsg_Stop message.
@@ -902,6 +919,15 @@ void RenderFrameHostImpl::OnUpdateTitle(
int32 page_id,
const base::string16& title,
blink::WebTextDirection title_direction) {
+ if (render_view_host_->page_id_ != page_id) {
+ base::debug::SetCrashKeyValue(
+ "url1", GetLastCommittedURL().possibly_invalid_spec());
Charlie Reis 2014/08/20 20:22:30 It's possible for GetLastCommittedURL to return nu
Avi (use Gerrit) 2014/08/20 20:29:20 Would that be a failure, though? Before the commit
Charlie Reis 2014/08/20 20:44:47 Ah, you're right, GetLastCommittedEntry can return
+ base::debug::SetCrashKeyValue(
+ "id1", base::IntToString(render_view_host_->page_id_));
+ base::debug::SetCrashKeyValue("id2",
+ base::IntToString(page_id));
+ CHECK(false);
+ }
// This message is only sent for top-level frames. TODO(avi): when frame tree
// mirroring works correctly, add a check here to enforce it.
if (title.length() > kMaxTitleChars) {
@@ -909,7 +935,7 @@ void RenderFrameHostImpl::OnUpdateTitle(
return;
}
- delegate_->UpdateTitle(this, page_id, title,
+ delegate_->UpdateTitle(this, render_view_host_->page_id_, title,
WebTextDirectionToChromeTextDirection(
title_direction));
}

Powered by Google App Engine
This is Rietveld 408576698