Bug 711656 - report force-enabled features in crash reports - r=jrmuizel

Force-enabled features will be reported with a '!' instead of the usual '?' in AppNotes in crash reports.
This commit is contained in:
Benoit Jacob 2012-02-27 16:33:19 -05:00
parent f236dbc153
commit 48c5b9a871
13 changed files with 27 additions and 24 deletions

View File

@ -362,8 +362,6 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
/*** end of early success return cases ***/
ScopedGfxFeatureReporter reporter("WebGL");
// At this point we know that the old context is not going to survive, even though we still don't
// know if creating the new context will succeed.
DestroyResourcesAndContext();
@ -386,6 +384,8 @@ WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
bool verbose =
Preferences::GetBool("webgl.verbose", false);
ScopedGfxFeatureReporter reporter("WebGL", forceEnabled);
if (disabled)
return NS_ERROR_FAILURE;

View File

@ -125,9 +125,9 @@ LayerManagerD3D10::~LayerManagerD3D10()
}
bool
LayerManagerD3D10::Initialize()
LayerManagerD3D10::Initialize(bool force)
{
ScopedGfxFeatureReporter reporter("D3D10 Layers");
ScopedGfxFeatureReporter reporter("D3D10 Layers", force);
HRESULT hr;

View File

@ -100,7 +100,7 @@ public:
*
* \return True is initialization was succesful, false when it was not.
*/
bool Initialize();
bool Initialize(bool force = false);
/*
* LayerManager implementation.

View File

@ -70,9 +70,9 @@ LayerManagerD3D9::~LayerManagerD3D9()
}
bool
LayerManagerD3D9::Initialize()
LayerManagerD3D9::Initialize(bool force)
{
ScopedGfxFeatureReporter reporter("D3D9 Layers");
ScopedGfxFeatureReporter reporter("D3D9 Layers", force);
/* XXX: this preference and blacklist code should move out of the layer manager */
bool forceAccelerate =

View File

@ -103,7 +103,7 @@ public:
*
* \return True is initialization was succesful, false when it was not.
*/
bool Initialize();
bool Initialize(bool force = false);
/*
* Sets the clipping region for this layer manager. This is important on

View File

@ -171,9 +171,9 @@ LayerManagerOGL::CreateContext()
}
bool
LayerManagerOGL::Initialize(nsRefPtr<GLContext> aContext)
LayerManagerOGL::Initialize(nsRefPtr<GLContext> aContext, bool force)
{
ScopedGfxFeatureReporter reporter("GL Layers");
ScopedGfxFeatureReporter reporter("GL Layers", force);
// Do not allow double intiailization
NS_ABORT_IF_FALSE(mGLContext == nsnull, "Don't reiniailize layer managers");

View File

@ -106,11 +106,11 @@ public:
*
* \return True is initialization was succesful, false when it was not.
*/
bool Initialize() {
return Initialize(CreateContext());
bool Initialize(bool force = false) {
return Initialize(CreateContext(), force);
}
bool Initialize(nsRefPtr<GLContext> aContext);
bool Initialize(nsRefPtr<GLContext> aContext, bool force = false);
/**
* Sets the clipping region for this layer manager. This is important on

View File

@ -103,10 +103,9 @@ ScopedGfxFeatureReporter::WriteAppNote(char statusChar)
}
nsCAutoString featureString;
featureString.AppendPrintf("%s%c%c",
featureString.AppendPrintf("%s%c ",
mFeature,
statusChar,
statusChar == '?' ? ' ' : '\n');
statusChar);
if (!gFeaturesAlreadyReported->Contains(featureString)) {
gFeaturesAlreadyReported->AppendElement(featureString);

View File

@ -53,9 +53,10 @@ namespace mozilla {
class NS_GFX ScopedGfxFeatureReporter
{
public:
ScopedGfxFeatureReporter(const char *aFeature) : mFeature(aFeature), mStatusChar('-')
ScopedGfxFeatureReporter(const char *aFeature, bool force = false)
: mFeature(aFeature), mStatusChar('-')
{
WriteAppNote('?');
WriteAppNote(force ? '!' : '?');
}
~ScopedGfxFeatureReporter() {
WriteAppNote(mStatusChar);

View File

@ -501,7 +501,7 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
mD2DDevice = nsnull;
}
mozilla::ScopedGfxFeatureReporter reporter("D2D");
mozilla::ScopedGfxFeatureReporter reporter("D2D", aAttemptForce);
HMODULE d3d10module = LoadLibraryA("d3d10_1.dll");
D3D10CreateDevice1Func createD3DDevice = (D3D10CreateDevice1Func)

View File

@ -3237,7 +3237,7 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
if (!prefs.mPreferD3D9 && !prefs.mPreferOpenGL) {
nsRefPtr<mozilla::layers::LayerManagerD3D10> layerManager =
new mozilla::layers::LayerManagerD3D10(this);
if (layerManager->Initialize()) {
if (layerManager->Initialize(prefs.mForceAcceleration)) {
mLayerManager = layerManager;
}
}
@ -3246,7 +3246,7 @@ nsWindow::GetLayerManager(PLayersChild* aShadowManager,
if (!prefs.mPreferOpenGL && !mLayerManager && sAllowD3D9) {
nsRefPtr<mozilla::layers::LayerManagerD3D9> layerManager =
new mozilla::layers::LayerManagerD3D9(this);
if (layerManager->Initialize()) {
if (layerManager->Initialize(prefs.mForceAcceleration)) {
mLayerManager = layerManager;
}
}

View File

@ -115,6 +115,7 @@ nsBaseWidget::nsBaseWidget()
, mBorderStyle(eBorderStyle_none)
, mOnDestroyCalled(false)
, mUseAcceleratedRendering(false)
, mForceLayersAcceleration(false)
, mTemporarilyUseBasicLayerManager(false)
, mBounds(0,0,0,0)
, mOriginalBounds(nsnull)
@ -795,7 +796,7 @@ nsBaseWidget::GetShouldAccelerate()
// we should use AddBoolPrefVarCache
bool disableAcceleration =
Preferences::GetBool("layers.acceleration.disabled", false);
bool forceAcceleration =
mForceLayersAcceleration =
Preferences::GetBool("layers.acceleration.force-enabled", false);
const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
@ -828,7 +829,7 @@ nsBaseWidget::GetShouldAccelerate()
if (disableAcceleration || safeMode)
return false;
if (forceAcceleration)
if (mForceLayersAcceleration)
return true;
if (!whitelisted) {
@ -906,7 +907,8 @@ LayerManager* nsBaseWidget::GetLayerManager(PLayersChild* aShadowManager,
* platforms on LayerManagerOGL should ensure their widget is able to
* deal with it though!
*/
if (layerManager->Initialize()) {
if (layerManager->Initialize(mForceLayersAcceleration)) {
mLayerManager = layerManager;
}
}

View File

@ -298,6 +298,7 @@ protected:
nsBorderStyle mBorderStyle;
bool mOnDestroyCalled;
bool mUseAcceleratedRendering;
bool mForceLayersAcceleration;
bool mTemporarilyUseBasicLayerManager;
nsIntRect mBounds;
nsIntRect* mOriginalBounds;