зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1722261 - Move profiler_thread_is_being_profiled to ProfilerThreadState.h and use ThreadRegistration - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121848
This commit is contained in:
Родитель
27339446a1
Коммит
dec6c72992
|
@ -35,10 +35,6 @@ class RacyRegisteredThread final {
|
|||
mThreadRegistration.mData.mIsBeingProfiled = aIsBeingProfiled;
|
||||
}
|
||||
|
||||
bool IsBeingProfiled() const {
|
||||
return mThreadRegistration.mData.mIsBeingProfiled;
|
||||
}
|
||||
|
||||
// This is called on every profiler restart. Put things that should happen at
|
||||
// that time here.
|
||||
void ReinitializeOnResume() {
|
||||
|
|
|
@ -5597,14 +5597,6 @@ void profiler_thread_wake() {
|
|||
racyRegisteredThread->SetAwake();
|
||||
}
|
||||
|
||||
bool mozilla::profiler::detail::IsThreadBeingProfiled() {
|
||||
MOZ_RELEASE_ASSERT(CorePS::Exists());
|
||||
|
||||
const RacyRegisteredThread* racyRegisteredThread =
|
||||
TLSRegisteredThread::RacyRegisteredThread();
|
||||
return racyRegisteredThread && racyRegisteredThread->IsBeingProfiled();
|
||||
}
|
||||
|
||||
bool profiler_thread_is_sleeping() {
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread());
|
||||
MOZ_RELEASE_ASSERT(CorePS::Exists());
|
||||
|
|
|
@ -164,7 +164,6 @@ using ProfilingStateChangeCallback = std::function<void(ProfilingState)>;
|
|||
|
||||
[[nodiscard]] inline bool profiler_is_active() { return false; }
|
||||
[[nodiscard]] inline bool profiler_can_accept_markers() { return false; }
|
||||
[[nodiscard]] inline bool profiler_thread_is_being_profiled() { return false; }
|
||||
[[nodiscard]] inline bool profiler_feature_active(uint32_t aFeature) {
|
||||
return false;
|
||||
}
|
||||
|
@ -276,7 +275,6 @@ class RacyFeatures {
|
|||
sActiveAndFeatures;
|
||||
};
|
||||
|
||||
[[nodiscard]] bool IsThreadBeingProfiled();
|
||||
} // namespace mozilla::profiler::detail
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -315,13 +313,6 @@ class RacyFeatures {
|
|||
return mozilla::profiler::detail::RacyFeatures::IsActiveAndUnpaused();
|
||||
}
|
||||
|
||||
// Is the profiler active, and is the current thread being profiled?
|
||||
// (Same caveats and recommented usage as profiler_is_active().)
|
||||
[[nodiscard]] inline bool profiler_thread_is_being_profiled() {
|
||||
return profiler_is_active() &&
|
||||
mozilla::profiler::detail::IsThreadBeingProfiled();
|
||||
}
|
||||
|
||||
// Is the profiler active and paused? Returns false if the profiler is inactive.
|
||||
[[nodiscard]] bool profiler_is_paused();
|
||||
|
||||
|
|
|
@ -22,4 +22,17 @@
|
|||
mozilla::profiler::ThreadRegistration::IsRegistered();
|
||||
}
|
||||
|
||||
// Is the profiler active, and is the current thread being profiled?
|
||||
// (Same caveats and recommented usage as profiler_is_active().)
|
||||
[[nodiscard]] inline bool profiler_thread_is_being_profiled() {
|
||||
return profiler_is_active() &&
|
||||
mozilla::profiler::ThreadRegistration::WithOnThreadRefOr(
|
||||
[](mozilla::profiler::ThreadRegistration::OnThreadRef aTR) {
|
||||
return aTR.UnlockedConstReaderAndAtomicRWCRef()
|
||||
.IsBeingProfiled();
|
||||
},
|
||||
false);
|
||||
;
|
||||
}
|
||||
|
||||
#endif // ProfilerThreadState_h
|
||||
|
|
Загрузка…
Ссылка в новой задаче