Add GPU process support to the crash reporting service. (bug 1278717, r=ted)

This commit is contained in:
David Anderson 2016-10-14 23:59:29 -07:00
Родитель c69dfea9a5
Коммит 95f369864c
6 изменённых файлов: 54 добавлений и 4 удалений

Просмотреть файл

@ -110,6 +110,10 @@ CrashReporterHost::NotifyCrashService(GeckoProcessType aProcessType,
processType = nsICrashService::PROCESS_TYPE_GMPLUGIN;
telemetryKey.AssignLiteral("gmplugin");
break;
case GeckoProcessType_GPU:
processType = nsICrashService::PROCESS_TYPE_GPU;
telemetryKey.AssignLiteral("gpu");
break;
default:
NS_ERROR("unknown process type");
return;

Просмотреть файл

@ -139,6 +139,9 @@ this.CrashManager.prototype = Object.freeze({
// A crash in a Gecko media plugin process.
PROCESS_TYPE_GMPLUGIN: "gmplugin",
// A crash in the GPU process.
PROCESS_TYPE_GPU: "gpu",
// A real crash.
CRASH_TYPE_CRASH: "crash",

Просмотреть файл

@ -37,6 +37,9 @@ CrashService.prototype = Object.freeze({
case Ci.nsICrashService.PROCESS_TYPE_GMPLUGIN:
processType = Services.crashmanager.PROCESS_TYPE_GMPLUGIN;
break;
case Ci.nsICrashService.PROCESS_TYPE_GPU:
processType = Services.crashmanager.PROCESS_TYPE_GPU;
break;
default:
throw new Error("Unrecognized PROCESS_TYPE: " + processType);
}

Просмотреть файл

@ -23,6 +23,7 @@ interface nsICrashService : nsISupports
const long PROCESS_TYPE_CONTENT = 1;
const long PROCESS_TYPE_PLUGIN = 2;
const long PROCESS_TYPE_GMPLUGIN = 3;
const long PROCESS_TYPE_GPU = 4;
const long CRASH_TYPE_CRASH = 0;
const long CRASH_TYPE_HANG = 1;

Просмотреть файл

@ -367,6 +367,8 @@ add_task(function* test_addCrash() {
"plugin-hang", DUMMY_DATE);
yield m.addCrash(m.PROCESS_TYPE_GMPLUGIN, m.CRASH_TYPE_CRASH,
"gmplugin-crash", DUMMY_DATE);
yield m.addCrash(m.PROCESS_TYPE_GPU, m.CRASH_TYPE_CRASH,
"gpu-crash", DUMMY_DATE);
yield m.addCrash(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH,
"changing-item", DUMMY_DATE);
@ -374,7 +376,7 @@ add_task(function* test_addCrash() {
"changing-item", DUMMY_DATE_2);
crashes = yield m.getCrashes();
Assert.equal(crashes.length, 8);
Assert.equal(crashes.length, 9);
let map = new Map(crashes.map(crash => [crash.id, crash]));
@ -420,6 +422,12 @@ add_task(function* test_addCrash() {
Assert.equal(crash.type, m.PROCESS_TYPE_GMPLUGIN + "-" + m.CRASH_TYPE_CRASH);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GMPLUGIN, m.CRASH_TYPE_CRASH));
crash = map.get("gpu-crash");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE);
Assert.equal(crash.type, m.PROCESS_TYPE_GPU+ "-" + m.CRASH_TYPE_CRASH);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GPU, m.CRASH_TYPE_CRASH));
crash = map.get("changing-item");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE_2);

Просмотреть файл

@ -24,6 +24,7 @@ const {
PROCESS_TYPE_CONTENT,
PROCESS_TYPE_PLUGIN,
PROCESS_TYPE_GMPLUGIN,
PROCESS_TYPE_GPU,
CRASH_TYPE_CRASH,
CRASH_TYPE_HANG,
SUBMISSION_RESULT_OK,
@ -334,6 +335,33 @@ add_task(function* test_add_gmplugin_crash() {
Assert.equal(crashes.length, 2);
});
add_task(function* test_add_gpu_crash() {
let s = yield getStore();
Assert.ok(
s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date())
);
Assert.equal(s.crashesCount, 1);
let c = s.crashes[0];
Assert.ok(c.crashDate);
Assert.equal(c.type, PROCESS_TYPE_GPU + "-" + CRASH_TYPE_CRASH);
Assert.ok(c.isOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH));
Assert.ok(
s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id2", new Date())
);
Assert.equal(s.crashesCount, 2);
Assert.ok(
s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "id1", new Date())
);
Assert.equal(s.crashesCount, 2);
let crashes = s.getCrashesOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH);
Assert.equal(crashes.length, 2);
});
add_task(function* test_add_mixed_types() {
let s = yield getStore();
@ -344,10 +372,11 @@ add_task(function* test_add_mixed_types() {
s.addCrash(PROCESS_TYPE_CONTENT, CRASH_TYPE_HANG, "chang", new Date()) &&
s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_CRASH, "pcrash", new Date()) &&
s.addCrash(PROCESS_TYPE_PLUGIN, CRASH_TYPE_HANG, "phang", new Date()) &&
s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "gmpcrash", new Date())
s.addCrash(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH, "gmpcrash", new Date()) &&
s.addCrash(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH, "gpucrash", new Date())
);
Assert.equal(s.crashesCount, 7);
Assert.equal(s.crashesCount, 8);
yield s.save();
@ -356,7 +385,7 @@ add_task(function* test_add_mixed_types() {
yield s.load();
Assert.equal(s.crashesCount, 7);
Assert.equal(s.crashesCount, 8);
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN, CRASH_TYPE_CRASH);
Assert.equal(crashes.length, 1);
@ -372,6 +401,8 @@ add_task(function* test_add_mixed_types() {
Assert.equal(crashes.length, 1);
crashes = s.getCrashesOfType(PROCESS_TYPE_GMPLUGIN, CRASH_TYPE_CRASH);
Assert.equal(crashes.length, 1);
crashes = s.getCrashesOfType(PROCESS_TYPE_GPU, CRASH_TYPE_CRASH);
Assert.equal(crashes.length, 1);
});
// Crashes added beyond the high water mark behave properly.