Closed Bug 1173379 Opened 5 years ago Closed 5 years ago

More aggressive delay-initialization

Categories

(Firefox for Android :: General, defect)

All
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(3 files, 1 obsolete file)

Bug 1166452 added a DelayedInit.jsm module that we can use to delay-load even moar things.
Add more things to be delay-loaded. In particular, we can delay initializing the context menu items until NativeWindow.contextmenu is accessed.
Attachment #8621268 - Flags: review?(mark.finkle)
We can lazy-load AndroidLog.jsm until dump() is used, and by switching some console.log() calls to dump() calls, we can delay loading the console service.
Attachment #8621270 - Flags: review?(mark.finkle)
Since the console object is not used right away, we can load it lazily.
Attachment #8621271 - Flags: review?(dtownsend)
Attachment #8621271 - Flags: review?(dtownsend) → review+
Comment on attachment 8621268 [details] [diff] [review]
Delay-init more things on startup (v1)

General comment: I'm not a big fan of pulling a bunch of initialization code out of the contextual location and putting it all in a single place.

One example of this is pulling CharacterEncoding.sendState out of the CharacterEncoding object. Why not keep CharacterEncoding.sendState in the CharacterEncoding.init() method, and move the CharacterEncoding.init method into the InitLater section?

The "click" event listeners also seem to want a better method of invocation. Maybe we could create a BrowserDeck helper like we do for nsIObserver notifications and message manager messages? That might be more work than you want to do for now, so how about just getting the CharacterEncoding object cleaned up a little?
Attachment #8621268 - Flags: review?(mark.finkle) → review-
Attachment #8621270 - Flags: review?(mark.finkle) → review+
(In reply to Mark Finkle (:mfinkle) from comment #4)
> Comment on attachment 8621268 [details] [diff] [review]
> Delay-init more things on startup (v1)
> 
> General comment: I'm not a big fan of pulling a bunch of initialization code
> out of the contextual location and putting it all in a single place.

Yeah that makes sense.

> One example of this is pulling CharacterEncoding.sendState out of the
> CharacterEncoding object. Why not keep CharacterEncoding.sendState in the
> CharacterEncoding.init() method, and move the CharacterEncoding.init method
> into the InitLater section?

I kept the original CharacterEncoding.init call because it registers observers, and (I think) we want that to happen before the Gecko:Ready event. In the new patch, I moved the InitLater(CharacterEncoding.sendState) call to inside CharacterEncoding.init. I also moved the click events back to their original location, with InitLater wrapped around them.
Attachment #8621268 - Attachment is obsolete: true
Attachment #8622698 - Flags: review?(mark.finkle)
Comment on attachment 8622698 [details] [diff] [review]
Delay-init more things on startup (v2)

Thanks
Attachment #8622698 - Flags: review?(mark.finkle) → review+
Depends on: 1251567
You need to log in before you can comment on or make changes to this bug.