Closed Bug 753217 Opened 12 years ago Closed 11 years ago

Move and refactor tab-specific listeners

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: bnicholson, Assigned: bnicholson)

Details

Attachments

(7 files)

The coupling between GeckoApp/Tab/Tabs has become tighter and more complicated. This makes it more complicated to fix edge-case bugs, like bug 751650.

If we move tab-specific listeners to the Tab class, we can reduce the number of public method, especially setters/updaters, in Tab. This will help contain tab-specific implementation to the Tabs class and reduce the size of GeckoApp.
Simple refactor for existing listeners
Attachment #622246 - Flags: review?(mark.finkle)
Moves all tab-specific listeners and methods from GeckoApp to Tab. Removes leftover public methods that are no longer being used.
Attachment #622247 - Flags: review?(mark.finkle)
Rather than having to use the Tabs singleton everywhere to determine whether a given tab is selected, we can contain this logic by moving it to Tab.
Attachment #622251 - Flags: review?(mark.finkle)
We're sending a DOMWindowClose event to Java that does the exact same thing as Tab:Close. This patch consolidates them.
Attachment #622253 - Flags: review?(mark.finkle)
Additional refactoring to remove Tab.setState().
Attachment #622255 - Flags: review?(mark.finkle)
Attachment #622253 - Flags: review?(mark.finkle) → review+
Attachment #622251 - Flags: review?(mark.finkle) → review+
Attachment #622246 - Flags: review?(mark.finkle) → review+
Comment on attachment 622247 [details] [diff] [review]
Part 2: Move tab-specific listeners from GeckoApp to Tab class

The first thing that jumps out at me is all the GeckoApp.mXxx code that we are moving into Tab.java. We must not do that. We will very soon have code that runs in chrome and chromeless activities.

The biggest offender is GeckoApp.mBrowserToolbar which leads me to think that BrowserToolbar should start listening for these messages too. Does that make sense to you?
Attachment #622255 - Flags: review?(mark.finkle) → review+
This patch creates an onTabUpdated() event which is called whenever some UI-related part of the tab is changed. This is handled in Tabs, which does a generic refresh.

Eventually, we probably want the browser toolbar updates to be handled in BrowserToolbar itself. Tabs.java already has lots of references to mBrowserToolbar, so it's easiest to just move it there for now, and we can replace all instances of mBrowserToolbar in Tabs separately.
Attachment #626271 - Flags: review?(mark.finkle)
Changes mTabsChangedListener to use a LinkedList, initializes it in the constructor, and removes some unnecessary null checks.
Attachment #626273 - Flags: review?(mark.finkle)
We have onTabUpdated and onTabChanged events. Should we use just one?
What here is still relevant?
(In reply to Mark Finkle (:mfinkle) from comment #10)
> What here is still relevant?

Probably everything, though we'll have to essentially redo all of the patches from bitrot.

As you said in comment 6, some of this code introduces more mAppContext references to Tab.java. We should be slowly trying to kill off mAppContext, so I'll have to think about parts of this more.
Attachment #622247 - Flags: review?(mark.finkle)
Attachment #626271 - Flags: review?(mark.finkle)
Attachment #626273 - Flags: review?(mark.finkle)
Parts of this have been fixed in other bugs, and other parts are extremely bitrotten. We could probably still use some cleanup in these areas, but we'd be best starting from scratch. Closing this bug since, as written, it is no longer valid.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
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: