Closed Bug 1116349 Opened 9 years ago Closed 9 years ago

Flush Picasso LRU cache on memory pressure events

Categories

(Firefox for Android Graveyard :: General, defect)

All
Android
defect
Not set
normal

Tracking

(firefox42 fixed)

RESOLVED FIXED
Firefox 42
Tracking Status
firefox42 --- fixed

People

(Reporter: rnewman, Assigned: Mailkov, Mentored)

References

Details

(Whiteboard: [good next bug][lang=java])

Attachments

(1 file, 1 obsolete file)

      No description provided.
Google should be sufficient to figure out how to do this.

The right place to add the code is probably MemoryMonitor.java.
Mentor: rnewman, michael.l.comella
Whiteboard: [good second bug][lang=java]
I'd like to work on this ... can you assign to me ?
Assignee: nobody → miticomilko
Attached patch bug1116349.patch (obsolete) — Splinter Review
Attachment #8634747 - Flags: review?(michael.l.comella)
I create a patch ... I hope it is ok ... :)
Flags: needinfo?(michael.l.comella)
Comment on attachment 8634747 [details] [diff] [review]
bug1116349.patch

Review of attachment 8634747 [details] [diff] [review]:
-----------------------------------------------------------------

Eviction code seems correct, but I'm not sure under which memory pressure level we should be flushing Picasso - deferring to Richard.
Attachment #8634747 - Flags: review?(rnewman)
Attachment #8634747 - Flags: review?(michael.l.comella)
Attachment #8634747 - Flags: review+
Comment on attachment 8634747 [details] [diff] [review]
bug1116349.patch

Review of attachment 8634747 [details] [diff] [review]:
-----------------------------------------------------------------

This fires at MEDIUM and above. MEDIUM corresponds to:


    /**
     * Level for {@link #onTrimMemory(int)}: the process is not an expendable
     * background process, but the device is running moderately low on memory.
     * Your running process may want to release some unneeded resources for
     * use elsewhere.
     */
    static final int TRIM_MEMORY_RUNNING_MODERATE = 5;


That seems right to me. Worst-case, Picasso can go back to disk.

::: mobile/android/base/home/ImageLoader.java
@@ +47,5 @@
>          }
>      }
>  
>      private static Picasso instance;
> +    private static LruCache lrucache;

Add a comment that these are protected by synchronization on the class.

@@ +62,5 @@
>  
>          return instance;
>      }
>  
> +    public static void clearLruCache() {

This method should be synchronized.
Attachment #8634747 - Flags: review?(rnewman) → review+
I synchronized the function clearLruCache() and add comment as you suggested.

I think now the patch is ok ... If it is, please can you push my patch to Try server? Because I have not yet access. 
Thanks.
Attachment #8634747 - Attachment is obsolete: true
Flags: needinfo?(rnewman)
Attachment #8637069 - Flags: review?(rnewman)
Attachment #8637069 - Flags: review?(rnewman) → review+
Leaving ni for me to check the try run and land.
Status: NEW → ASSIGNED
Flags: needinfo?(michael.l.comella)
url:        https://hg.mozilla.org/integration/fx-team/rev/9b6528285beac04e2a29cc6ad6220067f6930604
changeset:  9b6528285beac04e2a29cc6ad6220067f6930604
user:       Melchiorre Alastra <miticomilko@hotmail.com>
date:       Wed Jul 22 18:00:07 2015 -0700
description:
Bug 1116349 - Flush Picasso LRU cache on memory pressure events
Flags: needinfo?(rnewman)
https://hg.mozilla.org/mozilla-central/rev/9b6528285bea
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: