Closed Bug 1275229 Opened 7 years ago Closed 7 years ago

Stop using do_CreateInstance("@mozilla.org/image/loader;1") to create gecko internal imgLoader instances

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

Details

Attachments

(1 file)

imgLoader currently uses do_CreateInstance("@mozilla.org/image/loader;1") to create imgLoader instances because it needs its XPCOM module to be initialized before imgLoader instances are created or used, and do_CreateInstance takes care of that. That's silly though. We can just initialize the module ourselves which is more efficient, less confusing, and clears the way to getting rid of "@mozilla.org/image/loader;1" and "@mozilla.org/image/cache;1".
Attached patch patchSplinter Review
Attachment #8755799 - Flags: review?(tnikkel)
FWIW I built without the module initialization to see what breaks. The first thing to break is the sMemReporter->AddRef() call in the imgLoader constructor, since sMemReporter is created during the module initialization step. That was tricky to figure out though because the errors on Try were really opaque (hence why I think this is worth a comment for anyone doing bug archeology in the future).

https://treeherder.mozilla.org/#/jobs?repo=try&revision=c3686b389285&selectedJob=21300550
Attachment #8755799 - Flags: review?(tnikkel) → review+
https://hg.mozilla.org/mozilla-central/rev/a03bd5fc36c0
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.