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

Unified Diff: chrome/browser/sync/test/integration/autofill_helper.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
« no previous file with comments | « chrome/browser/sync/test/integration/autofill_helper.h ('k') | chrome/browser/webdata/token_web_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/autofill_helper.cc
diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc
index 31f86e485dc5d0c9a45fbfd7a3a4f941d6462639..eebe43214bafe58c5a43259995e08d2a5bd54014 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.cc
+++ b/chrome/browser/sync/test/integration/autofill_helper.cc
@@ -34,6 +34,8 @@ using autofill::CreditCard;
using autofill::FormFieldData;
using autofill::PersonalDataManager;
using autofill::PersonalDataManagerObserver;
+using base::Bind;
+using base::Unretained;
using base::WaitableEvent;
using content::BrowserThread;
using sync_datatype_helper::test;
@@ -80,13 +82,15 @@ void RemoveKeyDontBlockForSync(int profile, const AutofillKey& key) {
EXPECT_CALL(mock_observer, AutofillEntriesChanged(_))
.WillOnce(SignalEvent(&done_event));
- scoped_refptr<AutofillWebDataService> wds =
+ AutofillWebDataService* wds =
autofill_helper::GetWebDataService(profile);
void(AutofillWebDataService::*add_observer_func)(
AutofillWebDataServiceObserverOnDBThread*) =
&AutofillWebDataService::AddObserver;
- RunOnDBThreadAndBlock(Bind(add_observer_func, wds, &mock_observer));
+ RunOnDBThreadAndBlock(Bind(add_observer_func,
+ Unretained(wds),
+ &mock_observer));
wds->RemoveFormValueForElementName(key.name(), key.value());
done_event.Wait();
@@ -94,7 +98,9 @@ void RemoveKeyDontBlockForSync(int profile, const AutofillKey& key) {
void(AutofillWebDataService::*remove_observer_func)(
AutofillWebDataServiceObserverOnDBThread*) =
&AutofillWebDataService::RemoveObserver;
- RunOnDBThreadAndBlock(Bind(remove_observer_func, wds, &mock_observer));
+ RunOnDBThreadAndBlock(Bind(remove_observer_func,
+ Unretained(wds),
+ &mock_observer));
}
void GetAllAutofillEntriesOnDBThread(AutofillWebDataService* wds,
@@ -163,7 +169,7 @@ AutofillProfile CreateAutofillProfile(ProfileType type) {
return profile;
}
-scoped_refptr<AutofillWebDataService> GetWebDataService(int index) {
+AutofillWebDataService* GetWebDataService(int index) {
return AutofillWebDataService::FromBrowserContext(test()->GetProfile(index));
}
@@ -188,12 +194,14 @@ void AddKeys(int profile, const std::set<AutofillKey>& keys) {
EXPECT_CALL(mock_observer, AutofillEntriesChanged(_))
.WillOnce(SignalEvent(&done_event));
- scoped_refptr<AutofillWebDataService> wds = GetWebDataService(profile);
+ AutofillWebDataService* wds = GetWebDataService(profile);
void(AutofillWebDataService::*add_observer_func)(
AutofillWebDataServiceObserverOnDBThread*) =
&AutofillWebDataService::AddObserver;
- RunOnDBThreadAndBlock(Bind(add_observer_func, wds, &mock_observer));
+ RunOnDBThreadAndBlock(Bind(add_observer_func,
+ Unretained(wds),
+ &mock_observer));
wds->AddFormFields(form_fields);
done_event.Wait();
@@ -202,7 +210,9 @@ void AddKeys(int profile, const std::set<AutofillKey>& keys) {
void(AutofillWebDataService::*remove_observer_func)(
AutofillWebDataServiceObserverOnDBThread*) =
&AutofillWebDataService::RemoveObserver;
- RunOnDBThreadAndBlock(Bind(remove_observer_func, wds, &mock_observer));
+ RunOnDBThreadAndBlock(Bind(remove_observer_func,
+ Unretained(wds),
+ &mock_observer));
}
void RemoveKey(int profile, const AutofillKey& key) {
@@ -220,8 +230,8 @@ void RemoveKeys(int profile) {
}
std::set<AutofillEntry> GetAllKeys(int profile) {
- scoped_refptr<AutofillWebDataService> wds = GetWebDataService(profile);
- std::vector<AutofillEntry> all_entries = GetAllAutofillEntries(wds.get());
+ AutofillWebDataService* wds = GetWebDataService(profile);
+ std::vector<AutofillEntry> all_entries = GetAllAutofillEntries(wds);
std::set<AutofillEntry> all_keys;
for (std::vector<AutofillEntry>::const_iterator it = all_entries.begin();
it != all_entries.end(); ++it) {
« no previous file with comments | « chrome/browser/sync/test/integration/autofill_helper.h ('k') | chrome/browser/webdata/token_web_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698