diff options
Diffstat (limited to 'indra/newview')
62 files changed, 790 insertions, 330 deletions
diff --git a/indra/newview/app_settings/CA.pem b/indra/newview/app_settings/CA.pem index 6140842a7f..a16b4225e5 100644 --- a/indra/newview/app_settings/CA.pem +++ b/indra/newview/app_settings/CA.pem @@ -4587,38 +4587,6 @@ zo9uoV1/A3U05K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATy wy39FCqQmbkHzJ8= -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- -MIIFijCCA3KgAwIBAgIQDHbanJEMTiye/hXQWJM8TDANBgkqhkiG9w0BAQUFADBf -MQswCQYDVQQGEwJOTDESMBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdp -Tm90YXIgUm9vdCBDQTEgMB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmww -HhcNMDcwNTE2MTcxOTM2WhcNMjUwMzMxMTgxOTIxWjBfMQswCQYDVQQGEwJOTDES -MBAGA1UEChMJRGlnaU5vdGFyMRowGAYDVQQDExFEaWdpTm90YXIgUm9vdCBDQTEg -MB4GCSqGSIb3DQEJARYRaW5mb0BkaWdpbm90YXIubmwwggIiMA0GCSqGSIb3DQEB -AQUAA4ICDwAwggIKAoICAQCssFjBAL3YIQgLK5r+blYwBZ8bd5AQQVzDDYcRd46B -8cp86Yxq7Th0Nbva3/m7wAk3tJZzgX0zGpg595NvlX89ubF1h7pRSOiLcD6VBMXY -tsMW2YiwsYcdcNqGtA8Ui3rPENF0NqISe3eGSnnme98CEWilToauNFibJBN4ViIl -HgGLS1Fx+4LMWZZpiFpoU8W5DQI3y0u8ZkqQfioLBQftFl9VkHXYRskbg+IIvvEj -zJkd1ioPgyAVWCeCLvriIsJJsbkBgWqdbZ1Ad2h2TiEqbYRAhU52mXyC8/O3AlnU -JgEbjt+tUwbRrhjd4rI6y9eIOI6sWym5GdOY+RgDz0iChmYLG2kPyes4iHomGgVM -ktck1JbyrFIto0fVUvY//s6EBnCmqj6i8rZWNBhXouSBbefK8GrTx5FrAoNBfBXv -a5pkXuPQPOWx63tdhvvL5ndJzaNl3Pe5nLjkC1+Tz8wwGjIczhxjlaX56uF0i57p -K6kwe6AYHw4YC+VbqdPRbB4HZ4+RS6mKvNJmqpMBiLKR+jFc1abBUggJzQpjotMi -puih2TkGl/VujQKQjBR7P4DNG5y6xFhyI6+2Vp/GekIzKQc/gsnmHwUNzUwoNovT -yD4cxojvXu6JZOkd69qJfjKmadHdzIif0dDJZiHcBmfFlHqabWJMfczgZICynkeO -owIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV -HQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wDQYJKoZIhvcNAQEFBQADggIBADsC -jcs8MOhuoK3yc7NfniUTBAXT9uOLuwt5zlPe5JbF0a9zvNXD0EBVfEB/zRtfCdXy -fJ9oHbtdzno5wozWmHvFg1Wo1X1AyuAe94leY12hE8JdiraKfADzI8PthV9xdvBo -Y6pFITlIYXg23PFDk9Qlx/KAZeFTAnVR/Ho67zerhChXDNjU1JlWbOOi/lmEtDHo -M/hklJRRl6s5xUvt2t2AC298KQ3EjopyDedTFLJgQT2EkTFoPSdE2+Xe9PpjRchM -Ppj1P0G6Tss3DbpmmPHdy59c91Q2gmssvBNhl0L4eLvMyKKfyvBovWsdst+Nbwed -2o5nx0ceyrm/KkKRt2NTZvFCo+H0Wk1Ya7XkpDOtXHAd3ODy63MUkZoDweoAZbwH -/M8SESIsrqC9OuCiKthZ6SnTGDWkrBFfGbW1G/8iSlzGeuQX7yCpp/Q/rYqnmgQl -nQ7KN+ZQ/YxCKQSa7LnPS3K94gg2ryMvYuXKAdNw23yCIywWMQzGNgeQerEfZ1jE -O1hZibCMjFCz2IbLaKPECudpSyDOwR5WS5WpI2jYMNjD67BVUc3l/Su49bsRn1NU -9jQZjHkJNsphFyUXC4KYcwx3dMPVDceoEkzHp1RxRy4sGn3J4ys7SN4nhKdjNrN9 -j6BkOSQNPXuHr2ZcdBtLc7LljPCGmbjlxd+Ewbfr ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJO TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFh dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEy diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 43aa67e949..6ebb0162a4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -25,7 +25,7 @@ <key>Type</key> <string>S32</string> <key>Value</key> - <real>300</real> + <real>0</real> </map> <key>AdminMenu</key> <map> @@ -1981,6 +1981,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>DebugShowPrivateMem</key> + <map> + <key>Comment</key> + <string>Show Private Mem Info</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>DebugShowRenderInfo</key> <map> <key>Comment</key> @@ -5459,6 +5470,17 @@ <key>Value</key> <real>48.0</real> </map> + <key>MaxHeapSize</key> + <map> + <key>Comment</key> + <string>Maximum heap size (GB)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1.6</real> + </map> <key>MaxSelectDistance</key> <map> <key>Comment</key> @@ -5481,6 +5503,17 @@ <key>Value</key> <real>60.0</real> </map> + <key>MediaPluginDebugging</key> + <map> + <key>Comment</key> + <string>Turn on debugging messages that may help diagnosing media issues (WARNING: May reduce performance).</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>MediaControlFadeTime</key> <map> <key>Comment</key> @@ -5580,6 +5613,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>MemoryFailurePreventionEnabled</key> + <map> + <key>Comment</key> + <string>If set, the viewer will quit to avoid crash when memory failure happens</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>MemoryLogFrequency</key> <map> <key>Comment</key> @@ -5591,6 +5635,17 @@ <key>Value</key> <real>600.0</real> </map> + <key>MemoryPrivatePoolEnabled</key> + <map> + <key>Comment</key> + <string>Enable the private memory pool management</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>MemProfiling</key> <map> <key>Comment</key> diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1388d9aee0..a0af94ba77 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2285,7 +2285,9 @@ void LLAppearanceMgr::autopopulateOutfits() void LLAppearanceMgr::onFirstFullyVisible() { gAgentAvatarp->debugAvatarVisible(); - autopopulateOutfits(); + // The auto-populate is failing at the point of generating outfits
+ // folders, so don't do the library copy until that is resolved.
+ // autopopulateOutfits(); } bool LLAppearanceMgr::updateBaseOutfit() diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 6a808b5daf..7e597fe5dc 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -686,7 +686,7 @@ LLAppViewer::~LLAppViewer() } bool LLAppViewer::init() -{ +{ // // Start of the application // @@ -719,6 +719,11 @@ bool LLAppViewer::init() LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; + //set the max heap size. + initMaxHeapSize() ; + + LLPrivateMemoryPoolManager::initClass((BOOL)gSavedSettings.getBOOL("MemoryPrivatePoolEnabled")) ; + // write Google Breakpad minidump files to our log directory std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); logdir += gDirUtilp->getDirDelimiter(); @@ -1088,9 +1093,97 @@ bool LLAppViewer::init() LLAgentLanguage::init(); + return true; +} +void LLAppViewer::initMaxHeapSize() +{ + //set the max heap size. + //here is some info regarding to the max heap size: + //------------------------------------------------------------------------------------------ + // OS | setting | SL address bits | max manageable memory space | max heap size + // Win 32 | default | 32-bit | 2GB | < 1.7GB + // Win 32 | /3G | 32-bit | 3GB | < 1.7GB or 2.7GB + //Linux 32 | default | 32-bit | 3GB | < 2.7GB + //Linux 32 |HUGEMEM | 32-bit | 4GB | < 3.7GB + //64-bit OS |default | 32-bit | 4GB | < 3.7GB + //64-bit OS |default | 64-bit | N/A (> 4GB) | N/A (> 4GB) + //------------------------------------------------------------------------------------------ + //currently SL is built under 32-bit setting, we set its max heap size no more than 1.6 GB. + + //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; + F32 max_heap_size_gb = gSavedSettings.getF32("MaxHeapSize") ; + BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; + + LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; +} - return true; +void LLAppViewer::checkMemory() +{ + const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second + //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds + const static U32 MAX_SIZE_CHECKED_MEMORY_BLOCK = 64 * 1024 * 1024 ; //64 MB + //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; + static void* last_reserved_address = NULL ; + + if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) + { + return ; + } + mMemCheckTimer.reset() ; + + if(gGLManager.mDebugGPU) + { + //update the availability of memory + LLMemory::updateMemoryInfo() ; + } + + //check the virtual address space fragmentation + if(!last_reserved_address) + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + } + else + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + if(!last_reserved_address) //failed, try once more + { + last_reserved_address = LLMemory::tryToAlloc(last_reserved_address, MAX_SIZE_CHECKED_MEMORY_BLOCK) ; + } + } + + S32 is_low = !last_reserved_address || LLMemory::isMemoryPoolLow() ; + + //if(is_low < 0) //to force quit + //{ + // if(force_quit_timer > MAX_QUIT_WAIT_TIME) //just hit the limit for the first time + // { + // //send out the notification to tell the viewer is about to quit in 30 seconds. + // LLNotification::Params params("ForceQuitDueToLowMemory"); + // LLNotifications::instance().add(params); + + // force_quit_timer = MAX_QUIT_WAIT_TIME - MEMORY_CHECK_INTERVAL ; + // } + // else + // { + // force_quit_timer -= MEMORY_CHECK_INTERVAL ; + // if(force_quit_timer < 0.f) + // { + // forceQuit() ; //quit + // } + // } + //} + //else + //{ + // force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; + //} + + LLPipeline::throttleNewMemoryAllocation(!is_low ? FALSE : TRUE) ; + + if(is_low) + { + LLMemory::logMemoryInfo() ; + } } static LLFastTimer::DeclareTimer FTM_MESSAGES("System Messages"); @@ -1118,7 +1211,7 @@ bool LLAppViewer::mainLoop() //------------------------------------------- // Create IO Pump to use for HTTP Requests. - gServicePump = new LLPumpIO(gAPRPoolp); + gServicePump = new LLPumpIO; LLHTTPClient::setPump(*gServicePump); LLCurl::setCAFile(gDirUtilp->getCAFile()); @@ -1128,7 +1221,6 @@ bool LLAppViewer::mainLoop() LLVoiceClient::getInstance()->init(gServicePump); LLTimer frameTimer,idleTimer; LLTimer debugTime; - LLFrameTimer memCheckTimer; LLViewerJoystick* joystick(LLViewerJoystick::getInstance()); joystick->setNeedsReset(true); @@ -1139,7 +1231,9 @@ bool LLAppViewer::mainLoop() // point of posting. LLSD newFrame; - const F32 memory_check_interval = 1.0f ; //second + //LLPrivateMemoryPoolTester::getInstance()->run(false) ; + //LLPrivateMemoryPoolTester::getInstance()->run(true) ; + //LLPrivateMemoryPoolTester::destroy() ; // Handle messages while (!LLApp::isExiting()) @@ -1150,18 +1244,8 @@ bool LLAppViewer::mainLoop() llclearcallstacks; //check memory availability information - { - if(memory_check_interval < memCheckTimer.getElapsedTimeF32()) - { - memCheckTimer.reset() ; - - //update the availability of memory - LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ; - } - llcallstacks << "Available physical mem(KB): " << mAvailPhysicalMemInKB << llcallstacksendl ; - llcallstacks << "Available virtual mem(KB): " << mAvailVirtualMemInKB << llcallstacksendl ; - } - + checkMemory() ; + try { pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1325,7 +1409,7 @@ bool LLAppViewer::mainLoop() idleTimer.reset(); bool is_slow = (frameTimer.getElapsedTimeF64() > FRAME_SLOW_THRESHOLD) ; S32 total_work_pending = 0; - S32 total_io_pending = 0; + S32 total_io_pending = 0; while(!is_slow)//do not unpause threads if the frame rates are very low. { S32 work_pending = 0; @@ -1393,15 +1477,7 @@ bool LLAppViewer::mainLoop() } catch(std::bad_alloc) { - { - llinfos << "Availabe physical memory(KB) at the beginning of the frame: " << mAvailPhysicalMemInKB << llendl ; - llinfos << "Availabe virtual memory(KB) at the beginning of the frame: " << mAvailVirtualMemInKB << llendl ; - - LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ; - - llinfos << "Current availabe physical memory(KB): " << mAvailPhysicalMemInKB << llendl ; - llinfos << "Current availabe virtual memory(KB): " << mAvailVirtualMemInKB << llendl ; - } + LLMemory::logMemoryInfo(TRUE) ; //stop memory leaking simulation LLFloaterMemLeak* mem_leak_instance = @@ -1494,16 +1570,16 @@ bool LLAppViewer::cleanup() } // *TODO - generalize this and move DSO wrangling to a helper class -brad - std::set<struct apr_dso_handle_t *>::const_iterator i; - for(i = mPlugins.begin(); i != mPlugins.end(); ++i) + for(std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> >::iterator plugin = mPlugins.begin(); + plugin != mPlugins.end(); ++plugin) { int (*ll_plugin_stop_func)(void) = NULL; - apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, *i, "ll_plugin_stop"); + apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, plugin->first, "ll_plugin_stop"); ll_plugin_stop_func(); - rv = apr_dso_unload(*i); + rv = apr_dso_unload(plugin->first); } - mPlugins.clear(); + mPlugins.clear(); // Forget handles and destroy all memory pools. //flag all elements as needing to be destroyed immediately // to ensure shutdown order @@ -1887,6 +1963,9 @@ bool LLAppViewer::cleanup() LLMainLoopRepeater::instance().stop(); + //release all private memory pools. + LLPrivateMemoryPoolManager::destroyClass() ; + ll_close_fail_log(); MEM_TRACK_RELEASE @@ -1938,7 +2017,7 @@ bool LLAppViewer::initThreads() if (LLFastTimer::sLog || LLFastTimer::sMetricLog) { - LLFastTimer::sLogLock = new LLMutex(NULL); + LLFastTimer::sLogLock = new LLMutex; mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName); mFastTimerLogThread->start(); } @@ -3186,8 +3265,7 @@ void LLAppViewer::handleViewerCrash() else crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,ERROR_MARKER_FILE_NAME); llinfos << "Creating crash marker file " << crash_file_name << llendl; - LLAPRFile crash_file ; - crash_file.open(crash_file_name, LL_APR_W); + LLAPRFile crash_file(crash_file_name, LL_APR_W); if (crash_file.getFileHandle()) { LL_INFOS("MarkerFile") << "Created crash marker file " << crash_file_name << LL_ENDL; @@ -3251,11 +3329,10 @@ bool LLAppViewer::anotherInstanceRunning() LL_DEBUGS("MarkerFile") << "Checking marker file for lock..." << LL_ENDL; //Freeze case checks - if (LLAPRFile::isExist(marker_file, NULL, LL_APR_RB)) + if (LLAPRFile::isExist(marker_file, LL_APR_RB)) { // File exists, try opening with write permissions - LLAPRFile outfile ; - outfile.open(marker_file, LL_APR_WB); + LLAPRFile outfile(marker_file, LL_APR_WB); apr_file_t* fMarker = outfile.getFileHandle() ; if (!fMarker) { @@ -3294,25 +3371,25 @@ void LLAppViewer::initMarkerFile() std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME); std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME); - if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB) && !anotherInstanceRunning()) + if (LLAPRFile::isExist(mMarkerFileName, LL_APR_RB) && !anotherInstanceRunning()) { gLastExecEvent = LAST_EXEC_FROZE; LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL; } - if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB)) + if(LLAPRFile::isExist(logout_marker_file, LL_APR_RB)) { gLastExecEvent = LAST_EXEC_LOGOUT_FROZE; LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL; LLAPRFile::remove(logout_marker_file); } - if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB)) + if(LLAPRFile::isExist(llerror_marker_file, LL_APR_RB)) { if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH; else gLastExecEvent = LAST_EXEC_LLERROR_CRASH; LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL; LLAPRFile::remove(llerror_marker_file); } - if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB)) + if(LLAPRFile::isExist(error_marker_file, LL_APR_RB)) { if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH; else gLastExecEvent = LAST_EXEC_OTHER_CRASH; @@ -3328,7 +3405,7 @@ void LLAppViewer::initMarkerFile() // Create the marker file for this execution & lock it apr_status_t s; - s = mMarkerFile.open(mMarkerFileName, LL_APR_W, TRUE); + s = mMarkerFile.open(mMarkerFileName, LL_APR_W, LLAPRFile::long_lived); if (s == APR_SUCCESS && mMarkerFile.getFileHandle()) { @@ -4586,8 +4663,7 @@ void LLAppViewer::sendLogoutRequest() gLogoutInProgress = TRUE; mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME); - LLAPRFile outfile ; - outfile.open(mLogoutMarkerFileName, LL_APR_W); + LLAPRFile outfile(mLogoutMarkerFileName, LL_APR_W); mLogoutMarkerFile = outfile.getFileHandle() ; if (mLogoutMarkerFile) { @@ -5039,14 +5115,15 @@ void LLAppViewer::loadEventHostModule(S32 listen_port) } #endif // LL_WINDOWS - apr_dso_handle_t * eventhost_dso_handle = NULL; - apr_pool_t * eventhost_dso_memory_pool = NULL; + boost::shared_ptr<LLAPRPool> eventhost_dso_memory_pool_ptr(new LLAPRPool); + LLAPRPool& eventhost_dso_memory_pool(*eventhost_dso_memory_pool_ptr); + apr_dso_handle_t* eventhost_dso_handle = NULL; //attempt to load the shared library - apr_pool_create(&eventhost_dso_memory_pool, NULL); + eventhost_dso_memory_pool.create(); apr_status_t rv = apr_dso_load(&eventhost_dso_handle, dso_path.c_str(), - eventhost_dso_memory_pool); + eventhost_dso_memory_pool()); llassert_always(! ll_apr_warn_status(rv, eventhost_dso_handle)); llassert_always(eventhost_dso_handle != NULL); @@ -5066,7 +5143,8 @@ void LLAppViewer::loadEventHostModule(S32 listen_port) llerrs << "problem loading eventhost plugin, status: " << status << llendl; } - mPlugins.insert(eventhost_dso_handle); + // Store the handle and link it to the pool that was used to allocate it. + mPlugins[eventhost_dso_handle] = eventhost_dso_memory_pool_ptr; } void LLAppViewer::launchUpdater() diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 32115e0e7b..168aaf5d94 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -170,7 +170,7 @@ public: // mute/unmute the system's master audio virtual void setMasterSystemAudioMute(bool mute); - virtual bool getMasterSystemAudioMute(); + virtual bool getMasterSystemAudioMute(); // Metrics policy helper statics. static void metricsUpdateRegion(U64 region_handle); @@ -193,11 +193,12 @@ protected: private: + void initMaxHeapSize(); bool initThreads(); // Initialize viewer threads, return false on failure. bool initConfiguration(); // Initialize settings from the command line/config file. void initUpdater(); // Initialize the updater service. bool initCache(); // Initialize local client cache. - + void checkMemory() ; // We have switched locations of both Mac and Windows cache, make sure // files migrate and old cache is cleared out. @@ -269,10 +270,9 @@ private: LLAllocator mAlloc; - std::set<struct apr_dso_handle_t*> mPlugins; + std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> > mPlugins; - U32 mAvailPhysicalMemInKB ; - U32 mAvailVirtualMemInKB ; + LLFrameTimer mMemCheckTimer; boost::scoped_ptr<LLUpdaterService> mUpdater; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 48d02dfeaa..db11462fcb 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -111,6 +111,7 @@ int main( int argc, char **argv ) } delete viewer_app_ptr; viewer_app_ptr = NULL; + return 0; } diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp index 32e7e0a83d..1ae469dfcf 100644 --- a/indra/newview/llappviewerlinux_api_dbus.cpp +++ b/indra/newview/llappviewerlinux_api_dbus.cpp @@ -27,11 +27,11 @@ #if LL_DBUS_ENABLED #include "linden_common.h" +#include "llaprpool.h" extern "C" { #include <dbus/dbus-glib.h> -#include "apr_pools.h" #include "apr_dso.h" } @@ -44,7 +44,7 @@ extern "C" { #undef LL_DBUS_SYM static bool sSymsGrabbed = false; -static apr_pool_t *sSymDBUSDSOMemoryPool = NULL; +static LLAPRPool sSymDBUSDSOMemoryPool; static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL; bool grab_dbus_syms(std::string dbus_dso_name) @@ -63,11 +63,11 @@ bool grab_dbus_syms(std::string dbus_dso_name) #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0) //attempt to load the shared library - apr_pool_create(&sSymDBUSDSOMemoryPool, NULL); + sSymDBUSDSOMemoryPool.create(); if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle, dbus_dso_name.c_str(), - sSymDBUSDSOMemoryPool) )) + sSymDBUSDSOMemoryPool()) )) { INFOMSG("Found DSO: %s", dbus_dso_name.c_str()); @@ -109,11 +109,7 @@ void ungrab_dbus_syms() sSymDBUSDSOHandleG = NULL; } - if ( sSymDBUSDSOMemoryPool ) - { - apr_pool_destroy(sSymDBUSDSOMemoryPool); - sSymDBUSDSOMemoryPool = NULL; - } + sSymDBUSDSOMemoryPool.destroy(); // NULL-out all of the symbols we'd grabbed #define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0) diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index c2916717bd..8929c0c1a4 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -113,6 +113,7 @@ int main( int argc, char **argv ) } delete viewer_app_ptr; viewer_app_ptr = NULL; + return 0; } diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 79e6c7b66b..c8cfe5b51e 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -201,7 +201,8 @@ public: }; LLBottomTray::LLBottomTray(const LLSD&) -: mChicletPanel(NULL), +: mDesiredNearbyChatWidth(0), + mChicletPanel(NULL), mSpeakPanel(NULL), mSpeakBtn(NULL), mNearbyChatBar(NULL), @@ -1095,33 +1096,35 @@ S32 LLBottomTray::processWidthDecreased(S32 delta_width) if (still_should_be_processed) { processShrinkButtons(delta_width, buttons_freed_width); + still_should_be_processed = delta_width < 0; } + // 3. Decreasing width of nearby chat. const S32 chatbar_panel_min_width = get_panel_min_width(mToolbarStack, mChatBarContainer); const S32 chatbar_panel_width = mChatBarContainer->getRect().getWidth(); if (still_should_be_processed && chatbar_panel_width > chatbar_panel_min_width) { // we have some space to decrease chatbar panel - S32 panel_delta_min = chatbar_panel_width - chatbar_panel_min_width; + S32 chatbar_shrink_headroom = chatbar_panel_width - chatbar_panel_min_width; - S32 delta_panel = llmin(-delta_width, panel_delta_min); + S32 shrink_by = llmin(-delta_width, chatbar_shrink_headroom); // is chatbar panel wide enough to process resizing? - delta_width += panel_delta_min; + delta_width += chatbar_shrink_headroom; still_should_be_processed = delta_width < 0; // chatbar should only be shrunk here, not stretched - if(delta_panel > 0) + if (shrink_by > 0) { - lldebugs << "Shrinking nearby chat bar by " << delta_panel << " px " << llendl; - mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - delta_panel, mChatBarContainer->getRect().getHeight()); + lldebugs << "Shrinking nearby chat bar by " << shrink_by << " px " << llendl; + mChatBarContainer->reshape(mNearbyChatBar->getRect().getWidth() - shrink_by, mChatBarContainer->getRect().getHeight()); } log(mNearbyChatBar, "after processing panel decreasing via nearby chatbar panel"); lldebugs << "RS_CHATBAR_INPUT" - << ", delta_panel: " << delta_panel + << ", shrink_by: " << shrink_by << ", delta_width: " << delta_width << llendl; } @@ -1200,16 +1203,16 @@ void LLBottomTray::processWidthIncreased(S32 delta_width) << ", mDesiredNearbyChatWidth = " << mDesiredNearbyChatWidth << llendl; if (delta_width > 0 && chatbar_panel_width < mDesiredNearbyChatWidth) { - S32 delta_panel_max = mDesiredNearbyChatWidth - chatbar_panel_width; - S32 delta_panel = llmin(delta_width, delta_panel_max); - lldebugs << "Unprocesed delta width: " << delta_width - << ", can be applied to chatbar: " << delta_panel_max - << ", will be applied: " << delta_panel + S32 extend_by_max = mDesiredNearbyChatWidth - chatbar_panel_width; + S32 extend_by = llmin(delta_width, extend_by_max); + lldebugs << "Unprocessed delta width: " << delta_width + << " px, chatbar can be extended by " << extend_by_max + << " px, extending it by " << extend_by << " px" << llendl; - delta_width -= delta_panel_max; - lldebugs << "Extending nearby chat bar by " << delta_panel << " px " << llendl; - mChatBarContainer->reshape(chatbar_panel_width + delta_panel, mChatBarContainer->getRect().getHeight()); + delta_width -= extend_by_max; + lldebugs << "Extending nearby chat bar by " << extend_by << " px " << llendl; + mChatBarContainer->reshape(chatbar_panel_width + extend_by, mChatBarContainer->getRect().getHeight()); log(mNearbyChatBar, "applied unprocessed delta width"); } diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h index 62718531ef..e26b0792e9 100644 --- a/indra/newview/llbottomtray.h +++ b/indra/newview/llbottomtray.h @@ -323,7 +323,7 @@ private: void processExtendButtons(S32& available_width); /** - * Extends the Speak button if there is anough headroom. + * Extends the Speak button if there is enough headroom. * * Unlike other buttons, the Speak buttons has only two possible widths: * the minimal one (without label) and the maximal (default) one. diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index f781d5f3ff..fb9958ee9d 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -40,6 +40,7 @@ #include "llvertexbuffer.h" #include "llviewerdisplay.h" #include "llrender.h" +#include "pipeline.h" // static LLViewerDynamicTexture::instance_list_t LLViewerDynamicTexture::sInstances[ LLViewerDynamicTexture::ORDER_COUNT ]; @@ -201,7 +202,7 @@ void LLViewerDynamicTexture::postRender(BOOL success) BOOL LLViewerDynamicTexture::updateAllInstances() { sNumRenders = 0; - if (gGLManager.mIsDisabled) + if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) { return TRUE; } diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 1f334815d6..9f0218a95e 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -223,8 +223,7 @@ BOOL LLFloaterAnimPreview::postBuild() // now load bvh file S32 file_size; - LLAPRFile infile ; - infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size); + LLAPRFile infile(mFilenameAndPath, LL_APR_RB, &file_size); if (!infile.getFileHandle()) { diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp index 58931d112e..9edfe1e354 100644 --- a/indra/newview/llfloatermemleak.cpp +++ b/indra/newview/llfloatermemleak.cpp @@ -90,6 +90,11 @@ LLFloaterMemLeak::~LLFloaterMemLeak() void LLFloaterMemLeak::release() { + if(mLeakedMem.empty()) + { + return ; + } + for(S32 i = 0 ; i < (S32)mLeakedMem.size() ; i++) { delete[] mLeakedMem[i] ; diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ef846ec42e..2510f43aa7 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -367,7 +367,7 @@ mCalculateBtn(NULL) mLastMouseX = 0; mLastMouseY = 0; mGLName = 0; - mStatusLock = new LLMutex(NULL); + mStatusLock = new LLMutex(); mModelPreview = NULL; mLODMode[LLModel::LOD_HIGH] = 0; @@ -2878,7 +2878,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element) //----------------------------------------------------------------------------- LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp) -: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL) +: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex() , mPelvisZOffset( 0.0f ) , mLegacyRigValid( false ) , mRigValidJointUpload( false ) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index ec162e00eb..e4bd2049fa 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -181,6 +181,7 @@ LLFolderView::Params::Params() // Default constructor LLFolderView::LLFolderView(const Params& p) : LLFolderViewFolder(p), + mRunningHeight(0), mScrollContainer( NULL ), mPopupMenuHandle(), mAllowMultiSelect(p.allow_multiselect), @@ -479,6 +480,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen target_height = running_height; } + mRunningHeight = running_height; LLRect scroll_rect = mScrollContainer->getContentWindowRect(); reshape( llmax(scroll_rect.getWidth(), total_width), running_height ); @@ -524,10 +526,11 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) LLRect scroll_rect; if (mScrollContainer) { + LLView::reshape(width, height, called_from_parent); scroll_rect = mScrollContainer->getContentWindowRect(); } width = llmax(mMinWidth, scroll_rect.getWidth()); - height = llmax(height, scroll_rect.getHeight()); + height = llmax(mRunningHeight, scroll_rect.getHeight()); // restrict width with scroll container's width if (mUseEllipses) @@ -1915,9 +1918,9 @@ BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, if (!handled) { if (getListener()->getUUID().notNull()) - { - LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } + { + LLFolderViewFolder::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); + } else { if (!mFolders.empty()) diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 705a76a7b4..8af01e9102 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -314,6 +314,7 @@ protected: signal_t mReshapeSignal; S32 mSignalSelectCallback; S32 mMinWidth; + S32 mRunningHeight; std::map<LLUUID, LLFolderViewItem*> mItemMap; BOOL mDragAndDropThisFrame; diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp index 5c020e6d98..d73048a28b 100644 --- a/indra/newview/llmainlooprepeater.cpp +++ b/indra/newview/llmainlooprepeater.cpp @@ -46,7 +46,7 @@ void LLMainLoopRepeater::start(void) { if(mQueue != 0) return; - mQueue = new LLThreadSafeQueue<LLSD>(gAPRPoolp, 1024); + mQueue = new LLThreadSafeQueue<LLSD>(1024); mMainLoopConnection = LLEventPumps::instance(). obtain("mainloop").listen(LLEventPump::inventName(), boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1)); mRepeaterConnection = LLEventPumps::instance(). diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 1eb786f433..5bbef78dd4 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -319,6 +319,11 @@ BOOL LLMediaCtrl::handleRightMouseDown( S32 x, S32 y, MASK mask ) if (mContextMenu) { + // hide/show debugging options + bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); + mContextMenu->setItemVisible("open_webinspector", media_plugin_debugging_enabled ); + mContextMenu->setItemVisible("debug_separator", media_plugin_debugging_enabled ); + mContextMenu->show(x, y); LLMenuGL::showPopup(this, mContextMenu, x, y); } @@ -385,12 +390,22 @@ void LLMediaCtrl::onFocusLost() // BOOL LLMediaCtrl::postBuild () { + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; + registar.add("Open.WebInspector", boost::bind(&LLMediaCtrl::onOpenWebInspector, this)); + mContextMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>( "menu_media_ctrl.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); + return TRUE; } +void LLMediaCtrl::onOpenWebInspector() +{ + if (mMediaSource && mMediaSource->hasMedia()) + mMediaSource->getMediaPlugin()->showWebInspector( true ); +} + //////////////////////////////////////////////////////////////////////////////// // BOOL LLMediaCtrl::handleKeyHere( KEY key, MASK mask ) @@ -1065,6 +1080,12 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) mHoverTextChanged = true; }; break; + + case MEDIA_EVENT_DEBUG_MESSAGE: + { + LL_INFOS("media") << self->getDebugMessageText() << LL_ENDL; + }; + break; }; // chain all events to any potential observers of this object. diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 0e4a5b1d65..3c0436e27a 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -166,6 +166,9 @@ public: // Incoming media event dispatcher virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + // right click debugging item + void onOpenWebInspector(); + LLUUID getTextureID() {return mMediaTextureID;} protected: diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index afed306a28..fc594841e3 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -445,12 +445,12 @@ public: }; LLMeshRepoThread::LLMeshRepoThread() -: LLThread("mesh repo", NULL) +: LLThread("mesh repo") { mWaiting = false; - mMutex = new LLMutex(NULL); - mHeaderMutex = new LLMutex(NULL); - mSignal = new LLCondition(NULL); + mMutex = new LLMutex(); + mHeaderMutex = new LLMutex(); + mSignal = new LLCondition(); } LLMeshRepoThread::~LLMeshRepoThread() @@ -1199,7 +1199,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mUploadTextures = upload_textures; mUploadSkin = upload_skin; mUploadJoints = upload_joints; - mMutex = new LLMutex(NULL); + mMutex = new LLMutex(); mCurlRequest = NULL; mPendingUploads = 0; mFinished = false; @@ -2029,7 +2029,7 @@ LLMeshRepository::LLMeshRepository() void LLMeshRepository::init() { - mMeshMutex = new LLMutex(NULL); + mMeshMutex = new LLMutex(); LLConvexDecomposition::getInstance()->initSystem(); @@ -2852,8 +2852,8 @@ LLPhysicsDecomp::LLPhysicsDecomp() mQuitting = false; mDone = false; - mSignal = new LLCondition(NULL); - mMutex = new LLMutex(NULL); + mSignal = new LLCondition(); + mMutex = new LLMutex(); } LLPhysicsDecomp::~LLPhysicsDecomp() diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 1576ccccdf..bc594b5517 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -579,6 +579,11 @@ void LLPanelGroupGeneral::update(LLGroupChange gc) } + // After role member data was changed in Roles->Members + // need to update role titles. See STORM-918. + if (gc == GC_ROLE_MEMBER_DATA) + LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID); + // If this was just a titles update, we are done. if (gc == GC_TITLES) return; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index bef809f3a7..db7d836799 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -154,6 +154,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, } updateLocationCombo(false); + LLUICtrl& mode_combo = getChildRef<LLUICtrl>("mode_combo"); + mode_combo.setValue(gSavedSettings.getString("SessionSettingsFile")); + mode_combo.setCommitCallback(boost::bind(&LLPanelLogin::onModeChange, this, getChild<LLUICtrl>("mode_combo")->getValue(), _2)); + LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo"); server_choice_combo->setCommitCallback(onSelectServer, NULL); server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1)); @@ -1021,6 +1025,32 @@ void LLPanelLogin::updateLoginPanelLinks() sInstance->getChildView("forgot_password_text")->setVisible( system_grid); } +void LLPanelLogin::onModeChange(const LLSD& original_value, const LLSD& new_value) +{ + if (original_value.asString() != new_value.asString()) + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(&LLPanelLogin::onModeChangeConfirm, this, original_value, new_value, _1, _2)); + } +} + +void LLPanelLogin::onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: + gSavedSettings.getControl("SessionSettingsFile")->set(new_value); + LLAppViewer::instance()->requestQuit(); + break; + case 1: + // revert to original value + getChild<LLUICtrl>("mode_combo")->setValue(original_value); + break; + default: + break; + } +} + std::string canonicalize_username(const std::string& name) { std::string cname = name; diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 4078eedc77..be9de884d1 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -87,6 +87,8 @@ private: void reshapeBrowser(); void addFavoritesToStartLocation(); void addUsersWithFavoritesToUsername(); + void onModeChange(const LLSD& original_value, const LLSD& new_value); + void onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response); static void onClickConnect(void*); static void onClickNewAccount(void*); static void onClickVersion(void*); @@ -97,7 +99,6 @@ private: static void onServerComboLostFocus(LLFocusableElement*); static void updateServerCombo(); static void updateStartSLURL(); - static void updateLoginPanelLinks(); private: diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 651897a217..a7c4057846 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -496,7 +496,7 @@ public: LLSideTray* side_tray = LLSideTray::getInstance(); // Check if the tab we are dragging is docked. - if (!side_tray->isTabAttached(getName())) return FALSE; + if (!side_tray->isTabAttached(mTabName)) return FALSE; // Same value is hardcoded in LLDragHandle::handleHover(). const S32 undock_threshold = 12; @@ -505,7 +505,7 @@ public: if (delta_x <= -undock_threshold || delta_x >= undock_threshold || delta_y <= -undock_threshold || delta_y >= undock_threshold) { - LLSideTrayTab* tab = side_tray->getTab(getName()); + LLSideTrayTab* tab = side_tray->getTab(mTabName); if (!tab) return FALSE; tab->setDocked(false); @@ -544,7 +544,12 @@ protected: , mDragLastScreenX(0) , mDragLastScreenY(0) , mBadgeDriver(NULL) - {} + { + // Find out the tab name to use in handleHover(). + size_t pos = getName().find("_button"); + llassert(pos != std::string::npos); + mTabName = getName().substr(0, pos); + } friend class LLUICtrlFactory; @@ -562,6 +567,7 @@ private: S32 mDragLastScreenX; S32 mDragLastScreenY; + std::string mTabName; LLSideTrayTabBadgeDriver* mBadgeDriver; }; @@ -679,6 +685,7 @@ LLSideTrayTab* LLSideTray::getTab(const std::string& name) bool LLSideTray::isTabAttached(const std::string& name) { LLSideTrayTab* tab = getTab(name); + llassert(tab); if (!tab) return false; return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end(); diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index 4cf1df1655..a853726dea 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -273,11 +273,11 @@ LLSLURL::LLSLURL(const std::string& slurl) mRegion = LLURI::unescape(path_array[0].asString()); path_array.erase(0); - // parse the x, y, z - if(path_array.size() >= 3) + // parse the x, y, and optionally z + if(path_array.size() >= 2) { - mPosition = LLVector3(path_array); + mPosition = LLVector3(path_array); // this construction handles LLSD without all components (values default to 0.f) if((F32(mPosition[VX]) < 0.f) || (mPosition[VX] > REGION_WIDTH_METERS) || (F32(mPosition[VY]) < 0.f) || diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 1b8be7a5b2..0a00885843 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -162,6 +162,8 @@ BOOL LLStatusBar::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL LLStatusBar::postBuild() { + LLControlVariablePtr mode_control = gSavedSettings.getControl("SessionSettingsFile"); + gMenuBarView->setRightMouseDownCallback(boost::bind(&show_navbar_context_menu, _1, _2, _3)); mTextTime = getChild<LLTextBox>("TimeText" ); @@ -233,9 +235,40 @@ BOOL LLStatusBar::postBuild() mScriptOut = getChildView("scriptout"); + LLUICtrl& mode_combo = getChildRef<LLUICtrl>("mode_combo"); + mode_combo.setValue(gSavedSettings.getString("SessionSettingsFile")); + mode_combo.setCommitCallback(boost::bind(&LLStatusBar::onModeChange, this, getChild<LLUICtrl>("mode_combo")->getValue(), _2)); + + return TRUE; } +void LLStatusBar::onModeChange(const LLSD& original_value, const LLSD& new_value) +{ + if (original_value.asString() != new_value.asString()) + { + LLNotificationsUtil::add("ModeChange", LLSD(), LLSD(), boost::bind(&LLStatusBar::onModeChangeConfirm, this, original_value, new_value, _1, _2)); + } +} + +void LLStatusBar::onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: + gSavedSettings.getControl("SessionSettingsFile")->set(new_value); + LLAppViewer::instance()->requestQuit(); + break; + case 1: + // revert to original value + getChild<LLUICtrl>("mode_combo")->setValue(original_value); + break; + default: + break; + } +} + // Per-frame updates of visibility void LLStatusBar::refresh() { diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 4ea3183d18..e1e1f5459b 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -92,6 +92,8 @@ private: void onMouseEnterVolume(); void onMouseEnterNearbyMedia(); void onClickScreen(S32 x, S32 y); + void onModeChange(const LLSD& original_value, const LLSD& new_value);
+ void onModeChangeConfirm(const LLSD& original_value, const LLSD& new_value, const LLSD& notification, const LLSD& response);
static void onClickMediaToggle(void* data); static void onClickBalance(void* data); diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 9b417307fd..87b6304f9d 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -113,7 +113,7 @@ public: ~LLTextureCacheWorker() { llassert_always(!haveWork()); - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); } // override this interface @@ -176,7 +176,7 @@ private: bool LLTextureCacheLocalFileWorker::doRead() { - S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool()); + S32 local_size = LLAPRFile::size(mFileName); if (local_size > 0 && mFileName.size() > 4) { @@ -215,7 +215,7 @@ bool LLTextureCacheLocalFileWorker::doRead() mDataSize = 0; return true; } - mReadData = new U8[mDataSize]; + mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize); mBytesRead = -1; mBytesToRead = mDataSize; setPriority(LLWorkerThread::PRIORITY_LOW | mPriority); @@ -233,7 +233,7 @@ bool LLTextureCacheLocalFileWorker::doRead() // << " Bytes: " << mDataSize << " Offset: " << mOffset // << " / " << mDataSize << llendl; mDataSize = 0; // failed - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } return true; @@ -248,9 +248,9 @@ bool LLTextureCacheLocalFileWorker::doRead() { mDataSize = local_size; } - mReadData = new U8[mDataSize]; + mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize); - S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool()); + S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize); if (bytes_read != mDataSize) { @@ -258,7 +258,7 @@ bool LLTextureCacheLocalFileWorker::doRead() // << " Bytes: " << mDataSize << " Offset: " << mOffset // << " / " << mDataSize << llendl; mDataSize = 0; - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } else @@ -331,7 +331,7 @@ bool LLTextureCacheRemoteWorker::doRead() // Is it a JPEG2000 file? { local_filename = filename + ".j2c"; - local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { mImageFormat = IMG_CODEC_J2C; @@ -341,7 +341,7 @@ bool LLTextureCacheRemoteWorker::doRead() if (local_size == 0) { local_filename = filename + ".jpg"; - local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { mImageFormat = IMG_CODEC_JPEG; @@ -352,7 +352,7 @@ bool LLTextureCacheRemoteWorker::doRead() if (local_size == 0) { local_filename = filename + ".tga"; - local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { mImageFormat = IMG_CODEC_TGA; @@ -377,16 +377,15 @@ bool LLTextureCacheRemoteWorker::doRead() mDataSize = local_size; } // Allocate read buffer - mReadData = new U8[mDataSize]; - S32 bytes_read = LLAPRFile::readEx(local_filename, - mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool()); + mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize); + S32 bytes_read = LLAPRFile::readEx(local_filename, mReadData, mOffset, mDataSize); if (bytes_read != mDataSize) { llwarns << "Error reading file from local cache: " << local_filename << " Bytes: " << mDataSize << " Offset: " << mOffset << " / " << mDataSize << llendl; mDataSize = 0; - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } else @@ -429,15 +428,14 @@ bool LLTextureCacheRemoteWorker::doRead() S32 size = TEXTURE_CACHE_ENTRY_SIZE - mOffset; size = llmin(size, mDataSize); // Allocate the read buffer - mReadData = new U8[size]; - S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, - mReadData, offset, size, mCache->getLocalAPRFilePool()); + mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), size); + S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, mReadData, offset, size); if (bytes_read != size) { llwarns << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from header: " << bytes_read << " / " << size << llendl; - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed done = true; @@ -457,7 +455,7 @@ bool LLTextureCacheRemoteWorker::doRead() if (!done && (mState == BODY)) { std::string filename = mCache->getTextureFileName(mID); - S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool()); + S32 filesize = LLAPRFile::size(filename); if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset) { @@ -467,7 +465,7 @@ bool LLTextureCacheRemoteWorker::doRead() S32 data_offset, file_size, file_offset; // Reserve the whole data buffer first - U8* data = new U8[mDataSize]; + U8* data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize); // Set the data file pointers taking the read offset into account. 2 cases: if (mOffset < TEXTURE_CACHE_ENTRY_SIZE) @@ -480,7 +478,7 @@ bool LLTextureCacheRemoteWorker::doRead() // Copy the raw data we've been holding from the header cache into the new sized buffer llassert_always(mReadData); memcpy(data, mReadData, data_offset); - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } else @@ -499,14 +497,13 @@ bool LLTextureCacheRemoteWorker::doRead() // Read the data at last S32 bytes_read = LLAPRFile::readEx(filename, mReadData + data_offset, - file_offset, file_size, - mCache->getLocalAPRFilePool()); + file_offset, file_size); if (bytes_read != file_size) { llwarns << "LLTextureCacheWorker: " << mID << " incorrect number of bytes read from body: " << bytes_read << " / " << file_size << llendl; - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; mDataSize = -1; // failed done = true; @@ -598,16 +595,16 @@ bool LLTextureCacheRemoteWorker::doWrite() { // We need to write a full record in the header cache so, if the amount of data is smaller // than a record, we need to transfer the data to a buffer padded with 0 and write that - U8* padBuffer = new U8[TEXTURE_CACHE_ENTRY_SIZE]; + U8* padBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), TEXTURE_CACHE_ENTRY_SIZE); memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer - bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool()); - delete [] padBuffer; + bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size); + FREE_MEM(LLImageBase::getPrivatePool(), padBuffer); } else { // Write the header record (== first TEXTURE_CACHE_ENTRY_SIZE bytes of the raw file) in the header file - bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool()); + bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size); } if (bytes_written <= 0) @@ -642,8 +639,7 @@ bool LLTextureCacheRemoteWorker::doWrite() // llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl; S32 bytes_written = LLAPRFile::writeEx( filename, mWriteData + TEXTURE_CACHE_ENTRY_SIZE, - 0, file_size, - mCache->getLocalAPRFilePool()); + 0, file_size); if (bytes_written <= 0) { llwarns << "LLTextureCacheWorker: " << mID @@ -698,7 +694,7 @@ void LLTextureCacheWorker::finishWork(S32 param, bool completed) } else { - delete[] mReadData; + FREE_MEM(LLImageBase::getPrivatePool(), mReadData); mReadData = NULL; } } @@ -740,9 +736,6 @@ void LLTextureCacheWorker::endWork(S32 param, bool aborted) LLTextureCache::LLTextureCache(bool threaded) : LLWorkerThread("TextureCache", threaded), - mWorkersMutex(NULL), - mHeaderMutex(NULL), - mListMutex(NULL), mHeaderAPRFile(NULL), mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called. mTexturesSizeTotal(0), @@ -846,7 +839,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) // Is it a JPEG2000 file? { local_filename = filename + ".j2c"; - local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { return TRUE ; @@ -856,7 +849,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) // If not, is it a jpeg file? { local_filename = filename + ".jpg"; - local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { return TRUE ; @@ -866,7 +859,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id) // Hmm... What about a targa file? (used for UI texture mostly) { local_filename = filename + ".tga"; - local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool()); + local_size = LLAPRFile::size(local_filename); if (local_size > 0) { return TRUE ; @@ -912,10 +905,10 @@ void LLTextureCache::purgeCache(ELLPath location) if(LLFile::isdir(mTexturesDirName)) { std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename); - LLAPRFile::remove(file_name, getLocalAPRFilePool()); + LLAPRFile::remove(file_name); file_name = gDirUtilp->getExpandedFilename(location, cache_filename); - LLAPRFile::remove(file_name, getLocalAPRFilePool()); + LLAPRFile::remove(file_name); purgeAllTextures(true); } @@ -991,7 +984,9 @@ LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset) { llassert_always(mHeaderAPRFile == NULL); apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY; - mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, getLocalAPRFilePool()); + // All code calling openHeaderEntriesFile, immediately calls closeHeaderEntriesFile, + // so this file is very short-lived. + mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags); if(offset > 0) { mHeaderAPRFile->seek(APR_SET, offset); @@ -1014,10 +1009,9 @@ void LLTextureCache::readEntriesHeader() { // mHeaderEntriesInfo initializes to default values so safe not to read it llassert_always(mHeaderAPRFile == NULL); - if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool())) + if (LLAPRFile::isExist(mHeaderEntriesFileName)) { - LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo), - getLocalAPRFilePool()); + LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo)); } else //create an empty entries header. { @@ -1032,8 +1026,7 @@ void LLTextureCache::writeEntriesHeader() llassert_always(mHeaderAPRFile == NULL); if (!mReadOnly) { - LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo), - getLocalAPRFilePool()); + LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo)); } } @@ -1622,7 +1615,7 @@ void LLTextureCache::purgeTextures(bool validate) if (uuididx == validate_idx) { LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL; - S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool()); + S32 bodysize = LLAPRFile::size(filename); if (bodysize != entries[idx].mBodySize) { LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize @@ -1857,7 +1850,7 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id) mTexturesSizeMap.erase(id); } mHeaderIDMap.erase(id); - LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool()); + LLAPRFile::remove(getTextureFileName(id)); } //called after mHeaderMutex is locked. @@ -1869,7 +1862,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) { if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0. { - if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // Sanity check. Shouldn't exist when body size is 0. + if (LLAPRFile::isExist(filename)) // Sanity check. Shouldn't exist when body size is 0. { LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL; } @@ -1890,7 +1883,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename) if (file_maybe_exists) { - LLAPRFile::remove(filename, getLocalAPRFilePool()); + LLAPRFile::remove(filename); } } diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index 64e3a2658c..79f5ba5835 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -142,9 +142,6 @@ protected: std::string getTextureFileName(const LLUUID& id); void addCompleted(Responder* responder, bool success); -protected: - //void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; } - private: void setDirNames(ELLPath location); void readHeaderCache(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 18c3a3b87d..e9be45ffd0 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -674,7 +674,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mRetryAttempt(0), mActiveCount(0), mGetStatus(0), - mWorkMutex(NULL), mFirstPacket(0), mLastPacket(-1), mTotalPackets(0), @@ -817,7 +816,7 @@ void LLTextureFetchWorker::setImagePriority(F32 priority) void LLTextureFetchWorker::resetFormattedData() { - delete[] mBuffer; + FREE_MEM(LLImageBase::getPrivatePool(), mBuffer); mBuffer = NULL; mBufferSize = 0; if (mFormattedImage.notNull()) @@ -888,7 +887,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mSentRequest = UNSENT; mDecoded = FALSE; mWritten = FALSE; - delete[] mBuffer; + FREE_MEM(LLImageBase::getPrivatePool(), mBuffer); mBuffer = NULL; mBufferSize = 0; mHaveAllData = FALSE; @@ -1284,7 +1283,7 @@ bool LLTextureFetchWorker::doWork(S32 param) llassert_always(mBufferSize == cur_size + mRequestedSize); if(!mBufferSize)//no data received. { - delete[] mBuffer; + FREE_MEM(LLImageBase::getPrivatePool(), mBuffer); mBuffer = NULL; //abort. @@ -1312,7 +1311,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mFileSize = mBufferSize + 1 ; //flag the file is not fully loaded. } - U8* buffer = new U8[mBufferSize]; + U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mBufferSize); if (cur_size > 0) { memcpy(buffer, mFormattedImage->getData(), cur_size); @@ -1321,7 +1320,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // NOTE: setData releases current data and owns new data (buffer) mFormattedImage->setData(buffer, mBufferSize); // delete temp data - delete[] mBuffer; // Note: not 'buffer' (assigned in setData()) + FREE_MEM(LLImageBase::getPrivatePool(), mBuffer); // Note: not 'buffer' (assigned in setData()) mBuffer = NULL; mBufferSize = 0; mLoadedDiscard = mRequestedDiscard; @@ -1618,7 +1617,7 @@ bool LLTextureFetchWorker::processSimulatorPackets() if (buffer_size > cur_size) { /// We have new data - U8* buffer = new U8[buffer_size]; + U8* buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), buffer_size); S32 offset = 0; if (cur_size > 0 && mFirstPacket > 0) { @@ -1670,7 +1669,7 @@ S32 LLTextureFetchWorker::callbackHttpGet(const LLChannelDescriptors& channels, if (data_size > 0) { // *TODO: set the formatted image data here directly to avoid the copy - mBuffer = new U8[data_size]; + mBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); buffer->readAfter(channels.in(), NULL, mBuffer, data_size); mBufferSize += data_size; if (data_size < mRequestedSize && mRequestedDiscard == 0) @@ -1816,8 +1815,6 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mDebugPause(FALSE), mPacketCount(0), mBadPacketCount(0), - mQueueMutex(getAPRPool()), - mNetworkQueueMutex(getAPRPool()), mTextureCache(cache), mImageDecodeThread(imagedecodethread), mTextureBandwidth(0), diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index fa91f129b8..6873cf058a 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -307,8 +307,14 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair S32 bottom_offset = mIsScriptDialog ? (BTN_HEIGHT + IGNORE_BTN_TOP_DELTA + BOTTOM_PAD) : BOTTOM_PAD; S32 max_width = mControlPanel->getRect().getWidth(); LLButton* ignore_btn = NULL; + LLButton* mute_btn = NULL; for (std::vector<index_button_pair_t>::const_iterator it = buttons.begin(); it != buttons.end(); it++) { + if (-2 == it->first) + { + mute_btn = it->second; + continue; + } if (it->first == -1) { ignore_btn = it->second; @@ -328,6 +334,8 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair left = btn_rect.mLeft + btn_rect.getWidth() + h_pad; mControlPanel->addChild(btn, -1); } + + U32 ignore_btn_width = 0; if (mIsScriptDialog && ignore_btn != NULL) { LLRect ignore_btn_rect(ignore_btn->getRect()); @@ -340,8 +348,25 @@ void LLToastNotifyPanel::updateButtonsLayout(const std::vector<index_button_pair ignore_btn_rect.setOriginAndSize(ignore_btn_left, BOTTOM_PAD,// always move ignore button at the bottom ignore_btn_rect.getWidth(), ignore_btn_rect.getHeight()); ignore_btn->setRect(ignore_btn_rect); + ignore_btn_width = ignore_btn_rect.getWidth(); mControlPanel->addChild(ignore_btn, -1); } + + if (mIsScriptDialog && mute_btn != NULL) + { + LLRect mute_btn_rect(mute_btn->getRect()); + S32 buttons_per_row = max_width / BUTTON_WIDTH; //assume that h_pad far less than BUTTON_WIDTH + // Place mute (Block) button to the left of the ignore button. + S32 mute_btn_left = buttons_per_row * BUTTON_WIDTH + (buttons_per_row - 1) * h_pad - mute_btn_rect.getWidth() - ignore_btn_width - (h_pad / 2); + if (mute_btn_left + mute_btn_rect.getWidth() > max_width) // make sure that the mute button is in panel + { + mute_btn_left = max_width - mute_btn_rect.getWidth() - 2 * HPAD; + } + mute_btn_rect.setOriginAndSize(mute_btn_left, BOTTOM_PAD,// always move mute button at the bottom + mute_btn_rect.getWidth(), mute_btn_rect.getHeight()); + mute_btn->setRect(mute_btn_rect); + mControlPanel->addChild(mute_btn); + } } void LLToastNotifyPanel::adjustPanelForScriptNotice(S32 button_panel_width, S32 button_panel_height) diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 39053fe9e4..6142ee0dd6 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -202,6 +202,7 @@ void display_stats() gMemoryAllocated = LLMemory::getCurrentRSS(); U32 memory = (U32)(gMemoryAllocated / (1024*1024)); llinfos << llformat("MEMORY: %d MB", memory) << llendl; + LLMemory::logMemoryInfo() ; gRecentMemoryTime.reset(); } } @@ -692,7 +693,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glh::matrix4f mod = glh_get_current_modelview(); glViewport(0,0,512,512); LLVOAvatar::updateFreezeCounter() ; - LLVOAvatar::updateImpostors(); + + if(!LLPipeline::sMemAllocationThrottled) + { + LLVOAvatar::updateImpostors(); + } glh_set_current_projection(proj); glh_set_current_modelview(mod); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 384f7cd61d..31b22119cb 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1776,6 +1776,7 @@ void LLViewerMediaImpl::createMediaSource() LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL; } } + } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1880,7 +1881,10 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ // collect 'javascript enabled' setting from prefs and send to embedded browser bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); media_source->setJavascriptEnabled( javascript_enabled ); - + + bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging"); + media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled ); + media_source->setTarget(target); const std::string plugin_dir = gDirUtilp->getLLPluginDir(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b29821479b..26599f557e 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -116,6 +116,8 @@ using namespace LLVOAvatarDefines; +typedef LLPointer<LLViewerObject> LLViewerObjectPtr; + static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels; BOOL enable_land_build(void*); @@ -4010,23 +4012,21 @@ void handle_god_request_avatar_geometry(void *) } } - -void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) +static bool get_derezzable_objects( + EDeRezDestination dest, + std::string& error, + LLViewerRegion*& first_region, + LLDynamicArray<LLViewerObjectPtr>* derez_objectsp, + bool only_check = false) { - if(gAgentCamera.cameraMouselook()) - { - gAgentCamera.changeCameraToDefault(); - } - //gInventoryView->setPanelOpen(TRUE); + bool found = false; - std::string error; - LLDynamicArray<LLViewerObject*> derez_objects; + LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); // Check conditions that we can't deal with, building a list of // everything that we'll actually be derezzing. - LLViewerRegion* first_region = NULL; - for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin(); - iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++) + for (LLObjectSelection::valid_root_iterator iter = selection->valid_root_begin(); + iter != selection->valid_root_end(); iter++) { LLSelectNode* node = *iter; LLViewerObject* object = node->getObject(); @@ -4093,8 +4093,53 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) } if(can_derez_current) { - derez_objects.put(object); + found = true; + + if (only_check) + // one found, no need to traverse to the end + break; + + if (derez_objectsp) + derez_objectsp->put(object); + + } + } + + return found; +} + +static bool can_derez(EDeRezDestination dest) +{ + LLViewerRegion* first_region = NULL; + std::string error; + return get_derezzable_objects(dest, error, first_region, NULL, true); +} + +static void derez_objects( + EDeRezDestination dest, + const LLUUID& dest_id, + LLViewerRegion*& first_region, + std::string& error, + LLDynamicArray<LLViewerObjectPtr>* objectsp) +{ + LLDynamicArray<LLViewerObjectPtr> derez_objects; + + if (!objectsp) // if objects to derez not specified + { + // get them from selection + if (!get_derezzable_objects(dest, error, first_region, &derez_objects, false)) + { + llwarns << "No objects to derez" << llendl; + return; } + + objectsp = &derez_objects; + } + + + if(gAgentCamera.cameraMouselook()) + { + gAgentCamera.changeCameraToDefault(); } // This constant is based on (1200 - HEADER_SIZE) / 4 bytes per @@ -4104,13 +4149,13 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) // satisfy anybody. const S32 MAX_ROOTS_PER_PACKET = 250; const S32 MAX_PACKET_COUNT = 254; - F32 packets = ceil((F32)derez_objects.count() / (F32)MAX_ROOTS_PER_PACKET); + F32 packets = ceil((F32)objectsp->count() / (F32)MAX_ROOTS_PER_PACKET); if(packets > (F32)MAX_PACKET_COUNT) { error = "AcquireErrorTooManyObjects"; } - if(error.empty() && derez_objects.count() > 0) + if(error.empty() && objectsp->count() > 0) { U8 d = (U8)dest; LLUUID tid; @@ -4135,11 +4180,11 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) msg->addU8Fast(_PREHASH_PacketCount, packet_count); msg->addU8Fast(_PREHASH_PacketNumber, packet_number); objects_in_packet = 0; - while((object_index < derez_objects.count()) + while((object_index < objectsp->count()) && (objects_in_packet++ < MAX_ROOTS_PER_PACKET)) { - LLViewerObject* object = derez_objects.get(object_index++); + LLViewerObject* object = objectsp->get(object_index++); msg->nextBlockFast(_PREHASH_ObjectData); msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); // VEFFECT: DerezObject @@ -4164,6 +4209,13 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) } } +static void derez_objects(EDeRezDestination dest, const LLUUID& dest_id) +{ + LLViewerRegion* first_region = NULL; + std::string error; + derez_objects(dest, dest_id, first_region, error, NULL); +} + void handle_take_copy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; @@ -4175,12 +4227,19 @@ void handle_take_copy() // You can return an object to its owner if it is on your land. class LLObjectReturn : public view_listener_t { +public: + LLObjectReturn() : mFirstRegion(NULL) {} + +private: bool handleEvent(const LLSD& userdata) { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return true; mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + // Save selected objects, so that we still know what to return after the confirmation dialog resets selection. + get_derezzable_objects(DRD_RETURN_TO_OWNER, mError, mFirstRegion, &mReturnableObjects); + LLNotificationsUtil::add("ReturnToOwner", LLSD(), LLSD(), boost::bind(&LLObjectReturn::onReturnToOwner, this, _1, _2)); return true; } @@ -4191,16 +4250,23 @@ class LLObjectReturn : public view_listener_t if (0 == option) { // Ignore category ID for this derez destination. - derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null); + derez_objects(DRD_RETURN_TO_OWNER, LLUUID::null, mFirstRegion, mError, &mReturnableObjects); } + mReturnableObjects.clear(); + mError.clear(); + mFirstRegion = NULL; + // drop reference to current selection mObjectSelection = NULL; return false; } -protected: LLObjectSelectionHandle mObjectSelection; + + LLDynamicArray<LLViewerObjectPtr> mReturnableObjects; + std::string mError; + LLViewerRegion* mFirstRegion; }; @@ -4225,29 +4291,7 @@ class LLObjectEnableReturn : public view_listener_t } else { - LLViewerRegion* region = gAgent.getRegion(); - if (region) - { - // Estate owners and managers can always return objects. - if (region->canManageEstate()) - { - new_value = true; - } - else - { - struct f : public LLSelectedObjectFunctor - { - virtual bool apply(LLViewerObject* obj) - { - return - obj->permModify() || - obj->isReturnable(); - } - } func; - const bool firstonly = true; - new_value = LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, firstonly); - } - } + new_value = can_derez(DRD_RETURN_TO_OWNER); } #endif return new_value; diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index b9293b3b31..8139f7deda 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -149,7 +149,7 @@ void LLFilePickerThread::run() //static void LLFilePickerThread::initClass() { - sMutex = new LLMutex(NULL); + sMutex = new LLMutex(); } //static @@ -816,8 +816,7 @@ LLUUID upload_new_resource( uuid = tid.makeAssetID(gAgent.getSecureSessionID()); // copy this file into the vfs for upload S32 file_size; - LLAPRFile infile ; - infile.open(filename, LL_APR_RB, NULL, &file_size); + LLAPRFile infile(filename, LL_APR_RB, &file_size); if (infile.getFileHandle()) { LLVFile file(gVFS, uuid, asset_type, LLVFile::WRITE); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 4eb735fa16..6435904fee 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6498,8 +6498,24 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) rtn_text = LLNotification::getSelectedOptionName(response); } - // Didn't click "Ignore" - if (button_idx != -1) + // Button -2 = Mute + // Button -1 = Ignore - no processing needed for this button + // Buttons 0 and above = dialog choices + + if (-2 == button_idx) + { + std::string object_name = notification["payload"]["object_name"].asString(); + LLUUID object_id = notification["payload"]["object_id"].asUUID(); + LLMute mute(object_id, object_name, LLMute::OBJECT); + if (LLMuteList::getInstance()->add(mute)) + { + // This call opens the sidebar, displays the block list, and highlights the newly blocked + // object in the list so the user can see that their block click has taken effect. + LLPanelBlockedList::showPanelAndSelect(object_id); + } + } + + if (0 <= button_idx) { LLMessageSystem* msg = gMessageSystem; msg->newMessage("ScriptDialogReply"); @@ -6542,12 +6558,12 @@ void process_script_dialog(LLMessageSystem* msg, void**) std::string message; std::string first_name; std::string last_name; - std::string title; + std::string object_name; S32 chat_channel; msg->getString("Data", "FirstName", first_name); msg->getString("Data", "LastName", last_name); - msg->getString("Data", "ObjectName", title); + msg->getString("Data", "ObjectName", object_name); msg->getString("Data", "Message", message); msg->getS32("Data", "ChatChannel", chat_channel); @@ -6558,6 +6574,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) payload["sender"] = msg->getSender().getIPandPort(); payload["object_id"] = object_id; payload["chat_channel"] = chat_channel; + payload["object_name"] = object_name; // build up custom form S32 button_count = msg->getNumberOfBlocks("Buttons"); @@ -6576,7 +6593,7 @@ void process_script_dialog(LLMessageSystem* msg, void**) } LLSD args; - args["TITLE"] = title; + args["TITLE"] = object_name; args["MESSAGE"] = message; LLNotificationPtr notification; if (!first_name.empty()) diff --git a/indra/newview/llviewerparcelmedia.cpp b/indra/newview/llviewerparcelmedia.cpp index dfa35edef4..90fbc41daa 100644 --- a/indra/newview/llviewerparcelmedia.cpp +++ b/indra/newview/llviewerparcelmedia.cpp @@ -485,6 +485,12 @@ void LLViewerParcelMedia::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent { switch(event) { + case MEDIA_EVENT_DEBUG_MESSAGE: + { + // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_DEBUG_MESSAGE " << LL_ENDL; + }; + break; + case MEDIA_EVENT_CONTENT_UPDATED: { // LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CONTENT_UPDATED " << LL_ENDL; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 70509f9a9f..280337be0f 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3109,9 +3109,16 @@ void LLViewerLODTexture::processTextureStats() { mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel) ; } + else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. + { + if(scaleDown()) + { + mDesiredDiscardLevel = mCachedRawDiscardLevel ; + } + } } -void LLViewerLODTexture::scaleDown() +bool LLViewerLODTexture::scaleDown() { if(hasGLTexture() && mCachedRawDiscardLevel > getDiscardLevel()) { @@ -3122,7 +3129,10 @@ void LLViewerLODTexture::scaleDown() { tester->setStablizingTime() ; } + + return true ; } + return false ; } //---------------------------------------------------------------------------------------------- //end of LLViewerLODTexture diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index de528927b4..a4a5ae0a5b 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -597,7 +597,7 @@ public: private: void init(bool firstinit) ; - void scaleDown() ; + bool scaleDown() ; private: F32 mDiscardVirtualSize; // Virtual size used to calculate desired discard diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 8d4f9b346f..5893259d96 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -662,6 +662,17 @@ public: addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3])); ypos += y_inc; } + + if (gSavedSettings.getBOOL("DebugShowPrivateMem")) + { + LLPrivateMemoryPoolManager::getInstance()->updateStatistics() ; + addText(xpos, ypos, llformat("Total Reserved(KB): %d", LLPrivateMemoryPoolManager::getInstance()->mTotalReservedSize / 1024)); + ypos += y_inc; + + addText(xpos, ypos, llformat("Total Allocated(KB): %d", LLPrivateMemoryPoolManager::getInstance()->mTotalAllocatedSize / 1024)); + ypos += y_inc; + } + // only display these messages if we are actually rendering beacons at this moment if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons")) { @@ -1630,6 +1641,7 @@ LLViewerWindow::LLViewerWindow( } LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"), gSavedSettings.getBOOL("RenderVBOMappingDisable")); LL_INFOS("RenderInit") << "LLVertexBuffer initialization done." << LL_ENDL ; + gGL.init() ; if (LLFeatureManager::getInstance()->isSafe() || (gSavedSettings.getS32("LastFeatureVersion") != LLFeatureManager::getInstance()->getVersion()) @@ -2026,15 +2038,17 @@ void LLViewerWindow::shutdownGL() llinfos << "All textures and llimagegl images are destroyed!" << llendl ; llinfos << "Cleaning up select manager" << llendl; - LLSelectMgr::getInstance()->cleanup(); - - LLVertexBuffer::cleanupClass(); + LLSelectMgr::getInstance()->cleanup(); llinfos << "Stopping GL during shutdown" << llendl; stopGL(FALSE); stop_glerror(); gGL.shutdown(); + + LLVertexBuffer::cleanupClass(); + + llinfos << "LLVertexBuffer cleaned." << llendl ; } // shutdownViews() and shutdownGL() need to be called first @@ -4148,6 +4162,19 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei { return FALSE; } + //check if there is enough memory for the snapshot image + if(LLPipeline::sMemAllocationThrottled) + { + return FALSE ; //snapshot taking is disabled due to memory restriction. + } + if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K + { + if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) + { + llwarns << "No enough memory to take the snapshot with size (w : h): " << image_width << " : " << image_height << llendl ; + return FALSE ; //there is no enough memory for taking this snapshot. + } + } // PRE SNAPSHOT gDisplaySwapBuffers = FALSE; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 7946846222..7c6a815def 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7506,8 +7506,7 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // static void LLVOAvatar::dumpArchetypeXML( void* ) { - LLAPRFile outfile; - outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB ); + LLAPRFile outfile(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER, "new archetype.xml"), LL_APR_WB); apr_file_t* file = outfile.getFileHandle() ; if (!file) { diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 6d457434b5..baf01ec066 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -268,7 +268,6 @@ LLVOCache::LLVOCache(): mCacheSize(1) { mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled"); - mLocalAPRFilePoolp = new LLVolatileAPRPool() ; } LLVOCache::~LLVOCache() @@ -278,7 +277,6 @@ LLVOCache::~LLVOCache() writeCacheHeader(); clearCacheInMemory(); } - delete mLocalAPRFilePoolp; } void LLVOCache::setDirNames(ELLPath location) @@ -435,7 +433,7 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry) std::string filename; getObjectCacheFilename(entry->mHandle, filename); - LLAPRFile::remove(filename, mLocalAPRFilePoolp); + LLAPRFile::remove(filename); entry->mTime = INVALID_TIME ; updateEntry(entry) ; //update the head file. } @@ -452,9 +450,9 @@ void LLVOCache::readCacheHeader() clearCacheInMemory(); bool success = true ; - if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp)) + if (LLAPRFile::isExist(mHeaderFileName)) { - LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp); + LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY); //read the meta element success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ; @@ -539,7 +537,7 @@ void LLVOCache::writeCacheHeader() bool success = true ; { - LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp); + LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY); //write the meta element success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ; @@ -577,7 +575,7 @@ void LLVOCache::writeCacheHeader() BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry) { - LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp); + LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY); apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ; return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ; @@ -603,7 +601,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca { std::string filename; getObjectCacheFilename(handle, filename); - LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp); + LLAPRFile apr_file(filename, APR_READ|APR_BINARY); LLUUID cache_id ; success = check_read(&apr_file, cache_id.mData, UUID_BYTES) ; @@ -726,7 +724,7 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: { std::string filename; getObjectCacheFilename(handle, filename); - LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp); + LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY); success = check_write(&apr_file, (void*)id.mData, UUID_BYTES) ; @@ -751,4 +749,3 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: return ; } - diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 14e3b4c793..13651c6779 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -142,7 +142,6 @@ private: U32 mNumEntries; std::string mHeaderFileName ; std::string mObjectCacheDirName; - LLVolatileAPRPool* mLocalAPRFilePoolp ; header_entry_queue_t mHeaderEntryQueue; handle_entry_map_t mHandleEntryMap; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 0db0010688..8b942fbc6a 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -942,7 +942,7 @@ void LLVivoxVoiceClient::stateMachine() if(!mSocket) { - mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP); + mSocket = LLSocket::create(LLSocket::STREAM_TCP); } mConnected = mSocket->blockingConnect(mDaemonHost); diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp index 4f582fc2db..64ca94b567 100644 --- a/indra/newview/llwatchdog.cpp +++ b/indra/newview/llwatchdog.cpp @@ -178,8 +178,8 @@ void LLWatchdog::init(killer_event_callback func) mKillerCallback = func; if(!mSuspectsAccessMutex && !mTimer) { - mSuspectsAccessMutex = new LLMutex(NULL); - mTimer = new LLWatchdogTimerThread(); + mSuspectsAccessMutex = new LLMutex; + mTimer = new LLWatchdogTimerThread; mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000); mLastClockCount = LLTimer::getTotalTime(); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 4a6ec7fdbb..a7ae456f3c 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -127,6 +127,12 @@ void LLWorld::destroyClass() LLVOCache::getInstance()->destroyClass() ; } LLViewerPartSim::getInstance()->destroyClass(); + + mDefaultWaterTexturep = NULL ; + for (S32 i = 0; i < 8; i++) + { + mEdgeWaterObjects[i] = NULL; + } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7a26404138..a50f66f282 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -103,6 +103,7 @@ #include "llmutelist.h" #include "lltoolpie.h" #include "llcurl.h" +#include "llnotifications.h" void check_stack_depth(S32 stack_depth) @@ -317,6 +318,7 @@ BOOL LLPipeline::sRenderFrameTest = FALSE; BOOL LLPipeline::sRenderAttachedLights = TRUE; BOOL LLPipeline::sRenderAttachedParticles = TRUE; BOOL LLPipeline::sRenderDeferred = FALSE; +BOOL LLPipeline::sMemAllocationThrottled = FALSE; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; @@ -561,6 +563,24 @@ void LLPipeline::destroyGL() static LLFastTimer::DeclareTimer FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); +//static +void LLPipeline::throttleNewMemoryAllocation(BOOL disable) +{ + if(sMemAllocationThrottled != disable) + { + sMemAllocationThrottled = disable ; + + if(sMemAllocationThrottled) + { + //send out notification + LLNotification::Params params("LowMemory"); + LLNotifications::instance().add(params); + + //release some memory. + } + } +} + void LLPipeline::resizeScreenTexture() { LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 28e6526acd..3f0640221e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -362,6 +362,8 @@ public: static void updateRenderDeferred(); static void refreshRenderDeferred(); + static void throttleNewMemoryAllocation(BOOL disable); + void addDebugBlip(const LLVector3& position, const LLColor4& color); private: @@ -517,8 +519,9 @@ public: static BOOL sRenderAttachedLights; static BOOL sRenderAttachedParticles; static BOOL sRenderDeferred; + static BOOL sMemAllocationThrottled; static S32 sVisibleLightCount; - static F32 sMinRenderSize; + static F32 sMinRenderSize; //screen texture U32 mScreenWidth; diff --git a/indra/newview/skins/default/xui/en/menu_media_ctrl.xml b/indra/newview/skins/default/xui/en/menu_media_ctrl.xml index c39c26f25f..960da4bd7a 100644 --- a/indra/newview/skins/default/xui/en/menu_media_ctrl.xml +++ b/indra/newview/skins/default/xui/en/menu_media_ctrl.xml @@ -28,4 +28,16 @@ <menu_item_call.on_enable function="Edit.EnablePaste" /> </menu_item_call> + <menu_item_separator + layout="topleft" + name="debug_separator" + visible="false" /> + <menu_item_call + label="Open Web Inspector" + layout="topleft" + name="open_webinspector" + visible="false"> + <menu_item_call.on_click + function="Open.WebInspector" /> + </menu_item_call> </context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index b08e3abb71..36ebe73753 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -2133,6 +2133,16 @@ function="ToggleControl" parameter="DebugShowMemory" /> </menu_item_check> + <menu_item_check + label="Show Private Mem Info" + name="Show Private Mem Info"> + <menu_item_check.on_check + function="CheckControl" + parameter="DebugShowPrivateMem" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="DebugShowPrivateMem" /> + </menu_item_check> <menu_item_separator/> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c214c36586..f3a8d0a865 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6279,6 +6279,10 @@ Grant this request? [MESSAGE] <form name="form"> <button + index="-2" + name="Mute" + text="Block"/> + <button index="-1" name="Ignore" text="Ignore"/> @@ -6294,6 +6298,10 @@ Grant this request? [MESSAGE] <form name="form"> <button + index="-2" + name="Mute" + text="Block"/> + <button index="-1" name="Ignore" text="Ignore"/> @@ -7157,6 +7165,20 @@ Click and drag anywhere on the world to rotate your view <tag>funds</tag> </notification> + <notification + icon="alertmodal.tga" + name="LowMemory" + type="alertmodal"> + Your memory pool is low. Some functions of SL are disabled to avoid crash. Please close other applications. Restart SL if this persists. + </notification> + + <notification + icon="alertmodal.tga" + name="ForceQuitDueToLowMemory" + type="alertmodal"> + SL will quit in 30 seconds due to out of memory. + </notification> + <notification name="PopupAttempt" icon="Popup_Caution" diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index c8f8d07701..ec5853649e 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -47,13 +47,13 @@ mouse_opaque="false" name="chat_bar_layout_panel" user_resize="true" - width="310" > + width="250" > <panel name="chat_bar" filename="panel_nearby_chat_bar.xml" left="0" height="28" - width="308" + width="248" top="0" mouse_opaque="false" follows="left|right" @@ -341,7 +341,7 @@ Disabled for now. height="28" layout="topleft" min_height="28" - min_width="52" + min_width="62" mouse_opaque="false" name="mini_map_btn_panel" user_resize="false" diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml index 0bc1be666e..983f93cb03 100644 --- a/indra/newview/skins/default/xui/en/panel_login.xml +++ b/indra/newview/skins/default/xui/en/panel_login.xml @@ -117,16 +117,33 @@ label="Remember password" name="connect_btn" top="35" width="90" /> - <menu_button - left_pad="5" - top="35" - width="80" + <text + follows="left|bottom" + font="SansSerifSmall" + height="15" + left_pad="10" + name="mode_selection_text" + top="20" + width="130"> + Mode: + </text> + <combo_box + follows="left|bottom" height="23" - label="Mode ▲" - name="mode_menu" + max_chars="128" tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." - menu_filename="menu_mode_change.xml" - /> + top_pad="0" + name="mode_combo" + width="110"> + <combo_box.item + label="Basic" + name="Basic" + value="settings_minimal.xml" /> + <combo_box.item + label="Advanced" + name="Advanced" + value="" /> + </combo_box> <text follows="left|bottom" font="SansSerifSmall" diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index 8a7bd53054..9749b6fdd4 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -97,7 +97,7 @@ mouse_opaque="false" name="location_combo" top_delta="0" - width="266"> + width="226"> <combo_list mouse_wheel_opaque="true"/> <!-- *TODO: Delete. Let the location_input use the correct art sizes. @@ -137,7 +137,7 @@ name="search_combo_box" tool_tip="Search" top_delta="0" - width="200" > + width="244" > <combo_editor label="Search [SECOND_LIFE]" name="search_combo_editor"/> diff --git a/indra/newview/skins/default/xui/en/panel_region_terrain.xml b/indra/newview/skins/default/xui/en/panel_region_terrain.xml index bbb8b40594..5d060c0a0d 100644 --- a/indra/newview/skins/default/xui/en/panel_region_terrain.xml +++ b/indra/newview/skins/default/xui/en/panel_region_terrain.xml @@ -193,7 +193,7 @@ </text> <text follows="left|top" - height="20" + height="60" layout="topleft" left_delta="0" name="height_text_lbl11" diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index 23ad0e9528..c780cf2696 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -35,7 +35,7 @@ </panel.string> <panel height="18" - left="-315" + left="-355" width="95" top="1" follows="right|top" @@ -77,19 +77,28 @@ top="0" width="55" /> </panel> - <menu_button - follows="right|top" - image_color="0 0 0 0" - hover_glow_amount="0" + <combo_box + follows="right|top" + drop_down_button.pad_left="10" left_pad="5" top="0" - width="55" - height="18" - label="Mode ▼" + width="120" + height="20" + pad_left="5" + name="mode_combo" tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." - menu_filename="menu_mode_change.xml" - /> + > + <combo_box.item + label="Basic Mode" + name="Basic" + value="settings_minimal.xml" /> + <combo_box.item + label="Advanced Mode" + name="Advanced" + value="" /> + </combo_box> <text + left_pad="5" type="string" font="SansSerifSmall" text_readonly_color="TimeTextColor" @@ -98,10 +107,9 @@ height="16" top="5" layout="topleft" - left_pad="5" name="TimeText" tool_tip="Current time (Pacific)" - width="90"> + width="75"> 24:00 AM PST </text> <button diff --git a/indra/newview/skins/default/xui/en/widgets/combo_box.xml b/indra/newview/skins/default/xui/en/widgets/combo_box.xml index d1f68a9ef9..82d620d1e6 100644 --- a/indra/newview/skins/default/xui/en/widgets/combo_box.xml +++ b/indra/newview/skins/default/xui/en/widgets/combo_box.xml @@ -16,6 +16,9 @@ font="SansSerifSmall" scale_image="true" pad_right="24" + halign="left" + tab_stop="true" + follows="all" image_unselected="DropDown_Off" image_selected="DropDown_On" image_pressed="DropDown_Press" diff --git a/indra/newview/skins/minimal/xui/en/main_view.xml b/indra/newview/skins/minimal/xui/en/main_view.xml index ec2683880a..0ce6cbc984 100644 --- a/indra/newview/skins/minimal/xui/en/main_view.xml +++ b/indra/newview/skins/minimal/xui/en/main_view.xml @@ -187,9 +187,9 @@ name="status_bar_container" tab_stop="false" height="30" - left="-120" + left="-160" top="0" - width="120" + width="160" visible="false"/> <panel follows="top|bottom" height="500" diff --git a/indra/newview/skins/minimal/xui/en/panel_login.xml b/indra/newview/skins/minimal/xui/en/panel_login.xml index d89a0c6be1..40d2df78e1 100644 --- a/indra/newview/skins/minimal/xui/en/panel_login.xml +++ b/indra/newview/skins/minimal/xui/en/panel_login.xml @@ -118,16 +118,33 @@ label="Remember password" name="connect_btn" top="35" width="90" /> - <menu_button -left_pad="10" -top="35" -width="80" -height="23" -label="Mode ▲" -name="mode_menu" -tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." -menu_filename="menu_mode_change.xml" - /> + <text + follows="left|bottom" + font="SansSerifSmall" + height="15" + left_pad="10" + name="mode_selection_text" + top="20" + width="130"> + Mode: + </text> + <combo_box + follows="left|bottom" + height="23" + max_chars="128" + tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." + top_pad="0" + name="mode_combo" + width="110"> + <combo_box.item + label="Basic" + name="Basic" + value="settings_minimal.xml" /> + <combo_box.item + label="Advanced" + name="Advanced" + value="" /> + </combo_box> </layout_panel> <layout_panel tab_stop="false" diff --git a/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml b/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml index e50911b8d2..73a8564274 100644 --- a/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/minimal/xui/en/panel_navigation_bar.xml @@ -63,7 +63,7 @@ width="31" /> mouse_opaque="false" name="location_combo" top_delta="0" - width="390"> + width="325"> </location_input> <icon follows="right" height="20" diff --git a/indra/newview/skins/minimal/xui/en/panel_status_bar.xml b/indra/newview/skins/minimal/xui/en/panel_status_bar.xml index 42e6f30d48..fdd6b5d6ec 100644 --- a/indra/newview/skins/minimal/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/minimal/xui/en/panel_status_bar.xml @@ -12,7 +12,7 @@ name="status" top="19" tab_stop="false" - width="120"> + width="185"> <panel.string name="packet_loss_tooltip"> Packet Loss @@ -33,18 +33,27 @@ name="buycurrencylabel"> L$ [AMT] </panel.string> - <menu_button - follows="right|top" - image_color="0 0 0 0" - hover_glow_amount="0" - left="5" - top="7" - width="55" - height="18" - label="Mode ▼" - tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." - menu_filename="menu_mode_change.xml" - /> + <combo_box + follows="right|top" + left_pad="5" + drop_down_button.pad_left="10" + left="0" + top="5" + pad_left="5" + width="120" + height="23" + name="mode_combo" + tool_tip="Select your mode. Choose Basic for fast, easy exploration and chat. Choose Advanced to access more features." + > + <combo_box.item + label="Basic Mode" + name="Basic" + value="settings_minimal.xml" /> + <combo_box.item + label="Advanced Mode" + name="Advanced" + value="" /> + </combo_box> <button follows="right|top" height="16" @@ -53,7 +62,7 @@ image_pressed="Pause_Press" image_pressed_selected="Play_Press" is_toggle="true" - left="65" + left_pad="5" top="7" name="media_toggle_btn" tool_tip="Start/Stop All Media (Music, Video, Web pages)" diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp index acc6e814bc..102294959a 100644 --- a/indra/newview/tests/llworldmap_test.cpp +++ b/indra/newview/tests/llworldmap_test.cpp @@ -27,7 +27,6 @@ // Dependencies #include "linden_common.h" -#include "llapr.h" #include "llsingleton.h" #include "lltrans.h" #include "lluistring.h" |