mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1719240 - Use BaseProfilerMutex and Lock for state-change APIs - r=canaltinova
PSMutex/Autolock are reserved for the main profiler mutex (which will change in the next patch.) Differential Revision: https://phabricator.services.mozilla.com/D119146
This commit is contained in:
parent
210d1cc333
commit
2323e31002
@ -1463,7 +1463,11 @@ uint32_t ActivePS::sNextGeneration = 0;
|
||||
// The mutex that guards accesses to CorePS and ActivePS.
|
||||
static PSMutex gPSMutex;
|
||||
|
||||
static PSMutex gProfilerStateChangeMutex;
|
||||
using ProfilerStateChangeMutex =
|
||||
mozilla::baseprofiler::detail::BaseProfilerMutex;
|
||||
using ProfilerStateChangeLock =
|
||||
mozilla::baseprofiler::detail::BaseProfilerAutoLock;
|
||||
static ProfilerStateChangeMutex gProfilerStateChangeMutex;
|
||||
|
||||
struct IdentifiedProfilingStateChangeCallback {
|
||||
ProfilingStateSet mProfilingStateSet;
|
||||
@ -1489,7 +1493,7 @@ void profiler_add_state_change_callback(
|
||||
ProfilingStateChangeCallback&& aCallback,
|
||||
uintptr_t aUniqueIdentifier /* = 0 */) {
|
||||
gPSMutex.AssertCurrentThreadDoesNotOwn();
|
||||
PSAutoLock lock(gProfilerStateChangeMutex);
|
||||
ProfilerStateChangeLock lock(gProfilerStateChangeMutex);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Check if a non-zero id is not already used. Bug forgive it in non-DEBUG
|
||||
@ -1521,7 +1525,7 @@ void profiler_remove_state_change_callback(uintptr_t aUniqueIdentifier) {
|
||||
}
|
||||
|
||||
gPSMutex.AssertCurrentThreadDoesNotOwn();
|
||||
PSAutoLock lock(gProfilerStateChangeMutex);
|
||||
ProfilerStateChangeLock lock(gProfilerStateChangeMutex);
|
||||
|
||||
mIdentifiedProfilingStateChangeCallbacks.eraseIf(
|
||||
[aUniqueIdentifier](
|
||||
@ -1541,7 +1545,7 @@ void profiler_remove_state_change_callback(uintptr_t aUniqueIdentifier) {
|
||||
static void invoke_profiler_state_change_callbacks(
|
||||
ProfilingState aProfilingState) {
|
||||
gPSMutex.AssertCurrentThreadDoesNotOwn();
|
||||
PSAutoLock lock(gProfilerStateChangeMutex);
|
||||
ProfilerStateChangeLock lock(gProfilerStateChangeMutex);
|
||||
|
||||
for (const IdentifiedProfilingStateChangeCallbackUPtr& idedCallback :
|
||||
mIdentifiedProfilingStateChangeCallbacks) {
|
||||
|
Loading…
Reference in New Issue
Block a user