Closed
Bug 649002
Opened 14 years ago
Closed 4 years ago
Use XPCOMUtils.defineLazyModuleGetter
Categories
(Firefox :: General, defect)
Firefox
General
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)
(deleted),
patch
|
dao
:
review+
|
Details | Diff | Splinter Review |
See bug 581307 comment #0 for an example of code simplification, although note that for some reason the example uses Importer instead of Getter.
Comment 1•11 years ago
|
||
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)
Reporter | ||
Comment 2•11 years ago
|
||
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)
Comment 3•11 years ago
|
||
Thanks. I've set your name as mentor
Whiteboard: [good first bug] → [good first bug][mentor=neil]
Comment 4•11 years ago
|
||
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
Comment 6•11 years ago
|
||
where can I get the reference and all those to change the code and summary.
If possible please explain what is it about?
Updated•11 years ago
|
Assignee: allamsetty.anup → nobody
Comment 7•11 years ago
|
||
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
Reporter | ||
Comment 8•11 years ago
|
||
(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
Comment 9•11 years ago
|
||
(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?
Updated•11 years ago
|
Assignee: allamsetty.anup → cpt.at.work
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #826746 -
Flags: review?(neil)
Reporter | ||
Comment 11•11 years ago
|
||
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)
Assignee | ||
Comment 12•11 years ago
|
||
Attachment #826746 -
Attachment is obsolete: true
Attachment #829831 -
Flags: review?(neil)
Comment 13•11 years ago
|
||
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+
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #829831 -
Attachment is obsolete: true
Attachment #829855 -
Flags: review?(neil)
Updated•11 years ago
|
Attachment #829855 -
Flags: review?(neil) → review+
Updated•11 years ago
|
Keywords: checkin-needed
Updated•11 years ago
|
Whiteboard: [good first bug][mentor=neil] → [good first bug][mentor=neil][leave open]
Comment 15•11 years ago
|
||
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
Updated•11 years ago
|
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Comment 16•11 years ago
|
||
Whiteboard: [good first bug][mentor=neil][leave open][fixed-in-fx-team] → [good first bug][mentor=neil][leave open]
Updated•10 years ago
|
Mentor: neil.corlett
Whiteboard: [good first bug][mentor=neil][leave open] → [good first bug][leave open]
Updated•5 years ago
|
Keywords: good-first-bug,
leave-open
Whiteboard: [good first bug][leave open] → [leave open]
Comment 17•4 years ago
|
||
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)
Comment 18•4 years ago
|
||
I don't think this is very actionable - it's not even on XPCOMUtils anymore.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 4 years ago
Flags: needinfo?(bwinton)
Resolution: --- → WORKSFORME
Updated•4 years ago
|
Keywords: leave-open
You need to log in
before you can comment on or make changes to this bug.
Description
•