Closed
Bug 980036
Opened 10 years ago
Closed 10 years ago
Move image/* preferences to gfxPrefs
Categories
(Core :: Graphics, defect)
Tracking
()
RESOLVED
FIXED
mozilla35
People
(Reporter: milan, Assigned: milan)
References
Details
Attachments
(1 file, 4 obsolete files)
27.90 KB,
patch
|
milan
:
review+
|
Details | Diff | Splinter Review |
Move preferences from image/src/DiscardTracker.cpp image/src/ImageFactory.cpp image/src/imgLoader.cpp image/src/RasterImage.cpp image/src/SurfaceCache.cpp to use gfxPrefs class.
Assignee | ||
Comment 1•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=49066d9b1720
Assignee | ||
Comment 2•10 years ago
|
||
No urgency on this one.
Attachment #8490770 -
Flags: review?(seth)
Comment 3•10 years ago
|
||
Comment on attachment 8490770 [details] [diff] [review] Use gfxPrefs to manage imagelib prefs. Review of attachment 8490770 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me! r+'d with the issues below addressed. ::: image/src/DiscardTracker.cpp @@ +180,5 @@ > DiscardTracker::Initialize() > { > // Watch the timeout pref for changes. > Preferences::RegisterCallback(DiscardTimeoutChangedCallback, > sDiscardTimeoutPref); So I guess gfxPrefs can't support callbacks? It would be nice if it did; maybe file a followup. ::: image/src/RasterImage.cpp @@ +433,5 @@ > /* static */ void > RasterImage::Initialize() > { > + // This should already be initialized, but just in case: > + gfxPrefs::GetSingleton(); Seems like it'd be easier to just call this in nsImageModule::InitModule(), before all of the Initialize() calls there. Then we don't have to worry about calling it in multiple places, and you can remove the gfxPrefs::GetSingleton() call from e.g. ImageFactory. ::: image/src/SurfaceCache.cpp @@ +27,5 @@ > #include "nsSize.h" > #include "nsTArray.h" > #include "prsystem.h" > #include "SVGImageContext.h" > +#include "gfxPrefs.h" Nit: it's preferable to keep things alphabetized. @@ +461,5 @@ > { > // Initialize preferences. > MOZ_ASSERT(!sInstance, "Shouldn't initialize more than once"); > > + // See gfxPrefs for the default values This comment either needs rewording, since the reader will look down and say "What do you mean, I see the default values right there!", or you should remove the default value comments below. I think it's probably better to remove the comments, because I suspect they'll inevitably start to get out of sync with the values in gfxPrefs. ::: image/src/imgLoader.cpp @@ -1108,5 @@ > - if (NS_SUCCEEDED(rv)) > - sCacheMaxSize = cachesize; > - else > - sCacheMaxSize = 5 * 1024 * 1024; > - sCacheMaxSize = sCacheMaxSize > 0 ? sCacheMaxSize : 0; We recently added this line as part of a bug fix, because code elsewhere can't handle a negative value. We still need it. What would be considerably simpler is if the pref were just a uint32_t, but I'm not sure whether it's safe to change the type of an existing pref.
Attachment #8490770 -
Flags: review?(seth) → review+
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Seth Fowler [:seth] from comment #3) > ... > > ::: image/src/imgLoader.cpp > @@ -1108,5 @@ > > - if (NS_SUCCEEDED(rv)) > > - sCacheMaxSize = cachesize; > > - else > > - sCacheMaxSize = 5 * 1024 * 1024; > > - sCacheMaxSize = sCacheMaxSize > 0 ? sCacheMaxSize : 0; > > We recently added this line as part of a bug fix, because code elsewhere > can't handle a negative value. We still need it. > > What would be considerably simpler is if the pref were just a uint32_t, but > I'm not sure whether it's safe to change the type of an existing pref. But sCacheMaxSize is uint32_t, so this: sCacheMaxSize = sCacheMaxSize > 0 ? sCacheMaxSize : 0; is equivalent to this, right? sCacheMaxSize = sCacheMaxSize != 0 ? sCacheMaxSize : 0; which is a no-op. However, I see what we should be doing, and I'll make sure the new version does that; in the old code, it really should have been this instead: if (NS_SUCCEEDED(rv)) sCacheMaxSize = cachesize > 0 : cachesize : 0; else sCacheMaxSize = 5 * 1024 * 1024;
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Seth Fowler [:seth] from comment #3) > ... > > Preferences::RegisterCallback(DiscardTimeoutChangedCallback, > > sDiscardTimeoutPref); > > So I guess gfxPrefs can't support callbacks? It would be nice if it did; > maybe file a followup. Bug 1069620.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → milan
Assignee | ||
Comment 6•10 years ago
|
||
Address review comments. Will wait for bug 1069582, this patch is based of the one there.
Attachment #8491824 -
Flags: review+
Assignee | ||
Comment 7•10 years ago
|
||
While the changes from the previous patch were minimal, I did move where gfxPrefs are potentially initialized (at least during the test runs), so do another run just in case: https://tbpl.mozilla.org/?tree=Try&rev=47c614ae0d62
Assignee | ||
Updated•10 years ago
|
Attachment #8490770 -
Attachment is obsolete: true
Comment 8•10 years ago
|
||
(In reply to Milan Sreckovic [:milan] from comment #4) > However, I see what we should be doing, and I'll make > sure the new version does that Thanks! I overlooked the issue you pointed out here when I reviewed that patch originally.
Assignee | ||
Comment 9•10 years ago
|
||
Typo in the previous patch https://tbpl.mozilla.org/?tree=Try&rev=b50ee3ee41d0
Attachment #8491824 -
Attachment is obsolete: true
Attachment #8491839 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Attachment #8491839 -
Attachment is obsolete: true
Assignee | ||
Comment 10•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=000f4aa7d74f
Attachment #8492338 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 11•10 years ago
|
||
Hi Milan, the patch didn't apply cleanly: patching file image/src/RasterImage.cpp Hunk #4 FAILED at 2486 1 out of 8 hunks FAILED -- saving rejects to file image/src/RasterImage.cpp.rej patch failed, unable to continue (try -v) could you take a look (maybe it need a rebase against a current tree). Thanks!
Keywords: checkin-needed
Assignee | ||
Comment 12•10 years ago
|
||
Rebased patch. https://tbpl.mozilla.org/?tree=Try&rev=c09e720a1c89
Attachment #8492338 -
Attachment is obsolete: true
Attachment #8493791 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 13•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/d42f046984ce
Keywords: checkin-needed
Comment 14•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d42f046984ce
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in
before you can comment on or make changes to this bug.
Description
•