Bug 1658232 - Don't make ~ProfileBuffer() erase the ProfileChunkedBuffer - r=gregtatum

Until now the `ProfileBuffer` would erase its attached `ProfileChunkedBuffer` upon destruction.
However:
- The main `ProfileChunkedBuffer` is erased anyway in the `ActivePS`,
- Other `ProfileChunkedBuffer`s are short-lived and don't really need to be erased.
- The upcoming changes to `ProfilerBacktrace` and its users means that we will only keep the `ProfileChunkedBuffer` as backtrace storage, a `ProfileBuffer` will only be needed during capture and then when streaming to JSON; so we don't want the `ProfileChunkedBuffer` to be erased when detached from its capturing `ProfileBuffer`.
- Also, the erasing was done by `ResetChunkManager()` in `~ProfileBuffer()`, which was asymetric with what the constructor does (nothing!). So it's better to leave whoever did the `SetChunkManager()` to deal with the corresponding `ResetChunkManager()` (in the main case `ActivePS`, otherwise short-lived buffers being destroyed at the end of their scope).

Both `ProfileBuffer` destructors were only doing this operation, so we can just remove them completely.

Differential Revision: https://phabricator.services.mozilla.com/D86509
This commit is contained in:
Gerald Squelart 2020-08-13 03:28:38 +00:00
Родитель 3f131cf7b3
Коммит accd288dcf
4 изменённых файлов: 0 добавлений и 18 удалений

Просмотреть файл

@ -19,13 +19,6 @@ ProfileBuffer::ProfileBuffer(ProfileChunkedBuffer& aBuffer)
MOZ_ASSERT(mEntries.IsInSession());
}
ProfileBuffer::~ProfileBuffer() {
// Only ProfileBuffer controls this buffer, and it should be empty when there
// is no ProfileBuffer using it.
mEntries.ResetChunkManager();
MOZ_ASSERT(!mEntries.IsInSession());
}
/* static */
ProfileBufferBlockIndex ProfileBuffer::AddEntry(
ProfileChunkedBuffer& aProfileChunkedBuffer,

Просмотреть файл

@ -27,8 +27,6 @@ class ProfileBuffer final {
// manager.
explicit ProfileBuffer(ProfileChunkedBuffer& aBuffer);
~ProfileBuffer();
bool IsThreadSafe() const { return mEntries.IsThreadSafe(); }
// Add |aEntry| to the buffer, ignoring what kind of entry it is.

Просмотреть файл

@ -21,13 +21,6 @@ ProfileBuffer::ProfileBuffer(ProfileChunkedBuffer& aBuffer)
MOZ_ASSERT(mEntries.IsInSession());
}
ProfileBuffer::~ProfileBuffer() {
// Only ProfileBuffer controls this buffer, and it should be empty when there
// is no ProfileBuffer using it.
mEntries.ResetChunkManager();
MOZ_ASSERT(!mEntries.IsInSession());
}
/* static */
ProfileBufferBlockIndex ProfileBuffer::AddEntry(
ProfileChunkedBuffer& aProfileChunkedBuffer,

Просмотреть файл

@ -25,8 +25,6 @@ class ProfileBuffer final {
// manager.
explicit ProfileBuffer(mozilla::ProfileChunkedBuffer& aBuffer);
~ProfileBuffer();
bool IsThreadSafe() const { return mEntries.IsThreadSafe(); }
// Add |aEntry| to the buffer, ignoring what kind of entry it is.