зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team. a=merge
This commit is contained in:
Коммит
709b72ce50
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "b441bde54293bea5254dc340845effe951fa3906",
|
||||
"git_revision": "a8a462ab783a5bbab508d3c29483cff260672e3c",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "f1a55165dcd312394c553f763defd95b4b166b12",
|
||||
"revision": "4470d59428b583f2a393ecec55c192a3b2e3a40e",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="bfdb6348725a33bdcdc4e17999cb500be6beedb5"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="b441bde54293bea5254dc340845effe951fa3906"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="a8a462ab783a5bbab508d3c29483cff260672e3c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="ba0d9915742b28a6e705aa1af4310bb26a3098f2"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="bafc84295df205d0db53353734ec6d61e0f180c5"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -19,6 +19,9 @@ body[tpEnabled] .showTpDisabled,
|
|||
body:not([tpEnabled]) .showTpEnabled {
|
||||
display: none !important;
|
||||
}
|
||||
body[globalTpEnabled] .showGlobalTpDisabled {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1200px) and (min-height: 700px) {
|
||||
body.private {
|
||||
|
|
|
@ -14,18 +14,25 @@ const FAVICON_PRIVACY = "chrome://browser/skin/Privacy-16.png";
|
|||
let stringBundle = Services.strings.createBundle(
|
||||
"chrome://browser/locale/aboutPrivateBrowsing.properties");
|
||||
|
||||
let prefBranch = Services.prefs.getBranch("privacy.trackingprotection.pbmode.");
|
||||
let prefBranch = Services.prefs.getBranch("privacy.trackingprotection.");
|
||||
let prefObserver = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
observe: function () {
|
||||
if (prefBranch.getBoolPref("enabled")) {
|
||||
document.body.setAttribute("globalTpEnabled", "true");
|
||||
} else {
|
||||
document.body.removeAttribute("globalTpEnabled");
|
||||
}
|
||||
if (prefBranch.getBoolPref("pbmode.enabled") ||
|
||||
prefBranch.getBoolPref("enabled")) {
|
||||
document.body.setAttribute("tpEnabled", "true");
|
||||
} else {
|
||||
document.body.removeAttribute("tpEnabled");
|
||||
}
|
||||
},
|
||||
};
|
||||
prefBranch.addObserver("pbmode.enabled", prefObserver, true);
|
||||
prefBranch.addObserver("enabled", prefObserver, true);
|
||||
|
||||
function setFavIcon(url) {
|
||||
|
|
|
@ -73,11 +73,11 @@
|
|||
<!-- Use text links to implement plain styled buttons without an href. -->
|
||||
<label xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="disableTrackingProtection"
|
||||
class="text-link showTpEnabled"
|
||||
class="text-link showTpEnabled showGlobalTpDisabled"
|
||||
value="&trackingProtection.disable;"/>
|
||||
<label xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="enableTrackingProtection"
|
||||
class="text-link showTpDisabled"
|
||||
class="text-link showTpDisabled showGlobalTpDisabled"
|
||||
value="&trackingProtection.enable;"/>
|
||||
<p id="tpStartTour"
|
||||
class="showTpEnabled"><a id="startTour">&trackingProtection.startTour1;</a></p>
|
||||
|
|
|
@ -1612,6 +1612,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
}
|
||||
let nameWithQuery = this._getUriNameWithQuery(uri);
|
||||
let hostPort = this._getUriHostPort(uri);
|
||||
let host = this._getUriHost(uri);
|
||||
let unicodeUrl = NetworkHelper.convertToUnicode(unescape(uri.spec));
|
||||
|
||||
let file = $(".requests-menu-file", target);
|
||||
|
@ -1621,6 +1622,27 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
let domain = $(".requests-menu-domain", target);
|
||||
domain.setAttribute("value", hostPort);
|
||||
domain.setAttribute("tooltiptext", hostPort);
|
||||
|
||||
// Mark local hosts specially, where "local" is as defined in the W3C
|
||||
// spec for secure contexts.
|
||||
// http://www.w3.org/TR/powerful-features/
|
||||
//
|
||||
// * If the name falls under 'localhost'
|
||||
// * If the name is an IPv4 address within 127.0.0.0/8
|
||||
// * If the name is an IPv6 address within ::1/128
|
||||
//
|
||||
// IPv6 parsing is a little sloppy; it assumes that the address has
|
||||
// been validated before it gets here.
|
||||
let icon = $(".requests-security-state-icon", target);
|
||||
icon.classList.remove("security-state-local");
|
||||
if (host.match(/(.+\.)?localhost$/) ||
|
||||
host.match(/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}/) ||
|
||||
host.match(/\[[0:]+1\]/)) {
|
||||
let tooltip = L10N.getStr("netmonitor.security.state.secure");
|
||||
icon.classList.add("security-state-local");
|
||||
icon.setAttribute("tooltiptext", tooltip);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case "remoteAddress":
|
||||
|
@ -1630,12 +1652,17 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
domain.setAttribute("tooltiptext", tooltip);
|
||||
break;
|
||||
case "securityState": {
|
||||
let tooltip = L10N.getStr("netmonitor.security.state." + aValue);
|
||||
let icon = $(".requests-security-state-icon", target);
|
||||
this.attachSecurityIconClickListener(aItem);
|
||||
|
||||
// Security icon for local hosts is set in the "url" branch
|
||||
if (icon.classList.contains("security-state-local")) {
|
||||
break;
|
||||
}
|
||||
|
||||
let tooltip = L10N.getStr("netmonitor.security.state." + aValue);
|
||||
icon.classList.add("security-state-" + aValue);
|
||||
icon.setAttribute("tooltiptext", tooltip);
|
||||
|
||||
this.attachSecurityIconClickListener(aItem);
|
||||
break;
|
||||
}
|
||||
case "status": {
|
||||
|
@ -2113,6 +2140,9 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
|
|||
}
|
||||
return NetworkHelper.convertToUnicode(unescape(aUrl.hostPort));
|
||||
},
|
||||
_getUriHost: function(aUrl) {
|
||||
return this._getUriHostPort(aUrl).replace(/:\d+$/, "");
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper for getting an abbreviated string for a mime type.
|
||||
|
|
|
@ -14,6 +14,7 @@ add_task(function* () {
|
|||
"example.com": "security-state-secure",
|
||||
"nocert.example.com": "security-state-broken",
|
||||
"rc4.example.com": "security-state-weak",
|
||||
"localhost": "security-state-local",
|
||||
};
|
||||
|
||||
yield new promise(resolve => {
|
||||
|
@ -50,6 +51,8 @@ add_task(function* () {
|
|||
* - https://nocert.example.com (broken)
|
||||
* - https://example.com (secure)
|
||||
* - http://test1.example.com (insecure)
|
||||
* - https://rc4.example.com (partly secure)
|
||||
* - http://localhost (local)
|
||||
* and waits until NetworkMonitor has handled all packets sent by the server.
|
||||
*/
|
||||
function* performRequests() {
|
||||
|
@ -82,14 +85,19 @@ add_task(function* () {
|
|||
debuggee.performRequests(1, "https://rc4.example.com" + CORS_SJS_PATH);
|
||||
yield done;
|
||||
|
||||
is(RequestsMenu.itemCount, 4, "Four events logged.");
|
||||
done = waitForSecurityBrokenNetworkEvent(true);
|
||||
info("Requesting a resource over HTTP to localhost.");
|
||||
debuggee.performRequests(1, "http://localhost" + CORS_SJS_PATH);
|
||||
yield done;
|
||||
|
||||
is(RequestsMenu.itemCount, 5, "Five events logged.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise that's resolved once a request with security issues is
|
||||
* completed.
|
||||
*/
|
||||
function waitForSecurityBrokenNetworkEvent() {
|
||||
function waitForSecurityBrokenNetworkEvent(networkError) {
|
||||
let awaitedEvents = [
|
||||
"UPDATING_REQUEST_HEADERS",
|
||||
"RECEIVED_REQUEST_HEADERS",
|
||||
|
@ -102,6 +110,12 @@ add_task(function* () {
|
|||
"RECEIVED_EVENT_TIMINGS",
|
||||
];
|
||||
|
||||
// If the reason for breakage is a network error, then the
|
||||
// STARTED_RECEIVING_RESPONSE event does not fire.
|
||||
if (networkError) {
|
||||
awaitedEvents.splice(4, 1);
|
||||
}
|
||||
|
||||
let promises = awaitedEvents.map((event) => {
|
||||
return monitor.panelWin.once(EVENTS[event]);
|
||||
});
|
||||
|
|
|
@ -76,6 +76,7 @@ skip-if = os == 'linux' # Bug 1172120
|
|||
[browser_perf-overview-render-02.js]
|
||||
[browser_perf-overview-render-03.js]
|
||||
[browser_perf-overview-render-04.js]
|
||||
skip-if = os == 'linux' # bug 1186322
|
||||
[browser_perf-overview-selection-01.js]
|
||||
[browser_perf-overview-selection-02.js]
|
||||
[browser_perf-overview-selection-03.js]
|
||||
|
|
|
@ -142,25 +142,27 @@
|
|||
width: 16px;
|
||||
height: 16px;
|
||||
-moz-margin-end: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.security-state-insecure {
|
||||
list-style-image: url(chrome://browser/skin/identity-not-secure.svg);
|
||||
list-style-image: url(chrome://browser/skin/identity-mixed-active-loaded.svg);
|
||||
}
|
||||
|
||||
.security-state-secure {
|
||||
cursor: pointer;
|
||||
list-style-image: url(chrome://browser/skin/identity-secure.svg);
|
||||
}
|
||||
|
||||
.security-state-weak {
|
||||
cursor: pointer;
|
||||
list-style-image: url(chrome://browser/skin/identity-mixed-passive-loaded.svg);
|
||||
}
|
||||
|
||||
.security-state-broken {
|
||||
cursor: pointer;
|
||||
list-style-image: url(chrome://browser/skin/identity-mixed-active-loaded.svg);
|
||||
list-style-image: url(chrome://browser/skin/controlcenter/warning-gray.svg);
|
||||
}
|
||||
|
||||
.security-state-local {
|
||||
list-style-image: url(chrome://browser/skin/identity-not-secure.svg);
|
||||
}
|
||||
|
||||
.requests-menu-type {
|
||||
|
@ -196,7 +198,8 @@ label.requests-menu-status-code {
|
|||
}
|
||||
|
||||
box.requests-menu-status:not([code]) {
|
||||
background-color: var(--theme-content-color2);
|
||||
background-color: var(--theme-highlight-red);
|
||||
border-radius: 0; /* squares */
|
||||
}
|
||||
|
||||
box.requests-menu-status[code="cached"] {
|
||||
|
|
|
@ -767,8 +767,6 @@ See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
|
|||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
|
||||
# Definitions matching sdkddkver.h
|
||||
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
|
||||
AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
|
||||
AC_SUBST(MOZ_WINSDK_MAXVER)
|
||||
;;
|
||||
|
|
|
@ -860,6 +860,10 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
if (!root.messages || !Array.isArray(root.messages) ||
|
||||
root.messages.length == 0) {
|
||||
dump("Could not register invalid system message entry\n");
|
||||
try {
|
||||
dump(JSON.stringify(root.messages) + "\n");
|
||||
} catch(e) {}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -869,7 +873,14 @@ this.DOMApplicationRegistry = {
|
|||
root.messages.forEach(function registerPages(aMessage) {
|
||||
let handlerPageURI = launchPathURI;
|
||||
let messageName;
|
||||
if (typeof(aMessage) === "object" && Object.keys(aMessage).length === 1) {
|
||||
if (typeof(aMessage) !== "object" || Object.keys(aMessage).length !== 1) {
|
||||
dump("Could not register invalid system message entry\n");
|
||||
try {
|
||||
dump(JSON.stringify(aMessage) + "\n");
|
||||
} catch(e) {}
|
||||
return;
|
||||
}
|
||||
|
||||
messageName = Object.keys(aMessage)[0];
|
||||
let handlerPath = aMessage[messageName];
|
||||
// Resolve the handler path from origin. If |handler_path| is absent,
|
||||
|
@ -887,9 +898,6 @@ this.DOMApplicationRegistry = {
|
|||
return;
|
||||
}
|
||||
handlerPageURI = Services.io.newURI(fullHandlerPath, null, null);
|
||||
} else {
|
||||
messageName = aMessage;
|
||||
}
|
||||
|
||||
if (SystemMessagePermissionsChecker
|
||||
.isSystemMessagePermittedToRegister(messageName,
|
||||
|
|
|
@ -17,25 +17,6 @@ extern bool gBluetoothDebugFlag;
|
|||
|
||||
#define SWITCH_BT_DEBUG(V) (gBluetoothDebugFlag = V)
|
||||
|
||||
#if MOZ_IS_GCC
|
||||
# if MOZ_GCC_VERSION_AT_LEAST(4, 7, 0)
|
||||
/* use designated array initializers if supported */
|
||||
# define INIT_ARRAY_AT(in_, out_) \
|
||||
[in_] = out_
|
||||
# else
|
||||
/* otherwise init array element by position */
|
||||
# define INIT_ARRAY_AT(in_, out_) \
|
||||
out_
|
||||
# endif
|
||||
#else
|
||||
/* otherwise init array element by position */
|
||||
#define INIT_ARRAY_AT(in_, out_) \
|
||||
out_
|
||||
#endif
|
||||
|
||||
#define CONVERT(in_, out_) \
|
||||
INIT_ARRAY_AT(in_, out_)
|
||||
|
||||
#undef BT_LOG
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
#include <android/log.h>
|
||||
|
|
|
@ -215,8 +215,10 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> promise;
|
||||
systemMessenger->BroadcastMessage(aType, value,
|
||||
JS::UndefinedHandleValue);
|
||||
JS::UndefinedHandleValue,
|
||||
getter_AddRefs(promise));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -245,8 +247,10 @@ BroadcastSystemMessage(const nsAString& aType,
|
|||
NS_ENSURE_TRUE(systemMessenger, false);
|
||||
|
||||
JS::Rooted<JS::Value> value(cx, JS::ObjectValue(*obj));
|
||||
nsCOMPtr<nsISupports> promise;
|
||||
systemMessenger->BroadcastMessage(aType, value,
|
||||
JS::UndefinedHandleValue);
|
||||
JS::UndefinedHandleValue,
|
||||
getter_AddRefs(promise));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ BluetoothDaemonA2dpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
|||
{
|
||||
static void (BluetoothDaemonA2dpModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::HandleNtf),
|
||||
[0] = &BluetoothDaemonA2dpModule::HandleRsp,
|
||||
[1] = &BluetoothDaemonA2dpModule::HandleNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -145,12 +145,9 @@ BluetoothDaemonA2dpModule::HandleRsp(
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothA2dpResultHandler*) = {
|
||||
INIT_ARRAY_AT(OPCODE_ERROR,
|
||||
&BluetoothDaemonA2dpModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CONNECT,
|
||||
&BluetoothDaemonA2dpModule::ConnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_DISCONNECT,
|
||||
&BluetoothDaemonA2dpModule::DisconnectRsp),
|
||||
[OPCODE_ERROR] = &BluetoothDaemonA2dpModule::ErrorRsp,
|
||||
[OPCODE_CONNECT] = &BluetoothDaemonA2dpModule::ConnectRsp,
|
||||
[OPCODE_DISCONNECT] = &BluetoothDaemonA2dpModule::DisconnectRsp
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
@ -322,10 +319,10 @@ BluetoothDaemonA2dpModule::HandleNtf(
|
|||
{
|
||||
static void (BluetoothDaemonA2dpModule::* const HandleNtf[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonA2dpModule::ConnectionStateNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonA2dpModule::AudioStateNtf),
|
||||
[0] = &BluetoothDaemonA2dpModule::ConnectionStateNtf,
|
||||
[1] = &BluetoothDaemonA2dpModule::AudioStateNtf,
|
||||
#if ANDROID_VERSION >= 21
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonA2dpModule::AudioConfigNtf),
|
||||
[2] = &BluetoothDaemonA2dpModule::AudioConfigNtf
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ BluetoothDaemonAvrcpModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
|||
{
|
||||
static void (BluetoothDaemonAvrcpModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::HandleNtf),
|
||||
[0] = &BluetoothDaemonAvrcpModule::HandleRsp,
|
||||
[1] = &BluetoothDaemonAvrcpModule::HandleNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -427,28 +427,28 @@ BluetoothDaemonAvrcpModule::HandleRsp(
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothAvrcpResultHandler*) = {
|
||||
INIT_ARRAY_AT(OPCODE_ERROR,
|
||||
&BluetoothDaemonAvrcpModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_GET_PLAY_STATUS_RSP,
|
||||
&BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_ATTR_RSP,
|
||||
&BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_LIST_PLAYER_APP_VALUE_RSP,
|
||||
&BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_RSP,
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP,
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP,
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_GET_ELEMENT_ATTR_RSP,
|
||||
&BluetoothDaemonAvrcpModule::GetElementAttrRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SET_PLAYER_APP_VALUE_RSP,
|
||||
&BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_REGISTER_NOTIFICATION_RSP,
|
||||
&BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SET_VOLUME,
|
||||
&BluetoothDaemonAvrcpModule::SetVolumeRsp)
|
||||
[OPCODE_ERROR] =
|
||||
&BluetoothDaemonAvrcpModule::ErrorRsp,
|
||||
[OPCODE_GET_PLAY_STATUS_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::GetPlayStatusRspRsp,
|
||||
[OPCODE_LIST_PLAYER_APP_ATTR_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::ListPlayerAppAttrRspRsp,
|
||||
[OPCODE_LIST_PLAYER_APP_VALUE_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::ListPlayerAppValueRspRsp,
|
||||
[OPCODE_GET_PLAYER_APP_VALUE_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppValueRspRsp,
|
||||
[OPCODE_GET_PLAYER_APP_ATTR_TEXT_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppAttrTextRspRsp,
|
||||
[OPCODE_GET_PLAYER_APP_VALUE_TEXT_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::GetPlayerAppValueTextRspRsp,
|
||||
[OPCODE_GET_ELEMENT_ATTR_RSP]=
|
||||
&BluetoothDaemonAvrcpModule::GetElementAttrRspRsp,
|
||||
[OPCODE_SET_PLAYER_APP_VALUE_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::SetPlayerAppValueRspRsp,
|
||||
[OPCODE_REGISTER_NOTIFICATION_RSP] =
|
||||
&BluetoothDaemonAvrcpModule::RegisterNotificationRspRsp,
|
||||
[OPCODE_SET_VOLUME] =
|
||||
&BluetoothDaemonAvrcpModule::SetVolumeRsp
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
@ -797,28 +797,28 @@ BluetoothDaemonAvrcpModule::HandleNtf(
|
|||
static void (BluetoothDaemonAvrcpModule::* const HandleNtf[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
|
||||
#if ANDROID_VERSION >= 19
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::RemoteFeatureNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
|
||||
INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
|
||||
INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
|
||||
INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
|
||||
INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
|
||||
INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
|
||||
INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
|
||||
INIT_ARRAY_AT(9, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf),
|
||||
INIT_ARRAY_AT(10, &BluetoothDaemonAvrcpModule::VolumeChangeNtf),
|
||||
INIT_ARRAY_AT(11, &BluetoothDaemonAvrcpModule::PassthroughCmdNtf)
|
||||
[0] = &BluetoothDaemonAvrcpModule::RemoteFeatureNtf,
|
||||
[1] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
|
||||
[2] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
|
||||
[3] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
|
||||
[4] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
|
||||
[5] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
|
||||
[6] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
|
||||
[7] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
|
||||
[8] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
|
||||
[9] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf,
|
||||
[10] = &BluetoothDaemonAvrcpModule::VolumeChangeNtf,
|
||||
[11] = &BluetoothDaemonAvrcpModule::PassthroughCmdNtf
|
||||
#else
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonAvrcpModule::GetPlayStatusNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf),
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf),
|
||||
INIT_ARRAY_AT(3, &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf),
|
||||
INIT_ARRAY_AT(4, &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf),
|
||||
INIT_ARRAY_AT(5, &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf),
|
||||
INIT_ARRAY_AT(6, &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf),
|
||||
INIT_ARRAY_AT(7, &BluetoothDaemonAvrcpModule::GetElementAttrNtf),
|
||||
INIT_ARRAY_AT(8, &BluetoothDaemonAvrcpModule::RegisterNotificationNtf)
|
||||
[0] = &BluetoothDaemonAvrcpModule::GetPlayStatusNtf,
|
||||
[1] = &BluetoothDaemonAvrcpModule::ListPlayerAppAttrNtf,
|
||||
[2] = &BluetoothDaemonAvrcpModule::ListPlayerAppValuesNtf,
|
||||
[3] = &BluetoothDaemonAvrcpModule::GetPlayerAppValueNtf,
|
||||
[4] = &BluetoothDaemonAvrcpModule::GetPlayerAppAttrsTextNtf,
|
||||
[5] = &BluetoothDaemonAvrcpModule::GetPlayerAppValuesTextNtf,
|
||||
[6] = &BluetoothDaemonAvrcpModule::SetPlayerAppValueNtf,
|
||||
[7] = &BluetoothDaemonAvrcpModule::GetElementAttrNtf,
|
||||
[8] = &BluetoothDaemonAvrcpModule::RegisterNotificationNtf
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -47,8 +47,8 @@ BluetoothDaemonGattModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
|||
{
|
||||
static void (BluetoothDaemonGattModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::HandleNtf),
|
||||
[0] = &BluetoothDaemonGattModule::HandleRsp,
|
||||
[1] = &BluetoothDaemonGattModule::HandleNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -1411,78 +1411,78 @@ BluetoothDaemonGattModule::HandleRsp(
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothGattResultHandler*) = {
|
||||
INIT_ARRAY_AT(OPCODE_ERROR,
|
||||
&BluetoothDaemonGattModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER,
|
||||
&BluetoothDaemonGattModule::ClientRegisterRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_UNREGISTER,
|
||||
&BluetoothDaemonGattModule::ClientUnregisterRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_SCAN,
|
||||
&BluetoothDaemonGattModule::ClientScanRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_CONNECT,
|
||||
&BluetoothDaemonGattModule::ClientConnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_DISCONNECT,
|
||||
&BluetoothDaemonGattModule::ClientDisconnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_LISTEN,
|
||||
&BluetoothDaemonGattModule::ClientListenRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_REFRESH,
|
||||
&BluetoothDaemonGattModule::ClientRefreshRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_SEARCH_SERVICE,
|
||||
&BluetoothDaemonGattModule::ClientSearchServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_GET_INCLUDED_SERVICE,
|
||||
&BluetoothDaemonGattModule::ClientGetIncludedServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_GET_CHARACTERISTIC,
|
||||
&BluetoothDaemonGattModule::ClientGetCharacteristicRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_GET_DESCRIPTOR,
|
||||
&BluetoothDaemonGattModule::ClientGetDescriptorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_READ_CHARACTERISTIC,
|
||||
&BluetoothDaemonGattModule::ClientReadCharacteristicRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_CHARACTERISTIC,
|
||||
&BluetoothDaemonGattModule::ClientWriteCharacteristicRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_READ_DESCRIPTOR,
|
||||
&BluetoothDaemonGattModule::ClientReadDescriptorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_WRITE_DESCRIPTOR,
|
||||
&BluetoothDaemonGattModule::ClientWriteDescriptorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_EXECUTE_WRITE,
|
||||
&BluetoothDaemonGattModule::ClientExecuteWriteRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_REGISTER_NOTIFICATION,
|
||||
&BluetoothDaemonGattModule::ClientRegisterNotificationRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_DEREGISTER_NOTIFICATION,
|
||||
&BluetoothDaemonGattModule::ClientDeregisterNotificationRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_READ_REMOTE_RSSI,
|
||||
&BluetoothDaemonGattModule::ClientReadRemoteRssiRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_GET_DEVICE_TYPE,
|
||||
&BluetoothDaemonGattModule::ClientGetDeviceTypeRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_SET_ADV_DATA,
|
||||
&BluetoothDaemonGattModule::ClientSetAdvDataRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLIENT_TEST_COMMAND,
|
||||
&BluetoothDaemonGattModule::ClientTestCommandRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_REGISTER,
|
||||
&BluetoothDaemonGattModule::ServerRegisterRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_UNREGISTER,
|
||||
&BluetoothDaemonGattModule::ServerUnregisterRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_CONNECT_PERIPHERAL,
|
||||
&BluetoothDaemonGattModule::ServerConnectPeripheralRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_DISCONNECT_PERIPHERAL,
|
||||
&BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_ADD_SERVICE,
|
||||
&BluetoothDaemonGattModule::ServerAddServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_ADD_INCLUDED_SERVICE,
|
||||
&BluetoothDaemonGattModule::ServerAddIncludedServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_ADD_CHARACTERISTIC,
|
||||
&BluetoothDaemonGattModule::ServerAddCharacteristicRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_ADD_DESCRIPTOR,
|
||||
&BluetoothDaemonGattModule::ServerAddDescriptorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_START_SERVICE,
|
||||
&BluetoothDaemonGattModule::ServerStartServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_STOP_SERVICE,
|
||||
&BluetoothDaemonGattModule::ServerStopServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_DELETE_SERVICE,
|
||||
&BluetoothDaemonGattModule::ServerDeleteServiceRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_SEND_INDICATION,
|
||||
&BluetoothDaemonGattModule::ServerSendIndicationRsp),
|
||||
INIT_ARRAY_AT(OPCODE_SERVER_SEND_RESPONSE,
|
||||
&BluetoothDaemonGattModule::ServerSendResponseRsp)
|
||||
[OPCODE_ERROR] =
|
||||
&BluetoothDaemonGattModule::ErrorRsp,
|
||||
[OPCODE_CLIENT_REGISTER] =
|
||||
&BluetoothDaemonGattModule::ClientRegisterRsp,
|
||||
[OPCODE_CLIENT_UNREGISTER] =
|
||||
&BluetoothDaemonGattModule::ClientUnregisterRsp,
|
||||
[OPCODE_CLIENT_SCAN] =
|
||||
&BluetoothDaemonGattModule::ClientScanRsp,
|
||||
[OPCODE_CLIENT_CONNECT] =
|
||||
&BluetoothDaemonGattModule::ClientConnectRsp,
|
||||
[OPCODE_CLIENT_DISCONNECT] =
|
||||
&BluetoothDaemonGattModule::ClientDisconnectRsp,
|
||||
[OPCODE_CLIENT_LISTEN] =
|
||||
&BluetoothDaemonGattModule::ClientListenRsp,
|
||||
[OPCODE_CLIENT_REFRESH] =
|
||||
&BluetoothDaemonGattModule::ClientRefreshRsp,
|
||||
[OPCODE_CLIENT_SEARCH_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ClientSearchServiceRsp,
|
||||
[OPCODE_CLIENT_GET_INCLUDED_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ClientGetIncludedServiceRsp,
|
||||
[OPCODE_CLIENT_GET_CHARACTERISTIC] =
|
||||
&BluetoothDaemonGattModule::ClientGetCharacteristicRsp,
|
||||
[OPCODE_CLIENT_GET_DESCRIPTOR] =
|
||||
&BluetoothDaemonGattModule::ClientGetDescriptorRsp,
|
||||
[OPCODE_CLIENT_READ_CHARACTERISTIC] =
|
||||
&BluetoothDaemonGattModule::ClientReadCharacteristicRsp,
|
||||
[OPCODE_CLIENT_WRITE_CHARACTERISTIC] =
|
||||
&BluetoothDaemonGattModule::ClientWriteCharacteristicRsp,
|
||||
[OPCODE_CLIENT_READ_DESCRIPTOR] =
|
||||
&BluetoothDaemonGattModule::ClientReadDescriptorRsp,
|
||||
[OPCODE_CLIENT_WRITE_DESCRIPTOR] =
|
||||
&BluetoothDaemonGattModule::ClientWriteDescriptorRsp,
|
||||
[OPCODE_CLIENT_EXECUTE_WRITE] =
|
||||
&BluetoothDaemonGattModule::ClientExecuteWriteRsp,
|
||||
[OPCODE_CLIENT_REGISTER_NOTIFICATION] =
|
||||
&BluetoothDaemonGattModule::ClientRegisterNotificationRsp,
|
||||
[OPCODE_CLIENT_DEREGISTER_NOTIFICATION] =
|
||||
&BluetoothDaemonGattModule::ClientDeregisterNotificationRsp,
|
||||
[OPCODE_CLIENT_READ_REMOTE_RSSI] =
|
||||
&BluetoothDaemonGattModule::ClientReadRemoteRssiRsp,
|
||||
[OPCODE_CLIENT_GET_DEVICE_TYPE] =
|
||||
&BluetoothDaemonGattModule::ClientGetDeviceTypeRsp,
|
||||
[OPCODE_CLIENT_SET_ADV_DATA] =
|
||||
&BluetoothDaemonGattModule::ClientSetAdvDataRsp,
|
||||
[OPCODE_CLIENT_TEST_COMMAND] =
|
||||
&BluetoothDaemonGattModule::ClientTestCommandRsp,
|
||||
[OPCODE_SERVER_REGISTER] =
|
||||
&BluetoothDaemonGattModule::ServerRegisterRsp,
|
||||
[OPCODE_SERVER_UNREGISTER] =
|
||||
&BluetoothDaemonGattModule::ServerUnregisterRsp,
|
||||
[OPCODE_SERVER_CONNECT_PERIPHERAL] =
|
||||
&BluetoothDaemonGattModule::ServerConnectPeripheralRsp,
|
||||
[OPCODE_SERVER_DISCONNECT_PERIPHERAL] =
|
||||
&BluetoothDaemonGattModule::ServerDisconnectPeripheralRsp,
|
||||
[OPCODE_SERVER_ADD_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ServerAddServiceRsp,
|
||||
[OPCODE_SERVER_ADD_INCLUDED_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ServerAddIncludedServiceRsp,
|
||||
[OPCODE_SERVER_ADD_CHARACTERISTIC] =
|
||||
&BluetoothDaemonGattModule::ServerAddCharacteristicRsp,
|
||||
[OPCODE_SERVER_ADD_DESCRIPTOR] =
|
||||
&BluetoothDaemonGattModule::ServerAddDescriptorRsp,
|
||||
[OPCODE_SERVER_START_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ServerStartServiceRsp,
|
||||
[OPCODE_SERVER_STOP_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ServerStopServiceRsp,
|
||||
[OPCODE_SERVER_DELETE_SERVICE] =
|
||||
&BluetoothDaemonGattModule::ServerDeleteServiceRsp,
|
||||
[OPCODE_SERVER_SEND_INDICATION] =
|
||||
&BluetoothDaemonGattModule::ServerSendIndicationRsp,
|
||||
[OPCODE_SERVER_SEND_RESPONSE] =
|
||||
&BluetoothDaemonGattModule::ServerSendResponseRsp
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
@ -2156,37 +2156,37 @@ BluetoothDaemonGattModule::HandleNtf(
|
|||
{
|
||||
static void (BluetoothDaemonGattModule::* const HandleNtf[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonGattModule::ClientRegisterNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonGattModule::ClientScanResultNtf),
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonGattModule::ClientConnectNtf),
|
||||
INIT_ARRAY_AT(3, &BluetoothDaemonGattModule::ClientDisconnectNtf),
|
||||
INIT_ARRAY_AT(4, &BluetoothDaemonGattModule::ClientSearchCompleteNtf),
|
||||
INIT_ARRAY_AT(5, &BluetoothDaemonGattModule::ClientSearchResultNtf),
|
||||
INIT_ARRAY_AT(6, &BluetoothDaemonGattModule::ClientGetCharacteristicNtf),
|
||||
INIT_ARRAY_AT(7, &BluetoothDaemonGattModule::ClientGetDescriptorNtf),
|
||||
INIT_ARRAY_AT(8, &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf),
|
||||
INIT_ARRAY_AT(9, &BluetoothDaemonGattModule::ClientRegisterNotificationNtf),
|
||||
INIT_ARRAY_AT(10, &BluetoothDaemonGattModule::ClientNotifyNtf),
|
||||
INIT_ARRAY_AT(11, &BluetoothDaemonGattModule::ClientReadCharacteristicNtf),
|
||||
INIT_ARRAY_AT(12, &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf),
|
||||
INIT_ARRAY_AT(13, &BluetoothDaemonGattModule::ClientReadDescriptorNtf),
|
||||
INIT_ARRAY_AT(14, &BluetoothDaemonGattModule::ClientWriteDescriptorNtf),
|
||||
INIT_ARRAY_AT(15, &BluetoothDaemonGattModule::ClientExecuteWriteNtf),
|
||||
INIT_ARRAY_AT(16, &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf),
|
||||
INIT_ARRAY_AT(17, &BluetoothDaemonGattModule::ClientListenNtf),
|
||||
INIT_ARRAY_AT(18, &BluetoothDaemonGattModule::ServerRegisterNtf),
|
||||
INIT_ARRAY_AT(19, &BluetoothDaemonGattModule::ServerConnectionNtf),
|
||||
INIT_ARRAY_AT(20, &BluetoothDaemonGattModule::ServerServiceAddedNtf),
|
||||
INIT_ARRAY_AT(21, &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf),
|
||||
INIT_ARRAY_AT(22, &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf),
|
||||
INIT_ARRAY_AT(23, &BluetoothDaemonGattModule::ServerDescriptorAddedNtf),
|
||||
INIT_ARRAY_AT(24, &BluetoothDaemonGattModule::ServerServiceStartedNtf),
|
||||
INIT_ARRAY_AT(25, &BluetoothDaemonGattModule::ServerServiceStoppedNtf),
|
||||
INIT_ARRAY_AT(26, &BluetoothDaemonGattModule::ServerServiceDeletedNtf),
|
||||
INIT_ARRAY_AT(27, &BluetoothDaemonGattModule::ServerRequestReadNtf),
|
||||
INIT_ARRAY_AT(28, &BluetoothDaemonGattModule::ServerRequestWriteNtf),
|
||||
INIT_ARRAY_AT(29, &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf),
|
||||
INIT_ARRAY_AT(30, &BluetoothDaemonGattModule::ServerResponseConfirmationNtf)
|
||||
[0] = &BluetoothDaemonGattModule::ClientRegisterNtf,
|
||||
[1] = &BluetoothDaemonGattModule::ClientScanResultNtf,
|
||||
[2] = &BluetoothDaemonGattModule::ClientConnectNtf,
|
||||
[3] = &BluetoothDaemonGattModule::ClientDisconnectNtf,
|
||||
[4] = &BluetoothDaemonGattModule::ClientSearchCompleteNtf,
|
||||
[5] = &BluetoothDaemonGattModule::ClientSearchResultNtf,
|
||||
[6] = &BluetoothDaemonGattModule::ClientGetCharacteristicNtf,
|
||||
[7] = &BluetoothDaemonGattModule::ClientGetDescriptorNtf,
|
||||
[8] = &BluetoothDaemonGattModule::ClientGetIncludedServiceNtf,
|
||||
[9] = &BluetoothDaemonGattModule::ClientRegisterNotificationNtf,
|
||||
[10] = &BluetoothDaemonGattModule::ClientNotifyNtf,
|
||||
[11] = &BluetoothDaemonGattModule::ClientReadCharacteristicNtf,
|
||||
[12] = &BluetoothDaemonGattModule::ClientWriteCharacteristicNtf,
|
||||
[13] = &BluetoothDaemonGattModule::ClientReadDescriptorNtf,
|
||||
[14] = &BluetoothDaemonGattModule::ClientWriteDescriptorNtf,
|
||||
[15] = &BluetoothDaemonGattModule::ClientExecuteWriteNtf,
|
||||
[16] = &BluetoothDaemonGattModule::ClientReadRemoteRssiNtf,
|
||||
[17] = &BluetoothDaemonGattModule::ClientListenNtf,
|
||||
[18] = &BluetoothDaemonGattModule::ServerRegisterNtf,
|
||||
[19] = &BluetoothDaemonGattModule::ServerConnectionNtf,
|
||||
[20] = &BluetoothDaemonGattModule::ServerServiceAddedNtf,
|
||||
[21] = &BluetoothDaemonGattModule::ServerIncludedServiceAddedNtf,
|
||||
[22] = &BluetoothDaemonGattModule::ServerCharacteristicAddedNtf,
|
||||
[23] = &BluetoothDaemonGattModule::ServerDescriptorAddedNtf,
|
||||
[24] = &BluetoothDaemonGattModule::ServerServiceStartedNtf,
|
||||
[25] = &BluetoothDaemonGattModule::ServerServiceStoppedNtf,
|
||||
[26] = &BluetoothDaemonGattModule::ServerServiceDeletedNtf,
|
||||
[27] = &BluetoothDaemonGattModule::ServerRequestReadNtf,
|
||||
[28] = &BluetoothDaemonGattModule::ServerRequestWriteNtf,
|
||||
[29] = &BluetoothDaemonGattModule::ServerRequestExecuteWriteNtf,
|
||||
[30] = &BluetoothDaemonGattModule::ServerResponseConfirmationNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
|
|
@ -50,8 +50,8 @@ BluetoothDaemonHandsfreeModule::HandleSvc(
|
|||
{
|
||||
static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::HandleNtf),
|
||||
[0] = &BluetoothDaemonHandsfreeModule::HandleRsp,
|
||||
[1] = &BluetoothDaemonHandsfreeModule::HandleNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -685,38 +685,38 @@ BluetoothDaemonHandsfreeModule::HandleRsp(
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothHandsfreeResultHandler*) = {
|
||||
INIT_ARRAY_AT(OPCODE_ERROR,
|
||||
&BluetoothDaemonHandsfreeModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CONNECT,
|
||||
&BluetoothDaemonHandsfreeModule::ConnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_DISCONNECT,
|
||||
&BluetoothDaemonHandsfreeModule::DisconnectRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CONNECT_AUDIO,
|
||||
&BluetoothDaemonHandsfreeModule::ConnectAudioRsp),
|
||||
INIT_ARRAY_AT(OPCODE_DISCONNECT_AUDIO,
|
||||
&BluetoothDaemonHandsfreeModule::DisconnectAudioRsp),
|
||||
INIT_ARRAY_AT(OPCODE_START_VOICE_RECOGNITION,
|
||||
&BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp),
|
||||
INIT_ARRAY_AT(OPCODE_STOP_VOICE_RECOGNITION,
|
||||
&BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp),
|
||||
INIT_ARRAY_AT(OPCODE_VOLUME_CONTROL,
|
||||
&BluetoothDaemonHandsfreeModule::VolumeControlRsp),
|
||||
INIT_ARRAY_AT(OPCODE_DEVICE_STATUS_NOTIFICATION,
|
||||
&BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp),
|
||||
INIT_ARRAY_AT(OPCODE_COPS_RESPONSE,
|
||||
&BluetoothDaemonHandsfreeModule::CopsResponseRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CIND_RESPONSE,
|
||||
&BluetoothDaemonHandsfreeModule::CindResponseRsp),
|
||||
INIT_ARRAY_AT(OPCODE_FORMATTED_AT_RESPONSE,
|
||||
&BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp),
|
||||
INIT_ARRAY_AT(OPCODE_AT_RESPONSE,
|
||||
&BluetoothDaemonHandsfreeModule::AtResponseRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CLCC_RESPONSE,
|
||||
&BluetoothDaemonHandsfreeModule::ClccResponseRsp),
|
||||
INIT_ARRAY_AT(OPCODE_PHONE_STATE_CHANGE,
|
||||
&BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp),
|
||||
INIT_ARRAY_AT(OPCODE_CONFIGURE_WBS,
|
||||
&BluetoothDaemonHandsfreeModule::ConfigureWbsRsp)
|
||||
[OPCODE_ERROR] =
|
||||
&BluetoothDaemonHandsfreeModule::ErrorRsp,
|
||||
[OPCODE_CONNECT] =
|
||||
&BluetoothDaemonHandsfreeModule::ConnectRsp,
|
||||
[OPCODE_DISCONNECT] =
|
||||
&BluetoothDaemonHandsfreeModule::DisconnectRsp,
|
||||
[OPCODE_CONNECT_AUDIO] =
|
||||
&BluetoothDaemonHandsfreeModule::ConnectAudioRsp,
|
||||
[OPCODE_DISCONNECT_AUDIO] =
|
||||
&BluetoothDaemonHandsfreeModule::DisconnectAudioRsp,
|
||||
[OPCODE_START_VOICE_RECOGNITION] =
|
||||
&BluetoothDaemonHandsfreeModule::StartVoiceRecognitionRsp,
|
||||
[OPCODE_STOP_VOICE_RECOGNITION] =
|
||||
&BluetoothDaemonHandsfreeModule::StopVoiceRecognitionRsp,
|
||||
[OPCODE_VOLUME_CONTROL] =
|
||||
&BluetoothDaemonHandsfreeModule::VolumeControlRsp,
|
||||
[OPCODE_DEVICE_STATUS_NOTIFICATION] =
|
||||
&BluetoothDaemonHandsfreeModule::DeviceStatusNotificationRsp,
|
||||
[OPCODE_COPS_RESPONSE] =
|
||||
&BluetoothDaemonHandsfreeModule::CopsResponseRsp,
|
||||
[OPCODE_CIND_RESPONSE] =
|
||||
&BluetoothDaemonHandsfreeModule::CindResponseRsp,
|
||||
[OPCODE_FORMATTED_AT_RESPONSE] =
|
||||
&BluetoothDaemonHandsfreeModule::FormattedAtResponseRsp,
|
||||
[OPCODE_AT_RESPONSE] =
|
||||
&BluetoothDaemonHandsfreeModule::AtResponseRsp,
|
||||
[OPCODE_CLCC_RESPONSE] =
|
||||
&BluetoothDaemonHandsfreeModule::ClccResponseRsp,
|
||||
[OPCODE_PHONE_STATE_CHANGE] =
|
||||
&BluetoothDaemonHandsfreeModule::PhoneStateChangeRsp,
|
||||
[OPCODE_CONFIGURE_WBS] =
|
||||
&BluetoothDaemonHandsfreeModule::ConfigureWbsRsp
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
@ -1426,22 +1426,22 @@ BluetoothDaemonHandsfreeModule::HandleNtf(
|
|||
{
|
||||
static void (BluetoothDaemonHandsfreeModule::* const HandleNtf[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonHandsfreeModule::ConnectionStateNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonHandsfreeModule::AudioStateNtf),
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf),
|
||||
INIT_ARRAY_AT(3, &BluetoothDaemonHandsfreeModule::AnswerCallNtf),
|
||||
INIT_ARRAY_AT(4, &BluetoothDaemonHandsfreeModule::HangupCallNtf),
|
||||
INIT_ARRAY_AT(5, &BluetoothDaemonHandsfreeModule::VolumeNtf),
|
||||
INIT_ARRAY_AT(6, &BluetoothDaemonHandsfreeModule::DialCallNtf),
|
||||
INIT_ARRAY_AT(7, &BluetoothDaemonHandsfreeModule::DtmfNtf),
|
||||
INIT_ARRAY_AT(8, &BluetoothDaemonHandsfreeModule::NRECNtf),
|
||||
INIT_ARRAY_AT(9, &BluetoothDaemonHandsfreeModule::CallHoldNtf),
|
||||
INIT_ARRAY_AT(10, &BluetoothDaemonHandsfreeModule::CnumNtf),
|
||||
INIT_ARRAY_AT(11, &BluetoothDaemonHandsfreeModule::CindNtf),
|
||||
INIT_ARRAY_AT(12, &BluetoothDaemonHandsfreeModule::CopsNtf),
|
||||
INIT_ARRAY_AT(13, &BluetoothDaemonHandsfreeModule::ClccNtf),
|
||||
INIT_ARRAY_AT(14, &BluetoothDaemonHandsfreeModule::UnknownAtNtf),
|
||||
INIT_ARRAY_AT(15, &BluetoothDaemonHandsfreeModule::KeyPressedNtf)
|
||||
[0] = &BluetoothDaemonHandsfreeModule::ConnectionStateNtf,
|
||||
[1] = &BluetoothDaemonHandsfreeModule::AudioStateNtf,
|
||||
[2] = &BluetoothDaemonHandsfreeModule::VoiceRecognitionNtf,
|
||||
[3] = &BluetoothDaemonHandsfreeModule::AnswerCallNtf,
|
||||
[4] = &BluetoothDaemonHandsfreeModule::HangupCallNtf,
|
||||
[5] = &BluetoothDaemonHandsfreeModule::VolumeNtf,
|
||||
[6] = &BluetoothDaemonHandsfreeModule::DialCallNtf,
|
||||
[7] = &BluetoothDaemonHandsfreeModule::DtmfNtf,
|
||||
[8] = &BluetoothDaemonHandsfreeModule::NRECNtf,
|
||||
[9] = &BluetoothDaemonHandsfreeModule::CallHoldNtf,
|
||||
[10] = &BluetoothDaemonHandsfreeModule::CnumNtf,
|
||||
[11] = &BluetoothDaemonHandsfreeModule::CindNtf,
|
||||
[12] = &BluetoothDaemonHandsfreeModule::CopsNtf,
|
||||
[13] = &BluetoothDaemonHandsfreeModule::ClccNtf,
|
||||
[14] = &BluetoothDaemonHandsfreeModule::UnknownAtNtf,
|
||||
[15] = &BluetoothDaemonHandsfreeModule::KeyPressedNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
|
|
@ -22,8 +22,8 @@ nsresult
|
|||
Convert(bool aIn, BluetoothScanMode& aOut)
|
||||
{
|
||||
static const BluetoothScanMode sScanMode[] = {
|
||||
CONVERT(false, SCAN_MODE_CONNECTABLE),
|
||||
CONVERT(true, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
|
||||
[false] = SCAN_MODE_CONNECTABLE,
|
||||
[true] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
|
||||
aOut = SCAN_MODE_NONE; // silences compiler warning
|
||||
|
@ -37,10 +37,10 @@ nsresult
|
|||
Convert(int32_t aIn, BluetoothTypeOfDevice& aOut)
|
||||
{
|
||||
static const BluetoothTypeOfDevice sTypeOfDevice[] = {
|
||||
CONVERT(0x00, static_cast<BluetoothTypeOfDevice>(0)), // invalid, required by gcc
|
||||
CONVERT(0x01, TYPE_OF_DEVICE_BREDR),
|
||||
CONVERT(0x02, TYPE_OF_DEVICE_BLE),
|
||||
CONVERT(0x03, TYPE_OF_DEVICE_DUAL)
|
||||
[0x00] = static_cast<BluetoothTypeOfDevice>(0), // invalid, required by gcc
|
||||
[0x01] = TYPE_OF_DEVICE_BREDR,
|
||||
[0x02] = TYPE_OF_DEVICE_BLE,
|
||||
[0x03] = TYPE_OF_DEVICE_DUAL
|
||||
};
|
||||
if (NS_WARN_IF(!aIn) ||
|
||||
NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sTypeOfDevice))) {
|
||||
|
@ -54,9 +54,9 @@ nsresult
|
|||
Convert(int32_t aIn, BluetoothScanMode& aOut)
|
||||
{
|
||||
static const BluetoothScanMode sScanMode[] = {
|
||||
CONVERT(0x00, SCAN_MODE_NONE),
|
||||
CONVERT(0x01, SCAN_MODE_CONNECTABLE),
|
||||
CONVERT(0x02, SCAN_MODE_CONNECTABLE_DISCOVERABLE)
|
||||
[0x00] = SCAN_MODE_NONE,
|
||||
[0x01] = SCAN_MODE_CONNECTABLE,
|
||||
[0x02] = SCAN_MODE_CONNECTABLE_DISCOVERABLE
|
||||
};
|
||||
if (NS_WARN_IF(aIn < 0) ||
|
||||
NS_WARN_IF(static_cast<size_t>(aIn) >= MOZ_ARRAY_LENGTH(sScanMode))) {
|
||||
|
@ -70,9 +70,9 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothA2dpAudioState& aOut)
|
||||
{
|
||||
static const BluetoothA2dpAudioState sAudioState[] = {
|
||||
CONVERT(0x00, A2DP_AUDIO_STATE_REMOTE_SUSPEND),
|
||||
CONVERT(0x01, A2DP_AUDIO_STATE_STOPPED),
|
||||
CONVERT(0x02, A2DP_AUDIO_STATE_STARTED)
|
||||
[0x00] = A2DP_AUDIO_STATE_REMOTE_SUSPEND,
|
||||
[0x01] = A2DP_AUDIO_STATE_STOPPED,
|
||||
[0x02] = A2DP_AUDIO_STATE_STARTED
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -85,10 +85,10 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothA2dpConnectionState& aOut)
|
||||
{
|
||||
static const BluetoothA2dpConnectionState sConnectionState[] = {
|
||||
CONVERT(0x00, A2DP_CONNECTION_STATE_DISCONNECTED),
|
||||
CONVERT(0x01, A2DP_CONNECTION_STATE_CONNECTING),
|
||||
CONVERT(0x02, A2DP_CONNECTION_STATE_CONNECTED),
|
||||
CONVERT(0x03, A2DP_CONNECTION_STATE_DISCONNECTING)
|
||||
[0x00] = A2DP_CONNECTION_STATE_DISCONNECTED,
|
||||
[0x01] = A2DP_CONNECTION_STATE_CONNECTING,
|
||||
[0x02] = A2DP_CONNECTION_STATE_CONNECTED,
|
||||
[0x03] = A2DP_CONNECTION_STATE_DISCONNECTING
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -101,8 +101,8 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothAclState& aOut)
|
||||
{
|
||||
static const BluetoothAclState sAclState[] = {
|
||||
CONVERT(0x00, ACL_STATE_CONNECTED),
|
||||
CONVERT(0x01, ACL_STATE_DISCONNECTED),
|
||||
[0x00] = ACL_STATE_CONNECTED,
|
||||
[0x01] = ACL_STATE_DISCONNECTED
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAclState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -115,15 +115,15 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothAvrcpEvent& aOut)
|
||||
{
|
||||
static const BluetoothAvrcpEvent sAvrcpEvent[] = {
|
||||
CONVERT(0x00, static_cast<BluetoothAvrcpEvent>(0)),
|
||||
CONVERT(0x01, AVRCP_EVENT_PLAY_STATUS_CHANGED),
|
||||
CONVERT(0x02, AVRCP_EVENT_TRACK_CHANGE),
|
||||
CONVERT(0x03, AVRCP_EVENT_TRACK_REACHED_END),
|
||||
CONVERT(0x04, AVRCP_EVENT_TRACK_REACHED_START),
|
||||
CONVERT(0x05, AVRCP_EVENT_PLAY_POS_CHANGED),
|
||||
CONVERT(0x06, static_cast<BluetoothAvrcpEvent>(0)),
|
||||
CONVERT(0x07, static_cast<BluetoothAvrcpEvent>(0)),
|
||||
CONVERT(0x08, AVRCP_EVENT_APP_SETTINGS_CHANGED)
|
||||
[0x00] = static_cast<BluetoothAvrcpEvent>(0),
|
||||
[0x01] = AVRCP_EVENT_PLAY_STATUS_CHANGED,
|
||||
[0x02] = AVRCP_EVENT_TRACK_CHANGE,
|
||||
[0x03] = AVRCP_EVENT_TRACK_REACHED_END,
|
||||
[0x04] = AVRCP_EVENT_TRACK_REACHED_START,
|
||||
[0x05] = AVRCP_EVENT_PLAY_POS_CHANGED,
|
||||
[0x06] = static_cast<BluetoothAvrcpEvent>(0),
|
||||
[0x07] = static_cast<BluetoothAvrcpEvent>(0),
|
||||
[0x08] = AVRCP_EVENT_APP_SETTINGS_CHANGED
|
||||
};
|
||||
if (NS_WARN_IF(!aIn) ||
|
||||
NS_WARN_IF(aIn == 0x06) ||
|
||||
|
@ -140,14 +140,14 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothAvrcpMediaAttribute& aOut)
|
||||
{
|
||||
static const BluetoothAvrcpMediaAttribute sAvrcpMediaAttribute[] = {
|
||||
CONVERT(0x00, static_cast<BluetoothAvrcpMediaAttribute>(0)),
|
||||
CONVERT(0x01, AVRCP_MEDIA_ATTRIBUTE_TITLE),
|
||||
CONVERT(0x02, AVRCP_MEDIA_ATTRIBUTE_ARTIST),
|
||||
CONVERT(0x03, AVRCP_MEDIA_ATTRIBUTE_ALBUM),
|
||||
CONVERT(0x04, AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM),
|
||||
CONVERT(0x05, AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS),
|
||||
CONVERT(0x06, AVRCP_MEDIA_ATTRIBUTE_GENRE),
|
||||
CONVERT(0x07, AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME)
|
||||
[0x00] = static_cast<BluetoothAvrcpMediaAttribute>(0),
|
||||
[0x01] = AVRCP_MEDIA_ATTRIBUTE_TITLE,
|
||||
[0x02] = AVRCP_MEDIA_ATTRIBUTE_ARTIST,
|
||||
[0x03] = AVRCP_MEDIA_ATTRIBUTE_ALBUM,
|
||||
[0x04] = AVRCP_MEDIA_ATTRIBUTE_TRACK_NUM,
|
||||
[0x05] = AVRCP_MEDIA_ATTRIBUTE_NUM_TRACKS,
|
||||
[0x06] = AVRCP_MEDIA_ATTRIBUTE_GENRE,
|
||||
[0x07] = AVRCP_MEDIA_ATTRIBUTE_PLAYING_TIME
|
||||
};
|
||||
if (NS_WARN_IF(!aIn) ||
|
||||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpMediaAttribute))) {
|
||||
|
@ -163,11 +163,11 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothAvrcpPlayerAttribute& aOut)
|
||||
{
|
||||
static const BluetoothAvrcpPlayerAttribute sAvrcpPlayerAttribute[] = {
|
||||
CONVERT(0x00, static_cast<BluetoothAvrcpPlayerAttribute>(0)),
|
||||
CONVERT(0x01, AVRCP_PLAYER_ATTRIBUTE_EQUALIZER),
|
||||
CONVERT(0x02, AVRCP_PLAYER_ATTRIBUTE_REPEAT),
|
||||
CONVERT(0x03, AVRCP_PLAYER_ATTRIBUTE_SHUFFLE),
|
||||
CONVERT(0x04, AVRCP_PLAYER_ATTRIBUTE_SCAN)
|
||||
[0x00] = static_cast<BluetoothAvrcpPlayerAttribute>(0),
|
||||
[0x01] = AVRCP_PLAYER_ATTRIBUTE_EQUALIZER,
|
||||
[0x02] = AVRCP_PLAYER_ATTRIBUTE_REPEAT,
|
||||
[0x03] = AVRCP_PLAYER_ATTRIBUTE_SHUFFLE,
|
||||
[0x04] = AVRCP_PLAYER_ATTRIBUTE_SCAN
|
||||
};
|
||||
if (NS_WARN_IF(!aIn) ||
|
||||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpPlayerAttribute))) {
|
||||
|
@ -183,10 +183,10 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothAvrcpRemoteFeature& aOut)
|
||||
{
|
||||
static const BluetoothAvrcpRemoteFeature sAvrcpRemoteFeature[] = {
|
||||
CONVERT(0x00, AVRCP_REMOTE_FEATURE_NONE),
|
||||
CONVERT(0x01, AVRCP_REMOTE_FEATURE_METADATA),
|
||||
CONVERT(0x02, AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME),
|
||||
CONVERT(0x03, AVRCP_REMOTE_FEATURE_BROWSE)
|
||||
[0x00] = AVRCP_REMOTE_FEATURE_NONE,
|
||||
[0x01] = AVRCP_REMOTE_FEATURE_METADATA,
|
||||
[0x02] = AVRCP_REMOTE_FEATURE_ABSOLUTE_VOLUME,
|
||||
[0x03] = AVRCP_REMOTE_FEATURE_BROWSE
|
||||
};
|
||||
if (NS_WARN_IF(!aIn) ||
|
||||
NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature))) {
|
||||
|
@ -202,9 +202,9 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothBondState& aOut)
|
||||
{
|
||||
static const BluetoothBondState sBondState[] = {
|
||||
CONVERT(0x00, BOND_STATE_NONE),
|
||||
CONVERT(0x01, BOND_STATE_BONDING),
|
||||
CONVERT(0x02, BOND_STATE_BONDED)
|
||||
[0x00] = BOND_STATE_NONE,
|
||||
[0x01] = BOND_STATE_BONDING,
|
||||
[0x02] = BOND_STATE_BONDED
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBondState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -217,10 +217,10 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeAudioState& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeAudioState sAudioState[] = {
|
||||
CONVERT(0x00, HFP_AUDIO_STATE_DISCONNECTED),
|
||||
CONVERT(0x01, HFP_AUDIO_STATE_CONNECTING),
|
||||
CONVERT(0x02, HFP_AUDIO_STATE_CONNECTED),
|
||||
CONVERT(0x03, HFP_AUDIO_STATE_DISCONNECTING)
|
||||
[0x00] = HFP_AUDIO_STATE_DISCONNECTED,
|
||||
[0x01] = HFP_AUDIO_STATE_CONNECTING,
|
||||
[0x02] = HFP_AUDIO_STATE_CONNECTED,
|
||||
[0x03] = HFP_AUDIO_STATE_DISCONNECTING
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAudioState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -233,10 +233,10 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeCallHoldType& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeCallHoldType sCallHoldType[] = {
|
||||
CONVERT(0x00, HFP_CALL_HOLD_RELEASEHELD),
|
||||
CONVERT(0x01, HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD),
|
||||
CONVERT(0x02, HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD),
|
||||
CONVERT(0x03, HFP_CALL_HOLD_ADDHELDTOCONF)
|
||||
[0x00] = HFP_CALL_HOLD_RELEASEHELD,
|
||||
[0x01] = HFP_CALL_HOLD_RELEASEACTIVE_ACCEPTHELD,
|
||||
[0x02] = HFP_CALL_HOLD_HOLDACTIVE_ACCEPTHELD,
|
||||
[0x03] = HFP_CALL_HOLD_ADDHELDTOCONF
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallHoldType))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -249,11 +249,11 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeConnectionState& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeConnectionState sConnectionState[] = {
|
||||
CONVERT(0x00, HFP_CONNECTION_STATE_DISCONNECTED),
|
||||
CONVERT(0x01, HFP_CONNECTION_STATE_CONNECTING),
|
||||
CONVERT(0x02, HFP_CONNECTION_STATE_CONNECTED),
|
||||
CONVERT(0x03, HFP_CONNECTION_STATE_SLC_CONNECTED),
|
||||
CONVERT(0x04, HFP_CONNECTION_STATE_DISCONNECTING)
|
||||
[0x00] = HFP_CONNECTION_STATE_DISCONNECTED,
|
||||
[0x01] = HFP_CONNECTION_STATE_CONNECTING,
|
||||
[0x02] = HFP_CONNECTION_STATE_CONNECTED,
|
||||
[0x03] = HFP_CONNECTION_STATE_SLC_CONNECTED,
|
||||
[0x04] = HFP_CONNECTION_STATE_DISCONNECTING
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sConnectionState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -266,8 +266,8 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeNRECState& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeNRECState sNRECState[] = {
|
||||
CONVERT(0x00, HFP_NREC_STOPPED),
|
||||
CONVERT(0x01, HFP_NREC_STARTED)
|
||||
[0x00] = HFP_NREC_STOPPED,
|
||||
[0x01] = HFP_NREC_STARTED
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNRECState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -280,8 +280,8 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeVoiceRecognitionState& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeVoiceRecognitionState sState[] = {
|
||||
CONVERT(0x00, HFP_VOICE_RECOGNITION_STOPPED),
|
||||
CONVERT(0x01, HFP_VOICE_RECOGNITION_STOPPED)
|
||||
[0x00] = HFP_VOICE_RECOGNITION_STOPPED,
|
||||
[0x01] = HFP_VOICE_RECOGNITION_STARTED
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sState))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -294,8 +294,8 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeVolumeType& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeVolumeType sVolumeType[] = {
|
||||
CONVERT(0x00, HFP_VOLUME_TYPE_SPEAKER),
|
||||
CONVERT(0x01, HFP_VOLUME_TYPE_MICROPHONE)
|
||||
[0x00] = HFP_VOLUME_TYPE_SPEAKER,
|
||||
[0x01] = HFP_VOLUME_TYPE_MICROPHONE
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -308,9 +308,9 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothHandsfreeWbsConfig& aOut)
|
||||
{
|
||||
static const BluetoothHandsfreeWbsConfig sWbsConfig[] = {
|
||||
CONVERT(0x00, HFP_WBS_NONE),
|
||||
CONVERT(0x01, HFP_WBS_NO),
|
||||
CONVERT(0x02, HFP_WBS_YES)
|
||||
[0x00] = HFP_WBS_NONE,
|
||||
[0x01] = HFP_WBS_NO,
|
||||
[0x02] = HFP_WBS_YES
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -329,19 +329,19 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothPropertyType& aOut)
|
||||
{
|
||||
static const BluetoothPropertyType sPropertyType[] = {
|
||||
CONVERT(0x00, static_cast<BluetoothPropertyType>(0)), // invalid, required by gcc
|
||||
CONVERT(0x01, PROPERTY_BDNAME),
|
||||
CONVERT(0x02, PROPERTY_BDADDR),
|
||||
CONVERT(0x03, PROPERTY_UUIDS),
|
||||
CONVERT(0x04, PROPERTY_CLASS_OF_DEVICE),
|
||||
CONVERT(0x05, PROPERTY_TYPE_OF_DEVICE),
|
||||
CONVERT(0x06, PROPERTY_SERVICE_RECORD),
|
||||
CONVERT(0x07, PROPERTY_ADAPTER_SCAN_MODE),
|
||||
CONVERT(0x08, PROPERTY_ADAPTER_BONDED_DEVICES),
|
||||
CONVERT(0x09, PROPERTY_ADAPTER_DISCOVERY_TIMEOUT),
|
||||
CONVERT(0x0a, PROPERTY_REMOTE_FRIENDLY_NAME),
|
||||
CONVERT(0x0b, PROPERTY_REMOTE_RSSI),
|
||||
CONVERT(0x0c, PROPERTY_REMOTE_VERSION_INFO)
|
||||
[0x00] = static_cast<BluetoothPropertyType>(0), // invalid, required by gcc
|
||||
[0x01] = PROPERTY_BDNAME,
|
||||
[0x02] = PROPERTY_BDADDR,
|
||||
[0x03] = PROPERTY_UUIDS,
|
||||
[0x04] = PROPERTY_CLASS_OF_DEVICE,
|
||||
[0x05] = PROPERTY_TYPE_OF_DEVICE,
|
||||
[0x06] = PROPERTY_SERVICE_RECORD,
|
||||
[0x07] = PROPERTY_ADAPTER_SCAN_MODE,
|
||||
[0x08] = PROPERTY_ADAPTER_BONDED_DEVICES,
|
||||
[0x09] = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
|
||||
[0x0a] = PROPERTY_REMOTE_FRIENDLY_NAME,
|
||||
[0x0b] = PROPERTY_REMOTE_RSSI,
|
||||
[0x0c] = PROPERTY_REMOTE_VERSION_INFO
|
||||
};
|
||||
if (aIn == 0xff) {
|
||||
/* This case is handled separately to not populate
|
||||
|
@ -361,10 +361,10 @@ nsresult
|
|||
Convert(BluetoothSocketType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sSocketType[] = {
|
||||
CONVERT(0, 0), // silences compiler warning
|
||||
CONVERT(BluetoothSocketType::RFCOMM, 0x01),
|
||||
CONVERT(BluetoothSocketType::SCO, 0x02),
|
||||
CONVERT(BluetoothSocketType::L2CAP, 0x03)
|
||||
[0] = 0, // silences compiler warning
|
||||
[BluetoothSocketType::RFCOMM] = 0x01,
|
||||
[BluetoothSocketType::SCO] = 0x02,
|
||||
[BluetoothSocketType::L2CAP] = 0x03
|
||||
// EL2CAP not supported
|
||||
};
|
||||
if (NS_WARN_IF(aIn == BluetoothSocketType::EL2CAP) ||
|
||||
|
@ -381,10 +381,10 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothSspVariant& aOut)
|
||||
{
|
||||
static const BluetoothSspVariant sSspVariant[] = {
|
||||
CONVERT(0x00, SSP_VARIANT_PASSKEY_CONFIRMATION),
|
||||
CONVERT(0x01, SSP_VARIANT_PASSKEY_ENTRY),
|
||||
CONVERT(0x02, SSP_VARIANT_CONSENT),
|
||||
CONVERT(0x03, SSP_VARIANT_PASSKEY_NOTIFICATION)
|
||||
[0x00] = SSP_VARIANT_PASSKEY_CONFIRMATION,
|
||||
[0x01] = SSP_VARIANT_PASSKEY_ENTRY,
|
||||
[0x02] = SSP_VARIANT_CONSENT,
|
||||
[0x03] = SSP_VARIANT_PASSKEY_NOTIFICATION
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sSspVariant))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -397,17 +397,17 @@ nsresult
|
|||
Convert(uint8_t aIn, BluetoothStatus& aOut)
|
||||
{
|
||||
static const BluetoothStatus sStatus[] = {
|
||||
CONVERT(0x00, STATUS_SUCCESS),
|
||||
CONVERT(0x01, STATUS_FAIL),
|
||||
CONVERT(0x02, STATUS_NOT_READY),
|
||||
CONVERT(0x03, STATUS_NOMEM),
|
||||
CONVERT(0x04, STATUS_BUSY),
|
||||
CONVERT(0x05, STATUS_DONE),
|
||||
CONVERT(0x06, STATUS_UNSUPPORTED),
|
||||
CONVERT(0x07, STATUS_PARM_INVALID),
|
||||
CONVERT(0x08, STATUS_UNHANDLED),
|
||||
CONVERT(0x09, STATUS_AUTH_FAILURE),
|
||||
CONVERT(0x0a, STATUS_RMT_DEV_DOWN)
|
||||
[0x00] = STATUS_SUCCESS,
|
||||
[0x01] = STATUS_FAIL,
|
||||
[0x02] = STATUS_NOT_READY,
|
||||
[0x03] = STATUS_NOMEM,
|
||||
[0x04] = STATUS_BUSY,
|
||||
[0x05] = STATUS_DONE,
|
||||
[0x06] = STATUS_UNSUPPORTED,
|
||||
[0x07] = STATUS_PARM_INVALID,
|
||||
[0x08] = STATUS_UNHANDLED,
|
||||
[0x09] = STATUS_AUTH_FAILURE,
|
||||
[0x0a] = STATUS_RMT_DEV_DOWN
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sStatus))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -421,24 +421,24 @@ Convert(int32_t aIn, BluetoothGattStatus& aOut)
|
|||
{
|
||||
/* Reference: $B2G/external/bluetooth/bluedroid/stack/include/gatt_api.h */
|
||||
static const BluetoothGattStatus sGattStatus[] = {
|
||||
CONVERT(0x0000, GATT_STATUS_SUCCESS),
|
||||
CONVERT(0x0001, GATT_STATUS_INVALID_HANDLE),
|
||||
CONVERT(0x0002, GATT_STATUS_READ_NOT_PERMITTED),
|
||||
CONVERT(0x0003, GATT_STATUS_WRITE_NOT_PERMITTED),
|
||||
CONVERT(0x0004, GATT_STATUS_INVALID_PDU),
|
||||
CONVERT(0x0005, GATT_STATUS_INSUFFICIENT_AUTHENTICATION),
|
||||
CONVERT(0x0006, GATT_STATUS_REQUEST_NOT_SUPPORTED),
|
||||
CONVERT(0x0007, GATT_STATUS_INVALID_OFFSET),
|
||||
CONVERT(0x0008, GATT_STATUS_INSUFFICIENT_AUTHORIZATION),
|
||||
CONVERT(0x0009, GATT_STATUS_PREPARE_QUEUE_FULL),
|
||||
CONVERT(0x000a, GATT_STATUS_ATTRIBUTE_NOT_FOUND),
|
||||
CONVERT(0x000b, GATT_STATUS_ATTRIBUTE_NOT_LONG),
|
||||
CONVERT(0x000c, GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE),
|
||||
CONVERT(0x000d, GATT_STATUS_INVALID_ATTRIBUTE_LENGTH),
|
||||
CONVERT(0x000e, GATT_STATUS_UNLIKELY_ERROR),
|
||||
CONVERT(0x000f, GATT_STATUS_INSUFFICIENT_ENCRYPTION),
|
||||
CONVERT(0x0010, GATT_STATUS_UNSUPPORTED_GROUP_TYPE),
|
||||
CONVERT(0x0011, GATT_STATUS_INSUFFICIENT_RESOURCES)
|
||||
[0x0000] = GATT_STATUS_SUCCESS,
|
||||
[0x0001] = GATT_STATUS_INVALID_HANDLE,
|
||||
[0x0002] = GATT_STATUS_READ_NOT_PERMITTED,
|
||||
[0x0003] = GATT_STATUS_WRITE_NOT_PERMITTED,
|
||||
[0x0004] = GATT_STATUS_INVALID_PDU,
|
||||
[0x0005] = GATT_STATUS_INSUFFICIENT_AUTHENTICATION,
|
||||
[0x0006] = GATT_STATUS_REQUEST_NOT_SUPPORTED,
|
||||
[0x0007] = GATT_STATUS_INVALID_OFFSET,
|
||||
[0x0008] = GATT_STATUS_INSUFFICIENT_AUTHORIZATION,
|
||||
[0x0009] = GATT_STATUS_PREPARE_QUEUE_FULL,
|
||||
[0x000a] = GATT_STATUS_ATTRIBUTE_NOT_FOUND,
|
||||
[0x000b] = GATT_STATUS_ATTRIBUTE_NOT_LONG,
|
||||
[0x000c] = GATT_STATUS_INSUFFICIENT_ENCRYPTION_KEY_SIZE,
|
||||
[0x000d] = GATT_STATUS_INVALID_ATTRIBUTE_LENGTH,
|
||||
[0x000e] = GATT_STATUS_UNLIKELY_ERROR,
|
||||
[0x000f] = GATT_STATUS_INSUFFICIENT_ENCRYPTION,
|
||||
[0x0010] = GATT_STATUS_UNSUPPORTED_GROUP_TYPE,
|
||||
[0x0011] = GATT_STATUS_INSUFFICIENT_RESOURCES
|
||||
};
|
||||
if (NS_WARN_IF(aIn < 0) ||
|
||||
NS_WARN_IF(aIn >= static_cast<ssize_t>(MOZ_ARRAY_LENGTH(sGattStatus)))) {
|
||||
|
@ -541,8 +541,8 @@ nsresult
|
|||
Convert(BluetoothAclState aIn, bool& aOut)
|
||||
{
|
||||
static const bool sBool[] = {
|
||||
CONVERT(ACL_STATE_CONNECTED, true),
|
||||
CONVERT(ACL_STATE_DISCONNECTED, false)
|
||||
[ACL_STATE_CONNECTED] = true,
|
||||
[ACL_STATE_DISCONNECTED] = false
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sBool))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -578,12 +578,12 @@ nsresult
|
|||
Convert(BluetoothAvrcpEvent aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sValue[] = {
|
||||
CONVERT(AVRCP_EVENT_PLAY_STATUS_CHANGED, 0x01),
|
||||
CONVERT(AVRCP_EVENT_TRACK_CHANGE, 0x02),
|
||||
CONVERT(AVRCP_EVENT_TRACK_REACHED_END, 0x03),
|
||||
CONVERT(AVRCP_EVENT_TRACK_REACHED_START, 0x04),
|
||||
CONVERT(AVRCP_EVENT_PLAY_POS_CHANGED, 0x05),
|
||||
CONVERT(AVRCP_EVENT_APP_SETTINGS_CHANGED, 0x08)
|
||||
[AVRCP_EVENT_PLAY_STATUS_CHANGED] = 0x01,
|
||||
[AVRCP_EVENT_TRACK_CHANGE] = 0x02,
|
||||
[AVRCP_EVENT_TRACK_REACHED_END] = 0x03,
|
||||
[AVRCP_EVENT_TRACK_REACHED_START] = 0x04,
|
||||
[AVRCP_EVENT_PLAY_POS_CHANGED] = 0x05,
|
||||
[AVRCP_EVENT_APP_SETTINGS_CHANGED] = 0x08
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -596,8 +596,8 @@ nsresult
|
|||
Convert(BluetoothAvrcpNotification aIn, uint8_t& aOut)
|
||||
{
|
||||
static const bool sValue[] = {
|
||||
CONVERT(AVRCP_NTF_INTERIM, 0x00),
|
||||
CONVERT(AVRCP_NTF_CHANGED, 0x01)
|
||||
[AVRCP_NTF_INTERIM] = 0x00,
|
||||
[AVRCP_NTF_CHANGED] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -610,10 +610,10 @@ nsresult
|
|||
Convert(BluetoothAvrcpPlayerAttribute aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sValue[] = {
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_EQUALIZER, 0x01),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_REPEAT, 0x02),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SHUFFLE, 0x03),
|
||||
CONVERT(AVRCP_PLAYER_ATTRIBUTE_SCAN, 0x04)
|
||||
[AVRCP_PLAYER_ATTRIBUTE_EQUALIZER] = 0x01,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_REPEAT] = 0x02,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_SHUFFLE] = 0x03,
|
||||
[AVRCP_PLAYER_ATTRIBUTE_SCAN] = 0x04
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -638,11 +638,11 @@ nsresult
|
|||
Convert(BluetoothAvrcpStatus aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sValue[] = {
|
||||
CONVERT(AVRCP_STATUS_BAD_COMMAND, 0x00),
|
||||
CONVERT(AVRCP_STATUS_BAD_PARAMETER, 0x01),
|
||||
CONVERT(AVRCP_STATUS_NOT_FOUND, 0x02),
|
||||
CONVERT(AVRCP_STATUS_INTERNAL_ERROR, 0x03),
|
||||
CONVERT(AVRCP_STATUS_SUCCESS, 0x04)
|
||||
[AVRCP_STATUS_BAD_COMMAND] = 0x00,
|
||||
[AVRCP_STATUS_BAD_PARAMETER] = 0x01,
|
||||
[AVRCP_STATUS_NOT_FOUND] = 0x02,
|
||||
[AVRCP_STATUS_INTERNAL_ERROR] = 0x03,
|
||||
[AVRCP_STATUS_SUCCESS] = 0x04
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
@ -655,8 +655,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeAtResponse aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sAtResponse[] = {
|
||||
CONVERT(HFP_AT_RESPONSE_ERROR, 0x00),
|
||||
CONVERT(HFP_AT_RESPONSE_OK, 0x01)
|
||||
[HFP_AT_RESPONSE_ERROR] = 0x00,
|
||||
[HFP_AT_RESPONSE_OK] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sAtResponse))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -670,8 +670,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeCallAddressType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sCallAddressType[] = {
|
||||
CONVERT(HFP_CALL_ADDRESS_TYPE_UNKNOWN, 0x81),
|
||||
CONVERT(HFP_CALL_ADDRESS_TYPE_INTERNATIONAL, 0x91)
|
||||
[HFP_CALL_ADDRESS_TYPE_UNKNOWN] = 0x81,
|
||||
[HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = 0x91
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallAddressType))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -685,8 +685,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeCallDirection aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sCallDirection[] = {
|
||||
CONVERT(HFP_CALL_DIRECTION_OUTGOING, 0x00),
|
||||
CONVERT(HFP_CALL_DIRECTION_INCOMING, 0x01)
|
||||
[HFP_CALL_DIRECTION_OUTGOING] = 0x00,
|
||||
[HFP_CALL_DIRECTION_INCOMING] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallDirection))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -700,13 +700,13 @@ nsresult
|
|||
Convert(BluetoothHandsfreeCallState aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sCallState[] = {
|
||||
CONVERT(HFP_CALL_STATE_ACTIVE, 0x00),
|
||||
CONVERT(HFP_CALL_STATE_HELD, 0x01),
|
||||
CONVERT(HFP_CALL_STATE_DIALING, 0x02),
|
||||
CONVERT(HFP_CALL_STATE_ALERTING, 0x03),
|
||||
CONVERT(HFP_CALL_STATE_INCOMING, 0x04),
|
||||
CONVERT(HFP_CALL_STATE_WAITING, 0x05),
|
||||
CONVERT(HFP_CALL_STATE_IDLE, 0x06)
|
||||
[HFP_CALL_STATE_ACTIVE] = 0x00,
|
||||
[HFP_CALL_STATE_HELD] = 0x01,
|
||||
[HFP_CALL_STATE_DIALING] = 0x02,
|
||||
[HFP_CALL_STATE_ALERTING] = 0x03,
|
||||
[HFP_CALL_STATE_INCOMING] = 0x04,
|
||||
[HFP_CALL_STATE_WAITING] = 0x05,
|
||||
[HFP_CALL_STATE_IDLE] = 0x06
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallState))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -720,9 +720,9 @@ nsresult
|
|||
Convert(BluetoothHandsfreeCallMode aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sCallMode[] = {
|
||||
CONVERT(HFP_CALL_MODE_VOICE, 0x00),
|
||||
CONVERT(HFP_CALL_MODE_DATA, 0x01),
|
||||
CONVERT(HFP_CALL_MODE_FAX, 0x02)
|
||||
[HFP_CALL_MODE_VOICE] = 0x00,
|
||||
[HFP_CALL_MODE_DATA] = 0x01,
|
||||
[HFP_CALL_MODE_FAX] = 0x02
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMode))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -736,8 +736,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeCallMptyType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sCallMptyType[] = {
|
||||
CONVERT(HFP_CALL_MPTY_TYPE_SINGLE, 0x00),
|
||||
CONVERT(HFP_CALL_MPTY_TYPE_MULTI, 0x01)
|
||||
[HFP_CALL_MPTY_TYPE_SINGLE] = 0x00,
|
||||
[HFP_CALL_MPTY_TYPE_MULTI] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sCallMptyType))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -751,8 +751,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeNetworkState aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sNetworkState[] = {
|
||||
CONVERT(HFP_NETWORK_STATE_NOT_AVAILABLE, 0x00),
|
||||
CONVERT(HFP_NETWORK_STATE_AVAILABLE, 0x01)
|
||||
[HFP_NETWORK_STATE_NOT_AVAILABLE] = 0x00,
|
||||
[HFP_NETWORK_STATE_AVAILABLE] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sNetworkState))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -766,8 +766,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeServiceType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sServiceType[] = {
|
||||
CONVERT(HFP_SERVICE_TYPE_HOME, 0x00),
|
||||
CONVERT(HFP_SERVICE_TYPE_ROAMING, 0x01)
|
||||
[HFP_SERVICE_TYPE_HOME] = 0x00,
|
||||
[HFP_SERVICE_TYPE_ROAMING] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sServiceType))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -781,8 +781,8 @@ nsresult
|
|||
Convert(BluetoothHandsfreeVolumeType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sVolumeType[] = {
|
||||
CONVERT(HFP_VOLUME_TYPE_SPEAKER, 0x00),
|
||||
CONVERT(HFP_VOLUME_TYPE_MICROPHONE, 0x01)
|
||||
[HFP_VOLUME_TYPE_SPEAKER] = 0x00,
|
||||
[HFP_VOLUME_TYPE_MICROPHONE] = 0x01
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sVolumeType))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -796,9 +796,9 @@ nsresult
|
|||
Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sWbsConfig[] = {
|
||||
CONVERT(HFP_WBS_NONE, 0x00),
|
||||
CONVERT(HFP_WBS_NO, 0x01),
|
||||
CONVERT(HFP_WBS_YES, 0x02)
|
||||
[HFP_WBS_NONE] = 0x00,
|
||||
[HFP_WBS_NO] = 0x01,
|
||||
[HFP_WBS_YES] = 0x02
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sWbsConfig))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -812,20 +812,20 @@ nsresult
|
|||
Convert(BluetoothPropertyType aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sPropertyType[] = {
|
||||
CONVERT(PROPERTY_UNKNOWN, 0x00),
|
||||
CONVERT(PROPERTY_BDNAME, 0x01),
|
||||
CONVERT(PROPERTY_BDADDR, 0x02),
|
||||
CONVERT(PROPERTY_UUIDS, 0x03),
|
||||
CONVERT(PROPERTY_CLASS_OF_DEVICE, 0x04),
|
||||
CONVERT(PROPERTY_TYPE_OF_DEVICE, 0x05),
|
||||
CONVERT(PROPERTY_SERVICE_RECORD, 0x06),
|
||||
CONVERT(PROPERTY_ADAPTER_SCAN_MODE, 0x07),
|
||||
CONVERT(PROPERTY_ADAPTER_BONDED_DEVICES, 0x08),
|
||||
CONVERT(PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, 0x09),
|
||||
CONVERT(PROPERTY_REMOTE_FRIENDLY_NAME, 0x0a),
|
||||
CONVERT(PROPERTY_REMOTE_RSSI, 0x0b),
|
||||
CONVERT(PROPERTY_REMOTE_VERSION_INFO, 0x0c),
|
||||
CONVERT(PROPERTY_REMOTE_DEVICE_TIMESTAMP, 0xff)
|
||||
[PROPERTY_UNKNOWN] = 0x00,
|
||||
[PROPERTY_BDNAME] = 0x01,
|
||||
[PROPERTY_BDADDR] = 0x02,
|
||||
[PROPERTY_UUIDS] = 0x03,
|
||||
[PROPERTY_CLASS_OF_DEVICE] = 0x04,
|
||||
[PROPERTY_TYPE_OF_DEVICE] = 0x05,
|
||||
[PROPERTY_SERVICE_RECORD] = 0x06,
|
||||
[PROPERTY_ADAPTER_SCAN_MODE] = 0x07,
|
||||
[PROPERTY_ADAPTER_BONDED_DEVICES] = 0x08,
|
||||
[PROPERTY_ADAPTER_DISCOVERY_TIMEOUT] = 0x09,
|
||||
[PROPERTY_REMOTE_FRIENDLY_NAME] = 0x0a,
|
||||
[PROPERTY_REMOTE_RSSI] = 0x0b,
|
||||
[PROPERTY_REMOTE_VERSION_INFO] = 0x0c,
|
||||
[PROPERTY_REMOTE_DEVICE_TIMESTAMP] = 0xff
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sPropertyType))) {
|
||||
aOut = 0x00; // silences compiler warning
|
||||
|
@ -851,9 +851,9 @@ nsresult
|
|||
Convert(BluetoothScanMode aIn, int32_t& aOut)
|
||||
{
|
||||
static const int32_t sScanMode[] = {
|
||||
CONVERT(SCAN_MODE_NONE, 0x00),
|
||||
CONVERT(SCAN_MODE_CONNECTABLE, 0x01),
|
||||
CONVERT(SCAN_MODE_CONNECTABLE_DISCOVERABLE, 0x02)
|
||||
[SCAN_MODE_NONE] = 0x00,
|
||||
[SCAN_MODE_CONNECTABLE] = 0x01,
|
||||
[SCAN_MODE_CONNECTABLE_DISCOVERABLE] = 0x02
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sScanMode))) {
|
||||
aOut = 0; // silences compiler warning
|
||||
|
@ -867,10 +867,10 @@ nsresult
|
|||
Convert(BluetoothSspVariant aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sValue[] = {
|
||||
CONVERT(SSP_VARIANT_PASSKEY_CONFIRMATION, 0x00),
|
||||
CONVERT(SSP_VARIANT_PASSKEY_ENTRY, 0x01),
|
||||
CONVERT(SSP_VARIANT_CONSENT, 0x02),
|
||||
CONVERT(SSP_VARIANT_PASSKEY_NOTIFICATION, 0x03)
|
||||
[SSP_VARIANT_PASSKEY_CONFIRMATION] = 0x00,
|
||||
[SSP_VARIANT_PASSKEY_ENTRY] = 0x01,
|
||||
[SSP_VARIANT_CONSENT] = 0x02,
|
||||
[SSP_VARIANT_PASSKEY_NOTIFICATION] = 0x03
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sValue))) {
|
||||
aOut = 0; // silences compiler warning
|
||||
|
@ -884,11 +884,11 @@ nsresult
|
|||
Convert(ControlPlayStatus aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sValue[] = {
|
||||
CONVERT(PLAYSTATUS_STOPPED, 0x00),
|
||||
CONVERT(PLAYSTATUS_PLAYING, 0x01),
|
||||
CONVERT(PLAYSTATUS_PAUSED, 0x02),
|
||||
CONVERT(PLAYSTATUS_FWD_SEEK, 0x03),
|
||||
CONVERT(PLAYSTATUS_REV_SEEK, 0x04)
|
||||
[PLAYSTATUS_STOPPED] = 0x00,
|
||||
[PLAYSTATUS_PLAYING] = 0x01,
|
||||
[PLAYSTATUS_PAUSED] = 0x02,
|
||||
[PLAYSTATUS_FWD_SEEK] = 0x03,
|
||||
[PLAYSTATUS_REV_SEEK] = 0x04
|
||||
};
|
||||
if (aIn == PLAYSTATUS_ERROR) {
|
||||
/* This case is handled separately to not populate
|
||||
|
@ -908,11 +908,11 @@ nsresult
|
|||
Convert(BluetoothGattAuthReq aIn, int32_t& aOut)
|
||||
{
|
||||
static const int32_t sGattAuthReq[] = {
|
||||
CONVERT(GATT_AUTH_REQ_NONE, 0x00),
|
||||
CONVERT(GATT_AUTH_REQ_NO_MITM, 0x01),
|
||||
CONVERT(GATT_AUTH_REQ_MITM, 0x02),
|
||||
CONVERT(GATT_AUTH_REQ_SIGNED_NO_MITM, 0x03),
|
||||
CONVERT(GATT_AUTH_REQ_SIGNED_MITM, 0x04)
|
||||
[GATT_AUTH_REQ_NONE] = 0x00,
|
||||
[GATT_AUTH_REQ_NO_MITM] = 0x01,
|
||||
[GATT_AUTH_REQ_MITM] = 0x02,
|
||||
[GATT_AUTH_REQ_SIGNED_NO_MITM] = 0x03,
|
||||
[GATT_AUTH_REQ_SIGNED_MITM] = 0x04
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattAuthReq))) {
|
||||
aOut = GATT_AUTH_REQ_NONE; // silences compiler warning
|
||||
|
@ -926,10 +926,10 @@ nsresult
|
|||
Convert(BluetoothGattWriteType aIn, int32_t& aOut)
|
||||
{
|
||||
static const int32_t sGattWriteType[] = {
|
||||
CONVERT(GATT_WRITE_TYPE_NO_RESPONSE, 0x01),
|
||||
CONVERT(GATT_WRITE_TYPE_NORMAL, 0x02),
|
||||
CONVERT(GATT_WRITE_TYPE_PREPARE, 0x03),
|
||||
CONVERT(GATT_WRITE_TYPE_SIGNED, 0x04)
|
||||
[GATT_WRITE_TYPE_NO_RESPONSE] = 0x01,
|
||||
[GATT_WRITE_TYPE_NORMAL] = 0x02,
|
||||
[GATT_WRITE_TYPE_PREPARE] = 0x03,
|
||||
[GATT_WRITE_TYPE_SIGNED] = 0x04
|
||||
};
|
||||
if (NS_WARN_IF(aIn >= MOZ_ARRAY_LENGTH(sGattWriteType))) {
|
||||
aOut = GATT_WRITE_TYPE_NORMAL; // silences compiler warning
|
||||
|
|
|
@ -113,10 +113,10 @@ protected:
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothSetupResultHandler*) = {
|
||||
INIT_ARRAY_AT(0x00, &BluetoothDaemonSetupModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(0x01, &BluetoothDaemonSetupModule::RegisterModuleRsp),
|
||||
INIT_ARRAY_AT(0x02, &BluetoothDaemonSetupModule::UnregisterModuleRsp),
|
||||
INIT_ARRAY_AT(0x03, &BluetoothDaemonSetupModule::ConfigurationRsp)
|
||||
[0x00] = &BluetoothDaemonSetupModule::ErrorRsp,
|
||||
[0x01] = &BluetoothDaemonSetupModule::RegisterModuleRsp,
|
||||
[0x02] = &BluetoothDaemonSetupModule::UnregisterModuleRsp,
|
||||
[0x03] = &BluetoothDaemonSetupModule::ConfigurationRsp
|
||||
};
|
||||
|
||||
if (NS_WARN_IF(aHeader.mOpcode >= MOZ_ARRAY_LENGTH(HandleRsp)) ||
|
||||
|
@ -604,8 +604,8 @@ protected:
|
|||
{
|
||||
static void (BluetoothDaemonCoreModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::HandleRsp),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::HandleNtf),
|
||||
[0] = &BluetoothDaemonCoreModule::HandleRsp,
|
||||
[1] = &BluetoothDaemonCoreModule::HandleNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -831,31 +831,27 @@ private:
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothResultHandler*) = {
|
||||
INIT_ARRAY_AT(0x00, &BluetoothDaemonCoreModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(0x01, &BluetoothDaemonCoreModule::EnableRsp),
|
||||
INIT_ARRAY_AT(0x02, &BluetoothDaemonCoreModule::DisableRsp),
|
||||
INIT_ARRAY_AT(0x03, &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp),
|
||||
INIT_ARRAY_AT(0x04, &BluetoothDaemonCoreModule::GetAdapterPropertyRsp),
|
||||
INIT_ARRAY_AT(0x05, &BluetoothDaemonCoreModule::SetAdapterPropertyRsp),
|
||||
INIT_ARRAY_AT(0x06,
|
||||
&BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp),
|
||||
INIT_ARRAY_AT(0x07,
|
||||
&BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp),
|
||||
INIT_ARRAY_AT(0x08,
|
||||
&BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp),
|
||||
INIT_ARRAY_AT(0x09,
|
||||
&BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp),
|
||||
INIT_ARRAY_AT(0x0a, &BluetoothDaemonCoreModule::GetRemoteServicesRsp),
|
||||
INIT_ARRAY_AT(0x0b, &BluetoothDaemonCoreModule::StartDiscoveryRsp),
|
||||
INIT_ARRAY_AT(0x0c, &BluetoothDaemonCoreModule::CancelDiscoveryRsp),
|
||||
INIT_ARRAY_AT(0x0d, &BluetoothDaemonCoreModule::CreateBondRsp),
|
||||
INIT_ARRAY_AT(0x0e, &BluetoothDaemonCoreModule::RemoveBondRsp),
|
||||
INIT_ARRAY_AT(0x0f, &BluetoothDaemonCoreModule::CancelBondRsp),
|
||||
INIT_ARRAY_AT(0x10, &BluetoothDaemonCoreModule::PinReplyRsp),
|
||||
INIT_ARRAY_AT(0x11, &BluetoothDaemonCoreModule::SspReplyRsp),
|
||||
INIT_ARRAY_AT(0x12, &BluetoothDaemonCoreModule::DutModeConfigureRsp),
|
||||
INIT_ARRAY_AT(0x13, &BluetoothDaemonCoreModule::DutModeSendRsp),
|
||||
INIT_ARRAY_AT(0x14, &BluetoothDaemonCoreModule::LeTestModeRsp),
|
||||
[0x00] = &BluetoothDaemonCoreModule::ErrorRsp,
|
||||
[0x01] = &BluetoothDaemonCoreModule::EnableRsp,
|
||||
[0x02] = &BluetoothDaemonCoreModule::DisableRsp,
|
||||
[0x03] = &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp,
|
||||
[0x04] = &BluetoothDaemonCoreModule::GetAdapterPropertyRsp,
|
||||
[0x05] = &BluetoothDaemonCoreModule::SetAdapterPropertyRsp,
|
||||
[0x06] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp,
|
||||
[0x07] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp,
|
||||
[0x08] = &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp,
|
||||
[0x09] = &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp,
|
||||
[0x0a] = &BluetoothDaemonCoreModule::GetRemoteServicesRsp,
|
||||
[0x0b] = &BluetoothDaemonCoreModule::StartDiscoveryRsp,
|
||||
[0x0c] = &BluetoothDaemonCoreModule::CancelDiscoveryRsp,
|
||||
[0x0d] = &BluetoothDaemonCoreModule::CreateBondRsp,
|
||||
[0x0e] = &BluetoothDaemonCoreModule::RemoveBondRsp,
|
||||
[0x0f] = &BluetoothDaemonCoreModule::CancelBondRsp,
|
||||
[0x10] = &BluetoothDaemonCoreModule::PinReplyRsp,
|
||||
[0x11] = &BluetoothDaemonCoreModule::SspReplyRsp,
|
||||
[0x12] = &BluetoothDaemonCoreModule::DutModeConfigureRsp,
|
||||
[0x13] = &BluetoothDaemonCoreModule::DutModeSendRsp,
|
||||
[0x14] = &BluetoothDaemonCoreModule::LeTestModeRsp,
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -1353,17 +1349,17 @@ private:
|
|||
{
|
||||
static void (BluetoothDaemonCoreModule::* const HandleNtf[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&) = {
|
||||
INIT_ARRAY_AT(0, &BluetoothDaemonCoreModule::AdapterStateChangedNtf),
|
||||
INIT_ARRAY_AT(1, &BluetoothDaemonCoreModule::AdapterPropertiesNtf),
|
||||
INIT_ARRAY_AT(2, &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf),
|
||||
INIT_ARRAY_AT(3, &BluetoothDaemonCoreModule::DeviceFoundNtf),
|
||||
INIT_ARRAY_AT(4, &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf),
|
||||
INIT_ARRAY_AT(5, &BluetoothDaemonCoreModule::PinRequestNtf),
|
||||
INIT_ARRAY_AT(6, &BluetoothDaemonCoreModule::SspRequestNtf),
|
||||
INIT_ARRAY_AT(7, &BluetoothDaemonCoreModule::BondStateChangedNtf),
|
||||
INIT_ARRAY_AT(8, &BluetoothDaemonCoreModule::AclStateChangedNtf),
|
||||
INIT_ARRAY_AT(9, &BluetoothDaemonCoreModule::DutModeRecvNtf),
|
||||
INIT_ARRAY_AT(10, &BluetoothDaemonCoreModule::LeTestModeNtf)
|
||||
[0] = &BluetoothDaemonCoreModule::AdapterStateChangedNtf,
|
||||
[1] = &BluetoothDaemonCoreModule::AdapterPropertiesNtf,
|
||||
[2] = &BluetoothDaemonCoreModule::RemoteDevicePropertiesNtf,
|
||||
[3] = &BluetoothDaemonCoreModule::DeviceFoundNtf,
|
||||
[4] = &BluetoothDaemonCoreModule::DiscoveryStateChangedNtf,
|
||||
[5] = &BluetoothDaemonCoreModule::PinRequestNtf,
|
||||
[6] = &BluetoothDaemonCoreModule::SspRequestNtf,
|
||||
[7] = &BluetoothDaemonCoreModule::BondStateChangedNtf,
|
||||
[8] = &BluetoothDaemonCoreModule::AclStateChangedNtf,
|
||||
[9] = &BluetoothDaemonCoreModule::DutModeRecvNtf,
|
||||
[10] = &BluetoothDaemonCoreModule::LeTestModeNtf
|
||||
};
|
||||
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -1594,20 +1590,20 @@ BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU)
|
|||
{
|
||||
static void (BluetoothDaemonProtocol::* const HandleSvc[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
INIT_ARRAY_AT(0x00, &BluetoothDaemonProtocol::HandleSetupSvc),
|
||||
INIT_ARRAY_AT(0x01, &BluetoothDaemonProtocol::HandleCoreSvc),
|
||||
INIT_ARRAY_AT(0x02, &BluetoothDaemonProtocol::HandleSocketSvc),
|
||||
INIT_ARRAY_AT(0x03, nullptr), // HID host
|
||||
INIT_ARRAY_AT(0x04, nullptr), // PAN
|
||||
INIT_ARRAY_AT(BluetoothDaemonHandsfreeModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleHandsfreeSvc),
|
||||
INIT_ARRAY_AT(BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleA2dpSvc),
|
||||
INIT_ARRAY_AT(0x07, nullptr), // Health
|
||||
INIT_ARRAY_AT(BluetoothDaemonAvrcpModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleAvrcpSvc),
|
||||
INIT_ARRAY_AT(BluetoothDaemonGattModule::SERVICE_ID,
|
||||
&BluetoothDaemonProtocol::HandleGattSvc)
|
||||
[0x00] = &BluetoothDaemonProtocol::HandleSetupSvc,
|
||||
[0x01] = &BluetoothDaemonProtocol::HandleCoreSvc,
|
||||
[0x02] = &BluetoothDaemonProtocol::HandleSocketSvc,
|
||||
[0x03] = nullptr, // HID host
|
||||
[0x04] = nullptr, // PAN
|
||||
[BluetoothDaemonHandsfreeModule::SERVICE_ID] =
|
||||
&BluetoothDaemonProtocol::HandleHandsfreeSvc,
|
||||
[BluetoothDaemonA2dpModule::SERVICE_ID] =
|
||||
&BluetoothDaemonProtocol::HandleA2dpSvc,
|
||||
[0x07] = nullptr, // Health
|
||||
[BluetoothDaemonAvrcpModule::SERVICE_ID] =
|
||||
&BluetoothDaemonProtocol::HandleAvrcpSvc,
|
||||
[BluetoothDaemonGattModule::SERVICE_ID] =
|
||||
&BluetoothDaemonProtocol::HandleGattSvc
|
||||
};
|
||||
|
||||
DaemonSocketPDUHeader header;
|
||||
|
|
|
@ -166,9 +166,9 @@ BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
|||
const DaemonSocketPDUHeader&,
|
||||
DaemonSocketPDU&,
|
||||
BluetoothSocketResultHandler*) = {
|
||||
INIT_ARRAY_AT(0x00, &BluetoothDaemonSocketModule::ErrorRsp),
|
||||
INIT_ARRAY_AT(0x01, &BluetoothDaemonSocketModule::ListenRsp),
|
||||
INIT_ARRAY_AT(0x02, &BluetoothDaemonSocketModule::ConnectRsp),
|
||||
[0x00] = &BluetoothDaemonSocketModule::ErrorRsp,
|
||||
[0x01] = &BluetoothDaemonSocketModule::ListenRsp,
|
||||
[0x02] = &BluetoothDaemonSocketModule::ConnectRsp
|
||||
};
|
||||
|
||||
if (NS_WARN_IF(MOZ_ARRAY_LENGTH(HandleRsp) <= aHeader.mOpcode) ||
|
||||
|
|
|
@ -128,9 +128,9 @@ BluetoothDeviceType
|
|||
BluetoothDevice::ConvertUint32ToDeviceType(const uint32_t aValue)
|
||||
{
|
||||
static const BluetoothDeviceType sDeviceType[] = {
|
||||
CONVERT(TYPE_OF_DEVICE_BREDR, BluetoothDeviceType::Classic),
|
||||
CONVERT(TYPE_OF_DEVICE_BLE, BluetoothDeviceType::Le),
|
||||
CONVERT(TYPE_OF_DEVICE_DUAL, BluetoothDeviceType::Dual),
|
||||
[TYPE_OF_DEVICE_BREDR] = BluetoothDeviceType::Classic,
|
||||
[TYPE_OF_DEVICE_BLE] = BluetoothDeviceType::Le,
|
||||
[TYPE_OF_DEVICE_DUAL] = BluetoothDeviceType::Dual,
|
||||
};
|
||||
|
||||
BluetoothTypeOfDevice type = static_cast<BluetoothTypeOfDevice>(aValue);
|
||||
|
|
|
@ -850,12 +850,14 @@ DataTransfer::GetFilesAndDirectories(ErrorResult& aRv)
|
|||
{
|
||||
nsCOMPtr<nsINode> parentNode = do_QueryInterface(mParent);
|
||||
if (!parentNode) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> global = parentNode->OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
if (!global) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -865,15 +867,15 @@ DataTransfer::GetFilesAndDirectories(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
if (!mFiles) {
|
||||
ErrorResult dummy;
|
||||
GetFiles(dummy);
|
||||
if (!mFiles) {
|
||||
GetFiles(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Sequence<OwningFileOrDirectory> filesAndDirsSeq;
|
||||
|
||||
if (mFiles && mFiles->Length()) {
|
||||
if (!filesAndDirsSeq.SetLength(mFiles->Length(), mozilla::fallible_t())) {
|
||||
p->MaybeReject(NS_ERROR_OUT_OF_MEMORY);
|
||||
return p.forget();
|
||||
|
@ -904,6 +906,7 @@ DataTransfer::GetFilesAndDirectories(ErrorResult& aRv)
|
|||
filesAndDirsSeq[i].SetAsFile() = mFiles->Item(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p->MaybeResolve(filesAndDirsSeq);
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
|
||||
function boom() {
|
||||
var ev = new ClipboardEvent("p");
|
||||
ev.clipboardData.getFilesAndDirectories();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
|
@ -9,6 +9,7 @@ load 1033343.html
|
|||
load 1035654-1.html
|
||||
load 1035654-2.html
|
||||
load 1143972-1.html
|
||||
load 1190036-1.html
|
||||
needs-focus load 1072137-1.html
|
||||
load eventctor-nulldictionary.html
|
||||
load eventctor-nullstorage.html
|
||||
|
|
|
@ -157,6 +157,16 @@ struct AudioChunk {
|
|||
return static_cast<float*>(const_cast<void*>(mChannelData[aChannel]));
|
||||
}
|
||||
|
||||
void ReleaseBufferIfShared()
|
||||
{
|
||||
if (mBuffer && mBuffer->IsShared()) {
|
||||
// Remove pointers into the buffer, but keep the array allocation for
|
||||
// chunk re-use.
|
||||
mChannelData.ClearAndRetainStorage();
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool IsMuted() const { return mVolume == 0.0f; }
|
||||
|
||||
size_t SizeOfExcludingThisIfUnshared(MallocSizeOf aMallocSizeOf) const
|
||||
|
|
|
@ -105,7 +105,7 @@ UpdateStreamBlocking(MediaStream* aStream, bool aBlocking)
|
|||
*/
|
||||
class DecodedStreamData {
|
||||
public:
|
||||
DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
|
||||
DecodedStreamData(SourceMediaStream* aStream,
|
||||
MozPromiseHolder<GenericPromise>&& aPromise);
|
||||
~DecodedStreamData();
|
||||
bool IsFinished() const;
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
bool mEOSVideoCompensation;
|
||||
};
|
||||
|
||||
DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
|
||||
DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream,
|
||||
MozPromiseHolder<GenericPromise>&& aPromise)
|
||||
: mAudioFramesWritten(0)
|
||||
, mNextVideoTime(-1)
|
||||
|
@ -152,17 +152,15 @@ DecodedStreamData::DecodedStreamData(SourceMediaStream* aStream, bool aPlaying,
|
|||
, mHaveSentFinishAudio(false)
|
||||
, mHaveSentFinishVideo(false)
|
||||
, mStream(aStream)
|
||||
, mPlaying(aPlaying)
|
||||
, mPlaying(true)
|
||||
, mEOSVideoCompensation(false)
|
||||
{
|
||||
// DecodedStreamGraphListener will resolve this promise.
|
||||
mListener = new DecodedStreamGraphListener(mStream, Move(aPromise));
|
||||
mStream->AddListener(mListener);
|
||||
|
||||
// Block the stream if we are not playing.
|
||||
if (!aPlaying) {
|
||||
UpdateStreamBlocking(mStream, true);
|
||||
}
|
||||
// mPlaying is initially true because MDSM won't start playback until playing
|
||||
// becomes true. This is consistent with the settings of AudioSink.
|
||||
}
|
||||
|
||||
DecodedStreamData::~DecodedStreamData()
|
||||
|
@ -358,7 +356,7 @@ DecodedStream::DecodedStream(AbstractThread* aOwnerThread,
|
|||
MediaQueue<MediaData>& aAudioQueue,
|
||||
MediaQueue<MediaData>& aVideoQueue)
|
||||
: mOwnerThread(aOwnerThread)
|
||||
, mMonitor("DecodedStream::mMonitor")
|
||||
, mShuttingDown(false)
|
||||
, mPlaying(false)
|
||||
, mVolume(1.0)
|
||||
, mAudioQueue(aAudioQueue)
|
||||
|
@ -371,11 +369,17 @@ DecodedStream::~DecodedStream()
|
|||
MOZ_ASSERT(mStartTime.isNothing(), "playback should've ended.");
|
||||
}
|
||||
|
||||
void
|
||||
DecodedStream::Shutdown()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mShuttingDown = true;
|
||||
}
|
||||
|
||||
nsRefPtr<GenericPromise>
|
||||
DecodedStream::StartPlayback(int64_t aStartTime, const MediaInfo& aInfo)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
MOZ_ASSERT(mStartTime.isNothing(), "playback already started.");
|
||||
|
||||
mStartTime.emplace(aStartTime);
|
||||
|
@ -413,7 +417,7 @@ DecodedStream::StartPlayback(int64_t aStartTime, const MediaInfo& aInfo)
|
|||
void DecodedStream::StopPlayback()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
|
||||
// Playback didn't even start at all.
|
||||
if (mStartTime.isNothing()) {
|
||||
return;
|
||||
|
@ -424,12 +428,19 @@ void DecodedStream::StopPlayback()
|
|||
|
||||
// Clear mData immediately when this playback session ends so we won't
|
||||
// send data to the wrong stream in SendData() in next playback session.
|
||||
DecodedStreamData* data = mData.release();
|
||||
// mData is not yet created on the main thread.
|
||||
if (!data) {
|
||||
DestroyData(Move(mData));
|
||||
}
|
||||
|
||||
void
|
||||
DecodedStream::DestroyData(UniquePtr<DecodedStreamData> aData)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
|
||||
if (!aData) {
|
||||
return;
|
||||
}
|
||||
|
||||
DecodedStreamData* data = aData.release();
|
||||
nsRefPtr<DecodedStream> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
self->mOutputStreamManager.Disconnect();
|
||||
|
@ -442,35 +453,41 @@ void
|
|||
DecodedStream::CreateData(MozPromiseHolder<GenericPromise>&& aPromise)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
MOZ_ASSERT(!mData, "Already created.");
|
||||
|
||||
// No need to create a source stream when there are no output streams. This
|
||||
// happens when RemoveOutput() is called immediately after StartPlayback().
|
||||
// We also bail out when the playback session has ended. This happens when
|
||||
// StopPlayback() is called immediately after StartPlayback().
|
||||
if (!mOutputStreamManager.Graph() || mStartTime.isNothing()) {
|
||||
// Also we don't create a source stream when MDSM has begun shutdown.
|
||||
if (!mOutputStreamManager.Graph() || mShuttingDown) {
|
||||
// Resolve the promise to indicate the end of playback.
|
||||
aPromise.Resolve(true, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
auto source = mOutputStreamManager.Graph()->CreateSourceStream(nullptr);
|
||||
mData.reset(new DecodedStreamData(source, mPlaying, Move(aPromise)));
|
||||
mOutputStreamManager.Connect(mData->mStream);
|
||||
auto data = new DecodedStreamData(source, Move(aPromise));
|
||||
mOutputStreamManager.Connect(data->mStream);
|
||||
|
||||
// Start to send data to the stream immediately
|
||||
nsRefPtr<DecodedStream> self = this;
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([=] () {
|
||||
ReentrantMonitorAutoEnter mon(self->GetReentrantMonitor());
|
||||
// Don't send data if playback has ended.
|
||||
if (self->mStartTime.isSome()) {
|
||||
self->SendData();
|
||||
class R : public nsRunnable {
|
||||
typedef void(DecodedStream::*Method)(UniquePtr<DecodedStreamData>);
|
||||
public:
|
||||
R(DecodedStream* aThis, Method aMethod, DecodedStreamData* aData)
|
||||
: mThis(aThis), mMethod(aMethod), mData(aData) {}
|
||||
NS_IMETHOD Run() override
|
||||
{
|
||||
(mThis->*mMethod)(Move(mData));
|
||||
return NS_OK;
|
||||
}
|
||||
});
|
||||
// Don't assert success because the owner thread might have begun shutdown
|
||||
// while we are still dealing with jobs on the main thread.
|
||||
mOwnerThread->Dispatch(r.forget(), AbstractThread::DontAssertDispatchSuccess);
|
||||
private:
|
||||
nsRefPtr<DecodedStream> mThis;
|
||||
Method mMethod;
|
||||
UniquePtr<DecodedStreamData> mData;
|
||||
};
|
||||
|
||||
// Post a message to ensure |mData| is only updated on the worker thread.
|
||||
// Note this must be done before MDSM's shutdown since dispatch could fail
|
||||
// when the worker thread is shut down.
|
||||
nsCOMPtr<nsIRunnable> r = new R(this, &DecodedStream::OnDataCreated, data);
|
||||
mOwnerThread->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -479,10 +496,22 @@ DecodedStream::HasConsumers() const
|
|||
return !mOutputStreamManager.IsEmpty();
|
||||
}
|
||||
|
||||
ReentrantMonitor&
|
||||
DecodedStream::GetReentrantMonitor() const
|
||||
void
|
||||
DecodedStream::OnDataCreated(UniquePtr<DecodedStreamData> aData)
|
||||
{
|
||||
return mMonitor;
|
||||
AssertOwnerThread();
|
||||
MOZ_ASSERT(!mData, "Already created.");
|
||||
|
||||
// Start to send data to the stream immediately
|
||||
if (mStartTime.isSome()) {
|
||||
aData->SetPlaying(mPlaying);
|
||||
mData = Move(aData);
|
||||
SendData();
|
||||
return;
|
||||
}
|
||||
|
||||
// Playback has ended. Destroy aData which is not needed anymore.
|
||||
DestroyData(Move(aData));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -501,7 +530,6 @@ void
|
|||
DecodedStream::SetPlaying(bool aPlaying)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mPlaying = aPlaying;
|
||||
if (mData) {
|
||||
mData->SetPlaying(aPlaying);
|
||||
|
@ -512,7 +540,6 @@ void
|
|||
DecodedStream::SetVolume(double aVolume)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mVolume = aVolume;
|
||||
}
|
||||
|
||||
|
@ -520,7 +547,6 @@ void
|
|||
DecodedStream::SetSameOrigin(bool aSameOrigin)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
mSameOrigin = aSameOrigin;
|
||||
}
|
||||
|
||||
|
@ -528,7 +554,6 @@ void
|
|||
DecodedStream::InitTracks()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
if (mData->mStreamInitialized) {
|
||||
return;
|
||||
|
@ -609,7 +634,6 @@ void
|
|||
DecodedStream::SendAudio(double aVolume, bool aIsSameOrigin)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
if (!mInfo.HasAudio()) {
|
||||
return;
|
||||
|
@ -675,7 +699,6 @@ void
|
|||
DecodedStream::SendVideo(bool aIsSameOrigin)
|
||||
{
|
||||
AssertOwnerThread();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
if (!mInfo.HasVideo()) {
|
||||
return;
|
||||
|
@ -754,7 +777,6 @@ void
|
|||
DecodedStream::AdvanceTracks()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
GetReentrantMonitor().AssertCurrentThreadIn();
|
||||
|
||||
StreamTime endPosition = 0;
|
||||
|
||||
|
@ -779,7 +801,6 @@ void
|
|||
DecodedStream::SendData()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
MOZ_ASSERT(mStartTime.isSome(), "Must be called after StartPlayback()");
|
||||
|
||||
// Not yet created on the main thread. MDSM will try again later.
|
||||
|
@ -810,7 +831,6 @@ int64_t
|
|||
DecodedStream::AudioEndTime() const
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
if (mStartTime.isSome() && mInfo.HasAudio() && mData) {
|
||||
CheckedInt64 t = mStartTime.ref() +
|
||||
FramesToUsecs(mData->mAudioFramesWritten, mInfo.mAudio.mRate);
|
||||
|
@ -825,7 +845,6 @@ int64_t
|
|||
DecodedStream::GetPosition() const
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
// This is only called after MDSM starts playback. So mStartTime is
|
||||
// guaranteed to be something.
|
||||
MOZ_ASSERT(mStartTime.isSome());
|
||||
|
@ -836,7 +855,6 @@ bool
|
|||
DecodedStream::IsFinished() const
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
return mData && mData->IsFinished();
|
||||
}
|
||||
|
||||
|
@ -844,7 +862,6 @@ void
|
|||
DecodedStream::ConnectListener()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
|
||||
mAudioPushListener = mAudioQueue.PushEvent().Connect(
|
||||
mOwnerThread, this, &DecodedStream::SendData);
|
||||
|
@ -860,7 +877,6 @@ void
|
|||
DecodedStream::DisconnectListener()
|
||||
{
|
||||
AssertOwnerThread();
|
||||
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
|
||||
|
||||
mAudioPushListener.Disconnect();
|
||||
mVideoPushListener.Disconnect();
|
||||
|
|
|
@ -106,6 +106,8 @@ public:
|
|||
MediaQueue<MediaData>& aAudioQueue,
|
||||
MediaQueue<MediaData>& aVideoQueue);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
// Mimic MDSM::StartAudioThread.
|
||||
// Must be called before any calls to SendData().
|
||||
//
|
||||
|
@ -132,8 +134,9 @@ protected:
|
|||
virtual ~DecodedStream();
|
||||
|
||||
private:
|
||||
ReentrantMonitor& GetReentrantMonitor() const;
|
||||
void CreateData(MozPromiseHolder<GenericPromise>&& aPromise);
|
||||
void DestroyData(UniquePtr<DecodedStreamData> aData);
|
||||
void OnDataCreated(UniquePtr<DecodedStreamData> aData);
|
||||
void InitTracks();
|
||||
void AdvanceTracks();
|
||||
void SendAudio(double aVolume, bool aIsSameOrigin);
|
||||
|
@ -149,18 +152,18 @@ private:
|
|||
|
||||
const nsRefPtr<AbstractThread> mOwnerThread;
|
||||
|
||||
UniquePtr<DecodedStreamData> mData;
|
||||
/*
|
||||
* Main thread only members.
|
||||
*/
|
||||
// Data about MediaStreams that are being fed by the decoder.
|
||||
OutputStreamManager mOutputStreamManager;
|
||||
// True if MDSM has begun shutdown.
|
||||
bool mShuttingDown;
|
||||
|
||||
// TODO: This is a temp solution to get rid of decoder monitor on the main
|
||||
// thread in MDSM::AddOutputStream and MDSM::RecreateDecodedStream as
|
||||
// required by bug 1146482. DecodedStream needs to release monitor before
|
||||
// calling back into MDSM functions in order to prevent deadlocks.
|
||||
//
|
||||
// Please move all capture-stream related code from MDSM into DecodedStream
|
||||
// and apply "dispatch + mirroring" to get rid of this monitor in the future.
|
||||
mutable ReentrantMonitor mMonitor;
|
||||
/*
|
||||
* Worker thread only members.
|
||||
*/
|
||||
UniquePtr<DecodedStreamData> mData;
|
||||
|
||||
bool mPlaying;
|
||||
double mVolume;
|
||||
|
|
|
@ -171,6 +171,7 @@ public:
|
|||
|
||||
void DispatchShutdown()
|
||||
{
|
||||
mDecodedStream->Shutdown();
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown);
|
||||
OwnerThread()->Dispatch(runnable.forget());
|
||||
|
|
|
@ -776,9 +776,10 @@ MediaRecorder::MediaRecorder(AudioNode& aSrcAudioNode,
|
|||
if (aSrcAudioNode.NumberOfOutputs() > 0) {
|
||||
AudioContext* ctx = aSrcAudioNode.Context();
|
||||
AudioNodeEngine* engine = new AudioNodeEngine(nullptr);
|
||||
mPipeStream = ctx->Graph()->CreateAudioNodeStream(engine,
|
||||
MediaStreamGraph::EXTERNAL_STREAM,
|
||||
ctx->SampleRate());
|
||||
AudioNodeStream::Flags flags =
|
||||
AudioNodeStream::EXTERNAL_OUTPUT |
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED;
|
||||
mPipeStream = AudioNodeStream::Create(ctx->Graph(), engine, flags);
|
||||
AudioNodeStream* ns = aSrcAudioNode.GetStream();
|
||||
if (ns) {
|
||||
mInputPort = mPipeStream->AllocateInputPort(aSrcAudioNode.GetStream(),
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "ImageContainer.h"
|
||||
#include "AudioCaptureStream.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioNodeExternalInputStream.h"
|
||||
#include "mozilla/dom/AudioContextBinding.h"
|
||||
|
@ -86,7 +85,7 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream)
|
|||
static const GraphTime START_TIME_DELAYED = -1;
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::AddStream(MediaStream* aStream)
|
||||
MediaStreamGraphImpl::AddStreamGraphThread(MediaStream* aStream)
|
||||
{
|
||||
// Check if we're adding a stream to a suspended context, in which case, we
|
||||
// add it to mSuspendedStreams, and delay setting mBufferStartTime
|
||||
|
@ -113,7 +112,7 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream)
|
|||
}
|
||||
|
||||
void
|
||||
MediaStreamGraphImpl::RemoveStream(MediaStream* aStream)
|
||||
MediaStreamGraphImpl::RemoveStreamGraphThread(MediaStream* aStream)
|
||||
{
|
||||
// Remove references in mStreamUpdates before we allow aStream to die.
|
||||
// Pending updates are not needed (since the main thread has already given
|
||||
|
@ -1641,7 +1640,7 @@ public:
|
|||
explicit CreateMessage(MediaStream* aStream) : ControlMessage(aStream) {}
|
||||
virtual void Run() override
|
||||
{
|
||||
mStream->GraphImpl()->AddStream(mStream);
|
||||
mStream->GraphImpl()->AddStreamGraphThread(mStream);
|
||||
}
|
||||
virtual void RunDuringShutdown() override
|
||||
{
|
||||
|
@ -2055,7 +2054,7 @@ MediaStream::Destroy()
|
|||
mStream->RemoveAllListenersImpl();
|
||||
auto graph = mStream->GraphImpl();
|
||||
mStream->DestroyImpl();
|
||||
graph->RemoveStream(mStream);
|
||||
graph->RemoveStreamGraphThread(mStream);
|
||||
}
|
||||
virtual void RunDuringShutdown()
|
||||
{ Run(); }
|
||||
|
@ -2383,9 +2382,8 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
|
|||
|
||||
mMainThreadListeners.AppendElement(aListener);
|
||||
|
||||
// If we have to send the notification or we have a runnable that will do it,
|
||||
// let finish here.
|
||||
if (!mFinishedNotificationSent || mNotificationMainThreadRunnable) {
|
||||
// If it is not yet time to send the notification, then finish here.
|
||||
if (!mFinishedNotificationSent) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2399,7 +2397,6 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
|
|||
NS_IMETHOD Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mStream->mNotificationMainThreadRunnable = nullptr;
|
||||
mStream->NotifyMainThreadListeners();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2411,11 +2408,7 @@ MediaStream::AddMainThreadListener(MainThreadMediaStreamListener* aListener)
|
|||
};
|
||||
|
||||
nsRefPtr<nsRunnable> runnable = new NotifyRunnable(this);
|
||||
if (NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())))) {
|
||||
return;
|
||||
}
|
||||
|
||||
mNotificationMainThreadRunnable = runnable;
|
||||
NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable.forget())));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2860,7 +2853,7 @@ ProcessedMediaStream::DestroyImpl()
|
|||
MediaStream::DestroyImpl();
|
||||
// The stream order is only important if there are connections, in which
|
||||
// case MediaInputPort::Disconnect() called SetStreamOrderDirty().
|
||||
// MediaStreamGraphImpl::RemoveStream() will also call
|
||||
// MediaStreamGraphImpl::RemoveStreamGraphThread() will also call
|
||||
// SetStreamOrderDirty(), for other reasons.
|
||||
}
|
||||
|
||||
|
@ -3106,10 +3099,7 @@ SourceMediaStream*
|
|||
MediaStreamGraph::CreateSourceStream(DOMMediaStream* aWrapper)
|
||||
{
|
||||
SourceMediaStream* stream = new SourceMediaStream(aWrapper);
|
||||
NS_ADDREF(stream);
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
|
||||
stream->SetGraphImpl(graph);
|
||||
graph->AppendMessage(new CreateMessage(stream));
|
||||
AddStream(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -3117,10 +3107,7 @@ ProcessedMediaStream*
|
|||
MediaStreamGraph::CreateTrackUnionStream(DOMMediaStream* aWrapper)
|
||||
{
|
||||
TrackUnionStream* stream = new TrackUnionStream(aWrapper);
|
||||
NS_ADDREF(stream);
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
|
||||
stream->SetGraphImpl(graph);
|
||||
graph->AppendMessage(new CreateMessage(stream));
|
||||
AddStream(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -3128,54 +3115,17 @@ ProcessedMediaStream*
|
|||
MediaStreamGraph::CreateAudioCaptureStream(DOMMediaStream* aWrapper)
|
||||
{
|
||||
AudioCaptureStream* stream = new AudioCaptureStream(aWrapper);
|
||||
NS_ADDREF(stream);
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
|
||||
stream->SetGraphImpl(graph);
|
||||
graph->AppendMessage(new CreateMessage(stream));
|
||||
AddStream(stream);
|
||||
return stream;
|
||||
}
|
||||
|
||||
AudioNodeExternalInputStream*
|
||||
MediaStreamGraph::CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate)
|
||||
void
|
||||
MediaStreamGraph::AddStream(MediaStream* aStream)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!aSampleRate) {
|
||||
aSampleRate = aEngine->NodeMainThread()->Context()->SampleRate();
|
||||
}
|
||||
AudioNodeExternalInputStream* stream = new AudioNodeExternalInputStream(
|
||||
aEngine, aSampleRate, aEngine->NodeMainThread()->Context()->Id());
|
||||
NS_ADDREF(stream);
|
||||
NS_ADDREF(aStream);
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
|
||||
stream->SetGraphImpl(graph);
|
||||
graph->AppendMessage(new CreateMessage(stream));
|
||||
return stream;
|
||||
}
|
||||
|
||||
AudioNodeStream*
|
||||
MediaStreamGraph::CreateAudioNodeStream(AudioNodeEngine* aEngine,
|
||||
AudioNodeStreamKind aKind,
|
||||
TrackRate aSampleRate)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!aSampleRate) {
|
||||
aSampleRate = aEngine->NodeMainThread()->Context()->SampleRate();
|
||||
}
|
||||
// MediaRecorders use an AudioNodeStream, but no AudioNode
|
||||
AudioNode* node = aEngine->NodeMainThread();
|
||||
dom::AudioContext::AudioContextId contextIdForStream = node ? node->Context()->Id() :
|
||||
NO_AUDIO_CONTEXT;
|
||||
AudioNodeStream* stream = new AudioNodeStream(aEngine, aKind, aSampleRate,
|
||||
contextIdForStream);
|
||||
NS_ADDREF(stream);
|
||||
MediaStreamGraphImpl* graph = static_cast<MediaStreamGraphImpl*>(this);
|
||||
stream->SetGraphImpl(graph);
|
||||
if (aEngine->HasNode()) {
|
||||
stream->SetChannelMixingParametersImpl(aEngine->NodeMainThread()->ChannelCount(),
|
||||
aEngine->NodeMainThread()->ChannelCountModeValue(),
|
||||
aEngine->NodeMainThread()->ChannelInterpretationValue());
|
||||
}
|
||||
graph->AppendMessage(new CreateMessage(stream));
|
||||
return stream;
|
||||
aStream->SetGraphImpl(graph);
|
||||
graph->AppendMessage(new CreateMessage(aStream));
|
||||
}
|
||||
|
||||
class GraphStartedRunnable final : public nsRunnable
|
||||
|
|
|
@ -638,7 +638,6 @@ protected:
|
|||
TimeVarying<GraphTime,uint32_t,0> mExplicitBlockerCount;
|
||||
nsTArray<nsRefPtr<MediaStreamListener> > mListeners;
|
||||
nsTArray<MainThreadMediaStreamListener*> mMainThreadListeners;
|
||||
nsRefPtr<nsRunnable> mNotificationMainThreadRunnable;
|
||||
nsTArray<TrackID> mDisabledTrackIDs;
|
||||
|
||||
// Precomputed blocking status (over GraphTime).
|
||||
|
@ -1241,23 +1240,11 @@ public:
|
|||
* Create a stream that will mix all its audio input.
|
||||
*/
|
||||
ProcessedMediaStream* CreateAudioCaptureStream(DOMMediaStream* aWrapper);
|
||||
// Internal AudioNodeStreams can only pass their output to another
|
||||
// AudioNode, whereas external AudioNodeStreams can pass their output
|
||||
// to an nsAudioStream for playback.
|
||||
enum AudioNodeStreamKind { SOURCE_STREAM, INTERNAL_STREAM, EXTERNAL_STREAM };
|
||||
/**
|
||||
* Create a stream that will process audio for an AudioNode.
|
||||
* Takes ownership of aEngine. aSampleRate is the sampling rate used
|
||||
* for the stream. If 0 is passed, the sampling rate of the engine's
|
||||
* node will get used.
|
||||
*/
|
||||
AudioNodeStream* CreateAudioNodeStream(AudioNodeEngine* aEngine,
|
||||
AudioNodeStreamKind aKind,
|
||||
TrackRate aSampleRate = 0);
|
||||
|
||||
AudioNodeExternalInputStream*
|
||||
CreateAudioNodeExternalInputStream(AudioNodeEngine* aEngine,
|
||||
TrackRate aSampleRate = 0);
|
||||
/**
|
||||
* Add a new stream to the graph. Main thread.
|
||||
*/
|
||||
void AddStream(MediaStream* aStream);
|
||||
|
||||
/* From the main thread, ask the MSG to send back an event when the graph
|
||||
* thread is running, and audio is being processed. */
|
||||
|
|
|
@ -424,12 +424,12 @@ public:
|
|||
/**
|
||||
* Add aStream to the graph and initializes its graph-specific state.
|
||||
*/
|
||||
void AddStream(MediaStream* aStream);
|
||||
void AddStreamGraphThread(MediaStream* aStream);
|
||||
/**
|
||||
* Remove aStream from the graph. Ensures that pending messages about the
|
||||
* stream back to the main thread are flushed.
|
||||
*/
|
||||
void RemoveStream(MediaStream* aStream);
|
||||
void RemoveStreamGraphThread(MediaStream* aStream);
|
||||
/**
|
||||
* Remove aPort from the graph and release it.
|
||||
*/
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<script class="testbody" type="text/javascript">
|
||||
//longer timeout for slow platforms
|
||||
if (isSlowPlatform()) {
|
||||
SimpleTest.requestLongerTimeout(1.5);
|
||||
SimpleTest.requestLongerTimeout(2);
|
||||
}
|
||||
|
||||
var manager = new MediaTestManager;
|
||||
|
@ -38,8 +38,8 @@ function startTest(test, token) {
|
|||
|
||||
v.addEventListener("seeked", function (e) {
|
||||
e.target.seekedCount += 1;
|
||||
if (e.target.seekedCount == 3) {
|
||||
ok(e.target.seekingCount == 3, "Expect matched pairs of seeking/seeked events.");
|
||||
if (e.target.seekedCount == 2) {
|
||||
ok(e.target.seekingCount == 2, "Expect matched pairs of seeking/seeked events.");
|
||||
e.target.loop = false;
|
||||
}
|
||||
}, false);
|
||||
|
|
|
@ -85,8 +85,9 @@ AnalyserNode::AnalyserNode(AudioContext* aContext)
|
|||
, mMaxDecibels(-30.)
|
||||
, mSmoothingTimeConstant(.8)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(new AnalyserNodeEngine(this),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(),
|
||||
new AnalyserNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
|
||||
// Enough chunks must be recorded to handle the case of fftSize being
|
||||
// increased to maximum immediately before getFloatTimeDomainData() is
|
||||
|
|
|
@ -542,7 +542,8 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
|||
, mStartCalled(false)
|
||||
{
|
||||
AudioBufferSourceNodeEngine* engine = new AudioBufferSourceNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
|
|
@ -346,7 +346,11 @@ AudioDestinationNode::AudioDestinationNode(AudioContext* aContext,
|
|||
aLength, aSampleRate) :
|
||||
static_cast<AudioNodeEngine*>(new DestinationNodeEngine(this));
|
||||
|
||||
mStream = graph->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
|
||||
AudioNodeStream::Flags flags =
|
||||
AudioNodeStream::NEED_MAIN_THREAD_CURRENT_TIME |
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED |
|
||||
AudioNodeStream::EXTERNAL_OUTPUT;
|
||||
mStream = AudioNodeStream::Create(graph, engine, flags);
|
||||
mStream->AddMainThreadListener(this);
|
||||
mStream->AddAudioOutput(&gWebAudioOutputKey);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ using namespace mozilla::dom;
|
|||
namespace mozilla {
|
||||
|
||||
AudioNodeExternalInputStream::AudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate, uint32_t aContextId)
|
||||
: AudioNodeStream(aEngine, MediaStreamGraph::INTERNAL_STREAM, aSampleRate, aContextId)
|
||||
: AudioNodeStream(aEngine, NO_STREAM_FLAGS, aSampleRate, aContextId)
|
||||
{
|
||||
MOZ_COUNT_CTOR(AudioNodeExternalInputStream);
|
||||
}
|
||||
|
@ -23,6 +23,20 @@ AudioNodeExternalInputStream::~AudioNodeExternalInputStream()
|
|||
MOZ_COUNT_DTOR(AudioNodeExternalInputStream);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<AudioNodeExternalInputStream>
|
||||
AudioNodeExternalInputStream::Create(MediaStreamGraph* aGraph,
|
||||
AudioNodeEngine* aEngine)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aGraph->GraphRate() == aEngine->NodeMainThread()->Context()->SampleRate());
|
||||
|
||||
nsRefPtr<AudioNodeExternalInputStream> stream =
|
||||
new AudioNodeExternalInputStream(aEngine, aGraph->GraphRate(),
|
||||
aEngine->NodeMainThread()->Context()->Id());
|
||||
aGraph->AddStream(stream);
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies the data in aInput to aOffsetInBlock within aBlock.
|
||||
* aBlock must have been allocated with AllocateInputBlock and have a channel
|
||||
|
|
|
@ -21,9 +21,12 @@ namespace mozilla {
|
|||
class AudioNodeExternalInputStream final : public AudioNodeStream
|
||||
{
|
||||
public:
|
||||
static already_AddRefed<AudioNodeExternalInputStream>
|
||||
Create(MediaStreamGraph* aGraph, AudioNodeEngine* aEngine);
|
||||
|
||||
protected:
|
||||
AudioNodeExternalInputStream(AudioNodeEngine* aEngine, TrackRate aSampleRate,
|
||||
uint32_t aContextId);
|
||||
protected:
|
||||
~AudioNodeExternalInputStream();
|
||||
|
||||
public:
|
||||
|
|
|
@ -26,14 +26,14 @@ namespace mozilla {
|
|||
*/
|
||||
|
||||
AudioNodeStream::AudioNodeStream(AudioNodeEngine* aEngine,
|
||||
MediaStreamGraph::AudioNodeStreamKind aKind,
|
||||
Flags aFlags,
|
||||
TrackRate aSampleRate,
|
||||
AudioContext::AudioContextId aContextId)
|
||||
: ProcessedMediaStream(nullptr),
|
||||
mEngine(aEngine),
|
||||
mSampleRate(aSampleRate),
|
||||
mAudioContextId(aContextId),
|
||||
mKind(aKind),
|
||||
mFlags(aFlags),
|
||||
mNumberOfInputChannels(2),
|
||||
mMarkAsFinishedAfterThisBlock(false),
|
||||
mAudioParamStream(false),
|
||||
|
@ -53,6 +53,30 @@ AudioNodeStream::~AudioNodeStream()
|
|||
MOZ_COUNT_DTOR(AudioNodeStream);
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<AudioNodeStream>
|
||||
AudioNodeStream::Create(MediaStreamGraph* aGraph, AudioNodeEngine* aEngine,
|
||||
Flags aFlags)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// MediaRecorders use an AudioNodeStream, but no AudioNode
|
||||
AudioNode* node = aEngine->NodeMainThread();
|
||||
MOZ_ASSERT(!node || aGraph->GraphRate() == node->Context()->SampleRate());
|
||||
|
||||
dom::AudioContext::AudioContextId contextIdForStream = node ? node->Context()->Id() :
|
||||
NO_AUDIO_CONTEXT;
|
||||
nsRefPtr<AudioNodeStream> stream =
|
||||
new AudioNodeStream(aEngine, aFlags, aGraph->GraphRate(),
|
||||
contextIdForStream);
|
||||
if (aEngine->HasNode()) {
|
||||
stream->SetChannelMixingParametersImpl(aEngine->NodeMainThread()->ChannelCount(),
|
||||
aEngine->NodeMainThread()->ChannelCountModeValue(),
|
||||
aEngine->NodeMainThread()->ChannelInterpretationValue());
|
||||
}
|
||||
aGraph->AddStream(stream);
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
size_t
|
||||
AudioNodeStream::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
|
@ -490,28 +514,34 @@ AudioNodeStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
|
|||
bool blocked = mFinished || mBlocked.GetAt(aFrom);
|
||||
// If the stream has finished at this time, it will be blocked.
|
||||
if (blocked || InMutedCycle()) {
|
||||
mInputChunks.Clear();
|
||||
for (uint16_t i = 0; i < outputCount; ++i) {
|
||||
mLastChunks[i].SetNull(WEBAUDIO_BLOCK_SIZE);
|
||||
}
|
||||
} else {
|
||||
// We need to generate at least one input
|
||||
uint16_t maxInputs = std::max(uint16_t(1), mEngine->InputCount());
|
||||
OutputChunks inputChunks;
|
||||
inputChunks.SetLength(maxInputs);
|
||||
mInputChunks.SetLength(maxInputs);
|
||||
for (uint16_t i = 0; i < maxInputs; ++i) {
|
||||
ObtainInputBlock(inputChunks[i], i);
|
||||
ObtainInputBlock(mInputChunks[i], i);
|
||||
}
|
||||
bool finished = false;
|
||||
if (mPassThrough) {
|
||||
MOZ_ASSERT(outputCount == 1, "For now, we only support nodes that have one output port");
|
||||
mLastChunks[0] = inputChunks[0];
|
||||
mLastChunks[0] = mInputChunks[0];
|
||||
} else {
|
||||
if (maxInputs <= 1 && outputCount <= 1) {
|
||||
mEngine->ProcessBlock(this, inputChunks[0], &mLastChunks[0], &finished);
|
||||
mEngine->ProcessBlock(this, mInputChunks[0], &mLastChunks[0], &finished);
|
||||
} else {
|
||||
mEngine->ProcessBlocksOnPorts(this, inputChunks, mLastChunks, &finished);
|
||||
mEngine->ProcessBlocksOnPorts(this, mInputChunks, mLastChunks, &finished);
|
||||
}
|
||||
}
|
||||
for (auto& chunk : mInputChunks) {
|
||||
// If the buffer is shared then it won't be reused, so release the
|
||||
// reference now. Keep the channel data array to save a free/alloc
|
||||
// pair.
|
||||
chunk.ReleaseBufferIfShared();
|
||||
}
|
||||
for (uint16_t i = 0; i < outputCount; ++i) {
|
||||
NS_ASSERTION(mLastChunks[i].GetDuration() == WEBAUDIO_BLOCK_SIZE,
|
||||
"Invalid WebAudio chunk size");
|
||||
|
@ -571,7 +601,7 @@ AudioNodeStream::AdvanceOutputSegment()
|
|||
StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK);
|
||||
AudioSegment* segment = track->Get<AudioSegment>();
|
||||
|
||||
if (mKind == MediaStreamGraph::EXTERNAL_STREAM) {
|
||||
if (mFlags & EXTERNAL_OUTPUT) {
|
||||
segment->AppendAndConsumeChunk(&mLastChunks[0]);
|
||||
} else {
|
||||
segment->AppendNullData(mLastChunks[0].GetDuration());
|
||||
|
|
|
@ -43,15 +43,33 @@ public:
|
|||
|
||||
typedef nsAutoTArray<AudioChunk, 1> OutputChunks;
|
||||
|
||||
// Flags re main thread updates and stream output.
|
||||
typedef unsigned Flags;
|
||||
enum : Flags {
|
||||
NO_STREAM_FLAGS = 0U,
|
||||
NEED_MAIN_THREAD_FINISHED = 1U << 0,
|
||||
NEED_MAIN_THREAD_CURRENT_TIME = 1U << 1,
|
||||
// Internal AudioNodeStreams can only pass their output to another
|
||||
// AudioNode, whereas external AudioNodeStreams can pass their output
|
||||
// to other ProcessedMediaStreams or hardware audio output.
|
||||
EXTERNAL_OUTPUT = 1U << 2,
|
||||
};
|
||||
/**
|
||||
* Create a stream that will process audio for an AudioNode.
|
||||
* Takes ownership of aEngine.
|
||||
*/
|
||||
static already_AddRefed<AudioNodeStream>
|
||||
Create(MediaStreamGraph* aGraph, AudioNodeEngine* aEngine, Flags aKind);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Transfers ownership of aEngine to the new AudioNodeStream.
|
||||
*/
|
||||
AudioNodeStream(AudioNodeEngine* aEngine,
|
||||
MediaStreamGraph::AudioNodeStreamKind aKind,
|
||||
Flags aFlags,
|
||||
TrackRate aSampleRate,
|
||||
AudioContext::AudioContextId aContextId);
|
||||
|
||||
protected:
|
||||
~AudioNodeStream();
|
||||
|
||||
public:
|
||||
|
@ -111,9 +129,8 @@ public:
|
|||
}
|
||||
virtual bool MainThreadNeedsUpdates() const override
|
||||
{
|
||||
// Only source and external streams need updates on the main thread.
|
||||
return (mKind == MediaStreamGraph::SOURCE_STREAM && mFinished) ||
|
||||
mKind == MediaStreamGraph::EXTERNAL_STREAM;
|
||||
return ((mFlags & NEED_MAIN_THREAD_FINISHED) && mFinished) ||
|
||||
(mFlags & NEED_MAIN_THREAD_CURRENT_TIME);
|
||||
}
|
||||
virtual bool IsIntrinsicallyConsumed() const override
|
||||
{
|
||||
|
@ -166,6 +183,9 @@ protected:
|
|||
|
||||
// The engine that will generate output for this node.
|
||||
nsAutoPtr<AudioNodeEngine> mEngine;
|
||||
// The mixed input blocks are kept from iteration to iteration to avoid
|
||||
// reallocating channel data arrays.
|
||||
OutputChunks mInputChunks;
|
||||
// The last block produced by this node.
|
||||
OutputChunks mLastChunks;
|
||||
// The stream's sampling rate
|
||||
|
@ -174,7 +194,7 @@ protected:
|
|||
// AudioContext. It is set on the main thread, in the constructor.
|
||||
const AudioContext::AudioContextId mAudioContextId;
|
||||
// Whether this is an internal or external stream
|
||||
const MediaStreamGraph::AudioNodeStreamKind mKind;
|
||||
const Flags mFlags;
|
||||
// The number of input channels that this stream requires. 0 means don't care.
|
||||
uint32_t mNumberOfInputChannels;
|
||||
// The mixing modes
|
||||
|
|
|
@ -100,9 +100,8 @@ AudioParam::Stream()
|
|||
|
||||
AudioNodeEngine* engine = new AudioNodeEngine(nullptr);
|
||||
nsRefPtr<AudioNodeStream> stream =
|
||||
mNode->Context()->Graph()->CreateAudioNodeStream(engine,
|
||||
MediaStreamGraph::INTERNAL_STREAM,
|
||||
Node()->Context()->SampleRate());
|
||||
AudioNodeStream::Create(mNode->Context()->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
|
||||
// Force the input to have only one channel, and make it down-mix using
|
||||
// the speaker rules if needed.
|
||||
|
|
|
@ -250,7 +250,8 @@ BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
|
|||
, mGain(new AudioParam(this, SendGainToStream, 0.f, "gain"))
|
||||
{
|
||||
BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ ChannelMergerNode::ChannelMergerNode(AudioContext* aContext,
|
|||
ChannelInterpretation::Speakers)
|
||||
, mInputCount(aInputCount)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(new ChannelMergerNodeEngine(this),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(),
|
||||
new ChannelMergerNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
}
|
||||
|
||||
ChannelMergerNode::~ChannelMergerNode()
|
||||
|
|
|
@ -60,8 +60,9 @@ ChannelSplitterNode::ChannelSplitterNode(AudioContext* aContext,
|
|||
ChannelInterpretation::Speakers)
|
||||
, mOutputCount(aOutputCount)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(new ChannelSplitterNodeEngine(this),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(),
|
||||
new ChannelSplitterNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
}
|
||||
|
||||
ChannelSplitterNode::~ChannelSplitterNode()
|
||||
|
|
|
@ -191,7 +191,8 @@ ConvolverNode::ConvolverNode(AudioContext* aContext)
|
|||
, mNormalize(true)
|
||||
{
|
||||
ConvolverNodeEngine* engine = new ConvolverNodeEngine(this, mNormalize);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
}
|
||||
|
||||
ConvolverNode::~ConvolverNode()
|
||||
|
|
|
@ -198,7 +198,8 @@ DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
|
|||
DelayNodeEngine* engine =
|
||||
new DelayNodeEngine(this, aContext->Destination(),
|
||||
aContext->SampleRate() * aMaxDelay);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,8 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
|
|||
, mRelease(new AudioParam(this, SendReleaseToStream, 0.25f, "release"))
|
||||
{
|
||||
DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@ GainNode::GainNode(AudioContext* aContext)
|
|||
, mGain(new AudioParam(this, SendGainToStream, 1.0f, "gain"))
|
||||
{
|
||||
GainNodeEngine* engine = new GainNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a
|
|||
ProcessedMediaStream* outputStream = mDOMStream->GetStream()->AsProcessedStream();
|
||||
MOZ_ASSERT(!!outputStream);
|
||||
AudioNodeEngine* engine = new AudioNodeEngine(this);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::EXTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::EXTERNAL_OUTPUT);
|
||||
mPort = outputStream->AllocateInputPort(mStream);
|
||||
|
||||
nsIDocument* doc = aContext->GetParentObject()->GetExtantDoc();
|
||||
|
|
|
@ -39,7 +39,7 @@ MediaStreamAudioSourceNode::MediaStreamAudioSourceNode(AudioContext* aContext,
|
|||
mInputStream(aMediaStream)
|
||||
{
|
||||
AudioNodeEngine* engine = new MediaStreamAudioSourceNodeEngine(this);
|
||||
mStream = aContext->Graph()->CreateAudioNodeExternalInputStream(engine);
|
||||
mStream = AudioNodeExternalInputStream::Create(aContext->Graph(), engine);
|
||||
ProcessedMediaStream* outputStream = static_cast<ProcessedMediaStream*>(mStream.get());
|
||||
mInputPort = outputStream->AllocateInputPort(aMediaStream->GetStream(),
|
||||
MediaInputPort::FLAG_BLOCK_INPUT);
|
||||
|
|
|
@ -384,7 +384,8 @@ OscillatorNode::OscillatorNode(AudioContext* aContext)
|
|||
, mStartCalled(false)
|
||||
{
|
||||
OscillatorNodeEngine* engine = new OscillatorNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NEED_MAIN_THREAD_FINISHED);
|
||||
engine->SetSourceStream(mStream);
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
|
|
@ -240,8 +240,9 @@ PannerNode::PannerNode(AudioContext* aContext)
|
|||
, mConeOuterAngle(360.)
|
||||
, mConeOuterGain(0.)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(new PannerNodeEngine(this),
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(),
|
||||
new PannerNodeEngine(this),
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
// We should register once we have set up our stream and engine.
|
||||
Context()->Listener()->RegisterPannerNode(this);
|
||||
}
|
||||
|
|
|
@ -520,7 +520,8 @@ ScriptProcessorNode::ScriptProcessorNode(AudioContext* aContext,
|
|||
aContext->Destination(),
|
||||
BufferSize(),
|
||||
aNumberOfInputChannels);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ StereoPannerNode::StereoPannerNode(AudioContext* aContext)
|
|||
, mPan(new AudioParam(this, SendPanToStream, 0.f, "pan"))
|
||||
{
|
||||
StereoPannerNodeEngine* engine = new StereoPannerNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine,
|
||||
MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
engine->SetSourceStream(mStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,8 @@ WaveShaperNode::WaveShaperNode(AudioContext* aContext)
|
|||
mozilla::HoldJSObjects(this);
|
||||
|
||||
WaveShaperNodeEngine* engine = new WaveShaperNodeEngine(this);
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
|
||||
mStream = AudioNodeStream::Create(aContext->Graph(), engine,
|
||||
AudioNodeStream::NO_STREAM_FLAGS);
|
||||
}
|
||||
|
||||
WaveShaperNode::~WaveShaperNode()
|
||||
|
|
|
@ -273,7 +273,7 @@ SystemMessageInternal.prototype = {
|
|||
type: aType,
|
||||
msg: aMessage,
|
||||
extra: aExtra });
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Give this message an ID so that we can identify the message and
|
||||
|
@ -285,9 +285,17 @@ SystemMessageInternal.prototype = {
|
|||
|
||||
let shouldDispatchFunc = this._getMessageConfigurator(aType).shouldDispatch;
|
||||
|
||||
// Find pages that registered an handler for this type.
|
||||
this._pages.forEach(function(aPage) {
|
||||
if (aPage.type !== aType) {
|
||||
if (!this._pages.length) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Find pages that registered a handler for this type.
|
||||
let promises = [];
|
||||
for (let i = 0; i < this._pages.length; i++) {
|
||||
let promise = ((page) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (page.type !== aType) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -295,10 +303,11 @@ SystemMessageInternal.prototype = {
|
|||
let result = this._sendMessageCommon(aType,
|
||||
aMessage,
|
||||
messageID,
|
||||
aPage.pageURL,
|
||||
aPage.manifestURL,
|
||||
page.pageURL,
|
||||
page.manifestURL,
|
||||
aExtra);
|
||||
debug("Returned status of sending message: " + result);
|
||||
resolve();
|
||||
};
|
||||
|
||||
if ('function' !== typeof shouldDispatchFunc) {
|
||||
|
@ -308,14 +317,18 @@ SystemMessageInternal.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
shouldDispatchFunc(aPage.manifestURL, aPage.pageURL, aType, aMessage, aExtra)
|
||||
shouldDispatchFunc(page.manifestURL, page.pageURL, aType, aMessage, aExtra)
|
||||
.then(aShouldDispatch => {
|
||||
if (aShouldDispatch) {
|
||||
doDispatch();
|
||||
}
|
||||
});
|
||||
});
|
||||
})(this._pages[i]);
|
||||
promises.push(promise);
|
||||
}
|
||||
|
||||
}, this);
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
registerPage: function(aType, aPageURI, aManifestURI) {
|
||||
|
|
|
@ -10,7 +10,7 @@ interface nsIMessageSender;
|
|||
|
||||
// Implemented by the contract id @mozilla.org/system-message-internal;1
|
||||
|
||||
[scriptable, uuid(54c8e274-decb-4258-9a24-4ebfcbf3d00a)]
|
||||
[scriptable, uuid(59b6beda-f911-4d47-a296-8c81e6abcfb9)]
|
||||
interface nsISystemMessagesInternal : nsISupports
|
||||
{
|
||||
/*
|
||||
|
@ -36,8 +36,10 @@ interface nsISystemMessagesInternal : nsISupports
|
|||
* @param message The message payload.
|
||||
* @param extra Extra opaque information that will be passed around in the observer
|
||||
* notification to open the page.
|
||||
* returns a Promise
|
||||
*/
|
||||
void broadcastMessage(in DOMString type, in jsval message, [optional] in jsval extra);
|
||||
nsISupports broadcastMessage(in DOMString type, in jsval message,
|
||||
[optional] in jsval extra);
|
||||
|
||||
/*
|
||||
* Registration of a page that wants to be notified of a message type.
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
[test_hasPendingMessage.html]
|
||||
[DEFAULT]
|
||||
skip-if = (buildapp != "browser") || e10s
|
||||
support-files = file_hasPendingMessage.html
|
||||
support-files =
|
||||
file_hasPendingMessage.html
|
||||
invalid_manifest.webapp
|
||||
invalid_manifest.webapp^headers^
|
||||
manifest.webapp
|
||||
manifest.webapp^headers^
|
||||
|
||||
[test_hasPendingMessage.html]
|
||||
[test_sysmsg_registration.html]
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "Random app",
|
||||
"launch_path": "/index.html",
|
||||
"messages": [{
|
||||
"dummy-system-message": "/index.html",
|
||||
"dummy-system-message2": "/index.html"
|
||||
}]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Content-Type: application/manifest+json
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "Random app",
|
||||
"launch_path": "/index.html",
|
||||
"messages": [{
|
||||
"dummy-system-message": "/index.html"
|
||||
}, {
|
||||
"dummy-system-message2": "/index.html"
|
||||
}]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Content-Type: application/manifest+json
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
const { utils: Cu, interfaces: Ci, classes: Cc } = Components;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
@ -70,10 +71,23 @@
|
|||
test_frame.src = testURL + "#setMessageHandler2";
|
||||
return expectAlert(test_frame, "handle message", "message handled");
|
||||
}).then(() => {
|
||||
// Setp 7. Check hasPendingMessages2
|
||||
// Step 7. Check hasPendingMessages2
|
||||
return expectAlert(test_frame, "no hasPendingMessages",
|
||||
"no hasPendingMessages after mozSetMessageHandler");
|
||||
}).then(() => {
|
||||
// Be nice with the rest of the tests and clean up what we registered.
|
||||
let appsSvc = Cc["@mozilla.org/AppsService;1"]
|
||||
.getService(Ci.nsIAppsService);
|
||||
let appId = appsSvc.getAppLocalIdByManifestURL(manifestURL);
|
||||
let subject = {
|
||||
appId: appId,
|
||||
browserOnly: false,
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
Ci.mozIApplicationClearPrivateDataParams
|
||||
])
|
||||
};
|
||||
Services.obs.notifyObservers(subject, "webapps-clear-data", null);
|
||||
|
||||
test_frame.remove();
|
||||
finish();
|
||||
});
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>System messages registration tests</title>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1162281}">Mozilla Bug {1162281}</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.7">
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
// We need to keep the same CID as the one used on activities tests.
|
||||
// Check https://bugzilla.mozilla.org/show_bug.cgi?id=1176712#c13
|
||||
const SYS_MSG_GLUE_CID = Components.ID("{b0b6b9af-bc4e-4200-bffe-fb7691065ec9}");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "messenger", () => {
|
||||
return Cc["@mozilla.org/system-message-internal;1"]
|
||||
.getService(Ci.nsISystemMessagesInternal);
|
||||
});
|
||||
|
||||
let gRootUrl = "http://test/chrome/dom/messages/test/";
|
||||
let validAppUrl = gRootUrl + "manifest.webapp";
|
||||
let invalidAppUrl = gRootUrl + "invalid_manifest.webapp";
|
||||
let validApp;
|
||||
let initialAppsCount;
|
||||
let index = 0;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function go() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "webapps-manage", "allow": 1, "context": document },
|
||||
{ "type": "browser", "allow": 1, "context": document },
|
||||
{ "type": "embed-apps", "allow": 1, "context": document }],
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set': [["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.sysmsg.enabled", true]]},
|
||||
next) });
|
||||
}
|
||||
|
||||
function finish() {
|
||||
unregisterComponent(SystemMessageGlue);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function next() {
|
||||
info("Step " + index);
|
||||
if (index >= steps.length) {
|
||||
ok(false, "Shouldn't get here!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
let i = index++;
|
||||
steps[i]();
|
||||
} catch(ex) {
|
||||
ok(false, "Caught exception", ex);
|
||||
}
|
||||
}
|
||||
|
||||
function cbError(aEvent) {
|
||||
ok(false, "Error callback invoked " +
|
||||
aEvent.target.error.name + " " + aEvent.target.error.message);
|
||||
finish();
|
||||
}
|
||||
|
||||
function uninstall(aApp) {
|
||||
info("Uninstalling " + (aApp ? aApp.manifestURL : "NO APP!!"));
|
||||
}
|
||||
|
||||
function registerComponent(aObject, aDescription, aContract) {
|
||||
info("Registering " + SYS_MSG_GLUE_CID);
|
||||
|
||||
let componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.registerFactory(SYS_MSG_GLUE_CID, aDescription, aContract, aObject);
|
||||
}
|
||||
|
||||
function unregisterComponent(aObject) {
|
||||
info("Unregistering " + SYS_MSG_GLUE_CID);
|
||||
let componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.unregisterFactory(SYS_MSG_GLUE_CID, aObject);
|
||||
}
|
||||
|
||||
let SystemMessageGlue = {
|
||||
// nsISupports implementation.
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIFactory) ||
|
||||
iid.equals(Ci.nsISystemMessageGlue)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
// nsIFactory implementation.
|
||||
createInstance: function(outer, iid) {
|
||||
return this.QueryInterface(iid);
|
||||
},
|
||||
|
||||
_lastManifestURL: null,
|
||||
|
||||
// nsISystemMessageGlue implementation.
|
||||
openApp(pageURL, manifestURL, type, target, showApp, onlyShowApp, extra) {
|
||||
this._lastManifestURL = manifestURL;
|
||||
}
|
||||
};
|
||||
|
||||
registerComponent(SystemMessageGlue,
|
||||
"System Message Glue",
|
||||
"@mozilla.org/dom/messages/system-message-glue;1");
|
||||
|
||||
function testBroadcastMessage(aMessage, aExpectedManifestURL, aMsg) {
|
||||
SystemMessageGlue._lastManifestURL = null;
|
||||
messenger.broadcastMessage(aMessage, {}, {})
|
||||
.then(() => {
|
||||
is(SystemMessageGlue._lastManifestURL, aExpectedManifestURL, aMsg);
|
||||
next();
|
||||
})
|
||||
.catch(cbError);
|
||||
}
|
||||
|
||||
/**
|
||||
* TESTS
|
||||
*/
|
||||
let steps = [() => {
|
||||
Services.obs.notifyObservers(null, "webapps-registry-ready", null);
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
SpecialPowers.autoConfirmAppInstall(next);
|
||||
}, () => {
|
||||
SpecialPowers.autoConfirmAppUninstall(next);
|
||||
}, () => {
|
||||
// Check how many apps we are starting with.
|
||||
let request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = () => {
|
||||
initialAppsCount = request.result.length;
|
||||
info("Starting with " + initialAppsCount + " apps installed.");
|
||||
next();
|
||||
};
|
||||
}, () => {
|
||||
// We still have not installed any app handling dummy-system-message.
|
||||
testBroadcastMessage("dummy-system-message", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
testBroadcastMessage("dummy-system-message2", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
navigator.mozApps.mgmt.oninstall = () => {
|
||||
validApp = request.result;
|
||||
next();
|
||||
};
|
||||
let request = navigator.mozApps.install(validAppUrl, { });
|
||||
request.error = cbError;
|
||||
request.onsuccess = () => {
|
||||
validApp = request.result;
|
||||
};
|
||||
}, () => {
|
||||
// Installing the test app should register the system message.
|
||||
testBroadcastMessage("dummy-system-message", validAppUrl,
|
||||
"system message should be sent");
|
||||
}, () => {
|
||||
// Installing the test app should register the system message.
|
||||
testBroadcastMessage("dummy-system-message2", validAppUrl,
|
||||
"system message should be sent");
|
||||
}, () => {
|
||||
navigator.mozApps.mgmt.onuninstall = () => {
|
||||
validApp = null;
|
||||
next();
|
||||
};
|
||||
let request = navigator.mozApps.mgmt.uninstall(validApp);
|
||||
request.onerror = cbError;
|
||||
}, () => {
|
||||
// Uninstalling the app should unregister the system messages.
|
||||
testBroadcastMessage("dummy-system-message", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
// Uninstalling the app should unregister the system messages.
|
||||
testBroadcastMessage("dummy-system-message2", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
navigator.mozApps.mgmt.oninstall = () => {
|
||||
validApp = request.result;
|
||||
next();
|
||||
};
|
||||
let request = navigator.mozApps.install(invalidAppUrl, { });
|
||||
request.onerror = () => {
|
||||
ok(true, "should not install invalid app");
|
||||
next();
|
||||
};
|
||||
request.onsuccess = () => {
|
||||
ok(false, "should not install invalid app");
|
||||
finish();
|
||||
};
|
||||
}, () => {
|
||||
testBroadcastMessage("dummy-system-message", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
testBroadcastMessage("dummy-system-message2", null,
|
||||
"no system message should be sent");
|
||||
}, () => {
|
||||
// Check how many apps we are finishing with.
|
||||
let request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = () => {
|
||||
info("Finishing with " + request.result.length + " apps installed.");
|
||||
is(initialAppsCount, request.result.length, "All apps are uninstalled");
|
||||
next();
|
||||
};
|
||||
}, finish];
|
||||
|
||||
addLoadEvent(go);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1242,6 +1242,7 @@ _releaseobject(NPObject* npobj)
|
|||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_releaseobject called from the wrong thread\n"));
|
||||
MOZ_CRASH("NPN_releaseobject called from the wrong thread");
|
||||
}
|
||||
if (!npobj)
|
||||
return;
|
||||
|
|
|
@ -25,11 +25,9 @@ NS_IMPL_ADDREF_INHERITED(AudioChannelManager, DOMEventTargetHelper)
|
|||
NS_IMPL_RELEASE_INHERITED(AudioChannelManager, DOMEventTargetHelper)
|
||||
|
||||
AudioChannelManager::AudioChannelManager()
|
||||
: mState(SWITCH_STATE_UNKNOWN)
|
||||
, mVolumeChannel(-1)
|
||||
: mVolumeChannel(-1)
|
||||
{
|
||||
RegisterSwitchObserver(SWITCH_HEADPHONES, this);
|
||||
mState = GetCurrentSwitchState(SWITCH_HEADPHONES);
|
||||
}
|
||||
|
||||
AudioChannelManager::~AudioChannelManager()
|
||||
|
@ -68,7 +66,7 @@ AudioChannelManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProt
|
|||
void
|
||||
AudioChannelManager::Notify(const SwitchEvent& aEvent)
|
||||
{
|
||||
mState = aEvent.status();
|
||||
mState = Some(aEvent.status());
|
||||
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("headphoneschange"));
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/HalTypes.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "AudioChannelService.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -45,14 +46,17 @@ public:
|
|||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
bool Headphones() const
|
||||
bool Headphones()
|
||||
{
|
||||
// Bug 929139 - Remove the assert check for SWITCH_STATE_UNKNOWN.
|
||||
// If any devices (ex: emulator) didn't have the corresponding sys node for
|
||||
// headset switch state then GonkSwitch will report the unknown state.
|
||||
// So it is possible to get unknown state here.
|
||||
return mState != hal::SWITCH_STATE_OFF &&
|
||||
mState != hal::SWITCH_STATE_UNKNOWN;
|
||||
if (mState.isNothing()) {
|
||||
mState = Some(hal::GetCurrentSwitchState(hal::SWITCH_HEADPHONES));
|
||||
}
|
||||
return mState.value() != hal::SWITCH_STATE_OFF &&
|
||||
mState.value() != hal::SWITCH_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
bool SetVolumeControlChannel(const nsAString& aChannel);
|
||||
|
@ -67,7 +71,7 @@ protected:
|
|||
private:
|
||||
void NotifyVolumeControlChannelChanged();
|
||||
|
||||
hal::SwitchState mState;
|
||||
Maybe<hal::SwitchState> mState;
|
||||
int32_t mVolumeChannel;
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Telephony.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
#include "mozilla/dom/CallEvent.h"
|
||||
#include "mozilla/dom/MozMobileConnectionBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
@ -21,7 +20,6 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "AudioChannelService.h"
|
||||
#include "CallsList.h"
|
||||
#include "TelephonyCall.h"
|
||||
#include "TelephonyCallGroup.h"
|
||||
|
@ -64,12 +62,8 @@ public:
|
|||
};
|
||||
|
||||
Telephony::Telephony(nsPIDOMWindow* aOwner)
|
||||
: DOMEventTargetHelper(aOwner),
|
||||
mIsAudioStartPlaying(false),
|
||||
mAudioAgentNotify(nsIAudioChannelAgent::AUDIO_AGENT_NOTIFY),
|
||||
mHaveDispatchedInterruptBeginEvent(false)
|
||||
: DOMEventTargetHelper(aOwner)
|
||||
{
|
||||
MOZ_ASSERT(aOwner);
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aOwner);
|
||||
MOZ_ASSERT(global);
|
||||
|
||||
|
@ -78,7 +72,6 @@ Telephony::Telephony(nsPIDOMWindow* aOwner)
|
|||
MOZ_ASSERT(!rv.Failed());
|
||||
|
||||
mReadyPromise = promise;
|
||||
mMuted = AudioChannelService::IsAudioChannelMutedByDefault();
|
||||
}
|
||||
|
||||
Telephony::~Telephony()
|
||||
|
@ -525,61 +518,6 @@ Telephony::StopTone(const Optional<uint32_t>& aServiceId, ErrorResult& aRv)
|
|||
aRv = mService->StopTone(serviceId);
|
||||
}
|
||||
|
||||
void
|
||||
Telephony::OwnAudioChannel(ErrorResult& aRv)
|
||||
{
|
||||
if (mAudioAgent) {
|
||||
return;
|
||||
}
|
||||
|
||||
mAudioAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
|
||||
MOZ_ASSERT(mAudioAgent);
|
||||
aRv = mAudioAgent->Init(GetParentObject(),
|
||||
(int32_t)AudioChannel::Telephony, this);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
aRv = HandleAudioAgentState();
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
Telephony::HandleAudioAgentState()
|
||||
{
|
||||
if (!mAudioAgent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Nullable<OwningTelephonyCallOrTelephonyCallGroup> activeCall;
|
||||
GetActive(activeCall);
|
||||
nsresult rv;
|
||||
// Only stop agent when the call is disconnected.
|
||||
if ((!mCalls.Length() && !mGroup->CallsArray().Length()) &&
|
||||
mIsAudioStartPlaying) {
|
||||
mIsAudioStartPlaying = false;
|
||||
rv = mAudioAgent->NotifyStoppedPlaying(mAudioAgentNotify);
|
||||
mAudioAgent = nullptr;
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
} else if (!activeCall.IsNull() && !mIsAudioStartPlaying) {
|
||||
mIsAudioStartPlaying = true;
|
||||
float volume = 1.0;
|
||||
bool muted = false;
|
||||
rv = mAudioAgent->NotifyStartedPlaying(mAudioAgentNotify, &volume, &muted);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
rv = WindowVolumeChanged(volume, muted);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Telephony::GetMuted(ErrorResult& aRv) const
|
||||
{
|
||||
|
@ -653,78 +591,13 @@ Telephony::GetReady(ErrorResult& aRv) const
|
|||
return promise.forget();
|
||||
}
|
||||
|
||||
// nsIAudioChannelAgentCallback
|
||||
|
||||
NS_IMETHODIMP
|
||||
Telephony::WindowVolumeChanged(float aVolume, bool aMuted)
|
||||
{
|
||||
// Check the limitation of the network connection
|
||||
if (mCalls.Length() > 1 ||
|
||||
(mCalls.Length() == 1 && mGroup->CallsArray().Length())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
|
||||
nsRefPtr<Promise> promise = Promise::Create(global, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
// Check the single call or conference call
|
||||
bool isSingleCall = mCalls.Length();
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
if (isSingleCall) {
|
||||
rv = aMuted ? mCalls[0]->Hold(callback) : mCalls[0]->Resume(callback);
|
||||
} else {
|
||||
rv = aMuted ? mGroup->Hold(callback) : mGroup->Resume(callback);
|
||||
}
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
// These events will be triggered when the telephony is interrupted by other
|
||||
// audio channel.
|
||||
if (mMuted != aMuted) {
|
||||
mMuted = aMuted;
|
||||
// We should not dispatch "mozinterruptend" when the system app initializes
|
||||
// the telephony audio from muted to unmuted at the first time. The event
|
||||
// "mozinterruptend" must be dispatched after the "mozinterruptbegin".
|
||||
if (!mHaveDispatchedInterruptBeginEvent && mMuted) {
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("mozinterruptbegin"));
|
||||
mHaveDispatchedInterruptBeginEvent = mMuted;
|
||||
} else if (mHaveDispatchedInterruptBeginEvent && !mMuted) {
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("mozinterruptend"));
|
||||
mHaveDispatchedInterruptBeginEvent = mMuted;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Telephony::WindowAudioCaptureChanged()
|
||||
{
|
||||
// Do nothing
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsITelephonyListener
|
||||
|
||||
NS_IMETHODIMP
|
||||
Telephony::CallStateChanged(uint32_t aLength, nsITelephonyCallInfo** aAllInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
for (uint32_t i = 0; i < aLength; ++i) {
|
||||
rv = HandleCallInfo(aAllInfo[i]);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
rv = HandleAudioAgentState();
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
HandleCallInfo(aAllInfo[i]);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -732,8 +605,7 @@ Telephony::CallStateChanged(uint32_t aLength, nsITelephonyCallInfo** aAllInfo)
|
|||
NS_IMETHODIMP
|
||||
Telephony::EnumerateCallState(nsITelephonyCallInfo* aInfo)
|
||||
{
|
||||
uint32_t currentCallNum = 1;
|
||||
return CallStateChanged(currentCallNum, &aInfo);
|
||||
return HandleCallInfo(aInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/telephony/TelephonyCommon.h"
|
||||
|
||||
#include "nsIAudioChannelAgent.h"
|
||||
#include "nsITelephonyCallInfo.h"
|
||||
#include "nsITelephonyService.h"
|
||||
|
||||
|
@ -32,7 +31,6 @@ class TelephonyDialCallback;
|
|||
class OwningTelephonyCallOrTelephonyCallGroup;
|
||||
|
||||
class Telephony final : public DOMEventTargetHelper,
|
||||
public nsIAudioChannelAgentCallback,
|
||||
private nsITelephonyListener
|
||||
{
|
||||
/**
|
||||
|
@ -46,8 +44,6 @@ class Telephony final : public DOMEventTargetHelper,
|
|||
|
||||
friend class telephony::TelephonyDialCallback;
|
||||
|
||||
// The audio agent is needed to communicate with the audio channel service.
|
||||
nsCOMPtr<nsIAudioChannelAgent> mAudioAgent;
|
||||
nsCOMPtr<nsITelephonyService> mService;
|
||||
nsRefPtr<Listener> mListener;
|
||||
|
||||
|
@ -58,15 +54,8 @@ class Telephony final : public DOMEventTargetHelper,
|
|||
|
||||
nsRefPtr<Promise> mReadyPromise;
|
||||
|
||||
bool mIsAudioStartPlaying;
|
||||
|
||||
uint32_t mAudioAgentNotify;
|
||||
bool mHaveDispatchedInterruptBeginEvent;
|
||||
bool mMuted;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIAUDIOCHANNELAGENTCALLBACK
|
||||
NS_DECL_NSITELEPHONYLISTENER
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Telephony,
|
||||
|
@ -105,15 +94,6 @@ public:
|
|||
void
|
||||
StopTone(const Optional<uint32_t>& aServiceId, ErrorResult& aRv);
|
||||
|
||||
// In the audio channel architecture, the system app needs to know the state
|
||||
// of every audio channel, including the telephony. Therefore, when a
|
||||
// telephony call is activated , the audio channel service would notify the
|
||||
// system app about that. And we need a agent to communicate with the audio
|
||||
// channel service. We would follow the call states to make a correct
|
||||
// notification.
|
||||
void
|
||||
OwnAudioChannel(ErrorResult& aRv);
|
||||
|
||||
bool
|
||||
GetMuted(ErrorResult& aRv) const;
|
||||
|
||||
|
@ -233,10 +213,6 @@ private:
|
|||
|
||||
nsresult
|
||||
HandleCallInfo(nsITelephonyCallInfo* aInfo);
|
||||
|
||||
// Check the call states to decide whether need to send the notificaiton.
|
||||
nsresult
|
||||
HandleAudioAgentState();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -324,10 +324,34 @@ TelephonyCall::Hold(ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
|
||||
NS_WARNING(nsPrintfCString("Hold non-connected call is rejected!"
|
||||
" (State: %u)", mCallState).get());
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
if (mGroup) {
|
||||
NS_WARNING("Hold a call in conference is rejected!");
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
if (!mSwitchable) {
|
||||
NS_WARNING("Hold a non-switchable call is rejected!");
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = Hold(callback);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
aRv = mTelephony->Service()->HoldCall(mServiceId, mCallIndex, callback);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
if (mSecondId) {
|
||||
// No state transition when we switch two numbers within one TelephonyCall
|
||||
// object. Otherwise, the state here will be inconsistent with the backend
|
||||
// RIL and will never be right.
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
return promise.forget();
|
||||
|
@ -341,77 +365,28 @@ TelephonyCall::Resume(ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = Resume(callback);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCall::Hold(nsITelephonyCallback* aCallback)
|
||||
{
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
|
||||
NS_WARNING(nsPrintfCString("Hold non-connected call is rejected!"
|
||||
" (State: %u)", mCallState).get());
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (mGroup) {
|
||||
NS_WARNING("Hold a call in conference is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (!mSwitchable) {
|
||||
NS_WARNING("Hold a non-switchable call is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Service()->HoldCall(mServiceId, mCallIndex, aCallback);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (mSecondId) {
|
||||
// No state transition when we switch two numbers within one TelephonyCall
|
||||
// object. Otherwise, the state here will be inconsistent with the backend
|
||||
// RIL and will never be right.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCall::Resume(nsITelephonyCallback* aCallback)
|
||||
{
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_HELD) {
|
||||
NS_WARNING("Resume non-held call is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
NS_WARNING(nsPrintfCString("Resume non-held call is rejected!"
|
||||
" (State: %u)", mCallState).get());
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
if (mGroup) {
|
||||
NS_WARNING("Resume a call in conference is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
if (!mSwitchable) {
|
||||
NS_WARNING("Resume a non-switchable call is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Service()->ResumeCall(mServiceId, mCallIndex, aCallback);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = mTelephony->Service()->ResumeCall(mServiceId, mCallIndex, callback);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
|
||||
return NS_OK;
|
||||
return promise.forget();
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/dom/TelephonyCallBinding.h"
|
||||
#include "mozilla/dom/TelephonyCallId.h"
|
||||
#include "mozilla/dom/telephony/TelephonyCommon.h"
|
||||
#include "nsITelephonyService.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
|
@ -186,12 +185,6 @@ private:
|
|||
|
||||
~TelephonyCall();
|
||||
|
||||
nsresult
|
||||
Hold(nsITelephonyCallback* aCallback);
|
||||
|
||||
nsresult
|
||||
Resume(nsITelephonyCallback* aCallback);
|
||||
|
||||
void
|
||||
ChangeStateInternal(uint16_t aCallState, bool aFireEvents);
|
||||
|
||||
|
|
|
@ -347,12 +347,16 @@ TelephonyCallGroup::Hold(ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = Hold(callback);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
|
||||
NS_WARNING("Holding a non-connected call is rejected!");
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = mTelephony->Service()->HoldConference(mCalls[0]->ServiceId(),
|
||||
callback);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
|
@ -366,47 +370,15 @@ TelephonyCallGroup::Resume(ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = Resume(callback);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_HELD) {
|
||||
NS_WARNING("Resuming a non-held call is rejected!");
|
||||
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCallGroup::Hold(nsITelephonyCallback* aCallback)
|
||||
{
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
|
||||
NS_WARNING("Holding a non-connected call is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Service()->HoldConference(mCalls[0]->ServiceId(),
|
||||
aCallback);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TelephonyCallGroup::Resume(nsITelephonyCallback* aCallback)
|
||||
{
|
||||
if (mCallState != nsITelephonyService::CALL_STATE_HELD) {
|
||||
NS_WARNING("Resuming a non-held call is rejected!");
|
||||
aCallback->NotifyError(NS_LITERAL_STRING("InvalidStateError"));
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Service()->ResumeConference(mCalls[0]->ServiceId(),
|
||||
aCallback);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsITelephonyCallback> callback = new TelephonyCallback(promise);
|
||||
aRv = mTelephony->Service()->ResumeConference(mCalls[0]->ServiceId(),
|
||||
callback);
|
||||
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
|
||||
return promise.forget();
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TelephonyCallGroup,
|
||||
DOMEventTargetHelper)
|
||||
|
||||
friend class Telephony;
|
||||
|
||||
nsPIDOMWindow*
|
||||
GetParentObject() const
|
||||
{
|
||||
|
@ -110,12 +108,6 @@ private:
|
|||
explicit TelephonyCallGroup(nsPIDOMWindow* aOwner);
|
||||
~TelephonyCallGroup();
|
||||
|
||||
nsresult
|
||||
Hold(nsITelephonyCallback* aCallback);
|
||||
|
||||
nsresult
|
||||
Resume(nsITelephonyCallback* aCallback);
|
||||
|
||||
nsresult
|
||||
NotifyCallsChanged(TelephonyCall* aCall);
|
||||
|
||||
|
|
|
@ -49,12 +49,6 @@ interface Telephony : EventTarget {
|
|||
[Throws]
|
||||
void stopTone(optional unsigned long serviceId);
|
||||
|
||||
// Calling this method, the app will be treated as owner of the telephony
|
||||
// calls from the AudioChannel policy.
|
||||
[Throws,
|
||||
CheckAllPermissions="audio-channel-telephony"]
|
||||
void ownAudioChannel();
|
||||
|
||||
[Throws]
|
||||
attribute boolean muted;
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "TiledContentHost.h"
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "PaintedLayerComposite.h" // for PaintedLayerComposite
|
||||
#include "mozilla/gfx/BaseSize.h" // for BaseSize
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
|
|
|
@ -2652,9 +2652,6 @@ gfxFontGroup::FindNonItalicFaceForChar(gfxFontFamily* aFamily, uint32_t aCh)
|
|||
}
|
||||
|
||||
nsRefPtr<gfxFont> font = fe->FindOrMakeFont(&mStyle, needsBold);
|
||||
if (!font->Valid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return font.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -658,7 +658,7 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
|
|||
mozilla::gfx::Factory::SetDirect3D10Device(mD3D10Device);
|
||||
}
|
||||
|
||||
ScopedGfxFeatureReporter reporter1_1("D2D1.1");
|
||||
ScopedGfxFeatureReporter reporter1_1("D2D1.1V");
|
||||
|
||||
if (Factory::SupportsD2D1()) {
|
||||
reporter1_1.SetSuccessful();
|
||||
|
|
|
@ -425,20 +425,6 @@ ProgressTracker::RemoveObserver(IProgressObserver* aObserver)
|
|||
return removed;
|
||||
}
|
||||
|
||||
bool
|
||||
ProgressTracker::FirstObserverIs(IProgressObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only");
|
||||
ObserverArray::ForwardIterator iter(mObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsRefPtr<IProgressObserver> observer = iter.GetNext().get();
|
||||
if (observer) {
|
||||
return observer.get() == aObserver;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ProgressTracker::OnUnlockedDraw()
|
||||
{
|
||||
|
|
|
@ -155,11 +155,6 @@ public:
|
|||
return mObservers.Length();
|
||||
}
|
||||
|
||||
// This is intentionally non-general because its sole purpose is to support
|
||||
// some obscure network priority logic in imgRequest. That stuff could
|
||||
// probably be improved, but it's too scary to mess with at the moment.
|
||||
bool FirstObserverIs(IProgressObserver* aObserver);
|
||||
|
||||
// Resets our weak reference to our image. Image subclasses should call this
|
||||
// in their destructor.
|
||||
void ResetImage();
|
||||
|
|
|
@ -216,15 +216,6 @@ nsPNGDecoder::EndImageFrame()
|
|||
opacity = Opacity::OPAQUE;
|
||||
}
|
||||
|
||||
#ifdef PNG_APNG_SUPPORTED
|
||||
uint32_t numFrames = GetFrameCount();
|
||||
|
||||
// We can't use mPNG->num_frames_read as it may be one ahead.
|
||||
if (numFrames > 1) {
|
||||
PostInvalidation(mFrameRect);
|
||||
}
|
||||
#endif
|
||||
|
||||
PostFrameStop(opacity, mAnimInfo.mDispose, mAnimInfo.mTimeout,
|
||||
mAnimInfo.mBlend);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ imgRequest::imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey)
|
|||
: mLoader(aLoader)
|
||||
, mCacheKey(aCacheKey)
|
||||
, mLoadId(nullptr)
|
||||
, mFirstProxy(nullptr)
|
||||
, mValidator(nullptr)
|
||||
, mInnerWindowId(0)
|
||||
, mCORSMode(imgIRequest::CORS_NONE)
|
||||
|
@ -218,6 +219,12 @@ imgRequest::AddProxy(imgRequestProxy* proxy)
|
|||
NS_PRECONDITION(proxy, "null imgRequestProxy passed in");
|
||||
LOG_SCOPE_WITH_PARAM(GetImgLog(), "imgRequest::AddProxy", "proxy", proxy);
|
||||
|
||||
if (!mFirstProxy) {
|
||||
// Save a raw pointer to the first proxy we see, for use in the network
|
||||
// priority logic.
|
||||
mFirstProxy = proxy;
|
||||
}
|
||||
|
||||
// If we're empty before adding, we have to tell the loader we now have
|
||||
// proxies.
|
||||
nsRefPtr<ProgressTracker> progressTracker = GetProgressTracker();
|
||||
|
@ -535,8 +542,7 @@ imgRequest::AdjustPriority(imgRequestProxy* proxy, int32_t delta)
|
|||
// concern though is that image loads remain lower priority than other pieces
|
||||
// of content such as link clicks, CSS, and JS.
|
||||
//
|
||||
nsRefPtr<ProgressTracker> progressTracker = GetProgressTracker();
|
||||
if (!progressTracker->FirstObserverIs(proxy)) {
|
||||
if (!mFirstProxy || proxy != mFirstProxy) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,6 +256,10 @@ private:
|
|||
|
||||
void* mLoadId;
|
||||
|
||||
/// Raw pointer to the first proxy that was added to this imgRequest. Use only
|
||||
/// pointer comparisons; there's no guarantee this will remain valid.
|
||||
void* mFirstProxy;
|
||||
|
||||
imgCacheValidator* mValidator;
|
||||
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
||||
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
||||
|
|
|
@ -153,6 +153,164 @@ class HandleBase<TraceableHashMap<A,B,C,D,E,F>>
|
|||
: public TraceableHashMapOperations<JS::Handle<TraceableHashMap<A,B,C,D,E,F>>, A,B,C,D,E,F>
|
||||
{};
|
||||
|
||||
// A TraceableHashSet is a HashSet with an additional trace method that knows
|
||||
// how to visit all set element. HashSets that contain GC pointers that must
|
||||
// be traced to be kept alive will generally want to use this TraceableHashSet
|
||||
// specializeation in lieu of HashSet.
|
||||
//
|
||||
// Most types of GC pointers can be traced with no extra infrastructure. For
|
||||
// structs and non-gc-pointer members, ensure that there is a specialization of
|
||||
// DefaultTracer<T> with an appropriate trace method available to handle the
|
||||
// custom type.
|
||||
//
|
||||
// Note that although this HashSet's trace will deal correctly with moved
|
||||
// elements, it does not itself know when to barrier or trace elements. To
|
||||
// function properly it must either be used with Rooted or barriered and traced
|
||||
// manually.
|
||||
template <typename T,
|
||||
typename HashPolicy = DefaultHasher<T>,
|
||||
typename AllocPolicy = TempAllocPolicy,
|
||||
typename ElemTraceFunc = DefaultTracer<T>>
|
||||
class TraceableHashSet : public HashSet<T, HashPolicy, AllocPolicy>,
|
||||
public JS::Traceable
|
||||
{
|
||||
using Base = HashSet<T, HashPolicy, AllocPolicy>;
|
||||
|
||||
public:
|
||||
explicit TraceableHashSet(AllocPolicy a = AllocPolicy()) : Base(a) {}
|
||||
|
||||
static void trace(TraceableHashSet* set, JSTracer* trc) { set->trace(trc); }
|
||||
void trace(JSTracer* trc) {
|
||||
if (!this->initialized())
|
||||
return;
|
||||
for (typename Base::Enum e(*this); !e.empty(); e.popFront()) {
|
||||
T elem = e.front();
|
||||
ElemTraceFunc::trace(trc, &elem, "hashset element");
|
||||
if (elem != e.front())
|
||||
e.rekeyFront(elem);
|
||||
}
|
||||
}
|
||||
|
||||
// TraceableHashSet is movable
|
||||
TraceableHashSet(TraceableHashSet&& rhs) : Base(mozilla::Forward<TraceableHashSet>(rhs)) {}
|
||||
void operator=(TraceableHashSet&& rhs) {
|
||||
MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited");
|
||||
Base::operator=(mozilla::Forward<TraceableHashSet>(rhs));
|
||||
}
|
||||
|
||||
private:
|
||||
// TraceableHashSet is not copyable or assignable
|
||||
TraceableHashSet(const TraceableHashSet& hs) = delete;
|
||||
TraceableHashSet& operator=(const TraceableHashSet& hs) = delete;
|
||||
};
|
||||
|
||||
template <typename Outer, typename... Args>
|
||||
class TraceableHashSetOperations
|
||||
{
|
||||
using Set = TraceableHashSet<Args...>;
|
||||
using Lookup = typename Set::Lookup;
|
||||
using Ptr = typename Set::Ptr;
|
||||
using AddPtr = typename Set::AddPtr;
|
||||
using Range = typename Set::Range;
|
||||
using Enum = typename Set::Enum;
|
||||
|
||||
const Set& set() const { return static_cast<const Outer*>(this)->extract(); }
|
||||
|
||||
public:
|
||||
bool initialized() const { return set().initialized(); }
|
||||
Ptr lookup(const Lookup& l) const { return set().lookup(l); }
|
||||
AddPtr lookupForAdd(const Lookup& l) const { return set().lookupForAdd(l); }
|
||||
Range all() const { return set().all(); }
|
||||
bool empty() const { return set().empty(); }
|
||||
uint32_t count() const { return set().count(); }
|
||||
size_t capacity() const { return set().capacity(); }
|
||||
uint32_t generation() const { return set().generation(); }
|
||||
bool has(const Lookup& l) const { return set().lookup(l).found(); }
|
||||
};
|
||||
|
||||
template <typename Outer, typename... Args>
|
||||
class MutableTraceableHashSetOperations
|
||||
: public TraceableHashSetOperations<Outer, Args...>
|
||||
{
|
||||
using Set = TraceableHashSet<Args...>;
|
||||
using Lookup = typename Set::Lookup;
|
||||
using Ptr = typename Set::Ptr;
|
||||
using AddPtr = typename Set::AddPtr;
|
||||
using Range = typename Set::Range;
|
||||
using Enum = typename Set::Enum;
|
||||
|
||||
Set& set() { return static_cast<Outer*>(this)->extract(); }
|
||||
|
||||
public:
|
||||
bool init(uint32_t len = 16) { return set().init(len); }
|
||||
void clear() { set().clear(); }
|
||||
void finish() { set().finish(); }
|
||||
void remove(const Lookup& l) { set().remove(l); }
|
||||
|
||||
template<typename TInput>
|
||||
bool add(AddPtr& p, TInput&& t) {
|
||||
return set().add(p, mozilla::Forward<TInput>(t));
|
||||
}
|
||||
|
||||
template<typename TInput>
|
||||
bool relookupOrAdd(AddPtr& p, const Lookup& l, TInput&& t) {
|
||||
return set().relookupOrAdd(p, l, mozilla::Forward<TInput>(t));
|
||||
}
|
||||
|
||||
template<typename TInput>
|
||||
bool put(TInput&& t) {
|
||||
return set().put(mozilla::Forward<TInput>(t));
|
||||
}
|
||||
|
||||
template<typename TInput>
|
||||
bool putNew(TInput&& t) {
|
||||
return set().putNew(mozilla::Forward<TInput>(t));
|
||||
}
|
||||
|
||||
template<typename TInput>
|
||||
bool putNew(const Lookup& l, TInput&& t) {
|
||||
return set().putNew(l, mozilla::Forward<TInput>(t));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename HP, typename AP, typename TF>
|
||||
class RootedBase<TraceableHashSet<T, HP, AP, TF>>
|
||||
: public MutableTraceableHashSetOperations<JS::Rooted<TraceableHashSet<T, HP, AP, TF>>, T, HP, AP, TF>
|
||||
{
|
||||
using Set = TraceableHashSet<T, HP, AP, TF>;
|
||||
|
||||
friend class TraceableHashSetOperations<JS::Rooted<Set>, T, HP, AP, TF>;
|
||||
const Set& extract() const { return *static_cast<const JS::Rooted<Set>*>(this)->address(); }
|
||||
|
||||
friend class MutableTraceableHashSetOperations<JS::Rooted<Set>, T, HP, AP, TF>;
|
||||
Set& extract() { return *static_cast<JS::Rooted<Set>*>(this)->address(); }
|
||||
};
|
||||
|
||||
template <typename T, typename HP, typename AP, typename TF>
|
||||
class MutableHandleBase<TraceableHashSet<T, HP, AP, TF>>
|
||||
: public MutableTraceableHashSetOperations<JS::MutableHandle<TraceableHashSet<T, HP, AP, TF>>,
|
||||
T, HP, AP, TF>
|
||||
{
|
||||
using Set = TraceableHashSet<T, HP, AP, TF>;
|
||||
|
||||
friend class TraceableHashSetOperations<JS::MutableHandle<Set>, T, HP, AP, TF>;
|
||||
const Set& extract() const {
|
||||
return *static_cast<const JS::MutableHandle<Set>*>(this)->address();
|
||||
}
|
||||
|
||||
friend class MutableTraceableHashSetOperations<JS::MutableHandle<Set>, T, HP, AP, TF>;
|
||||
Set& extract() { return *static_cast<JS::MutableHandle<Set>*>(this)->address(); }
|
||||
};
|
||||
|
||||
template <typename T, typename HP, typename AP, typename TF>
|
||||
class HandleBase<TraceableHashSet<T, HP, AP, TF>>
|
||||
: public TraceableHashSetOperations<JS::Handle<TraceableHashSet<T, HP, AP, TF>>, T, HP, AP, TF>
|
||||
{
|
||||
using Set = TraceableHashSet<T, HP, AP, TF>;
|
||||
friend class TraceableHashSetOperations<JS::Handle<Set>, T, HP, AP, TF>;
|
||||
const Set& extract() const { return *static_cast<const JS::Handle<Set>*>(this)->address(); }
|
||||
};
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* gc_HashTable_h */
|
||||
|
|
|
@ -539,6 +539,12 @@ TryEnablingJit(JSContext* cx, AsmJSModule& module, HandleFunction fun, uint32_t
|
|||
return true;
|
||||
}
|
||||
|
||||
// Don't enable jit entry when we have a pending ion builder.
|
||||
// Take the interpreter path which will link it and enable
|
||||
// the fast path on the next call.
|
||||
if (script->baselineScript()->hasPendingIonBuilder())
|
||||
return true;
|
||||
|
||||
// Currently we can't rectify arguments. Therefore disabling if argc is too low.
|
||||
if (fun->nargs() > size_t(argc))
|
||||
return true;
|
||||
|
|
|
@ -489,8 +489,6 @@ case "$target" in
|
|||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
|
||||
# Definitions matching sdkddkver.h
|
||||
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
function t() {
|
||||
var o = {l: 0xfffffffff};
|
||||
var l = o.l - 0xffffffffe;
|
||||
var a = getSelfHostedValue('NewDenseArray');
|
||||
var arr = a(l);
|
||||
assertEq(arr.length, 1);
|
||||
}
|
||||
t();
|
||||
t();
|
|
@ -0,0 +1,18 @@
|
|||
h = function(m, foreign, n) {
|
||||
"use asm";
|
||||
var ff = foreign.ff;
|
||||
function f(x) {
|
||||
x = +x;
|
||||
ff();
|
||||
}
|
||||
return f;
|
||||
}(0, {
|
||||
ff: function() {
|
||||
return {
|
||||
e: String.prototype.substring
|
||||
};
|
||||
}
|
||||
}, 0);
|
||||
for (var k = 0; k < 999; k++) {
|
||||
h();
|
||||
}
|
|
@ -478,6 +478,21 @@ BaselineScript::Destroy(FreeOp* fop, BaselineScript* script)
|
|||
fop->delete_(script);
|
||||
}
|
||||
|
||||
void
|
||||
BaselineScript::clearDependentAsmJSModules()
|
||||
{
|
||||
// Remove any links from AsmJSModules that contain optimized FFI calls into
|
||||
// this BaselineScript.
|
||||
if (dependentAsmJSModules_) {
|
||||
for (size_t i = 0; i < dependentAsmJSModules_->length(); i++) {
|
||||
DependentAsmJSModuleExit exit = (*dependentAsmJSModules_)[i];
|
||||
exit.module->detachJitCompilation(exit.exitIndex);
|
||||
}
|
||||
|
||||
dependentAsmJSModules_->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BaselineScript::unlinkDependentAsmJSModules(FreeOp* fop)
|
||||
{
|
||||
|
|
|
@ -401,6 +401,7 @@ struct BaselineScript
|
|||
|
||||
bool addDependentAsmJSModule(JSContext* cx, DependentAsmJSModuleExit exit);
|
||||
void unlinkDependentAsmJSModules(FreeOp* fop);
|
||||
void clearDependentAsmJSModules();
|
||||
void removeDependentAsmJSModule(DependentAsmJSModuleExit exit);
|
||||
|
||||
// Toggle debug traps (used for breakpoints and step mode) in the script.
|
||||
|
@ -477,6 +478,9 @@ struct BaselineScript
|
|||
|
||||
pendingBuilder_ = builder;
|
||||
|
||||
// lazy linking cannot happen during asmjs to ion.
|
||||
clearDependentAsmJSModules();
|
||||
|
||||
script->updateBaselineOrIonRaw(maybecx);
|
||||
}
|
||||
void removePendingIonBuilder(JSScript* script) {
|
||||
|
|
|
@ -229,6 +229,7 @@ JitRuntime::initialize(JSContext* cx)
|
|||
if (class_ == FrameSizeClass::ClassLimit())
|
||||
break;
|
||||
bailoutTables_.infallibleAppend((JitCode*)nullptr);
|
||||
JitSpew(JitSpew_Codegen, "# Bailout table");
|
||||
bailoutTables_[id] = generateBailoutTable(cx, id);
|
||||
if (!bailoutTables_[id])
|
||||
return false;
|
||||
|
@ -297,6 +298,7 @@ JitRuntime::initialize(JSContext* cx)
|
|||
|
||||
JitSpew(JitSpew_Codegen, "# Emitting VM function wrappers");
|
||||
for (VMFunction* fun = VMFunction::functions; fun; fun = fun->next) {
|
||||
JitSpew(JitSpew_Codegen, "# VM function wrapper");
|
||||
if (!generateVMWrapper(cx, *fun))
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#include "jscompartment.h"
|
||||
#ifdef JS_DISASM_ARM
|
||||
#include "jsprf.h"
|
||||
#endif
|
||||
#include "jsutil.h"
|
||||
|
||||
#include "gc/Marking.h"
|
||||
#include "jit/arm/disasm/Disasm-arm.h"
|
||||
#include "jit/arm/MacroAssembler-arm.h"
|
||||
#include "jit/ExecutableAllocator.h"
|
||||
#include "jit/JitCompartment.h"
|
||||
|
@ -1405,18 +1409,260 @@ Assembler::bytesNeeded() const
|
|||
preBarrierTableBytes();
|
||||
}
|
||||
|
||||
#ifdef JS_DISASM_ARM
|
||||
|
||||
// Labels are named as they are encountered by adding names to a
|
||||
// table, using the Label address as the key. This is made tricky by
|
||||
// the (memory for) Label objects being reused, but reused label
|
||||
// objects are recognizable from being marked as not used or not
|
||||
// bound. See spewResolve().
|
||||
//
|
||||
// In a number of cases there is no information about the target, and
|
||||
// we just end up printing "patchable constant load to PC". This is
|
||||
// true especially for jumps to bailout handlers (which have no
|
||||
// names). See spewData() and its callers. In some cases (loop back
|
||||
// edges) some information about the intended target may be propagated
|
||||
// from higher levels, and if so it's printed here.
|
||||
|
||||
void
|
||||
Assembler::spew(Instruction* i)
|
||||
{
|
||||
if (spewDisabled() || !i)
|
||||
return;
|
||||
disasm::NameConverter converter;
|
||||
disasm::Disassembler dasm(converter);
|
||||
disasm::EmbeddedVector<char, disasm::ReasonableBufferSize> buffer;
|
||||
uint8_t* loc = reinterpret_cast<uint8_t*>(const_cast<uint32_t*>(i->raw()));
|
||||
dasm.InstructionDecode(buffer, loc);
|
||||
spew(" %08x %s", reinterpret_cast<uint32_t>(loc), buffer.start());
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spewTarget(Label* target)
|
||||
{
|
||||
if (spewDisabled())
|
||||
return;
|
||||
spew(" -> %d%s", spewResolve(target), !target->bound() ? "f" : "");
|
||||
}
|
||||
|
||||
// If a target label is known, always print that and do not attempt to
|
||||
// disassemble the branch operands, as they will often be encoding
|
||||
// metainformation (pointers for a chain of jump instructions), and
|
||||
// not actual branch targets.
|
||||
|
||||
void
|
||||
Assembler::spewBranch(Instruction* i, Label* target /* may be nullptr */)
|
||||
{
|
||||
if (spewDisabled() || !i)
|
||||
return;
|
||||
disasm::NameConverter converter;
|
||||
disasm::Disassembler dasm(converter);
|
||||
disasm::EmbeddedVector<char, disasm::ReasonableBufferSize> buffer;
|
||||
uint8_t* loc = reinterpret_cast<uint8_t*>(const_cast<uint32_t*>(i->raw()));
|
||||
dasm.InstructionDecode(buffer, loc);
|
||||
char labelBuf[128];
|
||||
labelBuf[0] = 0;
|
||||
if (!target)
|
||||
JS_snprintf(labelBuf, sizeof(labelBuf), " -> (link-time target)");
|
||||
if (InstBranchImm::IsTHIS(*i)) {
|
||||
InstBranchImm* bimm = InstBranchImm::AsTHIS(*i);
|
||||
BOffImm destOff;
|
||||
bimm->extractImm(&destOff);
|
||||
if (destOff.isInvalid() || target) {
|
||||
// The target information in the instruction is likely garbage, so remove it.
|
||||
// The target label will in any case be printed if we have it.
|
||||
//
|
||||
// The format of the instruction disassembly is [0-9a-f]{8}\s+\S+\s+.*,
|
||||
// where the \S+ string is the opcode. Strip everything after the opcode,
|
||||
// and attach the label if we have it.
|
||||
int i;
|
||||
for ( i=8 ; i < buffer.length() && buffer[i] == ' ' ; i++ )
|
||||
;
|
||||
for ( ; i < buffer.length() && buffer[i] != ' ' ; i++ )
|
||||
;
|
||||
buffer[i] = 0;
|
||||
if (target) {
|
||||
JS_snprintf(labelBuf, sizeof(labelBuf), " -> %d%s", spewResolve(target),
|
||||
!target->bound() ? "f" : "");
|
||||
target = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
spew(" %08x %s%s", reinterpret_cast<uint32_t>(loc), buffer.start(), labelBuf);
|
||||
if (target)
|
||||
spewTarget(target);
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spewLabel(Label* l)
|
||||
{
|
||||
if (spewDisabled())
|
||||
return;
|
||||
spew(" %d:", spewResolve(l));
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spewRetarget(Label* label, Label* target)
|
||||
{
|
||||
if (spewDisabled())
|
||||
return;
|
||||
spew(" %d: .retarget -> %d%s",
|
||||
spewResolve(label), spewResolve(target), !target->bound() ? "f" : "");
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spewData(BufferOffset addr, size_t numInstr, bool loadToPC)
|
||||
{
|
||||
if (spewDisabled())
|
||||
return;
|
||||
Instruction* inst = m_buffer.getInstOrNull(addr);
|
||||
if (!inst)
|
||||
return;
|
||||
uint32_t *instr = reinterpret_cast<uint32_t*>(inst);
|
||||
for ( size_t k=0 ; k < numInstr ; k++ ) {
|
||||
spew(" %08x %08x (patchable constant load%s)",
|
||||
reinterpret_cast<uint32_t>(instr+k), *(instr+k), loadToPC ? " to PC" : "");
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Assembler::spewDisabled()
|
||||
{
|
||||
return !(JitSpewEnabled(JitSpew_Codegen) || printer_);
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spew(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
spew(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::spew(const char* fmt, va_list va)
|
||||
{
|
||||
if (printer_) {
|
||||
printer_->vprintf(fmt, va);
|
||||
printer_->put("\n");
|
||||
}
|
||||
js::jit::JitSpewVA(js::jit::JitSpew_Codegen, fmt, va);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Assembler::spewResolve(Label* l)
|
||||
{
|
||||
// Note, spewResolve will sometimes return 0 when it is triggered
|
||||
// by the profiler and not by a full disassembly, since in that
|
||||
// case a label can be used or bound but not previously have been
|
||||
// defined.
|
||||
return l->used() || l->bound() ? spewProbe(l) : spewDefine(l);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Assembler::spewProbe(Label* l)
|
||||
{
|
||||
uint32_t key = reinterpret_cast<uint32_t>(l);
|
||||
uint32_t value = 0;
|
||||
spewNodes_.lookup(key, &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Assembler::spewDefine(Label* l)
|
||||
{
|
||||
uint32_t key = reinterpret_cast<uint32_t>(l);
|
||||
spewNodes_.remove(key);
|
||||
uint32_t value = spewNext_++;
|
||||
if (!spewNodes_.add(key, value))
|
||||
return 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
Assembler::SpewNodes::~SpewNodes()
|
||||
{
|
||||
Node* p = nodes;
|
||||
while (p) {
|
||||
Node* victim = p;
|
||||
p = p->next;
|
||||
js_free(victim);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Assembler::SpewNodes::lookup(uint32_t key, uint32_t* value)
|
||||
{
|
||||
for ( Node* p = nodes ; p ; p = p->next ) {
|
||||
if (p->key == key) {
|
||||
*value = p->value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Assembler::SpewNodes::add(uint32_t key, uint32_t value)
|
||||
{
|
||||
Node* node = (Node*)js_malloc(sizeof(Node));
|
||||
if (!node)
|
||||
return false;
|
||||
node->key = key;
|
||||
node->value = value;
|
||||
node->next = nodes;
|
||||
nodes = node;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Assembler::SpewNodes::remove(uint32_t key)
|
||||
{
|
||||
for ( Node* p = nodes, *pp = nullptr ; p ; pp = p, p = p->next ) {
|
||||
if (p->key == key) {
|
||||
if (pp)
|
||||
pp->next = p->next;
|
||||
else
|
||||
nodes = p->next;
|
||||
js_free(p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // JS_DISASM_ARM
|
||||
|
||||
// Write a blob of binary into the instruction stream.
|
||||
BufferOffset
|
||||
Assembler::writeInst(uint32_t x)
|
||||
{
|
||||
return m_buffer.putInt(x);
|
||||
BufferOffset offs = m_buffer.putInt(x);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spew(m_buffer.getInstOrNull(offs));
|
||||
#endif
|
||||
return offs;
|
||||
}
|
||||
|
||||
BufferOffset
|
||||
Assembler::writeBranchInst(uint32_t x)
|
||||
Assembler::writeBranchInst(uint32_t x, Label* documentation)
|
||||
{
|
||||
return m_buffer.putInt(x, /* markAsBranch = */ true);
|
||||
BufferOffset offs = m_buffer.putInt(x, /* markAsBranch = */ true);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInstOrNull(offs), documentation);
|
||||
#endif
|
||||
return offs;
|
||||
}
|
||||
|
||||
// Allocate memory for a branch instruction, it will be overwritten
|
||||
// subsequently and should not be disassembled.
|
||||
|
||||
BufferOffset
|
||||
Assembler::allocBranchInst()
|
||||
{
|
||||
return m_buffer.putInt(Always | InstNOP::NopInst, /* markAsBranch = */ true);
|
||||
}
|
||||
|
||||
void
|
||||
Assembler::WriteInstStatic(uint32_t x, uint32_t* dest)
|
||||
{
|
||||
|
@ -1867,12 +2113,34 @@ Assembler::as_dtm(LoadStore ls, Register rn, uint32_t mask,
|
|||
return writeInst(0x08000000 | RN(rn) | ls | mode | mask | c | wb);
|
||||
}
|
||||
|
||||
// Note, it's possible for markAsBranch and loadToPC to disagree,
|
||||
// because some loads to the PC are not necessarily encoding
|
||||
// instructions that should be marked as branches: only patchable
|
||||
// near branch instructions should be marked.
|
||||
|
||||
BufferOffset
|
||||
Assembler::allocEntry(size_t numInst, unsigned numPoolEntries,
|
||||
uint8_t* inst, uint8_t* data, ARMBuffer::PoolEntry* pe,
|
||||
bool markAsBranch, bool loadToPC)
|
||||
{
|
||||
BufferOffset offs = m_buffer.allocEntry(numInst, numPoolEntries, inst, data, pe, markAsBranch);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewData(offs, numInst, loadToPC);
|
||||
#endif
|
||||
return offs;
|
||||
}
|
||||
|
||||
// This is also used for instructions that might be resolved into branches,
|
||||
// or might not. If dest==pc then it is effectively a branch.
|
||||
|
||||
BufferOffset
|
||||
Assembler::as_Imm32Pool(Register dest, uint32_t value, Condition c)
|
||||
{
|
||||
PoolHintPun php;
|
||||
php.phd.init(0, c, PoolHintData::PoolDTR, dest);
|
||||
return m_buffer.allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value);
|
||||
BufferOffset offs = allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value, nullptr, false,
|
||||
dest == pc);
|
||||
return offs;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
@ -1891,12 +2159,13 @@ Assembler::WritePoolEntry(Instruction* addr, Condition c, uint32_t data)
|
|||
}
|
||||
|
||||
BufferOffset
|
||||
Assembler::as_BranchPool(uint32_t value, RepatchLabel* label, ARMBuffer::PoolEntry* pe, Condition c)
|
||||
Assembler::as_BranchPool(uint32_t value, RepatchLabel* label, ARMBuffer::PoolEntry* pe, Condition c,
|
||||
Label* documentation)
|
||||
{
|
||||
PoolHintPun php;
|
||||
php.phd.init(0, c, PoolHintData::PoolBranch, pc);
|
||||
BufferOffset ret = m_buffer.allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value, pe,
|
||||
/* markAsBranch = */ true);
|
||||
BufferOffset ret = allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value, pe,
|
||||
/* markAsBranch = */ true, /* loadToPC = */ true);
|
||||
// If this label is already bound, then immediately replace the stub load
|
||||
// with a correct branch.
|
||||
if (label->bound()) {
|
||||
|
@ -1905,6 +2174,10 @@ Assembler::as_BranchPool(uint32_t value, RepatchLabel* label, ARMBuffer::PoolEnt
|
|||
} else {
|
||||
label->use(ret.getOffset());
|
||||
}
|
||||
#ifdef JS_DISASM_ARM
|
||||
if (documentation)
|
||||
spewTarget(documentation);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1914,7 +2187,7 @@ Assembler::as_FImm64Pool(VFPRegister dest, double value, Condition c)
|
|||
MOZ_ASSERT(dest.isDouble());
|
||||
PoolHintPun php;
|
||||
php.phd.init(0, c, PoolHintData::PoolVDTR, dest);
|
||||
return m_buffer.allocEntry(1, 2, (uint8_t*)&php.raw, (uint8_t*)&value);
|
||||
return allocEntry(1, 2, (uint8_t*)&php.raw, (uint8_t*)&value);
|
||||
}
|
||||
|
||||
BufferOffset
|
||||
|
@ -1926,7 +2199,7 @@ Assembler::as_FImm32Pool(VFPRegister dest, float value, Condition c)
|
|||
MOZ_ASSERT(dest.isSingle());
|
||||
PoolHintPun php;
|
||||
php.phd.init(0, c, PoolHintData::PoolVDTR, dest);
|
||||
return m_buffer.allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value);
|
||||
return allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value);
|
||||
}
|
||||
|
||||
// Pool callbacks stuff:
|
||||
|
@ -2086,9 +2359,9 @@ Assembler::WritePoolGuard(BufferOffset branch, Instruction* dest, BufferOffset a
|
|||
// Branch can branch to an immediate *or* to a register.
|
||||
// Branches to immediates are pc relative, branches to registers are absolute.
|
||||
BufferOffset
|
||||
Assembler::as_b(BOffImm off, Condition c)
|
||||
Assembler::as_b(BOffImm off, Condition c, Label* documentation)
|
||||
{
|
||||
BufferOffset ret = writeBranchInst(((int)c) | OpB | off.encode());
|
||||
BufferOffset ret = writeBranchInst(((int)c) | OpB | off.encode(), documentation);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2102,8 +2375,11 @@ Assembler::as_b(Label* l, Condition c)
|
|||
|
||||
if (l->bound()) {
|
||||
// Note only one instruction is emitted here, the NOP is overwritten.
|
||||
BufferOffset ret = writeBranchInst(Always | InstNOP::NopInst);
|
||||
BufferOffset ret = allocBranchInst();
|
||||
as_b(BufferOffset(l).diffB<BOffImm>(ret), c, ret);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInstOrNull(ret), l);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2117,11 +2393,11 @@ Assembler::as_b(Label* l, Condition c)
|
|||
m_buffer.fail_bail();
|
||||
return ret;
|
||||
}
|
||||
ret = as_b(BOffImm(old), c);
|
||||
ret = as_b(BOffImm(old), c, l);
|
||||
} else {
|
||||
old = LabelBase::INVALID_OFFSET;
|
||||
BOffImm inv;
|
||||
ret = as_b(inv, c);
|
||||
ret = as_b(inv, c, l);
|
||||
}
|
||||
DebugOnly<int32_t> check = l->use(ret.getOffset());
|
||||
MOZ_ASSERT(check == old);
|
||||
|
@ -2131,6 +2407,8 @@ Assembler::as_b(Label* l, Condition c)
|
|||
BufferOffset
|
||||
Assembler::as_b(BOffImm off, Condition c, BufferOffset inst)
|
||||
{
|
||||
// JS_DISASM_ARM NOTE: Can't disassemble here, because numerous callers use this to
|
||||
// patchup old code. Must disassemble in caller where it makes sense. Not many callers.
|
||||
*editSrc(inst) = InstBImm(off, c);
|
||||
return inst;
|
||||
}
|
||||
|
@ -2149,9 +2427,9 @@ Assembler::as_blx(Register r, Condition c)
|
|||
// bl can only branch to an pc-relative immediate offset
|
||||
// It cannot change the processor state.
|
||||
BufferOffset
|
||||
Assembler::as_bl(BOffImm off, Condition c)
|
||||
Assembler::as_bl(BOffImm off, Condition c, Label* documentation)
|
||||
{
|
||||
return writeBranchInst(((int)c) | OpBl | off.encode());
|
||||
return writeBranchInst(((int)c) | OpBl | off.encode(), documentation);
|
||||
}
|
||||
|
||||
BufferOffset
|
||||
|
@ -2164,8 +2442,11 @@ Assembler::as_bl(Label* l, Condition c)
|
|||
|
||||
if (l->bound()) {
|
||||
// Note only one instruction is emitted here, the NOP is overwritten.
|
||||
BufferOffset ret = writeBranchInst(Always | InstNOP::NopInst);
|
||||
BufferOffset ret = allocBranchInst();
|
||||
as_bl(BufferOffset(l).diffB<BOffImm>(ret), c, ret);
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewBranch(m_buffer.getInstOrNull(ret), l);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2180,11 +2461,11 @@ Assembler::as_bl(Label* l, Condition c)
|
|||
m_buffer.fail_bail();
|
||||
return ret;
|
||||
}
|
||||
ret = as_bl(BOffImm(old), c);
|
||||
ret = as_bl(BOffImm(old), c, l);
|
||||
} else {
|
||||
old = LabelBase::INVALID_OFFSET;
|
||||
BOffImm inv;
|
||||
ret = as_bl(inv, c);
|
||||
ret = as_bl(inv, c, l);
|
||||
}
|
||||
DebugOnly<int32_t> check = l->use(ret.getOffset());
|
||||
MOZ_ASSERT(check == old);
|
||||
|
@ -2508,6 +2789,9 @@ Assembler::nextLink(BufferOffset b, BufferOffset* next)
|
|||
void
|
||||
Assembler::bind(Label* label, BufferOffset boff)
|
||||
{
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewLabel(label);
|
||||
#endif
|
||||
if (label->used()) {
|
||||
bool more;
|
||||
// If our caller didn't give us an explicit target to bind to then we
|
||||
|
@ -2535,6 +2819,9 @@ Assembler::bind(Label* label, BufferOffset boff)
|
|||
void
|
||||
Assembler::bind(RepatchLabel* label)
|
||||
{
|
||||
// It does not seem to be useful to record this label for
|
||||
// disassembly, as the value that is bound to the label is often
|
||||
// effectively garbage and is replaced by something else later.
|
||||
BufferOffset dest = nextOffset();
|
||||
if (label->used()) {
|
||||
// If the label has a use, then change this use to refer to the bound
|
||||
|
@ -2558,6 +2845,9 @@ Assembler::bind(RepatchLabel* label)
|
|||
void
|
||||
Assembler::retarget(Label* label, Label* target)
|
||||
{
|
||||
#ifdef JS_DISASM_ARM
|
||||
spewRetarget(label, target);
|
||||
#endif
|
||||
if (label->used()) {
|
||||
if (target->bound()) {
|
||||
bind(label, BufferOffset(target));
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче