зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1722261 - Convert remaining uses of RegisteredThread's GetEventTarget and ResetMainThread - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D121971
This commit is contained in:
Родитель
22cb733cca
Коммит
34aa8cf6dd
|
@ -65,12 +65,6 @@ class RegisteredThread final {
|
|||
const mozilla::profiler::ThreadRegistrationInfo& Info() const {
|
||||
return mRacyRegisteredThread.mThreadRegistration.mData.mInfo;
|
||||
}
|
||||
nsCOMPtr<nsIEventTarget> GetEventTarget() const {
|
||||
return mRacyRegisteredThread.mThreadRegistration.mData.mThread;
|
||||
}
|
||||
void ResetMainThread(nsIThread* aThread) {
|
||||
mRacyRegisteredThread.mThreadRegistration.mData.mThread = aThread;
|
||||
}
|
||||
|
||||
private:
|
||||
class RacyRegisteredThread mRacyRegisteredThread;
|
||||
|
|
|
@ -4129,7 +4129,8 @@ static ProfilingStack* locked_register_thread(
|
|||
if (ActivePS::Exists(aLock) &&
|
||||
ActivePS::ShouldProfileThread(
|
||||
aLock, aOffThreadRef.UnlockedConstReaderCRef().Info())) {
|
||||
nsCOMPtr<nsIEventTarget> eventTarget = registeredThread->GetEventTarget();
|
||||
nsCOMPtr<nsIEventTarget> eventTarget =
|
||||
lockedRWFromAnyThread->GetEventTarget();
|
||||
ProfiledThreadData* profiledThreadData = ActivePS::AddLiveProfiledThread(
|
||||
aLock, registeredThread.get(),
|
||||
MakeUnique<ProfiledThreadData>(
|
||||
|
@ -4257,12 +4258,15 @@ static Vector<const char*> SplitAtCommas(const char* aString,
|
|||
void profiler_init_threadmanager() {
|
||||
LOG("profiler_init_threadmanager");
|
||||
|
||||
PSAutoLock lock;
|
||||
RegisteredThread* registeredThread =
|
||||
TLSRegisteredThread::RegisteredThread(lock);
|
||||
if (registeredThread && !registeredThread->GetEventTarget()) {
|
||||
registeredThread->ResetMainThread(NS_GetCurrentThreadNoCreate());
|
||||
}
|
||||
ThreadRegistration::WithOnThreadRef(
|
||||
[](ThreadRegistration::OnThreadRef aOnThreadRef) {
|
||||
aOnThreadRef.WithLockedRWOnThread(
|
||||
[](ThreadRegistration::LockedRWOnThread& aThreadData) {
|
||||
if (!aThreadData.GetEventTarget()) {
|
||||
aThreadData.ResetMainThread(NS_GetCurrentThreadNoCreate());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void profiler_init(void* aStackTop) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче