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

Side by Side Diff: ui/android/java/src/org/chromium/ui/resources/ResourceManager.java

Issue 2578233002: Remove title resources when they are no longer used (Closed)
Patch Set: address comments Created 3 years, 11 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 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.ui.resources; 5 package org.chromium.ui.resources;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.res.Resources; 8 import android.content.res.Resources;
9 import android.graphics.Bitmap; 9 import android.graphics.Bitmap;
10 import android.graphics.Rect; 10 import android.graphics.Rect;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 Rect padding = resource.getPadding(); 162 Rect padding = resource.getPadding();
163 Rect aperture = resource.getAperture(); 163 Rect aperture = resource.getAperture();
164 164
165 nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resourc e.getBitmap(), 165 nativeOnResourceReady(mNativeResourceManagerPtr, resType, resId, resourc e.getBitmap(),
166 padding.left, padding.top, padding.right, padding.bottom, 166 padding.left, padding.top, padding.right, padding.bottom,
167 aperture.left, aperture.top, aperture.right, aperture.bottom); 167 aperture.left, aperture.top, aperture.right, aperture.bottom);
168 } 168 }
169 169
170 @Override
171 public void onResourceUnregistered(int resType, int resId) {
172 // Only remove dynamic bitmaps that were unregistered.
173 if (resType != AndroidResourceType.DYNAMIC_BITMAP) return;
174
175 nativeRemoveResource(mNativeResourceManagerPtr, resType, resId);
176 }
177
170 /** 178 /**
171 * Clear the cache of tinted assets that the native manager holds. 179 * Clear the cache of tinted assets that the native manager holds.
172 */ 180 */
173 public void clearTintedResourceCache() { 181 public void clearTintedResourceCache() {
174 if (mNativeResourceManagerPtr == 0) return; 182 if (mNativeResourceManagerPtr == 0) return;
175 nativeClearTintedResourceCache(mNativeResourceManagerPtr); 183 nativeClearTintedResourceCache(mNativeResourceManagerPtr);
176 } 184 }
177 185
178 private void saveMetadataForLoadedResource(int resType, int resId, Resource resource) { 186 private void saveMetadataForLoadedResource(int resType, int resId, Resource resource) {
179 SparseArray<LayoutResource> bucket = mLoadedResources.get(resType); 187 SparseArray<LayoutResource> bucket = mLoadedResources.get(resType);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 235
228 private native void nativeOnResourceReady(long nativeResourceManagerImpl, in t resType, 236 private native void nativeOnResourceReady(long nativeResourceManagerImpl, in t resType,
229 int resId, Bitmap bitmap, int paddingLeft, int paddingTop, int paddi ngRight, 237 int resId, Bitmap bitmap, int paddingLeft, int paddingTop, int paddi ngRight,
230 int paddingBottom, int apertureLeft, int apertureTop, int apertureRi ght, 238 int paddingBottom, int apertureLeft, int apertureTop, int apertureRi ght,
231 int apertureBottom); 239 int apertureBottom);
232 private native void nativeOnCrushedSpriteResourceReady(long nativeResourceMa nagerImpl, 240 private native void nativeOnCrushedSpriteResourceReady(long nativeResourceMa nagerImpl,
233 int bitmapResId, Bitmap bitmap, int[][] frameRects, int unscaledSpri teWidth, 241 int bitmapResId, Bitmap bitmap, int[][] frameRects, int unscaledSpri teWidth,
234 int unscaledSpriteHeight, float scaledSpriteWidth, float scaledSprit eHeight); 242 int unscaledSpriteHeight, float scaledSpriteWidth, float scaledSprit eHeight);
235 private native void nativeOnCrushedSpriteResourceReloaded(long nativeResourc eManagerImpl, 243 private native void nativeOnCrushedSpriteResourceReloaded(long nativeResourc eManagerImpl,
236 int bitmapResId, Bitmap bitmap); 244 int bitmapResId, Bitmap bitmap);
245 private native void nativeRemoveResource(long nativeResourceManagerImpl, int resType,
246 int resId);
237 private native void nativeClearTintedResourceCache(long nativeResourceManage rImpl); 247 private native void nativeClearTintedResourceCache(long nativeResourceManage rImpl);
238 248
239 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698