Closed Bug 77497 Opened 23 years ago Closed 22 years ago

imgContainer needs to have a GIF specific version

Categories

(Core :: Graphics: ImageLib, defect, P1)

defect

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: saari, Assigned: paper)

References

Details

(Keywords: memory-footprint)

Attachments

(3 files, 15 obsolete files)

48.34 KB, patch
Biesinger
: review+
Details | Diff | Splinter Review
3.23 KB, patch
Details | Diff | Splinter Review
48.63 KB, patch
paper
: review+
Details | Diff | Splinter Review
imgContainer has gotten too overloaded, needs to be spit up into a GIF specific
version and a general version.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.1
Target Milestone: mozilla0.9.1 → mozilla0.9.3
Target Milestone: mozilla0.9.3 → mozilla1.0
Target Milestone: mozilla1.0 → mozilla1.0.1
I've been living and breathing imgContainer.cpp for the past 2+ weeks.  I'm
willing to make an imgContainerGIF and move relevent code to that module. 
That'll free up your time for other more important things.

The only question I have (so far) is: why is this bug marked as Mac Platform and
not All?
marking platform->all since that's the only sensible value for this bug
Hardware: Macintosh → All
taking bug from saari & ccing people who love bugmail

I'll post a patch after Bug 85595 gets checked-in
Assignee: saari → paper
Status: ASSIGNED → NEW
Priority: -- → P1
Target Milestone: mozilla1.0.1 → mozilla1.1beta
Status: NEW → ASSIGNED
Blocks: 148634, 148637
Severity: normal → minor
I intend to have 3 patches:
1) imgContainer stripped of gif stuff (this one)
2) imgContainerGIF (basically a copy of imgContainer before the strip, along
with the required class name changes and compiler stuff)
3) Mac build file, which I will need someone with a Mac to do.

I intend to make no changes in imgContainerGIF other than the class name
changes and trailing white space removal.  This will make for a faster review. 
Any code standardizations and optimizations will be done in other bugs (See Bug
148637)

I anticipate that (1) will need the most "tender-lov'n reviewing" since after
stripping, I cleaned it up and put in null checking everywhere I could.
Comment on attachment 86834 [details] [diff] [review]
Patch 1of3: imgContainer stripped of gif stuff

ignore that patch, it's diff'd on the wrong files
Attachment #86834 - Attachment is obsolete: true
>2) imgContainerGIF (basically a copy of imgContainer before the strip, along
>with the required class name changes and compiler stuff)

Hm, is ContainerGIF really so different? As in, might it be a good idea to make
imgContainerGIF inherit from imgContainer, so that common code could be shared?
See Comment #4 for info on this patch.	One question I anticipated from
reviewers is about the removal of code from DecodingComplete.  Only GIFs called
DecodingComplete, so it's safe.  (I may create a new bug to deal with removing
or making all decoders use DecodingComplete)


biesi, after the strip down, imgContainer contains hardly any code.  The only
common code that imgContainerGIF could use would be a few of the one-liner
functions.  The 2 biggest functions left in imgContainer, AppendFrame and
Notify will look very different after Bug 148637. 

Actually, I question leaving the animation code bits in there in the first
place.	Replacing the animation functions with NS_ERROR_NOT_IMPLEMENTED  and
removing the variables would save a few bytes and get rid of that
nsITimerCallback.  Perhaps a good idea for another RFE bug, but out of the
scope of this bug, IMO.
Attached patch Patch 2of3: imgContainerGIF (obsolete) — Splinter Review
Addition of 2 files, plus changes to Makefile.in, Makefile.win,
nsGIFDecoder2.cpp, and nsGIFModule.cpp.  I think that's all I need to modify.
This proves that imgContainerGIF.cpp is the same as imgContainer.cpp with the
exception of the class name.  (meaning there's no need to review the
imgContainerGIF.cpp code)
Blocks: 152756
All my imgContainer patches seem to be in now.
I'll be un-bitrotting the patches in this bug within the next day or two.
diff'd against imgContainer.h v1.15 and imgContainer.cpp v1.32
Attachment #87830 - Attachment is obsolete: true
Attached patch Patch 2of3: imgContainerGIF (obsolete) — Splinter Review
only diff change is in imgContainerGIF.  Same diff for the rest of the files
(no new checkins in them)
Attachment #87853 - Attachment is obsolete: true
diff'd against imgContainer.cpp is v1.32 (latest) to prove that nothing was
changed.
Attachment #87855 - Attachment is obsolete: true
pavlov, tor: a r= and sr= before someone patches
modules/libpr0n/decoders/src/imgContainer.* or modules/libpr0n/decoders/gif/*
again would be nice.

The sooner this one gets in, the sooner I can put up the patches for the bugs
that this block. :)
Attached patch Patch 2of3: imgContainerGIF (obsolete) — Splinter Review
fixed spelling error in makefile.win.. imgConatiner -> imgContainer
Attachment #90259 - Attachment is obsolete: true
Keywords: patch
Comment on attachment 90340 [details] [diff] [review]
Patch 2of3: imgContainerGIF

r=pavlov
Attachment #90340 - Flags: review+
Blocks: 158715
Target Milestone: mozilla1.1beta → mozilla1.2alpha
futuring since I don't have time to hunt down r='s
Target Milestone: mozilla1.2alpha → Future
Attachment #90257 - Attachment is obsolete: true
Attachment #90262 - Attachment is obsolete: true
Attached patch Patch 2of3: imgContainerGIF (obsolete) — Splinter Review
Attachment #90340 - Attachment is obsolete: true
Patches are now current.
Attached patch Patch 2of3: imgContainerGIF (obsolete) — Splinter Review
Corrected diff so the new files are added to the right directory.
Attachment #101084 - Attachment is obsolete: true
New checkins today, current patches won't apply. Another set of patches coming
up shortly.
did a cvs diff from the root this time
Attachment #101083 - Attachment is obsolete: true
Attachment #101106 - Attachment is obsolete: true
As per discussion with tor, all animation code has been removed.  imgContainer
is now one frame only.
Attachment #101721 - Attachment is obsolete: true
Keywords: footprint, review
Comment on attachment 101722 [details] [diff] [review]
2of3: imgContainerGIF

A couple of small argument checking things:

 * GetCurrentFrame should check for a null pointer
 * GetNumFrames should return with NS_ERROR_NULL_POINTER
   if the arg is null instead of trying to assign through it.
Comment on attachment 101722 [details] [diff] [review]
2of3: imgContainerGIF

Ignore that comment - wrong attachment.  sr=tor
Attachment #101722 - Flags: superreview+
Comment on attachment 101847 [details] [diff] [review]
1of3: imgContainer stripped of multi-frames

A couple of small argument checking things:

 * GetCurrentFrame should check for a null pointer
 * GetNumFrames should return with NS_ERROR_NULL_POINTER
   if the arg is null instead of trying to assign through it.
re attachment 101847 [details] [diff] [review] (patch 1 of 3):

+    mFrame = nsnull;
+    NS_RELEASE(mFrame);

doesn't look right to me :)
also, maybe you should use a COMPtr for it?

+  if (!mFrame)
+    return NS_ERROR_FAILURE;
+  *aCurrentFrame = mFrame;
+  NS_IF_ADDREF(*aCurrentFrame);

mFrame can not be null here. therefore, you can use NS_ADDREF rather than
NS_IF_ADDREF

+  *aNumFrames = (mFrame) ? 1 : 0;

no need for parentheses

+  NS_IF_ADDREF(*_retval);

as above, use NS_ADDREF.

+  mFrame = item;
+  NS_ADDREF(mFrame);

when using a COMPtr for mFrame as suggested above, you can remove the ADDREF here.

 NS_IMETHODIMP imgContainer::DecodingComplete(void)
 {
-  mDoneDecoding = PR_TRUE;
-
-  PRUint32 numFrames;
-  mFrames.Count(&numFrames);
-  if (numFrames == 1) {
-    nsCOMPtr<gfxIImageFrame> currentFrame;
-    inlinedGetFrameAt(0, getter_AddRefs(currentFrame));
-    currentFrame->SetMutable(PR_FALSE);
-  }
   return NS_OK;

um, shouldn't you still do the SetMutable call?

in StartAnimation and StopAnimation: I am not sure if NOT_IMPLEMENTED is the
right thing to return. The old implementation returned NS_OK even if there was
nothing to animate.

SetLoopCount: you are always returning NOT_IMPLEMENTED here. this is
inconsistent with SetAnimationMode, which returns OK but ignores the argument.


rest of this patch looks ok on first sight.
Comment on attachment 101722 [details] [diff] [review]
2of3: imgContainerGIF

r=biesi; I trust you that imgContainerGIF is indeed identical to the old
imgCotainer except the name.
Attachment #101722 - Flags: review+
Attached patch 1of3: imgContainer stripped (obsolete) — Splinter Review
-changed everything that biesi (see notes) and tor mentioned
-removed NS_DECL_IMGICONTAINEROBSERVER
-removed imgIDecoderObserver

imgContainer is a wee thing now! :O

Biesi:
-DecodingComplete is only called by the GIF decoder.  So the SetMutable is
useless for anything else.  (JPGs, for example, SetMutable inside the decoder)

-Both [Get,Set]LoopCount now return NS_ERROR_NOT_IMPLEMENTED, and both
AnimationModes return NS_OK.  In other words, we are faking implementation of
AnimationMode, and not implementing LoopCount.
Attachment #101847 - Attachment is obsolete: true
Comment on attachment 101950 [details] [diff] [review]
1of3: imgContainer stripped

thanks for the changes - I noticed some more things, though:
in GetCurrentFrame:
maybe NS_ERROR_NOT_INITIALIZED would be more appropriate than _FAILURE?

looks great otherwise!
I'm alas unable to test the patch currently... just make sure that you test
well :)

r=biesi.
Attachment #101950 - Flags: review+
Comment on attachment 101950 [details] [diff] [review]
1of3: imgContainer stripped

Please either remove all the NS_ENSURE crap or move the return outside a macro.
 Macros that return suck ass for debugging since you can't break on return.
I think that checking these out paramters is a waste of cycles and just
clutters up the code, but if you really really want them, then change them all
to something that doesn't have return in the macro.

aside from this, the patch looks good.	Post a new patch and i'll r= it.
Attachment #101950 - Flags: review+ → needs-work+
Attached patch 1of3: imgContainer stripped (obsolete) — Splinter Review
For all you anti NS_ENSURE-ers out there :)
Attachment #101950 - Attachment is obsolete: true
Comment on attachment 102024 [details] [diff] [review]
1of3: imgContainer stripped

bleh, r=pavlov
Attachment #102024 - Flags: review+
Comment on attachment 102024 [details] [diff] [review]
1of3: imgContainer stripped

sr=tor
Attachment #102024 - Flags: superreview+
Not fully tested, but should work, as per #mozilla w/Paper, jkeiser.
Comment on attachment 102095 [details] [diff] [review]
1of3: imgContainer stripped - end check-in

transferring r= & sr=
Attachment #102095 - Flags: superreview+
Attachment #102095 - Flags: review+
Patches checked in on 10/07/2002 14:45 & 10/07/2002 14:49
Bustage fixed on 10/07/2002 15:25
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: