Backed out changeset cd8049475224 (bug 1218576)

This commit is contained in:
Sebastian Hengst 2016-08-30 15:51:49 +02:00
Родитель 9dbcd1079d
Коммит fd0de3fdad
1 изменённых файлов: 28 добавлений и 0 удалений

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

@ -57,6 +57,7 @@ const PREF_UNIFIED = PREF_BRANCH + "unified";
const MESSAGE_TELEMETRY_PAYLOAD = "Telemetry:Payload";
const MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD = "Telemetry:GetChildPayload";
const MESSAGE_TELEMETRY_THREAD_HANGS = "Telemetry:ChildThreadHangs";
const MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS = "Telemetry:GetChildThreadHangs";
const MESSAGE_TELEMETRY_USS = "Telemetry:USS";
@ -539,6 +540,13 @@ this.TelemetrySession = Object.freeze({
getPayload: function(reason, clearSubsession = false) {
return Impl.getPayload(reason, clearSubsession);
},
/**
* Asks the content processes to send their payloads.
* @returns Object
*/
requestChildPayloads: function() {
return Impl.requestChildPayloads();
},
/**
* Returns a promise that resolves to an array of thread hang stats from content processes, one entry per process.
* The structure of each entry is identical to that of "threadHangStats" in nsITelemetry.
@ -1513,6 +1521,7 @@ var Impl = {
}
Services.obs.addObserver(this, "content-child-shutdown", false);
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, this);
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS, this);
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_USS, this);
@ -1550,6 +1559,14 @@ var Impl = {
let source = message.data.childUUID;
delete message.data.childUUID;
for (let child of this._childTelemetry) {
if (child.source === source) {
// Update existing telemetry data.
child.payload = message.data;
return;
}
}
// Did not find existing child in this._childTelemetry.
this._childTelemetry.push({
source: source,
payload: message.data,
@ -1562,6 +1579,12 @@ var Impl = {
break;
}
case MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD:
{
// In child process, send the requested Telemetry payload
this.sendContentProcessPing("saved-session");
break;
}
case MESSAGE_TELEMETRY_THREAD_HANGS:
{
// Accumulate child thread hang stats from this child
@ -1741,6 +1764,11 @@ var Impl = {
return this.getSessionPayload(reason, clearSubsession);
},
requestChildPayloads: function() {
this._log.trace("requestChildPayloads");
ppmm.broadcastAsyncMessage(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, {});
},
getChildThreadHangs: function getChildThreadHangs() {
return new Promise((resolve) => {
// Return immediately if there are no child processes to get stats from