- Mar 25, 2020
-
-
Nat Goodspeed authored
-
Nat Goodspeed authored
Add a namespaced free function in .cpp file to report LL_ERRS as needed. Per code review, use a more indicative namespace name.
-
Nat Goodspeed authored
The pattern of requiring a lock to permit *any* access to a static instance of something seems generally useful. Break out lockstatic.h; recast LLInstanceTracker to use it. Moving LockStatic to an external template class instead of a nested class in LLInstanceTrackerBase leaves LLInstanceTrackerBase pretty empty. Get rid of it. And *that* means we can move the definition of the StaticData used by each LLInstanceTracker specialization into the class itself, rather than having to define it beforehand in namespace LLInstanceTrackerStuff.
-
Nat Goodspeed authored
-
Nat Goodspeed authored
-
Nat Goodspeed authored
The previous implementation went to some effort to crash if anyone attempted to create or destroy an LLInstanceTracker subclass instance during traversal. That restriction is manageable within a single thread, but becomes unworkable if it's possible that a given subclass might be used on more than one thread. Remove LLInstanceTracker::instance_iter, beginInstances(), endInstances(), also key_iter, beginKeys() and endKeys(). Instead, introduce key_snapshot() and instance_snapshot(), the only means of iterating over LLInstanceTracker instances. (These are intended to resemble functions, but in fact the current implementation simply presents the classes.) Iterating over a captured snapshot defends against container modifications during traversal. The term 'snapshot' reminds the coder that a new instance created during traversal will not be considered. To defend against instance deletion during traversal, a snapshot stores std::weak_ptrs which it lazily dereferences, skipping on the fly any that have expired. Dereferencing instance_snapshot::iterator gets you a reference rather than a pointer. Because some use cases want to delete all existing instances, add an instance_snapshot::deleteAll() method that extracts the pointer. Those cases used to require explicitly copying instance pointers into a separate container; instance_snapshot() now takes care of that. It remains the caller's responsibility to ensure that all instances of that LLInstanceTracker subclass were allocated on the heap. Replace unkeyed static LLInstanceTracker::getInstance(T*) -- which returned nullptr if that instance had been destroyed -- with new getWeak() method returning std::weak_ptr<T>. Caller must detect expiration of that weak_ptr. Adjust tests accordingly. Use of std::weak_ptr to detect expired instances requires engaging std::shared_ptr in the constructor. We now store shared_ptrs in the static containers (std::map for keyed, std::set for unkeyed). Make LLInstanceTrackerBase a template parameterized on the type of the static data it manages. For that reason, hoist static data class declarations out of the class definitions to an LLInstanceTrackerStuff namespace. Remove the static atomic sIterationNestDepth and its methods incrementDepth(), decrementDepth() and getDepth(), since they were used only to forbid creation and destruction during traversal. Add a std::mutex to static data. Introduce an internal LockStatic class that locks the mutex while providing a pointer to static data, making that the only way to access the static data. The LLINSTANCETRACKER_DTOR_NOEXCEPT macro goes away because we no longer expect ~LLInstanceTracker() to throw an exception in test programs. That affects LLTrace::StatBase as well as LLInstanceTracker itself. Adapt consumers to the new LLInstanceTracker API.
-
- Jan 15, 2019
-
-
andreykproductengine authored
-
- May 08, 2017
-
-
Nat Goodspeed authored
-
Nat Goodspeed authored
LLInstanceTracker<T> performs validation in ~LLInstanceTracker(). Normally validation failure logs an error and terminates the program, which is fine. In the test executable, though, we want validation failure to throw an exception instead so we can catch it and continue testing other failure conditions. But since destructors in C++11 are implicitly noexcept(true), that exception never made it out of ~LLInstanceTracker(): it crashed the test program instead. Declaring ~LLInstanceTracker() noexcept(false) solves that, allowing the test program to catch the exception and continue. However, if we unconditionally declare that, then every destructor anywhere in the inheritance hierarchy for any LLInstanceTracker subclass must also be noexcept(false)! That's way too pervasive, especially for functionality we only need (or want) in a specific test executable. Instead, make the CMake macros LL_ADD_PROJECT_UNIT_TESTS() and LL_ADD_INTEGRATION_TEST() -- with which we define all viewer build-time tests -- define two new command-line macros: LL_TEST=testname and LL_TEST_testname. That way, preprocessor logic in a header file can detect whether it's being compiled for production code or for a test executable. (While at it, encapsulate in a new GET_OPT_SOURCE_FILE_PROPERTY() CMake macro an ugly repetitive pattern. The builtin GET_SOURCE_FILE_PROPERTY() sets the target variable to "NOTFOUND" -- rather than an empty string -- if the specified property wasn't set. Every call to GET_SOURCE_FILE_PROPERTY() in LL_ADD_PROJECT_UNIT_TESTS() was followed by a test for NOTFOUND and an assignment to "". Wrap all that in a macro whose 'unset' value is "".) Now llinstancetracker.h can detect when we're building the LLInstanceTracker unit test executable, and *only then* declare ~LLInstanceTracker() as noexcept(false). We #define LLINSTANCETRACKER_DTOR_NOEXCEPT to expand either empty or noexcept(false), also detecting clang in C++11 mode. (It all works fine without noexcept(false) until we turn on C++11 mode.) We also use that macro for the StatBase class in lltrace.h. Turns out some of the infrastructure headers required for tests in general, including the LLInstanceTracker test, use LLInstanceTracker. Fortunately that appears to be the only other class we must annotate this way for the LLInstanceTracker tests.
-
- Nov 10, 2015
-
-
Oz Linden authored
-
- Apr 23, 2014
-
-
Graham Linden authored
-
- Apr 22, 2014
-
-
Graham Linden authored
Modify importer to (optionally) improve debug output, perform name-based LOD association, and handle models with many materials.
-
- Nov 20, 2013
-
-
Richard Linden authored
-
- Nov 19, 2013
-
-
Richard Linden authored
renamed fast timers to have unique names, changes instance tracker to never allow duplicates
-
- Oct 24, 2013
-
-
Richard Linden authored
SH-4577 WIP Interesting: viewer crashed when clicking a offline Conversation containing a shared object potential fix by making instance tracker allow key collisions for LLToastNotifyPanel changed assertion macro to use original unpreprocessed source code renamed instance tracker behavior macros to use LL prefix added RestoreCameraPosOnLogin setting to optionally restore old camera positioning behavior
-
- Oct 17, 2013
-
-
Richard Linden authored
fix for bad values returns from getPeriodMin and getPeriodMax on count stats when no counts recorded fix for gcc compile time error (typename ftw)
-
Richard Linden authored
added flag to LLInstanceTracker to allow multiple values per key made StatType allow multiple values per key to eliminate block timer related crash
-
- Aug 26, 2013
-
-
simon authored
-
- Aug 23, 2013
-
-
Graham Madarasz (Graham Linden) authored
MAINT-3046 make LLNotifications clear out vecs of LLNotificationChannelPtr so singleton cleanup doesn't do things it really ought not do
-
- Jul 30, 2013
-
-
Richard Linden authored
consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders
-
- Jul 18, 2013
-
-
Richard Linden authored
dependency cleanup - removed a lot of unecessary includes
-
- Apr 24, 2013
-
-
simon authored
-
- Apr 22, 2013
-
-
Richard Linden authored
added ExtendablePeriodicRecording and ability to append periodic recordings to each other
-
- Apr 19, 2013
-
-
Richard Linden authored
removed unused dll support from llinstancetracker as it didn't appear to be thread safe
-
- Apr 17, 2013
-
-
simon authored
-
- Mar 29, 2013
-
-
Graham Madarasz authored
-
- Mar 01, 2013
-
-
Graham Madarasz (Graham) authored
-
- Feb 28, 2013
-
-
Graham Madarasz (Graham) authored
-
- Dec 23, 2012
-
-
Richard Linden authored
fixed crash on exit by making LLInstanceTracker iterators use atomic iterator nesting count for thread safety
-
- Nov 01, 2012
-
-
Richard Linden authored
final removal of remaining LLStat code
-
- Feb 27, 2012
-
-
Nat Goodspeed authored
For the T* specialization (no string, or whatever, key), the original getInstance() method simply returned the passed-in T* value. It was defined, as the comments noted, for completeness of the analogy with the keyed LLInstanceTracker specialization. It turns out, though, that getInstance(T*) can still be useful to ask whether the T* you have in hand still references a valid T instance. Support that usage.
-
- Mar 30, 2012
-
-
Richard Linden authored
phase 2, removal of extraneous signaling in favor of llnotificationchannels made notificationchannels work better with overrides and lifetime managed by creator
-
- Oct 17, 2011
-
-
Richard Nelson authored
-
- Sep 07, 2011
-
-
Nat Goodspeed authored
Now that we have unit tests that require assertion failure if you try to delete an LLInstanceTracker subclass instance with an iterator loose, having llassert() "sometimes" compile away (whimsically, depending on platform as well as build type!) makes those tests fail. Use llassert_always() instead.
-
- Sep 06, 2011
-
-
Nat Goodspeed authored
Generalize the notion of getting some chunk of "static" storage: introduce LLInstanceTrackerBase::getStatic() template method. Define StaticData struct containing the InstanceMap (or InstanceSet, for that specialization) along with the S32 that caused the VS2010 linker so much grief. Completely eliminate that S32 as an actual class-static member, qualifying all references with the struct returned by getStatic(). In LLInstanceTrackerBase::getInstances(), use one std::map lookup instead of three.
-
- Aug 24, 2011
-
-
Nat Goodspeed authored
Fix LLInstanceTracker::key_iter constructor param; accepting InstanceMap::iterator by non-const reference relied on Microsoft extension that accepts non-const reference to an rvalue. Given typical iterator implementation, simply accept by value instead, which makes gcc happy too.
-
- Jul 27, 2011
-
-
Aaron Stone authored
-
Richard Nelson authored
-
Richard Nelson authored
-
Richard Nelson authored
-