Merge mozilla-central to mozilla-inbound on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2014-12-15 15:33:21 +01:00
Родитель d436487485 5ecb9d3b7b
Коммит bad074f263
43 изменённых файлов: 646 добавлений и 354 удалений

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

@ -58,7 +58,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
'cutils', 'cutils',
] ]
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS'] OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
if CONFIG['ANDROID_VERSION'] in ('17', '18', '19'): if CONFIG['ANDROID_VERSION'] in ('17', '18', '19', '21'):
OS_LIBS += [ OS_LIBS += [
'gui', 'gui',
'suspend', 'suspend',

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361"> <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- 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/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"/> <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,13 +19,13 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/> <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/> <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

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

@ -17,10 +17,10 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things --> <!-- Stock Android things -->
@ -136,7 +136,7 @@
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c5f8d282efe4a4e8b1e31a37300944e338e60e4f"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c5f8d282efe4a4e8b1e31a37300944e338e60e4f"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/> <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="58567be92162a64b3bbcc1cce911a27ca935610f"/> <project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="026478f008f26e568fb189a5be2928f9b18e3efa"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/> <project name="android-sdk" path="sdk" remote="b2g" revision="8b1365af38c9a653df97349ee53a3f5d64fd590a"/>
<project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/> <project name="darwinstreamingserver" path="system/darwinstreamingserver" remote="b2g" revision="cf85968c7f85e0ec36e72c87ceb4837a943b8af6"/>
</manifest> </manifest>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361"> <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- 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/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"/> <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"/>

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

@ -19,13 +19,13 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d5d3f93914558b6f168447b805cd799c8233e300"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="6fa7a4936414ceb4055fd27f7a30e76790f834fb"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/> <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/> <project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361"> <project name="platform_build" path="build" remote="b2g" revision="3ab0d9c70f0b2e1ededc679112c392303f037361">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
@ -23,7 +23,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- 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/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"/> <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"/>
@ -156,7 +156,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/> <project name="platform/hardware/ril" path="hardware/ril" revision="12b1977cc704b35f2e9db2bb423fa405348bc2f3"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/> <project name="platform/system/bluetooth" path="system/bluetooth" revision="985bf15264d865fe7b9c5b45f61c451cbaafa43d"/>
<project name="platform/system/core" path="system/core" revision="350eac5403124dacb2a5fd9e28ac290a59fc3b8e"/> <project name="platform/system/core" path="system/core" revision="350eac5403124dacb2a5fd9e28ac290a59fc3b8e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="58567be92162a64b3bbcc1cce911a27ca935610f"/> <project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="026478f008f26e568fb189a5be2928f9b18e3efa"/>
<project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/> <project name="platform/system/qcom" path="system/qcom" revision="63e3f6f176caad587d42bba4c16b66d953fb23c2"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/> <project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="d8952a42771045fca73ec600e2b42a4c7129d723"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="018b44e52b2bac5d3631d559550e88a4b68c6e67"/> <project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="018b44e52b2bac5d3631d559550e88a4b68c6e67"/>

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

@ -17,10 +17,10 @@
</project> </project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things --> <!-- Stock Android things -->
@ -145,7 +145,7 @@
<project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/> <project name="platform/hardware/ril" path="hardware/ril" revision="c4e2ac95907a5519a0e09f01a0d8e27fec101af0"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/> <project name="platform/system/bluetooth" path="system/bluetooth" revision="e1eb226fa3ad3874ea7b63c56a9dc7012d7ff3c2"/>
<project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/> <project name="platform/system/core" path="system/core" revision="adc485d8755af6a61641d197de7cfef667722580"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="58567be92162a64b3bbcc1cce911a27ca935610f"/> <project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="026478f008f26e568fb189a5be2928f9b18e3efa"/>
<project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/> <project name="platform/system/qcom" path="system/qcom" revision="1cdab258b15258b7f9657da70e6f06ebd5a2fc25"/>
<project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/> <project name="platform/vendor/qcom/msm8610" path="device/qcom/msm8610" revision="4ae5df252123591d5b941191790e7abed1bce5a4"/>
<project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/> <project name="platform/vendor/qcom-opensource/wlan/prima" path="vendor/qcom/opensource/wlan/prima" revision="ce18b47b4a4f93a581d672bbd5cb6d12fe796ca9"/>

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

@ -4,6 +4,6 @@
"remote": "", "remote": "",
"branch": "" "branch": ""
}, },
"revision": "f741dca42f03f16982c026484be42126a60a8adc", "revision": "9607d52833bfa08f7aededcb384cf2be5b707b6b",
"repo_path": "integration/gaia-central" "repo_path": "integration/gaia-central"
} }

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

@ -17,11 +17,11 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<!-- Stock Android things --> <!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/> <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/> <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

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

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -17,10 +17,10 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/> <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/> <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things --> <!-- Stock Android things -->
@ -131,7 +131,7 @@
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/> <project name="device-mako" path="device/lge/mako" remote="b2g" revision="78d17f0c117f0c66dd55ee8d5c5dde8ccc93ecba"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/> <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
<project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/> <project name="device/lge/mako-kernel" path="device/lge/mako-kernel" revision="d1729e53d71d711c8fde25eab8728ff2b9b4df0e"/>
<project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="58567be92162a64b3bbcc1cce911a27ca935610f"/> <project name="platform_system_nfcd" path="system/nfcd" remote="b2g" revision="026478f008f26e568fb189a5be2928f9b18e3efa"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/> <project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/> <project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
<project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/> <project name="platform/hardware/broadcom/wlan" path="hardware/broadcom/wlan" revision="0e1929fa3aa38bf9d40e9e953d619fab8164c82e"/>

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

@ -17,12 +17,12 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e2a3e606675c346b6e6f35351a458040be599b09"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5b01c018e79a36d7ca1e466c143c76fac7da705"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="50ad16a280fe9cfa0716f8c6ba16afdf7f266b49"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/> <project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/> <project name="moztt" path="external/moztt" remote="b2g" revision="fe893bb760a3bb64375f62fdf4762a58c59df9ef"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="04e95f6fbe74ff8627d3a80b5967b794388e75ff"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="09519af2056879ce0ea59f7085ac4b282c7d01d0"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/> <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things --> <!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/> <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

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

@ -7284,7 +7284,7 @@ dnl our own linker.
if test "$OS_TARGET" = Android; then if test "$OS_TARGET" = Android; then
MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv" MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2" MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
fi fi
fi fi

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

@ -15,11 +15,10 @@
using namespace mozilla; using namespace mozilla;
nsWeakPtr CameraControlImpl::sCameraThread; /* static */ StaticRefPtr<nsIThread> CameraControlImpl::sCameraThread;
CameraControlImpl::CameraControlImpl(uint32_t aCameraId) CameraControlImpl::CameraControlImpl()
: mListenerLock(PR_NewRWLock(PR_RWLOCK_RANK_NONE, "CameraControlImpl.Listeners.Lock")) : mListenerLock(PR_NewRWLock(PR_RWLOCK_RANK_NONE, "CameraControlImpl.Listeners.Lock"))
, mCameraId(aCameraId)
, mPreviewState(CameraControlListener::kPreviewStopped) , mPreviewState(CameraControlListener::kPreviewStopped)
, mHardwareState(CameraControlListener::kHardwareClosed) , mHardwareState(CameraControlListener::kHardwareClosed)
, mHardwareStateChangeReason(NS_OK) , mHardwareStateChangeReason(NS_OK)
@ -27,7 +26,7 @@ CameraControlImpl::CameraControlImpl(uint32_t aCameraId)
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
// reuse the same camera thread to conserve resources // reuse the same camera thread to conserve resources
nsCOMPtr<nsIThread> ct = do_QueryReferent(sCameraThread); nsCOMPtr<nsIThread> ct = do_QueryInterface(sCameraThread);
if (ct) { if (ct) {
mCameraThread = ct.forget(); mCameraThread = ct.forget();
} else { } else {
@ -35,9 +34,7 @@ CameraControlImpl::CameraControlImpl(uint32_t aCameraId)
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
MOZ_CRASH("Failed to create new Camera Thread"); MOZ_CRASH("Failed to create new Camera Thread");
} }
sCameraThread = mCameraThread;
// keep a weak reference to the new thread
sCameraThread = do_GetWeakReference(mCameraThread);
} }
// Care must be taken with the mListenerLock read-write lock to prevent // Care must be taken with the mListenerLock read-write lock to prevent
@ -58,6 +55,8 @@ CameraControlImpl::CameraControlImpl(uint32_t aCameraId)
CameraControlImpl::~CameraControlImpl() CameraControlImpl::~CameraControlImpl()
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(mListenerLock, "mListenerLock missing in ~CameraControlImpl()"); MOZ_ASSERT(mListenerLock, "mListenerLock missing in ~CameraControlImpl()");
if (mListenerLock) { if (mListenerLock) {
PR_DestroyRWLock(mListenerLock); PR_DestroyRWLock(mListenerLock);
@ -65,12 +64,6 @@ CameraControlImpl::~CameraControlImpl()
} }
} }
void
CameraControlImpl::Shutdown()
{
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
}
void void
CameraControlImpl::OnHardwareStateChange(CameraControlListener::HardwareState aNewState, CameraControlImpl::OnHardwareStateChange(CameraControlListener::HardwareState aNewState,
nsresult aReason) nsresult aReason)

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

@ -28,7 +28,7 @@ namespace layers {
class CameraControlImpl : public ICameraControl class CameraControlImpl : public ICameraControl
{ {
public: public:
explicit CameraControlImpl(uint32_t aCameraId); explicit CameraControlImpl();
virtual void AddListener(CameraControlListener* aListener) MOZ_OVERRIDE; virtual void AddListener(CameraControlListener* aListener) MOZ_OVERRIDE;
virtual void RemoveListener(CameraControlListener* aListener) MOZ_OVERRIDE; virtual void RemoveListener(CameraControlListener* aListener) MOZ_OVERRIDE;
@ -47,10 +47,6 @@ public:
virtual nsresult StopRecording() MOZ_OVERRIDE; virtual nsresult StopRecording() MOZ_OVERRIDE;
virtual nsresult ResumeContinuousFocus() MOZ_OVERRIDE; virtual nsresult ResumeContinuousFocus() MOZ_OVERRIDE;
uint32_t GetCameraId() { return mCameraId; }
virtual void Shutdown() MOZ_OVERRIDE;
// Event handlers called directly from outside this class. // Event handlers called directly from outside this class.
void OnShutter(); void OnShutter();
void OnUserError(CameraControlListener::UserContext aContext, nsresult aError); void OnUserError(CameraControlListener::UserContext aContext, nsresult aError);
@ -77,7 +73,7 @@ protected:
// don't want that reference to keep the thread object around unnecessarily, // don't want that reference to keep the thread object around unnecessarily,
// so we make it a weak reference. The strong dynamic references will keep // so we make it a weak reference. The strong dynamic references will keep
// the thread object alive as needed. // the thread object alive as needed.
static nsWeakPtr sCameraThread; static StaticRefPtr<nsIThread> sCameraThread;
nsCOMPtr<nsIThread> mCameraThread; nsCOMPtr<nsIThread> mCameraThread;
virtual ~CameraControlImpl(); virtual ~CameraControlImpl();
@ -128,8 +124,6 @@ protected:
void OnShutterInternal(); void OnShutterInternal();
void OnClosedInternal(); void OnClosedInternal();
uint32_t mCameraId;
CameraControlListener::CameraListenerConfiguration mCurrentConfiguration; CameraControlListener::CameraListenerConfiguration mCurrentConfiguration;
CameraControlListener::PreviewState mPreviewState; CameraControlListener::PreviewState mPreviewState;

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

@ -136,6 +136,7 @@ void
CameraPreviewMediaStream::Destroy() CameraPreviewMediaStream::Destroy()
{ {
MutexAutoLock lock(mMutex); MutexAutoLock lock(mMutex);
mMainThreadDestroyed = true;
DestroyImpl(); DestroyImpl();
} }

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

@ -32,8 +32,8 @@ protected:
* This is a stream for camera preview. * This is a stream for camera preview.
* *
* XXX It is a temporary fix of SourceMediaStream. * XXX It is a temporary fix of SourceMediaStream.
* A camera preview requests no delay and no buffering stream. * A camera preview requests no delay and no buffering stream,
* But the SourceMediaStream do not support it. * but the SourceMediaStream does not support it.
*/ */
class CameraPreviewMediaStream : public MediaStream class CameraPreviewMediaStream : public MediaStream
{ {
@ -50,7 +50,7 @@ public:
virtual void ChangeExplicitBlockerCount(int32_t aDelta) MOZ_OVERRIDE; virtual void ChangeExplicitBlockerCount(int32_t aDelta) MOZ_OVERRIDE;
virtual void AddListener(MediaStreamListener* aListener) MOZ_OVERRIDE; virtual void AddListener(MediaStreamListener* aListener) MOZ_OVERRIDE;
virtual void RemoveListener(MediaStreamListener* aListener) MOZ_OVERRIDE; virtual void RemoveListener(MediaStreamListener* aListener) MOZ_OVERRIDE;
virtual void Destroy(); virtual void Destroy() MOZ_OVERRIDE;
void OnPreviewStateChange(bool aActive); void OnPreviewStateChange(bool aActive);
void Invalidate(); void Invalidate();

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

@ -7,15 +7,79 @@
#include "DOMCameraCapabilities.h" #include "DOMCameraCapabilities.h"
#include "nsPIDOMWindow.h" #include "nsPIDOMWindow.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsProxyRelease.h"
#include "mozilla/dom/CameraManagerBinding.h" #include "mozilla/dom/CameraManagerBinding.h"
#include "mozilla/dom/CameraCapabilitiesBinding.h" #include "mozilla/dom/CameraCapabilitiesBinding.h"
#include "Navigator.h" #include "Navigator.h"
#include "CameraCommon.h" #include "CameraCommon.h"
#include "ICameraControl.h" #include "ICameraControl.h"
#include "CameraControlListener.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
/**
* CameraClosedListenerProxy and CameraClosedMessage
*/
template<class T>
class CameraClosedMessage : public nsRunnable
{
public:
CameraClosedMessage(nsMainThreadPtrHandle<T> aListener)
: mListener(aListener)
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}
NS_IMETHODIMP
Run() MOZ_OVERRIDE
{
MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<T> listener = mListener.get();
if (listener) {
listener->OnHardwareClosed();
}
return NS_OK;
}
protected:
virtual ~CameraClosedMessage()
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}
nsMainThreadPtrHandle<T> mListener;
};
template<class T>
class CameraClosedListenerProxy : public CameraControlListener
{
public:
CameraClosedListenerProxy(T* aListener)
: mListener(new nsMainThreadPtrHolder<T>(aListener))
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}
virtual void
OnHardwareStateChange(HardwareState aState, nsresult aReason) MOZ_OVERRIDE
{
if (aState != kHardwareClosed) {
return;
}
NS_DispatchToMainThread(new CameraClosedMessage<T>(mListener));
}
protected:
virtual ~CameraClosedListenerProxy()
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
}
nsMainThreadPtrHandle<T> mListener;
};
/** /**
* CameraRecorderVideoProfile * CameraRecorderVideoProfile
*/ */
@ -96,7 +160,10 @@ CameraRecorderAudioProfile::~CameraRecorderAudioProfile()
/** /**
* CameraRecorderProfile * CameraRecorderProfile
*/ */
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CameraRecorderProfile, mParent) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CameraRecorderProfile,
mParent,
mVideo,
mAudio)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CameraRecorderProfile) NS_IMPL_CYCLE_COLLECTING_ADDREF(CameraRecorderProfile)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CameraRecorderProfile) NS_IMPL_CYCLE_COLLECTING_RELEASE(CameraRecorderProfile)
@ -136,7 +203,9 @@ CameraRecorderProfile::~CameraRecorderProfile()
/** /**
* CameraRecorderProfiles * CameraRecorderProfiles
*/ */
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CameraRecorderProfiles, mParent) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(CameraRecorderProfiles,
mParent,
mProfiles)
NS_IMPL_CYCLE_COLLECTING_ADDREF(CameraRecorderProfiles) NS_IMPL_CYCLE_COLLECTING_ADDREF(CameraRecorderProfiles)
NS_IMPL_CYCLE_COLLECTING_RELEASE(CameraRecorderProfiles) NS_IMPL_CYCLE_COLLECTING_RELEASE(CameraRecorderProfiles)
@ -158,6 +227,10 @@ CameraRecorderProfiles::CameraRecorderProfiles(nsISupports* aParent,
, mCameraControl(aCameraControl) , mCameraControl(aCameraControl)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
if (mCameraControl) {
mListener = new CameraClosedListenerProxy<CameraRecorderProfiles>(this);
mCameraControl->AddListener(mListener);
}
} }
CameraRecorderProfiles::~CameraRecorderProfiles() CameraRecorderProfiles::~CameraRecorderProfiles()
@ -170,6 +243,10 @@ CameraRecorderProfiles::GetSupportedNames(unsigned aFlags, nsTArray<nsString>& a
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p, flags=0x%x\n", DOM_CAMERA_LOGT("%s:%d : this=%p, flags=0x%x\n",
__func__, __LINE__, this, aFlags); __func__, __LINE__, this, aFlags);
if (!mCameraControl) {
aNames.Clear();
return;
}
nsresult rv = mCameraControl->GetRecorderProfiles(aNames); nsresult rv = mCameraControl->GetRecorderProfiles(aNames);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
@ -182,6 +259,9 @@ CameraRecorderProfiles::NamedGetter(const nsAString& aName, bool& aFound)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p, name='%s'\n", __func__, __LINE__, this, DOM_CAMERA_LOGT("%s:%d : this=%p, name='%s'\n", __func__, __LINE__, this,
NS_ConvertUTF16toUTF8(aName).get()); NS_ConvertUTF16toUTF8(aName).get());
if (!mCameraControl) {
return nullptr;
}
CameraRecorderProfile* profile = mProfiles.GetWeak(aName, &aFound); CameraRecorderProfile* profile = mProfiles.GetWeak(aName, &aFound);
if (!aFound || !profile) { if (!aFound || !profile) {
@ -204,6 +284,19 @@ CameraRecorderProfiles::NameIsEnumerable(const nsAString& aName)
return true; return true;
} }
void
CameraRecorderProfiles::OnHardwareClosed()
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread());
if (mCameraControl) {
mCameraControl->RemoveListener(mListener);
mCameraControl = nullptr;
}
mListener = nullptr;
}
/** /**
* CameraCapabilities * CameraCapabilities
*/ */
@ -226,17 +319,14 @@ CameraCapabilities::HasSupport(JSContext* aCx, JSObject* aGlobal)
CameraCapabilities::CameraCapabilities(nsPIDOMWindow* aWindow, CameraCapabilities::CameraCapabilities(nsPIDOMWindow* aWindow,
ICameraControl* aCameraControl) ICameraControl* aCameraControl)
: mMaxFocusAreas(0) : mWindow(aWindow)
, mMaxMeteringAreas(0)
, mMaxDetectedFaces(0)
, mMinExposureCompensation(0.0)
, mMaxExposureCompensation(0.0)
, mExposureCompensationStep(0.0)
, mWindow(aWindow)
, mCameraControl(aCameraControl) , mCameraControl(aCameraControl)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_COUNT_CTOR(CameraCapabilities); if (mCameraControl) {
mListener = new CameraClosedListenerProxy<CameraCapabilities>(this);
mCameraControl->AddListener(mListener);
}
} }
CameraCapabilities::~CameraCapabilities() CameraCapabilities::~CameraCapabilities()
@ -245,6 +335,19 @@ CameraCapabilities::~CameraCapabilities()
MOZ_COUNT_DTOR(CameraCapabilities); MOZ_COUNT_DTOR(CameraCapabilities);
} }
void
CameraCapabilities::OnHardwareClosed()
{
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread());
if (mCameraControl) {
mCameraControl->RemoveListener(mListener);
mCameraControl = nullptr;
}
mListener = nullptr;
}
JSObject* JSObject*
CameraCapabilities::WrapObject(JSContext* aCx) CameraCapabilities::WrapObject(JSContext* aCx)
{ {
@ -262,6 +365,10 @@ CameraCapabilities::WrapObject(JSContext* aCx)
nsresult nsresult
CameraCapabilities::TranslateToDictionary(uint32_t aKey, nsTArray<CameraSize>& aSizes) CameraCapabilities::TranslateToDictionary(uint32_t aKey, nsTArray<CameraSize>& aSizes)
{ {
if (NS_WARN_IF(!mCameraControl)) {
return NS_ERROR_NOT_AVAILABLE;
}
nsresult rv; nsresult rv;
nsTArray<ICameraControl::Size> sizes; nsTArray<ICameraControl::Size> sizes;
@ -281,219 +388,224 @@ CameraCapabilities::TranslateToDictionary(uint32_t aKey, nsTArray<CameraSize>& a
return NS_OK; return NS_OK;
} }
// The following attributes are tagged [Cached, Constant] in the WebIDL, so
// the framework will handle caching them for us.
void void
CameraCapabilities::GetPreviewSizes(nsTArray<dom::CameraSize>& retval) CameraCapabilities::GetPreviewSizes(nsTArray<dom::CameraSize>& aRetVal)
{ {
if (mPreviewSizes.Length() == 0) { nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_PREVIEWSIZES, aRetVal);
nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_PREVIEWSIZES, LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PREVIEWSIZES);
mPreviewSizes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PREVIEWSIZES);
}
retval = mPreviewSizes;
} }
void void
CameraCapabilities::GetPictureSizes(nsTArray<dom::CameraSize>& retval) CameraCapabilities::GetPictureSizes(nsTArray<dom::CameraSize>& aRetVal)
{ {
if (mPictureSizes.Length() == 0) { nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_PICTURESIZES, aRetVal);
nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_PICTURESIZES, LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PICTURESIZES);
mPictureSizes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PICTURESIZES);
}
retval = mPictureSizes;
} }
void void
CameraCapabilities::GetThumbnailSizes(nsTArray<dom::CameraSize>& retval) CameraCapabilities::GetThumbnailSizes(nsTArray<dom::CameraSize>& aRetVal)
{ {
if (mThumbnailSizes.Length() == 0) { nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES, aRetVal);
nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES, LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES);
mThumbnailSizes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES);
}
retval = mThumbnailSizes;
} }
void void
CameraCapabilities::GetVideoSizes(nsTArray<dom::CameraSize>& retval) CameraCapabilities::GetVideoSizes(nsTArray<dom::CameraSize>& aRetVal)
{ {
if (mVideoSizes.Length() == 0) { nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_VIDEOSIZES, aRetVal);
nsresult rv = TranslateToDictionary(CAMERA_PARAM_SUPPORTED_VIDEOSIZES, LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_VIDEOSIZES);
mVideoSizes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_VIDEOSIZES);
}
retval = mVideoSizes;
} }
void void
CameraCapabilities::GetFileFormats(nsTArray<nsString>& retval) CameraCapabilities::GetFileFormats(nsTArray<nsString>& aRetVal)
{ {
if (mFileFormats.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_PICTUREFORMATS, return;
mFileFormats);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PICTUREFORMATS);
} }
retval = mFileFormats;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_PICTUREFORMATS, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_PICTUREFORMATS);
} }
void void
CameraCapabilities::GetWhiteBalanceModes(nsTArray<nsString>& retval) CameraCapabilities::GetWhiteBalanceModes(nsTArray<nsString>& aRetVal)
{ {
if (mWhiteBalanceModes.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_WHITEBALANCES, return;
mWhiteBalanceModes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_WHITEBALANCES);
} }
retval = mWhiteBalanceModes;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_WHITEBALANCES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_WHITEBALANCES);
} }
void void
CameraCapabilities::GetSceneModes(nsTArray<nsString>& retval) CameraCapabilities::GetSceneModes(nsTArray<nsString>& aRetVal)
{ {
if (mSceneModes.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_SCENEMODES, return;
mSceneModes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_SCENEMODES);
} }
retval = mSceneModes;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_SCENEMODES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_SCENEMODES);
} }
void void
CameraCapabilities::GetEffects(nsTArray<nsString>& retval) CameraCapabilities::GetEffects(nsTArray<nsString>& aRetVal)
{ {
if (mEffects.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_EFFECTS, return;
mEffects);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_EFFECTS);
} }
retval = mEffects;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_EFFECTS, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_EFFECTS);
} }
void void
CameraCapabilities::GetFlashModes(nsTArray<nsString>& retval) CameraCapabilities::GetFlashModes(nsTArray<nsString>& aRetVal)
{ {
if (mFlashModes.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_FLASHMODES, return;
mFlashModes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_FLASHMODES);
} }
retval = mFlashModes;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_FLASHMODES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_FLASHMODES);
} }
void void
CameraCapabilities::GetFocusModes(nsTArray<nsString>& retval) CameraCapabilities::GetFocusModes(nsTArray<nsString>& aRetVal)
{ {
if (mFocusModes.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_FOCUSMODES, return;
mFocusModes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_FOCUSMODES);
} }
retval = mFocusModes;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_FOCUSMODES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_FOCUSMODES);
} }
void void
CameraCapabilities::GetZoomRatios(nsTArray<double>& retval) CameraCapabilities::GetZoomRatios(nsTArray<double>& aRetVal)
{ {
if (mZoomRatios.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_ZOOMRATIOS, return;
mZoomRatios);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_ZOOMRATIOS);
} }
retval = mZoomRatios;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_ZOOMRATIOS, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_ZOOMRATIOS);
} }
uint32_t uint32_t
CameraCapabilities::MaxFocusAreas() CameraCapabilities::MaxFocusAreas()
{ {
if (mMaxFocusAreas == 0) { if (NS_WARN_IF(!mCameraControl)) {
int32_t areas; return 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXFOCUSAREAS,
areas);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXFOCUSAREAS);
mMaxFocusAreas = areas < 0 ? 0 : areas;
} }
return mMaxFocusAreas;
int32_t areas = 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXFOCUSAREAS, areas);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXFOCUSAREAS);
return areas < 0 ? 0 : areas;
} }
uint32_t uint32_t
CameraCapabilities::MaxMeteringAreas() CameraCapabilities::MaxMeteringAreas()
{ {
if (mMaxMeteringAreas == 0) { if (NS_WARN_IF(!mCameraControl)) {
int32_t areas; return 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXMETERINGAREAS,
areas);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXMETERINGAREAS);
mMaxMeteringAreas = areas < 0 ? 0 : areas;
} }
return mMaxMeteringAreas;
int32_t areas = 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXMETERINGAREAS, areas);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXMETERINGAREAS);
return areas < 0 ? 0 : areas;
} }
uint32_t uint32_t
CameraCapabilities::MaxDetectedFaces() CameraCapabilities::MaxDetectedFaces()
{ {
if (mMaxDetectedFaces == 0) { if (NS_WARN_IF(!mCameraControl)) {
int32_t faces; return 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES,
faces);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES);
mMaxDetectedFaces = faces < 0 ? 0 : faces;
} }
return mMaxDetectedFaces;
int32_t faces = 0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES, faces);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES);
return faces < 0 ? 0 : faces;
} }
double double
CameraCapabilities::MinExposureCompensation() CameraCapabilities::MinExposureCompensation()
{ {
if (mMinExposureCompensation == 0.0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MINEXPOSURECOMPENSATION, return 0.0;
mMinExposureCompensation);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MINEXPOSURECOMPENSATION);
} }
return mMinExposureCompensation;
double minEv = 0.0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MINEXPOSURECOMPENSATION, minEv);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MINEXPOSURECOMPENSATION);
return minEv;
} }
double double
CameraCapabilities::MaxExposureCompensation() CameraCapabilities::MaxExposureCompensation()
{ {
if (mMaxExposureCompensation == 0.0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXEXPOSURECOMPENSATION, return 0.0;
mMaxExposureCompensation);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXEXPOSURECOMPENSATION);
} }
return mMaxExposureCompensation;
double maxEv = 0.0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_MAXEXPOSURECOMPENSATION, maxEv);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_MAXEXPOSURECOMPENSATION);
return maxEv;
} }
double double
CameraCapabilities::ExposureCompensationStep() CameraCapabilities::ExposureCompensationStep()
{ {
if (mExposureCompensationStep == 0.0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_EXPOSURECOMPENSATIONSTEP, return 0.0;
mExposureCompensationStep);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_EXPOSURECOMPENSATIONSTEP);
} }
return mExposureCompensationStep;
double evStep = 0.0;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_EXPOSURECOMPENSATIONSTEP, evStep);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_EXPOSURECOMPENSATIONSTEP);
return evStep;
} }
CameraRecorderProfiles* CameraRecorderProfiles*
CameraCapabilities::RecorderProfiles() CameraCapabilities::RecorderProfiles()
{ {
nsRefPtr<CameraRecorderProfiles> profiles = mRecorderProfiles; if (NS_WARN_IF(!mCameraControl)) {
if (!mRecorderProfiles) { return nullptr;
profiles = new CameraRecorderProfiles(this, mCameraControl);
mRecorderProfiles = profiles;
} }
nsRefPtr<CameraRecorderProfiles> profiles =
new CameraRecorderProfiles(this, mCameraControl);
return profiles; return profiles;
} }
void void
CameraCapabilities::GetIsoModes(nsTArray<nsString>& retval) CameraCapabilities::GetIsoModes(nsTArray<nsString>& aRetVal)
{ {
if (mIsoModes.Length() == 0) { if (NS_WARN_IF(!mCameraControl)) {
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_ISOMODES, return;
mIsoModes);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_ISOMODES);
} }
retval = mIsoModes;
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_ISOMODES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_ISOMODES);
}
void
CameraCapabilities::GetMeteringModes(nsTArray<nsString>& aRetVal)
{
if (NS_WARN_IF(!mCameraControl)) {
return;
}
nsresult rv = mCameraControl->Get(CAMERA_PARAM_SUPPORTED_METERINGMODES, aRetVal);
LOG_IF_ERROR(rv, CAMERA_PARAM_SUPPORTED_METERINGMODES);
} }
} // namespace dom } // namespace dom

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

@ -146,6 +146,8 @@ private:
/** /**
* CameraRecorderProfiles * CameraRecorderProfiles
*/ */
template<class T> class CameraClosedListenerProxy;
class CameraRecorderProfiles MOZ_FINAL : public nsISupports class CameraRecorderProfiles MOZ_FINAL : public nsISupports
, public nsWrapperCache , public nsWrapperCache
{ {
@ -162,12 +164,15 @@ public:
bool NameIsEnumerable(const nsAString& aName); bool NameIsEnumerable(const nsAString& aName);
void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames);
virtual void OnHardwareClosed();
protected: protected:
virtual ~CameraRecorderProfiles(); virtual ~CameraRecorderProfiles();
nsCOMPtr<nsISupports> mParent; nsCOMPtr<nsISupports> mParent;
nsRefPtr<ICameraControl> mCameraControl; nsRefPtr<ICameraControl> mCameraControl;
nsRefPtrHashtable<nsStringHashKey, CameraRecorderProfile> mProfiles; nsRefPtrHashtable<nsStringHashKey, CameraRecorderProfile> mProfiles;
nsRefPtr<CameraClosedListenerProxy<CameraRecorderProfiles>> mListener;
private: private:
DISALLOW_EVIL_CONSTRUCTORS(CameraRecorderProfiles); DISALLOW_EVIL_CONSTRUCTORS(CameraRecorderProfiles);
@ -215,40 +220,20 @@ public:
double MaxExposureCompensation(); double MaxExposureCompensation();
double ExposureCompensationStep(); double ExposureCompensationStep();
void GetIsoModes(nsTArray<nsString>& aRetVal); void GetIsoModes(nsTArray<nsString>& aRetVal);
void GetMeteringModes(nsTArray<nsString>& aRetVal);
CameraRecorderProfiles* RecorderProfiles(); CameraRecorderProfiles* RecorderProfiles();
virtual void OnHardwareClosed();
protected: protected:
~CameraCapabilities(); ~CameraCapabilities();
nsresult TranslateToDictionary(uint32_t aKey, nsTArray<CameraSize>& aSizes); nsresult TranslateToDictionary(uint32_t aKey, nsTArray<CameraSize>& aSizes);
nsTArray<CameraSize> mPreviewSizes;
nsTArray<CameraSize> mPictureSizes;
nsTArray<CameraSize> mThumbnailSizes;
nsTArray<CameraSize> mVideoSizes;
nsTArray<nsString> mFileFormats;
nsTArray<nsString> mWhiteBalanceModes;
nsTArray<nsString> mSceneModes;
nsTArray<nsString> mEffects;
nsTArray<nsString> mFlashModes;
nsTArray<nsString> mFocusModes;
nsTArray<nsString> mIsoModes;
nsTArray<double> mZoomRatios;
uint32_t mMaxFocusAreas;
uint32_t mMaxMeteringAreas;
uint32_t mMaxDetectedFaces;
double mMinExposureCompensation;
double mMaxExposureCompensation;
double mExposureCompensationStep;
nsRefPtr<nsPIDOMWindow> mWindow; nsRefPtr<nsPIDOMWindow> mWindow;
nsRefPtr<ICameraControl> mCameraControl; nsRefPtr<ICameraControl> mCameraControl;
nsRefPtr<CameraRecorderProfiles> mRecorderProfiles; nsRefPtr<CameraClosedListenerProxy<CameraCapabilities>> mListener;
private: private:
DISALLOW_EVIL_CONSTRUCTORS(CameraCapabilities); DISALLOW_EVIL_CONSTRUCTORS(CameraCapabilities);

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

@ -54,13 +54,19 @@ StaticRefPtr<ICameraControl> nsDOMCameraControl::sCachedCameraControl;
#endif #endif
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl)
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
// nsISupports is an ambiguous base of nsDOMCameraControl
// so we have to work around that.
if ( aIID.Equals(NS_GET_IID(nsDOMCameraControl)) )
foundInterface = static_cast<nsISupports*>(static_cast<void*>(this));
else
NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream) NS_INTERFACE_MAP_END_INHERITING(DOMMediaStream)
NS_IMPL_ADDREF_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_IMPL_ADDREF_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_IMPL_RELEASE_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_IMPL_RELEASE_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl, DOMMediaStream, NS_IMPL_CYCLE_COLLECTION_INHERITED(nsDOMCameraControl, DOMMediaStream,
mAudioChannelAgent,
mCapabilities, mCapabilities,
mWindow, mWindow,
mGetCameraPromise, mGetCameraPromise,
@ -133,7 +139,7 @@ nsDOMCameraControl::DOMCameraConfiguration::~DOMCameraConfiguration()
} }
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
// This shoudl be long enough for even our slowest platforms. // This should be long enough for even our slowest platforms.
static const unsigned long kCachedCameraTimeoutMs = 3500; static const unsigned long kCachedCameraTimeoutMs = 3500;
// Open the battery-door-facing camera by default. // Open the battery-door-facing camera by default.
@ -383,88 +389,97 @@ nsDOMCameraControl::Get(uint32_t aKey, nsTArray<CameraRegion>& aValue)
return NS_OK; return NS_OK;
} }
#define THROW_IF_NO_CAMERACONTROL(...) \
do { \
if (!mCameraControl) { \
DOM_CAMERA_LOGW("mCameraControl is null at %s:%d\n", __func__, __LINE__); \
aRv = NS_ERROR_NOT_AVAILABLE; \
return __VA_ARGS__; \
} \
} while (0)
void void
nsDOMCameraControl::GetEffect(nsString& aEffect, ErrorResult& aRv) nsDOMCameraControl::GetEffect(nsString& aEffect, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_EFFECT, aEffect); aRv = mCameraControl->Get(CAMERA_PARAM_EFFECT, aEffect);
} }
void void
nsDOMCameraControl::SetEffect(const nsAString& aEffect, ErrorResult& aRv) nsDOMCameraControl::SetEffect(const nsAString& aEffect, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_EFFECT, aEffect); aRv = mCameraControl->Set(CAMERA_PARAM_EFFECT, aEffect);
} }
void void
nsDOMCameraControl::GetWhiteBalanceMode(nsString& aWhiteBalanceMode, ErrorResult& aRv) nsDOMCameraControl::GetWhiteBalanceMode(nsString& aWhiteBalanceMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode); aRv = mCameraControl->Get(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
} }
void void
nsDOMCameraControl::SetWhiteBalanceMode(const nsAString& aWhiteBalanceMode, ErrorResult& aRv) nsDOMCameraControl::SetWhiteBalanceMode(const nsAString& aWhiteBalanceMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode); aRv = mCameraControl->Set(CAMERA_PARAM_WHITEBALANCE, aWhiteBalanceMode);
} }
void void
nsDOMCameraControl::GetSceneMode(nsString& aSceneMode, ErrorResult& aRv) nsDOMCameraControl::GetSceneMode(nsString& aSceneMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_SCENEMODE, aSceneMode); aRv = mCameraControl->Get(CAMERA_PARAM_SCENEMODE, aSceneMode);
} }
void void
nsDOMCameraControl::SetSceneMode(const nsAString& aSceneMode, ErrorResult& aRv) nsDOMCameraControl::SetSceneMode(const nsAString& aSceneMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_SCENEMODE, aSceneMode); aRv = mCameraControl->Set(CAMERA_PARAM_SCENEMODE, aSceneMode);
} }
void void
nsDOMCameraControl::GetFlashMode(nsString& aFlashMode, ErrorResult& aRv) nsDOMCameraControl::GetFlashMode(nsString& aFlashMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_FLASHMODE, aFlashMode); aRv = mCameraControl->Get(CAMERA_PARAM_FLASHMODE, aFlashMode);
} }
void void
nsDOMCameraControl::SetFlashMode(const nsAString& aFlashMode, ErrorResult& aRv) nsDOMCameraControl::SetFlashMode(const nsAString& aFlashMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_FLASHMODE, aFlashMode); aRv = mCameraControl->Set(CAMERA_PARAM_FLASHMODE, aFlashMode);
} }
void void
nsDOMCameraControl::GetFocusMode(nsString& aFocusMode, ErrorResult& aRv) nsDOMCameraControl::GetFocusMode(nsString& aFocusMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSMODE, aFocusMode); aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSMODE, aFocusMode);
} }
void void
nsDOMCameraControl::SetFocusMode(const nsAString& aFocusMode, ErrorResult& aRv) nsDOMCameraControl::SetFocusMode(const nsAString& aFocusMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_FOCUSMODE, aFocusMode); aRv = mCameraControl->Set(CAMERA_PARAM_FOCUSMODE, aFocusMode);
} }
void void
nsDOMCameraControl::GetIsoMode(nsString& aIsoMode, ErrorResult& aRv) nsDOMCameraControl::GetIsoMode(nsString& aIsoMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_ISOMODE, aIsoMode); aRv = mCameraControl->Get(CAMERA_PARAM_ISOMODE, aIsoMode);
} }
void void
nsDOMCameraControl::SetIsoMode(const nsAString& aIsoMode, ErrorResult& aRv) nsDOMCameraControl::SetIsoMode(const nsAString& aIsoMode, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_ISOMODE, aIsoMode); aRv = mCameraControl->Set(CAMERA_PARAM_ISOMODE, aIsoMode);
} }
double double
nsDOMCameraControl::GetPictureQuality(ErrorResult& aRv) nsDOMCameraControl::GetPictureQuality(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(1.0);
double quality; double quality;
aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_QUALITY, quality); aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_QUALITY, quality);
@ -473,14 +488,27 @@ nsDOMCameraControl::GetPictureQuality(ErrorResult& aRv)
void void
nsDOMCameraControl::SetPictureQuality(double aQuality, ErrorResult& aRv) nsDOMCameraControl::SetPictureQuality(double aQuality, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_QUALITY, aQuality); aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_QUALITY, aQuality);
} }
void
nsDOMCameraControl::GetMeteringMode(nsString& aMode, ErrorResult& aRv)
{
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Get(CAMERA_PARAM_METERINGMODE, aMode);
}
void
nsDOMCameraControl::SetMeteringMode(const nsAString& aMode, ErrorResult& aRv)
{
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_METERINGMODE, aMode);
}
double double
nsDOMCameraControl::GetZoom(ErrorResult& aRv) nsDOMCameraControl::GetZoom(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(1.0);
double zoom = 1.0; double zoom = 1.0;
aRv = mCameraControl->Get(CAMERA_PARAM_ZOOM, zoom); aRv = mCameraControl->Get(CAMERA_PARAM_ZOOM, zoom);
@ -490,7 +518,7 @@ nsDOMCameraControl::GetZoom(ErrorResult& aRv)
void void
nsDOMCameraControl::SetZoom(double aZoom, ErrorResult& aRv) nsDOMCameraControl::SetZoom(double aZoom, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_ZOOM, aZoom); aRv = mCameraControl->Set(CAMERA_PARAM_ZOOM, aZoom);
} }
@ -521,6 +549,8 @@ nsDOMCameraControl::SetFocusAreas(const Optional<Sequence<CameraRegion> >& aFocu
void void
nsDOMCameraControl::GetPictureSize(CameraSize& aSize, ErrorResult& aRv) nsDOMCameraControl::GetPictureSize(CameraSize& aSize, ErrorResult& aRv)
{ {
THROW_IF_NO_CAMERACONTROL();
ICameraControl::Size size; ICameraControl::Size size;
aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_SIZE, size); aRv = mCameraControl->Get(CAMERA_PARAM_PICTURE_SIZE, size);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -534,6 +564,7 @@ nsDOMCameraControl::GetPictureSize(CameraSize& aSize, ErrorResult& aRv)
void void
nsDOMCameraControl::SetPictureSize(const CameraSize& aSize, ErrorResult& aRv) nsDOMCameraControl::SetPictureSize(const CameraSize& aSize, ErrorResult& aRv)
{ {
THROW_IF_NO_CAMERACONTROL();
ICameraControl::Size s = { aSize.mWidth, aSize.mHeight }; ICameraControl::Size s = { aSize.mWidth, aSize.mHeight };
aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s); aRv = mCameraControl->Set(CAMERA_PARAM_PICTURE_SIZE, s);
} }
@ -541,6 +572,7 @@ nsDOMCameraControl::SetPictureSize(const CameraSize& aSize, ErrorResult& aRv)
void void
nsDOMCameraControl::GetThumbnailSize(CameraSize& aSize, ErrorResult& aRv) nsDOMCameraControl::GetThumbnailSize(CameraSize& aSize, ErrorResult& aRv)
{ {
THROW_IF_NO_CAMERACONTROL();
ICameraControl::Size size; ICameraControl::Size size;
aRv = mCameraControl->Get(CAMERA_PARAM_THUMBNAILSIZE, size); aRv = mCameraControl->Get(CAMERA_PARAM_THUMBNAILSIZE, size);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -554,6 +586,7 @@ nsDOMCameraControl::GetThumbnailSize(CameraSize& aSize, ErrorResult& aRv)
void void
nsDOMCameraControl::SetThumbnailSize(const CameraSize& aSize, ErrorResult& aRv) nsDOMCameraControl::SetThumbnailSize(const CameraSize& aSize, ErrorResult& aRv)
{ {
THROW_IF_NO_CAMERACONTROL();
ICameraControl::Size s = { aSize.mWidth, aSize.mHeight }; ICameraControl::Size s = { aSize.mWidth, aSize.mHeight };
aRv = mCameraControl->Set(CAMERA_PARAM_THUMBNAILSIZE, s); aRv = mCameraControl->Set(CAMERA_PARAM_THUMBNAILSIZE, s);
} }
@ -561,7 +594,7 @@ nsDOMCameraControl::SetThumbnailSize(const CameraSize& aSize, ErrorResult& aRv)
double double
nsDOMCameraControl::GetFocalLength(ErrorResult& aRv) nsDOMCameraControl::GetFocalLength(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(0.0);
double focalLength; double focalLength;
aRv = mCameraControl->Get(CAMERA_PARAM_FOCALLENGTH, focalLength); aRv = mCameraControl->Get(CAMERA_PARAM_FOCALLENGTH, focalLength);
@ -571,7 +604,7 @@ nsDOMCameraControl::GetFocalLength(ErrorResult& aRv)
double double
nsDOMCameraControl::GetFocusDistanceNear(ErrorResult& aRv) nsDOMCameraControl::GetFocusDistanceNear(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(0.0);
double distance; double distance;
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCENEAR, distance); aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCENEAR, distance);
@ -581,7 +614,7 @@ nsDOMCameraControl::GetFocusDistanceNear(ErrorResult& aRv)
double double
nsDOMCameraControl::GetFocusDistanceOptimum(ErrorResult& aRv) nsDOMCameraControl::GetFocusDistanceOptimum(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(0.0);
double distance; double distance;
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEOPTIMUM, distance); aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEOPTIMUM, distance);
@ -591,7 +624,7 @@ nsDOMCameraControl::GetFocusDistanceOptimum(ErrorResult& aRv)
double double
nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv) nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(0.0);
double distance; double distance;
aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEFAR, distance); aRv = mCameraControl->Get(CAMERA_PARAM_FOCUSDISTANCEFAR, distance);
@ -601,14 +634,14 @@ nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv)
void void
nsDOMCameraControl::SetExposureCompensation(double aCompensation, ErrorResult& aRv) nsDOMCameraControl::SetExposureCompensation(double aCompensation, ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation); aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation);
} }
double double
nsDOMCameraControl::GetExposureCompensation(ErrorResult& aRv) nsDOMCameraControl::GetExposureCompensation(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); THROW_IF_NO_CAMERACONTROL(0.0);
double compensation; double compensation;
aRv = mCameraControl->Get(CAMERA_PARAM_EXPOSURECOMPENSATION, compensation); aRv = mCameraControl->Get(CAMERA_PARAM_EXPOSURECOMPENSATION, compensation);
@ -618,18 +651,22 @@ nsDOMCameraControl::GetExposureCompensation(ErrorResult& aRv)
int32_t int32_t
nsDOMCameraControl::SensorAngle() nsDOMCameraControl::SensorAngle()
{ {
MOZ_ASSERT(mCameraControl);
int32_t angle = 0; int32_t angle = 0;
mCameraControl->Get(CAMERA_PARAM_SENSORANGLE, angle); if (mCameraControl) {
mCameraControl->Get(CAMERA_PARAM_SENSORANGLE, angle);
}
return angle; return angle;
} }
already_AddRefed<dom::CameraCapabilities> already_AddRefed<dom::CameraCapabilities>
nsDOMCameraControl::Capabilities() nsDOMCameraControl::Capabilities()
{ {
nsRefPtr<CameraCapabilities> caps = mCapabilities; if (!mCameraControl) {
DOM_CAMERA_LOGW("mCameraControl is null at %s:%d\n", __func__, __LINE__);
return nullptr;
}
nsRefPtr<CameraCapabilities> caps = mCapabilities;
if (!caps) { if (!caps) {
caps = new CameraCapabilities(mWindow, mCameraControl); caps = new CameraCapabilities(mWindow, mCameraControl);
mCapabilities = caps; mCapabilities = caps;
@ -645,7 +682,7 @@ nsDOMCameraControl::StartRecording(const CameraStartRecordingOptions& aOptions,
const nsAString& aFilename, const nsAString& aFilename,
ErrorResult& aRv) ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
nsRefPtr<Promise> promise = CreatePromise(aRv); nsRefPtr<Promise> promise = CreatePromise(aRv);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -694,7 +731,9 @@ nsDOMCameraControl::OnCreatedFileDescriptor(bool aSucceeded)
{ {
nsresult rv = NS_ERROR_FAILURE; nsresult rv = NS_ERROR_FAILURE;
if (aSucceeded && mDSFileDescriptor->mFileDescriptor.IsValid()) { if (!mCameraControl) {
rv = NS_ERROR_NOT_AVAILABLE;
} else if (aSucceeded && mDSFileDescriptor->mFileDescriptor.IsValid()) {
ICameraControl::StartRecordingOptions o; ICameraControl::StartRecordingOptions o;
o.rotation = mOptions.mRotation; o.rotation = mOptions.mRotation;
@ -722,7 +761,8 @@ nsDOMCameraControl::OnCreatedFileDescriptor(bool aSucceeded)
void void
nsDOMCameraControl::StopRecording(ErrorResult& aRv) nsDOMCameraControl::StopRecording(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
#ifdef MOZ_B2G #ifdef MOZ_B2G
if (mAudioChannelAgent) { if (mAudioChannelAgent) {
@ -737,7 +777,8 @@ nsDOMCameraControl::StopRecording(ErrorResult& aRv)
void void
nsDOMCameraControl::ResumePreview(ErrorResult& aRv) nsDOMCameraControl::ResumePreview(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->StartPreview(); aRv = mCameraControl->StartPreview();
} }
@ -745,7 +786,8 @@ already_AddRefed<Promise>
nsDOMCameraControl::SetConfiguration(const CameraConfiguration& aConfiguration, nsDOMCameraControl::SetConfiguration(const CameraConfiguration& aConfiguration,
ErrorResult& aRv) ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL(nullptr);
nsRefPtr<Promise> promise = CreatePromise(aRv); nsRefPtr<Promise> promise = CreatePromise(aRv);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -779,7 +821,8 @@ nsDOMCameraControl::SetConfiguration(const CameraConfiguration& aConfiguration,
already_AddRefed<Promise> already_AddRefed<Promise>
nsDOMCameraControl::AutoFocus(ErrorResult& aRv) nsDOMCameraControl::AutoFocus(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL(nullptr);
nsRefPtr<Promise> promise = mAutoFocusPromise.forget(); nsRefPtr<Promise> promise = mAutoFocusPromise.forget();
if (promise) { if (promise) {
@ -807,14 +850,16 @@ nsDOMCameraControl::AutoFocus(ErrorResult& aRv)
void void
nsDOMCameraControl::StartFaceDetection(ErrorResult& aRv) nsDOMCameraControl::StartFaceDetection(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->StartFaceDetection(); aRv = mCameraControl->StartFaceDetection();
} }
void void
nsDOMCameraControl::StopFaceDetection(ErrorResult& aRv) nsDOMCameraControl::StopFaceDetection(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->StopFaceDetection(); aRv = mCameraControl->StopFaceDetection();
} }
@ -822,7 +867,8 @@ already_AddRefed<Promise>
nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions, nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions,
ErrorResult& aRv) ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL(nullptr);
nsRefPtr<Promise> promise = CreatePromise(aRv); nsRefPtr<Promise> promise = CreatePromise(aRv);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -871,34 +917,45 @@ nsDOMCameraControl::TakePicture(const CameraPictureOptions& aOptions,
already_AddRefed<Promise> already_AddRefed<Promise>
nsDOMCameraControl::ReleaseHardware(ErrorResult& aRv) nsDOMCameraControl::ReleaseHardware(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGI("%s:%d : this=%p\n", __func__, __LINE__, this);
nsRefPtr<Promise> promise = CreatePromise(aRv); nsRefPtr<Promise> promise = CreatePromise(aRv);
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }
if (!mCameraControl) {
// Always succeed if the camera instance is already closed.
promise->MaybeResolve(JS::UndefinedHandleValue);
return promise.forget();
}
aRv = mCameraControl->Stop(); aRv = mCameraControl->Stop();
if (aRv.Failed()) { if (aRv.Failed()) {
return nullptr; return nullptr;
} }
// Once we stop the camera, there's nothing we can do with it,
// so we can throw away this reference. (This won't prevent us
// from receiving the last underlying events.)
mCameraControl = nullptr;
mReleasePromise = promise; mReleasePromise = promise;
return promise.forget(); return promise.forget();
} }
void void
nsDOMCameraControl::ResumeContinuousFocus(ErrorResult& aRv) nsDOMCameraControl::ResumeContinuousFocus(ErrorResult& aRv)
{ {
MOZ_ASSERT(mCameraControl); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
THROW_IF_NO_CAMERACONTROL();
aRv = mCameraControl->ResumeContinuousFocus(); aRv = mCameraControl->ResumeContinuousFocus();
} }
void void
nsDOMCameraControl::Shutdown() nsDOMCameraControl::Shutdown()
{ {
DOM_CAMERA_LOGI("%s:%d\n", __func__, __LINE__); DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(mCameraControl);
// Remove any pending solicited event handlers; these // Remove any pending solicited event handlers; these
// reference our window object, which in turn references // reference our window object, which in turn references
@ -910,7 +967,10 @@ nsDOMCameraControl::Shutdown()
AbortPromise(mReleasePromise); AbortPromise(mReleasePromise);
AbortPromise(mSetConfigurationPromise); AbortPromise(mSetConfigurationPromise);
mCameraControl->Shutdown(); if (mCameraControl) {
mCameraControl->Stop();
mCameraControl = nullptr;
}
} }
nsresult nsresult
@ -986,7 +1046,9 @@ void
nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState aState, nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState aState,
nsresult aReason) nsresult aReason)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
ErrorResult ignored; ErrorResult ignored;
switch (aState) { switch (aState) {
@ -1058,15 +1120,15 @@ nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState a
void void
nsDOMCameraControl::OnShutter() nsDOMCameraControl::OnShutter()
{ {
MOZ_ASSERT(NS_IsMainThread());
DOM_CAMERA_LOGI("DOM ** SNAP **\n"); DOM_CAMERA_LOGI("DOM ** SNAP **\n");
MOZ_ASSERT(NS_IsMainThread());
DispatchTrustedEvent(NS_LITERAL_STRING("shutter")); DispatchTrustedEvent(NS_LITERAL_STRING("shutter"));
} }
void void
nsDOMCameraControl::OnPreviewStateChange(CameraControlListener::PreviewState aState) nsDOMCameraControl::OnPreviewStateChange(CameraControlListener::PreviewState aState)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
mPreviewState = aState; mPreviewState = aState;
@ -1089,6 +1151,7 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a
int32_t aArg, int32_t aTrackNum) int32_t aArg, int32_t aTrackNum)
{ {
// For now, we do nothing with 'aStatus' and 'aTrackNum'. // For now, we do nothing with 'aStatus' and 'aTrackNum'.
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
ErrorResult ignored; ErrorResult ignored;
@ -1148,6 +1211,7 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a
void void
nsDOMCameraControl::OnConfigurationChange(DOMCameraConfiguration* aConfiguration) nsDOMCameraControl::OnConfigurationChange(DOMCameraConfiguration* aConfiguration)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aConfiguration != nullptr); MOZ_ASSERT(aConfiguration != nullptr);
@ -1174,7 +1238,7 @@ nsDOMCameraControl::OnConfigurationChange(DOMCameraConfiguration* aConfiguration
CameraConfigurationEventInit eventInit; CameraConfigurationEventInit eventInit;
eventInit.mMode = mCurrentConfiguration->mMode; eventInit.mMode = mCurrentConfiguration->mMode;
eventInit.mRecorderProfile = mCurrentConfiguration->mRecorderProfile; eventInit.mRecorderProfile = mCurrentConfiguration->mRecorderProfile;
eventInit.mPreviewSize = new DOMRect(this, 0, 0, eventInit.mPreviewSize = new DOMRect(static_cast<DOMMediaStream*>(this), 0, 0,
mCurrentConfiguration->mPreviewSize.mWidth, mCurrentConfiguration->mPreviewSize.mWidth,
mCurrentConfiguration->mPreviewSize.mHeight); mCurrentConfiguration->mPreviewSize.mHeight);
@ -1189,6 +1253,7 @@ nsDOMCameraControl::OnConfigurationChange(DOMCameraConfiguration* aConfiguration
void void
nsDOMCameraControl::OnAutoFocusComplete(bool aAutoFocusSucceeded) nsDOMCameraControl::OnAutoFocusComplete(bool aAutoFocusSucceeded)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<Promise> promise = mAutoFocusPromise.forget(); nsRefPtr<Promise> promise = mAutoFocusPromise.forget();
@ -1206,6 +1271,7 @@ nsDOMCameraControl::OnAutoFocusComplete(bool aAutoFocusSucceeded)
void void
nsDOMCameraControl::OnAutoFocusMoving(bool aIsMoving) nsDOMCameraControl::OnAutoFocusMoving(bool aIsMoving)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (aIsMoving) { if (aIsMoving) {
@ -1225,7 +1291,7 @@ nsDOMCameraControl::OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces
if (faces.SetCapacity(len)) { if (faces.SetCapacity(len)) {
nsRefPtr<DOMCameraDetectedFace> f; nsRefPtr<DOMCameraDetectedFace> f;
for (uint32_t i = 0; i < len; ++i) { for (uint32_t i = 0; i < len; ++i) {
f = new DOMCameraDetectedFace(this, aFaces[i]); f = new DOMCameraDetectedFace(static_cast<DOMMediaStream*>(this), aFaces[i]);
*faces.AppendElement() = f.forget().take(); *faces.AppendElement() = f.forget().take();
} }
} }
@ -1244,6 +1310,7 @@ nsDOMCameraControl::OnFacesDetected(const nsTArray<ICameraControl::Face>& aFaces
void void
nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture) nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p\n", __func__, __LINE__, this);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aPicture); MOZ_ASSERT(aPicture);
@ -1267,7 +1334,8 @@ nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture)
void void
nsDOMCameraControl::OnUserError(CameraControlListener::UserContext aContext, nsresult aError) nsDOMCameraControl::OnUserError(CameraControlListener::UserContext aContext, nsresult aError)
{ {
DOM_CAMERA_LOGI("DOM OnUserError aContext=%u, aError=0x%x\n", aContext, aError); DOM_CAMERA_LOGI("DOM OnUserError : this=%paContext=%u, aError=0x%x\n",
this, aContext, aError);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<Promise> promise; nsRefPtr<Promise> promise;

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

@ -18,6 +18,7 @@
#include "nsHashPropertyBag.h" #include "nsHashPropertyBag.h"
#include "DeviceStorage.h" #include "DeviceStorage.h"
#include "DOMCameraControlListener.h" #include "DOMCameraControlListener.h"
#include "nsWeakReference.h"
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
#include "nsITimer.h" #include "nsITimer.h"
#endif #endif
@ -39,10 +40,17 @@ namespace dom {
class ErrorResult; class ErrorResult;
class StartRecordingHelper; class StartRecordingHelper;
#define NS_DOM_CAMERA_CONTROL_CID \
{ 0x3700c096, 0xf920, 0x438d, \
{ 0x8b, 0x3f, 0x15, 0xb3, 0xc9, 0x96, 0x23, 0x62 } }
// Main camera control. // Main camera control.
class nsDOMCameraControl MOZ_FINAL : public DOMMediaStream class nsDOMCameraControl MOZ_FINAL : public DOMMediaStream
, public nsSupportsWeakReference
{ {
public: public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_CAMERA_CONTROL_CID)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream) NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMCameraControl, DOMMediaStream)
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
@ -87,6 +95,8 @@ public:
void SetIsoMode(const nsAString& aMode, ErrorResult& aRv); void SetIsoMode(const nsAString& aMode, ErrorResult& aRv);
double GetPictureQuality(ErrorResult& aRv); double GetPictureQuality(ErrorResult& aRv);
void SetPictureQuality(double aQuality, ErrorResult& aRv); void SetPictureQuality(double aQuality, ErrorResult& aRv);
void GetMeteringMode(nsString& aMode, ErrorResult& aRv);
void SetMeteringMode(const nsAString& aMode, ErrorResult& aRv);
// Methods. // Methods.
already_AddRefed<dom::Promise> SetConfiguration(const dom::CameraConfiguration& aConfiguration, already_AddRefed<dom::Promise> SetConfiguration(const dom::CameraConfiguration& aConfiguration,
@ -115,6 +125,8 @@ public:
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
operator nsISupports*() { return static_cast<DOMMediaStream*>(this); }
#ifdef MOZ_WIDGET_GONK #ifdef MOZ_WIDGET_GONK
static void PreinitCameraHardware(); static void PreinitCameraHardware();
static void DiscardCachedCameraInstance(nsITimer* aTimer, void* aClosure); static void DiscardCachedCameraInstance(nsITimer* aTimer, void* aClosure);
@ -222,6 +234,8 @@ private:
nsDOMCameraControl& operator=(const nsDOMCameraControl&) MOZ_DELETE; nsDOMCameraControl& operator=(const nsDOMCameraControl&) MOZ_DELETE;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMCameraControl, NS_DOM_CAMERA_CONTROL_CID)
} // namespace mozilla } // namespace mozilla
#endif // DOM_CAMERA_DOMCAMERACONTROL_H #endif // DOM_CAMERA_DOMCAMERACONTROL_H

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

@ -15,7 +15,8 @@ using namespace mozilla::dom;
DOMCameraControlListener::DOMCameraControlListener(nsDOMCameraControl* aDOMCameraControl, DOMCameraControlListener::DOMCameraControlListener(nsDOMCameraControl* aDOMCameraControl,
CameraPreviewMediaStream* aStream) CameraPreviewMediaStream* aStream)
: mDOMCameraControl(new nsMainThreadPtrHolder<nsDOMCameraControl>(aDOMCameraControl)) : mDOMCameraControl(
new nsMainThreadPtrHolder<nsISupports>(static_cast<DOMMediaStream*>(aDOMCameraControl)))
, mStream(aStream) , mStream(aStream)
{ {
DOM_CAMERA_LOGT("%s:%d : this=%p, camera=%p, stream=%p\n", DOM_CAMERA_LOGT("%s:%d : this=%p, camera=%p, stream=%p\n",
@ -31,7 +32,7 @@ DOMCameraControlListener::~DOMCameraControlListener()
class DOMCameraControlListener::DOMCallback : public nsRunnable class DOMCameraControlListener::DOMCallback : public nsRunnable
{ {
public: public:
explicit DOMCallback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl) explicit DOMCallback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl)
: mDOMCameraControl(aDOMCameraControl) : mDOMCameraControl(aDOMCameraControl)
{ {
MOZ_COUNT_CTOR(DOMCameraControlListener::DOMCallback); MOZ_COUNT_CTOR(DOMCameraControlListener::DOMCallback);
@ -51,15 +52,17 @@ public:
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
nsRefPtr<nsDOMCameraControl> camera = mDOMCameraControl.get(); nsRefPtr<nsDOMCameraControl> camera = do_QueryObject(mDOMCameraControl.get());
if (camera) { if (!camera) {
RunCallback(camera); DOM_CAMERA_LOGE("do_QueryObject failed to get an nsDOMCameraControl\n");
return NS_ERROR_INVALID_ARG;
} }
RunCallback(camera);
return NS_OK; return NS_OK;
} }
protected: protected:
nsMainThreadPtrHandle<nsDOMCameraControl> mDOMCameraControl; nsMainThreadPtrHandle<nsISupports> mDOMCameraControl;
}; };
// Specific callback handlers // Specific callback handlers
@ -70,7 +73,7 @@ DOMCameraControlListener::OnHardwareStateChange(HardwareState aState,
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
HardwareState aState, nsresult aReason) HardwareState aState, nsresult aReason)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mState(aState) , mState(aState)
@ -97,7 +100,7 @@ DOMCameraControlListener::OnPreviewStateChange(PreviewState aState)
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
PreviewState aState) PreviewState aState)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mState(aState) , mState(aState)
@ -151,7 +154,7 @@ DOMCameraControlListener::OnRecorderStateChange(RecorderState aState,
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
RecorderState aState, RecorderState aState,
int32_t aStatus, int32_t aStatus,
int32_t aTrackNum) int32_t aTrackNum)
@ -182,7 +185,7 @@ DOMCameraControlListener::OnConfigurationChange(const CameraListenerConfiguratio
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
const CameraListenerConfiguration& aConfiguration) const CameraListenerConfiguration& aConfiguration)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mConfiguration(aConfiguration) , mConfiguration(aConfiguration)
@ -231,7 +234,7 @@ DOMCameraControlListener::OnAutoFocusMoving(bool aIsMoving)
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, bool aIsMoving) Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl, bool aIsMoving)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mIsMoving(aIsMoving) , mIsMoving(aIsMoving)
{ } { }
@ -255,7 +258,7 @@ DOMCameraControlListener::OnFacesDetected(const nsTArray<ICameraControl::Face>&
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
const nsTArray<ICameraControl::Face>& aFaces) const nsTArray<ICameraControl::Face>& aFaces)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mFaces(aFaces) , mFaces(aFaces)
@ -280,7 +283,7 @@ DOMCameraControlListener::OnShutter()
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
explicit Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl) explicit Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
{ } { }
@ -315,7 +318,7 @@ DOMCameraControlListener::OnAutoFocusComplete(bool aAutoFocusSucceeded)
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
bool aAutoFocusSucceeded) bool aAutoFocusSucceeded)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mAutoFocusSucceeded(aAutoFocusSucceeded) , mAutoFocusSucceeded(aAutoFocusSucceeded)
@ -340,7 +343,7 @@ DOMCameraControlListener::OnTakePictureComplete(uint8_t* aData, uint32_t aLength
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
uint8_t* aData, uint32_t aLength, const nsAString& aMimeType) uint8_t* aData, uint32_t aLength, const nsAString& aMimeType)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)
, mData(aData) , mData(aData)
@ -352,7 +355,7 @@ DOMCameraControlListener::OnTakePictureComplete(uint8_t* aData, uint32_t aLength
RunCallback(nsDOMCameraControl* aDOMCameraControl) MOZ_OVERRIDE RunCallback(nsDOMCameraControl* aDOMCameraControl) MOZ_OVERRIDE
{ {
nsCOMPtr<nsIDOMBlob> picture = nsCOMPtr<nsIDOMBlob> picture =
File::CreateMemoryFile(mDOMCameraControl, File::CreateMemoryFile(mDOMCameraControl.get(),
static_cast<void*>(mData), static_cast<void*>(mData),
static_cast<uint64_t>(mLength), static_cast<uint64_t>(mLength),
mMimeType); mMimeType);
@ -374,7 +377,7 @@ DOMCameraControlListener::OnUserError(UserContext aContext, nsresult aError)
class Callback : public DOMCallback class Callback : public DOMCallback
{ {
public: public:
Callback(nsMainThreadPtrHandle<nsDOMCameraControl> aDOMCameraControl, Callback(nsMainThreadPtrHandle<nsISupports> aDOMCameraControl,
UserContext aContext, UserContext aContext,
nsresult aError) nsresult aError)
: DOMCallback(aDOMCameraControl) : DOMCallback(aDOMCameraControl)

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

@ -35,7 +35,7 @@ public:
protected: protected:
virtual ~DOMCameraControlListener(); virtual ~DOMCameraControlListener();
nsMainThreadPtrHandle<nsDOMCameraControl> mDOMCameraControl; nsMainThreadPtrHandle<nsISupports> mDOMCameraControl;
CameraPreviewMediaStream* mStream; CameraPreviewMediaStream* mStream;
class DOMCallback; class DOMCallback;

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

@ -342,13 +342,27 @@ nsDOMCameraManager::Register(nsDOMCameraControl* aDOMCameraControl)
DOM_CAMERA_LOGI(">>> Register( aDOMCameraControl = %p ) mWindowId = 0x%" PRIx64 "\n", aDOMCameraControl, mWindowId); DOM_CAMERA_LOGI(">>> Register( aDOMCameraControl = %p ) mWindowId = 0x%" PRIx64 "\n", aDOMCameraControl, mWindowId);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
// Put the camera control into the hash table
CameraControls* controls = sActiveWindows->Get(mWindowId); CameraControls* controls = sActiveWindows->Get(mWindowId);
if (!controls) { if (!controls) {
controls = new CameraControls; controls = new CameraControls();
sActiveWindows->Put(mWindowId, controls); sActiveWindows->Put(mWindowId, controls);
} }
controls->AppendElement(aDOMCameraControl);
// Remove any stale CameraControl objects to limit our memory usage
uint32_t i = controls->Length();
while (i > 0) {
--i;
nsRefPtr<nsDOMCameraControl> cameraControl =
do_QueryObject(controls->ElementAt(i));
if (!cameraControl) {
controls->RemoveElementAt(i);
}
}
// Put the camera control into the hash table
nsWeakPtr cameraControl =
do_GetWeakReference(static_cast<DOMMediaStream*>(aDOMCameraControl));
controls->AppendElement(cameraControl);
} }
void void
@ -362,10 +376,14 @@ nsDOMCameraManager::Shutdown(uint64_t aWindowId)
return; return;
} }
uint32_t length = controls->Length(); uint32_t i = controls->Length();
for (uint32_t i = 0; i < length; i++) { while (i > 0) {
nsRefPtr<nsDOMCameraControl> cameraControl = controls->ElementAt(i); --i;
cameraControl->Shutdown(); nsRefPtr<nsDOMCameraControl> cameraControl =
do_QueryObject(controls->ElementAt(i));
if (cameraControl) {
cameraControl->Shutdown();
}
} }
controls->Clear(); controls->Clear();

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

@ -29,7 +29,7 @@ namespace mozilla {
} }
} }
typedef nsTArray<nsRefPtr<mozilla::nsDOMCameraControl> > CameraControls; typedef nsTArray<nsWeakPtr> CameraControls;
typedef nsClassHashtable<nsUint64HashKey, CameraControls> WindowTable; typedef nsClassHashtable<nsUint64HashKey, CameraControls> WindowTable;
class nsDOMCameraManager MOZ_FINAL class nsDOMCameraManager MOZ_FINAL

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

@ -22,7 +22,7 @@ namespace mozilla {
class FallbackCameraControl : public CameraControlImpl class FallbackCameraControl : public CameraControlImpl
{ {
public: public:
explicit FallbackCameraControl(uint32_t aCameraId) : CameraControlImpl(aCameraId) { } explicit FallbackCameraControl() : CameraControlImpl() { }
virtual nsresult Set(uint32_t aKey, const nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; } virtual nsresult Set(uint32_t aKey, const nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }
virtual nsresult Get(uint32_t aKey, nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; } virtual nsresult Get(uint32_t aKey, nsAString& aValue) MOZ_OVERRIDE { return NS_ERROR_NOT_IMPLEMENTED; }

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

@ -61,7 +61,7 @@ using namespace android;
// Construct nsGonkCameraControl on the main thread. // Construct nsGonkCameraControl on the main thread.
nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId) nsGonkCameraControl::nsGonkCameraControl(uint32_t aCameraId)
: CameraControlImpl(aCameraId) : mCameraId(aCameraId)
, mLastPictureSize({0, 0}) , mLastPictureSize({0, 0})
, mLastThumbnailSize({0, 0}) , mLastThumbnailSize({0, 0})
, mPreviewFps(30) , mPreviewFps(30)
@ -226,6 +226,30 @@ nsGonkCameraControl::Initialize()
mLastRecorderSize = mCurrentConfiguration.mPreviewSize; mLastRecorderSize = mCurrentConfiguration.mPreviewSize;
} }
nsAutoTArray<nsString, 8> modes;
mParams.Get(CAMERA_PARAM_SUPPORTED_METERINGMODES, modes);
if (!modes.IsEmpty()) {
nsString mode;
const char* kCenterWeighted = "center-weighted";
mParams.Get(CAMERA_PARAM_METERINGMODE, mode);
if (!mode.EqualsASCII(kCenterWeighted)) {
nsTArray<nsString>::index_type i = modes.Length();
while (i > 0) {
--i;
if (modes[i].EqualsASCII(kCenterWeighted)) {
mParams.Set(CAMERA_PARAM_METERINGMODE, kCenterWeighted);
PushParametersImpl();
break;
}
}
}
mParams.Get(CAMERA_PARAM_METERINGMODE, mode);
DOM_CAMERA_LOGI(" - metering mode: '%s'\n",
NS_ConvertUTF16toUTF8(mode).get());
}
return NS_OK; return NS_OK;
} }

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

@ -154,6 +154,8 @@ protected:
int32_t RationalizeRotation(int32_t aRotation); int32_t RationalizeRotation(int32_t aRotation);
uint32_t mCameraId;
android::sp<android::GonkCameraHardware> mCameraHw; android::sp<android::GonkCameraHardware> mCameraHw;
Size mLastPictureSize; Size mLastPictureSize;

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

@ -20,6 +20,7 @@
#include "ICameraControl.h" #include "ICameraControl.h"
#include "CameraCommon.h" #include "CameraCommon.h"
#include "mozilla/Hal.h" #include "mozilla/Hal.h"
#include "nsDataHashtable.h"
using namespace mozilla; using namespace mozilla;
using namespace android; using namespace android;
@ -119,6 +120,9 @@ GonkCameraParameters::Parameters::GetTextKey(uint32_t aKey)
return KEY_JPEG_QUALITY; return KEY_JPEG_QUALITY;
case CAMERA_PARAM_PREFERRED_PREVIEWSIZE_FOR_VIDEO: case CAMERA_PARAM_PREFERRED_PREVIEWSIZE_FOR_VIDEO:
return KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO; return KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO;
case CAMERA_PARAM_METERINGMODE:
// Not every platform defines KEY_AUTO_EXPOSURE.
return "auto-exposure";
case CAMERA_PARAM_SUPPORTED_PREVIEWSIZES: case CAMERA_PARAM_SUPPORTED_PREVIEWSIZES:
return KEY_SUPPORTED_PREVIEW_SIZES; return KEY_SUPPORTED_PREVIEW_SIZES;
@ -160,6 +164,9 @@ GonkCameraParameters::Parameters::GetTextKey(uint32_t aKey)
// Not every platform defines KEY_SUPPORTED_ISO_MODES; // Not every platform defines KEY_SUPPORTED_ISO_MODES;
// for those that don't, we use the raw string key. // for those that don't, we use the raw string key.
return "iso-values"; return "iso-values";
case CAMERA_PARAM_SUPPORTED_METERINGMODES:
// Not every platform defines KEY_SUPPORTED_AUTO_EXPOSURE.
return "auto-exposure-values";
default: default:
DOM_CAMERA_LOGE("Unhandled camera parameter value %u\n", aKey); DOM_CAMERA_LOGE("Unhandled camera parameter value %u\n", aKey);
return nullptr; return nullptr;
@ -278,7 +285,7 @@ GonkCameraParameters::Initialize()
nsString s; nsString s;
nsTArray<nsCString> isoModes; nsTArray<nsCString> isoModes;
GetListAsArray(CAMERA_PARAM_SUPPORTED_ISOMODES, isoModes); GetListAsArray(CAMERA_PARAM_SUPPORTED_ISOMODES, isoModes);
for (nsTArray<nsCString>::size_type i = 0; i < isoModes.Length(); ++i) { for (nsTArray<nsCString>::index_type i = 0; i < isoModes.Length(); ++i) {
rv = MapIsoFromGonk(isoModes[i].get(), s); rv = MapIsoFromGonk(isoModes[i].get(), s);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
DOM_CAMERA_LOGW("Unrecognized ISO mode value '%s'\n", isoModes[i].get()); DOM_CAMERA_LOGW("Unrecognized ISO mode value '%s'\n", isoModes[i].get());
@ -299,6 +306,22 @@ GonkCameraParameters::Initialize()
} }
} }
// Some platforms have strange duplicate metering mode values.
// We filter any out here.
nsDataHashtable<nsStringHashKey, bool> uniqueModes;
GetListAsArray(CAMERA_PARAM_SUPPORTED_METERINGMODES, mMeteringModes);
nsTArray<nsCString>::index_type i = mMeteringModes.Length();
while (i > 0) {
--i;
if (!uniqueModes.Get(mMeteringModes[i])) {
uniqueModes.Put(mMeteringModes[i], true);
} else {
DOM_CAMERA_LOGW("Dropped duplicate metering mode '%s' (index=%u)\n",
NS_ConvertUTF16toUTF8(mMeteringModes[i]).get(), i);
mMeteringModes.RemoveElementAt(i);
}
}
mInitialized = true; mInitialized = true;
return NS_OK; return NS_OK;
} }
@ -936,6 +959,10 @@ GonkCameraParameters::GetTranslated(uint32_t aKey, nsTArray<nsString>& aValues)
aValues = mSceneModes; aValues = mSceneModes;
return NS_OK; return NS_OK;
case CAMERA_PARAM_SUPPORTED_METERINGMODES:
aValues = mMeteringModes;
return NS_OK;
default: default:
return GetListAsArray(aKey, aValues); return GetListAsArray(aKey, aValues);
} }

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

@ -102,6 +102,7 @@ protected:
nsTArray<int> mZoomRatios; nsTArray<int> mZoomRatios;
nsTArray<nsString> mIsoModes; nsTArray<nsString> mIsoModes;
nsTArray<nsString> mSceneModes; nsTArray<nsString> mSceneModes;
nsTArray<nsString> mMeteringModes;
nsClassHashtable<nsStringHashKey, nsCString> mIsoModeMap; nsClassHashtable<nsStringHashKey, nsCString> mIsoModeMap;
// This subclass of android::CameraParameters just gives // This subclass of android::CameraParameters just gives

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

@ -55,6 +55,7 @@ enum {
CAMERA_PARAM_SCENEMODE_HDR_RETURNNORMALPICTURE, CAMERA_PARAM_SCENEMODE_HDR_RETURNNORMALPICTURE,
CAMERA_PARAM_RECORDINGHINT, CAMERA_PARAM_RECORDINGHINT,
CAMERA_PARAM_PREFERRED_PREVIEWSIZE_FOR_VIDEO, CAMERA_PARAM_PREFERRED_PREVIEWSIZE_FOR_VIDEO,
CAMERA_PARAM_METERINGMODE,
// supported features // supported features
CAMERA_PARAM_SUPPORTED_PREVIEWSIZES, CAMERA_PARAM_SUPPORTED_PREVIEWSIZES,
@ -75,7 +76,8 @@ enum {
CAMERA_PARAM_SUPPORTED_ZOOMRATIOS, CAMERA_PARAM_SUPPORTED_ZOOMRATIOS,
CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES, CAMERA_PARAM_SUPPORTED_MAXDETECTEDFACES,
CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES, CAMERA_PARAM_SUPPORTED_JPEG_THUMBNAIL_SIZES,
CAMERA_PARAM_SUPPORTED_ISOMODES CAMERA_PARAM_SUPPORTED_ISOMODES,
CAMERA_PARAM_SUPPORTED_METERINGMODES
}; };
class ICameraControl class ICameraControl
@ -251,7 +253,7 @@ public:
virtual nsresult StopPreview() = 0; virtual nsresult StopPreview() = 0;
virtual nsresult AutoFocus() = 0; virtual nsresult AutoFocus() = 0;
virtual nsresult TakePicture() = 0; virtual nsresult TakePicture() = 0;
virtual nsresult StartRecording(DeviceStorageFileDescriptor *aFileDescriptor, virtual nsresult StartRecording(DeviceStorageFileDescriptor* aFileDescriptor,
const StartRecordingOptions* aOptions = nullptr) = 0; const StartRecordingOptions* aOptions = nullptr) = 0;
virtual nsresult StopRecording() = 0; virtual nsresult StopRecording() = 0;
virtual nsresult StartFaceDetection() = 0; virtual nsresult StartFaceDetection() = 0;
@ -293,10 +295,6 @@ public:
virtual nsresult GetRecorderProfiles(nsTArray<nsString>& aProfiles) = 0; virtual nsresult GetRecorderProfiles(nsTArray<nsString>& aProfiles) = 0;
virtual RecorderProfile* GetProfileInfo(const nsAString& aProfile) = 0; virtual RecorderProfile* GetProfileInfo(const nsAString& aProfile) = 0;
virtual uint32_t GetCameraId() = 0;
virtual void Shutdown() = 0;
protected: protected:
virtual ~ICameraControl() { } virtual ~ICameraControl() { }

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

@ -12,6 +12,8 @@
<img src="#" alt="This image is going to load" id="testimage"/> <img src="#" alt="This image is going to load" id="testimage"/>
<script class="testbody" type="text/javascript;version=1.7"> <script class="testbody" type="text/javascript;version=1.7">
const Cr = Components.results;
var whichCamera = navigator.mozCameras.getListOfCameras()[0]; var whichCamera = navigator.mozCameras.getListOfCameras()[0];
var config = { var config = {
mode: 'picture', mode: 'picture',
@ -55,15 +57,25 @@ var tests = [
{ {
key: "set-picture-size-after-release", key: "set-picture-size-after-release",
func: function testSetPictureSize(camera) { func: function testSetPictureSize(camera) {
camera.setPictureSize({ width: 0, height: 0 }); try {
next(); camera.setPictureSize({ width: 0, height: 0 });
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"setPictureSize() failed with: " + e.name);
next();
}
} }
}, },
{ {
key: "set-thumbnail-size-after-release", key: "set-thumbnail-size-after-release",
func: function testSetThumbnailSize(camera) { func: function testSetThumbnailSize(camera) {
camera.setThumbnailSize({ width: 0, height: 0 }); try {
next(); camera.setThumbnailSize({ width: 0, height: 0 });
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"setThumbnailSize() failed with: " + e.name);
next();
}
} }
}, },
{ {
@ -76,8 +88,13 @@ var tests = [
{ {
key: "resume-preview-after-release", key: "resume-preview-after-release",
func: function testResumePreview(camera) { func: function testResumePreview(camera) {
camera.resumePreview(); try {
next(); camera.resumePreview();
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"resumePreview() failed with: " + e.name);
next();
}
} }
}, },
{ {
@ -87,7 +104,8 @@ var tests = [
ok(false, "autoFocus() succeeded incorrectly"); ok(false, "autoFocus() succeeded incorrectly");
} }
function onError(error) { function onError(error) {
ok(error.name === "NS_ERROR_NOT_INITIALIZED", "autoFocus() failed with: " + error); ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"autoFocus() failed with: " + error.name);
next(); next();
} }
camera.autoFocus().then(onSuccess, onError); camera.autoFocus().then(onSuccess, onError);
@ -100,7 +118,8 @@ var tests = [
ok(false, "takePicture() succeeded incorrectly"); ok(false, "takePicture() succeeded incorrectly");
} }
function onError(error) { function onError(error) {
ok(error.name === "NS_ERROR_NOT_INITIALIZED", "takePicture() failed with: " + error); ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"takePicture() failed with: " + error.name);
next(); next();
} }
camera.takePicture(null).then(onSuccess, onError); camera.takePicture(null).then(onSuccess, onError);
@ -113,7 +132,8 @@ var tests = [
ok(false, "startRecording() process succeeded incorrectly"); ok(false, "startRecording() process succeeded incorrectly");
} }
function onError(error) { function onError(error) {
ok(error.name === "NS_ERROR_FAILURE", "startRecording() failed with: " + error); ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"startRecording() failed with: " + error.name);
next(); next();
} }
var recordingOptions = { var recordingOptions = {
@ -128,8 +148,13 @@ var tests = [
{ {
key: "stop-recording-after-release", key: "stop-recording-after-release",
func: function testStopRecording(camera) { func: function testStopRecording(camera) {
camera.stopRecording(); try {
next(); camera.stopRecording();
} catch(e) {
ok(e.result === SpecialPowers.Cr.NS_ERROR_NOT_AVAILABLE,
"stopRecording() failed with: " + e.name);
next();
}
} }
}, },
{ {
@ -139,7 +164,8 @@ var tests = [
ok(false, "setConfiguration() process succeeded incorrectly"); ok(false, "setConfiguration() process succeeded incorrectly");
} }
function onError(error) { function onError(error) {
ok(error.name === "NS_ERROR_NOT_INITIALIZED", "setConfiguration() failed with: " + error); ok(error.name === "NS_ERROR_NOT_AVAILABLE",
"setConfiguration() failed with: " + error.name);
next(); next();
} }
camera.setConfiguration(config).then(onSuccess, onError); camera.setConfiguration(config).then(onSuccess, onError);

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

@ -401,6 +401,34 @@ var tests = [
nextSize(); nextSize();
}, },
}, },
{
key: "bug-1052851",
prep: function setupFakeMetering(test) {
// We should reject duplicate values.
test.setFakeParameters(
"auto-exposure=frame-average;auto-exposure-values=spot,frame-average,center-weighted,spot,center-weighted",
function () {
run();
});
},
test: function testFakeMetering(cam, cap) {
ok(cap.meteringModes.length == 3, "Metering modes length = " + cap.meteringModes.length);
// make sure expected values are present
[ "spot", "frame-average", "center-weighted" ].forEach(function(mode) {
ok(cap.meteringModes.indexOf(mode) != -1, "Metering mode '" + mode + "' is present");
});
// test setters/getters for individual metering modes
cap.meteringModes.forEach(function(mode, index) {
cam.meteringMode = mode;
ok(cam.meteringMode === mode,
"Metering Mode[" + index + "] = " + mode + ", cam.meteringMode = " + cam.meteringMode);
});
next();
}
},
]; ];
var testGenerator = function() { var testGenerator = function() {

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

@ -397,7 +397,7 @@ Nfc.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsINfcGonkEventListener]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsINfcGonkEventListener]),
rfState: null, rfState: NFC.NFC_RF_STATE_IDLE,
nfcService: null, nfcService: null,

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

@ -99,7 +99,7 @@ struct EventOptions
int32_t mMajorVersion; int32_t mMajorVersion;
int32_t mMinorVersion; int32_t mMinorVersion;
nsTArray<uint8_t> mTechList; nsTArray<uint8_t> mTechList;
bool mIsP2P; int32_t mIsP2P;
nsTArray<NDEFRecordStruct> mRecords; nsTArray<NDEFRecordStruct> mRecords;
int32_t mTagType; int32_t mTagType;
int32_t mMaxNDEFSize; int32_t mMaxNDEFSize;

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

@ -246,6 +246,13 @@ MozNFCPeerImpl.prototype = {
Ci.nsIDOMGlobalPropertyInitializer]), Ci.nsIDOMGlobalPropertyInitializer]),
}; };
// Should be mapped to the RFState defined in WebIDL.
let RFState = {
IDLE: "idle",
LISTEN: "listen",
DISCOVERY: "discovery"
};
/** /**
* Implementation of navigator NFC object. * Implementation of navigator NFC object.
*/ */
@ -270,13 +277,6 @@ MozNFCImpl.prototype = {
nfcTag: null, nfcTag: null,
eventService: null, eventService: null,
// Should be mapped to the RFState defined in WebIDL.
rfState: {
IDLE: "idle",
LISTEN: "listen",
DISCOVERY: "discovery"
},
init: function init(aWindow) { init: function init(aWindow) {
debug("MozNFCImpl init called"); debug("MozNFCImpl init called");
this._window = aWindow; this._window = aWindow;
@ -316,22 +316,26 @@ MozNFCImpl.prototype = {
startPoll: function startPoll() { startPoll: function startPoll() {
let callback = new NfcCallback(this._window); let callback = new NfcCallback(this._window);
this._nfcContentHelper.changeRFState(this.rfState.DISCOVERY, callback); this._nfcContentHelper.changeRFState(RFState.DISCOVERY, callback);
return callback.promise; return callback.promise;
}, },
stopPoll: function stopPoll() { stopPoll: function stopPoll() {
let callback = new NfcCallback(this._window); let callback = new NfcCallback(this._window);
this._nfcContentHelper.changeRFState(this.rfState.LISTEN, callback); this._nfcContentHelper.changeRFState(RFState.LISTEN, callback);
return callback.promise; return callback.promise;
}, },
powerOff: function powerOff() { powerOff: function powerOff() {
let callback = new NfcCallback(this._window); let callback = new NfcCallback(this._window);
this._nfcContentHelper.changeRFState(this.rfState.IDLE, callback); this._nfcContentHelper.changeRFState(RFState.IDLE, callback);
return callback.promise; return callback.promise;
}, },
get enabled() {
return this._rfState != RFState.IDLE;
},
defineEventHandlerGetterSetter: function defineEventHandlerGetterSetter(name) { defineEventHandlerGetterSetter: function defineEventHandlerGetterSetter(name) {
Object.defineProperty(this, name, { Object.defineProperty(this, name, {
get: function get() { get: function get() {

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

@ -1726,6 +1726,12 @@ RilObject.prototype = {
}, },
hangUpForeground: function(options) { hangUpForeground: function(options) {
for each (let currentCall in this.currentCalls) {
if (currentCall.state == CALL_STATE_ACTIVE) {
currentCall.hangUpLocal = true;
}
}
this.telephonyRequestQueue.push(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, () => { this.telephonyRequestQueue.push(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, () => {
this.context.Buf.simpleRequest(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, this.context.Buf.simpleRequest(REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,
options); options);
@ -1733,6 +1739,28 @@ RilObject.prototype = {
}, },
hangUpBackground: function(options) { hangUpBackground: function(options) {
let waitingCalls = [];
let heldCalls = [];
for each (let currentCall in this.currentCalls) {
switch (currentCall.state) {
case CALL_STATE_WAITING:
waitingCalls.push(currentCall);
break;
case CALL_STATE_HOLDING:
heldCalls.push(currentCall);
break;
}
}
// When both a held and a waiting call exist, the request shall apply to
// the waiting call.
if (waitingCalls.length) {
waitingCalls.forEach(call => call.hangUpLocal = true);
} else {
heldCalls.forEach(call => call.hangUpLocal = true);
}
this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND, () => { this.telephonyRequestQueue.push(REQUEST_HANGUP_WAITING_OR_BACKGROUND, () => {
this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND, this.context.Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND,
options); options);

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

@ -1241,7 +1241,7 @@ TelephonyService.prototype = {
} }
// Handle cached dial request. // Handle cached dial request.
if (this._cachedDialRequest && !this._getOneActiveCall()) { if (this._cachedDialRequest && !this._getOneActiveCall(aClientId)) {
if (DEBUG) debug("All calls held. Perform the cached dial request."); if (DEBUG) debug("All calls held. Perform the cached dial request.");
let request = this._cachedDialRequest; let request = this._cachedDialRequest;

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

@ -86,6 +86,7 @@ interface CameraCapabilities
[Constant, Cached] readonly attribute CameraRecorderProfiles recorderProfiles; [Constant, Cached] readonly attribute CameraRecorderProfiles recorderProfiles;
[Constant, Cached] readonly attribute sequence<DOMString> isoModes; [Constant, Cached] readonly attribute sequence<DOMString> isoModes;
[Constant, Cached] readonly attribute sequence<DOMString> meteringModes;
jsonifier; jsonifier;
}; };

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

@ -289,6 +289,11 @@ interface CameraControl : MediaStream
same orientation as the real world. */ same orientation as the real world. */
readonly attribute long sensorAngle; readonly attribute long sensorAngle;
/* the mode the camera will use to determine the correct exposure of
the scene; supported modes are exposed by capabilities.meteringModes. */
[Throws]
attribute DOMString meteringMode;
/* tell the camera to attempt to focus the image */ /* tell the camera to attempt to focus the image */
[Throws] [Throws]
Promise<boolean> autoFocus(); Promise<boolean> autoFocus();

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

@ -75,6 +75,11 @@ interface MozNFCManager {
CheckPermissions="nfc nfc-share", CheckPermissions="nfc nfc-share",
AvailableIn="PrivilegedApps"] AvailableIn="PrivilegedApps"]
interface MozNFC : EventTarget { interface MozNFC : EventTarget {
/**
* Indicate if NFC is enabled.
*/
readonly attribute boolean enabled;
/** /**
* This event will be fired when another NFCPeer is detected, and user confirms * This event will be fired when another NFCPeer is detected, and user confirms
* to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P. * to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P.

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

@ -55,10 +55,6 @@ int __real_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mtx);
int __real_pthread_cond_timedwait(pthread_cond_t *cond, int __real_pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mtx, pthread_mutex_t *mtx,
const struct timespec *abstime); const struct timespec *abstime);
int __real___pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mtx,
const struct timespec *abstime,
clockid_t clock);
int __real_pthread_mutex_lock(pthread_mutex_t *mtx); int __real_pthread_mutex_lock(pthread_mutex_t *mtx);
int __real_poll(struct pollfd *fds, nfds_t nfds, int timeout); int __real_poll(struct pollfd *fds, nfds_t nfds, int timeout);
int __real_epoll_create(int size); int __real_epoll_create(int size);
@ -1123,47 +1119,6 @@ __wrap_pthread_cond_timedwait(pthread_cond_t *cond,
return rv; return rv;
} }
extern "C" int __pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mtx,
const struct timespec *abstime,
clockid_t clock);
extern "C" MFBT_API int
__wrap___pthread_cond_timedwait(pthread_cond_t *cond,
pthread_mutex_t *mtx,
const struct timespec *abstime,
clockid_t clock) {
int rv = 0;
THREAD_FREEZE_POINT1_VIP();
if (freezePoint2) {
RECREATE_CONTINUE();
RECREATE_PASS_VIP();
RECREATE_GATE_VIP();
return rv;
}
if (recreated && mtx) {
if (!freezePoint1) {
tinfo->condMutex = mtx;
if (!pthread_mutex_trylock(mtx)) {
tinfo->condMutexNeedsBalancing = true;
}
}
RECREATE_CONTINUE();
RECREATE_PASS_VIP();
}
rv = REAL(__pthread_cond_timedwait)(cond, mtx, abstime, clock);
if (recreated && mtx) {
if (tinfo->condMutex) {
tinfo->condMutexNeedsBalancing = false;
pthread_mutex_unlock(mtx);
}
RECREATE_GATE_VIP();
}
THREAD_FREEZE_POINT2_VIP();
return rv;
}
extern "C" MFBT_API int extern "C" MFBT_API int
__wrap_pthread_mutex_lock(pthread_mutex_t *mtx) { __wrap_pthread_mutex_lock(pthread_mutex_t *mtx) {