Bug 1178426. Add GfxInfo to ServicesList.h. r=nfroyd

This commit is contained in:
Jeff Muizelaar 2015-07-08 16:51:09 -04:00
parent ff561b6cba
commit 1f2e10f9ba
14 changed files with 27 additions and 16 deletions

View File

@ -13,6 +13,7 @@
#include "nsIGfxInfo.h"
#include "nsIPersistentProperties2.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Services.h"
using namespace mozilla;
using namespace mozilla::a11y;
@ -28,7 +29,7 @@ ApplicationAccessibleWrap::NativeAttributes()
nsCOMPtr<nsIPersistentProperties> attributes =
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
bool isD2DEnabled = false;
gfxInfo->GetD2DEnabled(&isD2DEnabled);

View File

@ -740,7 +740,7 @@ CreateOffscreen(GLContext* gl, const WebGLContextOptions& options,
bool
WebGLContext::CreateOffscreenGL(bool forceEnabled)
{
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
layers::ISurfaceAllocator* surfAllocator = nullptr;
#ifdef MOZ_WIDGET_GONK
@ -914,7 +914,7 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight)
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
bool failIfMajorPerformanceCaveat =
!gfxPrefs::WebGLDisableFailIfMajorPerformanceCaveat() &&
!HasAcceleratedLayers(gfxInfo);

View File

@ -4608,7 +4608,7 @@ ContentParent::RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
int32_t* aStatus,
bool* aSuccess)
{
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (!gfxInfo) {
*aSuccess = false;
return true;

View File

@ -6,6 +6,7 @@
#include "mozilla/Preferences.h"
#include "MediaResource.h"
#include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/Services.h"
#include "AndroidMediaPluginHost.h"
#include "nsXPCOMStrings.h"
#include "nsISeekableStream.h"
@ -111,7 +112,7 @@ static bool IsOmxSupported()
ScopedGfxFeatureReporter reporter("Stagefright", forceEnabled);
if (!forceEnabled) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_STAGEFRIGHT, &status))) {

View File

@ -10,6 +10,7 @@
#include "WMFAudioMFTManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Services.h"
#include "WMFMediaDataDecoder.h"
#include "nsIWindowsRegKey.h"
#include "nsComponentManagerUtils.h"
@ -96,7 +97,7 @@ WMFDecoderModule::ShouldUseDXVA(const VideoInfo& aConfig) const
static bool isAMD = false;
static bool initialized = false;
if (!initialized) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
nsAutoString vendor;
gfxInfo->GetAdapterVendorID(vendor);
isAMD = vendor.Equals(widget::GfxDriverInfo::GetDeviceVendor(widget::VendorAMD), nsCaseInsensitiveStringComparator()) ||

View File

@ -654,7 +654,7 @@ ID3D11RenderTargetView *SwapChain11::getRenderTarget()
void SwapChain11::releaseSync()
{
SafeRelease(mOffscreenRTView);
//SafeRelease(mOffscreenRTView);
}
ID3D11ShaderResourceView *SwapChain11::getRenderTargetShaderResource()

View File

@ -14,6 +14,7 @@
#include "nsXULAppAPI.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "mozilla/gfx/Logging.h"
namespace mozilla {
@ -150,7 +151,7 @@ DriverInitCrashDetection::RecoverFromDriverInitCrash()
bool
DriverInitCrashDetection::UpdateEnvironment()
{
mGfxInfo = do_GetService("@mozilla.org/gfx/info;1");
mGfxInfo = services::GetGfxInfo();
bool changed = false;
if (mGfxInfo) {

View File

@ -11,6 +11,7 @@
#include "mozilla/layers/ISurfaceAllocator.h" // for GfxMemoryImageReporter
#include "mozilla/Logging.h"
#include "mozilla/Services.h"
#include "prprf.h"
#include "gfxPlatform.h"
@ -469,7 +470,7 @@ gfxPlatform::Init()
* incase that code crashes. See bug #591561. */
nsCOMPtr<nsIGfxInfo> gfxInfo;
/* this currently will only succeed on Windows */
gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
gfxInfo = services::GetGfxInfo();
#if defined(XP_WIN)
gPlatform = new gfxWindowsPlatform;
@ -2134,7 +2135,7 @@ InitLayersAccelerationPrefs()
gfxPrefs::GetSingleton();
sPrefBrowserTabsRemoteAutostart = BrowserTabsRemoteAutostart();
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
int32_t status;
#ifdef XP_WIN
if (gfxPrefs::LayersAccelerationForceEnabled()) {

View File

@ -15,6 +15,7 @@
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/WindowsVersion.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
@ -470,7 +471,7 @@ gfxWindowsPlatform::UpdateRenderMode()
bool d2dForceEnabled = false;
bool d2dBlocked = false;
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT2D, &status))) {
@ -1777,7 +1778,7 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma
}
if (GetModuleHandleW(L"atidxx32.dll")) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
nsString vendorID, vendorID2;
gfxInfo->GetAdapterVendorID(vendorID);
@ -1889,7 +1890,7 @@ gfxWindowsPlatform::InitD3D11Devices()
allowWARP = true;
}
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_11_LAYERS, &status))) {

View File

@ -19,6 +19,7 @@
#include "mozilla/Likely.h"
#include "mozilla/Poison.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
#include "nsAppRunner.h"
@ -4649,7 +4650,7 @@ mozilla::BrowserTabsRemoteAutostart()
// Check for blocked drivers
if (!accelDisabled) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_OPENGL_LAYERS, &status)) &&

View File

@ -52,6 +52,7 @@
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/Services.h"
#include "mozilla/Snprintf.h"
#include "nsRefPtrHashtable.h"
#include "TouchEvents.h"
@ -859,7 +860,7 @@ nsBaseWidget::ComputeShouldAccelerate(bool aDefault)
// enough not to:
bool whitelisted = false;
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
// bug 655578: on X11 at least, we must always call GetData (even if we don't need that information)
// as that's what causes GfxInfo initialization which kills the zombie 'glxtest' process.

View File

@ -6863,7 +6863,7 @@ nsWindow::HasBogusPopupsDropShadowOnMultiMonitor() {
LayerManagerPrefs prefs;
GetLayerManagerPrefs(&prefs);
if (!prefs.mDisableAcceleration && !prefs.mPreferOpenGL) {
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo();
if (gfxInfo) {
int32_t status;
if (NS_SUCCEEDED(gfxInfo->GetFeatureStatus(nsIGfxInfo::FEATURE_DIRECT3D_9_LAYERS, &status))) {

View File

@ -38,6 +38,8 @@ MOZ_SERVICE(AsyncShutdown, nsIAsyncShutdownService,
"@mozilla.org/async-shutdown-service;1")
MOZ_SERVICE(UUIDGenerator, nsIUUIDGenerator,
"@mozilla.org/uuid-generator;1");
MOZ_SERVICE(GfxInfo, nsIGfxInfo,
"@mozilla.org/gfx/info;1");
#ifdef MOZ_USE_NAMESPACE
namespace mozilla {

View File

@ -28,6 +28,7 @@
#include "nsIServiceWorkerManager.h"
#include "nsIAsyncShutdown.h"
#include "nsIUUIDGenerator.h"
#include "nsIGfxInfo.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
using namespace mozilla;