summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bai <michaelbai@chromium.org>2015-01-08 15:23:37 -0800
committerTao Bai <michaelbai@chromium.org>2015-01-08 23:25:09 +0000
commitc7fcb7dc12b921354ccf7ec395e60656725143b8 (patch)
treeb6ea69b5f6a1ad6faaca6b14e3d29f3ae269cf26
parentceecfed93d852bb9ce85dfaaa553083c0d7911e1 (diff)
downloadchromium_src-c7fcb7dc12b921354ccf7ec395e60656725143b8.zip
chromium_src-c7fcb7dc12b921354ccf7ec395e60656725143b8.tar.gz
chromium_src-c7fcb7dc12b921354ccf7ec395e60656725143b8.tar.bz2
Also remove the cache of favicon from native otherwise the code will be complicated.
BUG=446784 TBR=dtrainor Review URL: https://codereview.chromium.org/844553003 Cr-Commit-Position: refs/heads/master@{#310588} (cherry picked from commit 64134b8b5fba0e1c547bd02449a2e07db164e440) Review URL: https://codereview.chromium.org/839453003 Cr-Commit-Position: refs/branch-heads/2214@{#412} Cr-Branched-From: 03655fd3f6d72165dc3c9bd2c89807305316fe6c-refs/heads/master@{#303346}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/Tab.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
index 72cf801..e8b4781 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/Tab.java
@@ -952,13 +952,12 @@ public class Tab {
// If we have no content or a native page, return null.
if (getContentViewCore() == null) return null;
- if (mFavicon != null) return mFavicon;
+ // Use the cached favicon only if the page wasn't changed.
+ if (mFavicon != null && mFaviconUrl != null && mFaviconUrl.equals(getUrl())) {
+ return mFavicon;
+ }
- // Cache the result so we don't keep querying it.
- mFavicon = nativeGetFavicon(mNativeTabAndroid);
- // Invalidate the favicon URL so that if we do get a favicon for this page we don't drop it.
- mFaviconUrl = null;
- return mFavicon;
+ return nativeGetFavicon(mNativeTabAndroid);
}
/**
@@ -1102,7 +1101,6 @@ public class Tab {
if (url == null) return;
boolean pageUrlChanged = !url.equals(mFaviconUrl);
-
// This method will be called multiple times if the page has more than one favicon.
// we are trying to use the 16x16 DP icon here, Bitmap.createScaledBitmap will return
// the origin bitmap if it is already 16x16 DP.