Upstream version 9.37.195.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / safe_browsing / last_download_finder.cc
index 05e7c42..d0e1c2f 100644 (file)
@@ -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.