2011-01-19 17:30:12 -08:00
|
|
|
/* vim: se cin sw=2 ts=2 et : */
|
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07:00
|
|
|
* 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
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-01-19 17:30:12 -08:00
|
|
|
|
|
|
|
#ifndef __mozilla_widget_GfxInfoBase_h__
|
|
|
|
#define __mozilla_widget_GfxInfoBase_h__
|
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
#include "nsIGfxInfo.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakReference.h"
|
2011-01-19 17:35:51 -08:00
|
|
|
#include "GfxDriverInfo.h"
|
|
|
|
#include "nsTArray.h"
|
2011-02-07 11:44:48 -08:00
|
|
|
#include "nsString.h"
|
2011-11-02 13:53:59 -07:00
|
|
|
#include "GfxInfoCollector.h"
|
2011-12-14 21:04:35 -08:00
|
|
|
#include "nsIGfxInfoDebug.h"
|
2011-01-19 17:30:12 -08:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
class GfxInfoBase : public nsIGfxInfo,
|
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference
|
2011-12-14 21:04:35 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
, public nsIGfxInfoDebug
|
|
|
|
#endif
|
2011-01-19 17:30:12 -08:00
|
|
|
{
|
|
|
|
public:
|
2011-01-19 17:33:51 -08:00
|
|
|
GfxInfoBase();
|
|
|
|
virtual ~GfxInfoBase();
|
|
|
|
|
2011-01-19 17:30:12 -08:00
|
|
|
NS_DECL_ISUPPORTS
|
2011-01-19 17:33:51 -08:00
|
|
|
NS_DECL_NSIOBSERVER
|
2011-01-19 17:30:12 -08:00
|
|
|
|
|
|
|
// We only declare a subset of the nsIGfxInfo interface. It's up to derived
|
|
|
|
// classes to implement the rest of the interface.
|
|
|
|
// Derived classes need to use
|
|
|
|
// using GfxInfoBase::GetFeatureStatus;
|
|
|
|
// using GfxInfoBase::GetFeatureSuggestedDriverVersion;
|
|
|
|
// using GfxInfoBase::GetWebGLParameter;
|
|
|
|
// to import the relevant methods into their namespace.
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetFeatureStatus(int32_t aFeature, int32_t *_retval);
|
|
|
|
NS_IMETHOD GetFeatureSuggestedDriverVersion(int32_t aFeature, nsAString & _retval);
|
2012-07-06 13:31:49 -07:00
|
|
|
NS_IMETHOD GetWebGLParameter(const nsAString & aParam, nsAString & _retval);
|
2011-01-19 17:30:12 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetFailures(uint32_t *failureCount, char ***failures);
|
2011-02-07 11:44:48 -08:00
|
|
|
NS_IMETHOD_(void) LogFailure(const nsACString &failure);
|
2012-07-06 13:31:49 -07:00
|
|
|
NS_IMETHOD GetInfo(JSContext*, jsval*);
|
2011-02-07 11:44:48 -08:00
|
|
|
|
2011-01-19 17:33:51 -08:00
|
|
|
// Initialization function. If you override this, you must call this class's
|
|
|
|
// version of Init first.
|
2011-01-20 13:27:22 -08:00
|
|
|
// We need Init to be called separately from the constructor so we can
|
|
|
|
// register as an observer after all derived classes have been constructed
|
|
|
|
// and we know we have a non-zero refcount.
|
2011-01-19 17:33:51 -08:00
|
|
|
// Ideally, Init() would be void-return, but the rules of
|
|
|
|
// NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
|
|
|
|
virtual nsresult Init();
|
2011-09-07 14:17:44 -07:00
|
|
|
|
|
|
|
// only useful on X11
|
|
|
|
NS_IMETHOD_(void) GetData() { }
|
2011-01-19 17:33:51 -08:00
|
|
|
|
2011-11-02 13:53:59 -07:00
|
|
|
static void AddCollector(GfxInfoCollectorBase* collector);
|
|
|
|
static void RemoveCollector(GfxInfoCollectorBase* collector);
|
|
|
|
|
2011-12-14 21:02:59 -08:00
|
|
|
static nsTArray<GfxDriverInfo>* mDriverInfo;
|
|
|
|
static bool mDriverInfoObserverInitialized;
|
2011-11-02 13:53:59 -07:00
|
|
|
|
2011-01-19 17:30:12 -08:00
|
|
|
protected:
|
2011-01-19 17:35:51 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult GetFeatureStatusImpl(int32_t aFeature, int32_t* aStatus,
|
2011-01-19 17:35:51 -08:00
|
|
|
nsAString& aSuggestedDriverVersion,
|
2011-12-14 21:02:59 -08:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2012-07-30 07:20:58 -07:00
|
|
|
OperatingSystem* aOS = nullptr);
|
2011-01-19 17:35:51 -08:00
|
|
|
|
2011-12-14 21:02:59 -08:00
|
|
|
// Gets the driver info table. Used by GfxInfoBase to check for general cases
|
|
|
|
// (while subclasses check for more specific ones).
|
|
|
|
virtual const nsTArray<GfxDriverInfo>& GetGfxDriverInfo() = 0;
|
|
|
|
|
2011-01-19 17:35:51 -08:00
|
|
|
private:
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual int32_t FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2011-12-14 21:02:59 -08:00
|
|
|
nsAString& aSuggestedVersion,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aFeature,
|
2011-12-14 21:02:59 -08:00
|
|
|
OperatingSystem os);
|
2011-01-19 17:35:51 -08:00
|
|
|
|
|
|
|
void EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo);
|
|
|
|
|
2011-02-07 11:44:48 -08:00
|
|
|
nsCString mFailures[9]; // The choice of 9 is Ehsan's
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mFailureCount;
|
2011-02-07 11:44:48 -08:00
|
|
|
|
2011-01-19 17:30:12 -08:00
|
|
|
};
|
|
|
|
|
2011-01-20 00:38:05 -08:00
|
|
|
}
|
|
|
|
}
|
2011-01-19 17:30:12 -08:00
|
|
|
|
|
|
|
#endif /* __mozilla_widget_GfxInfoBase_h__ */
|