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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java

Issue 2035203002: Make ExternalNavigationHandler#intentsHaveSameResolvers() faster (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
index 5a86992c61579c0e43facf58d1d21524bd386ff0..62e7b26e134f1410c79c85b6eb56c6c04d801d72 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
@@ -121,15 +121,15 @@ public class ExternalNavigationHandler {
return result;
}
- private boolean intentsHaveSameResolvers(Intent intent, Intent previousIntent) {
- HashSet<ComponentName> previousHandlers = new HashSet<>();
- for (ResolveInfo r : mDelegate.queryIntentActivities(previousIntent)) {
- previousHandlers.add(new ComponentName(r.activityInfo.packageName,
- r.activityInfo.name));
+ private boolean resolversSubsetOf(List<ResolveInfo> infos, List<ResolveInfo> container) {
+ HashSet<ComponentName> containerSet = new HashSet<>();
+ for (ResolveInfo info : container) {
+ containerSet.add(
+ new ComponentName(info.activityInfo.packageName, info.activityInfo.name));
}
- for (ResolveInfo r : mDelegate.queryIntentActivities(intent)) {
- if (!previousHandlers.contains(new ComponentName(
- r.activityInfo.packageName, r.activityInfo.name))) {
+ for (ResolveInfo info : infos) {
+ if (!containerSet.contains(new ComponentName(
+ info.activityInfo.packageName, info.activityInfo.name))) {
return false;
}
}
@@ -377,10 +377,10 @@ public class ExternalNavigationHandler {
previousIntent = null;
}
- if (previousIntent != null) {
- if (intentsHaveSameResolvers(intent, previousIntent)) {
- return OverrideUrlLoadingResult.NO_OVERRIDE;
- }
+ if (previousIntent != null
+ && resolversSubsetOf(resolvingInfos,
+ mDelegate.queryIntentActivities(previousIntent))) {
+ return OverrideUrlLoadingResult.NO_OVERRIDE;
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698