2011-01-20 04:30:12 +03: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 15:12:37 +04: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-20 04:30:12 +03:00
|
|
|
|
|
|
|
#ifndef __mozilla_widget_GfxInfoBase_h__
|
|
|
|
#define __mozilla_widget_GfxInfoBase_h__
|
|
|
|
|
2011-01-20 04:35:51 +03:00
|
|
|
#include "GfxDriverInfo.h"
|
2011-11-03 00:53:59 +04:00
|
|
|
#include "GfxInfoCollector.h"
|
2016-04-29 07:52:56 +03:00
|
|
|
#include "gfxFeature.h"
|
2016-05-09 20:44:21 +03:00
|
|
|
#include "gfxTelemetry.h"
|
2013-09-20 00:02:03 +04:00
|
|
|
#include "js/Value.h"
|
2013-11-18 17:38:17 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-05-09 20:44:21 +03:00
|
|
|
#include "mozilla/Maybe.h"
|
|
|
|
#include "mozilla/Mutex.h"
|
2017-01-17 07:05:46 +03:00
|
|
|
#include "mozilla/dom/PContentParent.h"
|
2016-05-09 20:44:21 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIGfxInfo.h"
|
|
|
|
#include "nsIGfxInfoDebug.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsWeakReference.h"
|
2011-01-20 04:30:12 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2011-01-20 04:33:51 +03:00
|
|
|
class GfxInfoBase : public nsIGfxInfo,
|
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference
|
2011-12-15 09:04:35 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
, public nsIGfxInfoDebug
|
|
|
|
#endif
|
2011-01-20 04:30:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-01-20 04:33:51 +03:00
|
|
|
GfxInfoBase();
|
|
|
|
|
2013-07-19 06:24:15 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2011-01-20 04:33:51 +03:00
|
|
|
NS_DECL_NSIOBSERVER
|
2011-01-20 04:30:12 +03: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;
|
|
|
|
// to import the relevant methods into their namespace.
|
2016-04-14 00:12:47 +03:00
|
|
|
NS_IMETHOD GetFeatureStatus(int32_t aFeature, nsACString& aFailureId, int32_t *_retval) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetFeatureSuggestedDriverVersion(int32_t aFeature, nsAString & _retval) override;
|
2011-01-20 04:30:12 +03:00
|
|
|
|
2015-07-13 11:12:26 +03:00
|
|
|
NS_IMETHOD GetMonitors(JSContext* cx, JS::MutableHandleValue _retval) override;
|
|
|
|
NS_IMETHOD GetFailures(uint32_t *failureCount, int32_t** indices, char ***failures) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD_(void) LogFailure(const nsACString &failure) override;
|
|
|
|
NS_IMETHOD GetInfo(JSContext*, JS::MutableHandle<JS::Value>) override;
|
2015-07-20 00:50:35 +03:00
|
|
|
NS_IMETHOD GetFeatures(JSContext*, JS::MutableHandle<JS::Value>) override;
|
2016-04-29 07:52:56 +03:00
|
|
|
NS_IMETHOD GetFeatureLog(JSContext*, JS::MutableHandle<JS::Value>) override;
|
2016-05-10 21:49:16 +03:00
|
|
|
NS_IMETHOD GetActiveCrashGuards(JSContext*, JS::MutableHandle<JS::Value>) override;
|
2016-09-13 02:23:28 +03:00
|
|
|
NS_IMETHOD GetContentBackend(nsAString & aContentBackend) override;
|
2016-11-15 02:02:02 +03:00
|
|
|
NS_IMETHOD GetUsingGPUProcess(bool *aOutValue) override;
|
2017-03-22 22:20:00 +03:00
|
|
|
NS_IMETHOD GetWebRenderEnabled(bool* aWebRenderEnabled) override;
|
2017-07-04 01:39:16 +03:00
|
|
|
NS_IMETHOD GetIsHeadless(bool* aIsHeadless) override;
|
2018-01-24 00:52:13 +03:00
|
|
|
NS_IMETHOD GetUsesTiling(bool* aUsesTiling) override;
|
2018-04-30 23:05:19 +03:00
|
|
|
NS_IMETHOD GetContentUsesTiling(bool* aUsesTiling) override;
|
2017-08-15 07:08:18 +03:00
|
|
|
NS_IMETHOD GetOffMainThreadPaintEnabled(bool* aOffMainThreadPaintEnabled) override;
|
2018-01-24 00:52:13 +03:00
|
|
|
NS_IMETHOD GetOffMainThreadPaintWorkerCount(int32_t* aOffMainThreadPaintWorkerCount) override;
|
2011-02-07 22:44:48 +03:00
|
|
|
|
2011-01-20 04:33:51 +03:00
|
|
|
// Initialization function. If you override this, you must call this class's
|
|
|
|
// version of Init first.
|
2011-01-21 00:27:22 +03: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-20 04:33:51 +03: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-08 01:17:44 +04:00
|
|
|
|
|
|
|
// only useful on X11
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD_(void) GetData() override { }
|
2011-01-20 04:33:51 +03:00
|
|
|
|
2011-11-03 00:53:59 +04:00
|
|
|
static void AddCollector(GfxInfoCollectorBase* collector);
|
|
|
|
static void RemoveCollector(GfxInfoCollectorBase* collector);
|
|
|
|
|
2018-05-14 18:16:50 +03:00
|
|
|
static nsTArray<GfxDriverInfo>* sDriverInfo;
|
|
|
|
static nsTArray<mozilla::dom::GfxInfoFeatureStatus>* sFeatureStatus;
|
|
|
|
static bool sDriverInfoObserverInitialized;
|
|
|
|
static bool sShutdownOccurred;
|
2011-11-03 00:53:59 +04:00
|
|
|
|
2013-11-15 20:28:42 +04:00
|
|
|
virtual nsString Model() { return EmptyString(); }
|
|
|
|
virtual nsString Hardware() { return EmptyString(); }
|
|
|
|
virtual nsString Product() { return EmptyString(); }
|
|
|
|
virtual nsString Manufacturer() { return EmptyString(); }
|
|
|
|
virtual uint32_t OperatingSystemVersion() { return 0; }
|
2012-11-02 01:13:10 +04:00
|
|
|
|
2015-05-15 17:42:10 +03:00
|
|
|
// Convenience to get the application version
|
|
|
|
static const nsCString& GetApplicationVersion();
|
|
|
|
|
2015-06-18 09:11:55 +03:00
|
|
|
virtual nsresult FindMonitors(JSContext* cx, JS::HandleObject array) {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2017-01-17 07:05:46 +03:00
|
|
|
static void SetFeatureStatus(
|
|
|
|
const nsTArray<mozilla::dom::GfxInfoFeatureStatus>& aFS);
|
|
|
|
|
2011-01-20 04:30:12 +03:00
|
|
|
protected:
|
2011-01-20 04:35:51 +03:00
|
|
|
|
2014-06-24 20:36:44 +04:00
|
|
|
virtual ~GfxInfoBase();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult GetFeatureStatusImpl(int32_t aFeature, int32_t* aStatus,
|
2011-01-20 04:35:51 +03:00
|
|
|
nsAString& aSuggestedDriverVersion,
|
2011-12-15 09:02:59 +04:00
|
|
|
const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2016-04-14 00:12:47 +03:00
|
|
|
nsACString& aFailureId,
|
2012-07-30 18:20:58 +04:00
|
|
|
OperatingSystem* aOS = nullptr);
|
2011-01-20 04:35:51 +03:00
|
|
|
|
2011-12-15 09:02:59 +04: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;
|
|
|
|
|
2015-07-20 00:50:35 +03:00
|
|
|
virtual void DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> obj);
|
|
|
|
bool InitFeatureObject(
|
|
|
|
JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aContainer,
|
|
|
|
const char* aName,
|
2018-07-19 21:11:34 +03:00
|
|
|
mozilla::gfx::FeatureStatus& aKnownStatus,
|
2015-07-20 00:50:35 +03:00
|
|
|
JS::MutableHandle<JSObject*> aOutObj);
|
|
|
|
|
2017-01-27 03:35:55 +03:00
|
|
|
NS_IMETHOD ControlGPUProcessForXPCShell(bool aEnable, bool *_retval) override;
|
|
|
|
|
2011-01-20 04:35:51 +03:00
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t FindBlocklistedDeviceInList(const nsTArray<GfxDriverInfo>& aDriverInfo,
|
2011-12-15 09:02:59 +04:00
|
|
|
nsAString& aSuggestedVersion,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aFeature,
|
2016-04-14 00:12:47 +03:00
|
|
|
nsACString &aFailureId,
|
2011-12-15 09:02:59 +04:00
|
|
|
OperatingSystem os);
|
2011-01-20 04:35:51 +03:00
|
|
|
|
|
|
|
void EvaluateDownloadedBlacklist(nsTArray<GfxDriverInfo>& aDriverInfo);
|
|
|
|
|
2016-04-29 07:52:56 +03:00
|
|
|
bool BuildFeatureStateLog(JSContext* aCx, const gfx::FeatureState& aFeature,
|
|
|
|
JS::MutableHandle<JS::Value> aOut);
|
|
|
|
|
2013-02-25 18:07:16 +04:00
|
|
|
Mutex mMutex;
|
2011-02-07 22:44:48 +03:00
|
|
|
|
2011-01-20 04:30:12 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
2011-01-20 04:30:12 +03:00
|
|
|
|
|
|
|
#endif /* __mozilla_widget_GfxInfoBase_h__ */
|