Backed out 2 changesets (bug 1654957) for causing leaks.

CLOSED TREE

Backed out changeset 14761127f6bb (bug 1654957)
Backed out changeset 49a529a1cc20 (bug 1654957)
This commit is contained in:
Mihai Alexandru Michis 2020-08-04 19:31:06 +03:00
Родитель 697ca6ed56
Коммит 9fa46e7850
11 изменённых файлов: 28 добавлений и 50 удалений

Просмотреть файл

@ -1330,7 +1330,7 @@ void ContentChild::InitXPCOM(
nsCOMPtr<nsIURI> ucsURL = std::move(aXPCOMInit.userContentSheetURL());
GlobalStyleSheetCache::SetUserContentCSSURL(ucsURL);
GfxInfoBase::SetFeatureStatus(std::move(aXPCOMInit.gfxFeatureStatus()));
GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus());
DataStorage::SetCachedStorageEntries(aXPCOMInit.dataStorage());

Просмотреть файл

@ -2672,7 +2672,7 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
GfxInfoBase* gfxInfoRaw = static_cast<GfxInfoBase*>(gfxInfo.get());
xpcomInit.gfxFeatureStatus() = gfxInfoRaw->GetAllFeatures();
gfxInfoRaw->GetAllFeatures(xpcomInit);
}
#ifdef XP_WIN

Просмотреть файл

@ -289,6 +289,13 @@ struct GMPCapabilityData
GMPAPITags[] capabilities;
};
struct GfxInfoFeatureStatus
{
int32_t feature;
int32_t status;
nsCString failureId;
};
struct XPCOMInitData
{
bool isOffline;

Просмотреть файл

@ -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<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsTArray<GfxInfoFeatureStatus> features;
if (gfxInfo) {
auto* gfxInfoRaw = static_cast<widget::GfxInfoBase*>(gfxInfo.get());
features = gfxInfoRaw->GetAllFeatures();
}
SendInit(updates, devicePrefs, mappings, features);
SendInit(updates, devicePrefs, mappings);
gfxVars::AddReceiver(this);

Просмотреть файл

@ -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<PAPZInputBridgeParent> GPUParent::AllocPAPZInputBridgeParent(
mozilla::ipc::IPCResult GPUParent::RecvInit(
nsTArray<GfxVarUpdate>&& vars, const DevicePrefs& devicePrefs,
nsTArray<LayerTreeIdMapping>&& aMappings,
nsTArray<GfxInfoFeatureStatus>&& aFeatures) {
nsTArray<LayerTreeIdMapping>&& 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<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
Unused << gfxInfo;
#endif
// Make sure to do this *after* we update gfxVars above.

Просмотреть файл

@ -39,8 +39,7 @@ class GPUParent final : public PGPUParent {
mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
const DevicePrefs& devicePrefs,
nsTArray<LayerTreeIdMapping>&& mappings,
nsTArray<GfxInfoFeatureStatus>&& features);
nsTArray<LayerTreeIdMapping>&& mappings);
mozilla::ipc::IPCResult RecvInitCompositorManager(
Endpoint<PCompositorManagerParent>&& aEndpoint);
mozilla::ipc::IPCResult RecvInitVsyncBridge(

Просмотреть файл

@ -81,12 +81,5 @@ struct GfxVarUpdate
GfxVarValue value;
};
struct GfxInfoFeatureStatus
{
int32_t feature;
int32_t status;
nsCString failureId;
};
} // namespace gfx
} // namespace mozilla

Просмотреть файл

@ -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<PCompositorManagerParent> endpoint);
async InitVsyncBridge(Endpoint<PVsyncBridgeParent> endpoint);

Просмотреть файл

@ -41,7 +41,7 @@ using namespace mozilla;
using mozilla::MutexAutoLock;
nsTArray<GfxDriverInfo>* GfxInfoBase::sDriverInfo;
nsTArray<gfx::GfxInfoFeatureStatus>* GfxInfoBase::sFeatureStatus;
nsTArray<dom::GfxInfoFeatureStatus>* 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<gfx::GfxInfoFeatureStatus> GfxInfoBase::GetAllFeatures() {
void GfxInfoBase::GetAllFeatures(dom::XPCOMInitData& xpcomInit) {
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
if (!sFeatureStatus) {
sFeatureStatus = new nsTArray<gfx::GfxInfoFeatureStatus>();
sFeatureStatus = new nsTArray<dom::GfxInfoFeatureStatus>();
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<gfx::GfxInfoFeatureStatus> 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<gfx::GfxInfoFeatureStatus>&& aFS) {
void GfxInfoBase::SetFeatureStatus(
const nsTArray<dom::GfxInfoFeatureStatus>& aFS) {
MOZ_ASSERT(!sFeatureStatus);
sFeatureStatus = new nsTArray<gfx::GfxInfoFeatureStatus>(std::move(aFS));
sFeatureStatus = new nsTArray<dom::GfxInfoFeatureStatus>(aFS.Clone());
}
bool GfxInfoBase::DoesDesktopEnvironmentMatch(

Просмотреть файл

@ -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<mozilla::gfx::GfxInfoFeatureStatus> 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<GfxDriverInfo>* sDriverInfo;
static nsTArray<mozilla::gfx::GfxInfoFeatureStatus>* sFeatureStatus;
static nsTArray<mozilla::dom::GfxInfoFeatureStatus>* 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<mozilla::gfx::GfxInfoFeatureStatus>&& aFS);
const nsTArray<mozilla::dom::GfxInfoFeatureStatus>& aFS);
protected:
virtual ~GfxInfoBase();

Просмотреть файл

@ -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}',