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

Unified Diff: chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DidFinishNavigation is received when RenderFrameHostImpl is destroyed!! Created 4 years, 6 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: chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc
diff --git a/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc b/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc
index f6862a33f3dd7e1330d7d9d3df792f75de86e2c4..d2015fbe98ace754a45f6ce177b7b857efa8a669 100644
--- a/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc
+++ b/chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc
@@ -55,10 +55,11 @@ class WebContentsEntry : public content::WebContentsObserver {
void WebContentsDestroyed() override;
void RenderProcessGone(base::TerminationStatus status) override;
void OnRendererUnresponsive(RenderWidgetHost* render_widget_host) override;
- void DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) override;
+ void DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) override;
Charlie Reis 2016/06/24 22:21:17 Hooray! Thanks for moving to the new NavHandle-ba
afakhry 2016/06/27 14:29:18 Yes, Nick told me DidNavigateMainFrame() will be d
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
+ void DidAttachInterstitialPage() override;
+ void DidDetachInterstitialPage() override;
private:
// Defines a callback for WebContents::ForEachFrame() to create a
@@ -163,49 +164,60 @@ void WebContentsEntry::RenderProcessGone(base::TerminationStatus status) {
void WebContentsEntry::OnRendererUnresponsive(
RenderWidgetHost* render_widget_host) {
- auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame());
- if (itr == tasks_by_frames_.end())
+ RendererTask* task = GetTaskForFrame(web_contents()->GetMainFrame());
+ if (!task)
return;
DCHECK_EQ(render_widget_host->GetProcess(),
web_contents()->GetMainFrame()->GetProcess());
Charlie Reis 2016/06/24 22:21:17 This line caught my eye, since it looks buggy for
afakhry 2016/06/27 14:29:18 I saw the bug you filed, and I will handle it soon
- provider_->NotifyObserverTaskUnresponsive(itr->second);
+ provider_->NotifyObserverTaskUnresponsive(task);
}
-void WebContentsEntry::DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) {
- auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame());
- if (itr == tasks_by_frames_.end()) {
- // TODO(afakhry): Validate whether this actually happens in practice.
- NOTREACHED();
+void WebContentsEntry::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ RendererTask* task = GetTaskForFrame(web_contents()->GetMainFrame());
+ if (!task)
return;
- }
// Listening to WebContentsObserver::TitleWasSet() only is not enough in
// some cases when the the webpage doesn't have a title. That's why we update
// the title here as well.
- itr->second->UpdateTitle();
+ task->UpdateTitle();
// Call RendererTask::UpdateFavicon() to set the current favicon to the
// default favicon. If the page has a non-default favicon,
// RendererTask::OnFaviconUpdated() will update the current favicon once
// FaviconDriver figures out the correct favicon for the page.
- itr->second->UpdateFavicon();
- itr->second->UpdateRapporSampleName();
+ task->UpdateFavicon();
+ task->UpdateRapporSampleName();
}
void WebContentsEntry::TitleWasSet(content::NavigationEntry* entry,
bool explicit_set) {
- auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame());
- if (itr == tasks_by_frames_.end()) {
- // TODO(afakhry): Validate whether this actually happens in practice.
- NOTREACHED();
+ RendererTask* task = GetTaskForFrame(web_contents()->GetMainFrame());
+ if (!task)
+ return;
+
+ task->UpdateTitle();
+}
+
+void WebContentsEntry::DidAttachInterstitialPage() {
Charlie Reis 2016/06/24 22:21:17 Not sure I understand-- why do we need DidAttachIn
afakhry 2016/06/27 14:29:18 Updating titles here alone is not enough. It will
Charlie Reis 2016/06/28 00:47:09 I think I'm ok with that. Just curious, would we
afakhry 2016/06/28 14:34:16 No we won't need listening to the attach/detach ev
+ RendererTask* task = GetTaskForFrame(web_contents()->GetMainFrame());
+ if (!task)
+ return;
+
+ task->UpdateTitle();
+ task->UpdateFavicon();
+}
+
+void WebContentsEntry::DidDetachInterstitialPage() {
+ RendererTask* task = GetTaskForFrame(web_contents()->GetMainFrame());
+ if (!task)
return;
- }
- itr->second->UpdateTitle();
+ task->UpdateTitle();
+ task->UpdateFavicon();
}
void WebContentsEntry::CreateTaskForFrame(RenderFrameHost* render_frame_host) {

Powered by Google App Engine
This is Rietveld 408576698