Commit 6d3eae2d authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

LocalDB: Update OnURLsDeleted() to fix a DCHECK failure

Bug: 966059
Change-Id: I9afc2ed7c722166f6dbcd96c412387fab97d32ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1752743
Commit-Queue: Sébastien Marchand <sebmarchand@chromium.org>
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686585}
parent ff65236c
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "chrome/browser/resource_coordinator/tab_manager_features.h" #include "chrome/browser/resource_coordinator/tab_manager_features.h"
#include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/url_row.h" #include "components/history/core/browser/url_row.h"
#include "url/gurl.h"
namespace resource_coordinator { namespace resource_coordinator {
...@@ -24,9 +25,9 @@ constexpr char kSiteCharacteristicsDirectoryName[] = ...@@ -24,9 +25,9 @@ constexpr char kSiteCharacteristicsDirectoryName[] =
"Site Characteristics Database"; "Site Characteristics Database";
size_t CountOriginsInURLRows(const history::URLRows& rows) { size_t CountOriginsInURLRows(const history::URLRows& rows) {
std::set<url::Origin> origins; std::set<GURL> origins;
for (auto& row : rows) for (auto& row : rows)
origins.insert(url::Origin::Create(row.url())); origins.insert(row.url().GetOrigin());
return origins.size(); return origins.size();
} }
...@@ -164,8 +165,11 @@ void LocalSiteCharacteristicsDataStore::OnURLsDeleted( ...@@ -164,8 +165,11 @@ void LocalSiteCharacteristicsDataStore::OnURLsDeleted(
} else { } else {
std::vector<url::Origin> origins_to_remove; std::vector<url::Origin> origins_to_remove;
DCHECK_EQ(deletion_info.deleted_urls_origin_map().size(), // CHECK_EQ instead of DCHECK_EQ to determine if
CountOriginsInURLRows(deletion_info.deleted_rows())); // https://crbug.com/966059 still happens in production.
// TODO(sebmarchand): Remove once https://crbug.com/966059 is fixed.
CHECK_EQ(deletion_info.deleted_urls_origin_map().size(),
CountOriginsInURLRows(deletion_info.deleted_rows()));
for (const auto& it : deletion_info.deleted_urls_origin_map()) { for (const auto& it : deletion_info.deleted_urls_origin_map()) {
const url::Origin origin = url::Origin::Create(it.first); const url::Origin origin = url::Origin::Create(it.first);
const int remaining_visits_in_history = it.second.first; const int remaining_visits_in_history = it.second.first;
......
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