Closed Bug 649002 Opened 14 years ago Closed 4 years ago

Use XPCOMUtils.defineLazyModuleGetter

Categories

(Firefox :: General, defect)

defect
Not set
trivial

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: neil, Assigned: cpt.at.work, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [leave open])

Attachments

(1 file, 2 obsolete files)

See bug 581307 comment #0 for an example of code simplification, although note that for some reason the example uses Importer instead of Getter.
nail, is this still relevant? I'm going through older "good first bugs" that have been inactive for a while. Should it stay a good first bug? Would you like to sign up to mentor it?
Flags: needinfo?(neil)
Well, there's already been a lot of related activity; partly due to bug 814255 there are already over 400 uses of defineLazyModuleGetter, so I'm not sure how much work there is left here, but I wouldn't have a problem helping someone who wants to have a go at this.
Flags: needinfo?(neil)
Thanks. I've set your name as mentor
Whiteboard: [good first bug] → [good first bug][mentor=neil]
Hi, I am willing to work on this bug. So please I request you to assign it to me. Thanks in Advance, Regards, A. Anup
Go for it!
Assignee: nobody → allamsetty.anup
where can I get the reference and all those to change the code and summary. If possible please explain what is it about?
Assignee: allamsetty.anup → nobody
Hi, Sorry by mistake I have pressed "assign it to default". So, I request you to reassign it to me. Thanks in Advance, Regards, Anup
(In reply to Anup Allamsetty from comment #6) > where can I get the reference and all those to change the code and summary. > > If possible please explain what is it about? OK, so here's a quick example. If you look at browser/components/places/content/places.js you'll see that it imports MigrationUtils.jsm on line 7. But in fact MigrationUtils.jsm is only actually used in the importFromBrowser function on line 355. So by changing that line to a lazy module getter this avoids having to load MigrationUtils unless someone actually wants to import bookmarks from another browser. Now there are a number of cases where we don't want to do this: 1. Tests probably don't need this 2. XPCOMUtils.jsm can't be lazy itself 3. Some modules, such as Services.jsm, are very heavily used and it doesn't make sense to load them lazily. 4. If the module is loaded and then immediately used. For instance the migration utils module could have been loaded by importFromBrowser because it was the only function that needed it.
Assignee: nobody → allamsetty.anup
(In reply to neil@parkwaycc.co.uk from comment #8) > (In reply to Anup Allamsetty from comment #6) > > where can I get the reference and all those to change the code and summary. > > > > If possible please explain what is it about? > > OK, so here's a quick example. > > If you look at browser/components/places/content/places.js you'll see that > it imports MigrationUtils.jsm on line 7. But in fact MigrationUtils.jsm is > only actually used in the importFromBrowser function on line 355. So by > changing that line to a lazy module getter this avoids having to load > MigrationUtils unless someone actually wants to import bookmarks from > another browser. > > Now there are a number of cases where we don't want to do this: > 1. Tests probably don't need this > 2. XPCOMUtils.jsm can't be lazy itself > 3. Some modules, such as Services.jsm, are very heavily used and it doesn't > make sense to load them lazily. > 4. If the module is loaded and then immediately used. For instance the > migration utils module could have been loaded by importFromBrowser because > it was the only function that needed it. are you there on IRC? If so in which channel?
Assignee: allamsetty.anup → cpt.at.work
Attached patch bug (obsolete) (deleted) — Splinter Review
Attachment #826746 - Flags: review?(neil)
Status: NEW → ASSIGNED
Comment on attachment 826746 [details] [diff] [review] bug Sorry for taking so long to get back to you on this, but we use spaces for indentation, not tabs.
Attachment #826746 - Flags: review?(neil)
Attached patch bug (obsolete) (deleted) — Splinter Review
Attachment #826746 - Attachment is obsolete: true
Attachment #829831 - Flags: review?(neil)
Comment on attachment 829831 [details] [diff] [review] bug Review of attachment 829831 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/components/places/content/places.js @@ +4,4 @@ > * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > > Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); > +XPCOMUtils.defineLazyModuleGetter(this, "MigrationUtils", "resource:///modules/MigrationUtils.jsm"); thanks! But please indent this like lines 8 and 9 (being sure to use spaces)
Attachment #829831 - Flags: review?(neil) → feedback+
Attached patch bug (deleted) — Splinter Review
Attachment #829831 - Attachment is obsolete: true
Attachment #829855 - Flags: review?(neil)
Attachment #829855 - Flags: review?(neil) → review+
Keywords: checkin-needed
Whiteboard: [good first bug][mentor=neil] → [good first bug][mentor=neil][leave open]
Keywords: checkin-needed
Whiteboard: [good first bug][mentor=neil][leave open] → [good first bug][mentor=neil][leave open][fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Whiteboard: [good first bug][mentor=neil][leave open][fixed-in-fx-team] → [good first bug][mentor=neil][leave open]
Mentor: neil.corlett
Whiteboard: [good first bug][mentor=neil][leave open] → [good first bug][leave open]
Whiteboard: [good first bug][leave open] → [leave open]

The leave-open keyword is there and there is no activity for 6 months.
:bwinton, maybe it's time to close this bug?

Flags: needinfo?(bwinton)

I don't think this is very actionable - it's not even on XPCOMUtils anymore.

Status: REOPENED → RESOLVED
Closed: 11 years ago4 years ago
Flags: needinfo?(bwinton)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: