|
|
57 |
|
57 |
|
58 |
|
58 |
|
59 |
const MESSAGE_TELEMETRY_PAYLOAD = "Telemetry:Payload"; |
59 |
const MESSAGE_TELEMETRY_PAYLOAD = "Telemetry:Payload"; |
60 |
const MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD = "Telemetry:GetChildPayload"; |
|
|
61 |
const MESSAGE_TELEMETRY_THREAD_HANGS = "Telemetry:ChildThreadHangs"; |
60 |
const MESSAGE_TELEMETRY_THREAD_HANGS = "Telemetry:ChildThreadHangs"; |
62 |
const MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS = "Telemetry:GetChildThreadHangs"; |
61 |
const MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS = "Telemetry:GetChildThreadHangs"; |
63 |
const MESSAGE_TELEMETRY_USS = "Telemetry:USS"; |
62 |
const MESSAGE_TELEMETRY_USS = "Telemetry:USS"; |
|
541 |
return Impl.getPayload(reason, clearSubsession); |
540 |
return Impl.getPayload(reason, clearSubsession); |
542 |
}, |
541 |
}, |
543 |
/** |
542 |
/** |
544 |
* Asks the content processes to send their payloads. |
|
|
545 |
* @returns Object |
546 |
*/ |
547 |
requestChildPayloads: function() { |
548 |
return Impl.requestChildPayloads(); |
549 |
}, |
550 |
/** |
551 |
* Returns a promise that resolves to an array of thread hang stats from content processes, one entry per process. |
543 |
* Returns a promise that resolves to an array of thread hang stats from content processes, one entry per process. |
552 |
* The structure of each entry is identical to that of "threadHangStats" in nsITelemetry. |
544 |
* The structure of each entry is identical to that of "threadHangStats" in nsITelemetry. |
553 |
* While thread hang stats are also part of the child payloads, this function is useful for cheaply getting this information, |
545 |
* While thread hang stats are also part of the child payloads, this function is useful for cheaply getting this information, |
|
1511 |
} |
1503 |
} |
1512 |
|
1504 |
|
1513 |
Services.obs.addObserver(this, "content-child-shutdown", false); |
1505 |
Services.obs.addObserver(this, "content-child-shutdown", false); |
1514 |
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, this); |
|
|
1515 |
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS, this); |
1506 |
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_THREAD_HANGS, this); |
1516 |
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_USS, this); |
1507 |
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_USS, this); |
1517 |
|
1508 |
|
|
1549 |
let source = message.data.childUUID; |
1540 |
let source = message.data.childUUID; |
1550 |
delete message.data.childUUID; |
1541 |
delete message.data.childUUID; |
1551 |
|
1542 |
|
1552 |
for (let child of this._childTelemetry) { |
|
|
1553 |
if (child.source === source) { |
1554 |
// Update existing telemetry data. |
1555 |
child.payload = message.data; |
1556 |
return; |
1557 |
} |
1558 |
} |
1559 |
// Did not find existing child in this._childTelemetry. |
1560 |
this._childTelemetry.push({ |
1543 |
this._childTelemetry.push({ |
1561 |
source: source, |
1544 |
source: source, |
1562 |
payload: message.data, |
1545 |
payload: message.data, |
|
1569 |
|
1552 |
|
1570 |
break; |
1553 |
break; |
1571 |
} |
1554 |
} |
1572 |
case MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD: |
|
|
1573 |
{ |
1574 |
// In child process, send the requested Telemetry payload |
1575 |
this.sendContentProcessPing("saved-session"); |
1576 |
break; |
1577 |
} |
1578 |
case MESSAGE_TELEMETRY_THREAD_HANGS: |
1555 |
case MESSAGE_TELEMETRY_THREAD_HANGS: |
1579 |
{ |
1556 |
{ |
1580 |
// Accumulate child thread hang stats from this child |
1557 |
// Accumulate child thread hang stats from this child |
|
1754 |
return this.getSessionPayload(reason, clearSubsession); |
1731 |
return this.getSessionPayload(reason, clearSubsession); |
1755 |
}, |
1732 |
}, |
1756 |
|
1733 |
|
1757 |
requestChildPayloads: function() { |
|
|
1758 |
this._log.trace("requestChildPayloads"); |
1759 |
ppmm.broadcastAsyncMessage(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, {}); |
1760 |
}, |
1761 |
|
1762 |
getChildThreadHangs: function getChildThreadHangs() { |
1734 |
getChildThreadHangs: function getChildThreadHangs() { |
1763 |
return new Promise((resolve) => { |
1735 |
return new Promise((resolve) => { |
1764 |
// Return immediately if there are no child processes to get stats from |
1736 |
// Return immediately if there are no child processes to get stats from |
1765 |
- |
|
|