Closed Bug 317481 Opened 19 years ago Closed 18 years ago

C API for nsTraceRefcnt

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Future

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

(Whiteboard: [patch])

Attachments

(2 files, 2 obsolete files)

I've needed to use nsTraceRefcnt's leak logging ability from C code a number of times, most recently to debug bug 317478 (where I needed to log JS_LockGCThing and JS_UnlockGCThing as reference counting).  This time I decided to take a cleaner approach and actually write a small API to do this.  I'm not sure if it's really something we want to check in -- I'm curious what bsmedberg thinks.
Attached patch C API for nsTraceRefcnt (obsolete) — Splinter Review
bsmedberg, any opinions on how evil this is?
Attachment #203987 - Flags: review?(bsmedberg)
Attachment #203987 - Flags: review?(bsmedberg) → review?(benjamin)
The previous example for tracking lock/unlock of GC things was missing an NS_LOG_ADDREF in js_NewGCThing for objects created locked.
Attachment #203988 - Attachment is obsolete: true
Comment on attachment 203987 [details] [diff] [review]
C API for nsTraceRefcnt

Well hrm, I like the idea but it seems to be a bit hackier than we actually need. Why can't we just inline the static nsTraceRefCnt methods directly to their C counterparts (or get rid of them altogether, but I suppose they are used throughout the tree and we don't want to go on a global search-n-replace hunt).
Comment on attachment 203987 [details] [diff] [review]
C API for nsTraceRefcnt

r- to get this off my queue until questions are addressed.
Attachment #203987 - Flags: review?(benjamin) → review-
Status: NEW → ASSIGNED
Target Milestone: --- → Future
New patch is in bug 325229
Depends on: 325229
FIXED by bug 325229.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Not fixed, since the macros still aren't usable.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Note that this change is not just a change in delimiters:

-// nsCOMPtr.h allows these macros to be defined by clients
-// These logging functions require dynamic_cast<void *>, so we don't
-// define these macros if we don't have dynamic_cast.
+/* nsCOMPtr.h allows these macros to be defined by clients
+ * These logging functions require dynamic_cast<void*>, so they don't
+ * do anything useful if we don't have dynamic_cast<void*>. */

since bsmedberg didn't update this comment with his patch.  (I'm not sure I like that change, either, but I suppose it's OK.)
Attachment #203987 - Attachment is obsolete: true
Attachment #212013 - Flags: review?(benjamin)
Attachment #212013 - Flags: review?(benjamin) → review+
Fix checked in to trunk.
Status: REOPENED → RESOLVED
Closed: 18 years ago18 years ago
Resolution: --- → FIXED
Comment on attachment 203987 [details] [diff] [review]
C API for nsTraceRefcnt

I realize that a different fix went into the trunk but this patch has actually been very useful to us working on the 1.8 branch (for GC logging - bug 307312). Wondering what folks thought of putting it on the branch only.
Attachment #203987 - Flags: approval1.8.1?
Comment on attachment 203987 [details] [diff] [review]
C API for nsTraceRefcnt

Minusing (just myself, not on behalf of drivers) since we don't want an API that doesn't match what we've added on the trunk, and also since the patch has review-.
Attachment #203987 - Flags: approval1.8.1? → approval1.8.1-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: