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

Side by Side Diff: chrome/browser/history/history_tab_helper.cc

Issue 257153003: We have a problem in the process on destroying WebContentsImpl because (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebased onto origin/master again, resolved conflicts Created 6 years, 7 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/browser/history/history_tab_helper.h ('k') | chrome/browser/infobars/infobar_service.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 "chrome/browser/history/history_tab_helper.h" 5 #include "chrome/browser/history/history_tab_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/history/history_service.h" 9 #include "chrome/browser/history/history_service.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 HistoryService* HistoryTabHelper::GetHistoryService() { 146 HistoryService* HistoryTabHelper::GetHistoryService() {
147 Profile* profile = 147 Profile* profile =
148 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 148 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
149 if (profile->IsOffTheRecord()) 149 if (profile->IsOffTheRecord())
150 return NULL; 150 return NULL;
151 151
152 return HistoryServiceFactory::GetForProfile(profile, 152 return HistoryServiceFactory::GetForProfile(profile,
153 Profile::IMPLICIT_ACCESS); 153 Profile::IMPLICIT_ACCESS);
154 } 154 }
155 155
156 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { 156 void HistoryTabHelper::WebContentsDestroyed() {
157 // We update the history for this URL. 157 // We update the history for this URL.
158 // The content returned from web_contents() has been destroyed by now. 158 WebContents* tab = web_contents();
159 // We need to use tab value directly.
160 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); 159 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
161 if (profile->IsOffTheRecord()) 160 if (profile->IsOffTheRecord())
162 return; 161 return;
163 162
164 HistoryService* hs = 163 HistoryService* hs =
165 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); 164 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS);
166 if (hs) { 165 if (hs) {
167 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); 166 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
168 if (entry) { 167 if (entry) {
169 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), 168 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(),
170 base::Time::Now()); 169 base::Time::Now());
171 } 170 }
172 } 171 }
173 } 172 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_tab_helper.h ('k') | chrome/browser/infobars/infobar_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698