| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.compositor.layouts.content; | 5 package org.chromium.chrome.browser.compositor.layouts.content; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.util.SparseArray; | 10 import android.util.SparseArray; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Override the cache size on the command line with | 105 // Override the cache size on the command line with |
| 106 // --approximation-thumbnails=100 | 106 // --approximation-thumbnails=100 |
| 107 int approximationCacheSize = getIntegerResourceWithOverride(mContext, | 107 int approximationCacheSize = getIntegerResourceWithOverride(mContext, |
| 108 R.integer.default_approximation_thumbnail_cache_size, | 108 R.integer.default_approximation_thumbnail_cache_size, |
| 109 ChromeSwitches.APPROXIMATION_THUMBNAILS); | 109 ChromeSwitches.APPROXIMATION_THUMBNAILS); |
| 110 | 110 |
| 111 float thumbnailScale = 1.f; | 111 float thumbnailScale = 1.f; |
| 112 boolean useApproximationThumbnails; | 112 boolean useApproximationThumbnails; |
| 113 float deviceDensity = mContext.getResources().getDisplayMetrics().densit
y; | 113 float deviceDensity = mContext.getResources().getDisplayMetrics().densit
y; |
| 114 if (DeviceFormFactor.isTablet(mContext)) { | 114 if (DeviceFormFactor.isTablet()) { |
| 115 // Scale all tablets to MDPI. | 115 // Scale all tablets to MDPI. |
| 116 thumbnailScale = 1.f / deviceDensity; | 116 thumbnailScale = 1.f / deviceDensity; |
| 117 useApproximationThumbnails = false; | 117 useApproximationThumbnails = false; |
| 118 } else { | 118 } else { |
| 119 // For phones, reduce the amount of memory usage by capturing a lowe
r-res thumbnail for | 119 // For phones, reduce the amount of memory usage by capturing a lowe
r-res thumbnail for |
| 120 // devices with resolution higher than HDPI (crbug.com/357740). | 120 // devices with resolution higher than HDPI (crbug.com/357740). |
| 121 if (deviceDensity > 1.5f) { | 121 if (deviceDensity > 1.5f) { |
| 122 thumbnailScale = 1.5f / deviceDensity; | 122 thumbnailScale = 1.5f / deviceDensity; |
| 123 } | 123 } |
| 124 useApproximationThumbnails = true; | 124 useApproximationThumbnails = true; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 private native void nativeCacheTabWithBitmap(long nativeTabContentManager, O
bject tab, | 323 private native void nativeCacheTabWithBitmap(long nativeTabContentManager, O
bject tab, |
| 324 Object bitmap, float thumbnailScale); | 324 Object bitmap, float thumbnailScale); |
| 325 private native void nativeInvalidateIfChanged(long nativeTabContentManager,
int tabId, | 325 private native void nativeInvalidateIfChanged(long nativeTabContentManager,
int tabId, |
| 326 String url); | 326 String url); |
| 327 private native void nativeUpdateVisibleIds( | 327 private native void nativeUpdateVisibleIds( |
| 328 long nativeTabContentManager, int[] priority, int primaryTabId); | 328 long nativeTabContentManager, int[] priority, int primaryTabId); |
| 329 private native void nativeRemoveTabThumbnail(long nativeTabContentManager, i
nt tabId); | 329 private native void nativeRemoveTabThumbnail(long nativeTabContentManager, i
nt tabId); |
| 330 private native void nativeGetDecompressedThumbnail(long nativeTabContentMana
ger, int tabId); | 330 private native void nativeGetDecompressedThumbnail(long nativeTabContentMana
ger, int tabId); |
| 331 private static native void nativeDestroy(long nativeTabContentManager); | 331 private static native void nativeDestroy(long nativeTabContentManager); |
| 332 } | 332 } |
| OLD | NEW |