diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 34 | ||||
| -rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 7 | ||||
| -rw-r--r-- | indra/llplugin/llpluginprocessparent.h | 2 | ||||
| -rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 5 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
| -rw-r--r-- | indra/newview/llmediactrl.cpp | 34 |
6 files changed, 93 insertions, 0 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 9a1f408b34..da5fe08b13 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -41,6 +41,8 @@ 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 ) { @@ -963,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) @@ -974,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); } diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 40f6295e55..1125d530f4 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -165,6 +165,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); }; @@ -434,6 +439,8 @@ protected: F64 mSleepTime; + U32 mCefRemoteDebuggingPort {0}; + bool mCanUndo; bool mCanRedo; bool mCanCut; 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/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index caf804f915..96fcc38979 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -116,6 +116,7 @@ private: std::string mRootCachePath; std::string mCefLogFile; bool mCefLogVerbose; + U32 mCefRemoteDebuggingPort; std::vector<std::string> mPickedFiles; VolumeCatcher mVolumeCatcher; F32 mCurVolume; @@ -157,6 +158,7 @@ MediaPluginBase(host_send_func, host_user_data) mCanSelectAll = false; mCefLogFile = ""; mCefLogVerbose = false; + mCefRemoteDebuggingPort = 0; mPickedFiles.clear(); mCurVolume = 0.0; @@ -709,6 +711,8 @@ void MediaPluginCEF::receiveMessage(const char* message_string) settings.webgl_enabled = true; settings.log_file = mCefLogFile; settings.log_verbose = mCefLogVerbose; + settings.enable_remote_debug = (mCefRemoteDebuggingPort != 0); + settings.remote_debugging_port = mCefRemoteDebuggingPort; settings.autoplay_without_gesture = true; std::vector<std::string> custom_schemes(1, "secondlife"); @@ -773,6 +777,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string) mCefLogFile = message_in.getValue("cef_log_file"); mCefLogVerbose = message_in.getValueBoolean("cef_verbose_log"); + mCefRemoteDebuggingPort = message_in.getValueU32("cef_remote_debugging_port"); } else if (message_name == "size_change") { diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 75258cfa79..d34a5b3eab 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16170,6 +16170,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>CEFRemoteDebuggingPort</key> + <map> + <key>Comment</key> + <string>Enable CEF remote debugging on the specified base port (1024 to 65535, 0 to disable). Each new SLPlugin gets base+N.</string> + <key>Persist</key> + <integer>0</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>0</integer> + </map> <key>360CaptureJPEGEncodeQuality</key> <map> <key>Comment</key> diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 679157dc1e..26422d7d47 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -1370,6 +1370,7 @@ public: private: void getMediaInfo(const LLSD& request); void getMediaText(const LLSD& request); + void getPluginsList(const LLSD& request); void replyError(const LLSD& request, const std::string& error); LLMediaCtrl* findMediaCtrl(const std::string& path); }; @@ -1388,6 +1389,12 @@ LLMediaCtrlListener::LLMediaCtrlListener(): "Returns the text content of the page or a portion of it.", &LLMediaCtrlListener::getMediaText, llsd::map("path", LLSD(), "reply", LLSD())); + + add("getPluginsList", + "Enumerate the active media plugin (SLPlugin) instances.\n" + "Reply contains [\"plugins\"] an array of { pid, url, mime_type, remote_debugging_port } entries.", + &LLMediaCtrlListener::getPluginsList, + llsd::map("reply", LLSD())); } LLMediaCtrl* LLMediaCtrlListener::findMediaCtrl(const std::string& path) @@ -1457,4 +1464,31 @@ void LLMediaCtrlListener::getMediaText(const LLSD& request) } } +void LLMediaCtrlListener::getPluginsList(const LLSD& request) +{ + Response reply(LLSD(), request); + + LLSD plugins; + + LLViewerMedia::impl_list& impls = LLViewerMedia::getInstance()->getPriorityList(); + for (LLViewerMedia::impl_list::iterator it = impls.begin(); it != impls.end(); ++it) + { + LLViewerMediaImpl* impl = *it; + if (!impl) + { + continue; + } + LLPluginClassMedia* plugin = impl->getMediaPlugin(); + + LLSD entry; + entry["url"] = impl->getCurrentMediaURL(); + entry["mime_type"] = impl->getMimeType(); + entry["pid"] = plugin ? plugin->getProcessID() : 0; + entry["remote_debugging_port"] = plugin ? (S32)plugin->getCefRemoteDebuggingPort() : 0; + + plugins.append(entry); + } + reply["plugins"] = plugins; +} + static LLMediaCtrlListener sMediaCtrlListener; |
