Index: ui/android/java/src/org/chromium/ui/resources/ResourceLoader.java |
diff --git a/ui/android/java/src/org/chromium/ui/resources/ResourceLoader.java b/ui/android/java/src/org/chromium/ui/resources/ResourceLoader.java |
index eef765e46deb81ef00333c002da60f48633dec07..46236e4095304148811da5d729a4047961c6ef6d 100644 |
--- a/ui/android/java/src/org/chromium/ui/resources/ResourceLoader.java |
+++ b/ui/android/java/src/org/chromium/ui/resources/ResourceLoader.java |
@@ -22,6 +22,16 @@ public abstract class ResourceLoader { |
* not be loaded. |
*/ |
void onResourceLoaded(int resType, int resId, Resource resource); |
+ |
+ /** |
+ * Called when a resource is unregistered (unneeded). This should only be called for |
+ * dynamic bitmap resources since they change constantly and are replaced with new bitmaps. |
+ * Other resource types should not need this since thay are static for the lifetime of the |
+ * application. |
+ * @param resType The {@link ResourceType} of resource that was removed. |
+ * @param redId The Android id of the removed resource. |
+ */ |
+ void onResourceUnregistered(int resType, int resId); |
} |
private final int mResourceType; |
@@ -68,4 +78,13 @@ public abstract class ResourceLoader { |
protected void notifyLoadFinished(int resId, Resource resource) { |
if (mCallback != null) mCallback.onResourceLoaded(getResourceType(), resId, resource); |
} |
+ |
+ /** |
+ * A helper method for subclasses to notify the manager that a {@link Resource} is no longer |
+ * being used. |
+ * @param resId The id of the {@link Resource} being unloaded. |
+ */ |
+ protected void notifyResourceUnregistered(int resId) { |
+ if (mCallback != null) mCallback.onResourceUnregistered(getResourceType(), resId); |
+ } |
} |