diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 39b44dd8a3a2..aae46b9bd2e7 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -116,6 +116,7 @@ #include "mozilla/layers/IAPZCTreeManager.h" // for layers::ZoomToRectBehavior #include "mozilla/dom/Document.h" #include "mozilla/dom/Promise.h" +#include "mozilla/RDDProcessManager.h" #include "mozilla/ServoBindings.h" #include "mozilla/StyleSheetInlines.h" #include "mozilla/gfx/gfxVars.h" @@ -4380,6 +4381,18 @@ nsDOMWindowUtils::GetGpuProcessPid(int32_t* aPid) { return NS_OK; } +NS_IMETHODIMP +nsDOMWindowUtils::GetRddProcessPid(int32_t* aPid) { + RDDProcessManager* pm = RDDProcessManager::Get(); + if (pm) { + *aPid = pm->RDDProcessPid(); + } else { + *aPid = -1; + } + + return NS_OK; +} + struct StateTableEntry { const char* mStateString; ElementState mState; diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 7f87e544c37c..b4d065ff3197 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -2129,6 +2129,11 @@ interface nsIDOMWindowUtils : nsISupports { */ readonly attribute int32_t gpuProcessPid; + /** + * Returns the RDD process pid, or -1 if there is no RDD process. + */ + readonly attribute int32_t rddProcessPid; + /** * Returns usage data for a given storage object. * diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 05ecd3925bdf..fdab0349abdd 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -68,6 +68,7 @@ #include "mozilla/ProfilerLabels.h" #include "mozilla/ProfilerMarkers.h" #include "mozilla/RecursiveMutex.h" +#include "mozilla/RDDProcessManager.h" #include "mozilla/ScopeExit.h" #include "mozilla/ScriptPreloader.h" #include "mozilla/Components.h" @@ -2964,6 +2965,12 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) { gpm->AddListener(this); + if (StaticPrefs::media_rdd_process_enabled()) { + // Ensure the RDD process has been started. + RDDProcessManager* rdd = RDDProcessManager::Get(); + rdd->LaunchRDDProcess(); + } + nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { // This looks like a lot of work, but in a normal browser session we just diff --git a/toolkit/components/aboutmemory/tests/test_aboutmemory5.xhtml b/toolkit/components/aboutmemory/tests/test_aboutmemory5.xhtml index 7b6317976760..445aadc27bb8 100644 --- a/toolkit/components/aboutmemory/tests/test_aboutmemory5.xhtml +++ b/toolkit/components/aboutmemory/tests/test_aboutmemory5.xhtml @@ -132,7 +132,12 @@ socketProcessRunning = 1; } - let m2 = (vsizes.length == (4 + socketProcessRunning + ChromeUtils.aliveUtilityProcesses) && + let rddProcessRunning = 0; + if (window.windowUtils.rddProcessPid != -1) { + rddProcessRunning = 1; + } + + let m2 = (vsizes.length == (4 + socketProcessRunning + rddProcessRunning + ChromeUtils.aliveUtilityProcesses) && endOfBrowsers.length == 3); ok(m2, "three content processes present in loaded data"); good = good && !!m2; diff --git a/toolkit/components/aboutmemory/tests/test_aboutmemory7.xhtml b/toolkit/components/aboutmemory/tests/test_aboutmemory7.xhtml index a31eb6e6b4c3..12e9538106c6 100644 --- a/toolkit/components/aboutmemory/tests/test_aboutmemory7.xhtml +++ b/toolkit/components/aboutmemory/tests/test_aboutmemory7.xhtml @@ -105,7 +105,7 @@ SimpleTest.waitForClipboard( function(aActual) { mostRecentActual = aActual; - let rslt = aActual.trim() === aExpected.trim(); + let rslt = aActual.trim().startsWith(aExpected.trim()); if (!rslt) { // Try copying again. synthesizeKey("A", {accelKey: true}); diff --git a/toolkit/components/aboutmemory/tests/test_memoryReporters.xhtml b/toolkit/components/aboutmemory/tests/test_memoryReporters.xhtml index 47c9c139a6b2..3bcc57539836 100644 --- a/toolkit/components/aboutmemory/tests/test_memoryReporters.xhtml +++ b/toolkit/components/aboutmemory/tests/test_memoryReporters.xhtml @@ -237,7 +237,11 @@ if (SpecialPowers.Services.io.socketProcessLaunched) { socketProcessRunning = 1; } - is(aAmounts.length, 1 + socketProcessRunning, + let rddProcessRunning = 0; + if (window.windowUtils.rddProcessPid != -1) { + rddProcessRunning = 1; + } + is(aAmounts.length, 1 + socketProcessRunning + rddProcessRunning, aName + " has " + aAmounts.length + " report"); let n = aAmounts[0]; if (!aCanBeUnreasonable) { diff --git a/toolkit/components/aboutmemory/tests/test_memoryReporters2.xhtml b/toolkit/components/aboutmemory/tests/test_memoryReporters2.xhtml index 8dc756710958..d22ebc1a381a 100644 --- a/toolkit/components/aboutmemory/tests/test_memoryReporters2.xhtml +++ b/toolkit/components/aboutmemory/tests/test_memoryReporters2.xhtml @@ -21,8 +21,12 @@ if (SpecialPowers.Services.io.socketProcessLaunched) { socketProcessRunning = 1; } + let rddProcessRunning = 0; + if (window.windowUtils.rddProcessPid != -1) { + rddProcessRunning = 1; + } let numToOpen = 3; - const expectedNumRemotes = numToOpen + socketProcessRunning; + const expectedNumRemotes = numToOpen + socketProcessRunning + rddProcessRunning; let numReady = 0; // Create some remote processes, and set up message-passing so that @@ -96,6 +100,7 @@ } else { ok(processes[i].startsWith("Browser (") || processes[i].startsWith("Web Content (") || (processes[i].startsWith("Socket (") && socketProcessRunning) + || (processes[i].startsWith("RDD (") && rddProcessRunning) || processes[i].startsWith("web (") || processes[i].startsWith("Utility ("), "correct non-empty process name prefix: " + processes[i]); numNonEmptyProcesses++;