From cde8c7b58c31a7615c1ab6e4d61208367b9a3e53 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 29 Feb 2020 06:18:45 -0500
Subject: [PATCH] Finalize rlv classes for better virtual optimization

---
 indra/newview/rlvcommon.cpp    |  2 +-
 indra/newview/rlvcommon.h      |  6 +++---
 indra/newview/rlvextensions.h  |  2 +-
 indra/newview/rlvfloaters.h    |  8 ++++----
 indra/newview/rlvhandler.cpp   |  2 +-
 indra/newview/rlvhelper.h      |  8 ++++----
 indra/newview/rlvinventory.cpp |  2 +-
 indra/newview/rlvinventory.h   | 15 +++++++--------
 indra/newview/rlvlocks.cpp     |  2 +-
 indra/newview/rlvlocks.h       |  2 +-
 indra/newview/rlvmodifiers.h   |  8 ++++----
 11 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp
index 891c968011..ea654a45f2 100644
--- a/indra/newview/rlvcommon.cpp
+++ b/indra/newview/rlvcommon.cpp
@@ -757,7 +757,7 @@ bool rlvCanDeleteOrReturn()
 {
 	if ( (gRlvHandler.hasBehaviour(RLV_BHVR_REZ)) || (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) )
 	{
-		struct RlvCanDeleteOrReturn : public LLSelectedObjectFunctor
+		struct RlvCanDeleteOrReturn final : public LLSelectedObjectFunctor
 		{
 			/*virtual*/ bool apply(LLViewerObject* pObj) { return rlvCanDeleteOrReturn(pObj); }
 		} f;
diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h
index 67c99e08df..3245049e59 100644
--- a/indra/newview/rlvcommon.h
+++ b/indra/newview/rlvcommon.h
@@ -226,20 +226,20 @@ bool rlvMenuEnableIfNot(const LLSD& sdParam);
 bool rlvCanDeleteOrReturn();
 bool rlvCanDeleteOrReturn(const LLViewerObject* pObj);
 
-struct RlvSelectHasLockedAttach : public LLSelectedNodeFunctor
+struct RlvSelectHasLockedAttach final : public LLSelectedNodeFunctor
 {
 	RlvSelectHasLockedAttach() = default;
 	virtual bool apply(LLSelectNode* pNode);
 };
 
 // Filters out selected objects that can't be editable (i.e. getFirstNode() will return NULL if the selection is fully editable)
-struct RlvSelectIsEditable : public LLSelectedNodeFunctor
+struct RlvSelectIsEditable final : public LLSelectedNodeFunctor
 {
 	RlvSelectIsEditable() = default;
 	/*virtual*/ bool apply(LLSelectNode* pNode);
 };
 
-struct RlvSelectIsSittingOn : public LLSelectedNodeFunctor
+struct RlvSelectIsSittingOn final : public LLSelectedNodeFunctor
 {
 	RlvSelectIsSittingOn(const LLVOAvatar* pAvatar) : m_pAvatar(pAvatar) {}
 	/*virtual*/ bool apply(LLSelectNode* pNode);
diff --git a/indra/newview/rlvextensions.h b/indra/newview/rlvextensions.h
index b255302504..f94387ce33 100644
--- a/indra/newview/rlvextensions.h
+++ b/indra/newview/rlvextensions.h
@@ -27,7 +27,7 @@
  *
  */
 
-class RlvExtGetSet : public RlvExtCommandHandler
+class RlvExtGetSet final : public RlvExtCommandHandler
 {
 public:
 	RlvExtGetSet();
diff --git a/indra/newview/rlvfloaters.h b/indra/newview/rlvfloaters.h
index f29fa92483..9e6fb2b621 100644
--- a/indra/newview/rlvfloaters.h
+++ b/indra/newview/rlvfloaters.h
@@ -38,7 +38,7 @@ enum class ERlvBehaviourFilter {
 	ALL
 };
 
-class RlvFloaterBehaviours : public LLFloater
+class RlvFloaterBehaviours final : public LLFloater
 {
 	friend class LLFloaterReg;
 private:
@@ -74,7 +74,7 @@ protected:
 // RlvFloaterLocks class declaration
 //
 
-class RlvFloaterLocks : public LLFloater
+class RlvFloaterLocks final : public LLFloater
 {
 	friend class LLFloaterReg;
 private:
@@ -106,7 +106,7 @@ protected:
 // RlvFloaterStrings class declaration
 //
 
-class RlvFloaterStrings : public LLFloater
+class RlvFloaterStrings final : public LLFloater
 {
 	friend class LLFloaterReg;
 private:
@@ -135,7 +135,7 @@ protected:
 // RlvFloaterConsole - debug console to allow command execution without the need for a script
 //
 
-class RlvFloaterConsole : public LLFloater
+class RlvFloaterConsole final : public LLFloater
 {
 	friend class LLFloaterReg;
 	template<ERlvParamType> friend struct RlvCommandHandlerBaseImpl;
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index 62f5aea590..3ca3bbaa86 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -612,7 +612,7 @@ bool RlvHandler::processIMQuery(const LLUUID& idSender, const std::string& strMe
 			params.substitutions = LLSD().with("NAME_LABEL", LLSLURL("agent", idSender, "completename").getSLURLString()).with("NAME_SLURL", LLSLURL("agent", idSender, "about").getSLURLString());
 			params.payload = LLSD().with("from_id", idSender).with("command", strMessage);
 
-			class RlvPostponedOfferNotification : public LLPostponedNotification
+			class RlvPostponedOfferNotification final : public LLPostponedNotification
 			{
 			protected:
 				void modifyNotificationParams() override
diff --git a/indra/newview/rlvhelper.h b/indra/newview/rlvhelper.h
index 3b9babc7a8..0600a91f98 100644
--- a/indra/newview/rlvhelper.h
+++ b/indra/newview/rlvhelper.h
@@ -187,7 +187,7 @@ typedef RlvForceHandler<RLV_BHVR_SETCAM_EYEOFFSET> RlvForceCamEyeFocusOffsetHand
 // RlvCommandProcessor - Templated glue class that brings RlvBehaviourInfo, RlvCommandHandlerBaseImpl and RlvCommandHandler together
 //
 template <ERlvParamType templParamType, ERlvBehaviour templBhvr, typename handlerImpl = RlvCommandHandler<templParamType, templBhvr>, typename baseImpl = RlvCommandHandlerBaseImpl<templParamType>>
-class RlvCommandProcessor : public RlvBehaviourInfo
+class RlvCommandProcessor final : public RlvBehaviourInfo
 {
 public:
 	// Default constructor used by behaviour specializations
@@ -217,7 +217,7 @@ template<ERlvBehaviourOptionType templOptionType> using RlvForceGenericProcessor
 //
 
 template <ERlvBehaviour eBhvr, typename handlerImpl = RlvBehaviourHandler<eBhvr>, typename toggleHandlerImpl = RlvBehaviourToggleHandler<eBhvr>>
-class RlvBehaviourToggleProcessor : public RlvBehaviourInfo
+class RlvBehaviourToggleProcessor final : public RlvBehaviourInfo
 {
 public:
 	RlvBehaviourToggleProcessor(const std::string& strBhvr, U32 nBhvrFlags = 0) : RlvBehaviourInfo(strBhvr, eBhvr, RLV_TYPE_ADDREM, nBhvrFlags) {}
@@ -639,7 +639,7 @@ private:
 // Various helper classes/timers/functors
 //
 
-class RlvGCTimer : public LLEventTimer
+class RlvGCTimer final : public LLEventTimer
 {
 public:
 	RlvGCTimer() : LLEventTimer(30.0) {}
@@ -647,7 +647,7 @@ public:
 };
 
 // NOTE: Unused as of SL-3.7.2
-class RlvCallbackTimerOnce : public LLEventTimer
+class RlvCallbackTimerOnce final : public LLEventTimer
 {
 public:
 	typedef boost::function<void ()> nullary_func_t;
diff --git a/indra/newview/rlvinventory.cpp b/indra/newview/rlvinventory.cpp
index c5f28ec088..c41f8c4148 100644
--- a/indra/newview/rlvinventory.cpp
+++ b/indra/newview/rlvinventory.cpp
@@ -37,7 +37,7 @@ const std::string RlvInventory::cstrSharedRoot = RLV_ROOT_FOLDER;
 //
 
 // TODO-RLVa: [RLVa-1.2.1] This class really shouldn't be calling "fetchSharedLinks" directly so find a better way
-class RlvSharedInventoryFetcher : public LLInventoryFetchDescendentsObserver
+class RlvSharedInventoryFetcher final : public LLInventoryFetchDescendentsObserver
 {
 public:
 	RlvSharedInventoryFetcher(const uuid_vec_t& idFolders): LLInventoryFetchDescendentsObserver(idFolders) {}
diff --git a/indra/newview/rlvinventory.h b/indra/newview/rlvinventory.h
index 7b24cf75f4..63a44a7880 100644
--- a/indra/newview/rlvinventory.h
+++ b/indra/newview/rlvinventory.h
@@ -102,14 +102,13 @@ protected:
 private:
 	static const std::string cstrSharedRoot;
 	friend class RlvSharedInventoryFetcher;
-	friend class LLSingleton<RlvInventory>;
 };
 
 // ============================================================================
 // RlvRenameOnWearObserver - Handles "auto-rename-on-wear" for (linked) items living under #RLV
 //
 
-class RlvRenameOnWearObserver : public LLInventoryFetchItemsObserver
+class RlvRenameOnWearObserver final : public LLInventoryFetchItemsObserver
 {
 public:
 	RlvRenameOnWearObserver(const LLUUID& idItem) : LLInventoryFetchItemsObserver(idItem) {}
@@ -143,7 +142,7 @@ private:
 // [See LLInventoryTransactionObserver which says it's not entirely complete?]
 // NOTE: the offer may span mulitple BulkUpdateInventory messages so if we're no longer around then (ie due to "delete this") then
 //       we'll miss those; in this specific case we only care about the *folder* though and that will be in the very first message
-class RlvGiveToRLVTaskOffer : public LLInventoryObserver, RlvGiveToRLVOffer
+class RlvGiveToRLVTaskOffer final : public LLInventoryObserver, RlvGiveToRLVOffer
 {
 public:
 	RlvGiveToRLVTaskOffer(const LLUUID& idTransaction) : RlvGiveToRLVOffer(), m_idTransaction(idTransaction) {}
@@ -159,7 +158,7 @@ protected:
 	LLUUID       m_idTransaction;
 };
 
-class RlvGiveToRLVAgentOffer : public LLInventoryFetchDescendentsObserver, RlvGiveToRLVOffer
+class RlvGiveToRLVAgentOffer final : public LLInventoryFetchDescendentsObserver, RlvGiveToRLVOffer
 {
 public:
 	RlvGiveToRLVAgentOffer(const LLUUID& idFolder) : LLInventoryFetchDescendentsObserver(idFolder), RlvGiveToRLVOffer()  {}
@@ -175,7 +174,7 @@ protected:
 // RlvCriteriaCategoryCollector - Criteria based folder matching filter used by @findfolder and @findfolders
 //
 
-class RlvCriteriaCategoryCollector : public LLInventoryCollectFunctor
+class RlvCriteriaCategoryCollector final : public LLInventoryCollectFunctor
 {
 public:
 	RlvCriteriaCategoryCollector(const std::string& strCriteria)
@@ -223,7 +222,7 @@ protected:
 // RlvWearableItemCollector - Inventory item filter used by attach/detach/attachall/detachall/getinvworn
 //
 
-class RlvWearableItemCollector : public LLInventoryCollectFunctor
+class RlvWearableItemCollector final : public LLInventoryCollectFunctor
 {
 public:
 	RlvWearableItemCollector(const LLInventoryCategory* pFolder, RlvForceWear::EWearAction eAction, RlvForceWear::EWearFlags eFlags);
@@ -258,7 +257,7 @@ protected:
 // General purpose inventory helper classes
 //
 
-class RlvIsLinkType : public LLInventoryCollectFunctor
+class RlvIsLinkType final : public LLInventoryCollectFunctor
 {
 public:
 	RlvIsLinkType() = default;
@@ -267,7 +266,7 @@ public:
 };
 
 // If the attachment item is linked in COF but isn't worn (or just detached) the function will return inconsistent information
-class RlvFindAttachmentsOnPoint : public LLInventoryCollectFunctor
+class RlvFindAttachmentsOnPoint final : public LLInventoryCollectFunctor
 {
 public:
 	RlvFindAttachmentsOnPoint(const LLViewerJointAttachment* pAttachPt) : m_pAttachPt(pAttachPt) {}
diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp
index 98f868e88a..7f91124e98 100644
--- a/indra/newview/rlvlocks.cpp
+++ b/indra/newview/rlvlocks.cpp
@@ -923,7 +923,7 @@ void RlvWearableLocks::removeWearableTypeLock(LLWearableType::EType eType, const
 // RlvFolderLocks member functions
 //
 
-class RlvLockedDescendentsCollector : public LLInventoryCollectFunctor
+class RlvLockedDescendentsCollector final : public LLInventoryCollectFunctor
 {
 public:
 	RlvLockedDescendentsCollector(int eSourceTypeMask, RlvFolderLocks::ELockPermission ePermMask, ERlvLockMask eLockTypeMask) 
diff --git a/indra/newview/rlvlocks.h b/indra/newview/rlvlocks.h
index 0073e08ae5..88a6d9f722 100644
--- a/indra/newview/rlvlocks.h
+++ b/indra/newview/rlvlocks.h
@@ -202,7 +202,7 @@ protected:
 	typedef std::map<LLUUID, RlvWearInfo> rlv_wear_map_t;
 	rlv_wear_map_t m_PendingWear;
 
-	class RlvAttachmentLockWatchdogTimer : public LLEventTimer
+	class RlvAttachmentLockWatchdogTimer final : public LLEventTimer
 	{
 	public:
 		RlvAttachmentLockWatchdogTimer(RlvAttachmentLockWatchdog* pWatchdog) : LLEventTimer(10), m_pWatchdog(pWatchdog) {}
diff --git a/indra/newview/rlvmodifiers.h b/indra/newview/rlvmodifiers.h
index f11e43fdb2..91824ea690 100644
--- a/indra/newview/rlvmodifiers.h
+++ b/indra/newview/rlvmodifiers.h
@@ -25,7 +25,7 @@
 //
 
 template<ERlvBehaviourModifier eBhvrMod>
-class RlvBehaviourModifierHandler : public RlvBehaviourModifier
+class RlvBehaviourModifierHandler final : public RlvBehaviourModifier
 {
 public:
 	//using RlvBehaviourModifier::RlvBehaviourModifier; // Needs VS2015 and up
@@ -53,7 +53,7 @@ struct RlvBehaviourModifierComp
 	LLUUID m_idPrimaryObject;
 };
 
-struct RlvBehaviourModifierCompMin : public RlvBehaviourModifierComp
+struct RlvBehaviourModifierCompMin final : public RlvBehaviourModifierComp
 {
 	bool operator()(const RlvBehaviourModifierValueTuple& lhs, const RlvBehaviourModifierValueTuple& rhs) override
 	{
@@ -63,7 +63,7 @@ struct RlvBehaviourModifierCompMin : public RlvBehaviourModifierComp
 	}
 };
 
-struct RlvBehaviourModifierCompMax : public RlvBehaviourModifierComp
+struct RlvBehaviourModifierCompMax final : public RlvBehaviourModifierComp
 {
 	bool operator()(const RlvBehaviourModifierValueTuple& lhs, const RlvBehaviourModifierValueTuple& rhs) override
 	{
@@ -108,7 +108,7 @@ public:
 	 * Animation timer
 	 */
 protected:
-	class AnimationTimer : public LLEventTimer, public LLHandleProvider<AnimationTimer>
+	class AnimationTimer final : public LLEventTimer, public LLHandleProvider<AnimationTimer>
 	{
 	public:
 		AnimationTimer();
-- 
GitLab