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

Unified Diff: ui/android/java/src/org/chromium/ui/resources/ResourceLoader.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/resources/ResourceManager.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/resources/ResourceManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698