Revert part 5 also. It does depends on part 4.

Revert part 5 also. It does depends on part 4.
This commit is contained in:
win7-7 2026-01-28 17:30:07 +02:00 committed by wuggy
commit e79cfc5a77
4 changed files with 24 additions and 85 deletions

View file

@ -32,17 +32,12 @@ extern mozilla::LogModule* GetTimerLog();
{0x84, 0x27, 0xfb, 0xab, 0x44, 0xf2, 0x9b, 0xc8} \
}
class nsTimerImplHolder;
// TimerThread, nsTimerEvent, and nsTimer have references to these. nsTimer has
// a separate lifecycle so we can Cancel() the underlying timer when the user of
// the nsTimer has let go of its last reference.
class nsTimerImpl
{
~nsTimerImpl()
{
MOZ_ASSERT(!mHolder);
}
~nsTimerImpl() {}
public:
typedef mozilla::TimeStamp TimeStamp;
@ -164,8 +159,6 @@ public:
mType == nsITimer::TYPE_REPEATING_SLACK_LOW_PRIORITY;
}
void SetHolder(nsTimerImplHolder* aHolder);
nsCOMPtr<nsIEventTarget> mEventTarget;
void LogFiring(const Callback& aCallback, uint8_t aType, uint32_t aDelay);
@ -176,10 +169,6 @@ public:
uint32_t aType,
Callback::Name aName);
// This weak reference must be cleared by the nsTimerImplHolder by calling
// SetHolder(nullptr) before the holder is destroyed.
nsTimerImplHolder* mHolder;
// These members are set by the initiating thread, when the timer's type is
// changed and during the period where it fires on that thread.
uint8_t mType;
@ -231,39 +220,4 @@ private:
RefPtr<nsTimerImpl> mImpl;
};
// A class that holds on to an nsTimerImpl. This lets the nsTimerImpl object
// directly instruct its holder to forget the timer, avoiding list lookups.
class nsTimerImplHolder
{
public:
explicit nsTimerImplHolder(nsTimerImpl* aTimerImpl)
: mTimerImpl(aTimerImpl)
{
if (mTimerImpl) {
mTimerImpl->SetHolder(this);
}
}
~nsTimerImplHolder()
{
if (mTimerImpl) {
mTimerImpl->SetHolder(nullptr);
}
}
void
Forget(nsTimerImpl* aTimerImpl)
{
if (MOZ_UNLIKELY(!mTimerImpl)) {
return;
}
MOZ_ASSERT(aTimerImpl == mTimerImpl);
mTimerImpl->SetHolder(nullptr);
mTimerImpl = nullptr;
}
protected:
RefPtr<nsTimerImpl> mTimerImpl;
};
#endif /* nsTimerImpl_h___ */