Skip to content

Commit

Permalink
Revert "Use ObserverList for OverviewModeBehavior"
Browse files Browse the repository at this point in the history
This reverts commit 7dcbfa1.

Reason for revert: breaks build, bug 941226

Original change's description:
> Use ObserverList for OverviewModeBehavior
> 
> This switches to use ObserverList
> OverviewModeObservers in ChromeTabbedActivity. This list gets frequently
> modified during iteration, and Array List is throwing a
> ConcurrentModificationException because of this right now.
> 
> BUG=938236
> [email protected]
> 
> (cherry picked from commit 0775dc30ab0ccfd38181c219c3bc725ae03a5fa4)
> 
> Change-Id: I65c99b774ae34f2984ddb8f5ca254ff8e2af4569
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1515713
> Commit-Queue: Yusuf Ozuysal <[email protected]>
> Reviewed-by: Ted Choc <[email protected]>
> Cr-Original-Commit-Position: refs/heads/master@{#639660}
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1518364
> Reviewed-by: Yusuf Ozuysal <[email protected]>
> Cr-Commit-Position: refs/branch-heads/3729@{#63}
> Cr-Branched-From: d4a8972-refs/heads/master@{#638880}

[email protected],[email protected]

Change-Id: I20a905b15643de0cc270a5c91dcf79f4a81d9c6d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 938236
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1519449
Reviewed-by: Krishna Govind <[email protected]>
Cr-Commit-Position: refs/branch-heads/3729@{#70}
Cr-Branched-From: d4a8972-refs/heads/master@{#638880}
  • Loading branch information
Krishna Govind committed Mar 13, 2019
1 parent 3d0a2d1 commit 4bc7b1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.TOP_CONTROLS_HEIGHT;
import static org.chromium.chrome.browser.tasks.tab_management.TabListContainerProperties.VISIBILITY_LISTENER;

import org.chromium.base.ObserverList;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeController;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
import org.chromium.chrome.browser.fullscreen.FullscreenManager;
Expand All @@ -25,6 +24,9 @@
import org.chromium.chrome.browser.tabmodel.TabSelectionType;
import org.chromium.ui.modelutil.PropertyModel;

import java.util.ArrayList;
import java.util.List;

/**
* The Mediator that is responsible for resetting the tab grid based on visibility and model
* changes.
Expand All @@ -40,7 +42,7 @@ class GridTabSwitcherMediator
private final TabModelSelector mTabModelSelector;
private final TabModelSelectorTabModelObserver mTabModelObserver;
private final TabModelSelectorObserver mTabModelSelectorObserver;
private final ObserverList<OverviewModeObserver> mObservers = new ObserverList<>();
private final List<OverviewModeObserver> mObservers = new ArrayList<>();
private final ChromeFullscreenManager mFullscreenManager;
private final ChromeFullscreenManager.FullscreenListener mFullscreenListener =
new ChromeFullscreenManager.FullscreenListener() {
Expand Down Expand Up @@ -136,13 +138,13 @@ public boolean overviewVisible() {
}

@Override
public void addOverviewModeObserver(OverviewModeObserver observer) {
mObservers.addObserver(observer);
public void addOverviewModeObserver(OverviewModeObserver listener) {
mObservers.add(listener);
}

@Override
public void removeOverviewModeObserver(OverviewModeObserver observer) {
mObservers.removeObserver(observer);
public void removeOverviewModeObserver(OverviewModeObserver listener) {
mObservers.remove(listener);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.MemoryPressureListener;
import org.chromium.base.ObserverList;
import org.chromium.base.ThreadUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.VisibleForTesting;
Expand Down Expand Up @@ -171,6 +170,7 @@

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

Expand Down Expand Up @@ -333,7 +333,7 @@ public void closeAllIncognitoTabs() {
private static class OverviewModeControllerContainer
implements OverviewModeObserver, OverviewModeController {
private OverviewModeController mInternalOverviewModeController;
private ObserverList<OverviewModeObserver> mOverviewModeObserverList = new ObserverList<>();
private List<OverviewModeObserver> mOverviewModeObserverList = new ArrayList<>();

@Override
public boolean overviewVisible() {
Expand All @@ -342,27 +342,25 @@ public boolean overviewVisible() {
}

@Override
public void addOverviewModeObserver(OverviewModeObserver observer) {
mOverviewModeObserverList.addObserver(observer);
public void addOverviewModeObserver(OverviewModeObserver listener) {
mOverviewModeObserverList.add(listener);
}

@Override
public void removeOverviewModeObserver(OverviewModeObserver observer) {
mOverviewModeObserverList.removeObserver(observer);
public void removeOverviewModeObserver(OverviewModeObserver listener) {
mOverviewModeObserverList.remove(listener);
}

@Override
public void hideOverview(boolean animate) {
if (mInternalOverviewModeController != null) {
if (mInternalOverviewModeController != null)
mInternalOverviewModeController.hideOverview(animate);
}
}

@Override
public void showOverview(boolean animate) {
if (mInternalOverviewModeController != null) {
if (mInternalOverviewModeController != null)
mInternalOverviewModeController.showOverview(animate);
}
}

@Override
Expand Down

0 comments on commit 4bc7b1c

Please sign in to comment.