Commit bfb3bed8 authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Fixed OOM issue for download progress infobar

InfoBarContainerLayout is a FrameLayout, which seems to keep references
to its children after onMeasure call, even if they might have been
removed. This causes DownloadProgressInfoBar to leak memory, if we move
to another tab and keep downloading, while in theory we close the
infobar of the background tab. OptimizedFrameLayout actually clears
the references after onMeasure, hence using that seems to fix this issue.

Bug: 1008906
Change-Id: I292331d3315728005fe7e81d03a08b00c2bcfab1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838912Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702972}
parent 7a65f3e5
......@@ -22,6 +22,7 @@ import androidx.annotation.IntDef;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.infobar.InfoBarContainer.InfoBarAnimationListener;
import org.chromium.ui.widget.OptimizedFrameLayout;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
......@@ -65,7 +66,7 @@ import java.util.ArrayList;
*
* TODO(newt): finalize animation timings and interpolators.
*/
public class InfoBarContainerLayout extends FrameLayout {
public class InfoBarContainerLayout extends OptimizedFrameLayout {
/**
* An interface for items that can be added to an InfoBarContainerLayout.
*/
......@@ -126,7 +127,7 @@ public class InfoBarContainerLayout extends FrameLayout {
*/
InfoBarContainerLayout(Context context, Runnable makeContainerVisibleRunnable,
InfoBarAnimationListener animationListener) {
super(context);
super(context, null);
Resources res = context.getResources();
mBackInfobarHeight = res.getDimensionPixelSize(R.dimen.infobar_peeking_height);
mFloatingBehavior = new FloatingBehavior(this);
......
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