forked from mirrors/gecko-dev
Bug 1875430 part 3: Convert 'static UniquePtr' global vars to use StaticAutoPtr, in gfx. r=gfx-reviewers,jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D199169
This commit is contained in:
parent
570fa09edf
commit
6b6989bd75
3 changed files with 14 additions and 7 deletions
|
|
@ -3,8 +3,9 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "gfxConfig.h"
|
#include "gfxConfig.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "mozilla/gfx/GPUParent.h"
|
#include "mozilla/gfx/GPUParent.h"
|
||||||
#include "mozilla/gfx/GraphicsMessages.h"
|
#include "mozilla/gfx/GraphicsMessages.h"
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
static UniquePtr<gfxConfig> sConfig;
|
static StaticAutoPtr<gfxConfig> sConfig;
|
||||||
|
|
||||||
/* static */ FeatureState& gfxConfig::GetFeature(Feature aFeature) {
|
/* static */ FeatureState& gfxConfig::GetFeature(Feature aFeature) {
|
||||||
return sConfig->GetState(aFeature);
|
return sConfig->GetState(aFeature);
|
||||||
|
|
@ -277,7 +278,7 @@ void gfxConfig::ImportChange(Feature aFeature,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void gfxConfig::Init() { sConfig = mozilla::MakeUnique<gfxConfig>(); }
|
void gfxConfig::Init() { sConfig = new gfxConfig(); }
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void gfxConfig::Shutdown() { sConfig = nullptr; }
|
void gfxConfig::Shutdown() { sConfig = nullptr; }
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "mozilla/gfx/GPUParent.h"
|
#include "mozilla/gfx/GPUParent.h"
|
||||||
#include "mozilla/gfx/Matrix.h"
|
#include "mozilla/gfx/Matrix.h"
|
||||||
#include "mozilla/StaticPrefs_gfx.h"
|
#include "mozilla/StaticPrefs_gfx.h"
|
||||||
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/webrender/RenderD3D11TextureHost.h"
|
#include "mozilla/webrender/RenderD3D11TextureHost.h"
|
||||||
#include "mozilla/webrender/RenderDcompSurfaceTextureHost.h"
|
#include "mozilla/webrender/RenderDcompSurfaceTextureHost.h"
|
||||||
#include "mozilla/webrender/RenderTextureHost.h"
|
#include "mozilla/webrender/RenderTextureHost.h"
|
||||||
|
|
@ -53,7 +54,7 @@ extern LazyLogModule gRenderThreadLog;
|
||||||
MOZ_LOG(gDcompSurface, LogLevel::Debug, \
|
MOZ_LOG(gDcompSurface, LogLevel::Debug, \
|
||||||
("DCSurfaceHandle=%p, " msg, this, ##__VA_ARGS__))
|
("DCSurfaceHandle=%p, " msg, this, ##__VA_ARGS__))
|
||||||
|
|
||||||
UniquePtr<GpuOverlayInfo> DCLayerTree::sGpuOverlayInfo;
|
StaticAutoPtr<GpuOverlayInfo> DCLayerTree::sGpuOverlayInfo;
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
UniquePtr<DCLayerTree> DCLayerTree::Create(gl::GLContext* aGL,
|
UniquePtr<DCLayerTree> DCLayerTree::Create(gl::GLContext* aGL,
|
||||||
|
|
@ -156,7 +157,7 @@ bool DCLayerTree::Initialize(HWND aHwnd, nsACString& aError) {
|
||||||
}
|
}
|
||||||
if (!sGpuOverlayInfo) {
|
if (!sGpuOverlayInfo) {
|
||||||
// Set default if sGpuOverlayInfo was not set.
|
// Set default if sGpuOverlayInfo was not set.
|
||||||
sGpuOverlayInfo = MakeUnique<GpuOverlayInfo>();
|
sGpuOverlayInfo = new GpuOverlayInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize SwapChainInfo
|
// Initialize SwapChainInfo
|
||||||
|
|
@ -290,7 +291,11 @@ bool DCLayerTree::InitializeVideoOverlaySupport() {
|
||||||
|
|
||||||
info->mSupportsOverlays = info->mSupportsHardwareOverlays;
|
info->mSupportsOverlays = info->mSupportsHardwareOverlays;
|
||||||
|
|
||||||
sGpuOverlayInfo = std::move(info);
|
// Note: "UniquePtr::release" here is saying "release your ownership stake
|
||||||
|
// on your pointer, so that our StaticAutoPtr can take over ownership".
|
||||||
|
// (StaticAutoPtr doesn't have a move constructor that could directly steal
|
||||||
|
// the contents of a UniquePtr via std::move().)
|
||||||
|
sGpuOverlayInfo = info.release();
|
||||||
|
|
||||||
if (auto* gpuParent = gfx::GPUParent::GetSingleton()) {
|
if (auto* gpuParent = gfx::GPUParent::GetSingleton()) {
|
||||||
gpuParent->NotifyOverlayInfo(GetOverlayInfo());
|
gpuParent->NotifyOverlayInfo(GetOverlayInfo());
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
#include "mozilla/layers/OverlayInfo.h"
|
#include "mozilla/layers/OverlayInfo.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/RefPtr.h"
|
#include "mozilla/RefPtr.h"
|
||||||
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
#include "mozilla/webrender/WebRenderTypes.h"
|
#include "mozilla/webrender/WebRenderTypes.h"
|
||||||
|
|
||||||
|
|
@ -259,7 +260,7 @@ class DCLayerTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static UniquePtr<GpuOverlayInfo> sGpuOverlayInfo;
|
static StaticAutoPtr<GpuOverlayInfo> sGpuOverlayInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue