From 9fa46e78504867ef96fe9036059d5feed0d724a0 Mon Sep 17 00:00:00 2001 From: Mihai Alexandru Michis Date: Tue, 4 Aug 2020 19:31:06 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1654957) for causing leaks. CLOSED TREE Backed out changeset 14761127f6bb (bug 1654957) Backed out changeset 49a529a1cc20 (bug 1654957) --- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 2 +- dom/ipc/PContent.ipdl | 7 +++++++ gfx/ipc/GPUChild.cpp | 11 +---------- gfx/ipc/GPUParent.cpp | 10 +--------- gfx/ipc/GPUParent.h | 3 +-- gfx/ipc/GraphicsMessages.ipdlh | 7 ------- gfx/ipc/PGPU.ipdl | 3 +-- widget/GfxInfoBase.cpp | 22 ++++++++++------------ widget/GfxInfoBase.h | 8 ++++---- widget/gtk/components.conf | 3 +-- 11 files changed, 28 insertions(+), 50 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 88805b88c607..4e87ce4b67a0 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1330,7 +1330,7 @@ void ContentChild::InitXPCOM( nsCOMPtr ucsURL = std::move(aXPCOMInit.userContentSheetURL()); GlobalStyleSheetCache::SetUserContentCSSURL(ucsURL); - GfxInfoBase::SetFeatureStatus(std::move(aXPCOMInit.gfxFeatureStatus())); + GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus()); DataStorage::SetCachedStorageEntries(aXPCOMInit.dataStorage()); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 9073a7d461d7..afac9864801e 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2672,7 +2672,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) { nsCOMPtr gfxInfo = services::GetGfxInfo(); if (gfxInfo) { GfxInfoBase* gfxInfoRaw = static_cast(gfxInfo.get()); - xpcomInit.gfxFeatureStatus() = gfxInfoRaw->GetAllFeatures(); + gfxInfoRaw->GetAllFeatures(xpcomInit); } #ifdef XP_WIN diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 36678a6d77dc..ff269007d8f3 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -289,6 +289,13 @@ struct GMPCapabilityData GMPAPITags[] capabilities; }; +struct GfxInfoFeatureStatus +{ + int32_t feature; + int32_t status; + nsCString failureId; +}; + struct XPCOMInitData { bool isOffline; diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index be307cf730cf..3d786b714043 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "GPUChild.h" #include "gfxConfig.h" -#include "GfxInfoBase.h" #include "gfxPlatform.h" #include "GPUProcessHost.h" #include "GPUProcessManager.h" @@ -23,7 +22,6 @@ #include "mozilla/layers/LayerTreeOwnerTracker.h" #include "mozilla/Unused.h" #include "mozilla/HangDetails.h" -#include "nsIGfxInfo.h" #include "nsIObserverService.h" #ifdef MOZ_GECKO_PROFILER @@ -61,14 +59,7 @@ void GPUChild::Init() { mappings.AppendElement(LayerTreeIdMapping(aLayersId, aProcessId)); }); - nsCOMPtr gfxInfo = services::GetGfxInfo(); - nsTArray features; - if (gfxInfo) { - auto* gfxInfoRaw = static_cast(gfxInfo.get()); - features = gfxInfoRaw->GetAllFeatures(); - } - - SendInit(updates, devicePrefs, mappings, features); + SendInit(updates, devicePrefs, mappings); gfxVars::AddReceiver(this); diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index ed6e192b8226..c38b7b520112 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -10,7 +10,6 @@ #include "GPUParent.h" #include "gfxConfig.h" #include "gfxCrashReporterUtils.h" -#include "GfxInfoBase.h" #include "gfxPlatform.h" #include "GLContextProvider.h" #include "GPUProcessHost.h" @@ -175,8 +174,7 @@ already_AddRefed GPUParent::AllocPAPZInputBridgeParent( mozilla::ipc::IPCResult GPUParent::RecvInit( nsTArray&& vars, const DevicePrefs& devicePrefs, - nsTArray&& aMappings, - nsTArray&& aFeatures) { + nsTArray&& aMappings) { for (const auto& var : vars) { gfxVars::ApplyUpdate(var); } @@ -204,8 +202,6 @@ mozilla::ipc::IPCResult GPUParent::RecvInit( LayerTreeOwnerTracker::Get()->Map(map.layersId(), map.ownerId()); } - widget::GfxInfoBase::SetFeatureStatus(std::move(aFeatures)); - // We bypass gfxPlatform::Init, so we must initialize any relevant libraries // here that would normally be initialized there. SkGraphics::Init(); @@ -264,10 +260,6 @@ mozilla::ipc::IPCResult GPUParent::RecvInit( SkInitCairoFT(true); } - - // Ensure that GfxInfo::Init is called on the main thread. - nsCOMPtr gfxInfo = services::GetGfxInfo(); - Unused << gfxInfo; #endif // Make sure to do this *after* we update gfxVars above. diff --git a/gfx/ipc/GPUParent.h b/gfx/ipc/GPUParent.h index 2b8ef5771e67..f63840eb76c6 100644 --- a/gfx/ipc/GPUParent.h +++ b/gfx/ipc/GPUParent.h @@ -39,8 +39,7 @@ class GPUParent final : public PGPUParent { mozilla::ipc::IPCResult RecvInit(nsTArray&& vars, const DevicePrefs& devicePrefs, - nsTArray&& mappings, - nsTArray&& features); + nsTArray&& mappings); mozilla::ipc::IPCResult RecvInitCompositorManager( Endpoint&& aEndpoint); mozilla::ipc::IPCResult RecvInitVsyncBridge( diff --git a/gfx/ipc/GraphicsMessages.ipdlh b/gfx/ipc/GraphicsMessages.ipdlh index 989b00151835..78ccca9b5719 100644 --- a/gfx/ipc/GraphicsMessages.ipdlh +++ b/gfx/ipc/GraphicsMessages.ipdlh @@ -81,12 +81,5 @@ struct GfxVarUpdate GfxVarValue value; }; -struct GfxInfoFeatureStatus -{ - int32_t feature; - int32_t status; - nsCString failureId; -}; - } // namespace gfx } // namespace mozilla diff --git a/gfx/ipc/PGPU.ipdl b/gfx/ipc/PGPU.ipdl index 02eae560c801..116d2d1e2f9f 100644 --- a/gfx/ipc/PGPU.ipdl +++ b/gfx/ipc/PGPU.ipdl @@ -57,8 +57,7 @@ parent: // Sent by the UI process to initiate core settings. async Init(GfxVarUpdate[] vars, DevicePrefs devicePrefs, - LayerTreeIdMapping[] mapping, - GfxInfoFeatureStatus[] features); + LayerTreeIdMapping[] mapping); async InitCompositorManager(Endpoint endpoint); async InitVsyncBridge(Endpoint endpoint); diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp index c36315b91be4..383c71ef182d 100644 --- a/widget/GfxInfoBase.cpp +++ b/widget/GfxInfoBase.cpp @@ -41,7 +41,7 @@ using namespace mozilla; using mozilla::MutexAutoLock; nsTArray* GfxInfoBase::sDriverInfo; -nsTArray* GfxInfoBase::sFeatureStatus; +nsTArray* GfxInfoBase::sFeatureStatus; bool GfxInfoBase::sDriverInfoObserverInitialized; bool GfxInfoBase::sShutdownOccurred; @@ -686,7 +686,7 @@ GfxInfoBase::GetFeatureStatus(int32_t aFeature, nsACString& aFailureId, return NS_OK; } - if (XRE_IsContentProcess() || XRE_IsGPUProcess()) { + if (XRE_IsContentProcess()) { // Use the cached data received from the parent process. MOZ_ASSERT(sFeatureStatus); bool success = false; @@ -708,28 +708,25 @@ GfxInfoBase::GetFeatureStatus(int32_t aFeature, nsACString& aFailureId, return rv; } -nsTArray GfxInfoBase::GetAllFeatures() { +void GfxInfoBase::GetAllFeatures(dom::XPCOMInitData& xpcomInit) { MOZ_RELEASE_ASSERT(XRE_IsParentProcess()); if (!sFeatureStatus) { - sFeatureStatus = new nsTArray(); + sFeatureStatus = new nsTArray(); for (int32_t i = 1; i <= nsIGfxInfo::FEATURE_MAX_VALUE; ++i) { int32_t status = 0; nsAutoCString failureId; GetFeatureStatus(i, failureId, &status); - gfx::GfxInfoFeatureStatus gfxFeatureStatus; + dom::GfxInfoFeatureStatus gfxFeatureStatus; gfxFeatureStatus.feature() = i; gfxFeatureStatus.status() = status; gfxFeatureStatus.failureId() = failureId; sFeatureStatus->AppendElement(gfxFeatureStatus); } } - - nsTArray features; for (const auto& status : *sFeatureStatus) { - gfx::GfxInfoFeatureStatus copy = status; - features.AppendElement(copy); + dom::GfxInfoFeatureStatus copy = status; + xpcomInit.gfxFeatureStatus().AppendElement(copy); } - return features; } inline bool MatchingAllowStatus(int32_t aStatus) { @@ -1091,9 +1088,10 @@ int32_t GfxInfoBase::FindBlocklistedDeviceInList( return status; } -void GfxInfoBase::SetFeatureStatus(nsTArray&& aFS) { +void GfxInfoBase::SetFeatureStatus( + const nsTArray& aFS) { MOZ_ASSERT(!sFeatureStatus); - sFeatureStatus = new nsTArray(std::move(aFS)); + sFeatureStatus = new nsTArray(aFS.Clone()); } bool GfxInfoBase::DoesDesktopEnvironmentMatch( diff --git a/widget/GfxInfoBase.h b/widget/GfxInfoBase.h index 9f4e1887bb6f..98b0da0218fc 100644 --- a/widget/GfxInfoBase.h +++ b/widget/GfxInfoBase.h @@ -16,7 +16,7 @@ #include "mozilla/Attributes.h" #include "mozilla/Maybe.h" #include "mozilla/Mutex.h" -#include "mozilla/gfx/GraphicsMessages.h" +#include "mozilla/dom/PContentParent.h" #include "nsCOMPtr.h" #include "nsIGfxInfo.h" #include "nsIGfxInfoDebug.h" @@ -76,7 +76,7 @@ class GfxInfoBase : public nsIGfxInfo, NS_IMETHOD GetTargetFrameRate(uint32_t* aTargetFrameRate) override; // Non-XPCOM method to get IPC data: - nsTArray GetAllFeatures(); + void GetAllFeatures(dom::XPCOMInitData& xpcomInit); // Initialization function. If you override this, you must call this class's // version of Init first. @@ -94,7 +94,7 @@ class GfxInfoBase : public nsIGfxInfo, static void RemoveCollector(GfxInfoCollectorBase* collector); static nsTArray* sDriverInfo; - static nsTArray* sFeatureStatus; + static nsTArray* sFeatureStatus; static bool sDriverInfoObserverInitialized; static bool sShutdownOccurred; @@ -111,7 +111,7 @@ class GfxInfoBase : public nsIGfxInfo, virtual nsresult FindMonitors(JSContext* cx, JS::HandleObject array); static void SetFeatureStatus( - nsTArray&& aFS); + const nsTArray& aFS); protected: virtual ~GfxInfoBase(); diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf index 6659b42e965f..2b9e4e35a659 100644 --- a/widget/gtk/components.conf +++ b/widget/gtk/components.conf @@ -26,7 +26,7 @@ Classes = [ 'type': 'mozilla::widget::ScreenManager', 'headers': ['mozilla/StaticPtr.h', 'mozilla/widget/ScreenManager.h'], 'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton', - 'processes': ProcessSelector.ALLOW_IN_GPU_AND_MAIN_PROCESS, + 'processes': ProcessSelector.MAIN_PROCESS_ONLY, }, { 'cid': '{a9339876-0027-430f-b953-84c9c11c2da3}', @@ -116,7 +116,6 @@ if defined('MOZ_X11'): 'type': 'mozilla::widget::GfxInfo', 'headers': ['/widget/GfxInfoX11.h'], 'init_method': 'Init', - 'processes': ProcessSelector.ALLOW_IN_GPU_PROCESS, }, { 'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}',