diff options
| -rw-r--r-- | indra/newview/llstartup.h | 1 | ||||
| -rw-r--r-- | indra/newview/llstartuplistener.cpp | 26 | ||||
| -rw-r--r-- | indra/newview/llstartuplistener.h | 1 | 
3 files changed, 27 insertions, 1 deletions
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index d7d294e9f4..3ec3ff4133 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -128,6 +128,7 @@ public:  	static LLViewerStats::PhaseMap& getPhases() { return *sPhases; }  private: +	friend class LLStartupListener;  	static LLSLURL sStartSLURL;  	static std::string startupStateToString(EStartupState state); diff --git a/indra/newview/llstartuplistener.cpp b/indra/newview/llstartuplistener.cpp index d9a21f908e..5770b595d0 100644 --- a/indra/newview/llstartuplistener.cpp +++ b/indra/newview/llstartuplistener.cpp @@ -35,7 +35,7 @@  // external library headers  // other Linden headers  #include "llstartup.h" - +#include "stringize.h"  LLStartupListener::LLStartupListener(/* LLStartUp* instance */):      LLEventAPI("LLStartUp", "Access e.g. LLStartup::postStartupState()") /* , @@ -43,9 +43,33 @@ LLStartupListener::LLStartupListener(/* LLStartUp* instance */):  {      add("postStartupState", "Refresh \"StartupState\" listeners with current startup state",          &LLStartupListener::postStartupState); +    add("getStateTable", "Reply with array of EStartupState string names", +        &LLStartupListener::getStateTable);  }  void LLStartupListener::postStartupState(const LLSD&) const  {      LLStartUp::postStartupState();  } + +void LLStartupListener::getStateTable(const LLSD& event) const +{ +    Response response(LLSD(), event); + +    // This relies on our knowledge that STATE_STARTED is the very last +    // EStartupState value. If that ever stops being true, we're going to lie +    // without realizing it. I can think of no reliable way to test whether +    // the enum has been extended *beyond* STATE_STARTED. We could, of course, +    // test whether stuff has been inserted before it, by testing its +    // numerical value against the constant value as of the last time we +    // looked; but that's pointless, as values inserted before STATE_STARTED +    // will continue to work fine. The bad case is if new symbols get added +    // *after* it. +    LLSD table; +    // note <= comparison: we want to *include* STATE_STARTED. +    for (LLSD::Integer istate{0}; istate <= LLSD::Integer(STATE_STARTED); ++istate) +    { +        table.append(LLStartUp::startupStateToString(EStartupState(istate))); +    } +    response["table"] = table; +} diff --git a/indra/newview/llstartuplistener.h b/indra/newview/llstartuplistener.h index a35e11f6eb..0b4380a568 100644 --- a/indra/newview/llstartuplistener.h +++ b/indra/newview/llstartuplistener.h @@ -40,6 +40,7 @@ public:  private:      void postStartupState(const LLSD&) const; +    void getStateTable(const LLSD&) const;      //LLStartup* mStartup;  };  | 
