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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 328703002: Do not de-reference Profile on the IO thread in BrowsingDataRemover. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | no next file » | 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/browsing_data/browsing_data_remover.h" 5 #include "chrome/browser/browsing_data/browsing_data_remover.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 base::Bind( 305 base::Bind(
306 &BrowsingDataRemover::ClearHostnameResolutionCacheOnIOThread, 306 &BrowsingDataRemover::ClearHostnameResolutionCacheOnIOThread,
307 base::Unretained(this), 307 base::Unretained(this),
308 g_browser_process->io_thread())); 308 g_browser_process->io_thread()));
309 } 309 }
310 if (profile_->GetNetworkPredictor()) { 310 if (profile_->GetNetworkPredictor()) {
311 waiting_for_clear_network_predictor_ = true; 311 waiting_for_clear_network_predictor_ = true;
312 BrowserThread::PostTask( 312 BrowserThread::PostTask(
313 BrowserThread::IO, FROM_HERE, 313 BrowserThread::IO, FROM_HERE,
314 base::Bind(&BrowsingDataRemover::ClearNetworkPredictorOnIOThread, 314 base::Bind(&BrowsingDataRemover::ClearNetworkPredictorOnIOThread,
315 base::Unretained(this))); 315 base::Unretained(this),
316 profile_->GetNetworkPredictor()));
316 } 317 }
317 318
318 // As part of history deletion we also delete the auto-generated keywords. 319 // As part of history deletion we also delete the auto-generated keywords.
319 TemplateURLService* keywords_model = 320 TemplateURLService* keywords_model =
320 TemplateURLServiceFactory::GetForProfile(profile_); 321 TemplateURLServiceFactory::GetForProfile(profile_);
321 if (keywords_model && !keywords_model->loaded()) { 322 if (keywords_model && !keywords_model->loaded()) {
322 template_url_sub_ = keywords_model->RegisterOnLoadedCallback( 323 template_url_sub_ = keywords_model->RegisterOnLoadedCallback(
323 base::Bind(&BrowsingDataRemover::OnKeywordsLoaded, 324 base::Bind(&BrowsingDataRemover::OnKeywordsLoaded,
324 base::Unretained(this))); 325 base::Unretained(this)));
325 keywords_model->Load(); 326 keywords_model->Load();
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 base::Bind(&BrowsingDataRemover::OnClearedLoggedInPredictor, 858 base::Bind(&BrowsingDataRemover::OnClearedLoggedInPredictor,
858 base::Unretained(this))); 859 base::Unretained(this)));
859 } 860 }
860 861
861 void BrowsingDataRemover::OnClearedNetworkPredictor() { 862 void BrowsingDataRemover::OnClearedNetworkPredictor() {
862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 863 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
863 waiting_for_clear_network_predictor_ = false; 864 waiting_for_clear_network_predictor_ = false;
864 NotifyAndDeleteIfDone(); 865 NotifyAndDeleteIfDone();
865 } 866 }
866 867
867 void BrowsingDataRemover::ClearNetworkPredictorOnIOThread() { 868 void BrowsingDataRemover::ClearNetworkPredictorOnIOThread(
869 chrome_browser_net::Predictor* predictor) {
868 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 870 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
869 871
870 chrome_browser_net::Predictor* predictor = profile_->GetNetworkPredictor(); 872 predictor->DiscardInitialNavigationHistory();
871 if (predictor) { 873 predictor->DiscardAllResults();
Mike West 2014/06/10 12:33:13 Can this be null? If not, can we DCHECK?
engedy 2014/06/10 15:19:40 Indeed, this must be non-NULL, otherwise the metho
872 predictor->DiscardInitialNavigationHistory();
873 predictor->DiscardAllResults();
874 }
875 874
876 // Notify the UI thread that we are done. 875 // Notify the UI thread that we are done.
877 BrowserThread::PostTask( 876 BrowserThread::PostTask(
878 BrowserThread::UI, 877 BrowserThread::UI,
879 FROM_HERE, 878 FROM_HERE,
880 base::Bind(&BrowsingDataRemover::OnClearedNetworkPredictor, 879 base::Bind(&BrowsingDataRemover::OnClearedNetworkPredictor,
881 base::Unretained(this))); 880 base::Unretained(this)));
882 } 881 }
883 882
884 void BrowsingDataRemover::OnClearedNetworkingHistory() { 883 void BrowsingDataRemover::OnClearedNetworkingHistory() {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 waiting_for_clear_webrtc_logs_ = false; 1145 waiting_for_clear_webrtc_logs_ = false;
1147 NotifyAndDeleteIfDone(); 1146 NotifyAndDeleteIfDone();
1148 } 1147 }
1149 #endif 1148 #endif
1150 1149
1151 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1150 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1151 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1153 waiting_for_clear_domain_reliability_monitor_ = false; 1152 waiting_for_clear_domain_reliability_monitor_ = false;
1154 NotifyAndDeleteIfDone(); 1153 NotifyAndDeleteIfDone();
1155 } 1154 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698