diff options
| author | Erik Kundiman <erik@megapahit.org> | 2026-09-01 18:35:23 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2026-09-04 21:58:53 +0800 |
| commit | 00bb3bb6f07660bd914d29a1389342bb3060d254 (patch) | |
| tree | 431f574922494d2201718f13085f17bc6bd7fb42 /indra/llplugin | |
| parent | a8636720129952c10cf49ab80da21bf8b340b96c (diff) | |
| parent | 4ef9f8f14b35ed388c294d53767a0dca0e890924 (diff) | |
Merge remote-tracking branch 'secondlife/release/26.4' into 26.4
Diffstat (limited to 'indra/llplugin')
| -rw-r--r-- | indra/llplugin/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 49 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 7 | ||||
| -rw-r--r-- | indra/llplugin/llpluginmessagepipe.cpp | 3 | ||||
| -rw-r--r-- | indra/llplugin/llpluginprocessparent.cpp | 11 | ||||
| -rw-r--r-- | indra/llplugin/llpluginprocessparent.h | 2 | ||||
| -rw-r--r-- | indra/llplugin/slplugin/CMakeLists.txt | 10 |
7 files changed, 83 insertions, 4 deletions
diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt index 0525e3d9ea..d56bbc4f96 100644 --- a/indra/llplugin/CMakeLists.txt +++ b/indra/llplugin/CMakeLists.txt @@ -36,6 +36,11 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES}) add_library (llplugin ${llplugin_SOURCE_FILES}) target_include_directories( llplugin INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries( llplugin llcommon llmath llmessage llxml ) + +if (USE_PRECOMPILED_HEADERS) + target_precompile_headers(llplugin REUSE_FROM llprecompiled) +endif () + add_subdirectory(slplugin) include(LibraryInstall) diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 6ab378f30f..32ecf7bcd1 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -33,12 +33,16 @@ #include "llpluginmessageclasses.h" #include "llcontrol.h" +#include <cmath> + extern LLControlGroup gSavedSettings; -#if LL_DARWIN +#if LL_DARWIN || LL_LINUX extern bool gHiDPISupport; #endif static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256; +static const U32 MIN_DEBUG_PORT = 1024; +static const U32 MAX_DEBUG_PORT = 65535; static int nextPowerOf2( int value ) { @@ -90,6 +94,7 @@ bool LLPluginClassMedia::init(const std::string &launcher_filename, const std::s void LLPluginClassMedia::reset() { + LL_PROFILE_ZONE_SCOPED; if(mPlugin) { mPlugin->requestShutdown(); @@ -373,7 +378,7 @@ void LLPluginClassMedia::setSizeInternal(void) mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight); } -#if LL_DARWIN +#if LL_DARWIN || LL_LINUX if (!gHiDPISupport) #endif { @@ -960,6 +965,34 @@ void LLPluginClassMedia::showPageSource() sendMessage(message); } + +static U32 assignCefDebuggingPort() +{ + U32 base_port = gSavedSettings.getU32("CEFRemoteDebuggingPort"); + if (base_port == 0) + { + return 0; + } + base_port = llclamp<U32>(base_port, MIN_DEBUG_PORT, MAX_DEBUG_PORT); + + static U32 last_base_port = 0; + static U32 offset = 0; + if (base_port != last_base_port) + { + last_base_port = base_port; + offset = 0; + } + + U32 new_port = base_port + offset; + if (new_port > MAX_DEBUG_PORT) + { + return 0; + } + + ++offset; + return new_port; +} + void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache, const std::string &username, const std::string &user_data_path_cef_log) @@ -971,6 +1004,10 @@ void LLPluginClassMedia::setUserDataPath(const std::string &user_data_path_cache bool cef_verbose_log = gSavedSettings.getBOOL("CefVerboseLog"); message.setValueBoolean("cef_verbose_log", cef_verbose_log); + + U32 cef_remote_debugging_port = assignCefDebuggingPort(); + message.setValueU32("cef_remote_debugging_port", cef_remote_debugging_port); + mCefRemoteDebuggingPort = cef_remote_debugging_port; sendMessage(message); } @@ -1633,7 +1670,13 @@ void LLPluginClassMedia::setLoop(bool loop) void LLPluginClassMedia::setVolume(float volume) { - if(volume != mRequestedVolume) + // VLC's volume is integer, 0 to 100 range. When converted from float, + // changes below 0.01 won't be noticed by VLC. + // CEF's audio range is DWORD, 0 to 65535. But changes so small are + // inaudible and don't warrant the overhead, so use a bigger epsilon + // to avoid extra messages and locking. + constexpr float VOLUME_EPSILON = 0.002f; + if (std::abs(volume - mRequestedVolume) > VOLUME_EPSILON) { mRequestedVolume = volume; diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 944108aa10..19a0f1c208 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -169,6 +169,11 @@ public: std::string getPluginVersion() { return mPlugin?mPlugin->getPluginVersion():std::string(""); }; + int getProcessID() { return mPlugin ? (int)mPlugin->getProcessID() : 0; }; + + // 0 means remote debugging is disabled for this plugin instance. + U32 getCefRemoteDebuggingPort() const { return mCefRemoteDebuggingPort; }; + bool getDisableTimeout() { return mPlugin?mPlugin->getDisableTimeout():false; }; void setDisableTimeout(bool disable) { if(mPlugin) mPlugin->setDisableTimeout(disable); }; @@ -440,6 +445,8 @@ protected: F64 mSleepTime; + U32 mCefRemoteDebuggingPort {0}; + bool mCanUndo; bool mCanRedo; bool mCanCut; diff --git a/indra/llplugin/llpluginmessagepipe.cpp b/indra/llplugin/llpluginmessagepipe.cpp index 085afc0944..1e58e6c49b 100644 --- a/indra/llplugin/llpluginmessagepipe.cpp +++ b/indra/llplugin/llpluginmessagepipe.cpp @@ -121,8 +121,9 @@ bool LLPluginMessagePipe::addMessage(const std::string &message) mOutputStartIndex = 0; } + mOutput.reserve(mOutput.size() + message.size() + 1); mOutput += message; - mOutput += MESSAGE_DELIMITER; // message separator + mOutput.push_back(MESSAGE_DELIMITER); // message separator return true; } diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 3deee2fb3e..f1fd69df2b 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -511,6 +511,16 @@ void LLPluginProcessParent::idle(void) else if (!mProcess && !mProcessCreationRequested) { mProcessCreationRequested = true; +#if LL_DARWIN + // On darwin process should be created from main thread, otherwise it can + // cause a fork-lock deadlock. Relevant to both, boost and apr. + // Alternatively can remake process creation to use posix_spawn + if (!(mProcess = LLProcess::create(mProcessParams))) + { + mProcessCreationRequested = false; + errorState(); + } +#else LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop"); // *NOTE: main_queue->postTo casts this refcounted smart pointer to a weak // pointer @@ -561,6 +571,7 @@ void LLPluginProcessParent::idle(void) errorState(); } } +#endif } if (mProcess) diff --git a/indra/llplugin/llpluginprocessparent.h b/indra/llplugin/llpluginprocessparent.h index ea604ca8d7..3cfd4211d7 100644 --- a/indra/llplugin/llpluginprocessparent.h +++ b/indra/llplugin/llpluginprocessparent.h @@ -119,6 +119,8 @@ public: bool getDisableTimeout() { return mDisableTimeout; }; void setDisableTimeout(bool disable) { mDisableTimeout = disable; }; + LLProcess::id getProcessID() const { return mProcess ? mProcess->getProcessID() : 0; } + void setLaunchTimeout(F32 timeout) { mPluginLaunchTimeout = timeout; }; void setLockupTimeout(F32 timeout) { mPluginLockupTimeout = timeout; }; diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 80356b6b51..68b009db0f 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -18,6 +18,12 @@ if (DARWIN) list(APPEND SLPlugin_HEADER_FILES slplugin-objc.h ) + + set_source_files_properties( + slplugin-objc.mm + PROPERTIES + SKIP_PRECOMPILE_HEADERS TRUE + ) endif (DARWIN) if (SLPlugin_HEADER_FILES) @@ -37,6 +43,10 @@ target_link_libraries(SLPlugin ll::pluginlibraries ) +if (USE_PRECOMPILED_HEADERS) + target_precompile_headers(SLPlugin REUSE_FROM llprecompiled) +endif () + if (WINDOWS) set_target_properties(SLPlugin PROPERTIES |
