diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2015-05-23 12:41:47 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2015-05-23 12:41:47 -0400 |
commit | 430263746424bd0a7c6647d25d9d1db5eca2e8c0 (patch) | |
tree | c8f94523e5ebcefa3fc578a76a947f5223c8be56 | |
parent | df3da846243cce973468b15d1f1752db2009d4ba (diff) |
MAINT-5232: Make gMessageSystem an LLPounceable<LLMessageSystem*>.
This will permit other subsystems to use gMessageSystem.callWhenReady() to (e.g.)
register callbacks as soon as gMessageSystem is fully initialized.
-rwxr-xr-x | indra/llmessage/message.cpp | 7 | ||||
-rwxr-xr-x | indra/llmessage/message.h | 3 | ||||
-rwxr-xr-x | indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp | 3 | ||||
-rwxr-xr-x | indra/llmessage/tests/lltrustedmessageservice_test.cpp | 3 | ||||
-rwxr-xr-x | indra/llui/tests/llurlentry_stub.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/tests/llremoteparcelrequest_test.cpp | 3 | ||||
-rwxr-xr-x | indra/test/message_tut.cpp | 2 |
7 files changed, 16 insertions, 8 deletions
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index e9ce94ab3b..3c3683f12a 100755 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -77,6 +77,7 @@ #include "v3math.h" #include "v4math.h" #include "lltransfertargetvfile.h" +#include "llpounceable.h" // Constants //const char* MESSAGE_LOG_FILENAME = "message.log"; @@ -1776,7 +1777,9 @@ std::ostream& operator<<(std::ostream& s, LLMessageSystem &msg) return s; } -LLMessageSystem *gMessageSystem = NULL; +// LLPounceable supports callWhenReady(), to permit clients to queue up (e.g.) +// callback registrations for when gMessageSystem is first assigned +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; // update appropriate ping info void process_complete_ping_check(LLMessageSystem *msgsystem, void** /*user_data*/) @@ -2693,7 +2696,7 @@ void end_messaging_system(bool print_summary) LL_INFOS("Messaging") << str.str().c_str() << LL_ENDL; } - delete gMessageSystem; + delete static_cast<LLMessageSystem*>(gMessageSystem); gMessageSystem = NULL; } } diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h index 348b09b992..a6fabf2126 100755 --- a/indra/llmessage/message.h +++ b/indra/llmessage/message.h @@ -60,6 +60,7 @@ #include "llmessagesenderinterface.h" #include "llstoredmessage.h" +#include "llpounceable.h" const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; @@ -830,7 +831,7 @@ private: // external hook into messaging system -extern LLMessageSystem *gMessageSystem; +extern LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; // Must specific overall system version, which is used to determine // if a patch is available in the message template checksum verification. diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp index 3b04530c1a..e20f61b73f 100755 --- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp +++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp @@ -31,11 +31,12 @@ #include "llhost.h" #include "message.h" #include "llsd.h" +#include "llpounceable.h" #include "llhost.cpp" // Needed for copy operator #include "net.cpp" // Needed by LLHost. -LLMessageSystem * gMessageSystem = NULL; +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; // sensor test doubles bool gClearRecvWasCalled = false; diff --git a/indra/llmessage/tests/lltrustedmessageservice_test.cpp b/indra/llmessage/tests/lltrustedmessageservice_test.cpp index 55748ad27e..41f982a7e2 100755 --- a/indra/llmessage/tests/lltrustedmessageservice_test.cpp +++ b/indra/llmessage/tests/lltrustedmessageservice_test.cpp @@ -33,8 +33,9 @@ #include "message.h" #include "llmessageconfig.h" #include "llhttpnode_stub.cpp" +#include "llpounceable.h" -LLMessageSystem* gMessageSystem = NULL; +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; LLMessageConfig::SenderTrust LLMessageConfig::getSenderTrustedness(const std::string& msg_name) diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 5d3f9ac327..d28f601009 100755 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -31,6 +31,7 @@ #include "llcachename.h" #include "lluuid.h" #include "message.h" +#include "llpounceable.h" #include <string> @@ -167,7 +168,7 @@ char const* const _PREHASH_AgentID = (char *)"AgentID"; LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS); -LLMessageSystem* gMessageSystem = NULL; +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; // // Stub implementation for LLMessageSystem diff --git a/indra/newview/tests/llremoteparcelrequest_test.cpp b/indra/newview/tests/llremoteparcelrequest_test.cpp index c49b0350e9..5e3649fdae 100755 --- a/indra/newview/tests/llremoteparcelrequest_test.cpp +++ b/indra/newview/tests/llremoteparcelrequest_test.cpp @@ -33,6 +33,7 @@ #include "../llagent.h" #include "message.h" #include "llurlentry.h" +#include "llpounceable.h" namespace { const LLUUID TEST_PARCEL_ID("11111111-1111-1111-1111-111111111111"); @@ -61,7 +62,7 @@ void LLMessageSystem::addUUID(char const *,LLUUID const &) { } void LLMessageSystem::addUUIDFast(char const *,LLUUID const &) { } void LLMessageSystem::nextBlockFast(char const *) { } void LLMessageSystem::newMessage(char const *) { } -LLMessageSystem * gMessageSystem; +LLPounceable<LLMessageSystem*, LLPounceableStatic> gMessageSystem; char const* const _PREHASH_AgentID = 0; // never dereferenced during this test char const* const _PREHASH_AgentData = 0; // never dereferenced during this test LLAgent gAgent; diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp index aa23699de0..b9c025f518 100755 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -103,7 +103,7 @@ namespace tut ~LLMessageSystemTestData() { // not end_messaging_system() - delete gMessageSystem; + delete static_cast<LLMessageSystem*>(gMessageSystem); gMessageSystem = NULL; // rm contents of temp dir |