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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java

Issue 2865963003: [Suggestions UI] Drop Bitmap references from articles under memory pressure. (Closed)
Patch Set: remove annotation Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 28 matching lines...) Expand all
39 import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeL istener; 39 import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeL istener;
40 import android.view.accessibility.AccessibilityManager.TouchExplorationStateChan geListener; 40 import android.view.accessibility.AccessibilityManager.TouchExplorationStateChan geListener;
41 41
42 import org.chromium.base.ActivityState; 42 import org.chromium.base.ActivityState;
43 import org.chromium.base.ApiCompatibilityUtils; 43 import org.chromium.base.ApiCompatibilityUtils;
44 import org.chromium.base.ApplicationStatus; 44 import org.chromium.base.ApplicationStatus;
45 import org.chromium.base.BaseSwitches; 45 import org.chromium.base.BaseSwitches;
46 import org.chromium.base.Callback; 46 import org.chromium.base.Callback;
47 import org.chromium.base.CommandLine; 47 import org.chromium.base.CommandLine;
48 import org.chromium.base.ContextUtils; 48 import org.chromium.base.ContextUtils;
49 import org.chromium.base.DiscardableReferencePool;
49 import org.chromium.base.SysUtils; 50 import org.chromium.base.SysUtils;
50 import org.chromium.base.TraceEvent; 51 import org.chromium.base.TraceEvent;
51 import org.chromium.base.VisibleForTesting; 52 import org.chromium.base.VisibleForTesting;
52 import org.chromium.base.metrics.RecordHistogram; 53 import org.chromium.base.metrics.RecordHistogram;
53 import org.chromium.base.metrics.RecordUserAction; 54 import org.chromium.base.metrics.RecordUserAction;
54 import org.chromium.chrome.R; 55 import org.chromium.chrome.R;
55 import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; 56 import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate;
56 import org.chromium.chrome.browser.IntentHandler.TabOpenType; 57 import org.chromium.chrome.browser.IntentHandler.TabOpenType;
57 import org.chromium.chrome.browser.appmenu.AppMenu; 58 import org.chromium.chrome.browser.appmenu.AppMenu;
58 import org.chromium.chrome.browser.appmenu.AppMenuHandler; 59 import org.chromium.chrome.browser.appmenu.AppMenuHandler;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 private BottomSheetContentController mBottomSheetContentController; 266 private BottomSheetContentController mBottomSheetContentController;
266 private FadingBackgroundView mFadingBackgroundView; 267 private FadingBackgroundView mFadingBackgroundView;
267 268
268 // Time in ms that it took took us to inflate the initial layout 269 // Time in ms that it took took us to inflate the initial layout
269 private long mInflateInitialLayoutDurationMs; 270 private long mInflateInitialLayoutDurationMs;
270 271
271 private int mUiMode; 272 private int mUiMode;
272 private int mScreenWidthDp; 273 private int mScreenWidthDp;
273 private Runnable mRecordMultiWindowModeScreenWidthRunnable; 274 private Runnable mRecordMultiWindowModeScreenWidthRunnable;
274 275
276 private final DiscardableReferencePool mReferencePool = new DiscardableRefer encePool();
277
275 private AssistStatusHandler mAssistStatusHandler; 278 private AssistStatusHandler mAssistStatusHandler;
276 279
277 // A set of views obscuring all tabs. When this set is nonempty, 280 // A set of views obscuring all tabs. When this set is nonempty,
278 // all tab content will be hidden from the accessibility tree. 281 // all tab content will be hidden from the accessibility tree.
279 private Set<View> mViewsObscuringAllTabs = new HashSet<>(); 282 private Set<View> mViewsObscuringAllTabs = new HashSet<>();
280 283
281 // See enableHardwareAcceleration() 284 // See enableHardwareAcceleration()
282 private boolean mSetWindowHWA; 285 private boolean mSetWindowHWA;
283 286
284 // Skips capturing screenshot for testing purpose. 287 // Skips capturing screenshot for testing purpose.
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 return; 1774 return;
1772 } 1775 }
1773 1776
1774 if (mContextualSearchManager != null && mContextualSearchManager.onBackP ressed()) return; 1777 if (mContextualSearchManager != null && mContextualSearchManager.onBackP ressed()) return;
1775 1778
1776 if (handleBackPressed()) return; 1779 if (handleBackPressed()) return;
1777 1780
1778 super.onBackPressed(); 1781 super.onBackPressed();
1779 } 1782 }
1780 1783
1784 @Override
1785 public void onTrimMemory(int level) {
1786 super.onTrimMemory(level);
1787 // The conditions are expressed using ranges to capture intermediate lev els possibly added
1788 // to the API in the future.
1789 if ((level >= TRIM_MEMORY_RUNNING_LOW && level < TRIM_MEMORY_UI_HIDDEN)
1790 || level >= TRIM_MEMORY_MODERATE) {
1791 mReferencePool.drain();
1792 }
1793 }
1781 1794
1782 private ContentViewCore getContentViewCore() { 1795 private ContentViewCore getContentViewCore() {
1783 Tab tab = getActivityTab(); 1796 Tab tab = getActivityTab();
1784 if (tab == null) return null; 1797 if (tab == null) return null;
1785 return tab.getContentViewCore(); 1798 return tab.getContentViewCore();
1786 } 1799 }
1787 1800
1788 @Override 1801 @Override
1789 public void createContextualSearchTab(String searchUrl) { 1802 public void createContextualSearchTab(String searchUrl) {
1790 Tab currentTab = getActivityTab(); 1803 Tab currentTab = getActivityTab();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2196 */ 2209 */
2197 public void onExitVr() {} 2210 public void onExitVr() {}
2198 2211
2199 /** 2212 /**
2200 * Whether this Activity supports moving a {@link Tab} to the 2213 * Whether this Activity supports moving a {@link Tab} to the
2201 * {@link FullscreenWebContentsActivity} when it enters fullscreen. 2214 * {@link FullscreenWebContentsActivity} when it enters fullscreen.
2202 */ 2215 */
2203 public boolean supportsFullscreenActivity() { 2216 public boolean supportsFullscreenActivity() {
2204 return false; 2217 return false;
2205 } 2218 }
2219
2220 /**
2221 * @return the reference pool for this activity.
2222 */
2223 public DiscardableReferencePool getReferencePool() {
2224 return mReferencePool;
2225 }
2206 } 2226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698