Index: chrome/browser/safe_browsing/last_download_finder.cc |
diff --git a/chrome/browser/safe_browsing/last_download_finder.cc b/chrome/browser/safe_browsing/last_download_finder.cc |
index 05e7c425ffb6dc5ede5203bbba6a18927b2c7051..d0e1c2f17a3fb958f5e7e3e290c97da1e96a001f 100644 |
--- a/chrome/browser/safe_browsing/last_download_finder.cc |
+++ b/chrome/browser/safe_browsing/last_download_finder.cc |
@@ -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. |