Closed Bug 786503 Opened 13 years ago Closed 13 years ago

Mark nsSMILInstanceTime::mVisited as mutable, instead of doing const_cast dance

Categories

(Core :: SVG, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

nsSMILInstanceTime::mVisited is treated as a mutable member-var (and it has comments indicating that that's intentional). We should just declare it as mutable, so that we don't need the const_cast dance when we modify it.
Attached patch fixSplinter Review
Attachment #656270 - Flags: review?(birtles)
I'm assuming that all the compilers we care about support "mutable", because there are other instances of that keyword in our codebase. Just to be sure, here's a try run (builds-only): https://tbpl.mozilla.org/?tree=Try&rev=91016b3dbb4c
Comment on attachment 656270 [details] [diff] [review] fix Review of attachment 656270 [details] [diff] [review]: ----------------------------------------------------------------- I think the reason we didn't use 'mutable' to begin with was that not all our compilers supported it at the time. Digging up an old version of the C++ portability guide[1] I notice item 31 says "Don't use mutable". That's most likely why we didn't. I agree we should be safe now--the current coding style doesn't make any mention of it[2]--so thanks for bringing this up to date! [1] http://www.literateprogramming.com/portablecpp.pdf [2] https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style ::: content/smil/nsSMILInstanceTime.cpp @@ +168,5 @@ > return true; > > // mVisited is mutable > + mozilla::AutoRestore<bool> setVisited(mVisited); > + mVisited = true; I think we can remove the comment, "mVisited is mutable" as well.
Attachment #656270 - Flags: review?(birtles) → review+
Thanks! Yeah, we use "mutable" in a bunch of places now: https://mxr.mozilla.org/mozilla-central/search?string=+mutable+&case=on&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central so I think we're safe to use it here, too. > I think we can remove the comment, "mVisited is mutable" as well. Cool -- removed. Pushed: https://hg.mozilla.org/integration/mozilla-inbound/rev/2f34d5cff8a0
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: