зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1140383: Add fast path for NFC:QueryInfo, r=allstars.chh
Messages of type NFC:QueryInfo return local RF state. We don't need the NFC Service, so we can return early.
This commit is contained in:
Родитель
614234540f
Коммит
6d0aec9592
|
@ -663,9 +663,16 @@ Nfc.prototype = {
|
|||
* Process a message from the gMessageManager.
|
||||
*/
|
||||
receiveMessage: function receiveMessage(message) {
|
||||
if (["NFC:ChangeRFState",
|
||||
"NFC:SendFile",
|
||||
"NFC:QueryInfo"].indexOf(message.name) == -1) {
|
||||
// Return early if we don't need the NFC Service.
|
||||
switch (message.name) {
|
||||
case "NFC:QueryInfo":
|
||||
return {rfState: this.rfState};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (["NFC:ChangeRFState",
|
||||
"NFC:SendFile"].indexOf(message.name) == -1) {
|
||||
// Update the current sessionId before sending to the NFC service.
|
||||
message.data.sessionId = SessionHelper.getId(message.data.sessionToken);
|
||||
}
|
||||
|
@ -704,8 +711,6 @@ Nfc.prototype = {
|
|||
gSystemMessenger.broadcastMessage("nfc-manager-send-file",
|
||||
sysMsg);
|
||||
break;
|
||||
case "NFC:QueryInfo":
|
||||
return {rfState: this.rfState};
|
||||
default:
|
||||
debug("UnSupported : Message Name " + message.name);
|
||||
return null;
|
||||
|
|
Загрузка…
Ссылка в новой задаче