Closed
Bug 1238121
Opened 9 years ago
Closed 9 years ago
SamplerStackFrameRAII classes aren't MOZ_RAII and don't prevent you from misusing them
Categories
(Core :: Gecko Profiler, defect)
Core
Gecko Profiler
Tracking
()
RESOLVED
FIXED
mozilla47
Tracking | Status | |
---|---|---|
firefox47 | --- | fixed |
People
(Reporter: chutten, Assigned: chutten)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
1.70 KB,
patch
|
chutten
:
review+
|
Details | Diff | Splinter Review |
GeckoProfilerImpl.h has two RAII classes that don't prevent you from accidentally creating them in a way that it self-deletes at the end of the statement.
According to https://developer.mozilla.org/en-US/docs/Mozilla/RAII_classes there are ways to fix this so that others do not have to suffer the same shame as I have.
(( Will fix a small portion of bug 1204239 when complete ))
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8712275 -
Flags: review?(michael)
Comment 2•9 years ago
|
||
Comment on attachment 8712275 [details] [diff] [review]
0001-bug-1238121-Properly-guard-Profiler-s-RAII-classes-r.patch
Review of attachment 8712275 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM as a use of MOZ_RAII, but I don't think I'm the person to talk to for changes in the profiler.
Attachment #8712275 -
Flags: review?(michael) → feedback+
Assignee | ||
Comment 3•9 years ago
|
||
Comment on attachment 8712275 [details] [diff] [review]
0001-bug-1238121-Properly-guard-Profiler-s-RAII-classes-r.patch
Tapping :BenWa as he knows profiler stuff (at least enough to point this r? at the correct person if he isn't it).
Attachment #8712275 -
Flags: review?(bgirard)
Comment 4•9 years ago
|
||
Comment on attachment 8712275 [details] [diff] [review]
0001-bug-1238121-Properly-guard-Profiler-s-RAII-classes-r.patch
Review of attachment 8712275 [details] [diff] [review]:
-----------------------------------------------------------------
Other than not adding a guard to PrintfRAII it looks good.
::: tools/profiler/public/GeckoProfilerImpl.h
@@ +429,5 @@
> void* mHandle;
> };
>
> static const int SAMPLER_MAX_STRING = 128;
> +class MOZ_RAII SamplerStackFramePrintfRAII {
Why not add the guard here too?
Attachment #8712275 -
Flags: review?(bgirard) → review+
Assignee | ||
Comment 5•9 years ago
|
||
It occurs to me that the lovely commit messages I've been writing don't show up too prominently in bugzilla reviews :(
Basically, the GUARD_OBJECT stuff makes use of default args. PrintfRAII uses va_list. The two just don't work together. At all. And the trick that GUARD_OBJECT uses (I wrote a blog post about it: https://chuttenblog.wordpress.com/2016/01/11/c-today-i-learned-how-to-use-dtor-order-to-detect-temporaries/) seems to require the default arg, so I can't see a way around it.
Attachment #8712275 -
Attachment is obsolete: true
Attachment #8713241 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 6•9 years ago
|
||
Ahh right, makes sense, thanks! Land away.
Keywords: checkin-needed
Comment 8•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox47:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Comment 9•9 years ago
|
||
backout bugherder landing |
Backed out to see if it fixes the intermittent hazard build failures like https://treeherder.mozilla.org/logviewer.html#?job_id=20736122&repo=mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/8fb056fcecd0
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 10•9 years ago
|
||
Looking at the hazards list, it isn't likely that this caused them. Back to checkin-needed.
Keywords: checkin-needed
Comment 11•9 years ago
|
||
Keywords: checkin-needed
Comment 12•9 years ago
|
||
bugherder |
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•