Commit 0a220b3d authored by Scott Violet's avatar Scott Violet Committed by Commit Bot

weblayer: converts Browser.getTabs() from returning a List to a Set

A list implies a certain order. getTabs() does not return a particular
order. This converts the return value to a Set to reinforce the order is
not defined.

This is an incomptible API change. The change is purely in the client
library, so there is worry about compatibility with different implementation
versions. This change was requested by Alihan, and they understand it is
incomptible.

BUG=none
TEST=none

Change-Id: I5c4777b6624ba501c0708eacc7d81217a17f253e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080478Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745643}
parent b2403300
...@@ -19,7 +19,7 @@ import org.chromium.weblayer_private.interfaces.ITab; ...@@ -19,7 +19,7 @@ import org.chromium.weblayer_private.interfaces.ITab;
import org.chromium.weblayer_private.interfaces.ObjectWrapper; import org.chromium.weblayer_private.interfaces.ObjectWrapper;
import org.chromium.weblayer_private.interfaces.StrictModeWorkaround; import org.chromium.weblayer_private.interfaces.StrictModeWorkaround;
import java.util.List; import java.util.Set;
/** /**
* Browser contains any number of Tabs, with one active Tab. The active Tab is visible to the user, * Browser contains any number of Tabs, with one active Tab. The active Tab is visible to the user,
...@@ -153,7 +153,7 @@ public class Browser { ...@@ -153,7 +153,7 @@ public class Browser {
* @return The Tabs * @return The Tabs
*/ */
@NonNull @NonNull
public List<Tab> getTabs() { public Set<Tab> getTabs() {
ThreadCheck.ensureOnUiThread(); ThreadCheck.ensureOnUiThread();
return Tab.getTabsInBrowser(this); return Tab.getTabsInBrowser(this);
} }
......
...@@ -27,10 +27,10 @@ import org.chromium.weblayer_private.interfaces.ITabClient; ...@@ -27,10 +27,10 @@ import org.chromium.weblayer_private.interfaces.ITabClient;
import org.chromium.weblayer_private.interfaces.ObjectWrapper; import org.chromium.weblayer_private.interfaces.ObjectWrapper;
import org.chromium.weblayer_private.interfaces.StrictModeWorkaround; import org.chromium.weblayer_private.interfaces.StrictModeWorkaround;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* Represents a single tab in a browser. More specifically, owns a NavigationController, and allows * Represents a single tab in a browser. More specifically, owns a NavigationController, and allows
...@@ -93,8 +93,8 @@ public class Tab { ...@@ -93,8 +93,8 @@ public class Tab {
return sTabMap.get(id); return sTabMap.get(id);
} }
static List<Tab> getTabsInBrowser(Browser browser) { static Set<Tab> getTabsInBrowser(Browser browser) {
List<Tab> tabs = new ArrayList<Tab>(); Set<Tab> tabs = new HashSet<Tab>();
for (Tab tab : sTabMap.values()) { for (Tab tab : sTabMap.values()) {
if (tab.getBrowser() == browser) tabs.add(tab); if (tab.getBrowser() == browser) tabs.add(tab);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment