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

Unified Diff: components/autofill/browser/personal_data_manager.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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/browser/personal_data_manager.cc
diff --git a/components/autofill/browser/personal_data_manager.cc b/components/autofill/browser/personal_data_manager.cc
index 6a7fb1f0bb11589de867c56e5ce4ce0d05390303..07e5527b06c239873e256c96e1b0b99a49be5a44 100644
--- a/components/autofill/browser/personal_data_manager.cc
+++ b/components/autofill/browser/personal_data_manager.cc
@@ -146,11 +146,11 @@ void PersonalDataManager::Init(BrowserContext* browser_context) {
if (!browser_context_->IsOffTheRecord())
metric_logger_->LogIsAutofillEnabledAtStartup(IsAutofillEnabled());
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
// WebDataService may not be available in tests.
- if (!autofill_data.get())
+ if (!autofill_data)
return;
LoadProfiles();
@@ -166,9 +166,9 @@ PersonalDataManager::~PersonalDataManager() {
if (!browser_context_)
return;
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (autofill_data)
autofill_data->RemoveObserver(this);
}
@@ -375,9 +375,9 @@ void PersonalDataManager::AddProfile(const AutofillProfile& profile) {
if (FindByGUID<AutofillProfile>(web_profiles_, profile.guid()))
return;
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Don't add a duplicate.
@@ -408,9 +408,9 @@ void PersonalDataManager::UpdateProfile(const AutofillProfile& profile) {
return;
}
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Make the update.
@@ -441,9 +441,9 @@ void PersonalDataManager::AddCreditCard(const CreditCard& credit_card) {
if (FindByGUID<CreditCard>(credit_cards_, credit_card.guid()))
return;
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Don't add a duplicate.
@@ -474,9 +474,9 @@ void PersonalDataManager::UpdateCreditCard(const CreditCard& credit_card) {
return;
}
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Make the update.
@@ -496,9 +496,9 @@ void PersonalDataManager::RemoveByGUID(const std::string& guid) {
if (!is_credit_card && !is_profile)
return;
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
if (is_credit_card)
@@ -784,9 +784,9 @@ void PersonalDataManager::SetProfiles(std::vector<AutofillProfile>* profiles) {
address_of<AutofillProfile>);
AutofillProfile::AdjustInferredLabels(&profile_pointers);
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Any profiles that are not in the new profile list should be removed from
@@ -838,9 +838,9 @@ void PersonalDataManager::SetCreditCards(
it++;
}
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get())
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data)
return;
// Any credit cards that are not in the new credit card list should be
@@ -878,9 +878,9 @@ void PersonalDataManager::SetCreditCards(
}
void PersonalDataManager::LoadProfiles() {
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get()) {
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data) {
NOTREACHED();
return;
}
@@ -898,9 +898,9 @@ void PersonalDataManager::LoadAuxiliaryProfiles() {
#endif
void PersonalDataManager::LoadCreditCards() {
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get()) {
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data) {
NOTREACHED();
return;
}
@@ -949,9 +949,9 @@ void PersonalDataManager::ReceiveLoadedCreditCards(
void PersonalDataManager::CancelPendingQuery(
WebDataServiceBase::Handle* handle) {
if (*handle) {
- scoped_refptr<AutofillWebDataService> autofill_data(
- AutofillWebDataService::FromBrowserContext(browser_context_));
- if (!autofill_data.get()) {
+ AutofillWebDataService* autofill_data =
+ AutofillWebDataService::FromBrowserContext(browser_context_);
+ if (!autofill_data) {
NOTREACHED();
return;
}

Powered by Google App Engine
This is Rietveld 408576698