diff options
author | Rider Linden <rider@lindenlab.com> | 2015-07-07 19:41:27 +0100 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-07-07 19:41:27 +0100 |
commit | 247eb0c9c3418c10be8f2a0e3c8116758efa702f (patch) | |
tree | d3a448c69f1ad241dc72662970d702c2aa618382 /indra | |
parent | d785ec312bb7f4e77517eb44f46f276ba0129677 (diff) |
Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5
Diffstat (limited to 'indra')
75 files changed, 947 insertions, 974 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index 2d0c419ae0..baaddcaed1 100755 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -34,65 +34,11 @@ // std headers // external library headers #include <boost/bind.hpp> -#include <boost/thread/tss.hpp> // other Linden headers #include "llevents.h" #include "llerror.h" #include "stringize.h" -namespace { - -// do nothing, when we need nothing done -void no_cleanup(LLCoros::coro::self*) {} - -// When the dcoroutine library calls a top-level callable, it implicitly -// passes coro::self& as the first parameter. All our consumer code used to -// explicitly pass coro::self& down through all levels of call stack, because -// at the leaf level we need it for context-switching. But since coroutines -// are based on cooperative switching, we can cause the top-level entry point -// to stash a static pointer to the currently-running coroutine, and manage it -// appropriately as we switch out and back in. That eliminates the need to -// pass it as an explicit parameter down through every level, which is -// unfortunately viral in nature. Finding it implicitly rather than explicitly -// allows minor maintenance in which a leaf-level function adds a new async -// I/O call that suspends the calling coroutine, WITHOUT having to propagate -// coro::self& through every function signature down to that point -- and of -// course through every other caller of every such function. -// We use a boost::thread_specific_ptr because each thread potentially has its -// own distinct pool of coroutines. -// This thread_specific_ptr does NOT own the 'self' object! It merely -// identifies it. For this reason we instantiate it with a no-op cleanup -// function. -static boost::thread_specific_ptr<LLCoros::coro::self> -sCurrentSelf(no_cleanup); - -} // anonymous - -//static -LLCoros::coro::self& LLCoros::get_self() -{ - coro::self* current_self = sCurrentSelf.get(); - if (! current_self) - { - LL_ERRS("LLCoros") << "Calling get_self() from non-coroutine context!" << LL_ENDL; - } - return *current_self; -} - -LLCoros::Suspending::Suspending(): - mSuspended(sCurrentSelf.get()) -{ - // For the duration of our time away from this coroutine, sCurrentSelf - // must NOT refer to this coroutine. - sCurrentSelf.reset(); -} - -LLCoros::Suspending::~Suspending() -{ - // Okay, we're back, reinstate previous value of sCurrentSelf. - sCurrentSelf.reset(mSuspended); -} - LLCoros::LLCoros(): // MAINT-2724: default coroutine stack size too small on Windows. // Previously we used @@ -114,7 +60,7 @@ bool LLCoros::cleanup(const LLSD&) // since last tick? if (mi->second->exited()) { - LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL; // The erase() call will invalidate its passed iterator value -- // so increment mi FIRST -- but pass its original value to // erase(). This is what postincrement is all about. @@ -148,7 +94,7 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const { if (mCoros.find(name) == mCoros.end()) { - LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; + LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL; return name; } } @@ -168,10 +114,10 @@ bool LLCoros::kill(const std::string& name) return true; } -std::string LLCoros::getName() const +std::string LLCoros::getNameByID(const void* self_id) const { - // Walk the existing coroutines, looking for the current one. - void* self_id = get_self().get_id(); + // Walk the existing coroutines, looking for one from which the 'self_id' + // passed to us comes. for (CoroMap::const_iterator mi(mCoros.begin()), mend(mCoros.end()); mi != mend; ++mi) { namespace coro_private = boost::dcoroutines::detail; @@ -190,24 +136,10 @@ void LLCoros::setStackSize(S32 stacksize) mStackSize = stacksize; } -namespace { - -// Top-level wrapper around caller's coroutine callable. This function accepts -// the coroutine library's implicit coro::self& parameter and sets sCurrentSelf -// but does not pass it down to the caller's callable. -void toplevel(LLCoros::coro::self& self, const LLCoros::callable_t& callable) -{ - sCurrentSelf.reset(&self); - callable(); - sCurrentSelf.reset(); -} - -} // anonymous - /***************************************************************************** * MUST BE LAST *****************************************************************************/ -// Turn off MSVC optimizations for just LLCoros::launch() -- see +// Turn off MSVC optimizations for just LLCoros::launchImpl() -- see // DEV-32777. But MSVC doesn't support push/pop for optimization flags as it // does for warning suppression, and we really don't want to force // optimization ON for other code even in Debug or RelWithDebInfo builds. @@ -218,13 +150,9 @@ void toplevel(LLCoros::coro::self& self, const LLCoros::callable_t& callable) #pragma optimize("", off) #endif // LL_MSVC -std::string LLCoros::launch(const std::string& prefix, const callable_t& callable) +std::string LLCoros::launchImpl(const std::string& prefix, coro* newCoro) { std::string name(generateDistinctName(prefix)); - // Wrap the caller's callable in our toplevel() function so we can manage - // sCurrentSelf appropriately at startup and shutdown of each coroutine. - coro* newCoro = new coro(boost::bind(toplevel, _1, callable), mStackSize); - // Store it in our pointer map mCoros.insert(name, newCoro); /* Run the coroutine until its first wait, then return here */ (*newCoro)(std::nothrow); diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index 3f58a17aa9..01ee11da1a 100755 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -32,8 +32,10 @@ #include <boost/dcoroutine/coroutine.hpp> #include "llsingleton.h" #include <boost/ptr_container/ptr_map.hpp> -#include <boost/function.hpp> #include <string> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/iteration/local.hpp> #include <stdexcept> /** @@ -78,8 +80,8 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros> public: /// Canonical boost::dcoroutines::coroutine signature we use typedef boost::dcoroutines::coroutine<void()> coro; - /// Canonical callable type - typedef boost::function<void()> callable_t; + /// Canonical 'self' type + typedef coro::self self; /** * Create and start running a new coroutine with specified name. The name @@ -92,33 +94,39 @@ public: * { * public: * ... - * // Do NOT NOT NOT accept reference params! + * // Do NOT NOT NOT accept reference params other than 'self'! * // Pass by value only! - * void myCoroutineMethod(std::string, LLSD); + * void myCoroutineMethod(LLCoros::self& self, std::string, LLSD); * ... * }; * ... * std::string name = LLCoros::instance().launch( - * "mycoro", boost::bind(&MyClass::myCoroutineMethod, this, + * "mycoro", boost::bind(&MyClass::myCoroutineMethod, this, _1, * "somestring", LLSD(17)); * @endcode * - * Your function/method can accept any parameters you want -- but ONLY BY - * VALUE! Reference parameters are a BAD IDEA! You Have Been Warned. See + * Your function/method must accept LLCoros::self& as its first parameter. + * It can accept any other parameters you want -- but ONLY BY VALUE! + * Other reference parameters are a BAD IDEA! You Have Been Warned. See * DEV-32777 comments for an explanation. * - * Pass a nullary callable. It works to directly pass a nullary free - * function (or static method); for all other cases use boost::bind(). Of - * course, for a non-static class method, the first parameter must be the - * class instance. Any other parameters should be passed via the bind() - * expression. + * Pass a callable that accepts the single LLCoros::self& parameter. It + * may work to pass a free function whose only parameter is 'self'; for + * all other cases use boost::bind(). Of course, for a non-static class + * method, the first parameter must be the class instance. Use the + * placeholder _1 for the 'self' parameter. Any other parameters should be + * passed via the bind() expression. * * launch() tweaks the suggested name so it won't collide with any * existing coroutine instance, creates the coroutine instance, registers * it with the tweaked name and runs it until its first wait. At that * point it returns the tweaked name. */ - std::string launch(const std::string& prefix, const callable_t& callable); + template <typename CALLABLE> + std::string launch(const std::string& prefix, const CALLABLE& callable) + { + return launchImpl(prefix, new coro(callable, mStackSize)); + } /** * Abort a running coroutine by name. Normally, when a coroutine either @@ -130,34 +138,27 @@ public: bool kill(const std::string& name); /** - * From within a coroutine, look up the (tweaked) name string by which - * this coroutine is registered. Returns the empty string if not found - * (e.g. if the coroutine was launched by hand rather than using - * LLCoros::launch()). + * From within a coroutine, pass its @c self object to look up the + * (tweaked) name string by which this coroutine is registered. Returns + * the empty string if not found (e.g. if the coroutine was launched by + * hand rather than using LLCoros::launch()). */ - std::string getName() const; - - /// get the current coro::self& for those who really really care - static coro::self& get_self(); - - /// Instantiate one of these in a block surrounding any leaf point when - /// control literally switches away from this coroutine. - class Suspending + template <typename COROUTINE_SELF> + std::string getName(const COROUTINE_SELF& self) const { - public: - Suspending(); - ~Suspending(); + return getNameByID(self.get_id()); + } - private: - coro::self* mSuspended; - }; + /// getName() by self.get_id() + std::string getNameByID(const void* self_id) const; /// for delayed initialization void setStackSize(S32 stacksize); private: - LLCoros(); friend class LLSingleton<LLCoros>; + LLCoros(); + std::string launchImpl(const std::string& prefix, coro* newCoro); std::string generateDistinctName(const std::string& prefix) const; bool cleanup(const LLSD&); diff --git a/indra/llcommon/lleventcoro.cpp b/indra/llcommon/lleventcoro.cpp index be93e9c83b..81cc33fbba 100755 --- a/indra/llcommon/lleventcoro.cpp +++ b/indra/llcommon/lleventcoro.cpp @@ -34,24 +34,33 @@ #include <map> // std headers // external library headers -#include <boost/dcoroutine/coroutine.hpp> -#include <boost/dcoroutine/future.hpp> // other Linden headers #include "llsdserialize.h" #include "llerror.h" #include "llcoros.h" -std::string LLEventDetail::listenerNameForCoro() +std::string LLEventDetail::listenerNameForCoroImpl(const void* self_id) { - // If this coroutine was launched by LLCoros::launch(), find that name. - std::string name(LLCoros::instance().getName()); + // First, if this coroutine was launched by LLCoros::launch(), find that name. + std::string name(LLCoros::instance().getNameByID(self_id)); if (! name.empty()) { return name; } + // Apparently this coroutine wasn't launched by LLCoros::launch(). Check + // whether we have a memo for this self_id. + typedef std::map<const void*, std::string> MapType; + static MapType memo; + MapType::const_iterator found = memo.find(self_id); + if (found != memo.end()) + { + // this coroutine instance has called us before, reuse same name + return found->second; + } // this is the first time we've been called for this coroutine instance name = LLEventPump::inventName("coro"); - LL_INFOS("LLEventCoro") << "listenerNameForCoro(): inventing coro name '" + memo[self_id] = name; + LL_INFOS("LLEventCoro") << "listenerNameForCoroImpl(" << self_id << "): inventing coro name '" << name << "'" << LL_ENDL; return name; } @@ -109,98 +118,6 @@ void LLEventDetail::storeToLLSDPath(LLSD& dest, const LLSD& rawPath, const LLSD& *pdest = value; } -LLSD postAndWait(const LLSD& event, const LLEventPumpOrPumpName& requestPump, - const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath) -{ - // declare the future - boost::dcoroutines::future<LLSD> future(LLCoros::get_self()); - // make a callback that will assign a value to the future, and listen on - // the specified LLEventPump with that callback - std::string listenerName(LLEventDetail::listenerNameForCoro()); - LLTempBoundListener connection( - replyPump.getPump().listen(listenerName, - voidlistener(boost::dcoroutines::make_callback(future)))); - // skip the "post" part if requestPump is default-constructed - if (requestPump) - { - // If replyPumpNamePath is non-empty, store the replyPump name in the - // request event. - LLSD modevent(event); - LLEventDetail::storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName()); - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " posting to " << requestPump.getPump().getName() - << LL_ENDL; - - // *NOTE:Mani - Removed because modevent could contain user's hashed passwd. - // << ": " << modevent << LL_ENDL; - requestPump.getPump().post(modevent); - } - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " about to wait on LLEventPump " << replyPump.getPump().getName() - << LL_ENDL; - // trying to dereference ("resolve") the future makes us wait for it - LLSD value; - { - // instantiate Suspending to manage the "current" coroutine - LLCoros::Suspending suspended; - value = *future; - } // destroy Suspending as soon as we're back - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName - << " resuming with " << value << LL_ENDL; - // returning should disconnect the connection - return value; -} - -LLEventWithID postAndWait2(const LLSD& event, - const LLEventPumpOrPumpName& requestPump, - const LLEventPumpOrPumpName& replyPump0, - const LLEventPumpOrPumpName& replyPump1, - const LLSD& replyPump0NamePath, - const LLSD& replyPump1NamePath) -{ - // declare the future - boost::dcoroutines::future<LLEventWithID> future(LLCoros::get_self()); - // either callback will assign a value to this future; listen on - // each specified LLEventPump with a callback - std::string name(LLEventDetail::listenerNameForCoro()); - LLTempBoundListener connection0( - replyPump0.getPump().listen(name + "a", - LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 0))); - LLTempBoundListener connection1( - replyPump1.getPump().listen(name + "b", - LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 1))); - // skip the "post" part if requestPump is default-constructed - if (requestPump) - { - // If either replyPumpNamePath is non-empty, store the corresponding - // replyPump name in the request event. - LLSD modevent(event); - LLEventDetail::storeToLLSDPath(modevent, replyPump0NamePath, - replyPump0.getPump().getName()); - LLEventDetail::storeToLLSDPath(modevent, replyPump1NamePath, - replyPump1.getPump().getName()); - LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - << " posting to " << requestPump.getPump().getName() - << ": " << modevent << LL_ENDL; - requestPump.getPump().post(modevent); - } - LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name - << " about to wait on LLEventPumps " << replyPump0.getPump().getName() - << ", " << replyPump1.getPump().getName() << LL_ENDL; - // trying to dereference ("resolve") the future makes us wait for it - LLEventWithID value; - { - // instantiate Suspending to manage "current" coroutine - LLCoros::Suspending suspended; - value = *future; - } // destroy Suspending as soon as we're back - LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name - << " resuming with (" << value.first << ", " << value.second << ")" - << LL_ENDL; - // returning should disconnect both connections - return value; -} - LLSD errorException(const LLEventWithID& result, const std::string& desc) { // If the result arrived on the error pump (pump 1), instead of diff --git a/indra/llcommon/lleventcoro.h b/indra/llcommon/lleventcoro.h index daf9360a2e..abbeeaa373 100755 --- a/indra/llcommon/lleventcoro.h +++ b/indra/llcommon/lleventcoro.h @@ -29,6 +29,8 @@ #if ! defined(LL_LLEVENTCORO_H) #define LL_LLEVENTCORO_H +#include <boost/dcoroutine/coroutine.hpp> +#include <boost/dcoroutine/future.hpp> #include <boost/optional.hpp> #include <string> #include <stdexcept> @@ -100,6 +102,9 @@ LLVoidListener<LISTENER> voidlistener(const LISTENER& listener) namespace LLEventDetail { + /// Implementation for listenerNameForCoro(), see below + LL_COMMON_API std::string listenerNameForCoroImpl(const void* self_id); + /** * waitForEventOn() permits a coroutine to temporarily listen on an * LLEventPump any number of times. We don't really want to have to ask @@ -111,9 +116,21 @@ namespace LLEventDetail * call waitForEventOn() any number of times, we don't really want to * consume an arbitrary number of generated inventName()s: that namespace, * though large, is nonetheless finite. So we memoize an invented name for - * each distinct coroutine instance. + * each distinct coroutine instance (each different 'self' object). We + * can't know the type of 'self', because it depends on the coroutine + * body's signature. So we cast its address to void*, looking for distinct + * pointer values. Yes, that means that an early coroutine could cache a + * value here, then be destroyed, only to be supplanted by a later + * coroutine (of the same or different type), and we'll end up + * "recognizing" the second one and reusing the listener name -- but + * that's okay, since it won't collide with any listener name used by the + * earlier coroutine since that earlier coroutine no longer exists. */ - std::string listenerNameForCoro(); + template <typename COROUTINE_SELF> + std::string listenerNameForCoro(COROUTINE_SELF& self) + { + return listenerNameForCoroImpl(self.get_id()); + } /** * Implement behavior described for postAndWait()'s @a replyPumpNamePath @@ -142,7 +159,7 @@ namespace LLEventDetail * convenience: the difference between this function and the sequence * @code * requestPump.post(myEvent); - * LLSD reply = waitForEventOn(replyPump); + * LLSD reply = waitForEventOn(self, replyPump); * @endcode * is that the sequence above fails if the reply is posted immediately on * @a replyPump, that is, before <tt>requestPump.post()</tt> returns. In the @@ -184,16 +201,51 @@ namespace LLEventDetail * @a replyPumpNamePath specifies the entry in the lowest-level structure in * @a event into which to store <tt>replyPump.getName()</tt>. */ -LLSD postAndWait(const LLSD& event, const LLEventPumpOrPumpName& requestPump, - const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD()); +template <typename SELF> +LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, + const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD()) +{ + // declare the future + boost::dcoroutines::future<LLSD> future(self); + // make a callback that will assign a value to the future, and listen on + // the specified LLEventPump with that callback + std::string listenerName(LLEventDetail::listenerNameForCoro(self)); + LLTempBoundListener connection( + replyPump.getPump().listen(listenerName, + voidlistener(boost::dcoroutines::make_callback(future)))); + // skip the "post" part if requestPump is default-constructed + if (requestPump) + { + // If replyPumpNamePath is non-empty, store the replyPump name in the + // request event. + LLSD modevent(event); + LLEventDetail::storeToLLSDPath(modevent, replyPumpNamePath, replyPump.getPump().getName()); + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " posting to " << requestPump.getPump().getName() + << LL_ENDL; + + // *NOTE:Mani - Removed because modevent could contain user's hashed passwd. + // << ": " << modevent << LL_ENDL; + requestPump.getPump().post(modevent); + } + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " about to wait on LLEventPump " << replyPump.getPump().getName() + << LL_ENDL; + // trying to dereference ("resolve") the future makes us wait for it + LLSD value(*future); + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << listenerName + << " resuming with " << value << LL_ENDL; + // returning should disconnect the connection + return value; +} /// Wait for the next event on the specified LLEventPump. Pass either the /// LLEventPump& or its string name. -inline -LLSD waitForEventOn(const LLEventPumpOrPumpName& pump) +template <typename SELF> +LLSD waitForEventOn(SELF& self, const LLEventPumpOrPumpName& pump) { // This is now a convenience wrapper for postAndWait(). - return postAndWait(LLSD(), LLEventPumpOrPumpName(), pump); + return postAndWait(self, LLSD(), LLEventPumpOrPumpName(), pump); } /// return type for two-pump variant of waitForEventOn() @@ -261,7 +313,7 @@ namespace LLEventDetail * I'd have preferred to overload the name postAndWait() for both signatures. * But consider the following ambiguous call: * @code - * postAndWait(LLSD(), requestPump, replyPump, "someString"); + * postAndWait(self, LLSD(), requestPump, replyPump, "someString"); * @endcode * "someString" could be converted to either LLSD (@a replyPumpNamePath for * the single-pump function) or LLEventOrPumpName (@a replyPump1 for two-pump @@ -270,29 +322,69 @@ namespace LLEventDetail * It seems less burdensome to write postAndWait2() than to write either * LLSD("someString") or LLEventOrPumpName("someString"). */ -LLEventWithID postAndWait2(const LLSD& event, +template <typename SELF> +LLEventWithID postAndWait2(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, const LLEventPumpOrPumpName& replyPump0, const LLEventPumpOrPumpName& replyPump1, const LLSD& replyPump0NamePath=LLSD(), - const LLSD& replyPump1NamePath=LLSD()); + const LLSD& replyPump1NamePath=LLSD()) +{ + // declare the future + boost::dcoroutines::future<LLEventWithID> future(self); + // either callback will assign a value to this future; listen on + // each specified LLEventPump with a callback + std::string name(LLEventDetail::listenerNameForCoro(self)); + LLTempBoundListener connection0( + replyPump0.getPump().listen(name + "a", + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 0))); + LLTempBoundListener connection1( + replyPump1.getPump().listen(name + "b", + LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 1))); + // skip the "post" part if requestPump is default-constructed + if (requestPump) + { + // If either replyPumpNamePath is non-empty, store the corresponding + // replyPump name in the request event. + LLSD modevent(event); + LLEventDetail::storeToLLSDPath(modevent, replyPump0NamePath, + replyPump0.getPump().getName()); + LLEventDetail::storeToLLSDPath(modevent, replyPump1NamePath, + replyPump1.getPump().getName()); + LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + << " posting to " << requestPump.getPump().getName() + << ": " << modevent << LL_ENDL; + requestPump.getPump().post(modevent); + } + LL_DEBUGS("lleventcoro") << "postAndWait2(): coroutine " << name + << " about to wait on LLEventPumps " << replyPump0.getPump().getName() + << ", " << replyPump1.getPump().getName() << LL_ENDL; + // trying to dereference ("resolve") the future makes us wait for it + LLEventWithID value(*future); + LL_DEBUGS("lleventcoro") << "postAndWait(): coroutine " << name + << " resuming with (" << value.first << ", " << value.second << ")" + << LL_ENDL; + // returning should disconnect both connections + return value; +} /** * Wait for the next event on either of two specified LLEventPumps. */ -inline +template <typename SELF> LLEventWithID -waitForEventOn(const LLEventPumpOrPumpName& pump0, const LLEventPumpOrPumpName& pump1) +waitForEventOn(SELF& self, + const LLEventPumpOrPumpName& pump0, const LLEventPumpOrPumpName& pump1) { // This is now a convenience wrapper for postAndWait2(). - return postAndWait2(LLSD(), LLEventPumpOrPumpName(), pump0, pump1); + return postAndWait2(self, LLSD(), LLEventPumpOrPumpName(), pump0, pump1); } /** * Helper for the two-pump variant of waitForEventOn(), e.g.: * * @code - * LLSD reply = errorException(waitForEventOn(replyPump, errorPump), + * LLSD reply = errorException(waitForEventOn(self, replyPump, errorPump), * "error response from login.cgi"); * @endcode * @@ -362,16 +454,26 @@ public: /** * Wait for an event on this LLEventPump. + * + * @note + * The other major usage pattern we considered was to bind @c self at + * LLCoroEventPump construction time, which would avoid passing the + * parameter to each wait() call. But if we were going to bind @c self as + * a class member, we'd need to specify a class template parameter + * indicating its type. The big advantage of passing it to the wait() call + * is that the type can be implicit. */ - LLSD wait() + template <typename SELF> + LLSD wait(SELF& self) { - return ::waitForEventOn(mPump); + return waitForEventOn(self, mPump); } - LLSD postAndWait(const LLSD& event, const LLEventPumpOrPumpName& requestPump, + template <typename SELF> + LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, const LLSD& replyPumpNamePath=LLSD()) { - return ::postAndWait(event, requestPump, mPump, replyPumpNamePath); + return ::postAndWait(self, event, requestPump, mPump, replyPumpNamePath); } private: @@ -407,49 +509,55 @@ public: /// request pump 1 LLEventPump& getPump1() { return mPump1; } - /// waitForEventOn(either of our two LLEventPumps) - LLEventWithID wait() + /// waitForEventOn(self, either of our two LLEventPumps) + template <typename SELF> + LLEventWithID wait(SELF& self) { - return waitForEventOn(mPump0, mPump1); + return waitForEventOn(self, mPump0, mPump1); } - /// errorException(wait()) - LLSD waitWithException() + /// errorException(wait(self)) + template <typename SELF> + LLSD waitWithException(SELF& self) { - return errorException(wait(), std::string("Error event on ") + getName1()); + return errorException(wait(self), std::string("Error event on ") + getName1()); } - /// errorLog(wait()) - LLSD waitWithLog() + /// errorLog(wait(self)) + template <typename SELF> + LLSD waitWithLog(SELF& self) { - return errorLog(wait(), std::string("Error event on ") + getName1()); + return errorLog(wait(self), std::string("Error event on ") + getName1()); } - LLEventWithID postAndWait(const LLSD& event, + template <typename SELF> + LLEventWithID postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, const LLSD& replyPump0NamePath=LLSD(), const LLSD& replyPump1NamePath=LLSD()) { - return postAndWait2(event, requestPump, mPump0, mPump1, + return postAndWait2(self, event, requestPump, mPump0, mPump1, replyPump0NamePath, replyPump1NamePath); } - LLSD postAndWaitWithException(const LLSD& event, + template <typename SELF> + LLSD postAndWaitWithException(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, const LLSD& replyPump0NamePath=LLSD(), const LLSD& replyPump1NamePath=LLSD()) { - return errorException(postAndWait(event, requestPump, + return errorException(postAndWait(self, event, requestPump, replyPump0NamePath, replyPump1NamePath), std::string("Error event on ") + getName1()); } - LLSD postAndWaitWithLog(const LLSD& event, + template <typename SELF> + LLSD postAndWaitWithLog(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& requestPump, const LLSD& replyPump0NamePath=LLSD(), const LLSD& replyPump1NamePath=LLSD()) { - return errorLog(postAndWait(event, requestPump, + return errorLog(postAndWait(self, event, requestPump, replyPump0NamePath, replyPump1NamePath), std::string("Error event on ") + getName1()); } diff --git a/indra/llcommon/tests/lleventcoro_test.cpp b/indra/llcommon/tests/lleventcoro_test.cpp index da927038ab..2096807e53 100755 --- a/indra/llcommon/tests/lleventcoro_test.cpp +++ b/indra/llcommon/tests/lleventcoro_test.cpp @@ -82,7 +82,6 @@ #include "llevents.h" #include "tests/wrapllerrs.h" #include "stringize.h" -#include "llcoros.h" #include "lleventcoro.h" #include "../test/debug.h" @@ -122,6 +121,9 @@ typedef coroutine<std::string::iterator(void)> match_coroutine_type; /***************************************************************************** * Test helpers *****************************************************************************/ +// I suspect this will be typical of coroutines used in Linden software +typedef boost::dcoroutines::coroutine<void()> coroutine_type; + /// Simulate an event API whose response is immediate: sent on receipt of the /// initial request, rather than after some delay. This is the case that /// distinguishes postAndWait() from calling post(), then calling @@ -160,7 +162,306 @@ private: *****************************************************************************/ namespace tut { - struct coroutine_data {}; + struct coroutine_data + { + // Define coroutine bodies as methods here so they can use ensure*() + + void explicit_wait(coroutine_type::self& self) + { + BEGIN + { + // ... do whatever preliminary stuff must happen ... + + // declare the future + boost::dcoroutines::future<LLSD> future(self); + // tell the future what to wait for + LLTempBoundListener connection( + LLEventPumps::instance().obtain("source").listen("coro", voidlistener(boost::dcoroutines::make_callback(future)))); + ensure("Not yet", ! future); + // attempting to dereference ("resolve") the future causes the calling + // coroutine to wait for it + debug("about to wait"); + result = *future; + ensure("Got it", future); + } + END + } + + void waitForEventOn1(coroutine_type::self& self) + { + BEGIN + { + result = waitForEventOn(self, "source"); + } + END + } + + void waitForEventOn2(coroutine_type::self& self) + { + BEGIN + { + LLEventWithID pair = waitForEventOn(self, "reply", "error"); + result = pair.first; + which = pair.second; + debug(STRINGIZE("result = " << result << ", which = " << which)); + } + END + } + + void postAndWait1(coroutine_type::self& self) + { + BEGIN + { + result = postAndWait(self, + LLSDMap("value", 17), // request event + immediateAPI.getPump(), // requestPump + "reply1", // replyPump + "reply"); // request["reply"] = name + } + END + } + + void postAndWait2(coroutine_type::self& self) + { + BEGIN + { + LLEventWithID pair = ::postAndWait2(self, + LLSDMap("value", 18), + immediateAPI.getPump(), + "reply2", + "error2", + "reply", + "error"); + result = pair.first; + which = pair.second; + debug(STRINGIZE("result = " << result << ", which = " << which)); + } + END + } + + void postAndWait2_1(coroutine_type::self& self) + { + BEGIN + { + LLEventWithID pair = ::postAndWait2(self, + LLSDMap("value", 18)("fail", LLSD()), + immediateAPI.getPump(), + "reply2", + "error2", + "reply", + "error"); + result = pair.first; + which = pair.second; + debug(STRINGIZE("result = " << result << ", which = " << which)); + } + END + } + + void coroPump(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPump waiter; + replyName = waiter.getName(); + result = waiter.wait(self); + } + END + } + + void coroPumpPost(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPump waiter; + result = waiter.postAndWait(self, LLSDMap("value", 17), + immediateAPI.getPump(), "reply"); + } + END + } + + void coroPumps(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + replyName = waiter.getName0(); + errorName = waiter.getName1(); + LLEventWithID pair(waiter.wait(self)); + result = pair.first; + which = pair.second; + } + END + } + + void coroPumpsNoEx(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + replyName = waiter.getName0(); + errorName = waiter.getName1(); + result = waiter.waitWithException(self); + } + END + } + + void coroPumpsEx(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + replyName = waiter.getName0(); + errorName = waiter.getName1(); + try + { + result = waiter.waitWithException(self); + debug("no exception"); + } + catch (const LLErrorEvent& e) + { + debug(STRINGIZE("exception " << e.what())); + errordata = e.getData(); + } + } + END + } + + void coroPumpsNoLog(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + replyName = waiter.getName0(); + errorName = waiter.getName1(); + result = waiter.waitWithLog(self); + } + END + } + + void coroPumpsLog(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + replyName = waiter.getName0(); + errorName = waiter.getName1(); + WrapLLErrs capture; + try + { + result = waiter.waitWithLog(self); + debug("no exception"); + } + catch (const WrapLLErrs::FatalException& e) + { + debug(STRINGIZE("exception " << e.what())); + threw = e.what(); + } + } + END + } + + void coroPumpsPost(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + LLEventWithID pair(waiter.postAndWait(self, LLSDMap("value", 23), + immediateAPI.getPump(), "reply", "error")); + result = pair.first; + which = pair.second; + } + END + } + + void coroPumpsPost_1(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + LLEventWithID pair( + waiter.postAndWait(self, LLSDMap("value", 23)("fail", LLSD()), + immediateAPI.getPump(), "reply", "error")); + result = pair.first; + which = pair.second; + } + END + } + + void coroPumpsPostNoEx(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + result = waiter.postAndWaitWithException(self, LLSDMap("value", 8), + immediateAPI.getPump(), "reply", "error"); + } + END + } + + void coroPumpsPostEx(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + try + { + result = waiter.postAndWaitWithException(self, + LLSDMap("value", 9)("fail", LLSD()), + immediateAPI.getPump(), "reply", "error"); + debug("no exception"); + } + catch (const LLErrorEvent& e) + { + debug(STRINGIZE("exception " << e.what())); + errordata = e.getData(); + } + } + END + } + + void coroPumpsPostNoLog(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + result = waiter.postAndWaitWithLog(self, LLSDMap("value", 30), + immediateAPI.getPump(), "reply", "error"); + } + END + } + + void coroPumpsPostLog(coroutine_type::self& self) + { + BEGIN + { + LLCoroEventPumps waiter; + WrapLLErrs capture; + try + { + result = waiter.postAndWaitWithLog(self, + LLSDMap("value", 31)("fail", LLSD()), + immediateAPI.getPump(), "reply", "error"); + debug("no exception"); + } + catch (const WrapLLErrs::FatalException& e) + { + debug(STRINGIZE("exception " << e.what())); + threw = e.what(); + } + } + END + } + + void ensure_done(coroutine_type& coro) + { + ensure("coroutine complete", ! coro); + } + + ImmediateAPI immediateAPI; + std::string replyName, errorName, threw; + LLSD result, errordata; + int which; + }; typedef test_group<coroutine_data> coroutine_group; typedef coroutine_group::object object; coroutine_group coroutinegrp("coroutine"); @@ -210,57 +511,16 @@ namespace tut ensure("done", ! matcher); } - // use static data so we can intersperse coroutine functions with the - // tests that engage them - ImmediateAPI immediateAPI; - std::string replyName, errorName, threw; - LLSD result, errordata; - int which; - - // reinit vars at the start of each test - void clear() - { - replyName.clear(); - errorName.clear(); - threw.clear(); - result = LLSD(); - errordata = LLSD(); - which = 0; - } - - void explicit_wait(boost::dcoroutines::coroutine<void()>::self& self) - { - BEGIN - { - // ... do whatever preliminary stuff must happen ... - - // declare the future - boost::dcoroutines::future<LLSD> future(self); - // tell the future what to wait for - LLTempBoundListener connection( - LLEventPumps::instance().obtain("source").listen("coro", voidlistener(boost::dcoroutines::make_callback(future)))); - ensure("Not yet", ! future); - // attempting to dereference ("resolve") the future causes the calling - // coroutine to wait for it - debug("about to wait"); - result = *future; - ensure("Got it", future); - } - END - } - template<> template<> void object::test<2>() { - clear(); set_test_name("explicit_wait"); DEBUG; // Construct the coroutine instance that will run explicit_wait. // Pass the ctor a callable that accepts the coroutine_type::self // param passed by the library. - boost::dcoroutines::coroutine<void()> - coro(explicit_wait); + coroutine_type coro(boost::bind(&coroutine_data::explicit_wait, this, _1)); // Start the coroutine coro(std::nothrow); // When the coroutine waits for the event pump, it returns here. @@ -268,56 +528,37 @@ namespace tut // Satisfy the wait. LLEventPumps::instance().obtain("source").post("received"); // Now wait for the coroutine to complete. - ensure("coroutine complete", ! coro); + ensure_done(coro); // ensure the coroutine ran and woke up again with the intended result ensure_equals(result.asString(), "received"); } - void waitForEventOn1() - { - BEGIN - { - result = waitForEventOn("source"); - } - END - } - template<> template<> void object::test<3>() { - clear(); set_test_name("waitForEventOn1"); DEBUG; - LLCoros::instance().launch("test<3>", waitForEventOn1); + coroutine_type coro(boost::bind(&coroutine_data::waitForEventOn1, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain("source").post("received"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "received"); } - void waitForEventOn2() - { - BEGIN - { - LLEventWithID pair = waitForEventOn("reply", "error"); - result = pair.first; - which = pair.second; - debug(STRINGIZE("result = " << result << ", which = " << which)); - } - END - } - template<> template<> void object::test<4>() { - clear(); set_test_name("waitForEventOn2 reply"); { DEBUG; - LLCoros::instance().launch("test<4>", waitForEventOn2); + coroutine_type coro(boost::bind(&coroutine_data::waitForEventOn2, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain("reply").post("received"); debug("back from send"); + ensure_done(coro); } ensure_equals(result.asString(), "received"); ensure_equals("which pump", which, 0); @@ -326,65 +567,43 @@ namespace tut template<> template<> void object::test<5>() { - clear(); set_test_name("waitForEventOn2 error"); DEBUG; - LLCoros::instance().launch("test<5>", waitForEventOn2); + coroutine_type coro(boost::bind(&coroutine_data::waitForEventOn2, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain("error").post("badness"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "badness"); ensure_equals("which pump", which, 1); } - void coroPump() - { - BEGIN - { - LLCoroEventPump waiter; - replyName = waiter.getName(); - result = waiter.wait(); - } - END - } - template<> template<> void object::test<6>() { - clear(); set_test_name("coroPump"); DEBUG; - LLCoros::instance().launch("test<6>", coroPump); + coroutine_type coro(boost::bind(&coroutine_data::coroPump, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(replyName).post("received"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "received"); } - void coroPumps() - { - BEGIN - { - LLCoroEventPumps waiter; - replyName = waiter.getName0(); - errorName = waiter.getName1(); - LLEventWithID pair(waiter.wait()); - result = pair.first; - which = pair.second; - } - END - } - template<> template<> void object::test<7>() { - clear(); set_test_name("coroPumps reply"); DEBUG; - LLCoros::instance().launch("test<7>", coroPumps); + coroutine_type coro(boost::bind(&coroutine_data::coroPumps, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(replyName).post("received"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "received"); ensure_equals("which pump", which, 0); } @@ -392,389 +611,188 @@ namespace tut template<> template<> void object::test<8>() { - clear(); set_test_name("coroPumps error"); DEBUG; - LLCoros::instance().launch("test<8>", coroPumps); + coroutine_type coro(boost::bind(&coroutine_data::coroPumps, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(errorName).post("badness"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "badness"); ensure_equals("which pump", which, 1); } - void coroPumpsNoEx() - { - BEGIN - { - LLCoroEventPumps waiter; - replyName = waiter.getName0(); - errorName = waiter.getName1(); - result = waiter.waitWithException(); - } - END - } - template<> template<> void object::test<9>() { - clear(); set_test_name("coroPumpsNoEx"); DEBUG; - LLCoros::instance().launch("test<9>", coroPumpsNoEx); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsNoEx, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(replyName).post("received"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "received"); } - void coroPumpsEx() - { - BEGIN - { - LLCoroEventPumps waiter; - replyName = waiter.getName0(); - errorName = waiter.getName1(); - try - { - result = waiter.waitWithException(); - debug("no exception"); - } - catch (const LLErrorEvent& e) - { - debug(STRINGIZE("exception " << e.what())); - errordata = e.getData(); - } - } - END - } - template<> template<> void object::test<10>() { - clear(); set_test_name("coroPumpsEx"); DEBUG; - LLCoros::instance().launch("test<10>", coroPumpsEx); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsEx, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(errorName).post("badness"); debug("back from send"); + ensure_done(coro); ensure("no result", result.isUndefined()); ensure_equals("got error", errordata.asString(), "badness"); } - void coroPumpsNoLog() - { - BEGIN - { - LLCoroEventPumps waiter; - replyName = waiter.getName0(); - errorName = waiter.getName1(); - result = waiter.waitWithLog(); - } - END - } - template<> template<> void object::test<11>() { - clear(); set_test_name("coroPumpsNoLog"); DEBUG; - LLCoros::instance().launch("test<11>", coroPumpsNoLog); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsNoLog, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(replyName).post("received"); debug("back from send"); + ensure_done(coro); ensure_equals(result.asString(), "received"); } - void coroPumpsLog() - { - BEGIN - { - LLCoroEventPumps waiter; - replyName = waiter.getName0(); - errorName = waiter.getName1(); - WrapLLErrs capture; - try - { - result = waiter.waitWithLog(); - debug("no exception"); - } - catch (const WrapLLErrs::FatalException& e) - { - debug(STRINGIZE("exception " << e.what())); - threw = e.what(); - } - } - END - } - template<> template<> void object::test<12>() { - clear(); set_test_name("coroPumpsLog"); DEBUG; - LLCoros::instance().launch("test<12>", coroPumpsLog); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsLog, this, _1)); + coro(std::nothrow); debug("about to send"); LLEventPumps::instance().obtain(errorName).post("badness"); debug("back from send"); + ensure_done(coro); ensure("no result", result.isUndefined()); ensure_contains("got error", threw, "badness"); } - void postAndWait1() - { - BEGIN - { - result = postAndWait(LLSDMap("value", 17), // request event - immediateAPI.getPump(), // requestPump - "reply1", // replyPump - "reply"); // request["reply"] = name - } - END - } - template<> template<> void object::test<13>() { - clear(); set_test_name("postAndWait1"); DEBUG; - LLCoros::instance().launch("test<13>", postAndWait1); + coroutine_type coro(boost::bind(&coroutine_data::postAndWait1, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 18); } - void postAndWait2() - { - BEGIN - { - LLEventWithID pair = ::postAndWait2(LLSDMap("value", 18), - immediateAPI.getPump(), - "reply2", - "error2", - "reply", - "error"); - result = pair.first; - which = pair.second; - debug(STRINGIZE("result = " << result << ", which = " << which)); - } - END - } - template<> template<> void object::test<14>() { - clear(); set_test_name("postAndWait2"); DEBUG; - LLCoros::instance().launch("test<14>", postAndWait2); + coroutine_type coro(boost::bind(&coroutine_data::postAndWait2, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 19); ensure_equals(which, 0); } - void postAndWait2_1() - { - BEGIN - { - LLEventWithID pair = ::postAndWait2(LLSDMap("value", 18)("fail", LLSD()), - immediateAPI.getPump(), - "reply2", - "error2", - "reply", - "error"); - result = pair.first; - which = pair.second; - debug(STRINGIZE("result = " << result << ", which = " << which)); - } - END - } - template<> template<> void object::test<15>() { - clear(); set_test_name("postAndWait2_1"); DEBUG; - LLCoros::instance().launch("test<15>", postAndWait2_1); + coroutine_type coro(boost::bind(&coroutine_data::postAndWait2_1, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 19); ensure_equals(which, 1); } - void coroPumpPost() - { - BEGIN - { - LLCoroEventPump waiter; - result = waiter.postAndWait(LLSDMap("value", 17), - immediateAPI.getPump(), "reply"); - } - END - } - template<> template<> void object::test<16>() { - clear(); set_test_name("coroPumpPost"); DEBUG; - LLCoros::instance().launch("test<16>", coroPumpPost); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpPost, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 18); } - void coroPumpsPost() - { - BEGIN - { - LLCoroEventPumps waiter; - LLEventWithID pair(waiter.postAndWait(LLSDMap("value", 23), - immediateAPI.getPump(), "reply", "error")); - result = pair.first; - which = pair.second; - } - END - } - template<> template<> void object::test<17>() { - clear(); set_test_name("coroPumpsPost reply"); DEBUG; - LLCoros::instance().launch("test<17>", coroPumpsPost); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPost, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 24); ensure_equals("which pump", which, 0); } - void coroPumpsPost_1() - { - BEGIN - { - LLCoroEventPumps waiter; - LLEventWithID pair( - waiter.postAndWait(LLSDMap("value", 23)("fail", LLSD()), - immediateAPI.getPump(), "reply", "error")); - result = pair.first; - which = pair.second; - } - END - } - template<> template<> void object::test<18>() { - clear(); set_test_name("coroPumpsPost error"); DEBUG; - LLCoros::instance().launch("test<18>", coroPumpsPost_1); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPost_1, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 24); ensure_equals("which pump", which, 1); } - void coroPumpsPostNoEx() - { - BEGIN - { - LLCoroEventPumps waiter; - result = waiter.postAndWaitWithException(LLSDMap("value", 8), - immediateAPI.getPump(), "reply", "error"); - } - END - } - template<> template<> void object::test<19>() { - clear(); set_test_name("coroPumpsPostNoEx"); DEBUG; - LLCoros::instance().launch("test<19>", coroPumpsPostNoEx); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPostNoEx, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 9); } - void coroPumpsPostEx() - { - BEGIN - { - LLCoroEventPumps waiter; - try - { - result = waiter.postAndWaitWithException( - LLSDMap("value", 9)("fail", LLSD()), - immediateAPI.getPump(), "reply", "error"); - debug("no exception"); - } - catch (const LLErrorEvent& e) - { - debug(STRINGIZE("exception " << e.what())); - errordata = e.getData(); - } - } - END - } - template<> template<> void object::test<20>() { - clear(); set_test_name("coroPumpsPostEx"); DEBUG; - LLCoros::instance().launch("test<20>", coroPumpsPostEx); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPostEx, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure("no result", result.isUndefined()); ensure_equals("got error", errordata.asInteger(), 10); } - void coroPumpsPostNoLog() - { - BEGIN - { - LLCoroEventPumps waiter; - result = waiter.postAndWaitWithLog(LLSDMap("value", 30), - immediateAPI.getPump(), "reply", "error"); - } - END - } - template<> template<> void object::test<21>() { - clear(); set_test_name("coroPumpsPostNoLog"); DEBUG; - LLCoros::instance().launch("test<21>", coroPumpsPostNoLog); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPostNoLog, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure_equals(result.asInteger(), 31); } - void coroPumpsPostLog() - { - BEGIN - { - LLCoroEventPumps waiter; - WrapLLErrs capture; - try - { - result = waiter.postAndWaitWithLog( - LLSDMap("value", 31)("fail", LLSD()), - immediateAPI.getPump(), "reply", "error"); - debug("no exception"); - } - catch (const WrapLLErrs::FatalException& e) - { - debug(STRINGIZE("exception " << e.what())); - threw = e.what(); - } - } - END - } - template<> template<> void object::test<22>() { - clear(); set_test_name("coroPumpsPostLog"); DEBUG; - LLCoros::instance().launch("test<22>", coroPumpsPostLog); + coroutine_type coro(boost::bind(&coroutine_data::coroPumpsPostLog, this, _1)); + coro(std::nothrow); + ensure_done(coro); ensure("no result", result.isUndefined()); ensure_contains("got error", threw, "32"); } diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index ba6e9d3939..49f825d8f8 100755 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -256,8 +256,8 @@ if (LL_TESTS) ${LLMESSAGE_LIBRARIES} ${LLCOREHTTP_LIBRARIES} ${JSONCPP_LIBRARIES} - ${BOOST_COROUTINE_LIBRARY} ${BOOST_CONTEXT_LIBRARY} + ${BOOST_COROUTINE_LIBRARY} ${GOOGLEMOCK_LIBRARIES} ) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index d262862c80..7014048021 100755 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -137,8 +137,8 @@ namespace LLAvatarNameCache bool expirationFromCacheControl(const LLSD& headers, F64 *expires); - // This is a coroutine. - void requestAvatarNameCache_(std::string url, std::vector<LLUUID> agentIds); + // This is a coroutine. The only parameter that can be specified as a reference is the self + void requestAvatarNameCache_(LLCoros::self& self, std::string url, std::vector<LLUUID> agentIds); void handleAvNameCacheSuccess(const LLSD &data, const LLSD &httpResult); } @@ -185,9 +185,9 @@ namespace LLAvatarNameCache // Coroutine for sending and processing avatar name cache requests. // Do not call directly. See documentation in lleventcoro.h and llcoro.h for // further explanation. -void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLUUID> agentIds) +void LLAvatarNameCache::requestAvatarNameCache_(LLCoros::self& self, std::string url, std::vector<LLUUID> agentIds) { - LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName() + LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName(self) << " with url '" << url << "', requesting " << agentIds.size() << " Agent Ids" << LL_ENDL; try @@ -195,7 +195,7 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector<LLU bool success = true; LLCoreHttpUtil::HttpCoroutineAdapter httpAdapter("NameCache", LLAvatarNameCache::sHttpPolicy); - LLSD results = httpAdapter.getAndYield(sHttpRequest, url); + LLSD results = httpAdapter.getAndYield(self, sHttpRequest, url); LLSD httpResults; LL_DEBUGS() << results << LL_ENDL; @@ -401,7 +401,7 @@ void LLAvatarNameCache::requestNamesViaCapability() std::string coroname = LLCoros::instance().launch("LLAvatarNameCache::requestAvatarNameCache_", - boost::bind(&LLAvatarNameCache::requestAvatarNameCache_, url, agent_ids)); + boost::bind(&LLAvatarNameCache::requestAvatarNameCache_, _1, url, agent_ids)); LL_DEBUGS("AvNameCache") << coroname << " with url '" << url << "', agent_ids.size()=" << agent_ids.size() << LL_ENDL; } diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index ac1c2f8e58..4ec01aa405 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -565,17 +565,17 @@ HttpCoroutineAdapter::~HttpCoroutineAdapter() cancelYieldingOperation(); } -LLSD HttpCoroutineAdapter::postAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return postAndYield_(request, url, body, options, headers, httpHandler); + return postAndYield_(self, request, url, body, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::postAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) @@ -596,35 +596,35 @@ LLSD HttpCoroutineAdapter::postAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); return results; } -LLSD HttpCoroutineAdapter::postAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return postAndYield_(request, url, rawbody, options, headers, httpHandler); + return postAndYield_(self, request, url, rawbody, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::postRawAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::postRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroRawHandler(replyPump)); - return postAndYield_(request, url, rawbody, options, headers, httpHandler); + return postAndYield_(self, request, url, rawbody, options, headers, httpHandler); } // *TODO: This functionality could be moved into the LLCore::Http library itself // by having the CURL layer read the file directly. -LLSD HttpCoroutineAdapter::postFileAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, std::string fileName, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { @@ -648,12 +648,12 @@ LLSD HttpCoroutineAdapter::postFileAndYield(LLCore::HttpRequest::ptr_t request, } } - return postAndYield(request, url, fileData, options, headers); + return postAndYield(self, request, url, fileData, options, headers); } // *TODO: This functionality could be moved into the LLCore::Http library itself // by having the CURL layer read the file directly. -LLSD HttpCoroutineAdapter::postFileAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { @@ -673,11 +673,11 @@ LLSD HttpCoroutineAdapter::postFileAndYield(LLCore::HttpRequest::ptr_t request, delete[] fileBuffer; } - return postAndYield(request, url, fileData, options, headers); + return postAndYield(self, request, url, fileData, options, headers); } -LLSD HttpCoroutineAdapter::postAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) @@ -697,24 +697,24 @@ LLSD HttpCoroutineAdapter::postAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; } -LLSD HttpCoroutineAdapter::putAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::putAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return putAndYield_(request, url, body, options, headers, httpHandler); + return putAndYield_(self, request, url, body, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::putAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::putAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) @@ -735,43 +735,43 @@ LLSD HttpCoroutineAdapter::putAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; } -LLSD HttpCoroutineAdapter::getAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getRawAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroRawHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getJsonAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getJsonAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroJSONHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) @@ -790,24 +790,24 @@ LLSD HttpCoroutineAdapter::getAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; } -LLSD HttpCoroutineAdapter::deleteAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::deleteAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return deleteAndYield_(request, url, options, headers, httpHandler); + return deleteAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::deleteAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) { @@ -825,7 +825,7 @@ LLSD HttpCoroutineAdapter::deleteAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; @@ -907,7 +907,7 @@ LLCore::HttpStatus HttpCoroutineAdapter::getStatusFromLLSD(const LLSD &httpResul void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoros::instance().launch("HttpCoroutineAdapter::genericGetCoro", - boost::bind(&HttpCoroutineAdapter::trivialGetCoro, url, policyId, success, failure)); + boost::bind(&HttpCoroutineAdapter::trivialGetCoro, _1, url, policyId, success, failure)); } /*static*/ @@ -921,7 +921,7 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str } /*static*/ -void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) +void HttpCoroutineAdapter::trivialGetCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId)); @@ -932,7 +932,7 @@ void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest:: LL_INFOS("HttpCoroutineAdapter", "genericGetCoro") << "Generic GET for " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url, httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -957,7 +957,7 @@ void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest:: void HttpCoroutineAdapter::callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success, completionCallback_t failure) { LLCoros::instance().launch("HttpCoroutineAdapter::genericPostCoro", - boost::bind(&HttpCoroutineAdapter::trivialPostCoro, url, policyId, postData, success, failure)); + boost::bind(&HttpCoroutineAdapter::trivialPostCoro, _1, url, policyId, postData, success, failure)); } /*static*/ @@ -972,7 +972,7 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p } /*static*/ -void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) +void HttpCoroutineAdapter::trivialPostCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", policyId)); @@ -983,7 +983,7 @@ void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest: LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index cf35177e48..7dd161d1cd 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -320,67 +320,67 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD postAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { - return postAndYield(request, url, body, + return postAndYield(self, request, url, body, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { - return postAndYield(request, url, rawbody, + return postAndYield(self, request, url, rawbody, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postRawAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postRawAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { - return postRawAndYield(request, url, rawbody, + return postRawAndYield(self, request, url, rawbody, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, std::string fileName, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, std::string fileName, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndYield(request, url, fileName, + return postFileAndYield(self, request, url, fileName, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndYield(request, url, assetId, assetType, + return postFileAndYield(self, request, url, assetId, assetType, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } @@ -390,7 +390,7 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD putAndYield(LLCore::HttpRequest::ptr_t request, + LLSD putAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); @@ -400,38 +400,38 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD getAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getAndYield(request, url, + return getAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD getRawAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getRawAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getRawAndYield(request, url, + return getRawAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD getJsonAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getJsonAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getJsonndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getJsonndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getJsonAndYield(request, url, + return getJsonAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } @@ -442,7 +442,7 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD deleteAndYield(LLCore::HttpRequest::ptr_t request, + LLSD deleteAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); @@ -486,31 +486,31 @@ private: HttpCoroHandler::ptr_t &handler); void cleanState(); - LLSD postAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD postAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD putAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD putAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD getAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD deleteAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - static void trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); - static void trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure); + static void trivialGetCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); + static void trivialPostCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure); void checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers); diff --git a/indra/newview/llaccountingcostmanager.cpp b/indra/newview/llaccountingcostmanager.cpp index cd9146ea16..f928c84ecb 100755 --- a/indra/newview/llaccountingcostmanager.cpp +++ b/indra/newview/llaccountingcostmanager.cpp @@ -45,10 +45,10 @@ LLAccountingCostManager::LLAccountingCostManager(): // Coroutine for sending and processing avatar name cache requests. // Do not call directly. See documentation in lleventcoro.h and llcoro.h for // further explanation. -void LLAccountingCostManager::accountingCostCoro(std::string url, +void LLAccountingCostManager::accountingCostCoro(LLCoros::self& self, std::string url, eSelectionType selectionType, const LLHandle<LLAccountingCostObserver> observerHandle) { - LL_DEBUGS("LLAccountingCostManager") << "Entering coroutine " << LLCoros::instance().getName() + LL_DEBUGS("LLAccountingCostManager") << "Entering coroutine " << LLCoros::instance().getName(self) << " with url '" << url << LL_ENDL; try @@ -101,7 +101,7 @@ void LLAccountingCostManager::accountingCostCoro(std::string url, LLCoreHttpUtil::HttpCoroutineAdapter httpAdapter("AccountingCost", mHttpPolicy); - LLSD results = httpAdapter.postAndYield(mHttpRequest, url, dataToPost); + LLSD results = httpAdapter.postAndYield(self, mHttpRequest, url, dataToPost); LLSD httpResults; httpResults = results["http_result"]; @@ -181,7 +181,7 @@ void LLAccountingCostManager::fetchCosts( eSelectionType selectionType, { std::string coroname = LLCoros::instance().launch("LLAccountingCostManager::accountingCostCoro", - boost::bind(&LLAccountingCostManager::accountingCostCoro, this, url, selectionType, observer_handle)); + boost::bind(&LLAccountingCostManager::accountingCostCoro, this, _1, url, selectionType, observer_handle)); LL_DEBUGS() << coroname << " with url '" << url << LL_ENDL; } diff --git a/indra/newview/llaccountingcostmanager.h b/indra/newview/llaccountingcostmanager.h index d5a94f6fda..34748894e3 100755 --- a/indra/newview/llaccountingcostmanager.h +++ b/indra/newview/llaccountingcostmanager.h @@ -77,7 +77,7 @@ private: std::set<LLUUID> mPendingObjectQuota; typedef std::set<LLUUID>::iterator IDIt; - void accountingCostCoro(std::string url, eSelectionType selectionType, const LLHandle<LLAccountingCostObserver> observerHandle); + void accountingCostCoro(LLCoros::self& self, std::string url, eSelectionType selectionType, const LLHandle<LLAccountingCostObserver> observerHandle); LLCore::HttpRequest::ptr_t mHttpRequest; LLCore::HttpRequest::policy_t mHttpPolicy; diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index e260142254..73b2ecfd36 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -60,14 +60,14 @@ LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer; //LLCore::HttpRequest::ptr_t LLAvatarRenderInfoAccountant::sHttpRequest; //========================================================================= -void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64 regionHandle) +void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(LLCoros::self& self, std::string url, U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("AvatarRenderInfoAccountant", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); if (!regionp) @@ -130,7 +130,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro(std::string url, U64 } //------------------------------------------------------------------------- -void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U64 regionHandle) +void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(LLCoros::self& self, std::string url, U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -190,7 +190,7 @@ void LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro(std::string url, U report[KEY_AGENTS] = agents; regionp = NULL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, report); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, report); regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); if (!regionp) @@ -239,7 +239,7 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio { std::string coroname = LLCoros::instance().launch("LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro", - boost::bind(&LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro, url, regionp->getHandle())); + boost::bind(&LLAvatarRenderInfoAccountant::avatarRenderInfoReportCoro, _1, url, regionp->getHandle())); } } @@ -264,7 +264,7 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi // First send a request to get the latest data std::string coroname = LLCoros::instance().launch("LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro", - boost::bind(&LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro, url, regionp->getHandle())); + boost::bind(&LLAvatarRenderInfoAccountant::avatarRenderInfoGetCoro, _1, url, regionp->getHandle())); } } diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h index f7a04cca2c..1736f03772 100644 --- a/indra/newview/llavatarrenderinfoaccountant.h +++ b/indra/newview/llavatarrenderinfoaccountant.h @@ -56,8 +56,8 @@ private: // Send data updates about once per minute, only need per-frame resolution static LLFrameTimer sRenderInfoReportTimer; - static void avatarRenderInfoGetCoro(std::string url, U64 regionHandle); - static void avatarRenderInfoReportCoro(std::string url, U64 regionHandle); + static void avatarRenderInfoGetCoro(LLCoros::self& self, std::string url, U64 regionHandle); + static void avatarRenderInfoReportCoro(LLCoros::self& self, std::string url, U64 regionHandle); }; diff --git a/indra/newview/llcoproceduremanager.cpp b/indra/newview/llcoproceduremanager.cpp index 1a4a906f35..3ecb323cab 100644 --- a/indra/newview/llcoproceduremanager.cpp +++ b/indra/newview/llcoproceduremanager.cpp @@ -54,7 +54,7 @@ LLCoprocedureManager::LLCoprocedureManager(): new LLCoreHttpUtil::HttpCoroutineAdapter("uploadPostAdapter", mHTTPPolicy)); std::string uploadCoro = LLCoros::instance().launch("LLCoprocedureManager::coprocedureInvokerCoro", - boost::bind(&LLCoprocedureManager::coprocedureInvokerCoro, this, httpAdapter)); + boost::bind(&LLCoprocedureManager::coprocedureInvokerCoro, this, _1, httpAdapter)); mCoroMapping.insert(CoroAdapterMap_t::value_type(uploadCoro, httpAdapter)); } @@ -132,13 +132,13 @@ void LLCoprocedureManager::cancelCoprocedure(const LLUUID &id) } //========================================================================= -void LLCoprocedureManager::coprocedureInvokerCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter) +void LLCoprocedureManager::coprocedureInvokerCoro(LLCoros::self& self, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter) { LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); while (!mShutdown) { - waitForEventOn(mWakeupTrigger); + waitForEventOn(self, mWakeupTrigger); if (mShutdown) break; @@ -152,7 +152,7 @@ void LLCoprocedureManager::coprocedureInvokerCoro(LLCoreHttpUtil::HttpCoroutineA try { - coproc->mProc(httpAdapter, coproc->mId); + coproc->mProc(self, httpAdapter, coproc->mId); } catch (std::exception &e) { diff --git a/indra/newview/llcoproceduremanager.h b/indra/newview/llcoproceduremanager.h index 6ba3891e87..4e971d42e3 100644 --- a/indra/newview/llcoproceduremanager.h +++ b/indra/newview/llcoproceduremanager.h @@ -36,7 +36,7 @@ class LLCoprocedureManager : public LLSingleton < LLCoprocedureManager > { public: - typedef boost::function<void(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, const LLUUID &id)> CoProcedure_t; + typedef boost::function<void(LLCoros::self &, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, const LLUUID &id)> CoProcedure_t; LLCoprocedureManager(); virtual ~LLCoprocedureManager(); @@ -111,7 +111,7 @@ private: CoroAdapterMap_t mCoroMapping; - void coprocedureInvokerCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter); + void coprocedureInvokerCoro(LLCoros::self& self, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter); }; #endif diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index 884d1579e6..04d0dda7ac 100755 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -123,12 +123,12 @@ bool LLEstateInfoModel::commitEstateInfoCaps() } LLCoros::instance().launch("LLEstateInfoModel::commitEstateInfoCapsCoro", - boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, url)); + boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, _1, url)); return true; } -void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) +void LLEstateInfoModel::commitEstateInfoCapsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -153,7 +153,7 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) << ", sun_hour = " << getSunHour() << LL_ENDL; LL_DEBUGS() << body << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, body); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, body); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h index fcfbd1ce7d..2deae7e322 100755 --- a/indra/newview/llestateinfomodel.h +++ b/indra/newview/llestateinfomodel.h @@ -101,7 +101,7 @@ private: update_signal_t mUpdateSignal; /// emitted when we receive update from sim update_signal_t mCommitSignal; /// emitted when our update gets applied to sim - void commitEstateInfoCapsCoro(std::string url); + void commitEstateInfoCapsCoro(LLCoros::self& self, std::string url); }; inline bool LLEstateInfoModel::getFlag(U64 flag) const diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 54da226209..03a380f2f6 100755 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -61,7 +61,7 @@ namespace Details static const F32 EVENT_POLL_ERROR_RETRY_SECONDS_INC; static const S32 MAX_EVENT_POLL_HTTP_ERRORS; - void eventPollCoro(std::string url); + void eventPollCoro(LLCoros::self& self, std::string url); void handleMessage(const LLSD &content); @@ -113,7 +113,7 @@ namespace Details { std::string coroname = LLCoros::instance().launch("LLEventPollImpl::eventPollCoro", - boost::bind(&LLEventPollImpl::eventPollCoro, this, url)); + boost::bind(&LLEventPollImpl::eventPollCoro, this, _1, url)); LL_INFOS("LLEventPollImpl") << coroname << " with url '" << url << LL_ENDL; } } @@ -131,7 +131,7 @@ namespace Details } } - void LLEventPollImpl::eventPollCoro(std::string url) + void LLEventPollImpl::eventPollCoro(LLCoros::self& self, std::string url) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EventPoller", mHttpPolicy)); LLSD acknowledge; @@ -154,7 +154,7 @@ namespace Details // << LLSDXMLStreamer(request) << LL_ENDL; LL_DEBUGS("LLEventPollImpl") << " <" << counter << "> posting and yielding." << LL_ENDL; - LLSD result = httpAdapter->postAndYield(mHttpRequest, url, request); + LLSD result = httpAdapter->postAndYield(self, mHttpRequest, url, request); // LL_DEBUGS("LLEventPollImpl::eventPollCoro") << "<" << counter << "> result = " // << LLSDXMLStreamer(result) << LL_ENDL; @@ -197,7 +197,7 @@ namespace Details " seconds, error count is now " << errorCount << LL_ENDL; timeout.eventAfter(waitToRetry, LLSD()); - waitForEventOn(timeout); + waitForEventOn(self, timeout); if (mDone) break; diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp index 136e02953c..87d7aacda1 100755 --- a/indra/newview/llfacebookconnect.cpp +++ b/indra/newview/llfacebookconnect.cpp @@ -144,7 +144,7 @@ LLFacebookConnectHandler gFacebookConnectHandler; /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string authState) +void LLFacebookConnect::facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -167,7 +167,7 @@ void LLFacebookConnect::facebookConnectCoro(std::string authCode, std::string au setConnectionState(LLFacebookConnect::FB_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); + LLSD result = httpAdapter->putAndYield(self, httpRequest, getFacebookConnectURL("/connection"), putData, httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -231,7 +231,7 @@ bool LLFacebookConnect::testShareStatus(LLSD &result) return false; } -void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) +void LLFacebookConnect::facebookShareCoro(LLCoros::self& self, std::string route, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -244,7 +244,7 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), share, httpOpts, get_headers()); if (testShareStatus(result)) { @@ -254,7 +254,7 @@ void LLFacebookConnect::facebookShareCoro(std::string route, LLSD share) } } -void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer<LLImageFormatted> image, std::string caption) +void LLFacebookConnect::facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer<LLImageFormatted> image, std::string caption) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -311,7 +311,7 @@ void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer<LLIm setConnectionState(LLFacebookConnect::FB_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFacebookConnectURL(route, true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -323,7 +323,7 @@ void LLFacebookConnect::facebookShareImageCoro(std::string route, LLPointer<LLIm /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookDisconnectCoro() +void LLFacebookConnect::facebookDisconnectCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -334,7 +334,7 @@ void LLFacebookConnect::facebookDisconnectCoro() setConnectionState(LLFacebookConnect::FB_DISCONNECTING); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFacebookConnectURL("/connection"), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -358,7 +358,7 @@ void LLFacebookConnect::facebookDisconnectCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) +void LLFacebookConnect::facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -370,7 +370,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/connection", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -407,7 +407,7 @@ void LLFacebookConnect::facebookConnectedCheckCoro(bool autoConnect) /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectInfoCoro() +void LLFacebookConnect::facebookConnectInfoCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -418,7 +418,7 @@ void LLFacebookConnect::facebookConnectInfoCoro() httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/info", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -451,7 +451,7 @@ void LLFacebookConnect::facebookConnectInfoCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLFacebookConnect::facebookConnectFriendsCoro() +void LLFacebookConnect::facebookConnectFriendsCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -461,7 +461,7 @@ void LLFacebookConnect::facebookConnectFriendsCoro() httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFacebookConnectURL("/friends", true), httpOpts, get_headers()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -547,19 +547,19 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const std::string& auth_state) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectCoro", - boost::bind(&LLFacebookConnect::facebookConnectCoro, this, auth_code, auth_state)); + boost::bind(&LLFacebookConnect::facebookConnectCoro, this, _1, auth_code, auth_state)); } void LLFacebookConnect::disconnectFromFacebook() { LLCoros::instance().launch("LLFacebookConnect::facebookDisconnectCoro", - boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this)); + boost::bind(&LLFacebookConnect::facebookDisconnectCoro, this, _1)); } void LLFacebookConnect::checkConnectionToFacebook(bool auto_connect) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectedCheckCoro", - boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, auto_connect)); + boost::bind(&LLFacebookConnect::facebookConnectedCheckCoro, this, _1, auto_connect)); } void LLFacebookConnect::loadFacebookInfo() @@ -567,7 +567,7 @@ void LLFacebookConnect::loadFacebookInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectInfoCoro", - boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this)); + boost::bind(&LLFacebookConnect::facebookConnectInfoCoro, this, _1)); } } @@ -576,7 +576,7 @@ void LLFacebookConnect::loadFacebookFriends() if(mRefreshContent) { LLCoros::instance().launch("LLFacebookConnect::facebookConnectFriendsCoro", - boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this)); + boost::bind(&LLFacebookConnect::facebookConnectFriendsCoro, this, _1)); } } @@ -606,7 +606,7 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri } LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/checkin", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/checkin", body)); } void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::string& caption) @@ -617,13 +617,13 @@ void LLFacebookConnect::sharePhoto(const std::string& image_url, const std::stri body["caption"] = caption; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/photo", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/photo", body)); } void LLFacebookConnect::sharePhoto(LLPointer<LLImageFormatted> image, const std::string& caption) { LLCoros::instance().launch("LLFacebookConnect::facebookShareImageCoro", - boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, "/share/photo", image, caption)); + boost::bind(&LLFacebookConnect::facebookShareImageCoro, this, _1, "/share/photo", image, caption)); } void LLFacebookConnect::updateStatus(const std::string& message) @@ -632,7 +632,7 @@ void LLFacebookConnect::updateStatus(const std::string& message) body["message"] = message; LLCoros::instance().launch("LLFacebookConnect::facebookShareCoro", - boost::bind(&LLFacebookConnect::facebookShareCoro, this, "/share/wall", body)); + boost::bind(&LLFacebookConnect::facebookShareCoro, this, _1, "/share/wall", body)); } void LLFacebookConnect::storeInfo(const LLSD& info) diff --git a/indra/newview/llfacebookconnect.h b/indra/newview/llfacebookconnect.h index 2a2cdb5499..f569c2f486 100644 --- a/indra/newview/llfacebookconnect.h +++ b/indra/newview/llfacebookconnect.h @@ -105,13 +105,13 @@ private: static boost::scoped_ptr<LLEventPump> sContentWatcher; bool testShareStatus(LLSD &results); - void facebookConnectCoro(std::string authCode, std::string authState); - void facebookConnectedCheckCoro(bool autoConnect); - void facebookDisconnectCoro(); - void facebookShareCoro(std::string route, LLSD share); - void facebookShareImageCoro(std::string route, LLPointer<LLImageFormatted> image, std::string caption); - void facebookConnectInfoCoro(); - void facebookConnectFriendsCoro(); + void facebookConnectCoro(LLCoros::self& self, std::string authCode, std::string authState); + void facebookConnectedCheckCoro(LLCoros::self& self, bool autoConnect); + void facebookDisconnectCoro(LLCoros::self& self); + void facebookShareCoro(LLCoros::self& self, std::string route, LLSD share); + void facebookShareImageCoro(LLCoros::self& self, std::string route, LLPointer<LLImageFormatted> image, std::string caption); + void facebookConnectInfoCoro(LLCoros::self& self); + void facebookConnectFriendsCoro(LLCoros::self& self); }; #endif // LL_LLFACEBOOKCONNECT_H diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 0b76ca16a9..9a714ac962 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -492,7 +492,7 @@ bool LLFeatureManager::loadGPUClass() return true; // indicates that a gpu value was established } -void LLFeatureManager::fetchFeatureTableCoro(std::string tableName) +void LLFeatureManager::fetchFeatureTableCoro(LLCoros::self& self, std::string tableName) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -526,7 +526,7 @@ void LLFeatureManager::fetchFeatureTableCoro(std::string tableName) LL_INFOS() << "LLFeatureManager fetching " << url << " into " << path << LL_ENDL; - LLSD result = httpAdapter->getRawAndYield(httpRequest, url); + LLSD result = httpAdapter->getRawAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -553,7 +553,7 @@ void LLFeatureManager::fetchFeatureTableCoro(std::string tableName) void LLFeatureManager::fetchHTTPTables() { LLCoros::instance().launch("LLFeatureManager::fetchFeatureTableCoro", - boost::bind(&LLFeatureManager::fetchFeatureTableCoro, this, FEATURE_TABLE_VER_FILENAME)); + boost::bind(&LLFeatureManager::fetchFeatureTableCoro, this, _1, FEATURE_TABLE_VER_FILENAME)); } void LLFeatureManager::cleanupFeatureTables() diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 12ea691b49..1490c2122c 100755 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -166,7 +166,7 @@ protected: void initBaseMask(); - void fetchFeatureTableCoro(std::string name); + void fetchFeatureTableCoro(LLCoros::self& self, std::string name); std::map<std::string, LLFeatureList *> mMaskList; std::set<std::string> mSkippedFeatures; diff --git a/indra/newview/llflickrconnect.cpp b/indra/newview/llflickrconnect.cpp index 83e4f19191..873b1a7138 100644 --- a/indra/newview/llflickrconnect.cpp +++ b/indra/newview/llflickrconnect.cpp @@ -67,7 +67,7 @@ void toast_user_for_flickr_success() /////////////////////////////////////////////////////////////////////////////// // -void LLFlickrConnect::flickrConnectCoro(std::string requestToken, std::string oauthVerifier) +void LLFlickrConnect::flickrConnectCoro(LLCoros::self& self, std::string requestToken, std::string oauthVerifier) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -86,7 +86,7 @@ void LLFlickrConnect::flickrConnectCoro(std::string requestToken, std::string oa setConnectionState(LLFlickrConnect::FLICKR_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(httpRequest, getFlickrConnectURL("/connection"), body, httpOpts); + LLSD result = httpAdapter->putAndYield(self, httpRequest, getFlickrConnectURL("/connection"), body, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -157,7 +157,7 @@ bool LLFlickrConnect::testShareStatus(LLSD &result) return false; } -void LLFlickrConnect::flickrShareCoro(LLSD share) +void LLFlickrConnect::flickrShareCoro(LLCoros::self& self, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -170,7 +170,7 @@ void LLFlickrConnect::flickrShareCoro(LLSD share) setConnectionState(LLFlickrConnect::FLICKR_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getFlickrConnectURL("/share/photo", true), share, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFlickrConnectURL("/share/photo", true), share, httpOpts); if (testShareStatus(result)) { @@ -181,7 +181,7 @@ void LLFlickrConnect::flickrShareCoro(LLSD share) } -void LLFlickrConnect::flickrShareImageCoro(LLPointer<LLImageFormatted> image, std::string title, std::string description, std::string tags, int safetyLevel) +void LLFlickrConnect::flickrShareImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string title, std::string description, std::string tags, int safetyLevel) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -248,7 +248,7 @@ void LLFlickrConnect::flickrShareImageCoro(LLPointer<LLImageFormatted> image, st body << "\r\n--" << boundary << "--\r\n"; - LLSD result = httpAdapter->postAndYield(httpRequest, getFlickrConnectURL("/share/photo", true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getFlickrConnectURL("/share/photo", true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -260,7 +260,7 @@ void LLFlickrConnect::flickrShareImageCoro(LLPointer<LLImageFormatted> image, st /////////////////////////////////////////////////////////////////////////////// // -void LLFlickrConnect::flickrDisconnectCoro() +void LLFlickrConnect::flickrDisconnectCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -271,7 +271,7 @@ void LLFlickrConnect::flickrDisconnectCoro() setConnectionState(LLFlickrConnect::FLICKR_DISCONNECTING); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->deleteAndYield(httpRequest, getFlickrConnectURL("/connection"), httpOpts); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getFlickrConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -294,7 +294,7 @@ void LLFlickrConnect::flickrDisconnectCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLFlickrConnect::flickrConnectedCoro(bool autoConnect) +void LLFlickrConnect::flickrConnectedCoro(LLCoros::self& self, bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -306,7 +306,7 @@ void LLFlickrConnect::flickrConnectedCoro(bool autoConnect) httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFlickrConnectURL("/connection", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/connection", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -344,7 +344,7 @@ void LLFlickrConnect::flickrConnectedCoro(bool autoConnect) /////////////////////////////////////////////////////////////////////////////// // -void LLFlickrConnect::flickrInfoCoro() +void LLFlickrConnect::flickrInfoCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -355,7 +355,7 @@ void LLFlickrConnect::flickrInfoCoro() httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getFlickrConnectURL("/info", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getFlickrConnectURL("/info", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -438,19 +438,19 @@ std::string LLFlickrConnect::getFlickrConnectURL(const std::string& route, bool void LLFlickrConnect::connectToFlickr(const std::string& request_token, const std::string& oauth_verifier) { LLCoros::instance().launch("LLFlickrConnect::flickrConnectCoro", - boost::bind(&LLFlickrConnect::flickrConnectCoro, this, request_token, oauth_verifier)); + boost::bind(&LLFlickrConnect::flickrConnectCoro, this, _1, request_token, oauth_verifier)); } void LLFlickrConnect::disconnectFromFlickr() { LLCoros::instance().launch("LLFlickrConnect::flickrDisconnectCoro", - boost::bind(&LLFlickrConnect::flickrDisconnectCoro, this)); + boost::bind(&LLFlickrConnect::flickrDisconnectCoro, this, _1)); } void LLFlickrConnect::checkConnectionToFlickr(bool auto_connect) { LLCoros::instance().launch("LLFlickrConnect::flickrConnectedCoro", - boost::bind(&LLFlickrConnect::flickrConnectedCoro, this, auto_connect)); + boost::bind(&LLFlickrConnect::flickrConnectedCoro, this, _1, auto_connect)); } void LLFlickrConnect::loadFlickrInfo() @@ -458,7 +458,7 @@ void LLFlickrConnect::loadFlickrInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLFlickrConnect::flickrInfoCoro", - boost::bind(&LLFlickrConnect::flickrInfoCoro, this)); + boost::bind(&LLFlickrConnect::flickrInfoCoro, this, _1)); } } @@ -472,14 +472,14 @@ void LLFlickrConnect::uploadPhoto(const std::string& image_url, const std::strin body["safety_level"] = safety_level; LLCoros::instance().launch("LLFlickrConnect::flickrShareCoro", - boost::bind(&LLFlickrConnect::flickrShareCoro, this, body)); + boost::bind(&LLFlickrConnect::flickrShareCoro, this, _1, body)); } void LLFlickrConnect::uploadPhoto(LLPointer<LLImageFormatted> image, const std::string& title, const std::string& description, const std::string& tags, int safety_level) { LLCoros::instance().launch("LLFlickrConnect::flickrShareImageCoro", - boost::bind(&LLFlickrConnect::flickrShareImageCoro, this, image, + boost::bind(&LLFlickrConnect::flickrShareImageCoro, this, _1, image, title, description, tags, safety_level)); } diff --git a/indra/newview/llflickrconnect.h b/indra/newview/llflickrconnect.h index 0155804da0..26c63f8b08 100644 --- a/indra/newview/llflickrconnect.h +++ b/indra/newview/llflickrconnect.h @@ -97,12 +97,12 @@ private: static boost::scoped_ptr<LLEventPump> sContentWatcher; bool testShareStatus(LLSD &result); - void flickrConnectCoro(std::string requestToken, std::string oauthVerifier); - void flickrShareCoro(LLSD share); - void flickrShareImageCoro(LLPointer<LLImageFormatted> image, std::string title, std::string description, std::string tags, int safetyLevel); - void flickrDisconnectCoro(); - void flickrConnectedCoro(bool autoConnect); - void flickrInfoCoro(); + void flickrConnectCoro(LLCoros::self& self, std::string requestToken, std::string oauthVerifier); + void flickrShareCoro(LLCoros::self& self, LLSD share); + void flickrShareImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string title, std::string description, std::string tags, int safetyLevel); + void flickrDisconnectCoro(LLCoros::self& self); + void flickrConnectedCoro(LLCoros::self& self, bool autoConnect); + void flickrInfoCoro(LLCoros::self& self); }; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 2824038f77..e5e9a794a4 100755 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -457,7 +457,7 @@ BOOL LLFloaterAvatarPicker::visibleItemsSelected() const } /*static*/ -void LLFloaterAvatarPicker::findCoro(std::string url, LLUUID queryID, std::string name) +void LLFloaterAvatarPicker::findCoro(LLCoros::self& self, std::string url, LLUUID queryID, std::string name) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -466,7 +466,7 @@ void LLFloaterAvatarPicker::findCoro(std::string url, LLUUID queryID, std::strin LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -513,7 +513,7 @@ void LLFloaterAvatarPicker::find() LL_INFOS() << "avatar picker " << url << LL_ENDL; LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro", - boost::bind(&LLFloaterAvatarPicker::findCoro, url, mQueryID, getKey().asString())); + boost::bind(&LLFloaterAvatarPicker::findCoro, _1, url, mQueryID, getKey().asString())); } else { diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index fbee61b054..200f74278e 100755 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -86,7 +86,7 @@ private: void populateFriend(); BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected. - static void findCoro(std::string url, LLUUID mQueryID, std::string mName); + static void findCoro(LLCoros::self& self, std::string url, LLUUID mQueryID, std::string mName); void find(); void setAllowMultiple(BOOL allow_multiple); LLScrollListCtrl* getActiveList(); diff --git a/indra/newview/llfloatermodeluploadbase.cpp b/indra/newview/llfloatermodeluploadbase.cpp index e2f84fd990..aa91a2ce03 100755 --- a/indra/newview/llfloatermodeluploadbase.cpp +++ b/indra/newview/llfloatermodeluploadbase.cpp @@ -49,7 +49,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissions() << "::requestAgentUploadPermissions() requesting for upload model permissions from: " << url << LL_ENDL; LLCoros::instance().launch("LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro", - boost::bind(&LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro, this, url, getPermObserverHandle())); + boost::bind(&LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro, this, _1, url, getPermObserverHandle())); } else { @@ -61,7 +61,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissions() } } -void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(std::string url, +void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(LLCoros::self& self, std::string url, LLHandle<LLUploadPermissionsObserver> observerHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -70,7 +70,7 @@ void LLFloaterModelUploadBase::requestAgentUploadPermissionsCoro(std::string url LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llfloatermodeluploadbase.h b/indra/newview/llfloatermodeluploadbase.h index 0d4c834122..9bb9959af0 100755 --- a/indra/newview/llfloatermodeluploadbase.h +++ b/indra/newview/llfloatermodeluploadbase.h @@ -56,7 +56,7 @@ protected: // requests agent's permissions to upload model void requestAgentUploadPermissions(); - void requestAgentUploadPermissionsCoro(std::string url, LLHandle<LLUploadPermissionsObserver> observerHandle); + void requestAgentUploadPermissionsCoro(LLCoros::self& self, std::string url, LLHandle<LLUploadPermissionsObserver> observerHandle); std::string mUploadModelUrl; bool mHasUploadPerm; diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 16bb449fdb..06af2725c3 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -182,7 +182,7 @@ void LLFloaterPermsDefault::updateCap() if(!object_url.empty()) { LLCoros::instance().launch("LLFloaterPermsDefault::updateCapCoro", - boost::bind(&LLFloaterPermsDefault::updateCapCoro, object_url)); + boost::bind(&LLFloaterPermsDefault::updateCapCoro, _1, object_url)); } else { @@ -191,7 +191,7 @@ void LLFloaterPermsDefault::updateCap() } /*static*/ -void LLFloaterPermsDefault::updateCapCoro(std::string url) +void LLFloaterPermsDefault::updateCapCoro(LLCoros::self& self, std::string url) { static std::string previousReason; LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -215,7 +215,7 @@ void LLFloaterPermsDefault::updateCapCoro(std::string url) LL_CONT << sent_perms_log.str() << LL_ENDL; } - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llfloaterperms.h b/indra/newview/llfloaterperms.h index e866b6de7d..ba7d39fe89 100755 --- a/indra/newview/llfloaterperms.h +++ b/indra/newview/llfloaterperms.h @@ -82,7 +82,7 @@ private: void refresh(); static const std::string sCategoryNames[CAT_LAST]; - static void updateCapCoro(std::string url); + static void updateCapCoro(LLCoros::self& self, std::string url); // cached values only for implementing cancel. diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 14719a77f9..be18565670 100755 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -200,7 +200,7 @@ BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() if (!url.empty()) { LLCoros::instance().launch("LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro", - boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro, this, url)); + boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro, this, _1, url)); return TRUE; } else @@ -209,7 +209,7 @@ BOOL LLPanelScriptLimitsRegionMemory::getLandScriptResources() } } -void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url) +void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -220,7 +220,7 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url postData["parcel_id"] = mParcelId; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -240,27 +240,27 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptResourcesCoro(std::string url { std::string urlResourceSummary = result["ScriptResourceSummary"].asString(); LLCoros::instance().launch("LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro", - boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro, this, urlResourceSummary)); + boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro, this, _1, urlResourceSummary)); } if (result.has("ScriptResourceDetails")) { std::string urlResourceDetails = result["ScriptResourceDetails"].asString(); LLCoros::instance().launch("LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro", - boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro, this, urlResourceDetails)); + boost::bind(&LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro, this, _1, urlResourceDetails)); } } -void LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro(std::string url) +void LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getLandScriptSummaryCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -305,14 +305,14 @@ void LLPanelScriptLimitsRegionMemory::getLandScriptSummaryCoro(std::string url) } -void LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro(std::string url) +void LLPanelScriptLimitsRegionMemory::getLandScriptDetailsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getLandScriptDetailsCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -947,7 +947,7 @@ BOOL LLPanelScriptLimitsAttachment::requestAttachmentDetails() if (!url.empty()) { LLCoros::instance().launch("LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro", - boost::bind(&LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro, this, url)); + boost::bind(&LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro, this, _1, url)); return TRUE; } else @@ -956,14 +956,14 @@ BOOL LLPanelScriptLimitsAttachment::requestAttachmentDetails() } } -void LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro(std::string url) +void LLPanelScriptLimitsAttachment::getAttachmentLimitsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("getAttachmentLimitsCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h index e3cbbd185f..030020087b 100755 --- a/indra/newview/llfloaterscriptlimits.h +++ b/indra/newview/llfloaterscriptlimits.h @@ -132,9 +132,9 @@ private: std::vector<LLSD> mObjectListItems; - void getLandScriptResourcesCoro(std::string url); - void getLandScriptSummaryCoro(std::string url); - void getLandScriptDetailsCoro(std::string url); + void getLandScriptResourcesCoro(LLCoros::self& self, std::string url); + void getLandScriptSummaryCoro(LLCoros::self& self, std::string url); + void getLandScriptDetailsCoro(LLCoros::self& self, std::string url); protected: @@ -180,7 +180,7 @@ public: void clearList(); private: - void getAttachmentLimitsCoro(std::string url); + void getAttachmentLimitsCoro(LLCoros::self& self, std::string url); bool mGotAttachmentMemoryUsed; S32 mAttachmentMemoryMax; diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp index 6dc08417d7..27938bfbc4 100755 --- a/indra/newview/llfloatertos.cpp +++ b/indra/newview/llfloatertos.cpp @@ -190,7 +190,7 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev std::string url(getString("real_url")); LLCoros::instance().launch("LLFloaterTOS::testSiteIsAliveCoro", - boost::bind(&LLFloaterTOS::testSiteIsAliveCoro, this, url)); + boost::bind(&LLFloaterTOS::testSiteIsAliveCoro, this, _1, url)); } else if(mRealNavigateBegun) { @@ -202,7 +202,7 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev } } -void LLFloaterTOS::testSiteIsAliveCoro(std::string url) +void LLFloaterTOS::testSiteIsAliveCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -214,7 +214,7 @@ void LLFloaterTOS::testSiteIsAliveCoro(std::string url) LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h index 2748b20513..90bea2fe83 100755 --- a/indra/newview/llfloatertos.h +++ b/indra/newview/llfloatertos.h @@ -62,7 +62,7 @@ public: /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); private: - void testSiteIsAliveCoro(std::string url); + void testSiteIsAliveCoro(LLCoros::self& self, std::string url); std::string mMessage; bool mLoadingScreenLoaded; diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp index 6683a6e6e6..110d760dc9 100755 --- a/indra/newview/llfloaterurlentry.cpp +++ b/indra/newview/llfloaterurlentry.cpp @@ -194,7 +194,7 @@ void LLFloaterURLEntry::onBtnOK( void* userdata ) (scheme == "http" || scheme == "https")) { LLCoros::instance().launch("LLFloaterURLEntry::getMediaTypeCoro", - boost::bind(&LLFloaterURLEntry::getMediaTypeCoro, media_url, self->getHandle())); + boost::bind(&LLFloaterURLEntry::getMediaTypeCoro, _1, media_url, self->getHandle())); } else { @@ -208,7 +208,7 @@ void LLFloaterURLEntry::onBtnOK( void* userdata ) } // static -void LLFloaterURLEntry::getMediaTypeCoro(std::string url, LLHandle<LLFloater> parentHandle) +void LLFloaterURLEntry::getMediaTypeCoro(LLCoros::self& self, std::string url, LLHandle<LLFloater> parentHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -220,7 +220,7 @@ void LLFloaterURLEntry::getMediaTypeCoro(std::string url, LLHandle<LLFloater> pa LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url, httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llfloaterurlentry.h b/indra/newview/llfloaterurlentry.h index 20f4604907..2f5afa653d 100755 --- a/indra/newview/llfloaterurlentry.h +++ b/indra/newview/llfloaterurlentry.h @@ -60,7 +60,7 @@ private: static void onBtnClear(void*); bool callback_clear_url_list(const LLSD& notification, const LLSD& response); - static void getMediaTypeCoro(std::string url, LLHandle<LLFloater> parentHandle); + static void getMediaTypeCoro(LLCoros::self& self, std::string url, LLHandle<LLFloater> parentHandle); }; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index edae0bfd19..0fb39ab02e 100755 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -1862,7 +1862,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, group_datap->mMemberVersion.generate(); } -void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId) +void LLGroupMgr::getGroupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1871,7 +1871,7 @@ void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId) std::string finalUrl = url + "?group_id=" + groupId.asString(); - LLSD result = httpAdapter->getAndYield(httpRequest, finalUrl); + LLSD result = httpAdapter->getAndYield(self, httpRequest, finalUrl); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1890,7 +1890,7 @@ void LLGroupMgr::getGroupBanRequestCoro(std::string url, LLUUID groupId) } } -void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, +void LLGroupMgr::postGroupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, U32 action, uuid_vec_t banList, bool update) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -1922,7 +1922,7 @@ void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, LL_WARNS() << "post: " << ll_pretty_print_sd(postData) << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, finalUrl, postData, httpOptions, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, finalUrl, postData, httpOptions, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1942,7 +1942,7 @@ void LLGroupMgr::postGroupBanRequestCoro(std::string url, LLUUID groupId, if (update) { - getGroupBanRequestCoro(url, groupId); + getGroupBanRequestCoro(self, url, groupId); } } @@ -1979,11 +1979,11 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type, { case REQUEST_GET: LLCoros::instance().launch("LLGroupMgr::getGroupBanRequestCoro", - boost::bind(&LLGroupMgr::getGroupBanRequestCoro, this, cap_url, group_id)); + boost::bind(&LLGroupMgr::getGroupBanRequestCoro, this, _1, cap_url, group_id)); break; case REQUEST_POST: LLCoros::instance().launch("LLGroupMgr::postGroupBanRequestCoro", - boost::bind(&LLGroupMgr::postGroupBanRequestCoro, this, cap_url, group_id, + boost::bind(&LLGroupMgr::postGroupBanRequestCoro, this, _1, cap_url, group_id, action, ban_list, update)); break; case REQUEST_PUT: @@ -2028,7 +2028,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST); } -void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID groupId) +void LLGroupMgr::groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -2041,7 +2041,7 @@ void LLGroupMgr::groupMembersRequestCoro(std::string url, LLUUID groupId) LLSD postData = LLSD::emptyMap(); postData["group_id"] = groupId; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -2095,7 +2095,7 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id) lastGroupMemberRequestFrame = gFrameCount; LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro", - boost::bind(&LLGroupMgr::groupMembersRequestCoro, this, cap_url, group_id)); + boost::bind(&LLGroupMgr::groupMembersRequestCoro, this, _1, cap_url, group_id)); } diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index fd0c2de854..1163923eff 100755 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -428,11 +428,11 @@ public: void clearGroupData(const LLUUID& group_id); private: - void groupMembersRequestCoro(std::string url, LLUUID groupId); + void groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId); void processCapGroupMembersRequest(const LLSD& content); - void getGroupBanRequestCoro(std::string url, LLUUID groupId); - void postGroupBanRequestCoro(std::string url, LLUUID groupId, U32 action, uuid_vec_t banList, bool update); + void getGroupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId); + void postGroupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, U32 action, uuid_vec_t banList, bool update); static void processGroupBanRequest(const LLSD& content); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 8d670d0b0a..0e5c16752e 100755 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -79,8 +79,8 @@ const static std::string NEARBY_P2P_BY_AGENT("nearby_P2P_by_agent"); /** Timeout of outgoing session initialization (in seconds) */ const static U32 SESSION_INITIALIZATION_TIMEOUT = 30; -void startConfrenceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents); -void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType); +void startConfrenceCoro(LLCoros::self& self, std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents); +void chatterBoxInvitationCoro(LLCoros::self& self, std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType); void start_deprecated_conference_chat(const LLUUID& temp_session_id, const LLUUID& creator_id, const LLUUID& other_participant_id, const LLSD& agents_to_invite); std::string LLCallDialogManager::sPreviousSessionlName = ""; @@ -389,7 +389,7 @@ void on_new_message(const LLSD& msg) notify_of_message(msg, false); } -void startConfrenceCoro(std::string url, +void startConfrenceCoro(LLCoros::self& self, std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -402,7 +402,7 @@ void startConfrenceCoro(std::string url, postData["session-id"] = tempSessionId; postData["params"] = agents; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -430,7 +430,7 @@ void startConfrenceCoro(std::string url, } } -void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType) +void chatterBoxInvitationCoro(LLCoros::self& self, std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -441,7 +441,7 @@ void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvit postData["method"] = "accept invitation"; postData["session-id"] = sessionId; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1623,7 +1623,7 @@ bool LLIMModel::sendStartSession( "ChatSessionRequest"); LLCoros::instance().launch("startConfrenceCoro", - boost::bind(&startConfrenceCoro, url, + boost::bind(&startConfrenceCoro, _1, url, temp_session_id, gAgent.getID(), other_participant_id, agents)); } else @@ -2468,7 +2468,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload if (voice) { LLCoros::instance().launch("chatterBoxInvitationCoro", - boost::bind(&chatterBoxInvitationCoro, url, + boost::bind(&chatterBoxInvitationCoro, _1, url, session_id, inv_type)); // send notification message to the corresponding chat @@ -2555,7 +2555,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response) "ChatSessionRequest"); LLCoros::instance().launch("chatterBoxInvitationCoro", - boost::bind(&chatterBoxInvitationCoro, url, + boost::bind(&chatterBoxInvitationCoro, _1, url, session_id, inv_type)); } } @@ -3646,7 +3646,7 @@ public: if ( url != "" ) { LLCoros::instance().launch("chatterBoxInvitationCoro", - boost::bind(&chatterBoxInvitationCoro, url, + boost::bind(&chatterBoxInvitationCoro, _1, url, session_id, LLIMMgr::INVITATION_TYPE_INSTANT_MESSAGE)); } } //end if invitation has instant message diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 25450f2317..6d21dd4ba7 100755 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -578,7 +578,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, LL_DEBUGS(LOG_INV) << "create category request: " << ll_pretty_print_sd(request) << LL_ENDL; LLCoros::instance().launch("LLInventoryModel::createNewCategoryCoro", - boost::bind(&LLInventoryModel::createNewCategoryCoro, this, url, body, callback)); + boost::bind(&LLInventoryModel::createNewCategoryCoro, this, _1, url, body, callback)); return LLUUID::null; } @@ -607,7 +607,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, return id; } -void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inventory_func_type callback) +void LLInventoryModel::createNewCategoryCoro(LLCoros::self& self, std::string url, LLSD postData, inventory_func_type callback) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -620,7 +620,7 @@ void LLInventoryModel::createNewCategoryCoro(std::string url, LLSD postData, inv LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 1f1c686ef1..26ee06535a 100755 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -444,7 +444,7 @@ protected: void addCategory(LLViewerInventoryCategory* category); void addItem(LLViewerInventoryItem* item); - void createNewCategoryCoro(std::string url, LLSD postData, inventory_func_type callback); + void createNewCategoryCoro(LLCoros::self& self, std::string url, LLSD postData, inventory_func_type callback); /** Mutators ** ** diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 38c4382654..bd77912a6c 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -126,7 +126,7 @@ namespace LLMarketplaceImport // Responders #if 1 - void marketplacePostCoro(std::string url) + void marketplacePostCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -144,7 +144,7 @@ namespace LLMarketplaceImport httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_XML); httpHeaders->append(HTTP_OUT_HEADER_USER_AGENT, LLViewerMedia::getCurrentUserAgent()); - LLSD result = httpAdapter->postAndYield(httpRequest, url, LLSD(), httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, LLSD(), httpOpts, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -237,7 +237,7 @@ namespace LLMarketplaceImport #endif #if 1 - void marketplaceGetCoro(std::string url, bool buildHeaders) + void marketplaceGetCoro(LLCoros::self& self, std::string url, bool buildHeaders) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -263,7 +263,7 @@ namespace LLMarketplaceImport httpHeaders = LLViewerMedia::getHttpHeaders(); } - LLSD result = httpAdapter->getAndYield(httpRequest, url, httpOpts, httpHeaders); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url, httpOpts, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -405,7 +405,7 @@ namespace LLMarketplaceImport #if 1 LLCoros::instance().launch("marketplaceGetCoro", - boost::bind(&marketplaceGetCoro, url, false)); + boost::bind(&marketplaceGetCoro, _1, url, false)); #else if (gSavedSettings.getBOOL("InventoryOutboxLogging")) @@ -439,7 +439,7 @@ namespace LLMarketplaceImport #if 1 LLCoros::instance().launch("marketplaceGetCoro", - boost::bind(&marketplaceGetCoro, url, true)); + boost::bind(&marketplaceGetCoro, _1, url, true)); #else // Make the headers for the post @@ -482,7 +482,7 @@ namespace LLMarketplaceImport #if 1 LLCoros::instance().launch("marketplacePostCoro", - boost::bind(&marketplacePostCoro, url)); + boost::bind(&marketplacePostCoro, _1, url)); #else // Make the headers for the post diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 2e6937a79f..5dc90c987d 100755 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -225,7 +225,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b U64 regionHandle = pRegion->getHandle(); std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navMeshStatusRequestCoro", - boost::bind(&LLPathfindingManager::navMeshStatusRequestCoro, this, navMeshStatusURL, regionHandle, pIsGetStatusOnly)); + boost::bind(&LLPathfindingManager::navMeshStatusRequestCoro, this, _1, navMeshStatusURL, regionHandle, pIsGetStatusOnly)); } } @@ -259,12 +259,12 @@ void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_re LinksetsResponder::ptr_t linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetObjectsCoro", - boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, objectLinksetsURL, linksetsResponderPtr, LLSD())); + boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, _1, objectLinksetsURL, linksetsResponderPtr, LLSD())); if (doRequestTerrain) { std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetTerrainCoro", - boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, terrainLinksetsURL, linksetsResponderPtr, LLSD())); + boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, _1, terrainLinksetsURL, linksetsResponderPtr, LLSD())); } } } @@ -308,13 +308,13 @@ void LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, const LLP if (!objectPostData.isUndefined()) { std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetObjectsCoro", - boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, objectLinksetsURL, linksetsResponderPtr, objectPostData)); + boost::bind(&LLPathfindingManager::linksetObjectsCoro, this, _1, objectLinksetsURL, linksetsResponderPtr, objectPostData)); } if (!terrainPostData.isUndefined()) { std::string coroname = LLCoros::instance().launch("LLPathfindingManager::linksetTerrainCoro", - boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, terrainLinksetsURL, linksetsResponderPtr, terrainPostData)); + boost::bind(&LLPathfindingManager::linksetTerrainCoro, this, _1, terrainLinksetsURL, linksetsResponderPtr, terrainPostData)); } } } @@ -347,7 +347,7 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_ pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr); std::string coroname = LLCoros::instance().launch("LLPathfindingManager::charactersCoro", - boost::bind(&LLPathfindingManager::charactersCoro, this, charactersURL, pRequestId, pCharactersCallback)); + boost::bind(&LLPathfindingManager::charactersCoro, this, _1, charactersURL, pRequestId, pCharactersCallback)); } } } @@ -381,7 +381,7 @@ void LLPathfindingManager::requestGetAgentState() llassert(!agentStateURL.empty()); std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navAgentStateRequestCoro", - boost::bind(&LLPathfindingManager::navAgentStateRequestCoro, this, agentStateURL)); + boost::bind(&LLPathfindingManager::navAgentStateRequestCoro, this, _1, agentStateURL)); } } } @@ -404,7 +404,7 @@ void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebak llassert(!navMeshStatusURL.empty()); std::string coroname = LLCoros::instance().launch("LLPathfindingManager::navMeshRebakeCoro", - boost::bind(&LLPathfindingManager::navMeshRebakeCoro, this, navMeshStatusURL, pRebakeNavMeshCallback)); + boost::bind(&LLPathfindingManager::navMeshRebakeCoro, this, _1, navMeshStatusURL, pRebakeNavMeshCallback)); } } @@ -448,7 +448,7 @@ void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pR } } -void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionHandle, bool isGetStatusOnly) +void LLPathfindingManager::navMeshStatusRequestCoro(LLCoros::self& self, std::string url, U64 regionHandle, bool isGetStatusOnly) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -464,7 +464,7 @@ void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionH LLUUID regionUUID = region->getRegionID(); region = NULL; - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); region = LLWorld::getInstance()->getRegionFromHandle(regionHandle); @@ -519,7 +519,7 @@ void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionH navMeshPtr->handleNavMeshStart(navMeshStatus); LLSD postData; - result = httpAdapter->postAndYield(httpRequest, navMeshURL, postData); + result = httpAdapter->postAndYield(self, httpRequest, navMeshURL, postData); U32 navMeshVersion = navMeshStatus.getVersion(); @@ -538,14 +538,14 @@ void LLPathfindingManager::navMeshStatusRequestCoro(std::string url, U64 regionH } -void LLPathfindingManager::navAgentStateRequestCoro(std::string url) +void LLPathfindingManager::navAgentStateRequestCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("NavAgentStateRequest", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -566,7 +566,7 @@ void LLPathfindingManager::navAgentStateRequestCoro(std::string url) handleAgentState(canRebake); } -void LLPathfindingManager::navMeshRebakeCoro(std::string url, rebake_navmesh_callback_t rebakeNavMeshCallback) +void LLPathfindingManager::navMeshRebakeCoro(LLCoros::self& self, std::string url, rebake_navmesh_callback_t rebakeNavMeshCallback) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -577,7 +577,7 @@ void LLPathfindingManager::navMeshRebakeCoro(std::string url, rebake_navmesh_cal LLSD postData = LLSD::emptyMap(); postData["command"] = "rebuild"; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -595,7 +595,7 @@ void LLPathfindingManager::navMeshRebakeCoro(std::string url, rebake_navmesh_cal // If called with putData undefined this coroutine will issue a get. If there // is data in putData it will be PUT to the URL. -void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const +void LLPathfindingManager::linksetObjectsCoro(LLCoros::self &self, std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -606,11 +606,11 @@ void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder if (putData.isUndefined()) { - result = httpAdapter->getAndYield(httpRequest, url); + result = httpAdapter->getAndYield(self, httpRequest, url); } else { - result = httpAdapter->putAndYield(httpRequest, url, putData); + result = httpAdapter->putAndYield(self, httpRequest, url, putData); } LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -631,7 +631,7 @@ void LLPathfindingManager::linksetObjectsCoro(std::string url, LinksetsResponder // If called with putData undefined this coroutine will issue a GET. If there // is data in putData it will be PUT to the URL. -void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const +void LLPathfindingManager::linksetTerrainCoro(LLCoros::self &self, std::string url, LinksetsResponder::ptr_t linksetsResponsderPtr, LLSD putData) const { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -642,11 +642,11 @@ void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder if (putData.isUndefined()) { - result = httpAdapter->getAndYield(httpRequest, url); + result = httpAdapter->getAndYield(self, httpRequest, url); } else { - result = httpAdapter->putAndYield(httpRequest, url, putData); + result = httpAdapter->putAndYield(self, httpRequest, url, putData); } LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -666,14 +666,14 @@ void LLPathfindingManager::linksetTerrainCoro(std::string url, LinksetsResponder } -void LLPathfindingManager::charactersCoro(std::string url, request_id_t requestId, object_request_callback_t callback) const +void LLPathfindingManager::charactersCoro(LLCoros::self &self, std::string url, request_id_t requestId, object_request_callback_t callback) const { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("LinksetTerrain", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index e8fad590ba..abf611801c 100755 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -104,12 +104,12 @@ private: void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const; void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const; - void navMeshStatusRequestCoro(std::string url, U64 regionHandle, bool isGetStatusOnly); - void navAgentStateRequestCoro(std::string url); - void navMeshRebakeCoro(std::string url, rebake_navmesh_callback_t rebakeNavMeshCallback); - void linksetObjectsCoro(std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; - void linksetTerrainCoro(std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; - void charactersCoro(std::string url, request_id_t requestId, object_request_callback_t callback) const; + void navMeshStatusRequestCoro(LLCoros::self& self, std::string url, U64 regionHandle, bool isGetStatusOnly); + void navAgentStateRequestCoro(LLCoros::self& self, std::string url); + void navMeshRebakeCoro(LLCoros::self& self, std::string url, rebake_navmesh_callback_t rebakeNavMeshCallback); + void linksetObjectsCoro(LLCoros::self &self, std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; + void linksetTerrainCoro(LLCoros::self &self, std::string url, boost::shared_ptr<LinksetsResponder> linksetsResponsderPtr, LLSD putData) const; + void charactersCoro(LLCoros::self &self, std::string url, request_id_t requestId, object_request_callback_t callback) const; //void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly); void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus); diff --git a/indra/newview/llproductinforequest.cpp b/indra/newview/llproductinforequest.cpp index 467e9df482..fd948765b3 100755 --- a/indra/newview/llproductinforequest.cpp +++ b/indra/newview/llproductinforequest.cpp @@ -45,7 +45,7 @@ void LLProductInfoRequestManager::initSingleton() if (!url.empty()) { LLCoros::instance().launch("LLProductInfoRequestManager::getLandDescriptionsCoro", - boost::bind(&LLProductInfoRequestManager::getLandDescriptionsCoro, this, url)); + boost::bind(&LLProductInfoRequestManager::getLandDescriptionsCoro, this, _1, url)); } } @@ -66,14 +66,14 @@ std::string LLProductInfoRequestManager::getDescriptionForSku(const std::string& return LLTrans::getString("land_type_unknown"); } -void LLProductInfoRequestManager::getLandDescriptionsCoro(std::string url) +void LLProductInfoRequestManager::getLandDescriptionsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llproductinforequest.h b/indra/newview/llproductinforequest.h index 75dbf220d1..3ddae95a93 100755 --- a/indra/newview/llproductinforequest.h +++ b/indra/newview/llproductinforequest.h @@ -49,7 +49,7 @@ private: friend class LLSingleton<LLProductInfoRequestManager>; /* virtual */ void initSingleton(); - void getLandDescriptionsCoro(std::string url); + void getLandDescriptionsCoro(LLCoros::self& self, std::string url); LLSD mSkuDescriptions; }; diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp index 06bf90c7cb..7e8e9ac18e 100755 --- a/indra/newview/llremoteparcelrequest.cpp +++ b/indra/newview/llremoteparcelrequest.cpp @@ -170,7 +170,7 @@ bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url if (!url.empty()) { LLCoros::instance().launch("LLRemoteParcelInfoProcessor::regionParcelInfoCoro", - boost::bind(&LLRemoteParcelInfoProcessor::regionParcelInfoCoro, this, url, + boost::bind(&LLRemoteParcelInfoProcessor::regionParcelInfoCoro, this, _1, url, regionId, regionPos, globalPos, observerHandle)); return true; } @@ -178,7 +178,7 @@ bool LLRemoteParcelInfoProcessor::requestRegionParcelInfo(const std::string &url return false; } -void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url, +void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(LLCoros::self& self, std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle<LLRemoteParcelInfoObserver> observerHandle) { @@ -200,7 +200,7 @@ void LLRemoteParcelInfoProcessor::regionParcelInfoCoro(std::string url, bodyData["region_handle"] = ll_sd_from_U64(regionHandle); } - LLSD result = httpAdapter->postAndYield(httpRequest, url, bodyData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, bodyData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llremoteparcelrequest.h b/indra/newview/llremoteparcelrequest.h index cb5af50c5f..982a1590e5 100755 --- a/indra/newview/llremoteparcelrequest.h +++ b/indra/newview/llremoteparcelrequest.h @@ -91,7 +91,7 @@ private: typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t; observer_multimap_t mObservers; - void regionParcelInfoCoro(std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle<LLRemoteParcelInfoObserver> observerHandle); + void regionParcelInfoCoro(LLCoros::self& self, std::string url, LLUUID regionId, LLVector3 posRegion, LLVector3d posGlobal, LLHandle<LLRemoteParcelInfoObserver> observerHandle); }; #endif // LL_LLREMOTEPARCELREQUEST_H diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 3b060d8343..9a9739c9cb 100755 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -841,7 +841,7 @@ void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) data["params"]["mute_info"]["text"] = !speakerp->mModeratorMutedText; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) @@ -866,10 +866,10 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu data["params"]["mute_info"]["voice"] = !unmute; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } -void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) +void LLIMSpeakerMgr::moderationActionCoro(LLCoros::self& self, std::string url, LLSD action) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -881,7 +881,7 @@ void LLIMSpeakerMgr::moderationActionCoro(std::string url, LLSD action) LLUUID sessionId = action["session-id"]; - LLSD result = httpAdapter->postAndYield(httpRequest, url, action, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, action, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -948,7 +948,7 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice; LLCoros::instance().launch("LLIMSpeakerMgr::moderationActionCoro", - boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, url, data)); + boost::bind(&LLIMSpeakerMgr::moderationActionCoro, this, _1, url, data)); } void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted) diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 5cff70f377..1f3b2f584c 100755 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -335,7 +335,7 @@ protected: */ void forceVoiceModeratedMode(bool should_be_muted); - void moderationActionCoro(std::string url, LLSD action); + void moderationActionCoro(LLCoros::self& self, std::string url, LLSD action); }; diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 7f286044d6..d2197dcb4f 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -108,14 +108,14 @@ bool LLSyntaxIdLSL::syntaxIdChanged() void LLSyntaxIdLSL::fetchKeywordsFile(const std::string& filespec) { LLCoros::instance().launch("LLSyntaxIdLSL::fetchKeywordsFileCoro", - boost::bind(&LLSyntaxIdLSL::fetchKeywordsFileCoro, this, mCapabilityURL, filespec)); + boost::bind(&LLSyntaxIdLSL::fetchKeywordsFileCoro, this, _1, mCapabilityURL, filespec)); LL_DEBUGS("SyntaxLSL") << "LSLSyntaxId capability URL is: " << mCapabilityURL << ". Filename to use is: '" << filespec << "'." << LL_ENDL; } //----------------------------------------------------------------------------- // fetchKeywordsFileCoro //----------------------------------------------------------------------------- -void LLSyntaxIdLSL::fetchKeywordsFileCoro(std::string url, std::string fileSpec) +void LLSyntaxIdLSL::fetchKeywordsFileCoro(LLCoros::self& self, std::string url, std::string fileSpec) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -129,7 +129,7 @@ void LLSyntaxIdLSL::fetchKeywordsFileCoro(std::string url, std::string fileSpec) return; } - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llsyntaxid.h b/indra/newview/llsyntaxid.h index 0afa6dc04b..47de94cea2 100644 --- a/indra/newview/llsyntaxid.h +++ b/indra/newview/llsyntaxid.h @@ -57,7 +57,7 @@ private: void loadDefaultKeywordsIntoLLSD(); void loadKeywordsIntoLLSD(); - void fetchKeywordsFileCoro(std::string url, std::string fileSpec); + void fetchKeywordsFileCoro(LLCoros::self& self, std::string url, std::string fileSpec); void cacheFile(const std::string &fileSpec, const LLSD& content_ref); std::string mCapabilityURL; diff --git a/indra/newview/lltwitterconnect.cpp b/indra/newview/lltwitterconnect.cpp index c6a0a15759..09435850c3 100644 --- a/indra/newview/lltwitterconnect.cpp +++ b/indra/newview/lltwitterconnect.cpp @@ -67,7 +67,7 @@ void toast_user_for_twitter_success() /////////////////////////////////////////////////////////////////////////////// // -void LLTwitterConnect::twitterConnectCoro(std::string requestToken, std::string oauthVerifier) +void LLTwitterConnect::twitterConnectCoro(LLCoros::self& self, std::string requestToken, std::string oauthVerifier) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -86,7 +86,7 @@ void LLTwitterConnect::twitterConnectCoro(std::string requestToken, std::string setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->putAndYield(httpRequest, getTwitterConnectURL("/connection"), body, httpOpts); + LLSD result = httpAdapter->putAndYield(self, httpRequest, getTwitterConnectURL("/connection"), body, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -157,7 +157,7 @@ bool LLTwitterConnect::testShareStatus(LLSD &result) return false; } -void LLTwitterConnect::twitterShareCoro(std::string route, LLSD share) +void LLTwitterConnect::twitterShareCoro(LLCoros::self& self, std::string route, LLSD share) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -170,7 +170,7 @@ void LLTwitterConnect::twitterShareCoro(std::string route, LLSD share) setConnectionState(LLTwitterConnect::TWITTER_POSTING); - LLSD result = httpAdapter->postAndYield(httpRequest, getTwitterConnectURL(route, true), share, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getTwitterConnectURL(route, true), share, httpOpts); if (testShareStatus(result)) { @@ -180,7 +180,7 @@ void LLTwitterConnect::twitterShareCoro(std::string route, LLSD share) } } -void LLTwitterConnect::twitterShareImageCoro(LLPointer<LLImageFormatted> image, std::string status) +void LLTwitterConnect::twitterShareImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string status) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -235,7 +235,7 @@ void LLTwitterConnect::twitterShareImageCoro(LLPointer<LLImageFormatted> image, body << "\r\n--" << boundary << "--\r\n"; - LLSD result = httpAdapter->postAndYield(httpRequest, getTwitterConnectURL("/share/photo", true), raw, httpOpts, httpHeaders); + LLSD result = httpAdapter->postAndYield(self, httpRequest, getTwitterConnectURL("/share/photo", true), raw, httpOpts, httpHeaders); if (testShareStatus(result)) { @@ -247,7 +247,7 @@ void LLTwitterConnect::twitterShareImageCoro(LLPointer<LLImageFormatted> image, /////////////////////////////////////////////////////////////////////////////// // -void LLTwitterConnect::twitterDisconnectCoro() +void LLTwitterConnect::twitterDisconnectCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -259,7 +259,7 @@ void LLTwitterConnect::twitterDisconnectCoro() setConnectionState(LLTwitterConnect::TWITTER_DISCONNECTING); - LLSD result = httpAdapter->deleteAndYield(httpRequest, getTwitterConnectURL("/connection"), httpOpts); + LLSD result = httpAdapter->deleteAndYield(self, httpRequest, getTwitterConnectURL("/connection"), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -282,7 +282,7 @@ void LLTwitterConnect::twitterDisconnectCoro() /////////////////////////////////////////////////////////////////////////////// // -void LLTwitterConnect::twitterConnectedCoro(bool autoConnect) +void LLTwitterConnect::twitterConnectedCoro(LLCoros::self& self, bool autoConnect) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -293,7 +293,7 @@ void LLTwitterConnect::twitterConnectedCoro(bool autoConnect) httpOpts->setFollowRedirects(false); setConnectionState(LLTwitterConnect::TWITTER_CONNECTION_IN_PROGRESS); - LLSD result = httpAdapter->getAndYield(httpRequest, getTwitterConnectURL("/connection", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/connection", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -331,7 +331,7 @@ void LLTwitterConnect::twitterConnectedCoro(bool autoConnect) /////////////////////////////////////////////////////////////////////////////// // -void LLTwitterConnect::twitterInfoCoro() +void LLTwitterConnect::twitterInfoCoro(LLCoros::self& self) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -342,7 +342,7 @@ void LLTwitterConnect::twitterInfoCoro() httpOpts->setWantHeaders(true); httpOpts->setFollowRedirects(false); - LLSD result = httpAdapter->getAndYield(httpRequest, getTwitterConnectURL("/info", true), httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, getTwitterConnectURL("/info", true), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -425,19 +425,19 @@ std::string LLTwitterConnect::getTwitterConnectURL(const std::string& route, boo void LLTwitterConnect::connectToTwitter(const std::string& request_token, const std::string& oauth_verifier) { LLCoros::instance().launch("LLTwitterConnect::twitterConnectCoro", - boost::bind(&LLTwitterConnect::twitterConnectCoro, this, request_token, oauth_verifier)); + boost::bind(&LLTwitterConnect::twitterConnectCoro, this, _1, request_token, oauth_verifier)); } void LLTwitterConnect::disconnectFromTwitter() { LLCoros::instance().launch("LLTwitterConnect::twitterDisconnectCoro", - boost::bind(&LLTwitterConnect::twitterDisconnectCoro, this)); + boost::bind(&LLTwitterConnect::twitterDisconnectCoro, this, _1)); } void LLTwitterConnect::checkConnectionToTwitter(bool auto_connect) { LLCoros::instance().launch("LLTwitterConnect::twitterConnectedCoro", - boost::bind(&LLTwitterConnect::twitterConnectedCoro, this, auto_connect)); + boost::bind(&LLTwitterConnect::twitterConnectedCoro, this, _1, auto_connect)); } void LLTwitterConnect::loadTwitterInfo() @@ -445,7 +445,7 @@ void LLTwitterConnect::loadTwitterInfo() if(mRefreshInfo) { LLCoros::instance().launch("LLTwitterConnect::twitterInfoCoro", - boost::bind(&LLTwitterConnect::twitterInfoCoro, this)); + boost::bind(&LLTwitterConnect::twitterInfoCoro, this, _1)); } } @@ -456,13 +456,13 @@ void LLTwitterConnect::uploadPhoto(const std::string& image_url, const std::stri body["status"] = status; LLCoros::instance().launch("LLTwitterConnect::twitterShareCoro", - boost::bind(&LLTwitterConnect::twitterShareCoro, this, "/share/photo", body)); + boost::bind(&LLTwitterConnect::twitterShareCoro, this, _1, "/share/photo", body)); } void LLTwitterConnect::uploadPhoto(LLPointer<LLImageFormatted> image, const std::string& status) { LLCoros::instance().launch("LLTwitterConnect::twitterShareImageCoro", - boost::bind(&LLTwitterConnect::twitterShareImageCoro, this, image, status)); + boost::bind(&LLTwitterConnect::twitterShareImageCoro, this, _1, image, status)); } void LLTwitterConnect::updateStatus(const std::string& status) @@ -471,7 +471,7 @@ void LLTwitterConnect::updateStatus(const std::string& status) body["status"] = status; LLCoros::instance().launch("LLTwitterConnect::twitterShareCoro", - boost::bind(&LLTwitterConnect::twitterShareCoro, this, "/share/status", body)); + boost::bind(&LLTwitterConnect::twitterShareCoro, this, _1, "/share/status", body)); } void LLTwitterConnect::storeInfo(const LLSD& info) diff --git a/indra/newview/lltwitterconnect.h b/indra/newview/lltwitterconnect.h index be481a17c1..4d11118143 100644 --- a/indra/newview/lltwitterconnect.h +++ b/indra/newview/lltwitterconnect.h @@ -98,12 +98,12 @@ private: static boost::scoped_ptr<LLEventPump> sContentWatcher; bool testShareStatus(LLSD &result); - void twitterConnectCoro(std::string requestToken, std::string oauthVerifier); - void twitterDisconnectCoro(); - void twitterConnectedCoro(bool autoConnect); - void twitterInfoCoro(); - void twitterShareCoro(std::string route, LLSD share); - void twitterShareImageCoro(LLPointer<LLImageFormatted> image, std::string status); + void twitterConnectCoro(LLCoros::self& self, std::string requestToken, std::string oauthVerifier); + void twitterDisconnectCoro(LLCoros::self& self); + void twitterConnectedCoro(LLCoros::self& self, bool autoConnect); + void twitterInfoCoro(LLCoros::self& self); + void twitterShareCoro(LLCoros::self& self, std::string route, LLSD share); + void twitterShareImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string status); }; #endif // LL_LLTWITTERCONNECT_H diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index cd4e7c33ef..e2394e20d5 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -46,7 +46,7 @@ //========================================================================= /*static*/ -void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, +void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoros::self &self, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, std::string url, NewResourceUploadInfo::ptr_t uploadInfo) { LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); @@ -68,7 +68,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti LLSD body = uploadInfo->generatePostBody(); - result = httpAdapter->postAndYield(httpRequest, url, body); + result = httpAdapter->postAndYield(self, httpRequest, url, body); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -82,7 +82,7 @@ void LLViewerAssetUpload::AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCorouti std::string uploader = result["uploader"].asString(); - result = httpAdapter->postFileAndYield(httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType()); + result = httpAdapter->postFileAndYield(self, httpRequest, uploader, uploadInfo->getAssetId(), uploadInfo->getAssetType()); httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 38167fc0c7..ad48be67a6 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -41,7 +41,7 @@ class LLViewerAssetUpload { public: - static void AssetInventoryUploadCoproc(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, + static void AssetInventoryUploadCoproc(LLCoros::self &self, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, const LLUUID &id, std::string url, NewResourceUploadInfo::ptr_t uploadInfo); private: diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index f332a4e98e..6d0fce46aa 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1226,12 +1226,12 @@ void LLViewerMedia::setOpenIDCookie() std::string profileUrl = getProfileURL(""); LLCoros::instance().launch("LLViewerMedia::getOpenIDCookieCoro", - boost::bind(&LLViewerMedia::getOpenIDCookieCoro, profileUrl)); + boost::bind(&LLViewerMedia::getOpenIDCookieCoro, _1, profileUrl)); } } /*static*/ -void LLViewerMedia::getOpenIDCookieCoro(std::string url) +void LLViewerMedia::getOpenIDCookieCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1280,7 +1280,7 @@ void LLViewerMedia::getOpenIDCookieCoro(std::string url) LL_DEBUGS("MediaAuth") << "Requesting " << url << LL_ENDL; LL_DEBUGS("MediaAuth") << "sOpenIDCookie = [" << sOpenIDCookie << "]" << LL_ENDL; - LLSD result = httpAdapter->getRawAndYield(httpRequest, url, httpOpts, httpHeaders); + LLSD result = httpAdapter->getRawAndYield(self, httpRequest, url, httpOpts, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1317,11 +1317,11 @@ void LLViewerMedia::openIDSetup(const std::string &openidUrl, const std::string LL_DEBUGS("MediaAuth") << "url = \"" << openidUrl << "\", token = \"" << openidToken << "\"" << LL_ENDL; LLCoros::instance().launch("LLViewerMedia::openIDSetupCoro", - boost::bind(&LLViewerMedia::openIDSetupCoro, openidUrl, openidToken)); + boost::bind(&LLViewerMedia::openIDSetupCoro, _1, openidUrl, openidToken)); } /*static*/ -void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidToken) +void LLViewerMedia::openIDSetupCoro(LLCoros::self& self, std::string openidUrl, std::string openidToken) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1347,7 +1347,7 @@ void LLViewerMedia::openIDSetupCoro(std::string openidUrl, std::string openidTok bas << std::noskipws << openidToken; - LLSD result = httpAdapter->postRawAndYield(httpRequest, openidUrl, rawbody, httpOpts, httpHeaders); + LLSD result = httpAdapter->postRawAndYield(self, httpRequest, openidUrl, rawbody, httpOpts, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -2553,7 +2553,7 @@ void LLViewerMediaImpl::navigateInternal() if(scheme.empty() || "http" == scheme || "https" == scheme) { LLCoros::instance().launch("LLViewerMediaImpl::mimeDiscoveryCoro", - boost::bind(&LLViewerMediaImpl::mimeDiscoveryCoro, this, mMediaURL)); + boost::bind(&LLViewerMediaImpl::mimeDiscoveryCoro, this, _1, mMediaURL)); } else if("data" == scheme || "file" == scheme || "about" == scheme) { @@ -2583,7 +2583,7 @@ void LLViewerMediaImpl::navigateInternal() } } -void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url) +void LLViewerMediaImpl::mimeDiscoveryCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -2600,7 +2600,7 @@ void LLViewerMediaImpl::mimeDiscoveryCoro(std::string url) httpHeaders->append(HTTP_OUT_HEADER_ACCEPT, "*/*"); httpHeaders->append(HTTP_OUT_HEADER_COOKIE, ""); - LLSD result = httpAdapter->getRawAndYield(httpRequest, url, httpOpts, httpHeaders); + LLSD result = httpAdapter->getRawAndYield(self, httpRequest, url, httpOpts, httpHeaders); mMimeProbe.reset(); diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 92d644c900..ff9840627c 100755 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -170,8 +170,8 @@ private: static void setOpenIDCookie(); static void onTeleportFinished(); - static void openIDSetupCoro(std::string openidUrl, std::string openidToken); - static void getOpenIDCookieCoro(std::string url); + static void openIDSetupCoro(LLCoros::self& self, std::string openidUrl, std::string openidToken); + static void getOpenIDCookieCoro(LLCoros::self& self, std::string url); static LLPluginCookieStore *sCookieStore; static LLURL sOpenIDURL; @@ -475,7 +475,7 @@ private: BOOL mIsUpdated ; std::list< LLVOVolume* > mObjectList ; - void mimeDiscoveryCoro(std::string url); + void mimeDiscoveryCoro(LLCoros::self& self, std::string url); LLCoreHttpUtil::HttpCoroutineAdapter::wptr_t mMimeProbe; bool mCanceling; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index e9eb0e807a..4772dd144b 100755 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -929,7 +929,7 @@ void upload_new_resource( if ( !url.empty() ) { - LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, url, uploadInfo); + LLCoprocedureManager::CoProcedure_t proc = boost::bind(&LLViewerAssetUpload::AssetInventoryUploadCoproc, _1, _2, _3, url, uploadInfo); LLCoprocedureManager::getInstance()->enqueueCoprocedure("LLViewerAssetUpload::AssetInventoryUploadCoproc", proc); } diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 2a009499d3..1c3e2aec01 100755 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -992,7 +992,7 @@ void LLViewerObjectList::fetchObjectCosts() if (!url.empty()) { LLCoros::instance().launch("LLViewerObjectList::fetchObjectCostsCoro", - boost::bind(&LLViewerObjectList::fetchObjectCostsCoro, this, url)); + boost::bind(&LLViewerObjectList::fetchObjectCostsCoro, this, _1, url)); } else { @@ -1014,7 +1014,7 @@ void LLViewerObjectList::reportObjectCostFailure(LLSD &objectList) } -void LLViewerObjectList::fetchObjectCostsCoro(std::string url) +void LLViewerObjectList::fetchObjectCostsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1052,7 +1052,7 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url) postData["object_ids"] = idList; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -1122,7 +1122,7 @@ void LLViewerObjectList::fetchPhysicsFlags() if (!url.empty()) { LLCoros::instance().launch("LLViewerObjectList::fetchPhisicsFlagsCoro", - boost::bind(&LLViewerObjectList::fetchPhisicsFlagsCoro, this, url)); + boost::bind(&LLViewerObjectList::fetchPhisicsFlagsCoro, this, _1, url)); } else { @@ -1143,7 +1143,7 @@ void LLViewerObjectList::reportPhysicsFlagFailure(LLSD &objectList) } } -void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url) +void LLViewerObjectList::fetchPhisicsFlagsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -1181,7 +1181,7 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url) postData["object_ids"] = idList; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 9ec7c4bc22..f849813f0a 100755 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -232,10 +232,10 @@ protected: private: static void reportObjectCostFailure(LLSD &objectList); - void fetchObjectCostsCoro(std::string url); + void fetchObjectCostsCoro(LLCoros::self& self, std::string url); static void reportPhysicsFlagFailure(LLSD &obejectList); - void fetchPhisicsFlagsCoro(std::string url); + void fetchPhisicsFlagsCoro(LLCoros::self& self, std::string url); }; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index b256482289..f0015ceef1 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -219,12 +219,12 @@ public: LLVector3 mLastCameraOrigin; U32 mLastCameraUpdate; - void requestBaseCapabilitiesCoro(U64 regionHandle); - void requestBaseCapabilitiesCompleteCoro(U64 regionHandle); - void requestSimulatorFeatureCoro(std::string url, U64 regionHandle); + void requestBaseCapabilitiesCoro(LLCoros::self& self, U64 regionHandle); + void requestBaseCapabilitiesCompleteCoro(LLCoros::self& self, U64 regionHandle); + void requestSimulatorFeatureCoro(LLCoros::self& self, std::string url, U64 regionHandle); }; -void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) +void LLViewerRegionImpl::requestBaseCapabilitiesCoro(LLCoros::self& self, U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -275,7 +275,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) << " (attempt #" << mSeedCapAttempts << ")" << LL_ENDL; regionp = NULL; - result = httpAdapter->postAndYield(httpRequest, url, capabilityNames); + result = httpAdapter->postAndYield(self, httpRequest, url, capabilityNames); regionp = LLWorld::getInstance()->getRegionFromHandle(regionHandle); if (!regionp) //region was removed @@ -332,7 +332,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) } -void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) +void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(LLCoros::self& self, U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -365,7 +365,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) LL_INFOS("AppInit", "Capabilities") << "Requesting second Seed from " << url << LL_ENDL; regionp = NULL; - result = httpAdapter->postAndYield(httpRequest, url, capabilityNames); + result = httpAdapter->postAndYield(self, httpRequest, url, capabilityNames); LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -435,7 +435,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro(U64 regionHandle) } -void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 regionHandle) +void LLViewerRegionImpl::requestSimulatorFeatureCoro(LLCoros::self& self, std::string url, U64 regionHandle) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -464,7 +464,7 @@ void LLViewerRegionImpl::requestSimulatorFeatureCoro(std::string url, U64 region } regionp = NULL; - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result["http_result"]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -2908,7 +2908,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) //to the "original" seed cap received and determine why there is problem! std::string coroname = LLCoros::instance().launch("LLEnvironmentRequest::requestBaseCapabilitiesCompleteCoro", - boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro, mImpl, getHandle())); + boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCompleteCoro, mImpl, _1, getHandle())); return; } @@ -2920,7 +2920,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) std::string coroname = LLCoros::instance().launch("LLEnvironmentRequest::environmentRequestCoro", - boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCoro, mImpl, getHandle())); + boost::bind(&LLViewerRegionImpl::requestBaseCapabilitiesCoro, mImpl, _1, getHandle())); LL_INFOS("AppInit", "Capabilities") << "Launching " << coroname << " requesting seed capabilities from " << url << LL_ENDL; } @@ -2947,7 +2947,7 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u // kick off a request for simulator features std::string coroname = LLCoros::instance().launch("LLViewerRegionImpl::requestSimulatorFeatureCoro", - boost::bind(&LLViewerRegionImpl::requestSimulatorFeatureCoro, mImpl, url, getHandle())); + boost::bind(&LLViewerRegionImpl::requestSimulatorFeatureCoro, mImpl, _1, url, getHandle())); LL_INFOS("AppInit", "SimulatorFeatures") << "Launching " << coroname << " requesting simulator features from " << url << LL_ENDL; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 7c460ce097..ba4fd59feb 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2190,7 +2190,7 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const return text; } -void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) +void LLVOAvatarSelf::appearanceChangeMetricsCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -2242,7 +2242,7 @@ void LLVOAvatarSelf::appearanceChangeMetricsCoro(std::string url) gPendingMetricsUploads++; - LLSD result = httpAdapter->postAndYield(httpRequest, url, msg); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, msg); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -2347,7 +2347,7 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() { LLCoros::instance().launch("LLVOAvatarSelf::appearanceChangeMetricsCoro", - boost::bind(&LLVOAvatarSelf::appearanceChangeMetricsCoro, this, caps_url)); + boost::bind(&LLVOAvatarSelf::appearanceChangeMetricsCoro, this, _1, caps_url)); mTimeSinceLastRezMessage.reset(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index d32c959fb5..b3b5fe6c2f 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -402,7 +402,7 @@ private: F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void appearanceChangeMetricsCoro(std::string url); + void appearanceChangeMetricsCoro(LLCoros::self& self, std::string url); bool mInitialMetric; S32 mMetricSequence; /** Diagnostics diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 192d50ae9b..338201aab1 100755 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -481,7 +481,7 @@ void LLVoiceChannelGroup::getChannelInfo() std::string url = region->getCapability("ChatSessionRequest"); LLCoros::instance().launch("LLVoiceChannelGroup::voiceCallCapCoro", - boost::bind(&LLVoiceChannelGroup::voiceCallCapCoro, this, url)); + boost::bind(&LLVoiceChannelGroup::voiceCallCapCoro, this, _1, url)); } } @@ -604,7 +604,7 @@ void LLVoiceChannelGroup::setState(EState state) } } -void LLVoiceChannelGroup::voiceCallCapCoro(std::string url) +void LLVoiceChannelGroup::voiceCallCapCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -617,7 +617,7 @@ void LLVoiceChannelGroup::voiceCallCapCoro(std::string url) LL_INFOS("Voice", "voiceCallCapCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index ef15b2c79e..0dac0b1f6a 100755 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -159,7 +159,7 @@ protected: virtual void setState(EState state); private: - void voiceCallCapCoro(std::string url); + void voiceCallCapCoro(LLCoros::self& self, std::string url); U32 mRetries; BOOL mIsRetrying; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index f50ffdeae7..c70ce5801d 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -446,13 +446,13 @@ void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries) if ( !url.empty() ) { LLCoros::instance().launch("LLVivoxVoiceClient::voiceAccountProvisionCoro", - boost::bind(&LLVivoxVoiceClient::voiceAccountProvisionCoro, this, url, retries)); + boost::bind(&LLVivoxVoiceClient::voiceAccountProvisionCoro, this, _1, url, retries)); setState(stateConnectorStart); } } } -void LLVivoxVoiceClient::voiceAccountProvisionCoro(std::string url, S32 retries) +void LLVivoxVoiceClient::voiceAccountProvisionCoro(LLCoros::self& self, std::string url, S32 retries) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -462,7 +462,7 @@ void LLVivoxVoiceClient::voiceAccountProvisionCoro(std::string url, S32 retries) httpOpts->setRetries(retries); - LLSD result = httpAdapter->postAndYield(httpRequest, url, LLSD(), httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, LLSD(), httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -3928,12 +3928,12 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo() LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL; LLCoros::instance().launch("LLVivoxVoiceClient::parcelVoiceInfoRequestCoro", - boost::bind(&LLVivoxVoiceClient::parcelVoiceInfoRequestCoro, this, url)); + boost::bind(&LLVivoxVoiceClient::parcelVoiceInfoRequestCoro, this, _1, url)); return true; } } -void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(std::string url) +void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -3941,7 +3941,7 @@ void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(std::string url) LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); state requestingState = getState(); - LLSD result = httpAdapter->postAndYield(httpRequest, url, LLSD()); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, LLSD()); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index b12ed80e41..a3cdb342e2 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -637,8 +637,8 @@ protected: private: - void voiceAccountProvisionCoro(std::string url, S32 retries); - void parcelVoiceInfoRequestCoro(std::string url); + void voiceAccountProvisionCoro(LLCoros::self& self, std::string url, S32 retries); + void parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string url); LLVoiceVersionInfo mVoiceVersion; diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp index 2033a5f36a..62ba40ca32 100755 --- a/indra/newview/llwebprofile.cpp +++ b/indra/newview/llwebprofile.cpp @@ -67,7 +67,7 @@ LLWebProfile::status_callback_t LLWebProfile::mStatusCallback; void LLWebProfile::uploadImage(LLPointer<LLImageFormatted> image, const std::string& caption, bool add_location) { LLCoros::instance().launch("LLWebProfile::uploadImageCoro", - boost::bind(&LLWebProfile::uploadImageCoro, image, caption, add_location)); + boost::bind(&LLWebProfile::uploadImageCoro, _1, image, caption, add_location)); } @@ -95,7 +95,7 @@ LLCore::HttpHeaders::ptr_t LLWebProfile::buildDefaultHeaders() /*static*/ -void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::string caption, bool addLocation) +void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string caption, bool addLocation) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -124,7 +124,7 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin httpHeaders = buildDefaultHeaders(); httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie()); - LLSD result = httpAdapter->getJsonAndYield(httpRequest, configUrl, httpOpts, httpHeaders); + LLSD result = httpAdapter->getJsonAndYield(self, httpRequest, configUrl, httpOpts, httpHeaders); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -150,7 +150,7 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin LLCore::BufferArray::ptr_t body = LLWebProfile::buildPostData(data, image, boundary); - result = httpAdapter->postAndYield(httpRequest, uploadUrl, body, httpOpts, httpHeaders); + result = httpAdapter->postAndYield(self, httpRequest, uploadUrl, body, httpOpts, httpHeaders); body.reset(); httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -178,7 +178,7 @@ void LLWebProfile::uploadImageCoro(LLPointer<LLImageFormatted> image, std::strin LL_DEBUGS("Snapshots") << "Got redirection URL: " << redirUrl << LL_ENDL; - result = httpAdapter->getRawAndYield(httpRequest, redirUrl, httpOpts, httpHeaders); + result = httpAdapter->getRawAndYield(self, httpRequest, redirUrl, httpOpts, httpHeaders); httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/newview/llwebprofile.h b/indra/newview/llwebprofile.h index 6227e00afe..604ef7aff7 100755 --- a/indra/newview/llwebprofile.h +++ b/indra/newview/llwebprofile.h @@ -60,7 +60,7 @@ public: private: static LLCore::HttpHeaders::ptr_t buildDefaultHeaders(); - static void uploadImageCoro(LLPointer<LLImageFormatted> image, std::string caption, bool add_location); + static void uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatted> image, std::string caption, bool add_location); static LLCore::BufferArray::ptr_t buildPostData(const LLSD &data, LLPointer<LLImageFormatted> &image, const std::string &boundary); static void reportImageUploadStatus(bool ok); diff --git a/indra/newview/llwlhandlers.cpp b/indra/newview/llwlhandlers.cpp index ff15afa598..3145c3f38d 100755 --- a/indra/newview/llwlhandlers.cpp +++ b/indra/newview/llwlhandlers.cpp @@ -84,7 +84,7 @@ bool LLEnvironmentRequest::doRequest() std::string coroname = LLCoros::instance().launch("LLEnvironmentRequest::environmentRequestCoro", - boost::bind(&LLEnvironmentRequest::environmentRequestCoro, url)); + boost::bind(&LLEnvironmentRequest::environmentRequestCoro, _1, url)); LL_INFOS("WindlightCaps") << "Requesting region windlight settings via " << url << LL_ENDL; return true; @@ -93,7 +93,7 @@ bool LLEnvironmentRequest::doRequest() S32 LLEnvironmentRequest::sLastRequest = 0; //static -void LLEnvironmentRequest::environmentRequestCoro(std::string url) +void LLEnvironmentRequest::environmentRequestCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); S32 requestId = ++LLEnvironmentRequest::sLastRequest; @@ -101,7 +101,7 @@ void LLEnvironmentRequest::environmentRequestCoro(std::string url) httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EnvironmentRequest", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); if (requestId != LLEnvironmentRequest::sLastRequest) { @@ -174,18 +174,18 @@ bool LLEnvironmentApply::initiateRequest(const LLSD& content) std::string coroname = LLCoros::instance().launch("LLEnvironmentApply::environmentApplyCoro", - boost::bind(&LLEnvironmentApply::environmentApplyCoro, url, content)); + boost::bind(&LLEnvironmentApply::environmentApplyCoro, _1, url, content)); return true; } -void LLEnvironmentApply::environmentApplyCoro(std::string url, LLSD content) +void LLEnvironmentApply::environmentApplyCoro(LLCoros::self& self, std::string url, LLSD content) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("EnvironmentApply", httpPolicy)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLSD result = httpAdapter->postAndYield(httpRequest, url, content); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, content); LLSD notify; // for error reporting. If there is something to report to user this will be defined. /* diff --git a/indra/newview/llwlhandlers.h b/indra/newview/llwlhandlers.h index eb2bbf9553..0b778901ad 100755 --- a/indra/newview/llwlhandlers.h +++ b/indra/newview/llwlhandlers.h @@ -41,7 +41,7 @@ private: static void onRegionCapsReceived(const LLUUID& region_id); static bool doRequest(); - static void environmentRequestCoro(std::string url); + static void environmentRequestCoro(LLCoros::self& self, std::string url); static S32 sLastRequest; }; @@ -57,7 +57,7 @@ private: static clock_t sLastUpdate; static clock_t UPDATE_WAIT_SECONDS; - static void environmentApplyCoro(std::string url, LLSD content); + static void environmentApplyCoro(LLCoros::self& self, std::string url, LLSD content); }; #endif // LL_LLWLHANDLERS_H diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 0569e9f3e8..b8408a6fb4 100755 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -107,8 +107,9 @@ private: } // In a coroutine's top-level function args, do NOT NOT NOT accept - // references (const or otherwise) to anything! Pass by value only! - void login_(std::string uri, LLSD credentials); + // references (const or otherwise) to anything but the self argument! Pass + // by value only! + void login_(LLCoros::self& self, std::string uri, LLSD credentials); LLEventStream mPump; LLSD mAuthResponse, mValidAuthResponse; @@ -122,11 +123,11 @@ void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params) // its first wait; at that point, return here. std::string coroname = LLCoros::instance().launch("LLLogin::Impl::login_", - boost::bind(&Impl::login_, this, uri, login_params)); + boost::bind(&Impl::login_, this, _1, uri, login_params)); LL_DEBUGS("LLLogin") << " connected with uri '" << uri << "', login_params " << login_params << LL_ENDL; } -void LLLogin::Impl::login_(std::string uri, LLSD login_params) +void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params) { try { @@ -136,7 +137,7 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params) //{ // printable_params["params"]["passwd"] = "*******"; //} - LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName() + LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self) << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL; // Arriving in SRVRequest state @@ -175,7 +176,7 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params) request["op"] = "rewriteURI"; request["uri"] = uri; request["reply"] = replyPump.getName(); - rewrittenURIs = postAndWait(request, srv_pump_name, filter); + rewrittenURIs = postAndWait(self, request, srv_pump_name, filter); // EXP-772: If rewrittenURIs fail, try original URI as a fallback. rewrittenURIs.append(uri); } // we no longer need the filter @@ -221,10 +222,10 @@ void LLLogin::Impl::login_(std::string uri, LLSD login_params) // returns. Subsequent responses, of course, must be awaited // without posting again. for (mAuthResponse = validateResponse(loginReplyPump.getName(), - postAndWait(request, xmlrpcPump, loginReplyPump, "reply")); + postAndWait(self, request, xmlrpcPump, loginReplyPump, "reply")); mAuthResponse["status"].asString() == "Downloading"; mAuthResponse = validateResponse(loginReplyPump.getName(), - waitForEventOn(loginReplyPump))) + waitForEventOn(self, loginReplyPump))) { // Still Downloading -- send progress update. sendProgressEvent("offline", "downloading"); diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index e889f83aa9..29cb238892 100755 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -117,7 +117,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase, LL_INFOS("UpdaterService") << "checking for updates at " << checkUrl << LL_ENDL; LLCoros::instance().launch("LLUpdateChecker::Implementation::checkVersionCoro", - boost::bind(&Implementation::checkVersionCoro, this, checkUrl)); + boost::bind(&Implementation::checkVersionCoro, this, _1, checkUrl)); } else @@ -126,7 +126,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase, } } -void LLUpdateChecker::Implementation::checkVersionCoro(std::string url) +void LLUpdateChecker::Implementation::checkVersionCoro(LLCoros::self& self, std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -135,7 +135,7 @@ void LLUpdateChecker::Implementation::checkVersionCoro(std::string url) LL_INFOS("checkVersionCoro") << "Getting update information from " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index d10ea4cf42..e5050bb952 100755 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -106,7 +106,7 @@ private: unsigned char uniqueid[MD5HEX_STR_SIZE], bool willing_to_test); - void checkVersionCoro(std::string url); + void checkVersionCoro(LLCoros::self& self, std::string url); LOG_CLASS(LLUpdateChecker::Implementation); }; |