Closed
Bug 90380
Opened 24 years ago
Closed 23 years ago
Get rid of |#ifdef _IMPL_NS_XPRINT|
Categories
(Core Graveyard :: Printing: Xprint, enhancement, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
mozilla0.9.5
People
(Reporter: roland.mainz, Assigned: roland.mainz)
References
Details
Attachments
(1 file, 6 obsolete files)
RFE: get get of the use of _IMPL_NS_XPRINT (which was introduced for staticbuild
support) in places where it is possible. Most use of that CPP symbol is
unneccesary and can be removed.
Assignee | ||
Comment 1•24 years ago
|
||
Swapping QA<-->Owner
Assignee: katakai → Roland.Mainz
Priority: -- → P2
QA Contact: Roland.Mainz → katakai
Target Milestone: --- → mozilla0.9.4
Assignee | ||
Comment 3•23 years ago
|
||
Now we're too close to 0.9.4-freeze to get this fixed in 0.9.4. Retargeting to
0.9.5 - but I cannot promise that I have enougth time to get it fixed in that
milestone.
----
ToDo:
Replace _IMPL_NS_XPRINT with (at least) two defines: One for stuff mandatory for
static build stuff and one #define to seperate the differences between Xlib and
Xprint module. I have to investigate whether we need more categories or not...
Target Milestone: mozilla0.9.4 → mozilla0.9.5
Assignee | ||
Comment 4•23 years ago
|
||
Assignee | ||
Comment 5•23 years ago
|
||
Filed prototype patch, the CPP symbol |_IMPL_NS_XPRINT| is not completely
"gone".
ToDo:
Make StaticBuild patch and check whether the patch needs adjustments or not ...
Assignee | ||
Comment 6•23 years ago
|
||
s/Make StaticBuild patch and/Make StaticBuild build and/
Assignee | ||
Comment 7•23 years ago
|
||
Assignee | ||
Updated•23 years ago
|
Attachment #48081 -
Attachment is obsolete: true
Assignee | ||
Comment 8•23 years ago
|
||
Filed patch, this one works with StaticBuild (Solaris 7 SPARC/WS6U2FCS).
Requesting r=/sr= ...
Comment 9•23 years ago
|
||
you use the "#ifdef USE_XPRINT " alot, is there a way around using all those
ifdef's. I thought this was an XPRINT only modulule?
Assignee | ||
Comment 10•23 years ago
|
||
dcone:
|#ifdef USE_XPRINT| is required because Xprint is not available on all unix
platforms (for example IRIX). Therefore we need a way to turn-off matching code
if the Xprint module is not build (e.g. libXp.so is not present or someone
explicitly sets the configure option --disable-xprint ).
Comment 11•23 years ago
|
||
Why remove NS_INIT_REFCNT()?
In this:
+ rv = ((nsDrawingSurfaceXlibImpl*)surface)->Init(
Should that be an NS_STATIC_CAST? Ditto these:
+ ((nsDrawingSurfaceXlibImpl *)mRenderingSurface)->Init(mXlibRgbHandle,
+ ((nsDrawingSurfaceXlibImpl *)surf)->Init(mXlibRgbHandle,
I don't understand why you had to replace all the aSurface->GetBlah()s with
xxlib_rgb_get_blah()'s, though I don't see any harm in it. What was the
reasoning?
+ mRenderingSurface = mPrintContext;
+ NS_ADDREF(mRenderingSurface);
Why is this not an nsCOMPtr? (and the NS_IF_RELEASE or whatever could go away as
well).
Seeing these raises warning flags - direct calls to Release/AddRef??? Also,
what happens in GetGC if mGC is nsnull? I don't know if the logic allows that
to occur, but my assumption is that it might be possible. What about
SetGC(nsnull)?
+ if (mGC)
+ {
+ mGC->Release();
+ mGC = nsnull;
+ }
+ NS_IMETHOD_(xGC *) GetGC() { mGC->AddRef(); return mGC; }
+ void SetGC(xGC *aGC) { mGC = aGC; mGC->AddRef(); }
Assignee | ||
Comment 12•23 years ago
|
||
> Why remove NS_INIT_REFCNT()?
The superclass does that job... it is not required to do it in each subclass
constructor, too - right ? :-)
> In this:
> + rv = ((nsDrawingSurfaceXlibImpl*)surface)->Init(
> Should that be an NS_STATIC_CAST? Ditto these:
> + ((nsDrawingSurfaceXlibImpl *)mRenderingSurface)->Init(mXlibRgbHandle,
> + ((nsDrawingSurfaceXlibImpl *)surf)->Init(mXlibRgbHandle,
>
> I don't understand why you had to replace all the aSurface->GetBlah()s with
> xxlib_rgb_get_blah()'s, though I don't see any harm in it. What was the
> reasoning?
I simply cleaned-up the API a little bit. All the
Get[Display|Screen|Visual|Depth|etc.|etc.]() information is always the same as
in the |XlibRgbHandle|. It is usefull to cache the vars in the objects to avoid
unneccesary function calls... but IMHO there is no reason to add/keep extra APIs
for that stuff... |XlibRgbHandle| does the job already ...
> + mRenderingSurface = mPrintContext;
> + NS_ADDREF(mRenderingSurface);
>
> Why is this not an nsCOMPtr? (and the NS_IF_RELEASE or whatever could go
> away as well).
Good question... because I did not change that (yet) ? Most
nsDeviceContext[GTK|PS|Win|Mac|Qt|Photon|etc.] is not completely moved over to
nsCOMPtr land yet... this is only another thing which should be fixed some day.
> Seeing these raises warning flags - direct calls to Release/AddRef??? Also,
> what happens in GetGC if mGC is nsnull? I don't know if the logic allows that
> to occur, but my assumption is that it might be possible. What about
> SetGC(nsnull)?
>
> + if (mGC)
> + {
> + mGC->Release();
> + mGC = nsnull;
> + }
>
> + NS_IMETHOD_(xGC *) GetGC() { mGC->AddRef(); return mGC; }
> + void SetGC(xGC *aGC) { mGC = aGC; mGC->AddRef(); }
No... that's the GC-cache which does not inherit from nsISupports... don't
worry... see mozilla/gfx/src/xlib/nsGCCache.h ... :-)
Comment 13•23 years ago
|
||
Ok, I guess that answers all my quibbles except for the NS_STATIC_CAST
question. Deal with that quibble, and for what it's worth r=rjesup for general
issues.
You'll need other reviewers.
Comment 14•23 years ago
|
||
+nsDrawingSurfaceXlibImpl::Init(XlibRgbHandle *aXlibRgbHandle,
Drawable aDrawable,
xGC *aGC)
Line up your arguments. Repeat for all places you added |Impl|.
+ rv = ((nsDrawingSurfaceXlibImpl*)surface)->Init(
Why not just make |surface| of type nsDrawingSurfaceXlibImpl* and be done with
it?
-#ifdef _IMPL_NS_XPRINT
#define XPRINT_FONT_HACK 1
-#endif /* _IMPL_NS_XPRINT */
Please put #ifdef USE_XPRINT around this #define to clarify when this define is
actually relevant.
Looks okay to me otherwise, r=jag. Think you can find someone who knows this
code slightly better to have a look too?
Assignee | ||
Updated•23 years ago
|
Attachment #48127 -
Attachment is obsolete: true
Assignee | ||
Comment 15•23 years ago
|
||
Assignee | ||
Comment 16•23 years ago
|
||
Requesting r= from cls@seawood.org for the Makefile.in change ...
Comment 17•23 years ago
|
||
Ok I have used this patch on my Solaris 8 tree using Forte 6 UD2 and it looks
good to me and works just fine...
r=dcran
Comment 18•23 years ago
|
||
+ NS_IMETHOD_(Drawable) GetDrawable();
+ NS_IMETHOD_(XlibRgbHandle) *GetXlibRgbHandle();
+ NS_IMETHOD_(xGC *) GetGC();
Don't use NS_IMETHOD_(type) in interfaces. Proper XPCOM methods return
nsresults and use out parameters.
Could you explain the reference counting and ownership system here for me? Why
are you keeping a weak reference to the nsIDeviceContext (in
nsFontMetricsXlib::mDeviceContext)?
+nsRenderingContextXp::nsRenderingContextXp()
+ : nsRenderingContextXlib()
+{
+ mPrintContext = nsnull;
+}
...and if you do switch to a strong reference and an nsCOMPtr, you should use an
initializer rather than explicit assignment in the constructor.
+ NS_ADDREF(mRenderingSurface);
Is there a reason you're using manual refcounting? Unless it's a highly
exceptional case, you should be using nsCOMPtr.
+ NS_IMETHOD GetDepth(PRUint32 &depth)
+ { depth = xxlib_rgb_get_depth(GetXlibRgbHandle()); return
NS_OK; }
I don't see that the reviewers' comments about C-style casts have been reviewed.
Please respond to them, either in the patch or in a bug comment, before
submitting for re-super-review.
Assignee | ||
Comment 19•23 years ago
|
||
> + NS_IMETHOD_(Drawable) GetDrawable();
> + NS_IMETHOD_(XlibRgbHandle) *GetXlibRgbHandle();
> + NS_IMETHOD_(xGC *) GetGC();
>
> Don't use NS_IMETHOD_(type) in interfaces. Proper XPCOM methods return
> nsresults and use out parameters.
Fixed.
> Could you explain the reference counting and ownership system here for me?
> Why are you keeping a weak reference to the nsIDeviceContext (in
> nsFontMetricsXlib::mDeviceContext)?
nsFontMetricsXlib::mDeviceContext is a reference back to the device for which
this font is for. Per definition, the DeviceContextImpl keeps (or "owns") all
these fonts in it's font cache - which gets cleaned-up&destroyed in the
DeviceContextImpl destructor. Therefore the DeviceContextImpl-based object
always "lives" (little bit) longer than the nsFontMetrics*-objects used for that
device.
> +nsRenderingContextXp::nsRenderingContextXp()
> + : nsRenderingContextXlib()
> +{
> + mPrintContext = nsnull;
> +}
>
> ...and if you do switch to a strong reference and an nsCOMPtr, you should use
> an initializer rather than explicit assignment in the constructor.
Fixed.
> + NS_ADDREF(mRenderingSurface);
>
> Is there a reason you're using manual refcounting? Unless it's a highly
> exceptional case, you should be using nsCOMPtr.
No reason. That's simply some sort of "historical" stuff which wasn't updated
yet...
There is still a lot of stuff which still waits to be switched-over from manual
refcounting to the nsCOMPtr world.
Fixed; |mRenderingSurface| and |mOffscreenSurface| are now guarded by nsCOMPtr's
> + NS_IMETHOD GetDepth(PRUint32 &depth)
> + { depth = xxlib_rgb_get_depth(GetXlibRgbHandle());
> return NS_OK; }
>
> I don't see that the reviewers' comments about C-style casts have been
> reviewed.
> Please respond to them, either in the patch or in a bug comment, before
> submitting for re-super-review.
I removed the cast.
Fixed.
Assignee | ||
Updated•23 years ago
|
Attachment #48413 -
Attachment is obsolete: true
Assignee | ||
Comment 20•23 years ago
|
||
Assignee | ||
Comment 21•23 years ago
|
||
Requesting sr=
(I am aware that I still miss a r=cls@seawood.org - but I think it can be "done"
in parallel to the sr= assuming the Makefile.in-part won't be touched anymore).
Comment 22•23 years ago
|
||
Comment on attachment 48804 [details] [diff] [review]
New patch for 2001-09-08-08-trunk per shaver's comments
>diff -r -u original/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp
>--- original/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp Wed Aug 29 01:12:50 2001
>+++ mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp Sun Sep 9 21:24:56 2001
>@@ -65,7 +65,6 @@
> : DeviceContextImpl()
> {
> PR_LOG(DeviceContextXlibLM, PR_LOG_DEBUG, ("nsDeviceContextXlib::nsDeviceContextXlib()\n"));
>- NS_INIT_REFCNT();
> mTwipsToPixels = 1.0;
> mPixelsToTwips = 1.0;
> mNumCells = 0;
Why is that being removed? Does that leave things uninitialized?
>- nsDrawingSurfaceXlib *surf = (nsDrawingSurfaceXlib *)mSurface;
>+ nsIDrawingSurfaceXlib *surf = (nsIDrawingSurfaceXlib *)mSurface;
There are lots of these instances in the file. If you're going to touch them anyway
then please convert them to NS_STATIC_CAST() macro calls.
Other than that sr=blizzard
Attachment #48804 -
Flags: superreview+
Assignee | ||
Comment 23•23 years ago
|
||
blizzard wrote:
> >diff -r -u original/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp
> mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp
> >--- original/mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp Wed Aug 29
> 01:12:50 2001
> >+++ mozilla/gfx/src/xlib/nsDeviceContextXlib.cpp Sun Sep 9 21:24:56
> 2001
> >@@ -65,7 +65,6 @@
> > : DeviceContextImpl()
> > {
> > PR_LOG(DeviceContextXlibLM,PR_LOG_DEBUG, ("nsDeviceContextXlib ::
> nsDeviceContextXlib()\n" ));
> >- NS_INIT_REFCNT();
> > mTwipsToPixels = 1.0;
> > mPixelsToTwips = 1.0;
> > mNumCells = 0;
>
> Why is that being removed? Does that leave things uninitialized?
The superclass (DeviceContextImpl) already does that job. That's why I removed
it (I saw that in OS/2 code and asked mkaply):
> >- nsDrawingSurfaceXlib *surf = (nsDrawingSurfaceXlib *)mSurface;
> >+ nsIDrawingSurfaceXlib *surf = (nsIDrawingSurfaceXlib *)mSurface;
>
> There are lots of these instances in the file. If you're going to touch them
> anyway then please convert them to NS_STATIC_CAST() macro calls.
Fixed in the new patch...
> Other than that sr=blizzard
Thanks!
Assignee | ||
Updated•23 years ago
|
Attachment #48804 -
Attachment is obsolete: true
Assignee | ||
Comment 24•23 years ago
|
||
Comment 25•23 years ago
|
||
Same problem as last time:
../../../../mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp:38: imgIContainer.h:
No such file or directory
Configuring using: --with-xlib --with-qt --with-qtdir=/usr/lib/qt-2.2.4
Build with xlib & xprint enabled.
Comment 26•23 years ago
|
||
Dauphin: was that a dep tracking build? I suspect any of the REQUIRES lines in
the dirs we normally don't build are fairly dead.
Assignee | ||
Updated•23 years ago
|
Attachment #49198 -
Attachment is obsolete: true
Assignee | ||
Comment 27•23 years ago
|
||
Assignee | ||
Comment 28•23 years ago
|
||
> Same problem as last time:
>
> ../../../../mozilla/gfx/src/xlib/nsRenderingContextXlib.cpp:38:
> imgIContainer.h:
> No such file or directory
> Configuring using: --with-xlib --with-qt --with-qtdir=/usr/lib/qt-2.2.4
>
> Build with xlib & xprint enabled.
I added "imglib2" to gfx/src/xlib/Makefile.in 's REQUIRES line which should
(hopefully) fix this...
BTW: I usually build by Xlib-toolkit builds with "configure
--enable-toolkit=xlib"
Assignee | ||
Comment 29•23 years ago
|
||
Comment on attachment 49200 [details] [diff] [review]
New patch for 2001-09-08-08-trunk to get rid of this mess...
Someone touched REQUIRES line of gfx/src/xlib/Makefile.in between 2001-09-08-08-trunk and todays tip. I'll file a new patch ...
Attachment #49200 -
Attachment is obsolete: true
Assignee | ||
Comment 30•23 years ago
|
||
Assignee | ||
Comment 31•23 years ago
|
||
OK... thanks to jaggernauts's help I did the following to test the patch:
1. Set MOZ_TRACK_MODULE_DEPS=1 in config/autoconf.mk
2. Cleaned dist/
3. (cd gfx; gmake clean) + removed all remaining files (*/Makefile) from gfx/
4. rebuild the tree with "export MOZ_TRACK_MODULE_DEPS=1; nice gmake"
Results:
Build works :-)
Comment 32•23 years ago
|
||
cls: this should fix your problem, I think.
r=jag on the Makefile.in change.
Assignee | ||
Comment 33•23 years ago
|
||
Fix checked in
(http://bonsai.mozilla.org/cvsquery.cgi?module=MozillaTinderboxAll&branch=HEAD&cvsroot=/cvsroot&date=explicit&mindate=1000387560&maxdate=1000387807&who=timeless%25mac.com).
Marking bug as FIXED.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Comment 34•23 years ago
|
||
Roland or cls,
Can you verify this for me? Or could you give
the instruction how to verify?
Thanks.
Assignee | ||
Comment 35•23 years ago
|
||
Verifying - the evil |_IMPL_NS_XPRINT| cpp symbol is gone... :)
Status: RESOLVED → VERIFIED
Updated•16 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•