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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1410543014: Gather more debug info for the switch away from page id for titles and state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 1 month 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/public/common/page_state.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/crash_logging.h"
10 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
11 #include "base/location.h" 12 #include "base/location.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
14 #include "base/process/process.h" 15 #include "base/process/process.h"
15 #include "base/profiler/scoped_tracker.h" 16 #include "base/profiler/scoped_tracker.h"
16 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
(...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 // when the user is scrolling and entering form data, as well as when we're 3885 // when the user is scrolling and entering form data, as well as when we're
3885 // leaving a page, in which case our state may have already been moved to 3886 // leaving a page, in which case our state may have already been moved to
3886 // the next page. The navigation controller will look up the appropriate 3887 // the next page. The navigation controller will look up the appropriate
3887 // NavigationEntry and update it when it is notified via the delegate. 3888 // NavigationEntry and update it when it is notified via the delegate.
3888 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh); 3889 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(rvh);
3889 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( 3890 NavigationEntryImpl* entry = controller_.GetEntryWithPageID(
3890 rvhi->GetSiteInstance(), page_id); 3891 rvhi->GetSiteInstance(), page_id);
3891 if (!entry) 3892 if (!entry)
3892 return; 3893 return;
3893 3894
3894 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( 3895 int nav_entry_id =
3895 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame())->nav_entry_id()); 3896 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame())->nav_entry_id();
3897 NavigationEntryImpl* new_entry =
3898 controller_.GetEntryWithUniqueID(nav_entry_id);
3899 CHECK(new_entry);
Avi (use Gerrit) 2015/11/05 00:50:35 I get that if the page id lookup failed, we wouldn
Charlie Reis 2015/11/05 22:12:51 Done.
Charlie Reis 2015/11/05 23:05:37 Oops, that should have been a null check at the en
3896 3900
3897 DCHECK_EQ(entry, new_entry); 3901 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id));
3902 base::debug::SetCrashKeyValue("navuniqueid", base::IntToString(nav_entry_id));
3903 base::debug::SetCrashKeyValue(
3904 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry)));
3905 base::debug::SetCrashKeyValue(
3906 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry)));
3907 base::debug::SetCrashKeyValue(
3908 "lastcommittedindex",
3909 base::IntToString(controller_.GetLastCommittedEntryIndex()));
3910 base::debug::SetCrashKeyValue("oldurl", entry->GetURL().spec());
3911 base::debug::SetCrashKeyValue("newurl", new_entry->GetURL().spec());
3912 base::debug::SetCrashKeyValue(
3913 "updatedvalue", page_state.GetTopLevelUrlStringTemporaryForBug369661());
3914 base::debug::SetCrashKeyValue("oldvalue", entry->GetURL().spec());
3915 base::debug::SetCrashKeyValue("newvalue", new_entry->GetURL().spec());
3916 CHECK_EQ(entry, new_entry);
3898 3917
3899 if (page_state == entry->GetPageState()) 3918 if (page_state == entry->GetPageState())
3900 return; // Nothing to update. 3919 return; // Nothing to update.
3901 entry->SetPageState(page_state); 3920 entry->SetPageState(page_state);
3902 controller_.NotifyEntryChanged(entry); 3921 controller_.NotifyEntryChanged(entry);
3903 } 3922 }
3904 3923
3905 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, 3924 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host,
3906 const GURL& url) { 3925 const GURL& url) {
3907 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { 3926 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 base::i18n::TextDirection title_direction) { 4109 base::i18n::TextDirection title_direction) {
4091 // If we have a title, that's a pretty good indication that we've started 4110 // If we have a title, that's a pretty good indication that we've started
4092 // getting useful data. 4111 // getting useful data.
4093 SetNotWaitingForResponse(); 4112 SetNotWaitingForResponse();
4094 4113
4095 // Try to find the navigation entry, which might not be the current one. 4114 // Try to find the navigation entry, which might not be the current one.
4096 // For example, it might be from a recently swapped out RFH. 4115 // For example, it might be from a recently swapped out RFH.
4097 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( 4116 NavigationEntryImpl* entry = controller_.GetEntryWithPageID(
4098 render_frame_host->GetSiteInstance(), page_id); 4117 render_frame_host->GetSiteInstance(), page_id);
4099 4118
4100 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( 4119 int nav_entry_id =
4101 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id()); 4120 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id();
4102 DCHECK_EQ(entry, new_entry); 4121 NavigationEntryImpl* new_entry =
4122 controller_.GetEntryWithUniqueID(nav_entry_id);
4123
4124 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id));
4125 base::debug::SetCrashKeyValue("navuniqueid", base::IntToString(nav_entry_id));
4126 base::debug::SetCrashKeyValue(
4127 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry)));
4128 base::debug::SetCrashKeyValue(
4129 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry)));
4130 base::debug::SetCrashKeyValue(
4131 "lastcommittedindex",
4132 base::IntToString(controller_.GetLastCommittedEntryIndex()));
4133 base::debug::SetCrashKeyValue("oldurl",
4134 entry ? entry->GetURL().spec() : "-nullptr-");
4135 base::debug::SetCrashKeyValue(
4136 "newurl", new_entry ? new_entry->GetURL().spec() : "-nullptr-");
4137 base::debug::SetCrashKeyValue("updatedvalue", base::UTF16ToUTF8(title));
4138 base::debug::SetCrashKeyValue(
4139 "oldvalue", entry ? base::UTF16ToUTF8(entry->GetTitle()) : "-nullptr-");
4140 base::debug::SetCrashKeyValue(
4141 "newvalue",
4142 new_entry ? base::UTF16ToUTF8(new_entry->GetTitle()) : "-nullptr-");
4143 CHECK_EQ(entry, new_entry);
4103 4144
4104 // We can handle title updates when we don't have an entry in 4145 // We can handle title updates when we don't have an entry in
4105 // UpdateTitleForEntry, but only if the update is from the current RVH. 4146 // UpdateTitleForEntry, but only if the update is from the current RVH.
4106 // TODO(avi): Change to make decisions based on the RenderFrameHost. 4147 // TODO(avi): Change to make decisions based on the RenderFrameHost.
4107 if (!entry && render_frame_host != GetMainFrame()) 4148 if (!entry && render_frame_host != GetMainFrame())
4108 return; 4149 return;
4109 4150
4110 // TODO(evan): make use of title_direction. 4151 // TODO(evan): make use of title_direction.
4111 // http://code.google.com/p/chromium/issues/detail?id=27094 4152 // http://code.google.com/p/chromium/issues/detail?id=27094
4112 if (!UpdateTitleForEntry(entry, title)) 4153 if (!UpdateTitleForEntry(entry, title))
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 return NULL; 4717 return NULL;
4677 } 4718 }
4678 4719
4679 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4720 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4680 force_disable_overscroll_content_ = force_disable; 4721 force_disable_overscroll_content_ = force_disable;
4681 if (view_) 4722 if (view_)
4682 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4723 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4683 } 4724 }
4684 4725
4685 } // namespace content 4726 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | content/public/common/page_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698