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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java

Issue 1560573002: Reduce infobar lag on KitKat from 1000ms to 100ms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: appease the FindBugs gods Created 4 years, 12 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: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
index 50d90795b6940503dd851212ad17d75c06947ff1..c021c25cfe51ca87963695bef74b71c7389c8389 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarLayout.java
@@ -139,7 +139,6 @@ public final class InfoBarLayout extends ViewGroup implements View.OnClickListen
private Button mSecondaryButton;
private View mCustomButton;
- private Group mMainGroup;
private Group mButtonGroup;
private boolean mIsUsingBigIcon;
@@ -342,14 +341,12 @@ public final class InfoBarLayout extends ViewGroup implements View.OnClickListen
* first call to onMeasure().
*/
void onContentCreated() {
- mMainGroup = new Group(mMessageLayout);
-
View[] buttons = Group.filterNullViews(mCustomButton, mSecondaryButton, mPrimaryButton);
if (buttons.length != 0) mButtonGroup = new Group(buttons);
// Add the child views in the desired focus order.
if (mIconView != null) addView(mIconView);
- for (View v : mMainGroup.views) addView(v);
+ addView(mMessageLayout);
for (View v : mControlLayouts) addView(v);
if (mButtonGroup != null) {
for (View v : mButtonGroup.views) addView(v);
@@ -399,6 +396,10 @@ public final class InfoBarLayout extends ViewGroup implements View.OnClickListen
// big each child wants to be.
int unspecifiedSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
for (int i = 0; i < getChildCount(); i++) {
+ // No need to do a preliminary measure() on an InfoBarControlLayout,
+ // since InfoBarControlLayout handles all the measuring logic internally.
+ // TODO(dfalcantara): remove this instanceof check when refactoring this method.
+ if (getChildAt(i) instanceof InfoBarControlLayout) continue;
measureChild(getChildAt(i), unspecifiedSpec, unspecifiedSpec);
}

Powered by Google App Engine
This is Rietveld 408576698