summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lleventfilter.cpp34
-rw-r--r--indra/llcommon/lleventfilter.h13
-rw-r--r--indra/llcommon/lleventtimer.h69
-rw-r--r--indra/llcommon/llrun.h11
4 files changed, 18 insertions, 109 deletions
diff --git a/indra/llcommon/lleventfilter.cpp b/indra/llcommon/lleventfilter.cpp
index 4cded7f88e..14c9c51830 100644
--- a/indra/llcommon/lleventfilter.cpp
+++ b/indra/llcommon/lleventfilter.cpp
@@ -33,20 +33,19 @@
// STL headers
// std headers
// external library headers
-#include <boost/bind.hpp>
// other Linden headers
+#include "lldate.h"
#include "llerror.h" // LL_ERRS
+#include "lleventtimer.h"
#include "llsdutil.h" // llsd_matches()
#include "stringize.h"
-#include "lleventtimer.h"
-#include "lldate.h"
/*****************************************************************************
* LLEventFilter
*****************************************************************************/
LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak):
LLEventStream(name, tweak),
- mSource(source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1)))
+ mSource(source.listen(getName(), [this](const LLSD& event){ return post(event); }))
{
}
@@ -93,7 +92,7 @@ void LLEventTimeoutBase::actionAfter(F32 seconds, const Action& action)
if (! mMainloop.connected())
{
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
- mMainloop = mainloop.listen(getName(), boost::bind(&LLEventTimeoutBase::tick, this, _1));
+ mMainloop = mainloop.listen(getName(), [this](const LLSD& event){ return tick(event); });
}
}
@@ -185,27 +184,6 @@ bool LLEventTimeout::countdownElapsed() const
return mTimer.hasExpired();
}
-LLEventTimer* LLEventTimeout::post_every(F32 period, const std::string& pump, const LLSD& data)
-{
- return LLEventTimer::run_every(
- period,
- [pump, data](){ LLEventPumps::instance().obtain(pump).post(data); });
-}
-
-LLEventTimer* LLEventTimeout::post_at(const LLDate& time, const std::string& pump, const LLSD& data)
-{
- return LLEventTimer::run_at(
- time,
- [pump, data](){ LLEventPumps::instance().obtain(pump).post(data); });
-}
-
-LLEventTimer* LLEventTimeout::post_after(F32 interval, const std::string& pump, const LLSD& data)
-{
- return LLEventTimer::run_after(
- interval,
- [pump, data](){ LLEventPumps::instance().obtain(pump).post(data); });
-}
-
/*****************************************************************************
* LLEventBatch
*****************************************************************************/
@@ -311,7 +289,7 @@ bool LLEventThrottleBase::post(const LLSD& event)
// timeRemaining tells us how much longer it will be until
// mInterval seconds since the last flush() call. At that time,
// flush() deferred events.
- alarmActionAfter(timeRemaining, boost::bind(&LLEventThrottleBase::flush, this));
+ alarmActionAfter(timeRemaining, [this](){ flush(); });
}
}
return false;
@@ -349,7 +327,7 @@ void LLEventThrottleBase::setInterval(F32 interval)
// and if mAlarm is running, reset that too
if (alarmRunning())
{
- alarmActionAfter(timeRemaining, boost::bind(&LLEventThrottleBase::flush, this));
+ alarmActionAfter(timeRemaining, [this](){ flush(); });
}
}
}
diff --git a/indra/llcommon/lleventfilter.h b/indra/llcommon/lleventfilter.h
index 7613850fb2..437a4826d4 100644
--- a/indra/llcommon/lleventfilter.h
+++ b/indra/llcommon/lleventfilter.h
@@ -214,19 +214,6 @@ public:
LLEventTimeout();
LLEventTimeout(LLEventPump& source);
- /// using LLEventTimeout as namespace for free functions
- /// Post event to specified LLEventPump every period seconds. Delete
- /// returned LLEventTimer* to cancel.
- static LLEventTimer* post_every(F32 period, const std::string& pump, const LLSD& data);
- /// Post event to specified LLEventPump at specified future time. Call
- /// LLEventTimer::getInstance(returned pointer) to check whether it's still
- /// pending; if so, delete the pointer to cancel.
- static LLEventTimer* post_at(const LLDate& time, const std::string& pump, const LLSD& data);
- /// Post event to specified LLEventPump after specified interval. Call
- /// LLEventTimer::getInstance(returned pointer) to check whether it's still
- /// pending; if so, delete the pointer to cancel.
- static LLEventTimer* post_after(F32 interval, const std::string& pump, const LLSD& data);
-
protected:
virtual void setCountdown(F32 seconds);
virtual bool countdownElapsed() const;
diff --git a/indra/llcommon/lleventtimer.h b/indra/llcommon/lleventtimer.h
index dbbfe0c6e6..b5d40a0622 100644
--- a/indra/llcommon/lleventtimer.h
+++ b/indra/llcommon/lleventtimer.h
@@ -24,7 +24,7 @@
* $/LicenseInfo$
*/
-#ifndef LL_EVENTTIMER_H
+#ifndef LL_EVENTTIMER_H
#define LL_EVENTTIMER_H
#include "stdtypes.h"
@@ -47,76 +47,9 @@ public:
static void updateClass();
- /// Schedule recurring calls to generic callable every period seconds.
- /// Returns a pointer; if you delete it, cancels the recurring calls.
- template <typename CALLABLE>
- static LLEventTimer* run_every(F32 period, const CALLABLE& callable);
-
- /// Schedule a future call to generic callable. Returns a pointer.
- /// CAUTION: The object referenced by that pointer WILL BE DELETED once
- /// the callback has been called! LLEventTimer::getInstance(pointer) (NOT
- /// pointer->getInstance(pointer)!) can be used to test whether the
- /// pointer is still valid. If it is, deleting it will cancel the
- /// callback.
- template <typename CALLABLE>
- static LLEventTimer* run_at(const LLDate& time, const CALLABLE& callable);
-
- /// Like run_at(), but after a time delta rather than at a timestamp.
- /// Same CAUTION.
- template <typename CALLABLE>
- static LLEventTimer* run_after(F32 interval, const CALLABLE& callable);
-
protected:
LLTimer mEventTimer;
F32 mPeriod;
-
-private:
- template <typename CALLABLE>
- class Generic;
};
-template <typename CALLABLE>
-class LLEventTimer::Generic: public LLEventTimer
-{
-public:
- // making TIME generic allows engaging either LLEventTimer constructor
- template <typename TIME>
- Generic(const TIME& time, bool once, const CALLABLE& callable):
- LLEventTimer(time),
- mOnce(once),
- mCallable(callable)
- {}
- BOOL tick() override
- {
- mCallable();
- // true tells updateClass() to delete this instance
- return mOnce;
- }
-
-private:
- bool mOnce;
- CALLABLE mCallable;
-};
-
-template <typename CALLABLE>
-LLEventTimer* LLEventTimer::run_every(F32 period, const CALLABLE& callable)
-{
- // return false to schedule recurring calls
- return new Generic<CALLABLE>(period, false, callable);
-}
-
-template <typename CALLABLE>
-LLEventTimer* LLEventTimer::run_at(const LLDate& time, const CALLABLE& callable)
-{
- // return true for one-shot callback
- return new Generic<CALLABLE>(time, true, callable);
-}
-
-template <typename CALLABLE>
-LLEventTimer* LLEventTimer::run_after(F32 interval, const CALLABLE& callable)
-{
- // one-shot callback after specified interval
- return new Generic<CALLABLE>(interval, true, callable);
-}
-
#endif //LL_EVENTTIMER_H
diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h
index d610f86234..ebad5f3eaa 100644
--- a/indra/llcommon/llrun.h
+++ b/indra/llcommon/llrun.h
@@ -34,6 +34,17 @@
class LLRunnable;
+//////////////////////////////////////////////////////////////////////////////
+// DEPRECATION WARNING
+// LLRunner is one of several mostly redundant ways to schedule future
+// callbacks on the main thread. It seems to be unused in the current viewer.
+// addRunner() is only called by LLPumpIO::sleepChain().
+// sleepChain() is only called by LLIOSleeper and LLIOSleep.
+// LLIOSleeper is referenced only by tests.
+// LLIOSleep is only called by LLDeferredChain.
+// LLDeferredChain isn't referenced at all.
+//////////////////////////////////////////////////////////////////////////////
+
/**
* @class LLRunner
* @brief This class manages a set of LLRunnable objects.