Closed Bug 988699 Opened 10 years ago Closed 10 years ago

CameraCommon.h re-#defines NS_LOG_ADDREF and NS_LOG_RELEASE for some reason

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

http://mxr.mozilla.org/mozilla-central/search?string=define%20NS_LOG_ADDREF shows that we have two definitions of NS_LOG_ADDREF right now (and similar for NS_LOG_RELEASE):
 - one canonical definition in nsISupportsImpl.h
 - another random one in dom/camera/CameraCommon.h

So, C++ code will have different behavior for this macro, depending on whether it happens to #include "CameraCommon.h" (directly or indirectly).

That seems undesirable.


These #defines were introduced in this cset for bug 779139:
 http://hg.mozilla.org/mozilla-central/rev/244bba751ce4#l3.137
which (per commit message and bug title) are mostly just about making camera objects participate in cycle collection, which I'd imagine shouldn't require any different special addref/release logging macros. 

mikeh, do you remember why we did this (and can these macros go away)?
Flags: needinfo?(mhabicher)
(In reply to Daniel Holbert [:dholbert] from comment #0)
> 
> mikeh, do you remember why we did this (and can these macros go away)?

At the time I had a script that would post-process the output to make nothing was leaking. I haven't used the macros since, so if they're causing problems, they can go away.
Flags: needinfo?(mhabicher)
Attached patch fixSplinter Review
(In reply to Mike Habicher [:mikeh] from comment #1)
> I haven't used the macros since, so if they're causing
> problems, they can go away.

I'm not aware of them actively causing problems at the moment, other than confusion when someone searches for the definition of these macros. :)  (which is how I ran across this)

Anyway, it seems worth removing for that reason & from a code-hygiene perspective.

Patch attached, removing these macros and their inline helper-functions nsLogAddRefCamera/nsLogReleaseCamera (since the macros are the only clients of these functions).
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #8398642 - Flags: review?(mhabicher)
Comment on attachment 8398642 [details] [diff] [review]
fix

Review of attachment 8398642 [details] [diff] [review]:
-----------------------------------------------------------------

Make it so.
Attachment #8398642 - Flags: review?(mhabicher) → review+
Flags: in-testsuite-
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/72c971501525
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
(In reply to Daniel Holbert [:dholbert] from comment #2)
> I'm not aware of them actively causing problems at the moment, other than
> confusion when someone searches for the definition of these macros. :) 
> (which is how I ran across this)

They'd certainly cause potential problems, in that they'd disable:
 * leak detection on tests run on tbpl
 * nsTraceRefcnt leak debugging tools
for all classes implemented in files that include CameraCommon.h.  Both are pretty serious.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: