Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1895)

Unified Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 2384413003: Revert of Refactor WebappRegistry into a singleton instance. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index 8971a0c8a3e73d6384375034a077cf466295104b..67c8df3a5b9f4d079e58ed64c21faa09aba5d7cb 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -699,8 +699,13 @@
}
// Clear the history information (last launch time and origin URL) of any
- // registered webapps.
- webapp_registry_->ClearWebappHistoryForUrls(filter);
+ // registered webapps. The webapp_registry makes a JNI call into a Java-side
+ // AsyncTask, so don't wait for the reply.
+ waiting_for_clear_webapp_history_ = true;
+ webapp_registry_->ClearWebappHistoryForUrls(
+ filter,
+ base::Bind(&BrowsingDataRemover::OnClearedWebappHistory,
+ weak_ptr_factory_.GetWeakPtr()));
#endif
data_reduction_proxy::DataReductionProxySettings*
@@ -1137,9 +1142,15 @@
}
#if BUILDFLAG(ANDROID_JAVA_UI)
- // Clear all data associated with registered webapps.
- if (remove_mask & REMOVE_WEBAPP_DATA)
- webapp_registry_->UnregisterWebappsForUrls(filter);
+ if (remove_mask & REMOVE_WEBAPP_DATA) {
+ // Clear all data associated with registered webapps. The webapp_registry
+ // makes a JNI call into a Java-side AsyncTask, so don't wait for the reply.
+ waiting_for_clear_webapp_data_ = true;
+ webapp_registry_->UnregisterWebappsForUrls(
+ filter,
+ base::Bind(&BrowsingDataRemover::OnClearedWebappData,
+ weak_ptr_factory_.GetWeakPtr()));
+ }
// For now we're considering offline pages as cache, so if we're removing
// cache we should remove offline pages as well.
@@ -1247,6 +1258,8 @@
!waiting_for_clear_pnacl_cache_ &&
#if BUILDFLAG(ANDROID_JAVA_UI)
!waiting_for_clear_precache_history_ &&
+ !waiting_for_clear_webapp_data_ &&
+ !waiting_for_clear_webapp_history_ &&
!waiting_for_clear_offline_page_data_ &&
#endif
#if defined(ENABLE_WEBRTC)
@@ -1505,6 +1518,18 @@
NotifyIfDone();
}
+void BrowsingDataRemover::OnClearedWebappData() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ waiting_for_clear_webapp_data_ = false;
+ NotifyIfDone();
+}
+
+void BrowsingDataRemover::OnClearedWebappHistory() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ waiting_for_clear_webapp_history_ = false;
+ NotifyIfDone();
+}
+
void BrowsingDataRemover::OnClearedOfflinePageData(
offline_pages::OfflinePageModel::DeletePageResult result) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698