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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java

Issue 2810373002: InstalledAppProviderImpl: Assert that code is run off the UI thread. (Closed)
Patch Set: Fix spelling of UI. Created 3 years, 7 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: content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java b/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
index fd2f72def84df73ba35a93089f576c6b74df99f9..04047a84983f5c2da1dbe81ee3057abf25a67c36 100644
--- a/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/installedapp/InstalledAppProviderImpl.java
@@ -112,8 +112,6 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
/**
* Filters a list of apps, returning those that are both installed and match the origin.
*
- * This method is expected to be called on a background thread (not the main UI thread).
- *
* @param relatedApps A list of applications to be filtered.
* @param frameUrl The URL of the frame this operation was called from.
* @return Pair of: A subsequence of applications that meet the criteria, and, the total amount
@@ -122,6 +120,8 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
*/
private Pair<RelatedApplication[], Integer> filterInstalledAppsOnBackgroundThread(
RelatedApplication[] relatedApps, URI frameUrl) {
+ ThreadUtils.assertOnBackgroundThread();
+
ArrayList<RelatedApplication> installedApps = new ArrayList<RelatedApplication>();
int delayMillis = 0;
PackageManager pm = mContext.getPackageManager();
@@ -172,6 +172,8 @@ public class InstalledAppProviderImpl implements InstalledAppProvider {
*/
private boolean isAppInstalledAndAssociatedWithOrigin(
String packageName, URI frameUrl, PackageManager pm) {
+ ThreadUtils.assertOnBackgroundThread();
+
if (frameUrl == null) return false;
// Early-exit if the Android app is not installed.

Powered by Google App Engine
This is Rietveld 408576698