Merge Firestorm LGPL

master
Ansariel 2019-05-09 19:52:27 +02:00
commit e6970af7a1
312 changed files with 5385 additions and 3990 deletions

View File

@ -588,3 +588,4 @@ ac3b1332ad4f55b7182a8cbcc1254535a0069f75 5.1.7-release
a3143db58a0f6b005232bf9018e7fef17ff9ec90 6.1.0-release
50f0ece62ddb5a244ecb6d00ef5a89d80ad50efa 6.1.1-release
82a89165e5929a6c3073d6cd60a543cb395f147b 6.2.0-release
706bdc7e25c6e6b8fb56f4a13fcce2936e70a79c 6.2.1-release

View File

@ -52,9 +52,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>08358023ceab8b055af5c3594b3dcc2c</string>
<string>68f6096e055e7a0e46913e1c2613b9db</string>
<key>url</key>
<string>http://downloads.phoenixviewer.com/dullahan_gcc5-1.1.1320_3.3626.1895.g7001d56-linux64-190811112.tar.bz2</string>
<string>http://downloads.phoenixviewer.com/dullahan_gcc5-1.1.1320_3.3626.1895.g7001d56-linux64-191221945.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
@ -838,9 +838,9 @@
<key>archive</key>
<map>
<key>hash</key>
<string>607f824220ac11cdc7ae9b5297f5f57a</string>
<string>48d316c0ceb898f7577015df75b6d303</string>
<key>url</key>
<string>http://downloads.phoenixviewer.com/dullahan-1.1.1320_3.3626.1895.g7001d56-linux64-190811046.tar.bz2</string>
<string>http://downloads.phoenixviewer.com/dullahan-1.1.1320_3.3626.1895.g7001d56-linux64-191221910.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>

View File

@ -260,6 +260,8 @@ Benja Kepler
VWR-746
Benjamin Bigdipper
Beth Walcher
Beq Janus
SL-10288
Bezilon Kasei
Biancaluce Robbiani
CT-225
@ -378,6 +380,7 @@ Cinder Roxley
STORM-2127
STORM-2136
STORM-2144
SL-3404
Clara Young
Coaldust Numbers
VWR-1095
@ -793,6 +796,7 @@ Jonathan Yap
STORM-2100
STORM-2104
STORM-2142
SL-10089
Kadah Coba
STORM-1060
STORM-1843
@ -1083,7 +1087,9 @@ Nicky Dasmijn
STORM-2010
STORM-2082
MAINT-6665
SL-11072
SL-10291
SL-10293
SL-11072
Nicky Perian
OPEN-1
STORM-1087

View File

@ -35,6 +35,7 @@ set(llcommon_SOURCE_FILES
llapp.cpp
llapr.cpp
llassettype.cpp
llatomic.cpp
llbase32.cpp
llbase64.cpp
llbitpack.cpp
@ -135,6 +136,7 @@ set(llcommon_HEADER_FILES
llapp.h
llapr.h
llassettype.h
llatomic.h
llbase32.h
llbase64.h
llbitpack.h

View File

@ -157,7 +157,6 @@ const U8 SIM_ACCESS_DOWN = 254;
const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
// attachment constants
const S32 MAX_AGENT_ATTACHMENTS = 38;
const U8 ATTACHMENT_ADD = 0x80;
// god levels

View File

@ -78,9 +78,7 @@ void setup_signals();
void default_unix_signal_handler(int signum, siginfo_t *info, void *);
#if LL_LINUX
#include "google_breakpad/minidump_descriptor.h"
static bool unix_minidump_callback(const google_breakpad::MinidumpDescriptor& minidump_desc,
void* context,
bool succeeded);

View File

@ -32,7 +32,6 @@
#include "llsd.h"
#include <atomic>
// Forward declarations
class LLErrorThread;
class LLLiveFile;
#if LL_LINUX

View File

@ -28,6 +28,7 @@
#include "linden_common.h"
#include "llapr.h"
#include "llmutex.h"
#include "apr_dso.h"
#include "llthreadlocalstorage.h"
@ -44,10 +45,14 @@ void ll_init_apr()
apr_initialize();
if (!gAPRPoolp)
{
apr_pool_create(&gAPRPoolp, NULL);
}
if(!LLAPRFile::sAPRFilePoolp)
{
LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
}
LLThreadLocalPointerBase::initAllThreadLocalStorage();
gAPRInitialized = true;
@ -65,9 +70,6 @@ void ll_cleanup_apr()
LL_INFOS("APR") << "Cleaning up APR" << LL_ENDL;
// Clean up the logging mutex
// All other threads NEED to be done before we clean up APR, so this is okay.
LLThreadLocalPointerBase::destroyAllThreadLocalStorage();
if (gAPRPoolp)
@ -144,9 +146,7 @@ apr_pool_t* LLAPRPool::getAPRPool()
LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
: LLAPRPool(parent, size, releasePoolFlag),
mNumActiveRef(0),
mNumTotalRef(0),
mMutexPool(NULL),
mMutexp(NULL)
mNumTotalRef(0)
{
//create mutex
@ -161,15 +161,14 @@ LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size
// </FS:ND>
{
apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex
mMutexp = new std::mutex();
mMutexp.reset(new std::mutex());
}
}
LLVolatileAPRPool::~LLVolatileAPRPool()
{
delete mMutexp;
mMutexp = nullptr;
//delete mutex
mMutexp.reset();
}
//
@ -183,7 +182,7 @@ apr_pool_t* LLVolatileAPRPool::getAPRPool()
apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
{
LLScopedLock lock(mMutexp) ;
LLScopedLock lock(mMutexp.get()) ;
mNumTotalRef++ ;
mNumActiveRef++ ;
@ -198,7 +197,7 @@ apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
void LLVolatileAPRPool::clearVolatileAPRPool()
{
LLScopedLock lock(mMutexp) ;
LLScopedLock lock(mMutexp.get());
if(mNumActiveRef > 0)
{
@ -232,36 +231,6 @@ BOOL LLVolatileAPRPool::isFull()
{
return mNumTotalRef > FULL_VOLATILE_APR_POOL ;
}
//---------------------------------------------------------------------
//
// LLScopedLock
//
LLScopedLock::LLScopedLock(std::mutex* mutex) : mMutex(mutex)
{
if(mutex)
{
mutex->lock();
mLocked = true;
}
else
{
mLocked = false;
}
}
LLScopedLock::~LLScopedLock()
{
unlock();
}
void LLScopedLock::unlock()
{
if(mLocked)
{
mMutex->unlock();
mLocked = false;
}
}
//---------------------------------------------------------------------

View File

@ -36,23 +36,23 @@
#include <boost/noncopyable.hpp>
#include "llwin32headerslean.h"
#include "apr_thread_proc.h"
#include "apr_getopt.h"
#include "apr_signal.h"
#include <atomic>
#include "llstring.h"
#if LL_WINDOWS
#pragma warning(disable:4265)
#pragma warning (push)
#pragma warning (disable:4265)
#endif
// warning C4265: 'std::_Pad' : class has virtual functions, but destructor is not virtual
#include <mutex>
#if LL_WINDOWS
#pragma warning(default:4265)
#pragma warning (pop)
#endif
#include "llstring.h"
struct apr_dso_handle_t;
/**
* @brief Function which appropriately logs error or remains quiet on
@ -127,85 +127,9 @@ private:
S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating.
std::mutex *mMutexp;
apr_pool_t *mMutexPool;
std::unique_ptr<std::mutex> mMutexp;
} ;
/**
* @class LLScopedLock
* @brief Small class to help lock and unlock mutexes.
*
* This class is used to have a stack level lock once you already have
* an apr mutex handy. The constructor handles the lock, and the
* destructor handles the unlock. Instances of this class are
* <b>not</b> thread safe.
*/
class LL_COMMON_API LLScopedLock : private boost::noncopyable
{
public:
/**
* @brief Constructor which accepts a mutex, and locks it.
*
* @param mutex An allocated APR mutex. If you pass in NULL,
* this wrapper will not lock.
*/
LLScopedLock( std::mutex* mutex );
/**
* @brief Destructor which unlocks the mutex if still locked.
*/
~LLScopedLock();
/**
* @brief Check lock.
*/
bool isLocked() const { return mLocked; }
/**
* @brief This method unlocks the mutex.
*/
void unlock();
protected:
bool mLocked;
std::mutex* mMutex;
};
template <typename Type, typename AtomicType = std::atomic< Type > > class LLAtomicBase
{
public:
LLAtomicBase() {};
LLAtomicBase( Type x ) { mData.store( x ); };
~LLAtomicBase() {};
operator const Type() { return mData; }
Type CurrentValue() const { return mData; }
Type operator =( Type x) { mData.store( x ); return mData; }
void operator -=(Type x) { mData -= x; }
void operator +=(Type x) { mData += x; }
Type operator ++(int) { return mData++; }
Type operator --(int) { return mData--; }
Type operator ++() { return ++mData; }
Type operator --() { return --mData; }
private:
AtomicType mData;
};
// ND: Typedefs for specialized versions. Using std::atomic_(u)int32_t to get the optimzed implementation.
#ifdef LL_WINDOWS
typedef LLAtomicBase<U32, std::atomic_uint32_t> LLAtomicU32;
typedef LLAtomicBase<S32, std::atomic_int32_t> LLAtomicS32;
#else
typedef LLAtomicBase<U32, std::atomic_uint> LLAtomicU32;
typedef LLAtomicBase<S32, std::atomic_int> LLAtomicS32;
#endif
typedef LLAtomicBase<bool, std::atomic_bool> LLAtomicBool;
// File IO convenience functions.
// Returns NULL if the file fails to open, sets *sizep to file size if not NULL
// abbreviated flags

View File

@ -0,0 +1,29 @@
/**
* @file llatomic.cpp
*
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// <FS:Ansariel> Fix LNK4221 compiler warning
//#include "llatomic.h"
//============================================================================

69
indra/llcommon/llatomic.h Normal file
View File

@ -0,0 +1,69 @@
/**
* @file llatomic.h
* @brief Base classes for atomic.
*
* $LicenseInfo:firstyear=2018&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2018, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLATOMIC_H
#define LL_LLATOMIC_H
#include "stdtypes.h"
#include <atomic>
template <typename Type, typename AtomicType = std::atomic< Type > > class LLAtomicBase
{
public:
LLAtomicBase() {};
LLAtomicBase(Type x) { mData.store(x); }
~LLAtomicBase() {};
operator const Type() { return mData; }
Type CurrentValue() const { return mData; }
Type operator =(const Type& x) { mData.store(x); return mData; }
void operator -=(Type x) { mData -= x; }
void operator +=(Type x) { mData += x; }
Type operator ++(int) { return mData++; }
Type operator --(int) { return mData--; }
Type operator ++() { return ++mData; }
Type operator --() { return --mData; }
private:
AtomicType mData;
};
// Typedefs for specialized versions. Using std::atomic_(u)int32_t to get the optimzed implementation.
#ifdef LL_WINDOWS
typedef LLAtomicBase<U32, std::atomic_uint32_t> LLAtomicU32;
typedef LLAtomicBase<S32, std::atomic_int32_t> LLAtomicS32;
#else
typedef LLAtomicBase<U32, std::atomic_uint> LLAtomicU32;
typedef LLAtomicBase<S32, std::atomic_int> LLAtomicS32;
#endif
typedef LLAtomicBase<bool, std::atomic_bool> LLAtomicBool;
#endif // LL_LLATOMIC_H

View File

@ -56,9 +56,6 @@
#include "nd/ndlogthrottle.h"
namespace {
LLMutex gLogMutex;
LLMutex gCallStacksLogMutex ;
#if LL_WINDOWS
void debugger_print(const std::string& s)
{
@ -1190,6 +1187,9 @@ namespace
}
namespace {
LLMutex gLogMutex;
LLMutex gCallStacksLogMutex;
bool checkLevelMap(const LevelMap& map, const std::string& key,
LLError::ELevel& level)
{
@ -1241,8 +1241,8 @@ namespace LLError
bool Log::shouldLog(CallSite& site)
{
LLMutexTrylock lock( &gLogMutex,5);
if (!lock.isLocked() )
LLMutexTrylock lock(&gLogMutex, 5);
if (!lock.isLocked())
{
return false;
}
@ -1527,69 +1527,6 @@ namespace LLError
char** LLCallStacks::sBuffer = NULL ;
S32 LLCallStacks::sIndex = 0 ;
#define SINGLE_THREADED 1
class CallStacksLogLock
{
public:
CallStacksLogLock();
~CallStacksLogLock();
#if SINGLE_THREADED
bool ok() const { return true; }
#else
bool ok() const { return mOK; }
private:
bool mLocked;
bool mOK;
#endif
};
#if SINGLE_THREADED
CallStacksLogLock::CallStacksLogLock()
{
}
CallStacksLogLock::~CallStacksLogLock()
{
}
#else
CallStacksLogLock::CallStacksLogLock()
: mLocked(false), mOK(false)
{
if (!gCallStacksLogMutexp)
{
mOK = true;
return;
}
const int MAX_RETRIES = 5;
for (int attempts = 0; attempts < MAX_RETRIES; ++attempts)
{
apr_status_t s = apr_thread_mutex_trylock(gCallStacksLogMutexp);
if (!APR_STATUS_IS_EBUSY(s))
{
mLocked = true;
mOK = true;
return;
}
ms_sleep(1);
}
// We're hosed, we can't get the mutex. Blah.
std::cerr << "CallStacksLogLock::CallStacksLogLock: failed to get mutex for log"
<< std::endl;
}
CallStacksLogLock::~CallStacksLogLock()
{
if (mLocked)
{
apr_thread_mutex_unlock(gCallStacksLogMutexp);
}
}
#endif
//static
void LLCallStacks::allocateStackBuffer()
{
@ -1618,8 +1555,8 @@ namespace LLError
//static
void LLCallStacks::push(const char* function, const int line)
{
CallStacksLogLock lock;
if (!lock.ok())
LLMutexTrylock lock(&gCallStacksLogMutex, 5);
if (!lock.isLocked())
{
return;
}
@ -1653,8 +1590,8 @@ namespace LLError
//static
void LLCallStacks::end(std::ostringstream* _out)
{
CallStacksLogLock lock;
if (!lock.ok())
LLMutexTrylock lock(&gCallStacksLogMutex, 5);
if (!lock.isLocked())
{
return;
}
@ -1675,8 +1612,8 @@ namespace LLError
//static
void LLCallStacks::print()
{
CallStacksLogLock lock;
if (!lock.ok())
LLMutexTrylock lock(&gCallStacksLogMutex, 5);
if (!lock.isLocked())
{
return;
}
@ -1713,7 +1650,7 @@ namespace LLError
bool debugLoggingEnabled(const std::string& tag)
{
LLMutexTrylock lock(&gLogMutex,5);
LLMutexTrylock lock(&gLogMutex, 5);
if (!lock.isLocked())
{
return false;

View File

@ -72,7 +72,6 @@ bool BlockTimer::sMetricLog = false;
#endif
#if LL_LINUX || LL_SOLARIS || LL_DARWIN // AO: Add LL_DARWIN to this list now
U64 BlockTimer::sClockResolution = 1000000000; // Nanosecond resolution
#else
U64 BlockTimer::sClockResolution = 1000000; // Microsecond resolution
#endif

View File

@ -35,6 +35,7 @@
#define LL_FASTTIMER_USE_RDTSC 1
#define LL_RECORD_BLOCK_TIME(timer_stat) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(timer_stat)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__);
namespace LLTrace
{
// use to create blocktimer rvalue to be captured in a reference so that the BlockTimer lives to the end of the block.

View File

@ -30,7 +30,8 @@
LLFixedBuffer::LLFixedBuffer(const U32 max_lines)
: LLLineBuffer(),
mMaxLines(max_lines)
mMaxLines(max_lines),
mMutex()
{
mTimer.reset();
}

View File

@ -28,6 +28,7 @@
#ifndef LL_LLINSTANCETRACKER_H
#define LL_LLINSTANCETRACKER_H
#include <atomic>
#include <map>
#include <typeinfo>
@ -120,12 +121,12 @@ protected:
void decrementDepth();
U32 getDepth();
private:
#ifdef LL_WINDOWS
#ifdef LL_WINDOWS
std::atomic_uint32_t sIterationNestDepth;
#else
#else
std::atomic_uint sIterationNestDepth;
#endif
};
#endif
};
};
LL_COMMON_API void assert_main_thread();

View File

@ -24,27 +24,22 @@
*/
#include "linden_common.h"
#include "llapr.h"
#include "apr_portable.h"
#include "llmutex.h"
#include "llthread.h"
#include "lltimer.h"
//============================================================================
LLMutex::LLMutex() :
mCount(0), mLockingThread(NO_THREAD)
mCount(0),
mLockingThread(NO_THREAD)
{
}
LLMutex::~LLMutex()
{
#if MUTEX_DEBUG
//bad assertion, the subclass LLSignal might be "locked", and that's OK
//llassert_always(!isLocked()); // better not be locked!
#endif
}
@ -92,7 +87,9 @@ void LLMutex::unlock()
bool LLMutex::isLocked()
{
if (!mMutex.try_lock())
{
return true;
}
else
{
mMutex.unlock();
@ -119,8 +116,10 @@ bool LLMutex::trylock()
}
if (!mMutex.try_lock())
{
return false;
}
#if MUTEX_DEBUG
// Have to have the lock before we can access the debug info
U32 id = LLThread::currentID();
@ -135,23 +134,26 @@ bool LLMutex::trylock()
//============================================================================
LLCondition::LLCondition()
LLCondition::LLCondition() :
LLMutex()
{
}
LLCondition::~LLCondition()
{
}
void LLCondition::wait()
{
std::unique_lock< std::mutex > lock( mMutex );
mCond.wait( lock );
std::unique_lock< std::mutex > lock(mMutex);
mCond.wait(lock);
}
void LLCondition::signal()
{
mCond.notify_one() ;
mCond.notify_one();
}
void LLCondition::broadcast()
@ -160,4 +162,67 @@ void LLCondition::broadcast()
}
LLMutexTrylock::LLMutexTrylock(LLMutex* mutex)
: mMutex(mutex),
mLocked(false)
{
if (mMutex)
mLocked = mMutex->trylock();
}
LLMutexTrylock::LLMutexTrylock(LLMutex* mutex, U32 aTries, U32 delay_ms)
: mMutex(mutex),
mLocked(false)
{
if (!mMutex)
return;
for (U32 i = 0; i < aTries; ++i)
{
mLocked = mMutex->trylock();
if (mLocked)
break;
ms_sleep(delay_ms);
}
}
LLMutexTrylock::~LLMutexTrylock()
{
if (mMutex && mLocked)
mMutex->unlock();
}
//---------------------------------------------------------------------
//
// LLScopedLock
//
LLScopedLock::LLScopedLock(std::mutex* mutex) : mMutex(mutex)
{
if(mutex)
{
mutex->lock();
mLocked = true;
}
else
{
mLocked = false;
}
}
LLScopedLock::~LLScopedLock()
{
unlock();
}
void LLScopedLock::unlock()
{
if(mLocked)
{
mMutex->unlock();
mLocked = false;
}
}
//============================================================================

View File

@ -28,18 +28,20 @@
#define LL_LLMUTEX_H
#include "stdtypes.h"
#include "lltimer.h"
#include <boost/noncopyable.hpp>
#if LL_WINDOWS
#pragma warning(disable:4265)
#pragma warning (push)
#pragma warning (disable:4265)
#endif
// 'std::_Pad' : class has virtual functions, but destructor is not virtual
#include <mutex>
#include <condition_variable>
#if LL_WINDOWS
#pragma warning(default:4265)
#pragma warning (pop)
#endif
//============================================================================
#define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO)
@ -48,7 +50,6 @@
#include <map>
#endif
class LL_COMMON_API LLMutex
{
public:
@ -57,7 +58,7 @@ public:
NO_THREAD = 0xFFFFFFFF
} e_locking_thread;
LLMutex(); // NULL pool constructs a new pool for the mutex
LLMutex();
virtual ~LLMutex();
void lock(); // blocks
@ -68,12 +69,10 @@ public:
U32 lockingThread() const; //get ID of locking thread
protected:
std::mutex mMutex;
std::mutex mMutex;
mutable U32 mCount;
mutable U32 mLockingThread;
bool mIsLocalPool;
#if MUTEX_DEBUG
std::map<U32, BOOL> mIsLocked;
#endif
@ -83,7 +82,7 @@ protected:
class LL_COMMON_API LLCondition : public LLMutex
{
public:
LLCondition(); // Defaults to global pool, could use the thread pool as well.
LLCondition();
~LLCondition();
void wait(); // blocks
@ -126,36 +125,9 @@ private:
class LLMutexTrylock
{
public:
LLMutexTrylock(LLMutex* mutex)
: mMutex(mutex),
mLocked(false)
{
if (mMutex)
mLocked = mMutex->trylock();
}
LLMutexTrylock( LLMutex* mutex, U32 aTries )
: mMutex( mutex ),
mLocked( false )
{
if( !mMutex )
return;
U32 i = 0;
while( i < aTries )
{
mLocked = mMutex->trylock();
if( mLocked )
break;
++i;
ms_sleep( 10 );
}
}
~LLMutexTrylock()
{
if (mMutex && mLocked)
mMutex->unlock();
}
LLMutexTrylock(LLMutex* mutex);
LLMutexTrylock(LLMutex* mutex, U32 aTries, U32 delay_ms = 10);
~LLMutexTrylock();
bool isLocked() const
{
@ -166,4 +138,43 @@ private:
LLMutex* mMutex;
bool mLocked;
};
#endif // LL_LLTHREAD_H
/**
* @class LLScopedLock
* @brief Small class to help lock and unlock mutexes.
*
* The constructor handles the lock, and the destructor handles
* the unlock. Instances of this class are <b>not</b> thread safe.
*/
class LL_COMMON_API LLScopedLock : private boost::noncopyable
{
public:
/**
* @brief Constructor which accepts a mutex, and locks it.
*
* @param mutex An allocated mutex. If you pass in NULL,
* this wrapper will not lock.
*/
LLScopedLock(std::mutex* mutex);
/**
* @brief Destructor which unlocks the mutex if still locked.
*/
~LLScopedLock();
/**
* @brief Check lock.
*/
bool isLocked() const { return mLocked; }
/**
* @brief This method unlocks the mutex.
*/
void unlock();
protected:
bool mLocked;
std::mutex* mMutex;
};
#endif // LL_LLMUTEX_H

View File

@ -36,10 +36,10 @@
LLQueuedThread::LLQueuedThread(const std::string& name, bool threaded, bool should_pause) :
LLThread(name),
mThreaded(threaded),
mIdleThread(true),
mNextHandle(0),
mStarted(FALSE)
{
mIdleThread = true;
if (mThreaded)
{
if(should_pause)

View File

@ -32,7 +32,7 @@
#include <map>
#include <set>
#include "llapr.h"
#include "llatomic.h"
#include "llthread.h"
#include "llsimplehash.h"

View File

@ -29,25 +29,9 @@
#include "llerror.h"
#if LL_REF_COUNT_DEBUG
#include "llthread.h"
#include "llapr.h"
#endif
LLRefCount::LLRefCount(const LLRefCount& other)
: mRef(0)
{
#if LL_REF_COUNT_DEBUG
if(gAPRPoolp)
{
mMutexp = new LLMutex(gAPRPoolp) ;
}
else
{
mMutexp = NULL ;
}
mCrashAtUnlock = FALSE ;
#endif
}
LLRefCount& LLRefCount::operator=(const LLRefCount&)
@ -59,17 +43,6 @@ LLRefCount& LLRefCount::operator=(const LLRefCount&)
LLRefCount::LLRefCount() :
mRef(0)
{
#if LL_REF_COUNT_DEBUG
if(gAPRPoolp)
{
mMutexp = new LLMutex(gAPRPoolp) ;
}
else
{
mMutexp = NULL ;
}
mCrashAtUnlock = FALSE ;
#endif
}
LLRefCount::~LLRefCount()
@ -78,87 +51,5 @@ LLRefCount::~LLRefCount()
{
LL_ERRS() << "deleting non-zero reference" << LL_ENDL;
}
#if LL_REF_COUNT_DEBUG
if(gAPRPoolp)
{
delete mMutexp ;
}
#endif
}
#if LL_REF_COUNT_DEBUG
void LLRefCount::ref() const
{
if(mMutexp)
{
if(mMutexp->isLocked())
{
mCrashAtUnlock = TRUE ;
LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID
<< " Current thread: " << LLThread::currentID() << LL_ENDL ;
}
mMutexp->lock() ;
mLockedThreadID = LLThread::currentID() ;
mRef++;
if(mCrashAtUnlock)
{
while(1); //crash here.
}
mMutexp->unlock() ;
}
else
{
mRef++;
}
}
S32 LLRefCount::unref() const
{
if(mMutexp)
{
if(mMutexp->isLocked())
{
mCrashAtUnlock = TRUE ;
LL_ERRS() << "the mutex is locked by the thread: " << mLockedThreadID
<< " Current thread: " << LLThread::currentID() << LL_ENDL ;
}
mMutexp->lock() ;
mLockedThreadID = LLThread::currentID() ;
llassert(mRef >= 1);
if (0 == --mRef)
{
if(mCrashAtUnlock)
{
while(1); //crash here.
}
mMutexp->unlock() ;
delete this;
return 0;
}
if(mCrashAtUnlock)
{
while(1); //crash here.
}
mMutexp->unlock() ;
return mRef;
}
else
{
llassert(mRef >= 1);
if (0 == --mRef)
{
delete this;
return 0;
}
return mRef;
}
}
#endif

View File

@ -29,12 +29,7 @@
#include <boost/noncopyable.hpp>
#include <boost/intrusive_ptr.hpp>
#include "llmutex.h"
#include "llapr.h"
#define LL_REF_COUNT_DEBUG 0
#if LL_REF_COUNT_DEBUG
class LLMutex ;
#endif
#include "llatomic.h"
//----------------------------------------------------------------------------
// RefCount objects should generally only be accessed by way of LLPointer<>'s
@ -51,10 +46,6 @@ protected:
public:
LLRefCount();
#if LL_REF_COUNT_DEBUG
void ref() const ;
S32 unref() const ;
#else
inline void ref() const
{
mRef++;
@ -69,8 +60,7 @@ public:
return 0;
}
return mRef;
}
#endif
}
//NOTE: when passing around a const LLRefCount object, this can return different results
// at different types, since mRef is mutable
@ -81,12 +71,6 @@ public:
private:
mutable S32 mRef;
#if LL_REF_COUNT_DEBUG
LLMutex* mMutexp ;
mutable uintptr_t mLockedThreadID ;
mutable BOOL mCrashAtUnlock ;
#endif
};
@ -123,8 +107,8 @@ public:
void unref()
{
llassert(mRef >= 1);
if ((--mRef) == 0) // See note in llapr.h on atomic decrement operator return value.
{
if ((--mRef) == 0)
{
// If we hit zero, the caller should be the only smart pointer owning the object and we can delete it.
// It is technically possible for a vanilla pointer to mess this up, or another thread to
// jump in, find this object, create another smart pointer and end up dangling, but if
@ -140,7 +124,7 @@ public:
}
private:
LLAtomicS32 mRef;
LLAtomicS32 mRef;
};
/**

View File

@ -116,27 +116,27 @@ void LLThread::registerThreadID()
//
// Handed to the APR thread creation function
//
void LLThread::threadRun()
void LLThread::threadRun()
{
#ifdef LL_WINDOWS
set_thread_name( -1, mName.c_str() );
set_thread_name(-1, mName.c_str());
#endif
// for now, hard code all LLThreads to report to single master thread recorder, which is known to be running on main thread
mRecorder = new LLTrace::ThreadRecorder( *LLTrace::get_master_thread_recorder() );
mRecorder = new LLTrace::ThreadRecorder(*LLTrace::get_master_thread_recorder());
sThreadID = mID;
sThreadID = mID;
// Run the user supplied function
do
{
try
{
run();
run();
}
catch (const LLContinueError &e)
{
LL_WARNS( "THREAD" ) << "ContinueException on thread '" << mName <<
LL_WARNS("THREAD") << "ContinueException on thread '" << mName <<
"' reentering run(). Error what is: '" << e.what() << "'" << LL_ENDL;
//output possible call stacks to log file.
LLError::LLCallStacks::print();
@ -152,15 +152,13 @@ void LLThread::threadRun()
delete mRecorder;
mRecorder = nullptr;
mRecorder = NULL;
// We're done with the run function, this thread is done executing now.
//NB: we are using this flag to sync across threads...we really need memory barriers here
// Todo: add LLMutex per thread instead of flag?
// We are using "while (mStatus != STOPPED) {ms_sleep();}" everywhere.
mStatus = STOPPED;
return;
}
LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
@ -172,7 +170,6 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
{
mID = ++sIDIter;
mRunCondition = new LLCondition();
mDataLock = new LLMutex();
mLocalAPRFilePoolp = NULL ;
@ -204,7 +201,7 @@ void LLThread::shutdown()
// Warning! If you somehow call the thread destructor from itself,
// the thread will die in an unclean fashion!
if( mThreadp )
if (mThreadp)
{
if (!isStopped())
{
@ -235,16 +232,19 @@ void LLThread::shutdown()
{
// This thread just wouldn't stop, even though we gave it time
//LL_WARNS() << "LLThread::~LLThread() exiting thread before clean exit!" << LL_ENDL;
// Put a stake in its heart.
// ND: There is no such thing as to terminate a std::thread, we detach it so no wait will happen.
// Otherwise craft something platform specific with std::thread::native_handle
mThreadp->detach();
// Put a stake in its heart. (A very hostile method to force a thread to quit)
#if LL_WINDOWS
TerminateThread(mNativeHandle, 0);
#else
pthread_cancel(mNativeHandle);
#endif
delete mRecorder;
mRecorder = NULL;
mStatus = STOPPED;
return;
}
mThreadp = NULL;
mThreadp = NULL;
}
delete mRunCondition;
@ -252,7 +252,7 @@ void LLThread::shutdown()
delete mDataLock;
mDataLock = NULL;
if (mRecorder)
{
// missed chance to properly shut down recorder (needs to be done in thread context)
@ -270,16 +270,17 @@ void LLThread::start()
// Set thread state to running
mStatus = RUNNING;
try
{
mThreadp = new std::thread( std::bind( &LLThread::threadRun, this ) );
//mThreadp->detach();
}
catch( std::system_error& ex )
{
mStatus = STOPPED;
LL_WARNS() << "failed to start thread " << mName << " " << ex.what() << LL_ENDL;
try
{
mThreadp = new std::thread(std::bind(&LLThread::threadRun, this));
mNativeHandle = mThreadp->native_handle();
}
catch (std::system_error& ex)
{
mStatus = STOPPED;
LL_WARNS() << "failed to start thread " << mName << " " << ex.what() << LL_ENDL;
}
}
//============================================================================
@ -354,7 +355,7 @@ U32 LLThread::currentID()
// static
void LLThread::yield()
{
std::this_thread::yield();
std::this_thread::yield();
}
void LLThread::wake()
@ -395,7 +396,7 @@ void LLThreadSafeRefCount::initThreadSafeRefCount()
void LLThreadSafeRefCount::cleanupThreadSafeRefCount()
{
delete sMutex;
sMutex = nullptr;
sMutex = NULL;
}

View File

@ -29,11 +29,9 @@
#include "llapp.h"
#include "llapr.h"
#include "apr_thread_cond.h"
#include "boost/intrusive_ptr.hpp"
#include "llmutex.h"
#include "llrefcount.h"
#include <thread>
LL_COMMON_API void assert_main_thread();
@ -99,15 +97,17 @@ public:
private:
bool mPaused;
std::thread::native_handle_type mNativeHandle; // for termination in case of issues
void threadRun( );
// static function passed to APR thread creation routine
void threadRun();
protected:
std::string mName;
class LLCondition* mRunCondition;
LLMutex* mDataLock;
std::thread *mThreadp;
std::thread *mThreadp;
EThreadStatus mStatus;
U32 mID;
LLTrace::ThreadRecorder* mRecorder;

View File

@ -26,3 +26,4 @@
//#include "linden_common.h"
//#include "llthreadsafequeue.h"

View File

@ -28,10 +28,20 @@
#define LL_LLTHREADSAFEQUEUE_H
#include "llexception.h"
#include "llmutex.h"
#include "lltimer.h"
#include <string>
#include <deque>
#include <string>
#if LL_WINDOWS
#pragma warning (push)
#pragma warning (disable:4265)
#endif
// 'std::_Pad' : class has virtual functions, but destructor is not virtual
#include <mutex>
#include <condition_variable>
#if LL_WINDOWS
#pragma warning (pop)
#endif
//
// A general queue exception.
@ -62,8 +72,6 @@ public:
}
};
//
// Implements a thread safe FIFO.
//
@ -75,7 +83,7 @@ public:
// If the pool is set to NULL one will be allocated and managed by this
// queue.
LLThreadSafeQueue( U32 capacity = 1024);
LLThreadSafeQueue(U32 capacity = 1024);
// Add an element to the front of queue (will block if the queue has
// reached capacity).
@ -104,99 +112,102 @@ public:
private:
std::deque< ElementT > mStorage;
LLCondition mLock;;
U32 mCapacity; // Really needed?
U32 mCapacity;
std::mutex mLock;
std::condition_variable mCapacityCond;
std::condition_variable mEmptyCond;
};
// LLThreadSafeQueue
//-----------------------------------------------------------------------------
template<typename ElementT>
LLThreadSafeQueue<ElementT>::LLThreadSafeQueue( U32 capacity):
mCapacity( capacity )
LLThreadSafeQueue<ElementT>::LLThreadSafeQueue(U32 capacity) :
mCapacity(capacity)
{
; // No op.
}
template<typename ElementT>
void LLThreadSafeQueue<ElementT>::pushFront(ElementT const & element)
{
while( true )
{
{
LLMutexLock lck( &mLock );
if( mStorage.size() < mCapacity )
{
mStorage.push_front( element );
mLock.signal();
return;
}
}
ms_sleep( 100 );
}
while (true)
{
std::unique_lock<std::mutex> lock1(mLock);
if (mStorage.size() < mCapacity)
{
mStorage.push_front(element);
mEmptyCond.notify_one();
return;
}
// Storage Full. Wait for signal.
mCapacityCond.wait(lock1);
}
}
template<typename ElementT>
bool LLThreadSafeQueue<ElementT>::tryPushFront(ElementT const & element)
{
LLMutexTrylock lck( &mLock );
if( !lck.isLocked() )
return false;
std::unique_lock<std::mutex> lock1(mLock, std::defer_lock);
if (!lock1.try_lock())
return false;
if( mStorage.size() >= mCapacity )
return false;
if (mStorage.size() >= mCapacity)
return false;
mStorage.push_front( element );
mLock.signal();
return true;
mStorage.push_front(element);
mEmptyCond.notify_one();
return true;
}
template<typename ElementT>
ElementT LLThreadSafeQueue<ElementT>::popBack(void)
{
while( true )
{
mLock.wait();
if( !mStorage.empty() )
{
ElementT value = mStorage.back();
mStorage.pop_back();
return value;
}
}
while (true)
{
std::unique_lock<std::mutex> lock1(mLock);
if (!mStorage.empty())
{
ElementT value = mStorage.back();
mStorage.pop_back();
mCapacityCond.notify_one();
return value;
}
// Storage empty. Wait for signal.
mEmptyCond.wait(lock1);
}
}
template<typename ElementT>
bool LLThreadSafeQueue<ElementT>::tryPopBack(ElementT & element)
{
LLMutexTrylock lck( &mLock );
std::unique_lock<std::mutex> lock1(mLock, std::defer_lock);
if (!lock1.try_lock())
return false;
if( !lck.isLocked() )
return false;
if( mStorage.empty() )
return false;
if (mStorage.empty())
return false;
element = mStorage.back();
mStorage.pop_back();
return true;
element = mStorage.back();
mStorage.pop_back();
mCapacityCond.notify_one();
return true;
}
template<typename ElementT>
size_t LLThreadSafeQueue<ElementT>::size(void)
{
// Nicky: apr_queue_size is/was NOT threadsafe. I still play it safe here and rather lock the storage
LLMutexLock lck( &mLock );
return mStorage.size();
std::lock_guard<std::mutex> lock(mLock);
return mStorage.size();
}
#endif

View File

@ -204,6 +204,7 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na
mWorkerClassName(name),
mRequestHandle(LLWorkerThread::nullHandle()),
mRequestPriority(LLWorkerThread::PRIORITY_NORMAL),
mMutex(),
mWorkFlags(0)
{
if (!mWorkerThread)

View File

@ -33,7 +33,7 @@
#include <string>
#include "llqueuedthread.h"
#include "llapr.h"
#include "llatomic.h"
#define USE_FRAME_CALLBACK_MANAGER 0

View File

@ -565,6 +565,11 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
// about 700 or so requests and starts issuing TCP RSTs to
// new connections. Reuse the DNS lookups for even a few
// seconds and no RSTs.
//
// -1 stores forever
// 0 never stores
// any other positive number specifies seconds
// supposedly curl 7.62.0 can use TTL by default, otherwise default is 60 seconds
check_curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, dnsCacheTimeout);
if (gpolicy.mUseLLProxy)

View File

@ -31,7 +31,7 @@
#include <vector>
#include "linden_common.h"
#include "llapr.h"
#include "llatomic.h"
#include "httpcommon.h"
#include "httprequest.h"
#include "_httppolicyglobal.h"

View File

@ -34,7 +34,7 @@
#include <boost/thread.hpp>
#include <boost/intrusive_ptr.hpp>
#include "llapr.h"
#include "llatomic.h"
namespace LLCoreInt

View File

@ -33,6 +33,7 @@
#include <boost/function.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include "apr.h" // thread-related functions
#include "_refcounted.h"
namespace LLCoreInt

View File

@ -2903,6 +2903,13 @@ void HttpRequestTestObjectType::test<22>()
set_test_name("BUG-2295");
#if LL_WINDOWS && ADDRESS_SIZE == 64
// teamcity win64 builds freeze on this test, if you figure out the cause, please fix it
if (getenv("TEAMCITY_PROJECT_NAME"))
{
skip("BUG-2295 - partial load on W64 causes freeze");
}
#endif
// Handler can be stack-allocated *if* there are no dangling
// references to it after completion of this method.
// Create before memory record as the string copy will bump numbers.
@ -2921,6 +2928,7 @@ void HttpRequestTestObjectType::test<22>()
// options set
options = HttpOptions::ptr_t(new HttpOptions());
options->setRetries(1); // Partial_File is retryable and can timeout in here
options->setDNSCacheTimeout(30);
// Get singletons created
HttpRequest::createService();
@ -3091,7 +3099,11 @@ void HttpRequestTestObjectType::test<23>()
set_test_name("HttpRequest GET 503s with 'Retry-After'");
#if LL_WINDOWS && ADDRESS_SIZE == 64
skip("llcorehttp 503-with-retry test hangs on Windows 64");
// teamcity win64 builds freeze on this test, if you figure out the cause, please fix it
if (getenv("TEAMCITY_PROJECT_NAME"))
{
skip("llcorehttp 503-with-retry test hangs on Windows 64");
}
#endif
// This tests mainly that the code doesn't fall over if

View File

@ -27,6 +27,7 @@
#include "linden_common.h"
#include "llapr.h" // thread-related functions
#include "llcrashlock.h"
#include "lldir.h"
#include "llsd.h"

View File

@ -48,7 +48,7 @@ LLVolumeMgr::LLVolumeMgr()
{
// the LLMutex magic interferes with easy unit testing,
// so you now must manually call useMutex() to use it
//mDataMutex = new LLMutex(gAPRPoolp);
//mDataMutex = new LLMutex();
}
LLVolumeMgr::~LLVolumeMgr()

View File

@ -48,6 +48,7 @@ static void tcp_close_channel(LLSocket::ptr_t* handle_ptr); // Close an open TCP
LLProxy::LLProxy():
mHTTPProxyEnabled(false),
mProxyMutex(),
mUDPProxy(),
mTCPProxy(),
mHTTPProxy(),

View File

@ -54,11 +54,7 @@
// constants for poll timeout. if we are threading, we want to have a
// longer poll timeout.
#if LL_THREADS_APR
static const S32 DEFAULT_POLL_TIMEOUT = 1000;
#else
static const S32 DEFAULT_POLL_TIMEOUT = 0;
#endif
// The default (and fallback) expiration time for chains
const F32 DEFAULT_CHAIN_EXPIRY_SECS = 30.0f;
@ -169,8 +165,6 @@ LLPumpIO::LLPumpIO(apr_pool_t* pool) :
mPool(NULL),
mCurrentPool(NULL),
mCurrentPoolReallocCount(0),
mChainsMutex(NULL),
mCallbackMutex(NULL),
mCurrentChain(mRunningChains.end())
{
mCurrentChain = mRunningChains.end();
@ -194,9 +188,6 @@ bool LLPumpIO::addChain(const chain_t& chain, F32 timeout, bool has_curl_request
{
if(chain.empty()) return false;
#if LL_THREADS_APR
LLScopedLock lock(mChainsMutex);
#endif
LLChainInfo info;
info.mHasCurlRequest = has_curl_request;
info.setTimeoutSeconds(timeout);
@ -234,9 +225,6 @@ bool LLPumpIO::addChain(
if(!data) return false;
if(links.empty()) return false;
#if LL_THREADS_APR
LLScopedLock lock(mChainsMutex);
#endif
#if LL_DEBUG_PIPE_TYPE_IN_PUMP
LL_DEBUGS() << "LLPumpIO::addChain() " << links[0].mPipe << " '"
<< typeid(*(links[0].mPipe)).name() << "'" << LL_ENDL;
@ -391,9 +379,6 @@ void LLPumpIO::clearLock(S32 key)
// therefore won't be treading into deleted memory. I think we can
// also clear the lock on the chain safely since the pump only
// reads that value.
#if LL_THREADS_APR
LLScopedLock lock(mChainsMutex);
#endif
mClearLocks.insert(key);
}
@ -457,9 +442,6 @@ void LLPumpIO::pump(const S32& poll_timeout)
PUMP_DEBUG;
if(true)
{
#if LL_THREADS_APR
LLScopedLock lock(mChainsMutex);
#endif
// bail if this pump is paused.
if(PAUSING == mState)
{
@ -724,25 +706,10 @@ void LLPumpIO::pump(const S32& poll_timeout)
END_PUMP_DEBUG;
}
//bool LLPumpIO::respond(const chain_t& pipes)
//{
//#if LL_THREADS_APR
// LLScopedLock lock(mCallbackMutex);
//#endif
// LLChainInfo info;
// links_t links;
//
// mPendingCallbacks.push_back(info);
// return true;
//}
bool LLPumpIO::respond(LLIOPipe* pipe)
{
if(NULL == pipe) return false;
#if LL_THREADS_APR
LLScopedLock lock(mCallbackMutex);
#endif
LLChainInfo info;
LLLinkInfo link;
link.mPipe = pipe;
@ -761,10 +728,6 @@ bool LLPumpIO::respond(
if(!data) return false;
if(links.empty()) return false;
#if LL_THREADS_APR
LLScopedLock lock(mCallbackMutex);
#endif
// Add the callback response
LLChainInfo info;
info.mChainLinks = links;
@ -781,9 +744,6 @@ void LLPumpIO::callback()
//LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL;
if(true)
{
#if LL_THREADS_APR
LLScopedLock lock(mCallbackMutex);
#endif
std::copy(
mPendingCallbacks.begin(),
mPendingCallbacks.end(),
@ -809,9 +769,6 @@ void LLPumpIO::callback()
void LLPumpIO::control(LLPumpIO::EControl op)
{
#if LL_THREADS_APR
LLScopedLock lock(mChainsMutex);
#endif
switch(op)
{
case PAUSE:
@ -829,22 +786,11 @@ void LLPumpIO::control(LLPumpIO::EControl op)
void LLPumpIO::initialize(apr_pool_t* pool)
{
if(!pool) return;
#if LL_THREADS_APR
// SJB: Windows defaults to NESTED and OSX defaults to UNNESTED, so use UNNESTED explicitly.
apr_thread_mutex_create(&mChainsMutex, APR_THREAD_MUTEX_UNNESTED, pool);
apr_thread_mutex_create(&mCallbackMutex, APR_THREAD_MUTEX_UNNESTED, pool);
#endif
mPool = pool;
}
void LLPumpIO::cleanup()
{
#if LL_THREADS_APR
if(mChainsMutex) apr_thread_mutex_destroy(mChainsMutex);
if(mCallbackMutex) apr_thread_mutex_destroy(mCallbackMutex);
#endif
mChainsMutex = NULL;
mCallbackMutex = NULL;
if(mPollset)
{
// LL_DEBUGS() << "cleaning up pollset" << LL_ENDL;

View File

@ -40,9 +40,6 @@
#include "lliopipe.h"
#include "llrun.h"
// Define this to enable use with the APR thread library.
//#define LL_THREADS_APR 1
// some simple constants to help with timeouts
extern const F32 DEFAULT_CHAIN_EXPIRY_SECS;
extern const F32 SHORT_CHAIN_EXPIRY_SECS;
@ -393,14 +390,6 @@ protected:
apr_pool_t* mCurrentPool;
S32 mCurrentPoolReallocCount;
#if LL_THREADS_APR
std::mutex* mChainsMutex;
std::mutex* mCallbackMutex;
#else
int* mChainsMutex;
int* mCallbackMutex;
#endif
protected:
void initialize(apr_pool_t* pool);
void cleanup();

View File

@ -92,6 +92,8 @@ void LLPluginMessagePipeOwner::killMessagePipe(void)
}
LLPluginMessagePipe::LLPluginMessagePipe(LLPluginMessagePipeOwner *owner, LLSocket::ptr_t socket):
mInputMutex(),
mOutputMutex(),
mOutputStartIndex(0),
mOwner(owner),
mSocket(socket)

View File

@ -81,7 +81,8 @@ protected:
};
LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner)
LLPluginProcessParent::LLPluginProcessParent(LLPluginProcessParentOwner *owner):
mIncomingQueueMutex()
{
if(!sInstancesMutex)
{

View File

@ -160,7 +160,6 @@ public:
void ClearFacesAndMaterials() { mVolumeFaces.clear(); mMaterialList.clear(); }
std::string getName() const;
std::string getMetric() const {return mMetric;}
EModelStatus getStatus() const {return mStatus;}
static std::string getStatusString(U32 status) ;
@ -266,8 +265,6 @@ public:
std::string mRequestedLabel; // name requested in UI, if any.
std::string mLabel; // name computed from dae.
std::string mMetric; // user-supplied metric data for upload
LLVector3 mNormalizedScale;
LLVector3 mNormalizedTranslation;

View File

@ -48,6 +48,7 @@
//#include "imdebug.h"
#include "llfontbitmapcache.h"
#include "llgl.h"
#include "llapr.h"
FT_Render_Mode gFontRenderMode = FT_RENDER_MODE_NORMAL;

View File

@ -145,7 +145,6 @@ set(llui_HEADER_FILES
CMakeLists.txt
fsregistrarutils.h
fssearchablecontrol.h
llaccordionctrl.h
llaccordionctrltab.h
@ -207,6 +206,7 @@ set(llui_HEADER_FILES
llresizehandle.h
llresmgr.h
llrngwriter.h
llsearchablecontrol.h
llsearcheditor.h
llscrollbar.h
llscrollcontainer.h

View File

@ -805,10 +805,9 @@ void LLButton::draw()
}
}
// <FS::ND> Highlight if needed
if( nd::ui::SearchableControl::getHighlighted() )
label_color = nd::ui::SearchableControl::getHighlightColor();
// </FS:ND>
// Highlight if needed
if( ll::ui::SearchableControl::getHighlighted() )
label_color = ll::ui::SearchableControl::getHighlightColor();
// Unselected label assignments
LLWString label = getCurrentLabel();

View File

@ -62,7 +62,7 @@ class LLUICtrlFactory;
class LLButton
: public LLUICtrl, public LLBadgeOwner
, public nd::ui::SearchableControl
, public ll::ui::SearchableControl
{
public:
struct Params
@ -396,13 +396,11 @@ protected:
LLPanel* mCheckboxControlPanel;
// </FS:Zi>
// <FS:ND> Searchable text for UI filter
protected:
virtual std::string _getSearchText() const
{
return getLabelUnselected() + getToolTip();
}
// </FS:ND>
};
// Build time optimization, generate once in .cpp file

View File

@ -47,7 +47,7 @@ class LLViewBorder;
class LLCheckBoxCtrl
: public LLUICtrl
, public nd::ui::SearchableControl
, public ll::ui::SearchableControl
{
public:
struct Params
@ -97,6 +97,8 @@ public:
// LLCheckBoxCtrl interface
virtual BOOL toggle() { return mButton->toggleState(); } // returns new state
void setBtnFocus() { mButton->setFocus(TRUE); }
void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
@ -123,6 +125,18 @@ private:
enable_signal_t mCheckSignal;
// </FS:Ansariel>
protected:
virtual std::string _getSearchText() const
{
return getLabel() + getToolTip();
}
virtual void onSetHighlight() const // When highlight, really do highlight the label
{
if( mLabel )
mLabel->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() );
}
protected:
// note: value is stored in toggle state of button
LLButton* mButton;
@ -131,20 +145,6 @@ protected:
LLUIColor mTextEnabledColor;
LLUIColor mTextDisabledColor;
// <FS:ND> Searchable text for UI filter
protected:
virtual std::string _getSearchText() const
{
return getLabel() + getToolTip();
}
virtual void onSetHighlight( ) const // When highlight, really do highlight the label
{
if( mLabel )
mLabel-> nd::ui::SearchableControl::setHighlighted( nd::ui::SearchableControl::getHighlighted() );
}
// </FS:ND>
};
// Build time optimization, generate once in .cpp file

View File

@ -246,7 +246,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOO
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
selectFirstItem();
if (mControlVariable)
{
setValue(mControlVariable->getValue()); // selects the appropriate item
}
else
{
selectFirstItem();
}
}
return item;
}
@ -258,7 +265,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, const LLUUID& id, EAd
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
selectFirstItem();
if (mControlVariable)
{
setValue(mControlVariable->getValue()); // selects the appropriate item
}
else
{
selectFirstItem();
}
}
return item;
}
@ -271,7 +285,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, void* userdata, EAddP
item->setUserdata( userdata );
if (!mAllowTextEntry && mLabel.empty())
{
selectFirstItem();
if (mControlVariable)
{
setValue(mControlVariable->getValue()); // selects the appropriate item
}
else
{
selectFirstItem();
}
}
return item;
}
@ -283,7 +304,14 @@ LLScrollListItem* LLComboBox::add(const std::string& name, LLSD value, EAddPosit
item->setEnabled(enabled);
if (!mAllowTextEntry && mLabel.empty())
{
selectFirstItem();
if (mControlVariable)
{
setValue(mControlVariable->getValue()); // selects the appropriate item
}
else
{
selectFirstItem();
}
}
return item;
}

View File

@ -289,8 +289,14 @@ void LLLayoutStack::draw()
// always clip to stack itself
LLLocalClipRect clip(getLocalRect());
BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
for (LLLayoutPanel* panelp : mPanels)
{
if ((!panelp->getVisible() || panelp->mCollapsed)
&& (panelp->mVisibleAmt < 0.001f || !mAnimate))
{
// essentially invisible
continue;
}
// clip to layout rectangle, not bounding rectangle
LLRect clip_rect = panelp->getRect();
// scale clipping rectangle by visible amount

View File

@ -525,10 +525,9 @@ void LLMenuItemGL::draw( void )
color = mDisabledColor.get();
}
// <FS:ND> Highlight if needed
if( nd::ui::SearchableControl::getHighlighted() )
color = nd::ui::SearchableControl::getHighlightColor();
// </FS:ND>
// Highlight if needed
if( ll::ui::SearchableControl::getHighlighted() )
color = ll::ui::SearchableControl::getHighlightColor();
// Draw the text on top.
if (mBriefItem)

View File

@ -48,8 +48,7 @@ extern S32 MENU_BAR_WIDTH;
// The LLMenuItemGL represents a single menu item in a menu.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLMenuItemGL : public LLUICtrl
, public nd::ui::SearchableControl
class LLMenuItemGL: public LLUICtrl, public ll::ui::SearchableControl
{
public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
@ -177,7 +176,12 @@ protected:
// This function appends the character string representation of
// the current accelerator key and mask to the provided string.
void appendAcceleratorString( std::string& st ) const;
virtual std::string _getSearchText() const
{
return mLabel.getString();
}
protected:
KEY mAcceleratorKey;
MASK mAcceleratorMask;
@ -211,9 +215,6 @@ private:
BOOL mDrawTextDisabled;
KEY mJumpKey;
protected:
virtual std::string _getSearchText() const
{ return mLabel.getString(); }
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1,71 @@
/**
* @file llsearchablecontrol.h
*
* $LicenseInfo:firstyear=2019&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2019, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_SEARCHABLE_CONTROL_H
#define LL_SEARCHABLE_CONTROL_H
#include "lluicolortable.h"
#include "lluicolor.h"
namespace ll
{
namespace ui
{
class SearchableControl
{
mutable bool mIsHighlighed;
public:
SearchableControl()
: mIsHighlighed( false )
{ }
virtual ~SearchableControl()
{ }
LLColor4 getHighlightColor( ) const
{
static LLUIColor highlight_color = LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red);
return highlight_color.get();
}
void setHighlighted( bool aVal ) const
{
mIsHighlighed = aVal;
onSetHighlight( );
}
bool getHighlighted( ) const
{ return mIsHighlighed; }
std::string getSearchText() const
{ return _getSearchText(); }
protected:
virtual std::string _getSearchText() const = 0;
virtual void onSetHighlight( ) const
{ }
};
}
}
#endif

View File

@ -35,8 +35,7 @@
#include "lllineeditor.h"
class LLSliderCtrl : public LLF32UICtrl
, public nd::ui::SearchableControl
class LLSliderCtrl: public LLF32UICtrl, public ll::ui::SearchableControl
{
public:
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
@ -135,6 +134,19 @@ public:
static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
protected:
virtual std::string _getSearchText() const
{
std::string strLabel;
if( mLabelBox )
strLabel = mLabelBox->getLabel();
return strLabel + getToolTip();
}
virtual void onSetHighlight() const // When highlight, really do highlight the label
{
if( mLabelBox )
mLabelBox->ll::ui::SearchableControl::setHighlighted( ll::ui::SearchableControl::getHighlighted() );
}
private:
void updateText();
void updateSliderRect();
@ -158,21 +170,6 @@ private:
LLUIColor mTextDisabledColor;
commit_signal_t* mEditorCommitSignal;
// <FS:ND> Searchable text for UI filter
protected:
virtual std::string _getSearchText() const
{
std::string strLabel;
if( mLabelBox )
strLabel = mLabelBox->getLabel();
return strLabel + getToolTip();
}
virtual void onSetHighlight( ) const // When highlight, really do highlight the label
{
if( mLabelBox )
mLabelBox-> nd::ui::SearchableControl::setHighlighted( nd::ui::SearchableControl::getHighlighted() );
}
// </FS:ND>
};
#endif // LL_LLSLIDERCTRL_H

View File

@ -77,8 +77,8 @@ public:
mButton(b),
mOldState(FALSE),
mPlaceholderText(placeholder),
mPadding(0)
, mVisible( true )
mPadding(0),
mVisible(true)
{}
LLTabContainer* mTabContainer;
@ -434,13 +434,10 @@ void LLTabContainer::draw()
{
break;
}
//target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
// <FS:Ansariel> Only show button if tab is visible
if ((*iter)->mVisible)
{
if( (*iter)->mVisible )
target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
}
// </FS:Ansariel>
cur_scroll_pos--;
}
@ -518,13 +515,11 @@ void LLTabContainer::draw()
{
LLTabTuple* tuple = *iter;
// <FS:ND> If the tab is hidden, do not take it into account.
if( !tuple->mVisible )
{
tuple->mButton->setVisible(false);
tuple->mButton->setVisible( false );
continue;
}
// </FS:ND>
tuple->mButton->translate( left ? left - tuple->mButton->getRect().mLeft : 0,
top ? top - tuple->mButton->getRect().mTop : 0 );
@ -831,15 +826,11 @@ BOOL LLTabContainer::handleToolTip( S32 x, S32 y, MASK mask)
{
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
// [SL:KB]
if (!tuple->mButton->getVisible())
continue;
// [/SL/KB]
// tuple->mButton->setVisible( TRUE );
S32 local_x = x - tuple->mButton->getRect().mLeft;
S32 local_y = y - tuple->mButton->getRect().mBottom;
handled = tuple->mButton->handleToolTip( local_x, local_y, mask);
LLButton* tab_button = (*iter)->mButton;
if (!tab_button->getVisible()) continue;
S32 local_x = x - tab_button->getRect().mLeft;
S32 local_y = y - tab_button->getRect().mBottom;
handled = tab_button->handleToolTip(local_x, local_y, mask);
if( handled )
{
break;
@ -1687,10 +1678,7 @@ BOOL LLTabContainer::setTab(S32 which)
}
BOOL is_visible = FALSE;
// <FS:ND> Cannot switch to a hidden tab
// if (selected_tuple->mButton->getEnabled())
if (selected_tuple->mButton->getEnabled() && selected_tuple->mVisible )
// </FS:ND>
if( selected_tuple->mButton->getEnabled() && selected_tuple->mVisible )
{
setCurrentPanelIndex(which);
@ -2448,16 +2436,6 @@ S32 LLTabContainer::getTotalTabWidth() const
return mTotalTabWidth;
}
// [SL:KB] - Patch: UI-TabRearrange | Checked: 2012-05-05 (Catznip-3.3)
boost::signals2::connection LLTabContainer::setRearrangeCallback(const tab_rearrange_signal_t::slot_type& cb)
{
if (!mRearrangeSignal)
mRearrangeSignal = new tab_rearrange_signal_t();
return mRearrangeSignal->connect(cb);
}
// [/SL:KB]
// <FS:ND> Hide one tab. Will switch to the first visible tab if one exists. Otherwise the Tabcontainer is hidden
void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
{
for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr )
@ -2476,7 +2454,7 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
LLTabTuple const *pTT = *itr;
if( pTT->mVisible )
{
this->selectTab( itr-mTabList.begin() );
this->selectTab( itr - mTabList.begin() );
foundTab = true;
break;
}
@ -2489,4 +2467,12 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
updateMaxScrollPos();
}
// </FS:ND>
// [SL:KB] - Patch: UI-TabRearrange | Checked: 2012-05-05 (Catznip-3.3)
boost::signals2::connection LLTabContainer::setRearrangeCallback(const tab_rearrange_signal_t::slot_type& cb)
{
if (!mRearrangeSignal)
mRearrangeSignal = new tab_rearrange_signal_t();
return mRearrangeSignal->connect(cb);
}
// [/SL:KB]

View File

@ -236,6 +236,8 @@ public:
S32 getMinTabWidth() const { return mMinTabWidth; }
S32 getMaxTabWidth() const { return mMaxTabWidth; }
void setTabVisibility( LLPanel const *aPanel, bool );
void startDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); }
void onTabBtn( const LLSD& data, LLPanel* panel );
@ -343,9 +345,6 @@ private:
bool mOpenTabsOnDragAndDrop;
S32 mTabIconCtrlPad;
bool mUseTabEllipses;
public:
void setTabVisibility( LLPanel const *aPanel, bool );
};
#endif // LL_TABCONTAINER_H

View File

@ -1298,18 +1298,16 @@ void LLTextBase::draw()
gl_rect_2d(text_rect, bg_color % alpha, TRUE);
}
// <FS:ND> Draw highlighted if needed
if( nd::ui::SearchableControl::getHighlighted() )
// Draw highlighted if needed
if( ll::ui::SearchableControl::getHighlighted() )
{
LLColor4 bg_color = nd::ui::SearchableControl::getHighlightColor();
LLColor4 bg_color = ll::ui::SearchableControl::getHighlightColor();
LLRect bg_rect = mVisibleTextRect;
if (mScroller)
bg_rect.intersectWith(text_rect);
if( mScroller )
bg_rect.intersectWith( text_rect );
gl_rect_2d(text_rect, bg_color, TRUE);
gl_rect_2d( text_rect, bg_color, TRUE );
}
// <FS:ND>
bool should_clip = mClip || mScroller != NULL;
// <FS:Zi> Fix text bleeding at top edge of scrolling text editors

View File

@ -296,8 +296,8 @@ namespace LLInitParam
class LLTextBase
: public LLUICtrl,
protected LLEditMenuHandler,
public LLSpellCheckMenuHandler
, public nd::ui::SearchableControl
public LLSpellCheckMenuHandler,
public ll::ui::SearchableControl
{
public:
friend class LLTextSegment;
@ -671,6 +671,11 @@ protected:
void appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only = false);
S32 normalizeUri(std::string& uri);
protected:
virtual std::string _getSearchText() const
{
return mLabel.getString() + getToolTip();
}
protected:
// text segmentation and flow
@ -770,14 +775,6 @@ protected:
LLUIString mLabel; // text label that is visible when no user text provided
// <FS:Ansariel> Optional icon position
LLTextBaseEnums::EIconPositioning mIconPositioning;
// <FS:ND> Searchable text for UI filter
protected:
virtual std::string _getSearchText() const
{
return mLabel.getString() + getToolTip();
}
// </FS:ND>
};
#endif

View File

@ -786,14 +786,30 @@ BOOL LLTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
// [SL:KB] - Patch: UI-Notecards | Checked: 2010-09-12 (Catznip-2.1.2d) | Added: Catznip-2.1.2d
setCursorAtLocalPos(x, y, FALSE);
// [/SL:KB]
bool show_menu = false;
// Prefer editor menu if it has selection. See EXT-6806.
if (hasSelection() || !LLTextBase::handleRightMouseDown(x, y, mask))
if (hasSelection())
{
if(getShowContextMenu())
S32 click_pos = getDocIndexFromLocalCoord(x, y, FALSE);
if (click_pos > mSelectionStart && click_pos < mSelectionEnd)
{
showContextMenu(x, y);
show_menu = true;
}
}
// Let segments handle the click, if nothing does, show editor menu
if (!show_menu && !LLTextBase::handleRightMouseDown(x, y, mask))
{
show_menu = true;
}
if (show_menu && getShowContextMenu())
{
showContextMenu(x, y);
}
return TRUE;
}

View File

@ -37,8 +37,7 @@
#include "llinitparam.h"
#include "llview.h"
#include "llviewmodel.h" // *TODO move dependency to .cpp file
#include "fssearchablecontrol.h"
#include "llsearchablecontrol.h"
const BOOL TAKE_FOCUS_YES = TRUE;
const BOOL TAKE_FOCUS_NO = FALSE;

View File

@ -32,7 +32,6 @@
#include <map>
#include <set>
#include "llapr.h"
#include "llpointer.h"
#include "llqueuedthread.h"

View File

@ -27,6 +27,7 @@
#include "linden_common.h"
#include "llapr.h" // thread-related functions
#include "llpidlock.h"
#include "lldir.h"
#include "llsd.h"

View File

@ -32,8 +32,6 @@
#include <map>
#include <set>
#include "llapr.h"
#include "llqueuedthread.h"
#include "llvfs.h"

View File

@ -356,7 +356,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
NSPoint mPoint = gHiDPISupport ? [self convertPointToBacking:[theEvent locationInWindow]] : [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
// Apparently people still use this?
if ([theEvent modifierFlags] & NSCommandKeyMask &&
!([theEvent modifierFlags] & NSControlKeyMask) &&

View File

@ -43,6 +43,9 @@
#include "llrect.h"
#include "llxmltree.h"
#include "llsdserialize.h"
#include "llfile.h"
#include "lltimer.h"
#include "lldir.h"
#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
#define CONTROL_ERRS LL_ERRS("ControlErrors")
@ -92,6 +95,17 @@ template <> LLSD convert_from_llsd<LLSD>(const LLSD& sd, eControlType type, cons
//this defines the current version of the settings file
const S32 CURRENT_VERSION = 101;
// If you define the environment variable LL_SETTINGS_PROFILE to any value this will activate
// the gSavedSettings profiling code. This code tracks the calls to get a saved (debug) setting.
// When the viewer exits the results are written to the log directory to the file specified
// by SETTINGS_PROFILE below. Only settings with an average access rate >= 2/second are output.
typedef std::pair<std::string, U32> settings_pair_t;
typedef std::vector<settings_pair_t> settings_vec_t;
LLSD getCount;
settings_vec_t getCount_v;
F64 start_time = 0;
std::string SETTINGS_PROFILE = "settings_profile.log";
bool LLControlVariable::llsd_compare(const LLSD& a, const LLSD & b)
{
bool result = false;
@ -398,6 +412,11 @@ LLSD LLControlVariable::getSaveValue() const
LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
{
if (mSettingsProfile)
{
incrCount(name);
}
ctrl_name_table_t::iterator iter = mNameTable.find(name);
return iter == mNameTable.end() ? LLPointer<LLControlVariable>() : iter->second;
}
@ -431,8 +450,14 @@ const std::string LLControlGroup::mSanityTypeString[SANITY_TYPE_COUNT] = { "None
};
LLControlGroup::LLControlGroup(const std::string& name)
: LLInstanceTracker<LLControlGroup, std::string>(name)
: LLInstanceTracker<LLControlGroup, std::string>(name),
mSettingsProfile(false)
{
if (NULL != getenv("LL_SETTINGS_PROFILE"))
{
mSettingsProfile = true;
}
}
LLControlGroup::~LLControlGroup()
@ -440,8 +465,66 @@ LLControlGroup::~LLControlGroup()
cleanup();
}
static bool compareRoutine(settings_pair_t lhs, settings_pair_t rhs)
{
return lhs.second > rhs.second;
};
void LLControlGroup::cleanup()
{
if(mSettingsProfile && getCount.size() != 0)
{
std::string file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, SETTINGS_PROFILE);
LLFILE* out = LLFile::fopen(file, "w"); /* Flawfinder: ignore */
if(!out)
{
LL_WARNS("SettingsProfile") << "Error opening " << SETTINGS_PROFILE << LL_ENDL;
}
else
{
F64 end_time = LLTimer::getTotalSeconds();
U32 total_seconds = (U32)(end_time - start_time);
std::string msg = llformat("Runtime (seconds): %d\n\n No. accesses Avg. accesses/sec Name\n", total_seconds);
std::ostringstream data_msg;
data_msg << msg;
size_t data_size = data_msg.str().size();
if (fwrite(data_msg.str().c_str(), 1, data_size, out) != data_size)
{
LL_WARNS("SettingsProfile") << "Failed to write settings profile header" << LL_ENDL;
}
for (LLSD::map_const_iterator iter = getCount.beginMap(); iter != getCount.endMap(); ++iter)
{
getCount_v.push_back(settings_pair_t(iter->first, iter->second.asInteger()));
}
sort(getCount_v.begin(), getCount_v.end(), compareRoutine);
for (settings_vec_t::iterator iter = getCount_v.begin(); iter != getCount_v.end(); ++iter)
{
U32 access_rate = 0;
if (total_seconds != 0)
{
access_rate = iter->second / total_seconds;
}
if (access_rate >= 2)
{
std::ostringstream data_msg;
msg = llformat("%13d %7d %s", iter->second, access_rate, iter->first.c_str());
data_msg << msg << "\n";
size_t data_size = data_msg.str().size();
if (fwrite(data_msg.str().c_str(), 1, data_size, out) != data_size)
{
LL_WARNS("SettingsProfile") << "Failed to write settings profile" << LL_ENDL;
}
}
}
getCount = LLSD::emptyMap();
fclose(out);
}
}
mNameTable.clear();
}
@ -562,6 +645,15 @@ LLControlVariable* LLControlGroup::declareLLSD(const std::string& name, const LL
return declareControl(name, TYPE_LLSD, initial_val, comment, SANITY_TYPE_NONE, LLSD(), std::string(""), persist);
}
void LLControlGroup::incrCount(const std::string& name)
{
if (0.0 == start_time)
{
start_time = LLTimer::getTotalSeconds();
}
getCount[name] = getCount[name].asInteger() + 1;
}
BOOL LLControlGroup::getBOOL(const std::string& name)
{
return (BOOL)get<bool>(name);

View File

@ -345,6 +345,9 @@ public:
U32 saveToFile(const std::string& filename, BOOL nondefault_only);
U32 loadFromFile(const std::string& filename, bool default_values = false, bool save_values = true);
void resetToDefaults();
void incrCount(const std::string& name);
bool mSettingsProfile;
};

View File

@ -208,7 +208,6 @@ set(viewer_SOURCE_FILES
fsradarmenu.cpp
fsscriptlibrary.cpp
fsscrolllistctrl.cpp
fssearchableui.cpp
fsslurlcommand.cpp
groupchatlistener.cpp
lggbeamcolormapfloater.cpp
@ -385,6 +384,7 @@ set(viewer_SOURCE_FILES
llfloatermemleak.cpp
llfloatermodelpreview.cpp
llfloatermodeluploadbase.cpp
llfloatermyscripts.cpp
llfloatermyenvironment.cpp
llfloaternamedesc.cpp
llfloaternotificationsconsole.cpp
@ -660,6 +660,7 @@ set(viewer_SOURCE_FILES
llscrollingpanelparam.cpp
llscrollingpanelparambase.cpp
llsculptidsize.cpp
llsearchableui.cpp
llsearchcombobox.cpp
llsearchhistory.cpp
llsecapi.cpp
@ -963,7 +964,6 @@ set(viewer_HEADER_FILES
fsradarmenu.h
fsscriptlibrary.h
fsscrolllistctrl.h
fssearchableui.h
fsslurl.h
fsslurlcommand.h
groupchatlistener.h
@ -1145,6 +1145,7 @@ set(viewer_HEADER_FILES
llfloatermemleak.h
llfloatermodelpreview.h
llfloatermodeluploadbase.h
llfloatermyscripts.h
llfloatermyenvironment.h
llfloaternamedesc.h
llfloaternotificationsconsole.h
@ -1408,6 +1409,7 @@ set(viewer_HEADER_FILES
llscrollingpanelparam.h
llscrollingpanelparambase.h
llsculptidsize.h
llsearchableui.h
llsearchcombobox.h
llsearchhistory.h
llsecapi.h
@ -1954,6 +1956,7 @@ endif (WINDOWS)
# from within the IDE.
set(viewer_XUI_FILES
skins/default/colors.xml
skins/default/default_languages.xml
skins/default/textures/textures.xml
)
file(GLOB DEFAULT_XUI_FILE_GLOB_LIST
@ -2271,22 +2274,14 @@ if (WINDOWS)
windows-crash-logger
)
# <FS:Ansariel> No Teamcity -> allow unattended
# sets the 'working directory' for debugging from visual studio.
if (NOT UNATTENDED)
add_custom_command(
TARGET ${VIEWER_BINARY_NAME} POST_BUILD
COMMAND ${CMAKE_SOURCE_DIR}/tools/vstool/vstool.exe
ARGS
--solution
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}.sln
--workingdir
${VIEWER_BINARY_NAME}
"${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Setting the ${VIEWER_BINARY_NAME} working directory for debugging."
)
endif (NOT UNATTENDED)
# </FS:Ansariel>
# Condition for version can be moved to requirements once build agents will be updated (see TOOL-3865)
if ((NOT UNATTENDED) AND (${CMAKE_VERSION} VERSION_GREATER "3.7.2"))
set_property(
TARGET ${VIEWER_BINARY_NAME}
PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)
endif ((NOT UNATTENDED) AND (${CMAKE_VERSION} VERSION_GREATER "3.7.2"))
if (PACKAGE)
add_custom_command(

View File

@ -14365,6 +14365,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>MenuSearch</key>
<map>
<key>Comment</key>
<string>Show/hide 'Search menus' field</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>GroupListShowIcons</key>
<map>
<key>Comment</key>
@ -17646,6 +17657,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<real>1.0</real>
</map>
<key>RegionCrossingInterpolationTime</key>
<map>
<key>Comment</key>
<string>How long to extrapolate object motion after crossing regions</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>VertexShaderEnable</key>
<map>
<key>Comment</key>
@ -24041,17 +24063,6 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1023</integer>
</map>
<key>FSMenuSearch</key>
<map>
<key>Comment</key>
<string>If enabled, the viewer will show a search box for top menu items.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSLogSnapshotsToLocal</key>
<map>
<key>Comment</key>

View File

@ -91,9 +91,7 @@ void main()
// Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
// col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
col.rgb += light_diffuse[2].rgb * calcDirectionalLight(norm, light_position[2].xyz);
// col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
col.rgb += light_diffuse[3].rgb * calcDirectionalLight(norm, light_position[3].xyz);
col /= 2.0;
vertex_color = col*color;

View File

@ -898,19 +898,42 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge
{
if (revised_text.length() > command.length() + 1) //Typing this command with no argument was causing a crash. -Madgeek
{
LLVector3d agentPos = gAgent.getPositionGlobal();
S32 agent_x = ll_round( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
S32 agent_y = ll_round( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
S32 agent_z = ll_round( (F32)agentPos.mdV[VZ] );
std::string region_name = LLWeb::escapeURL(revised_text.substr(command.length() + 1));
std::string url;
if (!sFSCmdLineMapToKeepPos)
size_t found = revised_text.find("|");
std::string region_name;
std::string cords;
S32 agent_x, agent_y, agent_z;
if (found != std::string::npos)
{
agent_x = 128;
agent_y = 128;
agent_z = 0;
region_name = revised_text.substr(command.length() + 1);
found = region_name.find("|");
cords = region_name.substr(found+1);
LLStringUtil::trim(cords);
region_name = region_name.substr(0, found);
LLStringUtil::trim(region_name);
region_name = LLWeb::escapeURL(region_name);
i.str(cords);
if (!((i >> agent_x) && (i >> agent_y) && (i >> agent_z)))
{
agent_x = 128;
agent_y = 128;
agent_z = 0;
}
}
else
{
region_name = LLWeb::escapeURL(revised_text.substr(command.length() + 1));
LLVector3d agentPos = gAgent.getPositionGlobal();
agent_x = ll_round((F32)fmod(agentPos.mdV[VX], (F64)REGION_WIDTH_METERS));
agent_y = ll_round((F32)fmod(agentPos.mdV[VY], (F64)REGION_WIDTH_METERS));
agent_z = ll_round((F32)agentPos.mdV[VZ]);
if (!sFSCmdLineMapToKeepPos)
{
agent_x = 128;
agent_y = 128;
agent_z = 0;
}
}
std::string url;
url = llformat("secondlife:///app/teleport/%s/%d/%d/%d", region_name.c_str(), agent_x, agent_y, agent_z);
LLURLDispatcher::dispatch(url, "clicked", NULL, true);

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -10,6 +10,7 @@
<file>gulim.ttc</file>
<file>simhei.ttf</file>
<file>ArialUni.ttf</file>
<file>msyh.ttc</file>
<file>seguisym.ttf</file>
<file>nirmala.ttf</file>
<file>tahoma.ttf</file>
@ -26,6 +27,7 @@
<file>AppleGothic.ttf</file>
<file>AppleSDGothicNeo-Regular.otf</file>
<file>华文细黑.ttf</file>
<file>PingFang.ttc</file>
</os>
</font>

View File

@ -548,7 +548,7 @@ void FSFloaterVoiceControls::setModeratorMutedVoice(bool moderator_muted)
{
LLNotificationsUtil::add("VoiceIsMutedByModerator");
}
mSpeakingIndicator->setIsMuted(moderator_muted);
mSpeakingIndicator->setIsModeratorMuted(moderator_muted);
}
void FSFloaterVoiceControls::onModeratorNameCache(const LLAvatarName& av_name)

View File

@ -54,7 +54,7 @@ static void update_speaker_indicator(const LLAvatarList* const avatar_list, cons
if (item)
{
LLOutputMonitorCtrl* indicator = item->getChild<LLOutputMonitorCtrl>("speaking_indicator");
indicator->setIsMuted(is_muted);
indicator->setIsModeratorMuted(is_muted);
}
}

View File

@ -786,9 +786,7 @@ RMDir "$INSTDIR"
IfFileExists "$INSTDIR" FOLDERFOUND NOFOLDER
FOLDERFOUND:
# Silent uninstall always removes all files (/SD IDYES)
MessageBox MB_YESNO $(DeleteProgramFilesMB) /SD IDYES IDNO NOFOLDER
RMDir /r "$INSTDIR"
MessageBox MB_OK $(DeleteProgramFilesMB) /SD IDOK IDOK NOFOLDER
NOFOLDER:

View File

@ -641,12 +641,12 @@ static void settings_to_globals()
// </FS:Ansariel>
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
LLVOVolume::sLODFactor = gSavedSettings.getF32("RenderVolumeLODFactor");
LLVOVolume::sLODFactor = llclamp(gSavedSettings.getF32("RenderVolumeLODFactor"), 0.01f, MAX_LOD_FACTOR);
LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor");
LLVOAvatar::sPhysicsLODFactor = gSavedSettings.getF32("RenderAvatarPhysicsLODFactor");
LLVOAvatar::sLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
LLVOAvatar::sPhysicsLODFactor = llclamp(gSavedSettings.getF32("RenderAvatarPhysicsLODFactor"), 0.f, MAX_AVATAR_LOD_FACTOR);
LLVOAvatar::updateImpostorRendering(gSavedSettings.getU32("RenderAvatarMaxNonImpostors"));
LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible");
// clamp auto-open time to some minimum usable value
@ -1366,15 +1366,19 @@ bool LLAppViewer::init()
// updater.args.add(stringize(gSavedSettings.getBOOL("UpdaterWillingToTest")));
// // ForceAddressSize
// updater.args.add(stringize(gSavedSettings.getU32("ForceAddressSize")));
//
// // Run the updater. An exception from launching the updater should bother us.
// LLLeap::create(updater, true);
// }
// else
// {
// LL_WARNS("InitInfo") << "Skipping updater check." << LL_ENDL;
// }
// </FS:Ansariel>
//#if LL_WINDOWS && !LL_RELEASE_FOR_DOWNLOAD && !LL_SEND_CRASH_REPORTS
// // This is neither a release package, nor crash-reporting enabled test build
// // try to run version updater, but don't bother if it fails (file might be missing)
// LLLeap *leap_p = LLLeap::create(updater, false);
// if (!leap_p)
// {
// LL_WARNS("LLLeap") << "Failed to run LLLeap" << LL_ENDL;
// }
//#else
// // Run the updater. An exception from launching the updater should bother us.
// LLLeap::create(updater, true);
//#endif
// </FS:Ansariel>
// Iterate over --leap command-line options. But this is a bit tricky: if
// there's only one, it won't be an array at all.
@ -6368,11 +6372,8 @@ void LLAppViewer::resumeMainloopTimeout( char const* state, F32 secs)
{
if(secs < 0.0f)
{
// <FS:ND> Gets called often in display loop
// secs = gSavedSettings.getF32("MainloopTimeoutDefault");
static LLCachedControl< F32 > MainloopTimeoutDefault( gSavedSettings, "MainloopTimeoutDefault" );
secs = MainloopTimeoutDefault;
// </FS:ND>
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
secs = mainloop_timeout;
}
mMainloopTimeout->setTimeout(secs);
@ -6402,11 +6403,8 @@ void LLAppViewer::pingMainloopTimeout( char const* state, F32 secs)
{
if(secs < 0.0f)
{
// <FS:ND> Gets called often in display loop
// secs = gSavedSettings.getF32("MainloopTimeoutDefault");
static LLCachedControl< F32 > MainloopTimeoutDefault( gSavedSettings, "MainloopTimeoutDefault" );
secs = MainloopTimeoutDefault;
// </FS:ND>
static LLCachedControl<F32> mainloop_timeout(gSavedSettings, "MainloopTimeoutDefault", 60);
secs = mainloop_timeout;
}
mMainloopTimeout->setTimeout(secs);

View File

@ -43,6 +43,7 @@
#define LL_LLAPPVIEWER_H
#include "llallocator.h"
#include "llapr.h"
#include "llcontrol.h"
#include "llsys.h" // for LLOSInfo
#include "lltimer.h"

View File

@ -411,68 +411,6 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
return serial_md5;
}
static AudioDeviceID get_default_audio_output_device(void)
{
AudioDeviceID device = 0;
UInt32 size = sizeof(device);
AudioObjectPropertyAddress device_address = { kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &device_address, 0, NULL, &size, &device);
if(err != noErr)
{
LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL;
}
return device;
}
//virtual
void LLAppViewerMacOSX::setMasterSystemAudioMute(bool new_mute)
{
AudioDeviceID device = get_default_audio_output_device();
if(device != 0)
{
UInt32 mute = new_mute;
AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster };
OSStatus err = AudioObjectSetPropertyData(device, &device_address, 0, NULL, sizeof(mute), &mute);
if(err != noErr)
{
LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
}
}
}
//virtual
bool LLAppViewerMacOSX::getMasterSystemAudioMute()
{
// Assume the system isn't muted
UInt32 mute = 0;
AudioDeviceID device = get_default_audio_output_device();
if(device != 0)
{
UInt32 size = sizeof(mute);
AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute,
kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster };
OSStatus err = AudioObjectGetPropertyData(device, &device_address, 0, NULL, &size, &mute);
if(err != noErr)
{
LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
}
}
return (mute != 0);
}
void handleUrl(const char* url_utf8)
{
if (url_utf8 && gViewerAppPtr)

View File

@ -42,10 +42,6 @@ public:
//
virtual bool init(); // Override to do application initialization
// mute/unmute the system's master audio
virtual void setMasterSystemAudioMute(bool mute);
virtual bool getMasterSystemAudioMute();
protected:
virtual bool restoreErrorTrap();
virtual void initCrashReporting(bool reportFreeze);

View File

@ -68,8 +68,8 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement
word_start--; // walk word_start back to the beginning of the word
}
LL_DEBUGS("AutoReplace") << "word_start: " << word_start << " word_end: " << word_end << LL_ENDL;
std::string str_text = std::string(input_text.begin(), input_text.end());
std::string last_word = str_text.substr(word_start, word_end - word_start + 1);
LLWString old_string = input_text.substr(word_start, word_end - word_start + 1);
std::string last_word = wstring_to_utf8str(old_string);
std::string replacement_word(mSettings.replaceWord(last_word));
if (replacement_word != last_word)
@ -79,9 +79,8 @@ void LLAutoReplace::autoreplaceCallback(S32& replacement_start, S32& replacement
{
// return the replacement string
replacement_start = word_start;
replacement_length = last_word.length();
replacement_length = word_end - word_start + 1;
replacement_string = utf8str_to_wstring(replacement_word);
LLWString old_string = utf8str_to_wstring(last_word);
S32 size_change = replacement_string.size() - old_string.size();
cursor_pos += size_change;
}

View File

@ -159,6 +159,7 @@ BOOL LLAvatarListItem::postBuild()
mIconPermissionEditTheirs->setVisible(false);
mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
mSpeakingIndicator->setChannelState(LLOutputMonitorCtrl::UNDEFINED_CHANNEL);
mInfoBtn = getChild<LLButton>("info_btn");
mProfileBtn = getChild<LLButton>("profile_btn");

View File

@ -29,6 +29,7 @@
#include "llchatitemscontainerctrl.h"
#include "lltextbox.h"
#include "llavataractions.h"
#include "llavatariconctrl.h"
#include "llcommandhandler.h"
#include "llfloaterreg.h"
@ -220,6 +221,7 @@ void LLFloaterIMNearbyChatToastPanel::init(LLSD& notification)
mMsgText = getChild<LLChatMsgBox>("msg_text", false);
mMsgText->setContentTrusted(false);
mMsgText->setIsFriendCallback(LLAvatarActions::isFriend);
mMsgText->setText(std::string(""));

View File

@ -42,6 +42,7 @@
#include "llwearableitemslist.h"
#include "llpaneloutfitedit.h"
#include "lltrans.h"
#include "llvoavatarself.h"
#include "lltabcontainer.h"
static LLPanelInjector<LLCOFWearables> t_cof_wearables("cof_wearables");
@ -341,7 +342,7 @@ void LLCOFWearables::setAttachmentsTitle()
{
if (mAttachmentsTab)
{
U32 free_slots = MAX_AGENT_ATTACHMENTS - mAttachments->size();
U32 free_slots = gAgentAvatarp->getMaxAttachments() - mAttachments->size();
LLStringUtil::format_map_t args_attachments;
args_attachments["[COUNT]"] = llformat ("%d", free_slots);

View File

@ -353,7 +353,7 @@ void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_
LLConversationItemParticipant* participant = findParticipant(participant_id);
if (participant)
{
participant->muteVoice(is_muted);
participant->moderateVoice(is_muted);
}
}
@ -500,6 +500,7 @@ void LLConversationItemSession::onAvatarNameCache(const LLAvatarName& av_name)
LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
LLConversationItem(display_name,uuid,root_view_model),
mIsModeratorMuted(false),
mIsModerator(false),
mDisplayModeratorLabel(false),
mDistToAgent(-1.0)
@ -510,6 +511,7 @@ LLConversationItemParticipant::LLConversationItemParticipant(std::string display
LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) :
LLConversationItem(uuid,root_view_model),
mIsModeratorMuted(false),
mIsModerator(false),
mDisplayModeratorLabel(false),
mDistToAgent(-1.0)
@ -599,25 +601,7 @@ void LLConversationItemParticipant::setDisplayModeratorRole(bool displayRole)
bool LLConversationItemParticipant::isVoiceMuted()
{
return LLMuteList::getInstance()->isMuted(mUUID, LLMute::flagVoiceChat);
}
void LLConversationItemParticipant::muteVoice(bool mute_voice)
{
LLAvatarName av_name;
LLAvatarNameCache::get(mUUID, &av_name);
LLMuteList * mute_listp = LLMuteList::getInstance();
bool voice_already_muted = mute_listp->isMuted(mUUID, av_name.getUserName());
LLMute mute(mUUID, av_name.getUserName(), LLMute::AGENT);
if (voice_already_muted && !mute_voice)
{
mute_listp->remove(mute);
}
else if (!voice_already_muted && mute_voice)
{
mute_listp->add(mute);
}
return mIsModeratorMuted || LLMuteList::getInstance()->isMuted(mUUID, LLMute::flagVoiceChat);
}
//

View File

@ -197,8 +197,9 @@ public:
virtual const std::string& getDisplayName() const { return mDisplayName; }
bool isVoiceMuted();
bool isModeratorMuted() { return mIsModeratorMuted; }
bool isModerator() const { return mIsModerator; }
void muteVoice(bool mute_voice);
void moderateVoice(bool mute_voice) { mIsModeratorMuted = mute_voice; }
void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; mNeedsRefresh = true; }
void setTimeNow() { mLastActiveTime = LLFrameTimer::getElapsedSeconds(); mNeedsRefresh = true; }
void setDistance(F64 dist) { mDistToAgent = dist; mNeedsRefresh = true; }
@ -219,6 +220,7 @@ private:
void onAvatarNameCache(const LLAvatarName& av_name); // callback used by fetchAvatarName
void updateName(const LLAvatarName& av_name);
bool mIsModeratorMuted; // default is false
bool mIsModerator; // default is false
bool mDisplayModeratorLabel; // default is false
std::string mDisplayName;

View File

@ -236,6 +236,8 @@ void LLConversationViewSession::draw()
// Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap.
bool draw_children = getRoot() == static_cast<LLFolderViewFolder*>(this) || isOpen();
// Todo/fix this: arrange hides children 'out of bonds', session 'slowly' adjusts container size, unhides children
// this process repeats until children fit
for (folders_t::iterator iter = mFolders.begin();
iter != mFolders.end();)
{
@ -256,9 +258,6 @@ void LLConversationViewSession::draw()
updateLabelRotation();
drawOpenFolderArrow(default_params, sFgColor);
}
refresh();
LLView::draw();
}
@ -443,28 +442,23 @@ void LLConversationViewSession::refresh()
LLSpeakingIndicatorManager::updateSpeakingIndicators();
// we should show indicator for specified voice session only if this is current channel. EXT-5562.
if (!mIsInActiveVoiceChannel)
if (mSpeakingIndicator)
{
if (mSpeakingIndicator)
mSpeakingIndicator->setIsActiveChannel(mIsInActiveVoiceChannel);
mSpeakingIndicator->setShowParticipantsSpeaking(mIsInActiveVoiceChannel);
}
LLConversationViewParticipant* participant = NULL;
items_t::const_iterator iter;
for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
{
participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
if (participant)
{
mSpeakingIndicator->setVisible(false);
}
LLConversationViewParticipant* participant = NULL;
items_t::const_iterator iter;
for (iter = getItemsBegin(); iter != getItemsEnd(); iter++)
{
participant = dynamic_cast<LLConversationViewParticipant*>(*iter);
if (participant)
{
participant->hideSpeakingIndicator();
}
participant->allowSpeakingIndicator(mIsInActiveVoiceChannel);
}
}
if (mSpeakingIndicator)
{
mSpeakingIndicator->setShowParticipantsSpeaking(mIsInActiveVoiceChannel);
}
requestArrange();
// Do the regular upstream refresh
LLFolderViewFolder::refresh();
@ -476,8 +470,13 @@ void LLConversationViewSession::onCurrentVoiceSessionChanged(const LLUUID& sessi
if (vmi)
{
bool old_value = mIsInActiveVoiceChannel;
mIsInActiveVoiceChannel = vmi->getUUID() == session_id;
mCallIconLayoutPanel->setVisible(mIsInActiveVoiceChannel);
if (old_value != mIsInActiveVoiceChannel)
{
refresh();
}
}
}
@ -570,6 +569,7 @@ void LLConversationViewParticipant::draw()
F32 text_left = (F32)getLabelXPos();
LLColor4 color;
LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
@ -581,9 +581,14 @@ void LLConversationViewParticipant::draw()
color = mIsSelected ? sHighlightFgColor : sFgColor;
}
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
if (participant_model)
{
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
}
drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
drawLabel(font, text_left, y, color, right_x);
refresh();
LLView::draw();
}
@ -607,16 +612,39 @@ S32 LLConversationViewParticipant::arrange(S32* width, S32* height)
return arranged;
}
// virtual
void LLConversationViewParticipant::refresh()
{
// Refresh the participant view from its model data
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
participant_model->resetRefresh();
// *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat
mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
// Do the regular upstream refresh
LLFolderViewItem::refresh();
}
void LLConversationViewParticipant::addToFolder(LLFolderViewFolder* folder)
{
// Add the item to the folder (conversation)
LLFolderViewItem::addToFolder(folder);
// Retrieve the folder (conversation) UUID, which is also the speaker session UUID
LLConversationItem* vmi = getParentFolder() ? dynamic_cast<LLConversationItem*>(getParentFolder()->getViewModelItem()) : NULL;
if (vmi)
LLFolderViewFolder *prnt = getParentFolder();
if (prnt)
{
addToSession(vmi->getUUID());
LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(prnt->getViewModelItem());
if (vmi)
{
addToSession(vmi->getUUID());
}
LLConversationViewSession* session = dynamic_cast<LLConversationViewSession*>(prnt);
if (session)
{
allowSpeakingIndicator(session->isInActiveVoiceChannel());
}
}
}
@ -746,9 +774,9 @@ LLView* LLConversationViewParticipant::getItemChildView(EAvatarListItemChildInde
return child_view;
}
void LLConversationViewParticipant::hideSpeakingIndicator()
void LLConversationViewParticipant::allowSpeakingIndicator(bool val)
{
mSpeakingIndicator->setVisible(false);
mSpeakingIndicator->setIsActiveChannel(val);
}
// EOF

View File

@ -92,6 +92,7 @@ public:
void setHighlightState(bool hihglight_state);
LLFloater* getSessionFloater();
bool isInActiveVoiceChannel() { return mIsInActiveVoiceChannel; }
private:
@ -138,6 +139,7 @@ public:
virtual ~LLConversationViewParticipant( void );
bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); }
/*virtual*/ void refresh();
void addToFolder(LLFolderViewFolder* folder);
void addToSession(const LLUUID& session_id);
@ -146,7 +148,7 @@ public:
/*virtual*/ S32 getLabelXPos();
/*virtual*/ BOOL handleMouseDown( S32 x, S32 y, MASK mask );
void hideSpeakingIndicator();
void allowSpeakingIndicator(bool val);
protected:
friend class LLUICtrlFactory;

View File

@ -125,17 +125,11 @@ BOOL LLViewerDynamicTexture::render()
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::preRender(BOOL clear_depth)
{
// <FS:Beq> changes to support higher resolution rendering in the preview
////only images up to 512x512 are supported
//llassert(mFullHeight <= 512);
//llassert(mFullWidth <= 512);
gPipeline.allocatePhysicsBuffer();
llassert(mFullWidth <= static_cast<S32>(gPipeline.mPhysicsDisplay.getWidth()));
llassert(mFullHeight <= static_cast<S32>(gPipeline.mPhysicsDisplay.getHeight()));
// if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI)
if (gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI)
// </FS:Beq>
{ //using offscreen render target, just use the bottom left corner
mOrigin.set(0, 0);
}
@ -221,12 +215,10 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
{
return TRUE;
}
// <FS:Beq> changes to support higher resolution rendering in the preview
// bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete() && !gGLManager.mIsATI;
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsATI;
if (use_fbo)
{
// gPipeline.mWaterDis.bindTarget();
gPipeline.mPhysicsDisplay.bindTarget();
}
// </FS:Beq>
@ -265,10 +257,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
if (use_fbo)
{
// <FS:Beq> changes to support higher resolution rendering in the preview
// gPipeline.mWaterDis.flush();
gPipeline.mPhysicsDisplay.flush();
// </FS:Beq>
}
return ret;

View File

@ -967,7 +967,7 @@ bool LLFloaterAvatarPicker::isSelectBtnEnabled()
{
bool ret_val = visibleItemsSelected();
if ( ret_val )
if ( ret_val && !isMinimized())
{
std::string acvtive_panel_name;
LLScrollListCtrl* list = NULL;

View File

@ -58,6 +58,7 @@ LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_i
mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")),
mAccountName(session_id[LL_FCP_ACCOUNT_NAME]),
mCompleteName(session_id[LL_FCP_COMPLETE_NAME]),
mMutex(),
mShowHistory(false),
mMessages(NULL),
mHistoryThreadsBusy(false),

View File

@ -270,6 +270,9 @@ BOOL LLFloaterIMContainer::postBuild()
// When display name option change, we need to reload all participant names
LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
mParticipantRefreshTimer.setTimerExpirySec(0);
mParticipantRefreshTimer.start();
return TRUE;
}
@ -421,14 +424,66 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate()
void LLFloaterIMContainer::idle(void* user_data)
{
LLFloaterIMContainer* self = static_cast<LLFloaterIMContainer*>(user_data);
// Update the distance to agent in the nearby chat session if required
// Note: it makes no sense of course to update the distance in other session
if (self->mConversationViewModel.getSorter().getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE)
{
self->setNearbyDistances();
}
self->mConversationsRoot->update();
if (!self->getVisible() || self->isMinimized())
{
return;
}
self->idleUpdate();
}
void LLFloaterIMContainer::idleUpdate()
{
if (mTabContainer->getTabCount() == 0)
{
// Do not close the container when every conversation is torn off because the user
// still needs the conversation list. Simply collapse the message pane in that case.
collapseMessagesPane(true);
}
U32 sort_order = mConversationViewModel.getSorter().getSortOrderParticipants();
if (mParticipantRefreshTimer.hasExpired())
{
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
// Update moderator options visibility
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
bool is_moderator = isGroupModerator();
bool can_ban = haveAbilityToBan();
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(is_moderator && participant_model->getUUID() != gAgentID);
participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID);
current_participant_model++;
}
// Update floater's title as required by the currently selected session or use the default title
LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
}
mParticipantRefreshTimer.setTimerExpirySec(1.0f);
}
// Update the distance to agent in the nearby chat session if required
// Note: it makes no sense of course to update the distance in other session
if (sort_order == LLConversationFilter::SO_DISTANCE)
{
// almost real-time updates
setNearbyDistances(); //calls arrange all
}
mConversationsRoot->update(); //arranges, resizes, heavy
// "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
{
LLRect stack_rect = mConversationsStack->getRect();
mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
}
}
bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
@ -527,39 +582,6 @@ bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
void LLFloaterIMContainer::draw()
{
if (mTabContainer->getTabCount() == 0)
{
// Do not close the container when every conversation is torn off because the user
// still needs the conversation list. Simply collapse the message pane in that case.
collapseMessagesPane(true);
}
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
// Update moderator options visibility
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
while (current_participant_model != end_participant_model)
{
LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
participant_model->setModeratorOptionsVisible(isGroupModerator() && participant_model->getUUID() != gAgentID);
participant_model->setGroupBanVisible(haveAbilityToBan() && participant_model->getUUID() != gAgentID);
current_participant_model++;
}
// Update floater's title as required by the currently selected session or use the default title
LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
}
// "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
{
LLRect stack_rect = mConversationsStack->getRect();
mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
}
LLFloater::draw();
}

View File

@ -182,6 +182,8 @@ private:
void openNearbyChat();
bool isParticipantListExpanded();
void idleUpdate(); // for convenience (self) from static idle
LLButton* mExpandCollapseBtn;
LLButton* mStubCollapseBtn;
LLButton* mSpeakBtn;
@ -228,6 +230,8 @@ private:
LLConversationViewModel mConversationViewModel;
LLFolderView* mConversationsRoot;
LLEventStream mConversationsEventStream;
LLTimer mParticipantRefreshTimer;
};
#endif // LL_LLFLOATERIMCONTAINER_H

Some files were not shown because too many files have changed in this diff Show More