Bug 715767 - Make LayerManagerD3D10::ReportFailure threadsafe. r=joe

This commit is contained in:
Andrew Quartey 2013-02-25 09:07:16 -05:00
parent 5679cd4a46
commit 1528b2d529
2 changed files with 9 additions and 4 deletions

View File

@ -33,6 +33,7 @@
using namespace mozilla::widget;
using namespace mozilla;
using mozilla::MutexAutoLock;
nsTArray<GfxDriverInfo>* GfxInfoBase::mDriverInfo;
bool GfxInfoBase::mDriverInfoObserverInitialized;
@ -86,7 +87,7 @@ void InitGfxDriverInfoShutdownObserver()
using namespace mozilla::widget;
using namespace mozilla;
NS_IMPL_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference)
NS_IMPL_THREADSAFE_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference)
#define BLACKLIST_PREF_BRANCH "gfx.blacklist."
#define SUGGESTED_VERSION_PREF BLACKLIST_PREF_BRANCH "suggested-driver-version"
@ -531,6 +532,7 @@ GfxInfoBase::Observe(nsISupports* aSubject, const char* aTopic,
GfxInfoBase::GfxInfoBase()
: mFailureCount(0)
, mMutex("GfxInfoBase")
{
}
@ -838,14 +840,15 @@ GfxInfoBase::EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo)
NS_IMETHODIMP_(void)
GfxInfoBase::LogFailure(const nsACString &failure)
{
MutexAutoLock lock(mMutex);
/* We only keep the first 9 failures */
if (mFailureCount < ArrayLength(mFailures)) {
mFailures[mFailureCount++] = failure;
/* record it in the crash notes too */
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AppendAppNotesToCrashReport(failure);
#endif
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AppendAppNotesToCrashReport(failure);
#endif
}
}

View File

@ -17,6 +17,7 @@
#include "nsString.h"
#include "GfxInfoCollector.h"
#include "nsIGfxInfoDebug.h"
#include "mozilla/Mutex.h"
namespace mozilla {
namespace widget {
@ -95,6 +96,7 @@ private:
nsCString mFailures[9]; // The choice of 9 is Ehsan's
uint32_t mFailureCount;
Mutex mMutex;
};