Bug 1268938 - Use the name of the original message in Send for reply telemetry. r=billm

aReply usually won't have a name properly set, but aMsg does. To avoid
accessing aMsg after it dies, copy the pointer to the name.
This commit is contained in:
Andrew McCreight 2016-05-02 20:37:40 -07:00
parent 6197796b59
commit 56f812a0d5

View File

@ -1158,6 +1158,9 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
IPC_LOG("Send seqno=%d, xid=%d", seqno, transaction);
// msg will be destroyed soon, but name() is not owned by msg.
const char* msgName = msg->name();
mLink->SendMessage(msg.forget());
while (true) {
@ -1246,7 +1249,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
*aReply = Move(*reply);
if (aReply->capacity() >= kMinTelemetryMessageSize) {
Telemetry::Accumulate(Telemetry::IPC_REPLY_SIZE,
nsDependentCString(aReply->name()), aReply->capacity());
nsDependentCString(msgName), aReply->capacity());
}
return true;
}