summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/CMakeLists.txt2
-rw-r--r--indra/llcommon/ll_template_cast.h160
-rw-r--r--indra/llcommon/llevents.cpp25
-rw-r--r--indra/llcommon/llevents.h95
-rw-r--r--indra/llcommon/lllistenerwrapper.h181
-rw-r--r--indra/llplugin/llpluginmessage.cpp160
-rw-r--r--indra/llplugin/llpluginmessage.h10
-rw-r--r--indra/media_plugins/base/media_plugin_base.cpp56
-rw-r--r--indra/media_plugins/base/media_plugin_base.h44
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llviewerkeyboard.cpp3
-rw-r--r--indra/newview/llviewermedia.cpp80
-rw-r--r--indra/newview/llviewermedia.h7
-rw-r--r--indra/newview/llviewertexturelist.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_privacy.xml11
-rw-r--r--indra/test/CMakeLists.txt4
-rw-r--r--indra/test/llevents_tut.cpp30
-rw-r--r--indra/test/llsdutil_tut.cpp2
-rw-r--r--indra/viewer_components/login/tests/lllogin_test.cpp2
21 files changed, 818 insertions, 75 deletions
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index eb0d180a4b..ac7cc2cdac 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -167,6 +167,7 @@ set(llcommon_HEADER_FILES
llinstancetracker.h
llkeythrottle.h
lllazy.h
+ lllistenerwrapper.h
lllinkedqueue.h
llliveappconfig.h
lllivefile.h
@@ -224,6 +225,7 @@ set(llcommon_HEADER_FILES
llversionserver.h
llversionviewer.h
llworkerthread.h
+ ll_template_cast.h
metaclass.h
metaclasst.h
metaproperty.h
diff --git a/indra/llcommon/ll_template_cast.h b/indra/llcommon/ll_template_cast.h
new file mode 100644
index 0000000000..cff58ce00d
--- /dev/null
+++ b/indra/llcommon/ll_template_cast.h
@@ -0,0 +1,160 @@
+/**
+ * @file ll_template_cast.h
+ * @author Nat Goodspeed
+ * @date 2009-11-21
+ * @brief Define ll_template_cast function
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LL_TEMPLATE_CAST_H)
+#define LL_LL_TEMPLATE_CAST_H
+
+/**
+ * Implementation for ll_template_cast() (q.v.).
+ *
+ * Default implementation: trying to cast two completely unrelated types
+ * returns 0. Typically you'd specify T and U as pointer types, but in fact T
+ * can be any type that can be initialized with 0.
+ */
+template <typename T, typename U>
+struct ll_template_cast_impl
+{
+ T operator()(U)
+ {
+ return 0;
+ }
+};
+
+/**
+ * ll_template_cast<T>(some_value) is for use in a template function when
+ * some_value might be of arbitrary type, but you want to recognize type T
+ * specially.
+ *
+ * It's designed for use with pointer types. Example:
+ * @code
+ * struct SpecialClass
+ * {
+ * void someMethod(const std::string&) const;
+ * };
+ *
+ * template <class REALCLASS>
+ * void somefunc(const REALCLASS& instance)
+ * {
+ * const SpecialClass* ptr = ll_template_cast<const SpecialClass*>(&instance);
+ * if (ptr)
+ * {
+ * ptr->someMethod("Call method only available on SpecialClass");
+ * }
+ * }
+ * @endcode
+ *
+ * Why is this better than dynamic_cast<>? Because unless OtherClass is
+ * polymorphic, the following won't even compile (gcc 4.0.1):
+ * @code
+ * OtherClass other;
+ * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&other);
+ * @endcode
+ * to say nothing of this:
+ * @code
+ * void function(int);
+ * SpecialClass* ptr = dynamic_cast<SpecialClass*>(&function);
+ * @endcode
+ * ll_template_cast handles these kinds of cases by returning 0.
+ */
+template <typename T, typename U>
+T ll_template_cast(U value)
+{
+ return ll_template_cast_impl<T, U>()(value);
+}
+
+/**
+ * Implementation for ll_template_cast() (q.v.).
+ *
+ * Implementation for identical types: return same value.
+ */
+template <typename T>
+struct ll_template_cast_impl<T, T>
+{
+ T operator()(T value)
+ {
+ return value;
+ }
+};
+
+/**
+ * LL_TEMPLATE_CONVERTIBLE(dest, source) asserts that, for a value @c s of
+ * type @c source, <tt>ll_template_cast<dest>(s)</tt> will return @c s --
+ * presuming that @c source can be converted to @c dest by the normal rules of
+ * C++.
+ *
+ * By default, <tt>ll_template_cast<dest>(s)</tt> will return 0 unless @c s's
+ * type is literally identical to @c dest. (This is because of the
+ * straightforward application of template specialization rules.) That can
+ * lead to surprising results, e.g.:
+ *
+ * @code
+ * Foo myFoo;
+ * const Foo* fooptr = ll_template_cast<const Foo*>(&myFoo);
+ * @endcode
+ *
+ * Here @c fooptr will be 0 because <tt>&myFoo</tt> is of type <tt>Foo*</tt>
+ * -- @em not <tt>const Foo*</tt>. (Declaring <tt>const Foo myFoo;</tt> would
+ * force the compiler to do the right thing.)
+ *
+ * More disappointingly:
+ * @code
+ * struct Base {};
+ * struct Subclass: public Base {};
+ * Subclass object;
+ * Base* ptr = ll_template_cast<Base*>(&object);
+ * @endcode
+ *
+ * Here @c ptr will be 0 because <tt>&object</tt> is of type
+ * <tt>Subclass*</tt> rather than <tt>Base*</tt>. We @em want this cast to
+ * succeed, but without our help ll_template_cast can't recognize it.
+ *
+ * The following would suffice:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
+ * ...
+ * Base* ptr = ll_template_cast<Base*>(&object);
+ * @endcode
+ *
+ * However, as noted earlier, this is easily fooled:
+ * @code
+ * const Base* ptr = ll_template_cast<const Base*>(&object);
+ * @endcode
+ * would still produce 0 because we haven't yet seen:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
+ * @endcode
+ *
+ * @TODO
+ * This macro should use Boost type_traits facilities for stripping and
+ * re-adding @c const and @c volatile qualifiers so that invoking
+ * LL_TEMPLATE_CONVERTIBLE(dest, source) will automatically generate all
+ * permitted permutations. It's really not fair to the coder to require
+ * separate:
+ * @code
+ * LL_TEMPLATE_CONVERTIBLE(Base*, Subclass*);
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, Subclass*);
+ * LL_TEMPLATE_CONVERTIBLE(const Base*, const Subclass*);
+ * @endcode
+ *
+ * (Naturally we omit <tt>LL_TEMPLATE_CONVERTIBLE(Base*, const Subclass*)</tt>
+ * because that's not permitted by normal C++ assignment anyway.)
+ */
+#define LL_TEMPLATE_CONVERTIBLE(DEST, SOURCE) \
+template <> \
+struct ll_template_cast_impl<DEST, SOURCE> \
+{ \
+ DEST operator()(SOURCE wrapper) \
+ { \
+ return wrapper; \
+ } \
+}
+
+#endif /* ! defined(LL_LL_TEMPLATE_CAST_H) */
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index 4bdfe5a867..31fdd9e60a 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -459,11 +459,25 @@ void LLEventPump::stopListening(const std::string& name)
bool LLEventStream::post(const LLSD& event)
{
if (! mEnabled)
+ {
return false;
+ }
+ // NOTE NOTE NOTE: Any new access to member data beyond this point should
+ // cause us to move our LLStandardSignal object to a pimpl class along
+ // with said member data. Then the local shared_ptr will preserve both.
+
+ // DEV-43463: capture a local copy of mSignal. We've turned up a
+ // cross-coroutine scenario (described in the Jira) in which this post()
+ // call could end up destroying 'this', the LLEventPump subclass instance
+ // containing mSignal, during the call through *mSignal. So -- capture a
+ // *stack* instance of the shared_ptr, ensuring that our heap
+ // LLStandardSignal object will live at least until post() returns, even
+ // if 'this' gets destroyed during the call.
+ boost::shared_ptr<LLStandardSignal> signal(mSignal);
// Let caller know if any one listener handled the event. This is mostly
// useful when using LLEventStream as a listener for an upstream
// LLEventPump.
- return (*mSignal)(event);
+ return (*signal)(event);
}
/*****************************************************************************
@@ -492,9 +506,16 @@ void LLEventQueue::flush()
// be processed in the *next* flush() call.
EventQueue queue(mEventQueue);
mEventQueue.clear();
+ // NOTE NOTE NOTE: Any new access to member data beyond this point should
+ // cause us to move our LLStandardSignal object to a pimpl class along
+ // with said member data. Then the local shared_ptr will preserve both.
+
+ // DEV-43463: capture a local copy of mSignal. See LLEventStream::post()
+ // for detailed comments.
+ boost::shared_ptr<LLStandardSignal> signal(mSignal);
for ( ; ! queue.empty(); queue.pop_front())
{
- (*mSignal)(queue.front());
+ (*signal)(queue.front());
}
}
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index f52cf33fd8..ed714e4e40 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -44,6 +44,7 @@
#include "llsd.h"
#include "llsingleton.h"
#include "lldependencies.h"
+#include "ll_template_cast.h"
/*==========================================================================*|
// override this to allow binding free functions with more parameters
@@ -266,6 +267,14 @@ namespace LLEventDetail
*/
template <typename LISTENER>
LLBoundListener visit_and_connect(const LISTENER& listener,
+ const ConnectFunc& connect_func)
+ {
+ return visit_and_connect("", listener, connect_func);
+ }
+ /// overload of visit_and_connect() when we have a string identifier available
+ template <typename LISTENER>
+ LLBoundListener visit_and_connect(const std::string& name,
+ const LISTENER& listener,
const ConnectFunc& connect_func);
} // namespace LLEventDetail
@@ -468,7 +477,8 @@ public:
// This is why listen() is a template. Conversion from boost::bind()
// to LLEventListener performs type erasure, so it's important to look
// at the boost::bind object itself before that happens.
- return LLEventDetail::visit_and_connect(listener,
+ return LLEventDetail::visit_and_connect(name,
+ listener,
boost::bind(&LLEventPump::listen_impl,
this,
name,
@@ -522,7 +532,7 @@ private:
protected:
/// implement the dispatching
- boost::scoped_ptr<LLStandardSignal> mSignal;
+ boost::shared_ptr<LLStandardSignal> mSignal;
/// valve open?
bool mEnabled;
@@ -664,6 +674,62 @@ private:
LLSD mReqid;
};
+/**
+ * Base class for LLListenerWrapper. See visit_and_connect() and llwrap(). We
+ * provide virtual @c accept_xxx() methods, customization points allowing a
+ * subclass access to certain data visible at LLEventPump::listen() time.
+ * Example subclass usage:
+ *
+ * @code
+ * myEventPump.listen("somename",
+ * llwrap<MyListenerWrapper>(boost::bind(&MyClass::method, instance, _1)));
+ * @endcode
+ *
+ * Because of the anticipated usage (note the anonymous temporary
+ * MyListenerWrapper instance in the example above), the @c accept_xxx()
+ * methods must be @c const.
+ */
+class LL_COMMON_API LLListenerWrapperBase
+{
+public:
+ /// New instance. The accept_xxx() machinery makes it important to use
+ /// shared_ptrs for our data. Many copies of this object are made before
+ /// the instance that actually ends up in the signal, yet accept_xxx()
+ /// will later be called on the @em original instance. All copies of the
+ /// same original instance must share the same data.
+ LLListenerWrapperBase():
+ mName(new std::string),
+ mConnection(new LLBoundListener)
+ {
+ }
+
+ /// Copy constructor. Copy shared_ptrs to original instance data.
+ LLListenerWrapperBase(const LLListenerWrapperBase& that):
+ mName(that.mName),
+ mConnection(that.mConnection)
+ {
+ }
+ virtual ~LLListenerWrapperBase() {}
+
+ /// Ask LLEventPump::listen() for the listener name
+ virtual void accept_name(const std::string& name) const
+ {
+ *mName = name;
+ }
+
+ /// Ask LLEventPump::listen() for the new connection
+ virtual void accept_connection(const LLBoundListener& connection) const
+ {
+ *mConnection = connection;
+ }
+
+protected:
+ /// Listener name.
+ boost::shared_ptr<std::string> mName;
+ /// Connection.
+ boost::shared_ptr<LLBoundListener> mConnection;
+};
+
/*****************************************************************************
* Underpinnings
*****************************************************************************/
@@ -898,7 +964,8 @@ namespace LLEventDetail
* LLStandardSignal, returning LLBoundListener.
*/
template <typename LISTENER>
- LLBoundListener visit_and_connect(const LISTENER& raw_listener,
+ LLBoundListener visit_and_connect(const std::string& name,
+ const LISTENER& raw_listener,
const ConnectFunc& connect_func)
{
// Capture the listener
@@ -913,14 +980,20 @@ namespace LLEventDetail
// which type details have been erased. unwrap() comes from
// Boost.Signals, in case we were passed a boost::ref().
visit_each(visitor, LLEventDetail::unwrap(raw_listener));
- // Make the connection using passed function. At present, wrapping
- // this functionality into this function is a bit silly: we don't
- // really need a visit_and_connect() function any more, just a visit()
- // function. The definition of this function dates from when, after
- // visit_each(), after establishing the connection, we had to
- // postprocess the new connection with the visitor object. That's no
- // longer necessary.
- return connect_func(listener);
+ // Make the connection using passed function.
+ LLBoundListener connection(connect_func(listener));
+ // If the LISTENER is an LLListenerWrapperBase subclass, pass it the
+ // desired information. It's important that we pass the raw_listener
+ // so the compiler can make decisions based on its original type.
+ const LLListenerWrapperBase* lwb =
+ ll_template_cast<const LLListenerWrapperBase*>(&raw_listener);
+ if (lwb)
+ {
+ lwb->accept_name(name);
+ lwb->accept_connection(connection);
+ }
+ // In any case, show new connection to caller.
+ return connection;
}
} // namespace LLEventDetail
diff --git a/indra/llcommon/lllistenerwrapper.h b/indra/llcommon/lllistenerwrapper.h
new file mode 100644
index 0000000000..e7bad1423a
--- /dev/null
+++ b/indra/llcommon/lllistenerwrapper.h
@@ -0,0 +1,181 @@
+/**
+ * @file lllistenerwrapper.h
+ * @author Nat Goodspeed
+ * @date 2009-11-30
+ * @brief Introduce LLListenerWrapper template
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * Copyright (c) 2009, Linden Research, Inc.
+ * $/LicenseInfo$
+ */
+
+#if ! defined(LL_LLLISTENERWRAPPER_H)
+#define LL_LLLISTENERWRAPPER_H
+
+#include "llevents.h" // LLListenerWrapperBase
+#include <boost/visit_each.hpp>
+
+/**
+ * Template base class for coding wrappers for LLEventPump listeners.
+ *
+ * Derive your listener wrapper from LLListenerWrapper. You must use
+ * LLLISTENER_WRAPPER_SUBCLASS() so your subclass will play nicely with
+ * boost::visit_each (q.v.). That way boost::signals2 can still detect
+ * derivation from LLEventTrackable, and so forth.
+ */
+template <typename LISTENER>
+class LL_COMMON_API LLListenerWrapper: public LLListenerWrapperBase
+{
+public:
+ /// Wrap an arbitrary listener object
+ LLListenerWrapper(const LISTENER& listener):
+ mListener(listener)
+ {}
+
+ /// call
+ virtual bool operator()(const LLSD& event)
+ {
+ return mListener(event);
+ }
+
+ /// Allow boost::visit_each() to peek at our mListener.
+ template <class V>
+ void accept_visitor(V& visitor) const
+ {
+ using boost::visit_each;
+ visit_each(visitor, mListener, 0);
+ }
+
+private:
+ LISTENER mListener;
+};
+
+/**
+ * Specialize boost::visit_each() (leveraging ADL) to peek inside an
+ * LLListenerWrapper<T> to traverse its LISTENER. We borrow the
+ * accept_visitor() pattern from boost::bind(), avoiding the need to make
+ * mListener public.
+ */
+template <class V, typename T>
+void visit_each(V& visitor, const LLListenerWrapper<T>& wrapper, int)
+{
+ wrapper.accept_visitor(visitor);
+}
+
+/// use this (sigh!) for each subclass of LLListenerWrapper<T> you write
+#define LLLISTENER_WRAPPER_SUBCLASS(CLASS) \
+template <class V, typename T> \
+void visit_each(V& visitor, const CLASS<T>& wrapper, int) \
+{ \
+ visit_each(visitor, static_cast<const LLListenerWrapper<T>&>(wrapper), 0); \
+} \
+ \
+/* Have to state this explicitly, rather than using LL_TEMPLATE_CONVERTIBLE, */ \
+/* because the source type is itself a template. */ \
+template <typename T> \
+struct ll_template_cast_impl<const LLListenerWrapperBase*, const CLASS<T>*> \
+{ \
+ const LLListenerWrapperBase* operator()(const CLASS<T>* wrapper) \
+ { \
+ return wrapper; \
+ } \
+}
+
+/**
+ * Make an instance of a listener wrapper. Every wrapper class must be a
+ * template accepting a listener object of arbitrary type. In particular, the
+ * type of a boost::bind() expression is deliberately undocumented. So we
+ * can't just write Wrapper<CorrectType>(boost::bind(...)). Instead we must
+ * write llwrap<Wrapper>(boost::bind(...)).
+ */
+template <template<typename> class WRAPPER, typename T>
+WRAPPER<T> LL_COMMON_API llwrap(const T& listener)
+{
+ return WRAPPER<T>(listener);
+}
+
+/**
+ * This LLListenerWrapper template subclass is used to report entry/exit to an
+ * event listener, by changing this:
+ * @code
+ * someEventPump.listen("MyClass",
+ * boost::bind(&MyClass::method, ptr, _1));
+ * @endcode
+ * to this:
+ * @code
+ * someEventPump.listen("MyClass",
+ * llwrap<LLCoutListener>(
+ * boost::bind(&MyClass::method, ptr, _1)));
+ * @endcode
+ */
+template <class LISTENER>
+class LL_COMMON_API LLCoutListener: public LLListenerWrapper<LISTENER>
+{
+ typedef LLListenerWrapper<LISTENER> super;
+
+public:
+ /// Wrap an arbitrary listener object
+ LLCoutListener(const LISTENER& listener):
+ super(listener)
+ {}
+
+ /// call
+ virtual bool operator()(const LLSD& event)
+ {
+ std::cout << "Entering listener " << *super::mName << " with " << event << std::endl;
+ bool handled = super::operator()(event);
+ std::cout << "Leaving listener " << *super::mName;
+ if (handled)
+ {
+ std::cout << " (handled)";
+ }
+ std::cout << std::endl;
+ return handled;
+ }
+};
+
+LLLISTENER_WRAPPER_SUBCLASS(LLCoutListener);
+
+/**
+ * This LLListenerWrapper template subclass is used to log entry/exit to an
+ * event listener, by changing this:
+ * @code
+ * someEventPump.listen("MyClass",
+ * boost::bind(&MyClass::method, ptr, _1));
+ * @endcode
+ * to this:
+ * @code
+ * someEventPump.listen("MyClass",
+ * llwrap<LLLogListener>(
+ * boost::bind(&MyClass::method, ptr, _1)));
+ * @endcode
+ */
+template <class LISTENER>
+class LL_COMMON_API LLLogListener: public LLListenerWrapper<LISTENER>
+{
+ typedef LLListenerWrapper<LISTENER> super;
+
+public:
+ /// Wrap an arbitrary listener object
+ LLLogListener(const LISTENER& listener):
+ super(listener)
+ {}
+
+ /// call
+ virtual bool operator()(const LLSD& event)
+ {
+ LL_DEBUGS("LLLogListener") << "Entering listener " << *super::mName << " with " << event << LL_ENDL;
+ bool handled = super::operator()(event);
+ LL_DEBUGS("LLLogListener") << "Leaving listener " << *super::mName;
+ if (handled)
+ {
+ LL_CONT << " (handled)";
+ }
+ LL_CONT << LL_ENDL;
+ return handled;
+ }
+};
+
+LLLISTENER_WRAPPER_SUBCLASS(LLLogListener);
+
+#endif /* ! defined(LL_LLLISTENERWRAPPER_H) */
diff --git a/indra/llplugin/llpluginmessage.cpp b/indra/llplugin/llpluginmessage.cpp
index 34e02c356e..d06f3cefa0 100644
--- a/indra/llplugin/llpluginmessage.cpp
+++ b/indra/llplugin/llpluginmessage.cpp
@@ -37,31 +37,57 @@
#include "llsdserialize.h"
#include "u64.h"
+/**
+ * Constructor.
+ */
LLPluginMessage::LLPluginMessage()
{
}
+/**
+ * Constructor.
+ *
+ * @param[in] p Existing message
+ */
LLPluginMessage::LLPluginMessage(const LLPluginMessage &p)
{
mMessage = p.mMessage;
}
+/**
+ * Constructor.
+ *
+ * @param[in] message_class Message class
+ * @param[in] message_name Message name
+ */
LLPluginMessage::LLPluginMessage(const std::string &message_class, const std::string &message_name)
{
setMessage(message_class, message_name);
}
+/**
+ * Destructor.
+ */
LLPluginMessage::~LLPluginMessage()
{
}
+/**
+ * Reset all internal state.
+ */
void LLPluginMessage::clear()
{
mMessage = LLSD::emptyMap();
mMessage["params"] = LLSD::emptyMap();
}
+/**
+ * Sets the message class and name. Also has the side-effect of clearing any key-value pairs in the message.
+ *
+ * @param[in] message_class Message class
+ * @param[in] message_name Message name
+ */
void LLPluginMessage::setMessage(const std::string &message_class, const std::string &message_name)
{
clear();
@@ -69,21 +95,45 @@ void LLPluginMessage::setMessage(const std::string &message_class, const std::st
mMessage["name"] = message_name;
}
+/**
+ * Sets a key/value pair in the message, where the value is a string.
+ *
+ * @param[in] key Key
+ * @param[in] value String value
+ */
void LLPluginMessage::setValue(const std::string &key, const std::string &value)
{
mMessage["params"][key] = value;
}
+/**
+ * Sets a key/value pair in the message, where the value is LLSD.
+ *
+ * @param[in] key Key
+ * @param[in] value LLSD value
+ */
void LLPluginMessage::setValueLLSD(const std::string &key, const LLSD &value)
{
mMessage["params"][key] = value;
}
+/**
+ * Sets a key/value pair in the message, where the value is signed 32-bit.
+ *
+ * @param[in] key Key
+ * @param[in] value 32-bit signed value
+ */
void LLPluginMessage::setValueS32(const std::string &key, S32 value)
{
mMessage["params"][key] = value;
}
+/**
+ * Sets a key/value pair in the message, where the value is unsigned 32-bit. The value is stored as a string beginning with "0x".
+ *
+ * @param[in] key Key
+ * @param[in] value 32-bit unsigned value
+ */
void LLPluginMessage::setValueU32(const std::string &key, U32 value)
{
std::stringstream temp;
@@ -91,16 +141,34 @@ void LLPluginMessage::setValueU32(const std::string &key, U32 value)
setValue(key, temp.str());
}
+/**
+ * Sets a key/value pair in the message, where the value is a bool.
+ *
+ * @param[in] key Key
+ * @param[in] value Boolean value
+ */
void LLPluginMessage::setValueBoolean(const std::string &key, bool value)
{
mMessage["params"][key] = value;
}
+/**
+ * Sets a key/value pair in the message, where the value is a double.
+ *
+ * @param[in] key Key
+ * @param[in] value Boolean value
+ */
void LLPluginMessage::setValueReal(const std::string &key, F64 value)
{
mMessage["params"][key] = value;
}
+/**
+ * Sets a key/value pair in the message, where the value is a pointer. The pointer is stored as a string.
+ *
+ * @param[in] key Key
+ * @param[in] value Pointer value
+ */
void LLPluginMessage::setValuePointer(const std::string &key, void* value)
{
std::stringstream temp;
@@ -109,16 +177,33 @@ void LLPluginMessage::setValuePointer(const std::string &key, void* value)
setValue(key, temp.str());
}
+/**
+ * Gets the message class.
+ *
+ * @return Message class
+ */
std::string LLPluginMessage::getClass(void) const
{
return mMessage["class"];
}
+/**
+ * Gets the message name.
+ *
+ * @return Message name
+ */
std::string LLPluginMessage::getName(void) const
{
return mMessage["name"];
}
+/**
+ * Returns true if the specified key exists in this message (useful for optional parameters).
+ *
+ * @param[in] key Key
+ *
+ * @return True if key exists, false otherwise.
+ */
bool LLPluginMessage::hasValue(const std::string &key) const
{
bool result = false;
@@ -131,6 +216,13 @@ bool LLPluginMessage::hasValue(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as a string. If the key does not exist, an empty string will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return String value of key if key exists, empty string if key does not exist.
+ */
std::string LLPluginMessage::getValue(const std::string &key) const
{
std::string result;
@@ -143,6 +235,13 @@ std::string LLPluginMessage::getValue(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as LLSD. If the key does not exist, a null LLSD will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return LLSD value of key if key exists, null LLSD if key does not exist.
+ */
LLSD LLPluginMessage::getValueLLSD(const std::string &key) const
{
LLSD result;
@@ -155,6 +254,13 @@ LLSD LLPluginMessage::getValueLLSD(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as signed 32-bit int. If the key does not exist, 0 will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return Signed 32-bit int value of key if key exists, 0 if key does not exist.
+ */
S32 LLPluginMessage::getValueS32(const std::string &key) const
{
S32 result = 0;
@@ -167,6 +273,13 @@ S32 LLPluginMessage::getValueS32(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as unsigned 32-bit int. If the key does not exist, 0 will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return Unsigned 32-bit int value of key if key exists, 0 if key does not exist.
+ */
U32 LLPluginMessage::getValueU32(const std::string &key) const
{
U32 result = 0;
@@ -181,6 +294,13 @@ U32 LLPluginMessage::getValueU32(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as a bool. If the key does not exist, false will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return Boolean value of key if it exists, false otherwise.
+ */
bool LLPluginMessage::getValueBoolean(const std::string &key) const
{
bool result = false;
@@ -193,6 +313,13 @@ bool LLPluginMessage::getValueBoolean(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as a double. If the key does not exist, 0 will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return Value as a double if key exists, 0 otherwise.
+ */
F64 LLPluginMessage::getValueReal(const std::string &key) const
{
F64 result = 0.0f;
@@ -205,6 +332,13 @@ F64 LLPluginMessage::getValueReal(const std::string &key) const
return result;
}
+/**
+ * Gets the value of a key as a pointer. If the key does not exist, NULL will be returned.
+ *
+ * @param[in] key Key
+ *
+ * @return Pointer value if key exists, NULL otherwise.
+ */
void* LLPluginMessage::getValuePointer(const std::string &key) const
{
void* result = NULL;
@@ -219,6 +353,11 @@ void* LLPluginMessage::getValuePointer(const std::string &key) const
return result;
}
+/**
+ * Flatten the message into a string.
+ *
+ * @return Message as a string.
+ */
std::string LLPluginMessage::generate(void) const
{
std::ostringstream result;
@@ -230,7 +369,11 @@ std::string LLPluginMessage::generate(void) const
return result.str();
}
-
+/**
+ * Parse an incoming message into component parts. Clears all existing state before starting the parse.
+ *
+ * @return Returns -1 on failure, otherwise returns the number of key/value pairs in the incoming message.
+ */
int LLPluginMessage::parse(const std::string &message)
{
// clear any previous state
@@ -255,16 +398,31 @@ LLPluginMessageDispatcher::~LLPluginMessageDispatcher()
}
+/**
+ * Add a message listener. TODO:DOC need more info on what uses this. when are multiple listeners needed?
+ *
+ * @param[in] listener Message listener
+ */
void LLPluginMessageDispatcher::addPluginMessageListener(LLPluginMessageListener *listener)
{
mListeners.insert(listener);
}
+/**
+ * Remove a message listener.
+ *
+ * @param[in] listener Message listener
+ */
void LLPluginMessageDispatcher::removePluginMessageListener(LLPluginMessageListener *listener)
{
mListeners.erase(listener);
}
+/**
+ * Distribute a message to all message listeners.
+ *
+ * @param[in] message Message
+ */
void LLPluginMessageDispatcher::dispatchPluginMessage(const LLPluginMessage &message)
{
for (listener_set_t::iterator it = mListeners.begin();
diff --git a/indra/llplugin/llpluginmessage.h b/indra/llplugin/llpluginmessage.h
index 99f8d1194f..e00022a245 100644
--- a/indra/llplugin/llpluginmessage.h
+++ b/indra/llplugin/llpluginmessage.h
@@ -104,6 +104,9 @@ private:
};
+/**
+ * @brief Listens for plugin messages.
+ */
class LLPluginMessageListener
{
public:
@@ -112,6 +115,11 @@ public:
};
+/**
+ * @brief Dispatcher for plugin messages.
+ *
+ * Manages the set of plugin message listeners and distributes messages to plugin message listeners.
+ */
class LLPluginMessageDispatcher
{
public:
@@ -122,7 +130,9 @@ public:
protected:
void dispatchPluginMessage(const LLPluginMessage &message);
+ /** A set of message listeners. */
typedef std::set<LLPluginMessageListener*> listener_set_t;
+ /** The set of message listeners. */
listener_set_t mListeners;
};
diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp
index 8c8fa24a65..658783e064 100644
--- a/indra/media_plugins/base/media_plugin_base.cpp
+++ b/indra/media_plugins/base/media_plugin_base.cpp
@@ -2,6 +2,8 @@
* @file media_plugin_base.cpp
* @brief Media plugin base class for LLMedia API plugin system
*
+ * All plugins should be a subclass of MediaPluginBase.
+ *
* @cond
* $LicenseInfo:firstyear=2008&license=viewergpl$
*
@@ -37,7 +39,10 @@
// TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint
////////////////////////////////////////////////////////////////////////////////
-//
+/// Media plugin constructor.
+///
+/// @param[in] host_send_func Function for sending messages from plugin to plugin loader shell
+/// @param[in] host_user_data Message data for messages from plugin to plugin loader shell
MediaPluginBase::MediaPluginBase(
LLPluginInstance::sendMessageFunction host_send_func,
@@ -55,6 +60,12 @@ MediaPluginBase::MediaPluginBase(
mStatus = STATUS_NONE;
}
+/**
+ * Converts current media status enum value into string (STATUS_LOADING into "loading", etc.)
+ *
+ * @return Media status string ("loading", "playing", "paused", etc)
+ *
+ */
std::string MediaPluginBase::statusString()
{
std::string result;
@@ -75,6 +86,12 @@ std::string MediaPluginBase::statusString()
return result;
}
+/**
+ * Set media status.
+ *
+ * @param[in] status Media status (STATUS_LOADING, STATUS_PLAYING, STATUS_PAUSED, etc)
+ *
+ */
void MediaPluginBase::setStatus(EStatus status)
{
if(mStatus != status)
@@ -85,6 +102,13 @@ void MediaPluginBase::setStatus(EStatus status)
}
+/**
+ * Receive message from plugin loader shell.
+ *
+ * @param[in] message_string Message string
+ * @param[in] user_data Message data
+ *
+ */
void MediaPluginBase::staticReceiveMessage(const char *message_string, void **user_data)
{
MediaPluginBase *self = (MediaPluginBase*)*user_data;
@@ -102,12 +126,27 @@ void MediaPluginBase::staticReceiveMessage(const char *message_string, void **us
}
}
+/**
+ * Send message to plugin loader shell.
+ *
+ * @param[in] message Message data being sent to plugin loader shell
+ *
+ */
void MediaPluginBase::sendMessage(const LLPluginMessage &message)
{
std::string output = message.generate();
mHostSendFunction(output.c_str(), &mHostUserData);
}
+/**
+ * Notifies plugin loader shell that part of display area needs to be redrawn.
+ *
+ * @param[in] left Left X coordinate of area to redraw (0,0 is at top left corner)
+ * @param[in] top Top Y coordinate of area to redraw (0,0 is at top left corner)
+ * @param[in] right Right X-coordinate of area to redraw (0,0 is at top left corner)
+ * @param[in] bottom Bottom Y-coordinate of area to redraw (0,0 is at top left corner)
+ *
+ */
void MediaPluginBase::setDirty(int left, int top, int right, int bottom)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated");
@@ -120,6 +159,10 @@ void MediaPluginBase::setDirty(int left, int top, int right, int bottom)
sendMessage(message);
}
+/**
+ * Sends "media_status" message to plugin loader shell ("loading", "playing", "paused", etc.)
+ *
+ */
void MediaPluginBase::sendStatus()
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "media_status");
@@ -143,6 +186,17 @@ extern "C"
LLSYMEXPORT int LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data);
}
+/**
+ * Plugin initialization and entry point. Establishes communication channel for messages between plugin and plugin loader shell. TODO:DOC - Please check!
+ *
+ * @param[in] host_send_func Function for sending messages from plugin to plugin loader shell
+ * @param[in] host_user_data Message data for messages from plugin to plugin loader shell
+ * @param[out] plugin_send_func Function for plugin to receive messages from plugin loader shell
+ * @param[out] plugin_user_data Pointer to plugin instance
+ *
+ * @return int, where 0=success
+ *
+ */
LLSYMEXPORT int
LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
{
diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h
index 4dd157a07c..ed4dc0cfa9 100644
--- a/indra/media_plugins/base/media_plugin_base.h
+++ b/indra/media_plugins/base/media_plugin_base.h
@@ -42,14 +42,17 @@ class MediaPluginBase
{
public:
MediaPluginBase(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
+ /** Media plugin destructor. */
virtual ~MediaPluginBase() {}
+ /** Handle received message from plugin loader shell. */
virtual void receiveMessage(const char *message_string) = 0;
static void staticReceiveMessage(const char *message_string, void **user_data);
protected:
+ /** Plugin status. */
typedef enum
{
STATUS_NONE,
@@ -61,10 +64,13 @@ protected:
STATUS_DONE
} EStatus;
+ /** Plugin shared memory. */
class SharedSegmentInfo
{
public:
+ /** Shared memory address. */
void *mAddress;
+ /** Shared memory size. */
size_t mSize;
};
@@ -73,42 +79,56 @@ protected:
std::string statusString();
void setStatus(EStatus status);
- // The quicktime plugin overrides this to add current time and duration to the message...
+ /// Note: The quicktime plugin overrides this to add current time and duration to the message.
virtual void setDirty(int left, int top, int right, int bottom);
+ /** Map of shared memory names to shared memory. */
typedef std::map<std::string, SharedSegmentInfo> SharedSegmentMap;
+ /** Function to send message from plugin to plugin loader shell. */
LLPluginInstance::sendMessageFunction mHostSendFunction;
+ /** Message data being sent to plugin loader shell by mHostSendFunction. */
void *mHostUserData;
+ /** Flag to delete plugin instance (self). */
bool mDeleteMe;
+ /** Pixel array to display. TODO:DOC are pixels always 24-bit RGB format, aligned on 32-bit boundary? Also: calling this a pixel array may be misleading since 1 pixel > 1 char. */
unsigned char* mPixels;
+ /** TODO:DOC what's this for -- does a texture have its own piece of shared memory? updated on size_change_request, cleared on shm_remove */
std::string mTextureSegmentName;
+ /** Width of plugin display in pixels. */
int mWidth;
+ /** Height of plugin display in pixels. */
int mHeight;
+ /** Width of plugin texture. */
int mTextureWidth;
+ /** Height of plugin texture. */
int mTextureHeight;
+ /** Pixel depth (pixel size in bytes). */
int mDepth;
+ /** Current status of plugin. */
EStatus mStatus;
+ /** Map of shared memory segments. */
SharedSegmentMap mSharedSegments;
};
-// The plugin must define this function to create its instance.
+/** The plugin <b>must</b> define this function to create its instance.
+ * It should look something like this:
+ * @code
+ * {
+ * MediaPluginFoo *self = new MediaPluginFoo(host_send_func, host_user_data);
+ * *plugin_send_func = MediaPluginFoo::staticReceiveMessage;
+ * *plugin_user_data = (void*)self;
+ *
+ * return 0;
+ * }
+ * @endcode
+ */
int init_media_plugin(
LLPluginInstance::sendMessageFunction host_send_func,
void *host_user_data,
LLPluginInstance::sendMessageFunction *plugin_send_func,
void **plugin_user_data);
-// It should look something like this:
-/*
-{
- MediaPluginFoo *self = new MediaPluginFoo(host_send_func, host_user_data);
- *plugin_send_func = MediaPluginFoo::staticReceiveMessage;
- *plugin_user_data = (void*)self;
-
- return 0;
-}
-*/
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index fa4dfe767b..6252bd002e 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -386,17 +386,6 @@
<key>Value</key>
<integer>0</integer>
</map>
- <key>AutoPlayMedia</key>
- <map>
- <key>Comment</key>
- <string>Allow media objects to automatically play or navigate?</string>
- <key>Persist</key>
- <integer>1</integer>
- <key>Type</key>
- <string>Boolean</string>
- <key>Value</key>
- <integer>1</integer>
- </map>
<key>AutoSnapshot</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index eb08707b61..84843138bf 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -899,6 +899,8 @@ bool LLAppViewer::init()
loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort"));
}
+ LLViewerMedia::initClass();
+
return true;
}
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 8fd646ee93..f757155b94 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -538,8 +538,9 @@ void start_chat( EKeystate s )
void start_gesture( EKeystate s )
{
+ LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (KEYSTATE_UP == s &&
- !(gFocusMgr.getKeyboardFocus() && dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus())->acceptsTextInput()))
+ ! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
{
if (LLNearbyChatBar::getInstance()->getCurrentChat().empty())
{
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index d5fd23ac51..858aab300b 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -45,6 +45,9 @@
#include "llviewertexturelist.h"
#include "llvovolume.h"
#include "llpluginclassmedia.h"
+#include "llviewerwindow.h"
+#include "llfocusmgr.h"
+#include "llcallbacklist.h"
#include "llevent.h" // LLSimpleListener
#include "llnotificationsutil.h"
@@ -55,7 +58,7 @@
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
-/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "AutoPlayMedia";
+/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
// Move this to its own file.
@@ -327,6 +330,8 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
media_impl->mMediaLoop = media_entry->getAutoLoop();
media_impl->mMediaWidth = media_entry->getWidthPixels();
media_impl->mMediaHeight = media_entry->getHeightPixels();
+ media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+ media_impl->mMediaEntryURL = media_entry->getCurrentURL();
if (media_impl->mMediaSource)
{
media_impl->mMediaSource->setAutoScale(media_impl->mMediaAutoScale);
@@ -334,8 +339,8 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels());
}
- bool url_changed = (media_entry->getCurrentURL() != previous_url);
- if(media_entry->getCurrentURL().empty())
+ bool url_changed = (media_impl->mMediaEntryURL != previous_url);
+ if(media_impl->mMediaEntryURL.empty())
{
if(url_changed)
{
@@ -350,7 +355,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
// The current media URL is not empty.
// If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
// do a navigate.
- bool auto_play = (media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
+ bool auto_play = (media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
if((was_loaded || auto_play) && !update_from_self)
{
@@ -372,8 +377,10 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
media_entry->getAutoLoop());
media_impl->setHomeURL(media_entry->getHomeURL());
+ media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+ media_impl->mMediaEntryURL = media_entry->getCurrentURL();
- if(media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
+ if(media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
{
needs_navigate = true;
}
@@ -381,21 +388,20 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
if(media_impl)
{
- std::string url = media_entry->getCurrentURL();
if(needs_navigate)
{
- media_impl->navigateTo(url, "", true, true);
- lldebugs << "navigating to URL " << url << llendl;
+ media_impl->navigateTo(media_impl->mMediaEntryURL, "", true, true);
+ lldebugs << "navigating to URL " << media_impl->mMediaEntryURL << llendl;
}
- else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != url))
+ else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != media_impl->mMediaEntryURL))
{
// If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry.
- media_impl->mMediaURL = url;
+ media_impl->mMediaURL = media_impl->mMediaEntryURL;
// If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast.
media_impl->mNavigateServerRequest = true;
- lldebugs << "updating URL in the media impl to " << url << llendl;
+ lldebugs << "updating URL in the media impl to " << media_impl->mMediaEntryURL << llendl;
}
}
@@ -625,7 +631,7 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
//////////////////////////////////////////////////////////////////////////////////////////
// static
-void LLViewerMedia::updateMedia()
+void LLViewerMedia::updateMedia(void *dummy_arg)
{
impl_list::iterator iter = sViewerMediaImplList.begin();
impl_list::iterator end = sViewerMediaImplList.end();
@@ -747,6 +753,19 @@ void LLViewerMedia::updateMedia()
impl_count_total++;
}
+ // Overrides if the window is minimized or we lost focus (taking care
+ // not to accidentally "raise" the priority either)
+ if (!gViewerWindow->getActive() /* viewer window minimized? */
+ && new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+ }
+ else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
+ && new_priority > LLPluginClassMedia::PRIORITY_LOW)
+ {
+ new_priority = LLPluginClassMedia::PRIORITY_LOW;
+ }
+
pimpl->setPriority(new_priority);
if(pimpl->getUsedInUI())
@@ -785,9 +804,16 @@ void LLViewerMedia::updateMedia()
//////////////////////////////////////////////////////////////////////////////////////////
// static
+void LLViewerMedia::initClass()
+{
+ gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
void LLViewerMedia::cleanupClass()
{
- // This is no longer necessary, since sViewerMediaImplList is no longer smart pointers.
+ gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
}
//////////////////////////////////////////////////////////////////////////////////////////
@@ -830,6 +856,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mProximity(-1),
mProximityDistance(0.0f),
mMimeTypeProbe(NULL),
+ mMediaAutoPlay(false),
mIsUpdated(false)
{
@@ -1911,6 +1938,33 @@ void LLViewerMediaImpl::resetPreviousMediaState()
mPreviousMediaTime = 0.0f;
}
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+void LLViewerMediaImpl::setDisabled(bool disabled)
+{
+ if(mIsDisabled != disabled)
+ {
+ // Only do this on actual state transitions.
+ mIsDisabled = disabled;
+
+ if(mIsDisabled)
+ {
+ // We just disabled this media. Clear all state.
+ unload();
+ }
+ else
+ {
+ // We just (re)enabled this media. Do a navigate if auto-play is in order.
+ if(mMediaAutoPlay && gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING))
+ {
+ navigateTo(mMediaEntryURL, "", true, true);
+ }
+ }
+
+ }
+};
+
//////////////////////////////////////////////////////////////////////////////////////////
//
bool LLViewerMediaImpl::isForcedUnloaded() const
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index e2d159304f..713eb2710b 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -96,9 +96,10 @@ class LLViewerMedia
static bool textureHasMedia(const LLUUID& texture_id);
static void setVolume(F32 volume);
- static void updateMedia();
+ static void updateMedia(void* dummy_arg = NULL);
static bool isMusicPlaying();
+ static void initClass();
static void cleanupClass();
static void toggleMusicPlay(void*);
@@ -201,7 +202,7 @@ public:
bool isMediaFailed() const { return mMediaSourceFailed; };
void resetPreviousMediaState();
- void setDisabled(bool disabled) { mIsDisabled = disabled; };
+ void setDisabled(bool disabled);
bool isMediaDisabled() const { return mIsDisabled; };
// returns true if this instance should not be loaded (disabled, muted object, crashed, etc.)
@@ -345,6 +346,8 @@ public:
S32 mProximity;
F64 mProximityDistance;
LLMimeDiscoveryResponder *mMimeTypeProbe;
+ bool mMediaAutoPlay;
+ std::string mMediaEntryURL;
private:
BOOL mIsUpdated ;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index dbcf563010..5be7f2945f 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -614,10 +614,6 @@ void LLViewerTextureList::updateImages(F32 max_time)
didone = image->doLoadedCallbacks();
}
}
- if (!gNoRender && !gGLManager.mIsDisabled)
- {
- LLViewerMedia::updateMedia();
- }
updateImagesUpdateStats();
}
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 9ba056a17c..8529a93527 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1011,6 +1011,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
else
{
mActive = FALSE;
+
if (gSavedSettings.getBOOL("AllowIdleAFK"))
{
gAgent.setAFK();
@@ -3244,8 +3245,7 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans
}
else
{
- llwarns << "List of last picks is empty" << llendl;
- llwarns << "Using stub pick" << llendl;
+ lldebugs << "List of last picks is empty: Using stub pick" << llendl;
mLastPick = LLPickInfo();
}
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
index 23832ba120..29e9b476eb 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -78,7 +78,7 @@
top_pad="10"
width="350" />
<check_box
- control_name="AutoPlayMedia"
+ control_name="ParcelMediaAutoPlayEnable"
height="16"
label="Allow Media Autoplay"
layout="topleft"
@@ -86,15 +86,6 @@
name="autoplay_enabled"
top_pad="10"
width="350" />
- <check_box
- control_name="ParcelMediaAutoPlayEnable"
- height="16"
- label="Automatically Play Parcel Media"
- layout="topleft"
- left="30"
- name="parcel_autoplay_enabled"
- top_pad="10"
- width="350" />
<text
type="string"
length="1"
diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt
index cc9fa598f2..c1360987a5 100644
--- a/indra/test/CMakeLists.txt
+++ b/indra/test/CMakeLists.txt
@@ -119,8 +119,10 @@ get_target_property(TEST_EXE test LOCATION)
IF(WINDOWS)
set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR})
+ELSEIF(DARWIN)
+ set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources:/usr/lib)
ELSE(WINDOWS)
- set(LD_LIBRARY_PATH ${ARCH_PREBUILT_DIRS}:${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}:/usr/lib)
+ set(LD_LIBRARY_PATH ${SHARED_LIB_STAGING_DIR}:/usr/lib)
ENDIF(WINDOWS)
LL_TEST_COMMAND("${LD_LIBRARY_PATH}"
diff --git a/indra/test/llevents_tut.cpp b/indra/test/llevents_tut.cpp
index 31130c3c79..e58b10ce07 100644
--- a/indra/test/llevents_tut.cpp
+++ b/indra/test/llevents_tut.cpp
@@ -21,6 +21,7 @@
#define testable public
#include "llevents.h"
#undef testable
+#include "lllistenerwrapper.h"
// STL headers
// std headers
#include <iostream>
@@ -639,6 +640,33 @@ namespace tut
heaptest.post(2);
}
+ template<> template<>
+ void events_object::test<15>()
+ {
+ // This test ensures that using an LLListenerWrapper subclass doesn't
+ // block Boost.Signals2 from recognizing a bound LLEventTrackable
+ // subclass.
+ set_test_name("listen(llwrap<LLLogListener>(boost::bind(...TempTrackableListener ref...)))");
+ bool live = false;
+ LLEventPump& heaptest(pumps.obtain("heaptest"));
+ LLBoundListener connection;
+ {
+ TempTrackableListener tempListener("temp", live);
+ ensure("TempTrackableListener constructed", live);
+ connection = heaptest.listen(tempListener.getName(),
+ llwrap<LLLogListener>(
+ boost::bind(&TempTrackableListener::call,
+ boost::ref(tempListener), _1)));
+ heaptest.post(1);
+ check_listener("received", tempListener, 1);
+ } // presumably this will make tempListener go away?
+ // verify that
+ ensure("TempTrackableListener destroyed", ! live);
+ ensure("implicit disconnect", ! connection.connected());
+ // now just make sure we don't blow up trying to access a freed object!
+ heaptest.post(2);
+ }
+
class TempSharedListener: public TempListener,
public boost::enable_shared_from_this<TempSharedListener>
{
@@ -649,7 +677,7 @@ namespace tut
};
template<> template<>
- void events_object::test<15>()
+ void events_object::test<16>()
{
set_test_name("listen(boost::bind(...TempSharedListener ref...))");
#if 0
diff --git a/indra/test/llsdutil_tut.cpp b/indra/test/llsdutil_tut.cpp
index d125bb0005..aebb1f9770 100644
--- a/indra/test/llsdutil_tut.cpp
+++ b/indra/test/llsdutil_tut.cpp
@@ -207,7 +207,7 @@ namespace tut
map.insert("Date", LLSD::Date());
map.insert("URI", LLSD::URI());
map.insert("Binary", LLSD::Binary());
- map.insert("Map", LLSD().insert("foo", LLSD()));
+ map.insert("Map", LLSD().with("foo", LLSD()));
// Only an empty array can be constructed on the fly
LLSD array;
array.append(LLSD());
diff --git a/indra/viewer_components/login/tests/lllogin_test.cpp b/indra/viewer_components/login/tests/lllogin_test.cpp
index 99ea796ad0..56c21016bd 100644
--- a/indra/viewer_components/login/tests/lllogin_test.cpp
+++ b/indra/viewer_components/login/tests/lllogin_test.cpp
@@ -416,7 +416,6 @@ namespace tut
ensure_equals("Failed to offline", listener.lastEvent()["state"].asString(), "offline");
}
-/*
template<> template<>
void llviewerlogin_object::test<5>()
{
@@ -452,5 +451,4 @@ namespace tut
ensure_equals("SRV Failure", listener.lastEvent()["change"].asString(), "fail.login");
}
-*/
}