summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-05-02 23:57:29 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-05-02 23:57:29 -0400
commit48e1979abaecc03af96e7e752e65c645083a4268 (patch)
tree3d6f361da0d6e03000844e73c37cf3834d44b19b /indra/newview
parentc231c97eeefc484b74198ba86251054b7dc0e6bb (diff)
Introduce LLLater::getRemaining(handle).
Some timer use cases need to know not only whether the timer is active, but how much time remains before it (next) fires. Introduce LLLater::mDoneTimes to track, for each handle, the timestamp at which it's expected to fire. We can't just look up the target timestamp in mQueue's func_at entry because there's no documented way to navigate from a handle_type to a node iterator or pointer. Nor can we store it in mHandles because of order dependency: we need the mDoneTimes iterator so we can bind it into the Periodic functor for doPeriodically(), but we need the mQueue handle to store in mHandles. If we could find the mQueue node from the new handle, we could update the func_at entry after emplace() -- but if we could find the mQueue node from a handle, we wouldn't need to store the target timestamp separately anyway. Split LLLater::doAtTime() into internal doAtTime1() and doAtTime2(): the first creates an mDoneTimes entry and returns an iterator, the second finishes creating new mQueue and mHandles entries based on that mDoneTimes entry. This lets doPeriodically()'s Periodic bind the mDoneTimes iterator. Then instead of continually incrementing an internal data member, it increments the mDoneTimes entry to set the next upcoming timestamp. That lets getRemaining() report the next upcoming timestamp rather than only the original one. Add LLEventTimer::isRunning() and getRemaining(), forwarding to its LLLater handle. Fix various LLEventTimer subclass references to mEventTimer.stop(), etc. Fix non-inline LLEventTimer subclass tick() overrides for bool, not BOOL. Remove LLAppViewer::idle() call to LLEventTimer::updateClass(). Since LLApp::stepFrame() already calls LLCallbackList::callFunctions(), assume we've already handled that every tick.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappearancemgr.cpp19
-rw-r--r--indra/newview/llappviewer.cpp7
-rw-r--r--indra/newview/lldonotdisturbnotificationstorage.cpp4
-rw-r--r--indra/newview/llfloaterlinkreplace.cpp10
-rw-r--r--indra/newview/llfloaterpreference.cpp8
-rw-r--r--indra/newview/llfloaterregionrestarting.cpp4
-rw-r--r--indra/newview/llfloateruipreview.cpp6
-rw-r--r--indra/newview/llimview.cpp6
-rw-r--r--indra/newview/lllocalbitmaps.cpp13
-rw-r--r--indra/newview/lllocalbitmaps.h1
-rw-r--r--indra/newview/lllocalgltfmaterials.cpp13
-rw-r--r--indra/newview/lllocalgltfmaterials.h1
-rw-r--r--indra/newview/llmediadataclient.cpp14
-rw-r--r--indra/newview/llpanelpeople.cpp18
-rw-r--r--indra/newview/llsetkeybinddialog.cpp4
-rw-r--r--indra/newview/llspeakers.cpp4
-rw-r--r--indra/newview/lltoast.cpp4
-rw-r--r--indra/newview/llviewermessage.cpp6
-rw-r--r--indra/newview/llviewerparcelmediaautoplay.cpp4
19 files changed, 62 insertions, 84 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 7e84ad3b2a..5b8835add8 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -118,25 +118,19 @@ public:
LLOutfitUnLockTimer(F32 period) : LLEventTimer(period)
{
// restart timer on BOF changed event
- LLOutfitObserver::instance().addBOFChangedCallback(boost::bind(
- &LLOutfitUnLockTimer::reset, this));
+ LLOutfitObserver::instance().addBOFChangedCallback([this]{ start(); });
stop();
}
bool tick() override
{
- if(mEventTimer.hasExpired())
- {
- LLAppearanceMgr::instance().setOutfitLocked(false);
- }
- return FALSE;
+ LLAppearanceMgr::instance().setOutfitLocked(false);
+ return false;
}
- void stop() { mEventTimer.stop(); }
- void start() { mEventTimer.start(); }
- void reset() { mEventTimer.reset(); }
- BOOL getStarted() { return mEventTimer.getStarted(); }
+// void reset() { mEventTimer.reset(); }
+ bool getStarted() { return isRunning(); }
- LLTimer& getEventTimer() { return mEventTimer;}
+// LLTimer& getEventTimer() { return mEventTimer;}
};
// support for secondlife:///app/appearance SLapps
@@ -1706,7 +1700,6 @@ void LLAppearanceMgr::setOutfitLocked(bool locked)
mOutfitLocked = locked;
if (locked)
{
- mUnlockOutfitTimer->reset();
mUnlockOutfitTimer->start();
}
else
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d6a4c41497..0200ea6ad7 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4586,7 +4586,7 @@ static LLTrace::BlockTimerStatHandle FTM_HUD_EFFECTS("HUD Effects");
///////////////////////////////////////////////////////
void LLAppViewer::idle()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
pingMainloopTimeout("Main:Idle");
// Update frame timers
@@ -4594,8 +4594,7 @@ void LLAppViewer::idle()
LLFrameTimer::updateFrameTime();
LLFrameTimer::updateFrameCount();
- LLEventTimer::updateClass();
- LLPerfStats::updateClass();
+ LLPerfStats::updateClass();
// LLApp::stepFrame() performs the above three calls plus mRunner.run().
// Not sure why we don't call stepFrame() here, except that LLRunner seems
@@ -4607,7 +4606,7 @@ void LLAppViewer::idle()
LLDirPickerThread::clearDead();
F32 dt_raw = idle_timer.getElapsedTimeAndResetF32();
- LLGLTFMaterialList::flushUpdates();
+ LLGLTFMaterialList::flushUpdates();
// Service the WorkQueue we use for replies from worker threads.
// Use function statics for the timeslice setting so we only have to fetch
diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 4d9ef99319..93a0ef0e82 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -55,7 +55,7 @@ LLDoNotDisturbNotificationStorageTimer::~LLDoNotDisturbNotificationStorageTimer(
}
-BOOL LLDoNotDisturbNotificationStorageTimer::tick()
+bool LLDoNotDisturbNotificationStorageTimer::tick()
{
LLDoNotDisturbNotificationStorage * doNotDisturbNotificationStorage = LLDoNotDisturbNotificationStorage::getInstance();
@@ -64,7 +64,7 @@ BOOL LLDoNotDisturbNotificationStorageTimer::tick()
{
doNotDisturbNotificationStorage->saveNotifications();
}
- return FALSE;
+ return false;
}
LLDoNotDisturbNotificationStorage::LLDoNotDisturbNotificationStorage()
diff --git a/indra/newview/llfloaterlinkreplace.cpp b/indra/newview/llfloaterlinkreplace.cpp
index b42c49c607..0bc3c241fa 100644
--- a/indra/newview/llfloaterlinkreplace.cpp
+++ b/indra/newview/llfloaterlinkreplace.cpp
@@ -45,7 +45,7 @@ LLFloaterLinkReplace::LLFloaterLinkReplace(const LLSD& key)
mTargetUUID(LLUUID::null),
mBatchSize(gSavedSettings.getU32("LinkReplaceBatchSize"))
{
- mEventTimer.stop();
+ stop();
}
LLFloaterLinkReplace::~LLFloaterLinkReplace()
@@ -202,7 +202,7 @@ void LLFloaterLinkReplace::onStartClickedResponse(const LLSD& notification, cons
mStartBtn->setEnabled(FALSE);
mRefreshBtn->setEnabled(FALSE);
- mEventTimer.start();
+ start();
tick();
}
else
@@ -298,7 +298,7 @@ void LLFloaterLinkReplace::decreaseOpenItemCount()
mStatusText->setText(getString("ReplaceFinished"));
mStartBtn->setEnabled(TRUE);
mRefreshBtn->setEnabled(TRUE);
- mEventTimer.stop();
+ stop();
LL_INFOS() << "Inventory link replace finished." << LL_ENDL;
}
else
@@ -310,7 +310,7 @@ void LLFloaterLinkReplace::decreaseOpenItemCount()
}
}
-BOOL LLFloaterLinkReplace::tick()
+bool LLFloaterLinkReplace::tick()
{
LL_DEBUGS() << "Calling tick - remaining items = " << mRemainingInventoryItems.size() << LL_ENDL;
@@ -320,7 +320,7 @@ BOOL LLFloaterLinkReplace::tick()
{
if (!mRemainingInventoryItems.size())
{
- mEventTimer.stop();
+ stop();
break;
}
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 34dc263519..d9f7f0a171 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1947,7 +1947,7 @@ public:
:LLEventTimer(period),
mCallback(cb)
{
- mEventTimer.stop();
+ stop();
}
virtual ~Updater(){}
@@ -1955,7 +1955,7 @@ public:
void update(const LLSD& new_value)
{
mNewValue = new_value;
- mEventTimer.start();
+ start();
}
protected:
@@ -1963,9 +1963,9 @@ protected:
bool tick() override
{
mCallback(mNewValue);
- mEventTimer.stop();
+ stop();
- return FALSE;
+ return false;
}
private:
diff --git a/indra/newview/llfloaterregionrestarting.cpp b/indra/newview/llfloaterregionrestarting.cpp
index 95d4265bb4..6817cce5f6 100644
--- a/indra/newview/llfloaterregionrestarting.cpp
+++ b/indra/newview/llfloaterregionrestarting.cpp
@@ -74,11 +74,11 @@ void LLFloaterRegionRestarting::regionChange()
close();
}
-BOOL LLFloaterRegionRestarting::tick()
+bool LLFloaterRegionRestarting::tick()
{
refresh();
- return FALSE;
+ return false;
}
void LLFloaterRegionRestarting::refresh()
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 6da380c639..74b6218b46 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -355,7 +355,7 @@ LLFadeEventTimer::LLFadeEventTimer(F32 refresh, LLGUIPreviewLiveFile* parent)
}
// Single tick of fade event timer: increment the color
-BOOL LLFadeEventTimer::tick()
+bool LLFadeEventTimer::tick()
{
float diff = 0.04f;
if(TRUE == mFadingOut) // set fade for in/out color direction
@@ -365,7 +365,7 @@ BOOL LLFadeEventTimer::tick()
if(NULL == mParent) // no more need to tick, so suicide
{
- return TRUE;
+ return true;
}
// Set up colors
@@ -388,7 +388,7 @@ BOOL LLFadeEventTimer::tick()
mFadingOut = FALSE;
}
- return FALSE;
+ return false;
}
// Constructor
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ce4a032b27..0144f13f24 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -99,16 +99,16 @@ const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-141
LLIMMgr* gIMMgr = NULL;
-BOOL LLSessionTimeoutTimer::tick()
+bool LLSessionTimeoutTimer::tick()
{
- if (mSessionId.isNull()) return TRUE;
+ if (mSessionId.isNull()) return true;
LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
if (session && !session->mSessionInitialized)
{
gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
}
- return TRUE;
+ return true;
}
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp
index 1e42773777..60edbfee88 100644
--- a/indra/newview/lllocalbitmaps.cpp
+++ b/indra/newview/lllocalbitmaps.cpp
@@ -996,23 +996,18 @@ LLLocalBitmapTimer::~LLLocalBitmapTimer()
void LLLocalBitmapTimer::startTimer()
{
- mEventTimer.start();
+ start();
}
void LLLocalBitmapTimer::stopTimer()
{
- mEventTimer.stop();
+ stop();
}
-bool LLLocalBitmapTimer::isRunning()
-{
- return mEventTimer.getStarted();
-}
-
-BOOL LLLocalBitmapTimer::tick()
+bool LLLocalBitmapTimer::tick()
{
LLLocalBitmapMgr::getInstance()->doUpdates();
- return FALSE;
+ return false;
}
/*=======================================*/
diff --git a/indra/newview/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h
index 8420049b1e..96a39a3d66 100644
--- a/indra/newview/lllocalbitmaps.h
+++ b/indra/newview/lllocalbitmaps.h
@@ -120,7 +120,6 @@ class LLLocalBitmapTimer : public LLEventTimer
public:
void startTimer();
void stopTimer();
- bool isRunning();
bool tick() override;
};
diff --git a/indra/newview/lllocalgltfmaterials.cpp b/indra/newview/lllocalgltfmaterials.cpp
index 61e0163798..91753349c8 100644
--- a/indra/newview/lllocalgltfmaterials.cpp
+++ b/indra/newview/lllocalgltfmaterials.cpp
@@ -288,24 +288,19 @@ LLLocalGLTFMaterialTimer::~LLLocalGLTFMaterialTimer()
void LLLocalGLTFMaterialTimer::startTimer()
{
- mEventTimer.start();
+ start();
}
void LLLocalGLTFMaterialTimer::stopTimer()
{
- mEventTimer.stop();
+ stop();
}
-bool LLLocalGLTFMaterialTimer::isRunning()
-{
- return mEventTimer.getStarted();
-}
-
-BOOL LLLocalGLTFMaterialTimer::tick()
+bool LLLocalGLTFMaterialTimer::tick()
{
// todo: do on idle? No point in timer
LLLocalGLTFMaterialMgr::getInstance()->doUpdates();
- return FALSE;
+ return false;
}
/*=======================================*/
diff --git a/indra/newview/lllocalgltfmaterials.h b/indra/newview/lllocalgltfmaterials.h
index 53639dfb1d..ff54d48602 100644
--- a/indra/newview/lllocalgltfmaterials.h
+++ b/indra/newview/lllocalgltfmaterials.h
@@ -89,7 +89,6 @@ public:
public:
void startTimer();
void stopTimer();
- bool isRunning();
bool tick() override;
};
diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp
index d3b981e205..5bf587292d 100644
--- a/indra/newview/llmediadataclient.cpp
+++ b/indra/newview/llmediadataclient.cpp
@@ -418,10 +418,10 @@ LLMediaDataClient::QueueTimer::QueueTimer(F32 time, LLMediaDataClient *mdc)
}
// virtual
-BOOL LLMediaDataClient::QueueTimer::tick()
+bool LLMediaDataClient::QueueTimer::tick()
{
- BOOL result = TRUE;
-
+ bool result = TRUE;
+
if (!mMDC.isNull())
{
result = mMDC->processQueueTimer();
@@ -451,7 +451,7 @@ LLMediaDataClient::RetryTimer::RetryTimer(F32 time, Request::ptr_t request)
}
// virtual
-BOOL LLMediaDataClient::RetryTimer::tick()
+bool LLMediaDataClient::RetryTimer::tick()
{
mRequest->stopTracking();
@@ -464,12 +464,12 @@ BOOL LLMediaDataClient::RetryTimer::tick()
LL_INFOS("LLMediaDataClient") << "RetryTimer fired for: " << *mRequest << ", retrying." << LL_ENDL;
mRequest->reEnqueue();
}
-
+
// Release the ref to the request.
- mRequest.reset();
+ mRequest.reset();
// Don't fire again
- return TRUE;
+ return true;
}
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index aad6ceecb2..ab79442f51 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -310,12 +310,12 @@ public:
: LLEventTimer(period),
LLPanelPeople::Updater(cb)
{
- mEventTimer.stop();
+ stop();
}
- virtual bool tick() override // from LLEventTimer
+ bool tick() override // from LLEventTimer
{
- return FALSE;
+ return false;
}
};
@@ -359,7 +359,7 @@ public:
{
// events can arrive quickly in bulk - we need not process EVERY one of them -
// so we wait a short while to let others pile-in, and process them in aggregate.
- mEventTimer.start();
+ start();
}
// save-up all the mask-bits which have come-in
@@ -377,10 +377,10 @@ public:
}
// Stop updates.
- mEventTimer.stop();
+ stop();
mMask = 0;
- return FALSE;
+ return false;
}
// virtual
@@ -499,19 +499,19 @@ public:
{
// update immediately and start regular updates
update();
- mEventTimer.start();
+ start();
}
else
{
// stop regular updates
- mEventTimer.stop();
+ stop();
}
}
bool tick() override
{
update();
- return FALSE;
+ return false;
}
private:
};
diff --git a/indra/newview/llsetkeybinddialog.cpp b/indra/newview/llsetkeybinddialog.cpp
index 79d03922cc..a6d628e1ad 100644
--- a/indra/newview/llsetkeybinddialog.cpp
+++ b/indra/newview/llsetkeybinddialog.cpp
@@ -46,9 +46,7 @@ public:
:LLEventTimer(period),
mMask(mask),
mCallback(cb)
- {
- mEventTimer.start();
- }
+ {}
virtual ~Updater(){}
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 60bada8f58..2bc8d04a8e 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -181,13 +181,13 @@ LLSpeakerActionTimer::LLSpeakerActionTimer(action_callback_t action_cb, F32 acti
{
}
-BOOL LLSpeakerActionTimer::tick()
+bool LLSpeakerActionTimer::tick()
{
if (mActionCallback)
{
return (BOOL)mActionCallback(mSpeakerId);
}
- return TRUE;
+ return true;
}
void LLSpeakerActionTimer::unset()
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index d30e028d33..d2a650f200 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -57,7 +57,7 @@ void LLToastLifeTimer::restart()
bool LLToastLifeTimer::getStarted()
{
- return LLLater::instance.isRunning(mTimer);
+ return isRunning();
}
void LLToastLifeTimer::setPeriod(F32 period)
@@ -326,7 +326,7 @@ void LLToast::setFading(bool transparent)
F32 LLToast::getTimeLeftToLive()
{
- F32 time_to_live = mTimer->getRemainingTimeF32();
+ F32 time_to_live = mTimer->getRemaining();
if (!mIsFading)
{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index b65305337f..e8b81ac3b4 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2901,9 +2901,9 @@ LLPostTeleportNotifiers::~LLPostTeleportNotifiers()
{
}
-BOOL LLPostTeleportNotifiers::tick()
+bool LLPostTeleportNotifiers::tick()
{
- BOOL all_done = FALSE;
+ bool all_done = false;
if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
{
// get callingcards and landmarks available to the user arriving.
@@ -2927,7 +2927,7 @@ BOOL LLPostTeleportNotifiers::tick()
gInventory.addObserver(fetcher);
}
}
- all_done = TRUE;
+ all_done = true;
}
return all_done;
diff --git a/indra/newview/llviewerparcelmediaautoplay.cpp b/indra/newview/llviewerparcelmediaautoplay.cpp
index db8fcb4dc4..8cf86910e7 100644
--- a/indra/newview/llviewerparcelmediaautoplay.cpp
+++ b/indra/newview/llviewerparcelmediaautoplay.cpp
@@ -60,7 +60,7 @@ void LLViewerParcelMediaAutoPlay::playStarted()
LLSingleton<LLViewerParcelMediaAutoPlay>::getInstance()->mPlayed = TRUE;
}
-BOOL LLViewerParcelMediaAutoPlay::tick()
+bool LLViewerParcelMediaAutoPlay::tick()
{
LLParcel *this_parcel = NULL;
LLViewerRegion *this_region = NULL;
@@ -156,7 +156,7 @@ BOOL LLViewerParcelMediaAutoPlay::tick()
}
- return FALSE; // continue ticking forever please.
+ return false; // continue ticking forever please.
}
//static