Closed Bug 891105 Opened 11 years ago Closed 11 years ago

Cancel LoadThumbnailsTask when not showing the about:home

Categories

(Firefox for Android Graveyard :: Theme and Visual Design, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 26

People

(Reporter: sriram, Assigned: sriram)

References

Details

(Whiteboard: fixed-fig)

Attachments

(1 file, 2 obsolete files)

Cancel the LoadThumbnailsTask, when the user moved out of about:home.
Blocks: 889612
I'm thinking of using Loaders for this.
Attached patch Patch (obsolete) — Splinter Review
Made the AsyncTask a AsyncTaskLoader. I'm not checking for the id on the ThumbnailsLoaderCallback as there is just one loader handled by it.
Attachment #772960 - Flags: review?(lucasr.at.mozilla)
Attached patch Patch (obsolete) — Splinter Review
A missed "tab" is fixed in this.
Attachment #772960 - Attachment is obsolete: true
Attachment #772960 - Flags: review?(lucasr.at.mozilla)
Attachment #772962 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 772962 [details] [diff] [review]
Patch

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

You're using a cursor in the thumbnails loader that is managed by another Loader. This is not thread-safe. You should probably create a data structure with all the data you need from cursor and use that copy in the thumbnails loader instead.
Attachment #772962 - Flags: review?(lucasr.at.mozilla) → review-
I had the same doubt on concurrency. However, if I had to cache the cursor data (basically the url), where would I do it? Would I do it when I get the result from the CursorLoader, and pass it to ThumbnailLoader?
(In reply to Sriram Ramasubramanian [:sriram] from comment #5)
> I had the same doubt on concurrency. However, if I had to cache the cursor
> data (basically the url), where would I do it? Would I do it when I get the
> result from the CursorLoader, and pass it to ThumbnailLoader?

Have a look at how FaviconsLoader does it. The thumbnails loader should be similar.
This spins a list from the cursor, passes that as an argument to load the thumbnails. This is pretty close to FaviconsLoader (but for the static methods).
Attachment #772962 - Attachment is obsolete: true
Attachment #774351 - Flags: review?(lucasr.at.mozilla)
Comment on attachment 774351 [details] [diff] [review]
Part 1: Thumbnail Loader

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

Great.

::: mobile/android/base/home/BookmarksPage.java
@@ +52,5 @@
>      // Key for bookmarks folder id.
>      private static final String BOOKMARKS_FOLDER_KEY = "folder_id";
>  
> +    // Key for thumbnail urls.
> +    private static final String THUMBNAILS_URL_KEY = "urls";

THUMBNAILS_URL_KEY -> THUMBNAILS_URLS_KEY
Attachment #774351 - Flags: review?(lucasr.at.mozilla) → review+
http://hg.mozilla.org/projects/fig/rev/a0658f1018a6
Assignee: nobody → sriram
Whiteboard: fixed-fig
https://hg.mozilla.org/mozilla-central/rev/a0658f1018a6
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
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: