Commit b3e5a5ae authored by grt@chromium.org's avatar grt@chromium.org

Make safe browsing's last download finder's SearchInProfile idempotent.

Different orderings of notifications could previously trip up the finder.
They don't now.

BUG=397229
R=shess@chromium.org

Review URL: https://codereview.chromium.org/418103006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285495 0039d316-1c4b-4281-b951-d872f2087c98
parent 1859d52d
......@@ -145,6 +145,14 @@ void LastDownloadFinder::SearchInProfile(Profile* profile) {
return;
}
// Exit early if already processing this profile. This could happen if, for
// example, NOTIFICATION_PROFILE_ADDED arrives after construction while
// waiting for NOTIFICATION_HISTORY_LOADED.
if (std::find(profiles_.begin(), profiles_.end(), profile) !=
profiles_.end()) {
return;
}
HistoryService* history_service =
HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS);
// No history service is returned for profiles that do not save history.
......
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