diff options
32 files changed, 903 insertions, 254 deletions
diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index e524c88cf8..89f8b44569 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -96,11 +96,14 @@ void LLPluginMessagePipeOwner::killMessagePipe(void) } } -LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket) +LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket): + mInputMutex(gAPRPoolp), + mOutputMutex(gAPRPoolp), + mOwner(owner), + mSocket(socket) { - mOwner = owner; + mOwner->setMessagePipe(this); - mSocket = socket; } LLPluginMessagePipe::~LLPluginMessagePipe() @@ -114,6 +117,7 @@ LLPluginMessagePipe::~LLPluginMessagePipe() bool LLPluginMessagePipe::addMessage(const std::string &message) { // queue the message for later output + LLMutexLock lock(&mOutputMutex); mOutput += message; mOutput += MESSAGE_DELIMITER; // message separator @@ -149,6 +153,18 @@ void LLPluginMessagePipe::setSocketTimeout(apr_interval_time_t timeout_usec) bool LLPluginMessagePipe::pump(F64 timeout) { + bool result = pumpOutput(); + + if(result) + { + result = pumpInput(timeout); + } + + return result; +} + +bool LLPluginMessagePipe::pumpOutput() +{ bool result = true; if(mSocket) @@ -156,6 +172,7 @@ bool LLPluginMessagePipe::pump(F64 timeout) apr_status_t status; apr_size_t size; + LLMutexLock lock(&mOutputMutex); if(!mOutput.empty()) { // write any outgoing messages @@ -183,6 +200,17 @@ bool LLPluginMessagePipe::pump(F64 timeout) // remove the written part from the buffer and try again later. mOutput = mOutput.substr(size); } + else if(APR_STATUS_IS_EOF(status)) + { + // This is what we normally expect when a plugin exits. + llinfos << "Got EOF from plugin socket. " << llendl; + + if(mOwner) + { + mOwner->socketError(status); + } + result = false; + } else { // some other error @@ -196,6 +224,19 @@ bool LLPluginMessagePipe::pump(F64 timeout) result = false; } } + } + + return result; +} + +bool LLPluginMessagePipe::pumpInput(F64 timeout) +{ + bool result = true; + + if(mSocket) + { + apr_status_t status; + apr_size_t size; // FIXME: For some reason, the apr timeout stuff isn't working properly on windows. // Until such time as we figure out why, don't try to use the socket timeout -- just sleep here instead. @@ -216,8 +257,16 @@ bool LLPluginMessagePipe::pump(F64 timeout) char input_buf[1024]; apr_size_t request_size; - // Start out by reading one byte, so that any data received will wake us up. - request_size = 1; + if(timeout == 0.0f) + { + // If we have no timeout, start out with a full read. + request_size = sizeof(input_buf); + } + else + { + // Start out by reading one byte, so that any data received will wake us up. + request_size = 1; + } // and use the timeout so we'll sleep if no data is available. setSocketTimeout((apr_interval_time_t)(timeout * 1000000)); @@ -236,11 +285,14 @@ bool LLPluginMessagePipe::pump(F64 timeout) // LL_INFOS("Plugin") << "after apr_socket_recv, size = " << size << LL_ENDL; if(size > 0) + { + LLMutexLock lock(&mInputMutex); mInput.append(input_buf, size); + } if(status == APR_SUCCESS) { -// llinfos << "success, read " << size << llendl; + LL_DEBUGS("PluginSocket") << "success, read " << size << LL_ENDL; if(size != request_size) { @@ -250,16 +302,28 @@ bool LLPluginMessagePipe::pump(F64 timeout) } else if(APR_STATUS_IS_TIMEUP(status)) { -// llinfos << "TIMEUP, read " << size << llendl; + LL_DEBUGS("PluginSocket") << "TIMEUP, read " << size << LL_ENDL; // Timeout was hit. Since the initial read is 1 byte, this should never be a partial read. break; } else if(APR_STATUS_IS_EAGAIN(status)) { -// llinfos << "EAGAIN, read " << size << llendl; + LL_DEBUGS("PluginSocket") << "EAGAIN, read " << size << LL_ENDL; - // We've been doing partial reads, and we're done now. + // Non-blocking read returned immediately. + break; + } + else if(APR_STATUS_IS_EOF(status)) + { + // This is what we normally expect when a plugin exits. + LL_INFOS("PluginSocket") << "Got EOF from plugin socket. " << LL_ENDL; + + if(mOwner) + { + mOwner->socketError(status); + } + result = false; break; } else @@ -276,22 +340,18 @@ bool LLPluginMessagePipe::pump(F64 timeout) break; } - // Second and subsequent reads should not use the timeout - setSocketTimeout(0); - // and should try to fill the input buffer - request_size = sizeof(input_buf); + if(timeout != 0.0f) + { + // Second and subsequent reads should not use the timeout + setSocketTimeout(0); + // and should try to fill the input buffer + request_size = sizeof(input_buf); + } } processInput(); } } - - if(!result) - { - // If we got an error, we're done. - LL_INFOS("Plugin") << "Error from socket, cleaning up." << LL_ENDL; - delete this; - } return result; } @@ -300,6 +360,7 @@ void LLPluginMessagePipe::processInput(void) { // Look for input delimiter(s) in the input buffer. int delim; + mInputMutex.lock(); while((delim = mInput.find(MESSAGE_DELIMITER)) != std::string::npos) { // Let the owner process this message @@ -310,12 +371,15 @@ void LLPluginMessagePipe::processInput(void) // and this guarantees that the messages will get dequeued correctly. std::string message(mInput, 0, delim); mInput.erase(0, delim + 1); + mInputMutex.unlock(); mOwner->receiveMessageRaw(message); + mInputMutex.lock(); } else { LL_WARNS("Plugin") << "!mOwner" << LL_ENDL; } } + mInputMutex.unlock(); } diff --git a/indra/llplugin/llpluginmessagepipe.h b/indra/llplugin/llpluginmessagepipe.h index 1ddb38de68..1b0a08254b 100644 --- a/indra/llplugin/llpluginmessagepipe.h +++ b/indra/llplugin/llpluginmessagepipe.h @@ -35,6 +35,7 @@ #define LL_LLPLUGINMESSAGEPIPE_H #include "lliosocket.h" +#include "llthread.h" class LLPluginMessagePipe; @@ -51,7 +52,7 @@ public: virtual apr_status_t socketError(apr_status_t error); // called from LLPluginMessagePipe to manage the connection with LLPluginMessagePipeOwner -- do not use! - virtual void setMessagePipe(LLPluginMessagePipe *message_pipe) ; + virtual void setMessagePipe(LLPluginMessagePipe *message_pipe); protected: // returns false if writeMessageRaw() would drop the message @@ -76,14 +77,18 @@ public: void clearOwner(void); bool pump(F64 timeout = 0.0f); - + bool pumpOutput(); + bool pumpInput(F64 timeout = 0.0f); + protected: void processInput(void); // used internally by pump() void setSocketTimeout(apr_interval_time_t timeout_usec); + LLMutex mInputMutex; std::string mInput; + LLMutex mOutputMutex; std::string mOutput; LLPluginMessagePipeOwner *mOwner; diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp index 2d078cd6ed..d1cf91b253 100644 --- a/indra/llplugin/llpluginprocesschild.cpp +++ b/indra/llplugin/llpluginprocesschild.cpp @@ -85,9 +85,14 @@ void LLPluginProcessChild::idle(void) bool idle_again; do { - if(mSocketError != APR_SUCCESS) + if(APR_STATUS_IS_EOF(mSocketError)) { - LL_INFOS("Plugin") << "message pipe is in error state, moving to STATE_ERROR"<< LL_ENDL; + // Plugin socket was closed. This covers both normal plugin termination and host crashes. + setState(STATE_ERROR); + } + else if(mSocketError != APR_SUCCESS) + { + LL_INFOS("Plugin") << "message pipe is in error state (" << mSocketError << "), moving to STATE_ERROR"<< LL_ENDL; setState(STATE_ERROR); } diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index e273410a1d..3589b22a77 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -45,8 +45,51 @@ LLPluginProcessParentOwner::~LLPluginProcessParentOwner() } -LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) +bool LLPluginProcessParent::sUseReadThread = false; +apr_pollset_t *LLPluginProcessParent::sPollSet = NULL; +bool LLPluginProcessParent::sPollsetNeedsRebuild = false; +LLMutex *LLPluginProcessParent::sInstancesMutex; +std::list<LLPluginProcessParent*> LLPluginProcessParent::sInstances; +LLThread *LLPluginProcessParent::sReadThread = NULL; + + +class LLPluginProcessParentPollThread: public LLThread { +public: + LLPluginProcessParentPollThread() : + LLThread("LLPluginProcessParentPollThread", gAPRPoolp) + { + } +protected: + // Inherited from LLThread + /*virtual*/ void run(void) + { + while(!isQuitting() && LLPluginProcessParent::getUseReadThread()) + { + LLPluginProcessParent::poll(0.1f); + checkPause(); + } + + // Final poll to clean up the pollset, etc. + LLPluginProcessParent::poll(0.0f); + } + + // Inherited from LLThread + /*virtual*/ bool runCondition(void) + { + return(LLPluginProcessParent::canPollThreadRun()); + } + +}; + +LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner): + mIncomingQueueMutex(gAPRPoolp) +{ + if(!sInstancesMutex) + { + sInstancesMutex = new LLMutex(gAPRPoolp); + } + mOwner = owner; mBoundPort = 0; mState = STATE_UNINITIALIZED; @@ -55,18 +98,36 @@ LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner) mDisableTimeout = false; mDebug = false; mBlocked = false; + mPolledInput = false; + mPollFD.client_data = NULL; mPluginLaunchTimeout = 60.0f; mPluginLockupTimeout = 15.0f; // Don't start the timer here -- start it when we actually launch the plugin process. mHeartbeat.stop(); + + // Don't add to the global list until fully constructed. + { + LLMutexLock lock(sInstancesMutex); + sInstances.push_back(this); + } } LLPluginProcessParent::~LLPluginProcessParent() { LL_DEBUGS("Plugin") << "destructor" << LL_ENDL; + // Remove from the global list before beginning destruction. + { + // Make sure to get the global mutex _first_ here, to avoid a possible deadlock against LLPluginProcessParent::poll() + LLMutexLock lock(sInstancesMutex); + { + LLMutexLock lock2(&mIncomingQueueMutex); + sInstances.remove(this); + } + } + // Destroy any remaining shared memory regions sharedMemoryRegionsType::iterator iter; while((iter = mSharedMemoryRegions.begin()) != mSharedMemoryRegions.end()) @@ -78,15 +139,17 @@ LLPluginProcessParent::~LLPluginProcessParent() mSharedMemoryRegions.erase(iter); } - // orphaning the process means it won't be killed when the LLProcessLauncher is destructed. - // This is what we want -- it should exit cleanly once it notices the sockets have been closed. - mProcess.orphan(); + mProcess.kill(); killSockets(); } void LLPluginProcessParent::killSockets(void) { - killMessagePipe(); + { + LLMutexLock lock(&mIncomingQueueMutex); + killMessagePipe(); + } + mListenSocket.reset(); mSocket.reset(); } @@ -160,21 +223,47 @@ void LLPluginProcessParent::idle(void) do { + // process queued messages + mIncomingQueueMutex.lock(); + while(!mIncomingQueue.empty()) + { + LLPluginMessage message = mIncomingQueue.front(); + mIncomingQueue.pop(); + mIncomingQueueMutex.unlock(); + + receiveMessage(message); + + mIncomingQueueMutex.lock(); + } + + mIncomingQueueMutex.unlock(); + // Give time to network processing if(mMessagePipe) { - if(!mMessagePipe->pump()) + // Drain any queued outgoing messages + mMessagePipe->pumpOutput(); + + // Only do input processing here if this instance isn't in a pollset. + if(!mPolledInput) { -// LL_WARNS("Plugin") << "Message pipe hit an error state" << LL_ENDL; - errorState(); + mMessagePipe->pumpInput(); } } - - if((mSocketError != APR_SUCCESS) && (mState <= STATE_RUNNING)) + + if(mState <= STATE_RUNNING) { - // The socket is in an error state -- the plugin is gone. - LL_WARNS("Plugin") << "Socket hit an error state (" << mSocketError << ")" << LL_ENDL; - errorState(); + if(APR_STATUS_IS_EOF(mSocketError)) + { + // Plugin socket was closed. This covers both normal plugin termination and plugin crashes. + errorState(); + } + else if(mSocketError != APR_SUCCESS) + { + // The socket is in an error state -- the plugin is gone. + LL_WARNS("Plugin") << "Socket hit an error state (" << mSocketError << ")" << LL_ENDL; + errorState(); + } } // If a state needs to go directly to another state (as a performance enhancement), it can set idle_again to true after calling setState(). @@ -355,7 +444,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_HELLO: - LL_DEBUGS("Plugin") << "received hello message" << llendl; + LL_DEBUGS("Plugin") << "received hello message" << LL_ENDL; // Send the message to load the plugin { @@ -389,7 +478,7 @@ void LLPluginProcessParent::idle(void) } else if(pluginLockedUp()) { - LL_WARNS("Plugin") << "timeout in exiting state, bailing out" << llendl; + LL_WARNS("Plugin") << "timeout in exiting state, bailing out" << LL_ENDL; errorState(); } break; @@ -411,8 +500,7 @@ void LLPluginProcessParent::idle(void) break; case STATE_CLEANUP: - // Don't do a kill here anymore -- closing the sockets is the new 'kill'. - mProcess.orphan(); + mProcess.kill(); killSockets(); setState(STATE_DONE); break; @@ -491,29 +579,317 @@ void LLPluginProcessParent::sendMessage(const LLPluginMessage &message) std::string buffer = message.generate(); LL_DEBUGS("Plugin") << "Sending: " << buffer << LL_ENDL; writeMessageRaw(buffer); + + // Try to send message immediately. + if(mMessagePipe) + { + mMessagePipe->pumpOutput(); + } +} + +//virtual +void LLPluginProcessParent::setMessagePipe(LLPluginMessagePipe *message_pipe) +{ + bool update_pollset = false; + + if(mMessagePipe) + { + // Unsetting an existing message pipe -- remove from the pollset + mPollFD.client_data = NULL; + + // pollset needs an update + update_pollset = true; + } + if(message_pipe != NULL) + { + // Set up the apr_pollfd_t + mPollFD.p = gAPRPoolp; + mPollFD.desc_type = APR_POLL_SOCKET; + mPollFD.reqevents = APR_POLLIN|APR_POLLERR|APR_POLLHUP; + mPollFD.rtnevents = 0; + mPollFD.desc.s = mSocket->getSocket(); + mPollFD.client_data = (void*)this; + + // pollset needs an update + update_pollset = true; + } + + mMessagePipe = message_pipe; + + if(update_pollset) + { + dirtyPollSet(); + } +} + +//static +void LLPluginProcessParent::dirtyPollSet() +{ + sPollsetNeedsRebuild = true; + + if(sReadThread) + { + LL_DEBUGS("PluginPoll") << "unpausing read thread " << LL_ENDL; + sReadThread->unpause(); + } +} + +void LLPluginProcessParent::updatePollset() +{ + if(!sInstancesMutex) + { + // No instances have been created yet. There's no work to do. + return; + } + + LLMutexLock lock(sInstancesMutex); + + if(sPollSet) + { + LL_DEBUGS("PluginPoll") << "destroying pollset " << sPollSet << LL_ENDL; + // delete the existing pollset. + apr_pollset_destroy(sPollSet); + sPollSet = NULL; + } + + std::list<LLPluginProcessParent*>::iterator iter; + int count = 0; + + // Count the number of instances that want to be in the pollset + for(iter = sInstances.begin(); iter != sInstances.end(); iter++) + { + (*iter)->mPolledInput = false; + if((*iter)->mPollFD.client_data) + { + // This instance has a socket that needs to be polled. + ++count; + } + } + + if(sUseReadThread && sReadThread && !sReadThread->isQuitting()) + { + if(!sPollSet && (count > 0)) + { +#ifdef APR_POLLSET_NOCOPY + // The pollset doesn't exist yet. Create it now. + apr_status_t status = apr_pollset_create(&sPollSet, count, gAPRPoolp, APR_POLLSET_NOCOPY); + if(status != APR_SUCCESS) + { +#endif // APR_POLLSET_NOCOPY + LL_WARNS("PluginPoll") << "Couldn't create pollset. Falling back to non-pollset mode." << LL_ENDL; + sPollSet = NULL; +#ifdef APR_POLLSET_NOCOPY + } + else + { + LL_DEBUGS("PluginPoll") << "created pollset " << sPollSet << LL_ENDL; + + // Pollset was created, add all instances to it. + for(iter = sInstances.begin(); iter != sInstances.end(); iter++) + { + if((*iter)->mPollFD.client_data) + { + status = apr_pollset_add(sPollSet, &((*iter)->mPollFD)); + if(status == APR_SUCCESS) + { + (*iter)->mPolledInput = true; + } + else + { + LL_WARNS("PluginPoll") << "apr_pollset_add failed with status " << status << LL_ENDL; + } + } + } + } +#endif // APR_POLLSET_NOCOPY + } + } +} + +void LLPluginProcessParent::setUseReadThread(bool use_read_thread) +{ + if(sUseReadThread != use_read_thread) + { + sUseReadThread = use_read_thread; + + if(sUseReadThread) + { + if(!sReadThread) + { + // start up the read thread + LL_INFOS("PluginPoll") << "creating read thread " << LL_ENDL; + + // make sure the pollset gets rebuilt. + sPollsetNeedsRebuild = true; + + sReadThread = new LLPluginProcessParentPollThread; + sReadThread->start(); + } + } + else + { + if(sReadThread) + { + // shut down the read thread + LL_INFOS("PluginPoll") << "destroying read thread " << LL_ENDL; + delete sReadThread; + sReadThread = NULL; + } + } + + } +} + +void LLPluginProcessParent::poll(F64 timeout) +{ + if(sPollsetNeedsRebuild || !sUseReadThread) + { + sPollsetNeedsRebuild = false; + updatePollset(); + } + + if(sPollSet) + { + apr_status_t status; + apr_int32_t count; + const apr_pollfd_t *descriptors; + status = apr_pollset_poll(sPollSet, (apr_interval_time_t)(timeout * 1000000), &count, &descriptors); + if(status == APR_SUCCESS) + { + // One or more of the descriptors signalled. Call them. + for(int i = 0; i < count; i++) + { + LLPluginProcessParent *self = (LLPluginProcessParent *)(descriptors[i].client_data); + // NOTE: the descriptor returned here is actually a COPY of the original (even though we create the pollset with APR_POLLSET_NOCOPY). + // This means that even if the parent has set its mPollFD.client_data to NULL, the old pointer may still there in this descriptor. + // It's even possible that the old pointer no longer points to a valid LLPluginProcessParent. + // This means that we can't safely dereference the 'self' pointer here without some extra steps... + if(self) + { + // Make sure this pointer is still in the instances list + bool valid = false; + { + LLMutexLock lock(sInstancesMutex); + for(std::list<LLPluginProcessParent*>::iterator iter = sInstances.begin(); iter != sInstances.end(); ++iter) + { + if(*iter == self) + { + // Lock the instance's mutex before unlocking the global mutex. + // This avoids a possible race condition where the instance gets deleted between this check and the servicePoll() call. + self->mIncomingQueueMutex.lock(); + valid = true; + break; + } + } + } + + if(valid) + { + // The instance is still valid. + // Pull incoming messages off the socket + self->servicePoll(); + self->mIncomingQueueMutex.unlock(); + } + else + { + LL_DEBUGS("PluginPoll") << "detected deleted instance " << self << LL_ENDL; + } + + } + } + } + else if(APR_STATUS_IS_TIMEUP(status)) + { + // timed out with no incoming data. Just return. + } + else if(status == EBADF) + { + // This happens when one of the file descriptors in the pollset is destroyed, which happens whenever a plugin's socket is closed. + // The pollset has been or will be recreated, so just return. + LL_DEBUGS("PluginPoll") << "apr_pollset_poll returned EBADF" << LL_ENDL; + } + else if(status != APR_SUCCESS) + { + LL_WARNS("PluginPoll") << "apr_pollset_poll failed with status " << status << LL_ENDL; + } + } } +void LLPluginProcessParent::servicePoll() +{ + bool result = true; + + // poll signalled on this object's socket. Try to process incoming messages. + if(mMessagePipe) + { + result = mMessagePipe->pumpInput(0.0f); + } + + if(!result) + { + // If we got a read error on input, remove this pipe from the pollset + apr_pollset_remove(sPollSet, &mPollFD); + + // and tell the code not to re-add it + mPollFD.client_data = NULL; + } +} void LLPluginProcessParent::receiveMessageRaw(const std::string &message) { LL_DEBUGS("Plugin") << "Received: " << message << LL_ENDL; - - // FIXME: should this go into a queue instead? LLPluginMessage parsed; if(parsed.parse(message) != -1) { - receiveMessage(parsed); + if(parsed.hasValue("blocking_request")) + { + mBlocked = true; + } + + if(mPolledInput) + { + // This is being called on the polling thread -- only do minimal processing/queueing. + receiveMessageEarly(parsed); + } + else + { + // This is not being called on the polling thread -- do full message processing at this time. + receiveMessage(parsed); + } } } -void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) +void LLPluginProcessParent::receiveMessageEarly(const LLPluginMessage &message) { - if(message.hasValue("blocking_request")) + // NOTE: this function will be called from the polling thread. It will be called with mIncomingQueueMutex _already locked_. + + bool handled = false; + + std::string message_class = message.getClass(); + if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL) + { + // no internal messages need to be handled early. + } + else { - mBlocked = true; + // Call out to the owner and see if they to reply + // TODO: Should this only happen when blocked? + if(mOwner != NULL) + { + handled = mOwner->receivePluginMessageEarly(message); + } } + + if(!handled) + { + // any message that wasn't handled early needs to be queued. + mIncomingQueue.push(message); + } +} +void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message) +{ std::string message_class = message.getClass(); if(message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL) { @@ -704,12 +1080,12 @@ bool LLPluginProcessParent::pluginLockedUpOrQuit() if(!mProcess.isRunning()) { - LL_WARNS("Plugin") << "child exited" << llendl; + LL_WARNS("Plugin") << "child exited" << LL_ENDL; result = true; } else if(pluginLockedUp()) { - LL_WARNS("Plugin") << "timeout" << llendl; + LL_WARNS("Plugin") << "timeout" << LL_ENDL; result = true; } diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index 31f125bfb3..4dff835b6a 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -41,12 +41,14 @@ #include "llpluginsharedmemory.h" #include "lliosocket.h" +#include "llthread.h" class LLPluginProcessParentOwner { public: virtual ~LLPluginProcessParentOwner(); virtual void receivePluginMessage(const LLPluginMessage &message) = 0; + virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;}; // This will only be called when the plugin has died unexpectedly virtual void pluginLaunchFailed() {}; virtual void pluginDied() {}; @@ -90,7 +92,9 @@ public: void receiveMessage(const LLPluginMessage &message); // Inherited from LLPluginMessagePipeOwner - void receiveMessageRaw(const std::string &message); + /*virtual*/ void receiveMessageRaw(const std::string &message); + /*virtual*/ void receiveMessageEarly(const LLPluginMessage &message); + /*virtual*/ void setMessagePipe(LLPluginMessagePipe *message_pipe) ; // This adds a memory segment shared with the client, generating a name for the segment. The name generated is guaranteed to be unique on the host. // The caller must call removeSharedMemory first (and wait until getSharedMemorySize returns 0 for the indicated name) before re-adding a segment with the same name. @@ -113,7 +117,11 @@ public: void setLockupTimeout(F32 timeout) { mPluginLockupTimeout = timeout; }; F64 getCPUUsage() { return mCPUUsage; }; - + + static void poll(F64 timeout); + static bool canPollThreadRun() { return (sPollSet || sPollsetNeedsRebuild || sUseReadThread); }; + static void setUseReadThread(bool use_read_thread); + static bool getUseReadThread() { return sUseReadThread; }; private: enum EState @@ -164,12 +172,26 @@ private: bool mDisableTimeout; bool mDebug; bool mBlocked; + bool mPolledInput; LLProcessLauncher mDebugger; F32 mPluginLaunchTimeout; // Somewhat longer timeout for initial launch. F32 mPluginLockupTimeout; // If we don't receive a heartbeat in this many seconds, we declare the plugin locked up. + static bool sUseReadThread; + apr_pollfd_t mPollFD; + static apr_pollset_t *sPollSet; + static bool sPollsetNeedsRebuild; + static LLMutex *sInstancesMutex; + static std::list<LLPluginProcessParent*> sInstances; + static void dirtyPollSet(); + static void updatePollset(); + void servicePoll(); + static LLThread *sReadThread; + + LLMutex mIncomingQueueMutex; + std::queue<LLPluginMessage> mIncomingQueue; }; #endif // LL_LLPLUGINPROCESSPARENT_H diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp index 9788f10a58..38727e5965 100644 --- a/indra/media_plugins/webkit/mac_volume_catcher.cpp +++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp @@ -1,5 +1,5 @@ /** - * @file dummy_volume_catcher.cpp + * @file mac_volume_catcher.cpp * @brief A Mac OS X specific hack to control the volume level of all audio channels opened by a process. * * @cond @@ -98,7 +98,7 @@ VolumeCatcherImpl *VolumeCatcherImpl::getInstance() VolumeCatcherImpl::VolumeCatcherImpl() { mVolume = 1.0; // default to full volume - mPan = 0.5; // and center pan + mPan = 0.0; // and center pan ComponentDescription desc; desc.componentType = kAudioUnitType_Output; diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index f7df3b19a0..54bfa652e9 100644 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -144,10 +144,11 @@ extern "C" // copy volume level 4 times into 64 bit MMX register __m64 volume_64 = _mm_set_pi16(volume_16, volume_16, volume_16, volume_16); - __m64 *sample_64; + __m64* sample_64; + __m64* last_sample_64 = (__m64*)(pwh->lpData + pwh->dwBufferLength - sizeof(__m64)); // for everything that can be addressed in 64 bit multiples... for (sample_64 = (__m64*)pwh->lpData; - sample_64 < (__m64*)(pwh->lpData + pwh->dwBufferLength); + sample_64 <= last_sample_64; ++sample_64) { //...multiply the samples by the volume... diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6f11a6d616..280c3d642c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5585,6 +5585,19 @@ <key>Value</key> <integer>8</integer> </map> + + <key>PluginUseReadThread</key> + <map> + <key>Comment</key> + <string>Use a separate thread to read incoming messages from plugins</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>PrecachingDelay</key> <map> <key>Comment</key> diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2f9bbb1407..4f7c0c3549 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1530,6 +1530,9 @@ bool LLAppViewer::cleanup() LLViewerMedia::saveCookieFile(); + // Stop the plugin read thread if it's running. + LLPluginProcessParent::setUseReadThread(false); + llinfos << "Shutting down Threads" << llendflush; // Let threads finish diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index b8222ebb18..36a8031cce 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -34,10 +34,13 @@ #include "llcofwearables.h" +#include "llagentdata.h" #include "llappearancemgr.h" #include "llinventory.h" -#include "llinventoryitemslist.h" #include "llinventoryfunctions.h" +#include "llwearableitemslist.h" + +static LLRegisterPanelClassWrapper<LLCOFAccordionListAdaptor> t_cof_accodion_list_adaptor("accordion_list_adaptor"); static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearables"); @@ -89,7 +92,6 @@ void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list) onCommit(); } -#include "llwearableitemslist.h" void LLCOFWearables::refresh() { clear(); @@ -126,9 +128,10 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel } else if (item_type == LLAssetType::AT_BODYPART) { - item_panel = LLPanelBodyPartsListItem::create(item); + item_panel = buildBodypartListItem(item); + if (!item_panel) continue; + mBodyParts->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false); - addWearableTypeSeparator(mBodyParts); } } @@ -143,17 +146,69 @@ void LLCOFWearables::populateAttachmentsAndBodypartsLists(const LLInventoryModel mBodyParts->sort(); //*TODO by name } - addListButtonBar(mBodyParts, "panel_bodyparts_list_button_bar.xml"); mBodyParts->notify(REARRANGE); } +//create a clothing list item, update verbs and show/hide line separator +LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last) +{ + llassert(item); + + LLPanelClothingListItem* item_panel = LLPanelClothingListItem::create(item); + if (!item_panel) return NULL; + + //updating verbs + //we don't need to use permissions of a link but of an actual/linked item + if (item->getLinkedItem()) item = item->getLinkedItem(); + + bool allow_modify = item->getPermissions().allowModifyBy(gAgentID); + + item_panel->setShowLockButton(!allow_modify); + item_panel->setShowEditButton(allow_modify); + + item_panel->setShowMoveUpButton(!first); + item_panel->setShowMoveDownButton(!last); + + //setting callbacks + //*TODO move that item panel's inner structure disclosing stuff into the panels + item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable); + item_panel->childSetAction("btn_move_up", mCOFCallbacks.mMoveWearableCloser); + item_panel->childSetAction("btn_move_down", mCOFCallbacks.mMoveWearableFurther); + item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable); + + //turning on gray separator line for the last item in the items group of the same wearable type + item_panel->childSetVisible("wearable_type_separator_panel", last); + + return item_panel; +} + +LLPanelBodyPartsListItem* LLCOFWearables::buildBodypartListItem(LLViewerInventoryItem* item) +{ + llassert(item); + + LLPanelBodyPartsListItem* item_panel = LLPanelBodyPartsListItem::create(item); + if (!item_panel) return NULL; + + //updating verbs + //we don't need to use permissions of a link but of an actual/linked item + if (item->getLinkedItem()) item = item->getLinkedItem(); + + bool allow_modify = item->getPermissions().allowModifyBy(gAgentID); + item_panel->setShowLockButton(!allow_modify); + item_panel->setShowEditButton(allow_modify); + + //setting callbacks + //*TODO move that item panel's inner structure disclosing stuff into the panels + item_panel->childSetAction("btn_delete", mCOFCallbacks.mDeleteWearable); + item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable); + + return item_panel; +} void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type) { llassert(clothing_by_type.size() == WT_COUNT); - addListButtonBar(mClothing, "panel_clothing_list_button_bar.xml"); - for (U32 type = WT_SHIRT; type < WT_COUNT; ++type) { U32 size = clothing_by_type[type].size(); @@ -165,13 +220,11 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& { LLViewerInventoryItem* item = clothing_by_type[type][i]; - LLPanelInventoryListItemBase* item_panel = LLPanelClothingListItem::create(item); + LLPanelClothingListItem* item_panel = buildClothingListItem(item, i == 0, i == size - 1); if (!item_panel) continue; mClothing->addItem(item_panel, item->getUUID(), ADD_BOTTOM, false); } - - addWearableTypeSeparator(mClothing); } addClothingTypesDummies(clothing_by_type); @@ -179,21 +232,6 @@ void LLCOFWearables::populateClothingList(LLAppearanceMgr::wearables_by_type_t& mClothing->notify(REARRANGE); } -void LLCOFWearables::addListButtonBar(LLFlatListView* list, std::string xml_filename) -{ - llassert(list); - llassert(xml_filename.length()); - - LLPanel::Params params; - LLPanel* button_bar = LLUICtrlFactory::create<LLPanel>(params); - LLUICtrlFactory::instance().buildPanel(button_bar, xml_filename); - - LLRect rc = button_bar->getRect(); - button_bar->reshape(list->getItemsRect().getWidth(), rc.getHeight()); - - list->addItem(button_bar, LLUUID::null, ADD_TOP, false); -} - //adding dummy items for missing wearable types void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type) { @@ -208,26 +246,9 @@ void LLCOFWearables::addClothingTypesDummies(const LLAppearanceMgr::wearables_by LLPanelInventoryListItemBase* item_panel = LLPanelDummyClothingListItem::create(w_type); if(!item_panel) continue; mClothing->addItem(item_panel, LLUUID::null, ADD_BOTTOM, false); - addWearableTypeSeparator(mClothing); } } -void LLCOFWearables::addWearableTypeSeparator(LLFlatListView* list) -{ - llassert(list); - - static LLXMLNodePtr separator_xml_node = getXMLNode("panel_wearable_type_separator.xml"); - if (separator_xml_node->isNull()) return; - - LLPanel* separator = LLUICtrlFactory::defaultBuilder<LLPanel>(separator_xml_node, NULL, NULL); - - LLRect rc = separator->getRect(); - rc.setOriginAndSize(0, 0, list->getItemsRect().getWidth(), rc.getHeight()); - separator->setRect(rc); - - list->addItem(separator, LLUUID::null, ADD_BOTTOM, false); -} - LLUUID LLCOFWearables::getSelectedUUID() { if (!mLastSelectedList) return LLUUID::null; @@ -242,17 +263,4 @@ void LLCOFWearables::clear() mBodyParts->clear(); } -LLXMLNodePtr LLCOFWearables::getXMLNode(std::string xml_filename) -{ - LLXMLNodePtr xmlNode = NULL; - bool success = LLUICtrlFactory::getLayeredXMLNode(xml_filename, xmlNode); - if (!success) - { - llwarning("Failed to read xml", 0); - return NULL; - } - - return xmlNode; -} - //EOF diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index fec6d34db2..2d26bf781f 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -36,12 +36,80 @@ #include "llpanel.h" #include "llinventorymodel.h" #include "llappearancemgr.h" +#include "llwearableitemslist.h" class LLFlatListView; +/** + * Adaptor between LLAccordionCtrlTab and LLFlatListView to facilitate communication between them + * (notify, notifyParent) regarding size changes of a list and selection changes across accordion tabs. + * Besides that it acts as a container for the LLFlatListView and a button bar on top of it. + */ +class LLCOFAccordionListAdaptor : public LLPanel +{ +public: + LLCOFAccordionListAdaptor() : LLPanel() {}; + ~LLCOFAccordionListAdaptor() {}; + + S32 notifyParent(const LLSD& info) + { + LLView* parent = getParent(); + if (!parent) return -1; + + if (!(info.has("action") && "size_changes" == info["action"].asString())) + { + return parent->notifyParent(info); + } + + LLRect rc; + childGetRect("button_bar", rc); + + LLSD params; + params["action"] = "size_changes"; + params["width"] = info["width"]; + params["height"] = info["height"].asInteger() + rc.getHeight(); + + return parent->notifyParent(params); + } + + + S32 notify(const LLSD& info) + { + for (child_list_const_iter_t iter = beginChild(); iter != endChild(); iter++) + { + if (dynamic_cast<LLFlatListView*>(*iter)) + { + return (*iter)->notify(info); + } + } + return LLPanel::notify(info); + }; +}; + + class LLCOFWearables : public LLPanel { public: + + /** + * Represents a collection of callbacks assigned to inventory panel item's buttons + */ + class LLCOFCallbacks + { + public: + LLCOFCallbacks() {}; + virtual ~LLCOFCallbacks() {}; + + typedef boost::function<void (void*)> cof_callback_t; + + cof_callback_t mMoveWearableCloser; + cof_callback_t mMoveWearableFurther; + cof_callback_t mEditWearable; + cof_callback_t mDeleteWearable; + }; + + + LLCOFWearables(); virtual ~LLCOFWearables() {}; @@ -52,17 +120,18 @@ public: void refresh(); void clear(); + LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; } + protected: void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items); void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type); - void addListButtonBar(LLFlatListView* list, std::string xml_filename); void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type); - void addWearableTypeSeparator(LLFlatListView* list); void onSelectionChange(LLFlatListView* selected_list); - LLXMLNodePtr getXMLNode(std::string xml_filename); + LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last); + LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item); LLFlatListView* mAttachments; LLFlatListView* mClothing; @@ -70,6 +139,8 @@ protected: LLFlatListView* mLastSelectedList; + LLCOFCallbacks mCOFCallbacks; + }; diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 4c1e3461a5..6b7a257a4b 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1165,6 +1165,17 @@ void LLFavoritesBarCtrl::pastFromClipboard() const void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { + // EXT-6997 (Fav bar: Pop-up menu for LM in overflow dropdown is kept after LM was dragged away) + // mInventoryItemsPopupMenuHandle.get() - is a pop-up menu (of items) in already opened dropdown menu. + // We have to check and set visibility of pop-up menu in such a way instead of using + // LLMenuHolderGL::hideMenus() because it will close both menus(dropdown and pop-up), but + // we need to close only pop-up menu while dropdown one should be still opened. + LLMenuGL* menu = (LLMenuGL*)mInventoryItemsPopupMenuHandle.get(); + if(menu && menu->getVisible()) + { + menu->setVisible(FALSE); + } + mDragItemId = id; mStartDrag = TRUE; diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 95094f6b52..7cb192e026 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -145,6 +145,9 @@ std::string LLMute::getDisplayType() const case GROUP: return LLTrans::getString("MuteGroup"); break; + case EXTERNAL: + return LLTrans::getString("MuteExternal"); + break; } } @@ -303,6 +306,12 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) void LLMuteList::updateAdd(const LLMute& mute) { + // External mutes (e.g. Avaline callers) are local only, don't send them to the server. + if (mute.mType == LLMute::EXTERNAL) + { + return; + } + // Update the database LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_UpdateMuteListEntry); @@ -390,6 +399,12 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) void LLMuteList::updateRemove(const LLMute& mute) { + // External mutes are not sent to the server anyway, no need to remove them. + if (mute.mType == LLMute::EXTERNAL) + { + return; + } + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_RemoveMuteListEntry); msg->nextBlockFast(_PREHASH_AgentData); @@ -573,9 +588,14 @@ BOOL LLMuteList::saveToFile(const std::string& filename) it != mMutes.end(); ++it) { - it->mID.toString(id_string); - const std::string& name = it->mName; - fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string.c_str(), name.c_str(), it->mFlags); + // Don't save external mutes as they are not sent to the server and probably won't + //be valid next time anyway. + if (it->mType != LLMute::EXTERNAL) + { + it->mID.toString(id_string); + const std::string& name = it->mName; + fprintf(fp, "%d %s %s|%u\n", (S32)it->mType, id_string.c_str(), name.c_str(), it->mFlags); + } } fclose(fp); return TRUE; diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 7cb11e6031..79b556bdbb 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -45,7 +45,8 @@ class LLMute { public: // Legacy mutes are BY_NAME and have null UUID. - enum EType { BY_NAME = 0, AGENT = 1, OBJECT = 2, GROUP = 3, COUNT = 4 }; + // EXTERNAL mutes are only processed through an external system (e.g. Voice) and not stored. + enum EType { BY_NAME = 0, AGENT = 1, OBJECT = 2, GROUP = 3, EXTERNAL = 4, COUNT = 5 }; // Bits in the mute flags. For backwards compatibility (since any mute list entries that were created before the flags existed // will have a flags field of 0), some of the flags are "inverted". diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index c5b32e288a..daa41e1467 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -128,8 +128,6 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() mSearchFilter(NULL), mCOFWearables(NULL), mInventoryItemsPanel(NULL), - mAddToOutfitBtn(NULL), - mRemoveFromOutfitBtn(NULL), mLookObserver(NULL) { mSavedFolderState = new LLSaveFolderState(); @@ -174,13 +172,20 @@ BOOL LLPanelOutfitEdit::postBuild() mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name"); - childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL); childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL); mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list"); mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this)); + mCOFWearables->getCOFCallbacks().mEditWearable = boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this); + mCOFWearables->getCOFCallbacks().mDeleteWearable = boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this); + mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true); + mCOFWearables->getCOFCallbacks().mMoveWearableFurther = boost::bind(&LLPanelOutfitEdit::moveWearable, this, false); + + mCOFWearables->childSetAction("add_btn", boost::bind(&LLPanelOutfitEdit::toggleAddWearablesPanel, this)); + + mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); @@ -209,13 +214,6 @@ BOOL LLPanelOutfitEdit::postBuild() mAddToLookBtn->setEnabled(FALSE); mAddToLookBtn->setVisible(FALSE); */ - childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this)); - childSetEnabled("add_to_outfit_btn", false); - - mRemoveFromOutfitBtn = getChild<LLButton>("remove_from_outfit_btn"); - mRemoveFromOutfitBtn->setEnabled(FALSE); - mRemoveFromOutfitBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromOutfitClicked, this)); - mEditWearableBtn = getChild<LLButton>("edit_wearable_btn"); mEditWearableBtn->setEnabled(FALSE); mEditWearableBtn->setVisible(FALSE); @@ -233,7 +231,7 @@ BOOL LLPanelOutfitEdit::postBuild() mWearableListManager = new LLFilteredWearableListManager( getChild<LLInventoryItemsList>("filtered_wearables_list"), ALL_ITEMS_MASK); - + return TRUE; } @@ -249,9 +247,9 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body) updateLookInfo(); } -void LLPanelOutfitEdit::showAddWearablesPanel() +void LLPanelOutfitEdit::toggleAddWearablesPanel() { - childSetVisible("add_wearables_panel", childGetValue("add_btn")); + childSetVisible("add_wearables_panel", !childIsVisible("add_wearables_panel")); } void LLPanelOutfitEdit::showWearablesFilter() @@ -376,8 +374,6 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) LLAppearanceMgr::getInstance()->removeItemFromAvatar(id_to_remove); updateLookInfo(); - - mRemoveFromOutfitBtn->setEnabled(FALSE); } @@ -431,10 +427,7 @@ void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderView case LLAssetType::AT_CLOTHING: case LLAssetType::AT_BODYPART: case LLAssetType::AT_OBJECT: - childSetEnabled("add_to_outfit_btn", true); - break; default: - childSetEnabled("add_to_outfit_btn", false); break; } @@ -467,10 +460,7 @@ void LLPanelOutfitEdit::onOutfitItemSelectionChange(void) { case LLAssetType::AT_CLOTHING: case LLAssetType::AT_OBJECT: - mRemoveFromOutfitBtn->setEnabled(TRUE); - break; default: - mRemoveFromOutfitBtn->setEnabled(FALSE); break; } } diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 21fa849289..0074cd517b 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -90,7 +90,7 @@ public: void moveWearable(bool closer_to_body); - void showAddWearablesPanel(); + void toggleAddWearablesPanel(); void showWearablesFilter(); void showFilteredWearablesPanel(); void saveOutfit(bool as_new = false); @@ -122,8 +122,6 @@ private: LLFilterEditor* mSearchFilter; LLSaveFolderState* mSavedFolderState; std::string mSearchString; - LLButton* mAddToOutfitBtn; - LLButton* mRemoveFromOutfitBtn; LLButton* mEditWearableBtn; LLToggleableMenu* mSaveMenu; diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index c3748ca81d..a058548459 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -722,7 +722,21 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, name = speakerp->mDisplayName; - LLMute mute(speaker_id, name, speakerp->mType == LLSpeaker::SPEAKER_AGENT ? LLMute::AGENT : LLMute::OBJECT); + LLMute::EType mute_type; + switch (speakerp->mType) + { + case LLSpeaker::SPEAKER_AGENT: + mute_type = LLMute::AGENT; + break; + case LLSpeaker::SPEAKER_OBJECT: + mute_type = LLMute::OBJECT; + break; + case LLSpeaker::SPEAKER_EXTERNAL: + default: + mute_type = LLMute::EXTERNAL; + break; + } + LLMute mute(speaker_id, name, mute_type); if (!is_muted) { diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index fd2bb0fdf9..a4d8dddfe4 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -732,10 +732,17 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi } } +static LLFastTimer::DeclareTimer FTM_MEDIA_UPDATE("Update Media"); + ////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::updateMedia(void *dummy_arg) { + LLFastTimer t1(FTM_MEDIA_UPDATE); + + // Enable/disable the plugin read thread + LLPluginProcessParent::setUseReadThread(gSavedSettings.getBOOL("PluginUseReadThread")); + sAnyMediaShowing = false; sUpdatedCookies = getCookieStore()->getChangedCookies(); if(!sUpdatedCookies.empty()) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 298ce3fcec..542ec16547 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5143,9 +5143,6 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con { result->mAvatarIDValid = true; result->mAvatarID = id; - - if(result->updateMuteState()) - mMuteDirty = true; } else { @@ -5154,7 +5151,12 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con setUUIDFromStringHash(result->mAvatarID, uri); } } - + + if(result->updateMuteState()) + { + mMuteDirty = true; + } + mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result)); if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume)) @@ -5173,15 +5175,12 @@ bool LLVoiceClient::participantState::updateMuteState() { bool result = false; - if(mAvatarIDValid) + bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat); + if(mOnMuteList != isMuted) { - bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat); - if(mOnMuteList != isMuted) - { - mOnMuteList = isMuted; - mVolumeDirty = true; - result = true; - } + mOnMuteList = isMuted; + mVolumeDirty = true; + result = true; } return result; } diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 56b2791993..bd5d8d9357 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -136,31 +136,6 @@ BOOL LLPanelClothingListItem::postBuild() return TRUE; } -void LLPanelClothingListItem::setShowDeleteButton(bool show) -{ - setShowWidget("btn_delete", show); -} - -void LLPanelClothingListItem::setShowMoveUpButton(bool show) -{ - setShowWidget("btn_move_up", show); -} - -void LLPanelClothingListItem::setShowMoveDownButton(bool show) -{ - setShowWidget("btn_move_down", show); -} - -void LLPanelClothingListItem::setShowLockButton(bool show) -{ - setShowWidget("btn_lock", show); -} - -void LLPanelClothingListItem::setShowEditButton(bool show) -{ - setShowWidget("btn_edit", show); -} - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// @@ -201,16 +176,6 @@ BOOL LLPanelBodyPartsListItem::postBuild() return TRUE; } -void LLPanelBodyPartsListItem::setShowLockButton(bool show) -{ - setShowWidget("btn_lock", show); -} - -void LLPanelBodyPartsListItem::setShowEditButton(bool show) -{ - setShowWidget("btn_edit", show); -} - ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index c4a415dfbf..29532a15c1 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -86,11 +86,13 @@ public: /** * Make button visible during mouse over event. */ - inline void setShowDeleteButton(bool show); - inline void setShowMoveUpButton(bool show); - inline void setShowMoveDownButton(bool show); - inline void setShowLockButton(bool show); - inline void setShowEditButton(bool show); + inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); } + inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); } + + inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); } + inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); } + inline void setShowEditButton(bool show) { setShowWidget("btn_edit", show); } + protected: @@ -113,8 +115,8 @@ public: /** * Make button visible during mouse over event. */ - inline void setShowLockButton(bool show); - inline void setShowEditButton(bool show); + inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); } + inline void setShowEditButton(bool show) { setShowWidget("btn_edit", show); } protected: LLPanelBodyPartsListItem(LLViewerInventoryItem* item); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 3af80f63fe..df4f33adf0 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1339,6 +1339,16 @@ function="ToggleControl" parameter="RunMultipleThreads" /> </menu_item_check> + <menu_item_check + label="Use Plugin Read Thread" + name="Use Plugin Read Thread"> + <menu_item_check.on_check + function="CheckControl" + parameter="PluginUseReadThread" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="PluginUseReadThread" /> + </menu_item_check> <menu_item_call label="Clear Group Cache" name="ClearGroupCache"> diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml index 28a6995186..e70abc0975 100644 --- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml @@ -37,7 +37,7 @@ layout="topleft" name="speakers_list" opaque="false" - show_info_btn="false" + show_info_btn="true" show_profile_btn="false" show_speaking_indicator="false" width="147" /> diff --git a/indra/newview/skins/default/xui/en/panel_body_parts_list_item.xml b/indra/newview/skins/default/xui/en/panel_body_parts_list_item.xml index 4313d450fb..115964e5f2 100644 --- a/indra/newview/skins/default/xui/en/panel_body_parts_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_body_parts_list_item.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel follows="top|right|left" - height="20" + height="22" layout="topleft" left="0" name="wearable_item" @@ -69,4 +69,14 @@ height="20" width="20" tab_stop="false" /> + <panel + background_visible="true" + bg_alpha_color="0.4 0.4 0.4 1.0" + bottom="0" + follows="left|right|top" + height="1" + layout="bottomleft" + left="0" + name="wearable_type_separator_panel" + width="380"/> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_clothing_list_item.xml b/indra/newview/skins/default/xui/en/panel_clothing_list_item.xml index 8dc67de06f..7cc9c46c08 100644 --- a/indra/newview/skins/default/xui/en/panel_clothing_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_clothing_list_item.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel follows="top|right|left" - height="20" + height="23" layout="topleft" left="0" name="wearable_item" @@ -101,4 +101,15 @@ height="20" width="20" tab_stop="false" /> + <panel + background_visible="true" + bg_alpha_color="0.4 0.4 0.4 1.0" + bottom="0" + follows="left|right|top" + height="1" + layout="bottomleft" + left="0" + name="wearable_type_separator_panel" + visible="false" + width="380"/> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml index f878dd0b19..86b9ea6e14 100644 --- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml +++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml @@ -4,13 +4,13 @@ bg_alpha_color="DkGray" border="false" follows="all" - height="373" + height="200" left="0" name="cof_wearables" width="311"> <accordion follows="all" - height="373" + height="200" layout="topleft" left="0" single_expansion="true" @@ -26,7 +26,7 @@ <flat_list_view allow_select="true" follows="all" - height="150" + height="10" layout="topleft" left="0" name="list_attachments" @@ -37,29 +37,71 @@ layout="topleft" name="tab_clothing" title="Clothing"> - <flat_list_view - allow_select="true" + + <!-- *NOTE there should be no any gaps between the button bar and the list - + accordiong-list adaptor won't employ them while calculating new height when the size of the list changes --> + <panel + background_visible="false" + class="accordion_list_adaptor" follows="all" - height="150" + height="45" layout="topleft" left="0" - name="list_clothing" + name="button_bar_adaptor" top="0" - width="311" /> + width="311"> + <panel + bevel="none" + filename="panel_clothing_list_button_bar.xml" + height="35" + name="button_bar" + top="0" + width="311" /> + <flat_list_view + allow_select="true" + follows="all" + height="10" + layout="topleft" + left="0" + name="list_clothing" + top_pad="0" + width="311" /> + </panel> </accordion_tab> <accordion_tab layout="topleft" name="tab_body_parts" title="Body Parts"> - <flat_list_view - allow_select="true" + + <!-- *NOTE there should be no any gaps between the button bar and the list - + accordiong-list adaptor won't employ them while calculating new height when the size of the list changes --> + <panel + background_visible="false" + class="accordion_list_adaptor" follows="all" - height="150" + height="45" layout="topleft" left="0" - name="list_body_parts" + name="button_bar_adaptor" top="0" - width="311" /> + width="311"> + <panel + bevel="none" + filename="panel_bodyparts_list_button_bar.xml" + height="35" + name="button_bar" + top="0" + width="311"/> + <flat_list_view + allow_select="true" + follows="all" + height="10" + layout="topleft" + left="0" + name="list_body_parts" + top_pad="0" + width="311" /> + </panel> </accordion_tab> </accordion> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml index dbbfa8f2e2..c5a60ced88 100644 --- a/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_dummy_clothing_list_item.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel follows="top|right|left" - height="20" + height="22" layout="topleft" left="0" name="dummy_clothing_item" @@ -59,4 +59,14 @@ height="20" width="20" tab_stop="false" /> + <panel + background_visible="true" + bg_alpha_color="0.4 0.4 0.4 1.0" + bottom="0" + follows="left|right|top" + height="1" + layout="bottomleft" + left="0" + name="wearable_type_separator_panel" + width="380"/> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml index aa7d621e4c..c1dc2aaaf7 100644 --- a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml @@ -36,7 +36,7 @@ layout="topleft" name="speakers_list" opaque="false" - show_info_btn="false" + show_info_btn="true" show_profile_btn="false" show_speaking_indicator="false" width="145" /> diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index bf554217a6..6a212306d6 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -142,7 +142,6 @@ left="5"> <layout_panel layout="topleft" - follows="all" height="220" label="IM Control Panel" min_height="100" @@ -164,6 +163,7 @@ top="0" width="311" /> + <!-- Button bar --> <panel background_visible="true" bevel_style="none" @@ -187,40 +187,14 @@ name="gear_menu_btn" top="1" width="31" /> - <button - is_toggle="true" - follows="bottom|left" + <icon + follows="bottom|left|right" height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="AddItem_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_name="Toolbar_Right_Off" layout="topleft" left_pad="1" - name="add_btn" - top="1" - width="31" /> - <icon - follows="bottom|left|right" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="216" - /> - <button - follows="bottom|right" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="TrashItem_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Right_Off" - layout="topleft" - name="remove_from_outfit_btn" - right="-1" - top="1" - width="31" /> + name="dummy_right_icon" + width="281" /> </panel> </layout_panel> @@ -423,12 +397,12 @@ follows="left|right|bottom" height="30" layout="topleft" - left="5" + left="4" top_pad="2" name="save_revert_button_bar" width="300"> <button - follows="bottom|left|right" + follows="bottom|left" height="23" label="Save" left="0" @@ -437,7 +411,7 @@ top="0" width="155" /> <button - follows="bottom|right" + follows="bottom|left" height="23" name="save_flyout_btn" label="" @@ -454,11 +428,11 @@ <button follows="bottom|left|right" height="23" - left_pad="13" + left_pad="12" label="Revert" layout="topleft" name="revert_btn" top="0" - width="145" /> + width="147" /> </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index e0d58a16c8..f544449d02 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2163,10 +2163,11 @@ Clears (deletes) the media and all params from the given face. <string name="BusyModeResponseDefault">The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string> <!-- Mute --> - <string name="MuteByName">(by name)</string> + <string name="MuteByName">(By name)</string> <string name="MuteAgent">(Resident)</string> - <string name="MuteObject">(object)</string> - <string name="MuteGroup">(group)</string> + <string name="MuteObject">(Object)</string> + <string name="MuteGroup">(Group)</string> + <string name="MuteExternal">(External)</string> <!-- Region/Estate Covenant --> <string name="RegionNoCovenant">There is no Covenant provided for this Estate.</string> diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp index 7e9a8336e7..7a544debb2 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.cpp +++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp @@ -241,6 +241,9 @@ LLMediaPluginTest::~LLMediaPluginTest() { remMediaPanel( mMediaPanels[ i ] ); }; + + // Stop the plugin read thread if it's running. + LLPluginProcessParent::setUseReadThread(false); } //////////////////////////////////////////////////////////////////////////////// @@ -1047,6 +1050,11 @@ void LLMediaPluginTest::gluiCallback( int control_id ) } } else + if ( control_id == mIdUsePluginReadThread ) + { + LLPluginProcessParent::setUseReadThread(mUsePluginReadThread); + } + else if ( control_id == mIdControlCrashPlugin ) { // send message to plugin and ask it to crash @@ -1431,6 +1439,12 @@ void LLMediaPluginTest::makeChrome() glui_window_misc_control->set_main_gfx_window( mAppWindow ); glui_window_misc_control->add_column( true ); + mIdUsePluginReadThread = start_id++; + mUsePluginReadThread = 0; + glui_window_misc_control->add_checkbox( "Use plugin read thread", &mUsePluginReadThread, mIdUsePluginReadThread, gluiCallbackWrapper ); + glui_window_misc_control->set_main_gfx_window( mAppWindow ); + glui_window_misc_control->add_column( true ); + mIdLargePanelSpacing = start_id++; mLargePanelSpacing = 0; glui_window_misc_control->add_checkbox( "Large Panel Spacing", &mLargePanelSpacing, mIdLargePanelSpacing, gluiCallbackWrapper ); diff --git a/indra/test_apps/llplugintest/llmediaplugintest.h b/indra/test_apps/llplugintest/llmediaplugintest.h index e7c7699343..5d08e42148 100644 --- a/indra/test_apps/llplugintest/llmediaplugintest.h +++ b/indra/test_apps/llplugintest/llmediaplugintest.h @@ -164,6 +164,8 @@ class LLMediaPluginTest : public LLPluginClassMediaOwner int mRandomBookmarks; int mIdDisableTimeout; int mDisableTimeout; + int mIdUsePluginReadThread; + int mUsePluginReadThread; int mIdLargePanelSpacing; int mLargePanelSpacing; int mIdControlCrashPlugin; |