зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1262008 - Add WebGL failure causes to telemetry ping. r=dvander
MozReview-Commit-ID: 9IVhVNGmaAP --HG-- extra : rebase_source : bfa8d247c331c216c048fb696fbfb4302c5b8d52
This commit is contained in:
Родитель
018f6c8d55
Коммит
70acc7f3f9
|
@ -765,6 +765,10 @@ gfxPlatform::Init()
|
|||
|
||||
ScrollMetadata::sNullMetadata = new ScrollMetadata();
|
||||
ClearOnShutdown(&ScrollMetadata::sNullMetadata);
|
||||
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nullptr, "gfx-features-ready", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
static bool sLayersIPCIsUp = false;
|
||||
|
|
|
@ -181,11 +181,12 @@ const PREF_UPDATE_AUTODOWNLOAD = "app.update.auto";
|
|||
const PREF_SEARCH_COHORT = "browser.search.cohort";
|
||||
const PREF_E10S_COHORT = "e10s.rollout.cohort";
|
||||
|
||||
const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
|
||||
const SEARCH_ENGINE_MODIFIED_TOPIC = "browser-search-engine-modified";
|
||||
const SEARCH_SERVICE_TOPIC = "browser-search-service";
|
||||
const COMPOSITOR_CREATED_TOPIC = "compositor:created";
|
||||
const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC = "distribution-customization-complete";
|
||||
const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
|
||||
const GFX_FEATURES_READY_TOPIC = "gfx-features-ready";
|
||||
const SEARCH_ENGINE_MODIFIED_TOPIC = "browser-search-engine-modified";
|
||||
const SEARCH_SERVICE_TOPIC = "browser-search-service";
|
||||
|
||||
/**
|
||||
* Enforces the parameter to a boolean value.
|
||||
|
@ -902,20 +903,21 @@ EnvironmentCache.prototype = {
|
|||
|
||||
_addObservers: function () {
|
||||
// Watch the search engine change and service topics.
|
||||
Services.obs.addObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC, false);
|
||||
Services.obs.addObserver(this, SEARCH_SERVICE_TOPIC, false);
|
||||
Services.obs.addObserver(this, COMPOSITOR_CREATED_TOPIC, false);
|
||||
Services.obs.addObserver(this, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC, false);
|
||||
Services.obs.addObserver(this, GFX_FEATURES_READY_TOPIC, false);
|
||||
Services.obs.addObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC, false);
|
||||
Services.obs.addObserver(this, SEARCH_SERVICE_TOPIC, false);
|
||||
},
|
||||
|
||||
_removeObservers: function () {
|
||||
// Remove the search engine change and service observers.
|
||||
Services.obs.removeObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC);
|
||||
Services.obs.removeObserver(this, SEARCH_SERVICE_TOPIC);
|
||||
Services.obs.removeObserver(this, COMPOSITOR_CREATED_TOPIC);
|
||||
try {
|
||||
Services.obs.removeObserver(this, DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC);
|
||||
} catch(ex) {}
|
||||
Services.obs.removeObserver(this, GFX_FEATURES_READY_TOPIC);
|
||||
Services.obs.removeObserver(this, SEARCH_ENGINE_MODIFIED_TOPIC);
|
||||
Services.obs.removeObserver(this, SEARCH_SERVICE_TOPIC);
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
|
@ -935,6 +937,7 @@ EnvironmentCache.prototype = {
|
|||
// Now that the search engine init is complete, record the default search choice.
|
||||
this._updateSearchEngine();
|
||||
break;
|
||||
case GFX_FEATURES_READY_TOPIC:
|
||||
case COMPOSITOR_CREATED_TOPIC:
|
||||
// Full graphics information is not available until we have created at
|
||||
// least one off-main-thread-composited window. Thus we wait for the
|
||||
|
|
|
@ -581,6 +581,8 @@ function checkSystemSection(data) {
|
|||
|
||||
let features = gfxInfo.getFeatures();
|
||||
Assert.equal(features.compositor, gfxData.features.compositor);
|
||||
Assert.equal(features.opengl, gfxData.features.opengl);
|
||||
Assert.equal(features.webgl, gfxData.features.webgl);
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
|
|
|
@ -1285,15 +1285,20 @@ GfxInfoBase::BuildFeatureStateLog(JSContext* aCx, const FeatureState& aFeature,
|
|||
}
|
||||
|
||||
void
|
||||
GfxInfoBase::DescribeFeatures(JSContext* cx, JS::Handle<JSObject*> aOut)
|
||||
GfxInfoBase::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx);
|
||||
|
||||
InitFeatureObject(aCx, aObj, "opengl", nsIGfxInfo::FEATURE_OPENGL_LAYERS, Nothing(), &obj);
|
||||
InitFeatureObject(aCx, aObj, "webgl", nsIGfxInfo::FEATURE_WEBGL_OPENGL, Nothing(), &obj);
|
||||
}
|
||||
|
||||
bool
|
||||
GfxInfoBase::InitFeatureObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aContainer,
|
||||
const char* aName,
|
||||
mozilla::gfx::FeatureStatus aFeatureStatus,
|
||||
int32_t aFeature,
|
||||
Maybe<mozilla::gfx::FeatureStatus> aFeatureStatus,
|
||||
JS::MutableHandle<JSObject*> aOutObj)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
|
||||
|
@ -1301,15 +1306,27 @@ GfxInfoBase::InitFeatureObject(JSContext* aCx,
|
|||
return false;
|
||||
}
|
||||
|
||||
const char* status = FeatureStatusToString(aFeatureStatus);
|
||||
nsCString failureId = NS_LITERAL_CSTRING("OK");
|
||||
int32_t unused;
|
||||
if (!NS_SUCCEEDED(GetFeatureStatus(aFeature, failureId, &unused))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set "status".
|
||||
{
|
||||
if (aFeatureStatus) {
|
||||
const char* status = FeatureStatusToString(aFeatureStatus.value());
|
||||
|
||||
JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, status));
|
||||
JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
|
||||
JS_SetProperty(aCx, obj, "status", val);
|
||||
}
|
||||
|
||||
if (!failureId.IsEmpty()) {
|
||||
JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, failureId.get()));
|
||||
JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
|
||||
JS_SetProperty(aCx, obj, "failureId", val);
|
||||
}
|
||||
|
||||
// Add the feature object to the container.
|
||||
{
|
||||
JS::Rooted<JS::Value> val(aCx, JS::ObjectValue(*obj));
|
||||
|
|
|
@ -8,20 +8,21 @@
|
|||
#ifndef __mozilla_widget_GfxInfoBase_h__
|
||||
#define __mozilla_widget_GfxInfoBase_h__
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "GfxDriverInfo.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
#include "GfxInfoCollector.h"
|
||||
#include "gfxTelemetry.h"
|
||||
#include "gfxFeature.h"
|
||||
#include "nsIGfxInfoDebug.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "gfxTelemetry.h"
|
||||
#include "js/Value.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsIGfxInfoDebug.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
@ -107,7 +108,8 @@ protected:
|
|||
JSContext* aCx,
|
||||
JS::Handle<JSObject*> aContainer,
|
||||
const char* aName,
|
||||
mozilla::gfx::FeatureStatus aFeatureStatus,
|
||||
int32_t aFeature,
|
||||
Maybe<mozilla::gfx::FeatureStatus> aKnownStatus,
|
||||
JS::MutableHandle<JSObject*> aOutObj);
|
||||
|
||||
private:
|
||||
|
|
|
@ -167,6 +167,7 @@ interface nsIGfxInfo : nsISupports
|
|||
// "name": <string>,
|
||||
// "description": <string>,
|
||||
// "status": <string>,
|
||||
// "failureId": <string>, // optional, only covers static failure currently.
|
||||
// "log": [
|
||||
// // One or more log entries, the first denotes the default value.
|
||||
// {
|
||||
|
|
|
@ -1258,12 +1258,16 @@ GfxInfo::FindMonitors(JSContext* aCx, JS::HandleObject aOutArray)
|
|||
void
|
||||
GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
|
||||
{
|
||||
// Add the platform neutral features
|
||||
GfxInfoBase::DescribeFeatures(aCx, aObj);
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx);
|
||||
|
||||
gfxWindowsPlatform* platform = gfxWindowsPlatform::GetPlatform();
|
||||
|
||||
gfx::FeatureStatus d3d11 = gfxConfig::GetValue(Feature::D3D11_COMPOSITING);
|
||||
if (!InitFeatureObject(aCx, aObj, "d3d11", d3d11, &obj)) {
|
||||
if (!InitFeatureObject(aCx, aObj, "d3d11", FEATURE_DIRECT3D_11_ANGLE,
|
||||
Some(d3d11), &obj)) {
|
||||
return;
|
||||
}
|
||||
if (d3d11 == gfx::FeatureStatus::Available) {
|
||||
|
@ -1290,7 +1294,8 @@ GfxInfo::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj)
|
|||
}
|
||||
|
||||
gfx::FeatureStatus d2d = gfxConfig::GetValue(Feature::DIRECT2D);
|
||||
if (!InitFeatureObject(aCx, aObj, "d2d", d2d, &obj)) {
|
||||
if (!InitFeatureObject(aCx, aObj, "d2d", nsIGfxInfo::FEATURE_DIRECT2D,
|
||||
Some(d2d), &obj)) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче