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

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: Fix null check 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 3861 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 return; 3882 return;
3882 3883
3883 // We must be prepared to handle state updates for any page. They occur 3884 // We must be prepared to handle state updates for any page. They occur
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);
3892
3893 int nav_entry_id =
3894 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame())->nav_entry_id();
3895 NavigationEntryImpl* new_entry =
3896 controller_.GetEntryWithUniqueID(nav_entry_id);
3897
3898 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id));
3899 base::debug::SetCrashKeyValue("navuniqueid", base::IntToString(nav_entry_id));
3900 base::debug::SetCrashKeyValue(
3901 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry)));
3902 base::debug::SetCrashKeyValue(
3903 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry)));
3904 base::debug::SetCrashKeyValue(
3905 "lastcommittedindex",
3906 base::IntToString(controller_.GetLastCommittedEntryIndex()));
3907 base::debug::SetCrashKeyValue("oldurl",
3908 entry ? entry->GetURL().spec() : "-nullptr-");
3909 base::debug::SetCrashKeyValue(
3910 "newurl", new_entry ? new_entry->GetURL().spec() : "-nullptr-");
3911 base::debug::SetCrashKeyValue(
3912 "updatedvalue", page_state.GetTopLevelUrlStringTemporaryForBug369661());
3913 base::debug::SetCrashKeyValue(
3914 "oldvalue", entry ? entry->GetURL().spec() : "-nullptr-");
3915 base::debug::SetCrashKeyValue(
3916 "newvalue",
3917 new_entry ? new_entry->GetURL().spec() : "-nullptr-");
3918 CHECK_EQ(entry, new_entry);
3919
3891 if (!entry) 3920 if (!entry)
3892 return; 3921 return;
3893 3922
3894 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID(
3895 static_cast<RenderFrameHostImpl*>(rvhi->GetMainFrame())->nav_entry_id());
3896
3897 DCHECK_EQ(entry, new_entry);
3898
3899 if (page_state == entry->GetPageState()) 3923 if (page_state == entry->GetPageState())
3900 return; // Nothing to update. 3924 return; // Nothing to update.
3901 entry->SetPageState(page_state); 3925 entry->SetPageState(page_state);
3902 controller_.NotifyEntryChanged(entry); 3926 controller_.NotifyEntryChanged(entry);
3903 } 3927 }
3904 3928
3905 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, 3929 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host,
3906 const GURL& url) { 3930 const GURL& url) {
3907 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { 3931 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) {
3908 // If we're fullscreen only update the url if it's from the fullscreen 3932 // If we're fullscreen only update the url if it's from the fullscreen
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
4090 base::i18n::TextDirection title_direction) { 4114 base::i18n::TextDirection title_direction) {
4091 // If we have a title, that's a pretty good indication that we've started 4115 // If we have a title, that's a pretty good indication that we've started
4092 // getting useful data. 4116 // getting useful data.
4093 SetNotWaitingForResponse(); 4117 SetNotWaitingForResponse();
4094 4118
4095 // Try to find the navigation entry, which might not be the current one. 4119 // 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. 4120 // For example, it might be from a recently swapped out RFH.
4097 NavigationEntryImpl* entry = controller_.GetEntryWithPageID( 4121 NavigationEntryImpl* entry = controller_.GetEntryWithPageID(
4098 render_frame_host->GetSiteInstance(), page_id); 4122 render_frame_host->GetSiteInstance(), page_id);
4099 4123
4100 NavigationEntryImpl* new_entry = controller_.GetEntryWithUniqueID( 4124 int nav_entry_id =
4101 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id()); 4125 static_cast<RenderFrameHostImpl*>(render_frame_host)->nav_entry_id();
4102 DCHECK_EQ(entry, new_entry); 4126 NavigationEntryImpl* new_entry =
4127 controller_.GetEntryWithUniqueID(nav_entry_id);
4128
4129 base::debug::SetCrashKeyValue("pageid", base::IntToString(page_id));
4130 base::debug::SetCrashKeyValue("navuniqueid", base::IntToString(nav_entry_id));
4131 base::debug::SetCrashKeyValue(
4132 "oldindex", base::IntToString(controller_.GetIndexOfEntry(entry)));
4133 base::debug::SetCrashKeyValue(
4134 "newindex", base::IntToString(controller_.GetIndexOfEntry(new_entry)));
4135 base::debug::SetCrashKeyValue(
4136 "lastcommittedindex",
4137 base::IntToString(controller_.GetLastCommittedEntryIndex()));
4138 base::debug::SetCrashKeyValue("oldurl",
4139 entry ? entry->GetURL().spec() : "-nullptr-");
4140 base::debug::SetCrashKeyValue(
4141 "newurl", new_entry ? new_entry->GetURL().spec() : "-nullptr-");
4142 base::debug::SetCrashKeyValue("updatedvalue", base::UTF16ToUTF8(title));
4143 base::debug::SetCrashKeyValue(
4144 "oldvalue", entry ? base::UTF16ToUTF8(entry->GetTitle()) : "-nullptr-");
4145 base::debug::SetCrashKeyValue(
4146 "newvalue",
4147 new_entry ? base::UTF16ToUTF8(new_entry->GetTitle()) : "-nullptr-");
4148 CHECK_EQ(entry, new_entry);
4103 4149
4104 // We can handle title updates when we don't have an entry in 4150 // 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. 4151 // UpdateTitleForEntry, but only if the update is from the current RVH.
4106 // TODO(avi): Change to make decisions based on the RenderFrameHost. 4152 // TODO(avi): Change to make decisions based on the RenderFrameHost.
4107 if (!entry && render_frame_host != GetMainFrame()) 4153 if (!entry && render_frame_host != GetMainFrame())
4108 return; 4154 return;
4109 4155
4110 // TODO(evan): make use of title_direction. 4156 // TODO(evan): make use of title_direction.
4111 // http://code.google.com/p/chromium/issues/detail?id=27094 4157 // http://code.google.com/p/chromium/issues/detail?id=27094
4112 if (!UpdateTitleForEntry(entry, title)) 4158 if (!UpdateTitleForEntry(entry, title))
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 return NULL; 4722 return NULL;
4677 } 4723 }
4678 4724
4679 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4725 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4680 force_disable_overscroll_content_ = force_disable; 4726 force_disable_overscroll_content_ = force_disable;
4681 if (view_) 4727 if (view_)
4682 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4728 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4683 } 4729 }
4684 4730
4685 } // namespace content 4731 } // 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