Commit ebd5a4de authored by byoungkwon ko's avatar byoungkwon ko Committed by Commit Bot

Convert usage of HistoryService::DeleteURL to DeleteURLs

We have both deleting url function in HistoryService.
And DeleteURL can be replaced as DeleteURLs.
So we will remove DeleteURL, and use DeleteURLs.

Bug: 1008292
Change-Id: I28463eb9c347145331bfda802abca10b54c01d28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1892977Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Byoungkwon Ko <codeimpl@gmail.com>
Cr-Commit-Position: refs/heads/master@{#714349}
parent d2b61b39
......@@ -614,7 +614,7 @@ IN_PROC_BROWSER_TEST_F(LocalSiteCharacteristicsDatabaseTest, PRE_ClearHistory) {
HistoryServiceFactory::GetForProfile(browser()->profile(),
ServiceAccessType::IMPLICIT_ACCESS)
->DeleteURL(test_url);
->DeleteURLs({test_url});
// The history gets cleared asynchronously.
while (reader->UpdatesTitleInBackground() !=
performance_manager::SiteFeatureUsage::kSiteFeatureUsageUnknown) {
......
......@@ -194,7 +194,7 @@ TEST_F(SubresourceFilterContentSettingsManagerHistoryTest,
// Deleting a URL from history while there are still other urls for the
// same origin should not delete the setting.
history_service->DeleteURL(url1);
history_service->DeleteURLs({url1});
history::BlockUntilHistoryProcessesPendingRequests(history_service);
EXPECT_FALSE(settings_manager()->ShouldShowUIForSite(url1));
EXPECT_FALSE(settings_manager()->ShouldShowUIForSite(url2));
......@@ -202,7 +202,7 @@ TEST_F(SubresourceFilterContentSettingsManagerHistoryTest,
// Deleting all URLs of an origin from history should clear the setting for
// this URL. Note that since there is another URL in the history this won't
// clear all items.
history_service->DeleteURL(url2);
history_service->DeleteURLs({url2});
history::BlockUntilHistoryProcessesPendingRequests(history_service);
EXPECT_TRUE(settings_manager()->ShouldShowUIForSite(url1));
......
......@@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientSendTabToSelfSyncTest,
GURL(kUrl))
.Wait());
history_service->DeleteURL(GURL(kUrl));
history_service->DeleteURLs({GURL(kUrl)});
EXPECT_TRUE(send_tab_to_self_helper::SendTabToSelfUrlDeletedChecker(
SendTabToSelfSyncServiceFactory::GetForProfile(GetProfile(0)),
......
......@@ -387,10 +387,13 @@ void ExpireHistoryBetween(int index,
}
void DeleteUrlFromHistory(int index, const GURL& url) {
GetHistoryServiceFromClient(index)->DeleteURL(url);
GetHistoryServiceFromClient(index)->DeleteURLs({url});
if (test()->use_verifier())
HistoryServiceFactory::GetForProfile(
test()->verifier(), ServiceAccessType::IMPLICIT_ACCESS)->DeleteURL(url);
HistoryServiceFactory::GetForProfile(test()->verifier(),
ServiceAccessType::IMPLICIT_ACCESS)
->DeleteURLs({url});
WaitForHistoryDBThread(index);
}
......
......@@ -508,7 +508,7 @@ TEST_F(SearchResultRankerTest, QueryMixedModelDeletesURLCorrectly) {
EXPECT_FALSE(base::PathExists(model_path));
history_service()->AddPage(GURL(url_1), base::Time::Now(),
history::VisitSource::SOURCE_BROWSED);
history_service()->DeleteURL(GURL(url_1));
history_service()->DeleteURLs({GURL(url_1)});
history::BlockUntilHistoryProcessesPendingRequests(history_service());
Wait();
EXPECT_TRUE(base::PathExists(model_path));
......
......@@ -543,7 +543,7 @@ TEST_F(BrowsingHistoryServiceTest, QueryHistoryFullLocalPending) {
/*reached_beginning*/ false, /*has_synced_results*/ true,
{{kUrl3, 3, kRemote}}, QueryHistory(1));
local_history()->DeleteURL(GURL(kUrl1));
local_history()->DeleteURLs({GURL(kUrl1)});
VerifyQueryResult(/*reached_beginning*/ true, /*has_synced_results*/ true,
{{kUrl2, 2, kRemote}, {kUrl1, 1, kLocal}}, ContinueQuery());
}
......
......@@ -3597,7 +3597,7 @@ TEST_F(HistoryBackendTest, RemoveNotification) {
// This won't actually delete the URL, rather it'll empty out the visits.
// This triggers blocking on the BookmarkModel.
service->DeleteURL(url);
service->DeleteURLs({url});
}
// Test DeleteFTSIndexDatabases deletes expected files.
......
......@@ -1027,15 +1027,6 @@ void HistoryService::NotifyProfileError(sql::InitStatus init_status,
history_client_->NotifyProfileError(init_status, diagnostics);
}
void HistoryService::DeleteURL(const GURL& url) {
TRACE_EVENT0("browser", "HistoryService::DeleteURL");
DCHECK(backend_task_runner_) << "History service being called after cleanup";
DCHECK(thread_checker_.CalledOnValidThread());
// We will update the visited links when we observe the delete notifications.
ScheduleTask(PRIORITY_NORMAL, base::BindOnce(&HistoryBackend::DeleteURL,
history_backend_, url));
}
void HistoryService::DeleteURLs(const std::vector<GURL>& urls) {
TRACE_EVENT0("browser", "HistoryService::DeleteURLs");
DCHECK(backend_task_runner_) << "History service being called after cleanup";
......@@ -1170,7 +1161,7 @@ void HistoryService::DeleteLocalAndRemoteUrl(WebHistoryService* web_history,
/*restrict_urls=*/{url}, base::Time(), base::Time::Max(),
base::DoNothing(), partial_traffic_annotation);
}
DeleteURL(url);
DeleteURLs({url});
}
void HistoryService::OnDBLoaded() {
......
......@@ -335,9 +335,6 @@ class HistoryService : public KeyedService {
// Database management operations --------------------------------------------
// Delete all the information related to a single url.
void DeleteURL(const GURL& url);
// Delete all the information related to a list of urls. (Deleting
// URLs one by one is slow as it has to flush to disk each time.)
void DeleteURLs(const std::vector<GURL>& urls);
......
......@@ -174,7 +174,7 @@ class TopSitesImplTest : public HistoryUnitTestBase {
}
// Delets a url.
void DeleteURL(const GURL& url) { history_service()->DeleteURL(url); }
void DeleteURL(const GURL& url) { history_service()->DeleteURLs({url}); }
// Recreates top sites. This forces top sites to reread from the db.
void RecreateTopSitesAndBlock() {
......
......@@ -28,7 +28,7 @@ void HistoryProvider::DeleteMatch(const AutocompleteMatch& match) {
// and indices to drop any data they might have stored pertaining to the URL.
DCHECK(history_service);
DCHECK(match.destination_url.is_valid());
history_service->DeleteURL(match.destination_url);
history_service->DeleteURLs({match.destination_url});
DeleteMatchFromMatches(match);
}
......
......@@ -157,7 +157,7 @@ void ShortcutsProvider::DeleteMatch(const AutocompleteMatch& match) {
// second call to DeleteShortcutsWithURL(), which is harmless.
history::HistoryService* const history_service = client_->GetHistoryService();
DCHECK(history_service);
history_service->DeleteURL(url);
history_service->DeleteURLs({url});
}
ShortcutsProvider::~ShortcutsProvider() {
......
......@@ -339,7 +339,7 @@ void DeleteTypedUrlFromClient(const GURL& url) {
ios::HistoryServiceFactory::GetForBrowserState(
browser_state, ServiceAccessType::EXPLICIT_ACCESS);
history_service->DeleteURL(url);
history_service->DeleteURLs({url});
}
void DeleteTypedUrlFromFakeSyncServer(std::string url) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment