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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.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.ntp; 5 package org.chromium.chrome.browser.ntp;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.content.Context; 8 import android.content.Context;
9 import android.graphics.Canvas; 9 import android.graphics.Canvas;
10 import android.graphics.Point; 10 import android.graphics.Point;
11 import android.graphics.Rect; 11 import android.graphics.Rect;
12 import android.os.Build; 12 import android.os.Build;
13 import android.support.v4.view.ViewCompat; 13 import android.support.v4.view.ViewCompat;
14 import android.support.v7.widget.RecyclerView; 14 import android.support.v7.widget.RecyclerView;
15 import android.text.TextUtils; 15 import android.text.TextUtils;
16 import android.view.LayoutInflater; 16 import android.view.LayoutInflater;
17 import android.view.View; 17 import android.view.View;
18 18
19 import org.chromium.base.ApiCompatibilityUtils; 19 import org.chromium.base.ApiCompatibilityUtils;
20 import org.chromium.base.CommandLine; 20 import org.chromium.base.CommandLine;
21 import org.chromium.base.DiscardableReferencePool;
21 import org.chromium.base.Log; 22 import org.chromium.base.Log;
22 import org.chromium.base.TraceEvent; 23 import org.chromium.base.TraceEvent;
23 import org.chromium.base.VisibleForTesting; 24 import org.chromium.base.VisibleForTesting;
24 import org.chromium.base.metrics.RecordHistogram; 25 import org.chromium.base.metrics.RecordHistogram;
25 import org.chromium.base.metrics.RecordUserAction; 26 import org.chromium.base.metrics.RecordUserAction;
26 import org.chromium.chrome.R; 27 import org.chromium.chrome.R;
27 import org.chromium.chrome.browser.ChromeActivity; 28 import org.chromium.chrome.browser.ChromeActivity;
28 import org.chromium.chrome.browser.ChromeFeatureList; 29 import org.chromium.chrome.browser.ChromeFeatureList;
29 import org.chromium.chrome.browser.ChromeSwitches; 30 import org.chromium.chrome.browser.ChromeSwitches;
30 import org.chromium.chrome.browser.NativePage; 31 import org.chromium.chrome.browser.NativePage;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 @VisibleForTesting 172 @VisibleForTesting
172 public static void setSuggestionsSourceForTests(SuggestionsSource suggestion sSource) { 173 public static void setSuggestionsSourceForTests(SuggestionsSource suggestion sSource) {
173 sSuggestionsSourceForTests = suggestionsSource; 174 sSuggestionsSourceForTests = suggestionsSource;
174 } 175 }
175 176
176 private class NewTabPageManagerImpl 177 private class NewTabPageManagerImpl
177 extends SuggestionsUiDelegateImpl implements NewTabPageManager { 178 extends SuggestionsUiDelegateImpl implements NewTabPageManager {
178 public NewTabPageManagerImpl(SuggestionsSource suggestionsSource, 179 public NewTabPageManagerImpl(SuggestionsSource suggestionsSource,
179 SuggestionsEventReporter eventReporter, 180 SuggestionsEventReporter eventReporter,
180 SuggestionsNavigationDelegate navigationDelegate, Profile profil e, 181 SuggestionsNavigationDelegate navigationDelegate, Profile profil e,
181 NativePageHost nativePageHost) { 182 NativePageHost nativePageHost, DiscardableReferencePool referenc ePool) {
182 super(suggestionsSource, eventReporter, navigationDelegate, profile, nativePageHost); 183 super(suggestionsSource, eventReporter, navigationDelegate, profile, nativePageHost,
184 referencePool);
183 } 185 }
184 186
185 @Override 187 @Override
186 public boolean isLocationBarShownInNTP() { 188 public boolean isLocationBarShownInNTP() {
187 if (mIsDestroyed) return false; 189 if (mIsDestroyed) return false;
188 Context context = mNewTabPageView.getContext(); 190 Context context = mNewTabPageView.getContext();
189 return isInSingleUrlBarMode(context) 191 return isInSingleUrlBarMode(context)
190 && !mNewTabPageView.urlFocusAnimationsDisabled(); 192 && !mNewTabPageView.urlFocusAnimationsDisabled();
191 } 193 }
192 194
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 mTab = nativePageHost.getActiveTab(); 317 mTab = nativePageHost.getActiveTab();
316 mTabModelSelector = tabModelSelector; 318 mTabModelSelector = tabModelSelector;
317 Profile profile = mTab.getProfile(); 319 Profile profile = mTab.getProfile();
318 320
319 mSnippetsBridge = new SnippetsBridge(profile); 321 mSnippetsBridge = new SnippetsBridge(profile);
320 SuggestionsEventReporter eventReporter = new SuggestionsEventReporterBri dge(); 322 SuggestionsEventReporter eventReporter = new SuggestionsEventReporterBri dge();
321 323
322 SuggestionsNavigationDelegateImpl navigationDelegate = 324 SuggestionsNavigationDelegateImpl navigationDelegate =
323 new SuggestionsNavigationDelegateImpl( 325 new SuggestionsNavigationDelegateImpl(
324 activity, profile, nativePageHost, tabModelSelector); 326 activity, profile, nativePageHost, tabModelSelector);
325 mNewTabPageManager = new NewTabPageManagerImpl( 327 mNewTabPageManager = new NewTabPageManagerImpl(mSnippetsBridge, eventRep orter,
326 mSnippetsBridge, eventReporter, navigationDelegate, profile, nat ivePageHost); 328 navigationDelegate, profile, nativePageHost, activity.getReferen cePool());
327 mTileGroupDelegate = new NewTabPageTileGroupDelegate( 329 mTileGroupDelegate = new NewTabPageTileGroupDelegate(
328 activity, profile, tabModelSelector, navigationDelegate); 330 activity, profile, tabModelSelector, navigationDelegate);
329 331
330 mTitle = activity.getResources().getString(R.string.button_new_tab); 332 mTitle = activity.getResources().getString(R.string.button_new_tab);
331 mBackgroundColor = ApiCompatibilityUtils.getColor(activity.getResources( ), R.color.ntp_bg); 333 mBackgroundColor = ApiCompatibilityUtils.getColor(activity.getResources( ), R.color.ntp_bg);
332 mThemeColor = ApiCompatibilityUtils.getColor( 334 mThemeColor = ApiCompatibilityUtils.getColor(
333 activity.getResources(), R.color.default_primary_color); 335 activity.getResources(), R.color.default_primary_color);
334 TemplateUrlService.getInstance().addObserver(this); 336 TemplateUrlService.getInstance().addObserver(this);
335 337
336 mTabObserver = new EmptyTabObserver() { 338 mTabObserver = new EmptyTabObserver() {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 @Override 612 @Override
611 public boolean shouldCaptureThumbnail() { 613 public boolean shouldCaptureThumbnail() {
612 return mNewTabPageView.shouldCaptureThumbnail(); 614 return mNewTabPageView.shouldCaptureThumbnail();
613 } 615 }
614 616
615 @Override 617 @Override
616 public void captureThumbnail(Canvas canvas) { 618 public void captureThumbnail(Canvas canvas) {
617 mNewTabPageView.captureThumbnail(canvas); 619 mNewTabPageView.captureThumbnail(canvas);
618 } 620 }
619 } 621 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698