gecko-dev/mozglue
Gerald Squelart 86c0b62678 Bug 1573111 - BlocksRingBuffer can switch underlying buffer - r=gregtatum
`BlocksRingBuffer` will be used both inside and outside `ProfileBuffer`:
- Inside to serve as `ProfileBuffer`'s main storage for stack traces,
- Outside to allow marker storage even when `ProfileBuffer` is locked during
  stack sampling.

`ProfileBuffer` only exists while `ActivePS` is alive, but because of the
potential outside accesses above (due to small races between ProfileBuffer
shutdown, and thread-local IsBeingProfiled() flags), we cannot just do the same
for BlocksRingBuffer, and it must remain alive to gracefully deny these accesses
around the profiler startup and shutdown times.

To accomplish this, `BlocksRingBuffer` may be in different states:
- "In-session", we have a real buffer to write to and read from,
- "Out-of-session", without buffer so reads&writes do nothing.
This is implemented by enclosing the underlying `ModuloBuffer` and the entry
deleter in a `Maybe`, which may be `Nothing` when the profiler is not running
and the `ProfileBuffer`'s `BlocksRingBuffer` is out-of-session.

Differential Revision: https://phabricator.services.mozilla.com/D41519

--HG--
extra : moz-landing-system : lando
2019-08-13 12:06:40 +00:00
..
android Bug 1555205 - Move db/sqlite3 to third_party/; r=mak 2019-05-29 10:16:29 +00:00
baseprofiler Bug 1573111 - BlocksRingBuffer can switch underlying buffer - r=gregtatum 2019-08-13 12:06:40 +00:00
build Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-08-13 07:15:25 +00:00
linker Bug 1562642 - Part 2 - Add missing MPL2 headers r=Gijs 2019-07-08 09:27:47 +00:00
misc Bug 1418624 - Allow mozilla::Result to be moved, make unwrap{,Err}() move, and add inspect() APIs that return references. r=froydnj 2019-08-13 08:26:18 +00:00
tests Bug 1573111 - BlocksRingBuffer can switch underlying buffer - r=gregtatum 2019-08-13 12:06:40 +00:00
moz.build Bug 1492121 - MOZ_BASE_PROFILER may be defined in BaseProfiler.h to enable Base Profiler - r=njn 2019-06-06 06:17:30 +00:00