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

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

Issue 16154031: Un-refcount AutofillWebData and TokenWebData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT Created 7 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
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 SessionService* session_service = 307 SessionService* session_service =
308 SessionServiceFactory::GetForProfile(profile_); 308 SessionServiceFactory::GetForProfile(profile_);
309 if (session_service) 309 if (session_service)
310 session_service->DeleteLastSession(); 310 session_service->DeleteLastSession();
311 #endif 311 #endif
312 } 312 }
313 313
314 // The saved Autofill profiles and credit cards can include the origin from 314 // The saved Autofill profiles and credit cards can include the origin from
315 // which these profiles and credit cards were learned. These are a form of 315 // which these profiles and credit cards were learned. These are a form of
316 // history, so clear them as well. 316 // history, so clear them as well.
317 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 317 autofill::AutofillWebDataService* web_data_service =
318 autofill::AutofillWebDataService::FromBrowserContext(profile_); 318 autofill::AutofillWebDataService::FromBrowserContext(profile_);
319 if (web_data_service.get()) { 319 if (web_data_service) {
320 waiting_for_clear_autofill_origin_urls_ = true; 320 waiting_for_clear_autofill_origin_urls_ = true;
321 web_data_service->RemoveOriginURLsModifiedBetween( 321 web_data_service->RemoveOriginURLsModifiedBetween(
322 delete_begin_, delete_end_); 322 delete_begin_, delete_end_);
323 // The above calls are done on the UI thread but do their work on the DB 323 // The above calls are done on the UI thread but do their work on the DB
324 // thread. So wait for it. 324 // thread. So wait for it.
325 BrowserThread::PostTaskAndReply( 325 BrowserThread::PostTaskAndReply(
326 BrowserThread::DB, FROM_HERE, 326 BrowserThread::DB, FROM_HERE,
327 base::Bind(&base::DoNothing), 327 base::Bind(&base::DoNothing),
328 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs, 328 base::Bind(&BrowsingDataRemover::OnClearedAutofillOriginURLs,
329 base::Unretained(this))); 329 base::Unretained(this)));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords")); 455 content::RecordAction(UserMetricsAction("ClearBrowsingData_Passwords"));
456 PasswordStore* password_store = PasswordStoreFactory::GetForProfile( 456 PasswordStore* password_store = PasswordStoreFactory::GetForProfile(
457 profile_, Profile::EXPLICIT_ACCESS).get(); 457 profile_, Profile::EXPLICIT_ACCESS).get();
458 458
459 if (password_store) 459 if (password_store)
460 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_); 460 password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_);
461 } 461 }
462 462
463 if (remove_mask & REMOVE_FORM_DATA) { 463 if (remove_mask & REMOVE_FORM_DATA) {
464 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill")); 464 content::RecordAction(UserMetricsAction("ClearBrowsingData_Autofill"));
465 scoped_refptr<autofill::AutofillWebDataService> web_data_service = 465 autofill::AutofillWebDataService* web_data_service =
466 autofill::AutofillWebDataService::FromBrowserContext(profile_); 466 autofill::AutofillWebDataService::FromBrowserContext(profile_);
467 467
468 if (web_data_service.get()) { 468 if (web_data_service) {
469 waiting_for_clear_form_ = true; 469 waiting_for_clear_form_ = true;
470 web_data_service->RemoveFormElementsAddedBetween(delete_begin_, 470 web_data_service->RemoveFormElementsAddedBetween(delete_begin_,
471 delete_end_); 471 delete_end_);
472 web_data_service->RemoveAutofillDataModifiedBetween( 472 web_data_service->RemoveAutofillDataModifiedBetween(
473 delete_begin_, delete_end_); 473 delete_begin_, delete_end_);
474 // The above calls are done on the UI thread but do their work on the DB 474 // The above calls are done on the UI thread but do their work on the DB
475 // thread. So wait for it. 475 // thread. So wait for it.
476 BrowserThread::PostTaskAndReply( 476 BrowserThread::PostTaskAndReply(
477 BrowserThread::DB, FROM_HERE, 477 BrowserThread::DB, FROM_HERE,
478 base::Bind(&base::DoNothing), 478 base::Bind(&base::DoNothing),
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1093 waiting_for_clear_form_ = false; 1093 waiting_for_clear_form_ = false;
1094 NotifyAndDeleteIfDone(); 1094 NotifyAndDeleteIfDone();
1095 } 1095 }
1096 1096
1097 void BrowsingDataRemover::OnClearedAutofillOriginURLs() { 1097 void BrowsingDataRemover::OnClearedAutofillOriginURLs() {
1098 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1098 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1099 waiting_for_clear_autofill_origin_urls_ = false; 1099 waiting_for_clear_autofill_origin_urls_ = false;
1100 NotifyAndDeleteIfDone(); 1100 NotifyAndDeleteIfDone();
1101 } 1101 }
OLDNEW
« no previous file with comments | « android_webview/native/aw_form_database.cc ('k') | chrome/browser/search_engines/template_url_service_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698