Closed Bug 845051 Opened 11 years ago Closed 11 years ago

Clean up the BrowserApp/BrowserToolbar onTabChanged handlers

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 22

People

(Reporter: Margaret, Assigned: Margaret)

Details

Attachments

(2 files)

This first patch gets rid of calls to mMainHandler.post from inside onTabChanged. We don't need these, since onTabChanged is always called from a Runnable passed to mActivity.runOnUiThread.

Getting rid of this also gets rid of the need for some helper methods.
Attachment #718084 - Flags: review?(bnicholson)
This patch gets rid of some indirection and lets us make some BrowserToolbar methods private (also we can get rid of mMainHandler.post calls for the same reason I mentioned above).
Attachment #718086 - Flags: review?(bnicholson)
Comment on attachment 718084 [details] [diff] [review]
(Part 1) Don't post Runnables to the main thread from onTabChanged, since it's always called on the main thread

Add a comment here stating this is called on the main thread:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/BrowserApp.java#90
Attachment #718084 - Flags: review?(bnicholson) → review+
Attachment #718086 - Flags: review?(bnicholson) → review+
In patch 1, the mMainHandler cannot be removed, for showTabs(). https://bugzilla.mozilla.org/show_bug.cgi?id=834399#c14
Comment on attachment 718084 [details] [diff] [review]
(Part 1) Don't post Runnables to the main thread from onTabChanged, since it's always called on the main thread

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

::: mobile/android/base/BrowserApp.java
@@ -109,5 @@
> -                                                : TabsPanel.Panel.NORMAL_TABS;
> -                    mMainHandler.post(new Runnable() {
> -                        public void run() {
> -                            if (areTabsShown() && mTabsPanel.getCurrentPanel() != panel)
> -                                showTabs(panel);

This is used not to run something on a particular thread, but to delay it so that it does not modify the mTabsChangedListeners array while we are still iterating through the array.  For details see bug 834399 comment 14.

(If we decide to keep this runnable, we should add a comment explaining it -- sorry for not doing that in my original patch.)
Thanks Sriram and Matt. I updated the patch to keep the mMainHandler code and add a comment above that line.

https://hg.mozilla.org/integration/mozilla-inbound/rev/dc4f4e042b3f
https://hg.mozilla.org/integration/mozilla-inbound/rev/956f5c456463
https://hg.mozilla.org/mozilla-central/rev/dc4f4e042b3f
https://hg.mozilla.org/mozilla-central/rev/956f5c456463
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
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: