Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2015-11-30 13:46:30 +01:00
commit 77dfa13ff4
357 changed files with 6610 additions and 4194 deletions

View File

@ -104,6 +104,9 @@ GPATH
^testing/mozharness/logs/
^testing/mozharness/build/
# Ignore tox generated dir
.tox/
# Ignore node_modules from eslint-plugin-mozilla
^testing/eslint-plugin-mozilla/node_modules/

View File

@ -552,7 +552,7 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
NSPoint tmpPoint = NSMakePoint(point.x,
[mainView frame].size.height - point.y);
nsIntPoint geckoPoint = nsCocoaUtils::
LayoutDeviceIntPoint geckoPoint = nsCocoaUtils::
CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
mozAccessible* nativeChild = nil;

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -110,7 +110,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="576f57b6510de59c08568b53c0fb60588be8689e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>
<project name="platform/system/netd" path="system/netd" revision="a6531f7befb49b1c81bc0de7e51c5482b308e1c5"/>

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -116,7 +116,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="cfcef469537869947abb9aa1d656774cc2678d4c"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="10e78a05252b3de785f88c2d0b9ea8a428009c50"/>
<project name="platform/system/media" path="system/media" revision="188b3e51e0a2ce1e16dc8067edef7be3d2365ad9"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>

View File

@ -15,7 +15,7 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gecko and Gaia -->
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<!-- Gonk-specific things and forks -->
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
<project name="platform_build" path="build" remote="b2g" revision="1b0db93fb6b870b03467aff50d6419771ba0d88c">
@ -31,7 +31,7 @@
<project name="screencap-gonk" path="external/screencap-gonk" remote="b2g" revision="e6403c71e9eca8cb943739d5a0a192deac60fc51"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c72c9278ddc2f442d193474993d36e7f2cfb08c4"/>
<project name="platform_frameworks_base" path="frameworks/base" remote="b2g" revision="6afc63abe52776ae6a1d32a2d927e630a743a86a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>

View File

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
@ -118,7 +118,7 @@
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
<project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>

View File

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -114,7 +114,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="6aa61f8557a22039a30b42b7f283996381fd625d"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="5356165f67f4a81c2ef28671c13697f1657590df"/>
<project name="platform/system/media" path="system/media" revision="be0e2fe59a8043fa5200f75697df9220a99abe9d"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>

View File

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -126,7 +126,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="1d080491f26dfdfd76d5bbc3e6b40c660e8565af"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="61a10cbd19d6b7fc052a8cb92dfa1b37b93754f3"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="9e892a67a01671f312c76b0880dedaa6ba478148"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="47fa016e2248b80aebd5928402c7409f8e0ca64e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>
<project name="platform/system/media" path="system/media" revision="70bfebc66d9c6a4c614a8c7efde90e8e7e1d8641"/>

View File

@ -15,7 +15,7 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gecko and Gaia -->
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<!-- Gonk-specific things and forks -->
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
<project name="platform_build" path="build" remote="b2g" revision="1b0db93fb6b870b03467aff50d6419771ba0d88c">
@ -31,7 +31,7 @@
<project name="screencap-gonk" path="external/screencap-gonk" remote="b2g" revision="e6403c71e9eca8cb943739d5a0a192deac60fc51"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c72c9278ddc2f442d193474993d36e7f2cfb08c4"/>
<project name="platform_frameworks_base" path="frameworks/base" remote="b2g" revision="6afc63abe52776ae6a1d32a2d927e630a743a86a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -109,7 +109,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="c792f0bd9fff7aea2887c60bbb3a9bbdb534ffa3"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="69d524e80cdf3981006627c65ac85f3a871238a3"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5a48c04c4bb5f079bc757e29864a42427378e051"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="576f57b6510de59c08568b53c0fb60588be8689e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>
<project name="platform/system/netd" path="system/netd" revision="a6531f7befb49b1c81bc0de7e51c5482b308e1c5"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "ee6d8625c9d76de2f6614c87bb82b301bc37c7a9",
"git_revision": "702773bee0b70e479ccebe5e061f571e977bc376",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "553d04c277d58581b55701f1978b82b257990a7e",
"revision": "d8d3b630339c16b3bf5292813143da11a8bbb0f0",
"repo_path": "integration/gaia-central"
}

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -116,7 +116,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="6aa61f8557a22039a30b42b7f283996381fd625d"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="b562b01c93de9578d5db537b6a602a38e1aaa0ce"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="387f03e815f57d536dd922706db1622bddba8d81"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="5356165f67f4a81c2ef28671c13697f1657590df"/>
<project name="platform/system/media" path="system/media" revision="be0e2fe59a8043fa5200f75697df9220a99abe9d"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>

View File

@ -18,8 +18,8 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
@ -119,7 +119,7 @@
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="842e33e43a55ea44833b9e23e4d180fa17c843af"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="5db24726f0f42124304195a6bdea129039eeeaeb"/>
<project name="platform/system/bluetooth" path="system/bluetooth" revision="930ae098543881f47eac054677726ee4b998b2f8"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform_system_core" path="system/core" remote="b2g" revision="542d1f59dc331b472307e5bd043101d14d5a3a3e"/>
<project name="platform/system/extras" path="system/extras" revision="18c1180e848e7ab8691940481f5c1c8d22c37b3e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>

View File

@ -15,10 +15,10 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="ee6d8625c9d76de2f6614c87bb82b301bc37c7a9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="702773bee0b70e479ccebe5e061f571e977bc376"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
@ -127,7 +127,7 @@
<project name="platform/prebuilts/ndk" path="prebuilts/ndk" revision="1d080491f26dfdfd76d5bbc3e6b40c660e8565af"/>
<project name="platform/prebuilts/sdk" path="prebuilts/sdk" revision="61a10cbd19d6b7fc052a8cb92dfa1b37b93754f3"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="9e892a67a01671f312c76b0880dedaa6ba478148"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="07a49d1f7a7a0a1e7d70fef353c2700434ffdc5c"/>
<project name="platform_system_bluetoothd" path="system/bluetoothd" remote="b2g" revision="bdb3469b9302bb22e7df8912e582feefbd05d55f"/>
<project name="platform/system/extras" path="system/extras" revision="47fa016e2248b80aebd5928402c7409f8e0ca64e"/>
<project name="platform_system_libfdio" path="system/libfdio" remote="b2g" revision="34adfb400e031f3dd3353d92413572db5e3a7376"/>
<project name="platform/system/media" path="system/media" revision="70bfebc66d9c6a4c614a8c7efde90e8e7e1d8641"/>

View File

@ -13,6 +13,7 @@
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
#include "nsWindowsMigrationUtils.h"
#include "nsStringGlue.h"
#define NS_HANDLE_JET_ERROR(err) { \
if (err < JET_errSuccess) { \
@ -199,12 +200,15 @@ nsEdgeReadingListExtractor::ConvertJETError(const JET_ERR &aError)
return NS_ERROR_FILE_NOT_FOUND;
case JET_errDatabaseDirtyShutdown:
return NS_ERROR_FILE_CORRUPTED;
default:
nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
wchar_t* msg = new wchar_t[80];
swprintf(msg, 80, MOZ_UTF16("Unexpected JET error from ESE database: %ld"), aError);
consoleService->LogStringMessage(msg);
default: {
nsCOMPtr<nsIConsoleService>
consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
nsAutoString msg;
msg.AppendLiteral("Unexpected JET error from ESE database: ");
msg.AppendInt(aError);
consoleService->LogStringMessage(msg.get());
return NS_ERROR_FAILURE;
}
}
}

View File

@ -89,6 +89,10 @@ leak:MessageLoop::MessageLoop
leak:base::WaitableEvent::TimedWait
leak:MessageLoop::PostTask_Helper
# Bug 1189430 - DNS leaks in mochitest-chrome.
leak:nsDNSService::AsyncResolveExtended
leak:_GetAddrInfo_Portable
# Bug 1189568 - Indirect leaks of IMContextWrapper and nsIntRect.
leak:nsWindow::Create
leak:nsBaseWidget::StoreWindowClipRegion

View File

@ -95,6 +95,7 @@ function RootActor(aConnection, aParameters) {
this._onTabListChanged = this.onTabListChanged.bind(this);
this._onAddonListChanged = this.onAddonListChanged.bind(this);
this._onWorkerListChanged = this.onWorkerListChanged.bind(this);
this._onServiceWorkerRegistrationListChanged = this.onServiceWorkerRegistrationListChanged.bind(this);
this._extraActors = {};
this._globalActorPool = new ActorPool(this.conn);
@ -386,6 +387,37 @@ RootActor.prototype = {
this._parameters.workerList.onListChanged = null;
},
onListServiceWorkerRegistrations: function () {
let registrationList = this._parameters.serviceWorkerRegistrationList;
if (!registrationList) {
return { from: this.actorID, error: "noServiceWorkerRegistrations",
message: "This root actor has no service worker registrations." };
}
return registrationList.getList().then(actors => {
let pool = new ActorPool(this.conn);
for (let actor of actors) {
pool.addActor(actor);
}
this.conn.removeActorPool(this._serviceWorkerRegistrationActorPool);
this._serviceWorkerRegistrationActorPool = pool;
this.conn.addActorPool(this._serviceWorkerRegistrationActorPool);
registrationList.onListChanged = this._onServiceWorkerRegistrationListChanged;
return {
"from": this.actorID,
"registrations": actors.map(actor => actor.form())
};
});
},
onServiceWorkerRegistrationListChanged: function () {
this.conn.send({ from: this.actorID, type: "serviceWorkerRegistrationListChanged" });
this._parameters.serviceWorkerRegistrationList.onListChanged = null;
},
onListProcesses: function () {
let processes = [];
for (let i = 0; i < ppmm.childCount; i++) {
@ -473,6 +505,7 @@ RootActor.prototype.requestTypes = {
"getTab": RootActor.prototype.onGetTab,
"listAddons": RootActor.prototype.onListAddons,
"listWorkers": RootActor.prototype.onListWorkers,
"listServiceWorkerRegistrations": RootActor.prototype.onListServiceWorkerRegistrations,
"listProcesses": RootActor.prototype.onListProcesses,
"getProcess": RootActor.prototype.onGetProcess,
"echo": RootActor.prototype.onEcho,

View File

@ -12,7 +12,7 @@ var promise = require("promise");
var { ActorPool, createExtraActors, appendExtraActors } = require("devtools/server/actors/common");
var { DebuggerServer } = require("devtools/server/main");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var { assert } = DevToolsUtils;
var { assert } = DevToolsUtils;
var { TabSources } = require("./utils/TabSources");
var makeDebugger = require("./utils/make-debugger");
@ -23,6 +23,7 @@ loader.lazyRequireGetter(this, "ThreadActor", "devtools/server/actors/script", t
loader.lazyRequireGetter(this, "unwrapDebuggerObjectGlobal", "devtools/server/actors/script", true);
loader.lazyRequireGetter(this, "BrowserAddonActor", "devtools/server/actors/addon", true);
loader.lazyRequireGetter(this, "WorkerActorList", "devtools/server/actors/worker", true);
loader.lazyRequireGetter(this, "ServiceWorkerRegistrationActorList", "devtools/server/actors/worker", true);
loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
// Assumptions on events module:
@ -130,6 +131,7 @@ function createRootActor(aConnection)
tabList: new BrowserTabList(aConnection),
addonList: new BrowserAddonList(aConnection),
workerList: new WorkerActorList({}),
serviceWorkerRegistrationList: new ServiceWorkerRegistrationActorList(),
globalActorFactories: DebuggerServer.globalActorFactories,
onShutdown: sendShutdownEvent
});
@ -1346,7 +1348,26 @@ TabActor.prototype = {
this._tabActorPool = null;
}
// Make sure that no more workerListChanged notifications are sent.
if (this._workerActorList !== null) {
this._workerActorList.onListChanged = null;
this._workerActorList = null;
}
if (this._workerActorPool !== null) {
this.conn.removeActorPool(this._workerActorPool);
this._workerActorPool = null;
}
// Make sure that no more serviceWorkerRegistrationChanged notifications are
// sent.
if (this._mustNotifyServiceWorkerRegistrationChanged) {
swm.removeListener(this);
this._mustNotifyServiceWorkerRegistrationChanged = false;
}
this._attached = false;
return true;
},

View File

@ -228,3 +228,106 @@ WorkerActorList.prototype = {
};
exports.WorkerActorList = WorkerActorList;
function ServiceWorkerRegistrationActor(registration) {
this._registration = registration;
};
ServiceWorkerRegistrationActor.prototype = {
actorPrefix: "serviceWorkerRegistration",
form: function () {
return {
actor: this.actorID,
scope: this._registration.scope
};
}
};
function ServiceWorkerRegistrationActorList() {
this._actors = new Map();
this._onListChanged = null;
this._mustNotify = false;
this.onRegister = this.onRegister.bind(this);
this.onUnregister = this.onUnregister.bind(this);
};
ServiceWorkerRegistrationActorList.prototype = {
getList: function () {
// Create a set of registrations.
let registrations = new Set();
let array = swm.getAllRegistrations();
for (let index = 0; index < array.length; ++index) {
registrations.add(
array.queryElementAt(index, Ci.nsIServiceWorkerRegistrationInfo));
}
// Delete each actor for which we don't have a registration.
for (let [registration, ] of this._actors) {
if (!registrations.has(registration)) {
this._actors.delete(registration);
}
}
// Create an actor for each registration for which we don't have one.
for (let registration of registrations) {
if (!this._actors.has(registration)) {
this._actors.set(registration,
new ServiceWorkerRegistrationActor(registration));
}
}
if (!this._mustNotify) {
if (this._onListChanged !== null) {
swm.addListener(this);
}
this._mustNotify = true;
}
let actors = [];
for (let [, actor] of this._actors) {
actors.push(actor);
}
return Promise.resolve(actors);
},
get onListchanged() {
return this._onListchanged;
},
set onListChanged(onListChanged) {
if (typeof onListChanged !== "function" && onListChanged !== null) {
throw new Error("onListChanged must be either a function or null.");
}
if (this._mustNotify) {
if (this._onListChanged === null && onListChanged !== null) {
swm.addListener(this);
}
if (this._onListChanged !== null && onListChanged === null) {
swm.removeListener(this);
}
}
this._onListChanged = onListChanged;
},
_notifyListChanged: function () {
this._onListChanged();
if (this._onListChanged !== null) {
swm.removeListener(this);
}
this._mustNotify = false;
},
onRegister: function (registration) {
this._notifyListChanged();
},
onUnregister: function (registration) {
this._notifyListChanged();
}
};
exports.ServiceWorkerRegistrationActorList = ServiceWorkerRegistrationActorList;

View File

@ -160,6 +160,7 @@ const UnsolicitedNotifications = {
"reflowActivity": "reflowActivity",
"addonListChanged": "addonListChanged",
"workerListChanged": "workerListChanged",
"serviceWorkerRegistrationListChanged": "serviceWorkerRegistrationList",
"tabNavigated": "tabNavigated",
"frameUpdate": "frameUpdate",
"pageError": "pageError",
@ -1529,6 +1530,15 @@ RootClient.prototype = {
listWorkers: DebuggerClient.requester({ type: "listWorkers" },
{ telemetry: "LISTWORKERS" }),
/**
* List the registered service workers.
*
* @param function aOnResponse
* Called with the response packet.
*/
listServiceWorkerRegistrations: DebuggerClient.requester({ type: "listServiceWorkerRegistrations" },
{ telemetry: "LISTSERVICEWORKERREGISTRATIONS" }),
/**
* List the running processes.
*

View File

@ -558,14 +558,15 @@ EnsureBlobForBackgroundManager(BlobImpl* aBlobImpl,
PBackgroundChild* aManager = nullptr)
{
MOZ_ASSERT(aBlobImpl);
RefPtr<BlobImpl> blobImpl = aBlobImpl;
if (!aManager) {
aManager = BackgroundChild::GetForCurrentThread();
MOZ_ASSERT(aManager);
if (!aManager) {
return blobImpl.forget();
}
}
RefPtr<BlobImpl> blobImpl = aBlobImpl;
const nsTArray<RefPtr<BlobImpl>>* subBlobImpls =
aBlobImpl->GetSubBlobImpls();
@ -670,6 +671,8 @@ WriteBlob(JSStructuredCloneWriter* aWriter,
RefPtr<BlobImpl> blobImpl = EnsureBlobForBackgroundManager(aBlob->Impl());
MOZ_ASSERT(blobImpl);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
// We store the position of the blobImpl in the array as index.
if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_BLOB,
aHolder->BlobImpls().Length())) {

View File

@ -2567,7 +2567,7 @@ CheckLeafLayers(Layer* aLayer, const nsIntPoint& aOffset, nsIntRegion* aCoveredR
child = child->GetNextSibling();
}
} else {
nsIntRegion rgn = aLayer->GetVisibleRegion();
nsIntRegion rgn = aLayer->GetVisibleRegion().ToUnknownRegion();
rgn.MoveBy(offset);
nsIntRegion tmp;
tmp.And(rgn, *aCoveredRegion);
@ -2603,7 +2603,7 @@ nsDOMWindowUtils::LeafLayersPartitionWindow(bool* aResult)
if (!CheckLeafLayers(root, offset, &coveredRegion)) {
*aResult = false;
}
if (!coveredRegion.IsEqual(root->GetVisibleRegion())) {
if (!coveredRegion.IsEqual(root->GetVisibleRegion().ToUnknownRegion())) {
*aResult = false;
}
#endif

View File

@ -2213,17 +2213,6 @@ nsGonkCameraControl::LoadRecorderProfiles()
return NS_OK;
}
/* static */ PLDHashOperator
nsGonkCameraControl::Enumerate(const nsAString& aProfileName,
RecorderProfile* aProfile,
void* aUserArg)
{
nsTArray<nsString>* profiles = static_cast<nsTArray<nsString>*>(aUserArg);
MOZ_ASSERT(profiles);
profiles->AppendElement(aProfileName);
return PL_DHASH_NEXT;
}
nsresult
nsGonkCameraControl::GetRecorderProfiles(nsTArray<nsString>& aProfiles)
{
@ -2233,7 +2222,9 @@ nsGonkCameraControl::GetRecorderProfiles(nsTArray<nsString>& aProfiles)
}
aProfiles.Clear();
mRecorderProfiles.EnumerateRead(Enumerate, static_cast<void*>(&aProfiles));
for (auto iter = mRecorderProfiles.Iter(); !iter.Done(); iter.Next()) {
aProfiles.AppendElement(iter.Key());
}
return NS_OK;
}

View File

@ -156,9 +156,6 @@ protected:
void CreatePoster(layers::Image* aImage, uint32_t aWidth, uint32_t aHeight, int32_t aRotation);
nsresult LoadRecorderProfiles();
static PLDHashOperator Enumerate(const nsAString& aProfileName,
RecorderProfile* aProfile,
void* aUserArg);
friend class SetPictureSize;
friend class SetThumbnailSize;

View File

@ -69,27 +69,19 @@ GonkCameraParameters::FindVendorSpecificKey(const char* aPotentialKeys[],
return nullptr;
}
/* static */ PLDHashOperator
GonkCameraParameters::EnumerateFlatten(const nsACString& aKey,
nsCString* aValue,
void* aUserArg)
{
nsCString* data = static_cast<nsCString*>(aUserArg);
if (!data->IsEmpty()) {
data->Append(';');
}
data->Append(aKey);
data->Append('=');
data->Append(*aValue);
return PL_DHASH_NEXT;
}
String8
GonkCameraParameters::Flatten() const
{
MutexAutoLock lock(mLock);
nsCString data;
mParams.EnumerateRead(EnumerateFlatten, static_cast<void*>(&data));
for (auto iter = mParams.ConstIter(); !iter.Done(); iter.Next()) {
if (!data.IsEmpty()) {
data.Append(';');
}
data.Append(iter.Key());
data.Append('=');
data.Append(*iter.UserData());
}
return String8(data.Data());
}

View File

@ -93,8 +93,6 @@ protected:
nsClassHashtable<nsStringHashKey, nsCString> mIsoModeMap;
nsClassHashtable<nsCStringHashKey, nsCString> mParams;
static PLDHashOperator EnumerateFlatten(const nsACString& aKey, nsCString* aValue, void* aUserArg);
nsresult SetImpl(const char* aKey, const char* aValue)
{
if (!aValue || strchr(aValue, ';') || strchr(aValue, '=')) {

View File

@ -269,18 +269,6 @@ GonkRecorderProfile::GonkRecorderProfile(uint32_t aCameraId,
mIsValid = isValid && mAudio.IsValid() && mVideo.IsValid();
}
/* static */ PLDHashOperator
GonkRecorderProfile::Enumerate(const nsAString& aProfileName,
GonkRecorderProfile* aProfile,
void* aUserArg)
{
nsTArray<RefPtr<ICameraControl::RecorderProfile>>* profiles =
static_cast<nsTArray<RefPtr<ICameraControl::RecorderProfile>>*>(aUserArg);
MOZ_ASSERT(profiles);
profiles->AppendElement(aProfile);
return PL_DHASH_NEXT;
}
/* static */
already_AddRefed<GonkRecorderProfile>
GonkRecorderProfile::CreateProfile(uint32_t aCameraId, int aQuality)
@ -379,7 +367,9 @@ GonkRecorderProfile::GetAll(uint32_t aCameraId,
}
aProfiles.Clear();
profiles->EnumerateRead(Enumerate, static_cast<void*>(&aProfiles));
for (auto iter = profiles->Iter(); !iter.Done(); iter.Next()) {
aProfiles.AppendElement(iter.UserData());
}
return NS_OK;
}

View File

@ -142,9 +142,6 @@ protected:
static already_AddRefed<GonkRecorderProfile> CreateProfile(uint32_t aCameraId,
int aQuality);
static ProfileHashtable* GetProfileHashtable(uint32_t aCameraId);
static PLDHashOperator Enumerate(const nsAString& aProfileName,
GonkRecorderProfile* aProfile,
void* aUserArg);
uint32_t mCameraId;
int mQuality;

View File

@ -52,6 +52,7 @@
#include "nsRuleData.h"
#include "nsIPrincipal.h"
#include "nsContainerFrame.h"
#include "nsStyleUtil.h"
#include "nsPresState.h"
#include "nsILayoutHistoryState.h"
@ -1326,12 +1327,28 @@ nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(const nsMappedAttribut
}
}
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
nsCSSValue* lang = aData->ValueForLang();
if (lang->GetUnit() == eCSSUnit_Null) {
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::lang);
if (value && value->Type() == nsAttrValue::eString) {
lang->SetStringValue(value->GetStringValue(), eCSSUnit_Ident);
const nsAttrValue* langValue = aAttributes->GetAttr(nsGkAtoms::lang);
if (langValue && langValue->Type() == nsAttrValue::eString) {
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
nsCSSValue* lang = aData->ValueForLang();
if (lang->GetUnit() == eCSSUnit_Null) {
lang->SetStringValue(langValue->GetStringValue(), eCSSUnit_Ident);
}
}
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
nsCSSValue* emphasisPos = aData->ValueForTextEmphasisPosition();
if (emphasisPos->GetUnit() == eCSSUnit_Null) {
const nsAString& lang = langValue->GetStringValue();
if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("zh"))) {
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH,
eCSSUnit_Enumerated);
} else if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("ja")) ||
nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("mn"))) {
// This branch is currently no part of the spec.
// See bug 1040668 comment 69 and comment 75.
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT,
eCSSUnit_Enumerated);
}
}
}
}

View File

@ -14955,46 +14955,6 @@ VersionChangeTransaction::UpdateMetadata(nsresult aResult)
MOZ_ASSERT(!!mActorWasAlive == !!mOpenDatabaseOp->mDatabase);
MOZ_ASSERT_IF(mActorWasAlive, !mOpenDatabaseOp->mDatabaseId.IsEmpty());
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
Enumerate(const uint64_t& aKey,
RefPtr<FullObjectStoreMetadata>& aValue,
void* /* aClosure */)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
if (aValue->mDeleted) {
return PL_DHASH_REMOVE;
}
aValue->mIndexes.Enumerate(Enumerate, nullptr);
#ifdef DEBUG
aValue->mIndexes.MarkImmutable();
#endif
return PL_DHASH_NEXT;
}
private:
static PLDHashOperator
Enumerate(const uint64_t& aKey,
RefPtr<FullIndexMetadata>& aValue,
void* /* aClosure */)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
if (aValue->mDeleted) {
return PL_DHASH_REMOVE;
}
return PL_DHASH_NEXT;
}
};
if (IsActorDestroyed() || !mActorWasAlive) {
return;
}
@ -15011,7 +14971,33 @@ VersionChangeTransaction::UpdateMetadata(nsresult aResult)
if (NS_SUCCEEDED(aResult)) {
// Remove all deleted objectStores and indexes, then mark immutable.
info->mMetadata->mObjectStores.Enumerate(Helper::Enumerate, nullptr);
for (auto objectStoreIter = info->mMetadata->mObjectStores.Iter();
!objectStoreIter.Done();
objectStoreIter.Next()) {
MOZ_ASSERT(objectStoreIter.Key());
RefPtr<FullObjectStoreMetadata>& metadata = objectStoreIter.Data();
MOZ_ASSERT(metadata);
if (metadata->mDeleted) {
objectStoreIter.Remove();
continue;
}
for (auto indexIter = metadata->mIndexes.Iter();
!indexIter.Done();
indexIter.Next()) {
MOZ_ASSERT(indexIter.Key());
RefPtr<FullIndexMetadata>& index = indexIter.Data();
MOZ_ASSERT(index);
if (index->mDeleted) {
indexIter.Remove();
}
}
#ifdef DEBUG
metadata->mIndexes.MarkImmutable();
#endif
}
#ifdef DEBUG
info->mMetadata->mObjectStores.MarkImmutable();
#endif
@ -15909,22 +15895,6 @@ FileManager::Init(nsIFile* aDirectory,
nsresult
FileManager::Invalidate()
{
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
ClearDBRefs(const uint64_t& aKey, FileInfo*& aValue, void* aUserArg)
{
MOZ_ASSERT(aValue);
if (aValue->LockedClearDBRefs()) {
return PL_DHASH_NEXT;
}
return PL_DHASH_REMOVE;
}
};
if (IndexedDatabaseManager::IsClosed()) {
MOZ_ASSERT(false, "Shouldn't be called after shutdown!");
return NS_ERROR_UNEXPECTED;
@ -15935,7 +15905,14 @@ FileManager::Invalidate()
MOZ_ASSERT(!mInvalidated);
mInvalidated = true;
mFileInfos.Enumerate(Helper::ClearDBRefs, nullptr);
for (auto iter = mFileInfos.Iter(); !iter.Done(); iter.Next()) {
FileInfo* info = iter.Data();
MOZ_ASSERT(info);
if (!info->LockedClearDBRefs()) {
iter.Remove();
}
}
return NS_OK;
}

View File

@ -1025,27 +1025,15 @@ IDBDatabase::NoteFinishedFileActor(PBackgroundIDBDatabaseFileChild* aFileActor)
AssertIsOnOwningThread();
MOZ_ASSERT(aFileActor);
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
Remove(nsISupports* aKey,
PBackgroundIDBDatabaseFileChild*& aValue,
void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
MOZ_ASSERT(aClosure);
for (auto iter = mFileActors.Iter(); !iter.Done(); iter.Next()) {
MOZ_ASSERT(iter.Key());
PBackgroundIDBDatabaseFileChild* actor = iter.Data();
MOZ_ASSERT(actor);
if (aValue == static_cast<PBackgroundIDBDatabaseFileChild*>(aClosure)) {
return PL_DHASH_REMOVE;
}
return PL_DHASH_NEXT;
if (actor == aFileActor) {
iter.Remove();
}
};
mFileActors.Enumerate(&Helper::Remove, aFileActor);
}
}
void
@ -1163,23 +1151,16 @@ IDBDatabase::ExpireFileActors(bool aExpireAll)
{
AssertIsOnOwningThread();
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
MaybeExpireFileActors(nsISupports* aKey,
PBackgroundIDBDatabaseFileChild*& aValue,
void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
MOZ_ASSERT(aClosure);
if (mBackgroundActor && mFileActors.Count()) {
for (auto iter = mFileActors.Iter(); !iter.Done(); iter.Next()) {
nsISupports* key = iter.Key();
PBackgroundIDBDatabaseFileChild* actor = iter.Data();
MOZ_ASSERT(key);
MOZ_ASSERT(actor);
const bool expiringAll = *static_cast<bool*>(aClosure);
bool shouldExpire = expiringAll;
bool shouldExpire = aExpireAll;
if (!shouldExpire) {
nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(aKey);
nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(key);
MOZ_ASSERT(weakRef);
nsCOMPtr<nsISupports> referent = do_QueryReferent(weakRef);
@ -1187,19 +1168,13 @@ IDBDatabase::ExpireFileActors(bool aExpireAll)
}
if (shouldExpire) {
PBackgroundIDBDatabaseFileChild::Send__delete__(aValue);
PBackgroundIDBDatabaseFileChild::Send__delete__(actor);
if (!expiringAll) {
return PL_DHASH_REMOVE;
if (!aExpireAll) {
iter.Remove();
}
}
return PL_DHASH_NEXT;
}
};
if (mBackgroundActor && mFileActors.Count()) {
mFileActors.Enumerate(&Helper::MaybeExpireFileActors, &aExpireAll);
if (aExpireAll) {
mFileActors.Clear();
}

View File

@ -1753,6 +1753,12 @@ protected:
BlobChild* mActor;
nsCOMPtr<nsIEventTarget> mActorTarget;
// We use this pointer to keep a live a blobImpl coming from a different
// process until this one is fully created. We set it to null when
// SendCreatedFromKnownBlob() is received. This is used only with KnownBlob
// params in the CTOR of a IPC BlobImpl.
RefPtr<BlobImpl> mDifferentProcessBlobImpl;
RefPtr<BlobImpl> mSameProcessBlobImpl;
const bool mIsSlice;
@ -1760,31 +1766,20 @@ protected:
public:
// For File.
RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aRemoteBlobImpl,
const nsAString& aName,
const nsAString& aContentType,
uint64_t aLength,
int64_t aModDate,
BlobDirState aDirState);
BlobDirState aDirState,
bool aIsSameProcessBlob);
// For Blob.
RemoteBlobImpl(BlobChild* aActor,
const nsAString& aContentType,
uint64_t aLength);
// For same-process blobs.
RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aSameProcessBlobImpl,
const nsAString& aName,
BlobImpl* aRemoteBlobImpl,
const nsAString& aContentType,
uint64_t aLength,
int64_t aModDate,
BlobDirState aDirState);
// For same-process blobs.
RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aSameProcessBlobImpl,
const nsAString& aContentType,
uint64_t aLength);
bool aIsSameProcessBlob);
// For mystery blobs.
explicit
@ -1857,6 +1852,13 @@ public:
virtual BlobParent*
GetBlobParent() override;
void
NullifyDifferentProcessBlobImpl()
{
MOZ_ASSERT(mDifferentProcessBlobImpl);
mDifferentProcessBlobImpl = nullptr;
}
protected:
// For SliceImpl.
RemoteBlobImpl(const nsAString& aContentType, uint64_t aLength);
@ -2086,56 +2088,43 @@ private:
BlobChild::
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aRemoteBlobImpl,
const nsAString& aName,
const nsAString& aContentType,
uint64_t aLength,
int64_t aModDate,
BlobDirState aDirState)
BlobDirState aDirState,
bool aIsSameProcessBlob)
: BlobImplBase(aName, aContentType, aLength, aModDate, aDirState)
, mIsSlice(false)
{
if (aIsSameProcessBlob) {
MOZ_ASSERT(aRemoteBlobImpl);
mSameProcessBlobImpl = aRemoteBlobImpl;
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
} else {
mDifferentProcessBlobImpl = aRemoteBlobImpl;
}
CommonInit(aActor);
}
BlobChild::
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
const nsAString& aContentType,
uint64_t aLength)
: BlobImplBase(aContentType, aLength)
, mIsSlice(false)
{
CommonInit(aActor);
}
BlobChild::
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aSameProcessBlobImpl,
const nsAString& aName,
BlobImpl* aRemoteBlobImpl,
const nsAString& aContentType,
uint64_t aLength,
int64_t aModDate,
BlobDirState aDirState)
: BlobImplBase(aName, aContentType, aLength, aModDate, aDirState)
, mSameProcessBlobImpl(aSameProcessBlobImpl)
, mIsSlice(false)
{
MOZ_ASSERT(aSameProcessBlobImpl);
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
CommonInit(aActor);
}
BlobChild::
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
BlobImpl* aSameProcessBlobImpl,
const nsAString& aContentType,
uint64_t aLength)
bool aIsSameProcessBlob)
: BlobImplBase(aContentType, aLength)
, mSameProcessBlobImpl(aSameProcessBlobImpl)
, mIsSlice(false)
{
MOZ_ASSERT(aSameProcessBlobImpl);
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
if (aIsSameProcessBlob) {
MOZ_ASSERT(aRemoteBlobImpl);
mSameProcessBlobImpl = aRemoteBlobImpl;
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
} else {
mDifferentProcessBlobImpl = aRemoteBlobImpl;
}
CommonInit(aActor);
}
@ -3033,7 +3022,7 @@ BlobChild::CommonInit(BlobChild* aOther, BlobImpl* aBlobImpl)
uint64_t length = otherImpl->GetSize(rv);
MOZ_ASSERT(!rv.Failed());
RefPtr<RemoteBlobImpl> remoteBlob;
RemoteBlobImpl* remoteBlob = nullptr;
if (otherImpl->IsFile()) {
nsString name;
otherImpl->GetName(name);
@ -3041,12 +3030,20 @@ BlobChild::CommonInit(BlobChild* aOther, BlobImpl* aBlobImpl)
int64_t modDate = otherImpl->GetLastModified(rv);
MOZ_ASSERT(!rv.Failed());
remoteBlob = new RemoteBlobImpl(this, name, contentType, length, modDate,
otherImpl->GetDirState());
remoteBlob = new RemoteBlobImpl(this, otherImpl, name, contentType, length,
modDate, otherImpl->GetDirState(),
false /* SameProcessBlobImpl */);
} else {
remoteBlob = new RemoteBlobImpl(this, contentType, length);
remoteBlob = new RemoteBlobImpl(this, otherImpl, contentType, length,
false /* SameProcessBlobImpl */);
}
// This RemoteBlob must be kept alive untill RecvCreatedFromKnownBlob is
// called because the parent will send this notification and we must be able
// to manage it.
MOZ_ASSERT(remoteBlob);
remoteBlob->AddRef();
CommonInit(aOther->ParentID(), remoteBlob);
}
@ -3073,7 +3070,8 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
const NormalBlobConstructorParams& params =
blobParams.get_NormalBlobConstructorParams();
remoteBlob =
new RemoteBlobImpl(this, params.contentType(), params.length());
new RemoteBlobImpl(this, nullptr, params.contentType(), params.length(),
false /* SameProcessBlobImpl */);
break;
}
@ -3081,11 +3079,13 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
const FileBlobConstructorParams& params =
blobParams.get_FileBlobConstructorParams();
remoteBlob = new RemoteBlobImpl(this,
nullptr,
params.name(),
params.contentType(),
params.length(),
params.modDate(),
BlobDirState(params.dirState()));
BlobDirState(params.dirState()),
false /* SameProcessBlobImpl */);
break;
}
@ -3120,9 +3120,11 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
contentType,
size,
lastModifiedDate,
blobImpl->GetDirState());
blobImpl->GetDirState(),
true /* SameProcessBlobImpl */);
} else {
remoteBlob = new RemoteBlobImpl(this, blobImpl, contentType, size);
remoteBlob = new RemoteBlobImpl(this, blobImpl, contentType, size,
true /* SameProcessBlobImpl */);
}
break;
@ -3592,6 +3594,20 @@ BlobChild::DeallocPBlobStreamChild(PBlobStreamChild* aActor)
return true;
}
bool
BlobChild::RecvCreatedFromKnownBlob()
{
MOZ_ASSERT(mRemoteBlobImpl);
// Releasing the other blob now that this blob is fully created.
mRemoteBlobImpl->NullifyDifferentProcessBlobImpl();
// Release the additional reference to ourself that was added in order to
// receive this RecvCreatedFromKnownBlob.
mRemoteBlobImpl->Release();
return true;
}
/*******************************************************************************
* BlobParent
******************************************************************************/

View File

@ -220,6 +220,9 @@ private:
virtual bool
DeallocPBlobStreamChild(PBlobStreamChild* aActor) override;
virtual bool
RecvCreatedFromKnownBlob() override;
};
// Only let ContentChild call BlobChild::Startup() and ensure that

View File

@ -3524,6 +3524,18 @@ ContentParent::DeallocPBlobParent(PBlobParent* aActor)
return nsIContentParent::DeallocPBlobParent(aActor);
}
bool
ContentParent::RecvPBlobConstructor(PBlobParent* aActor,
const BlobConstructorParams& aParams)
{
const ParentBlobConstructorParams& params = aParams.get_ParentBlobConstructorParams();
if (params.blobParams().type() == AnyBlobConstructorParams::TKnownBlobConstructorParams) {
return aActor->SendCreatedFromKnownBlob();
}
return true;
}
mozilla::PRemoteSpellcheckEngineParent *
ContentParent::AllocPRemoteSpellcheckEngineParent()
{
@ -5721,6 +5733,7 @@ ContentParent::RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo)
void
ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (NS_WARN_IF(!aParams)) {
return;
}
@ -5734,6 +5747,7 @@ ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
ipcParams.threadFilters() = aParams->GetThreadFilterNames();
Unused << SendStartProfiler(ipcParams);
#endif
}
} // namespace dom

View File

@ -648,6 +648,9 @@ private:
override;
virtual bool DeallocPBlobParent(PBlobParent* aActor) override;
virtual bool RecvPBlobConstructor(PBlobParent* aActor,
const BlobConstructorParams& params) override;
virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) override;
virtual bool RecvGetRandomValues(const uint32_t& length,

View File

@ -45,6 +45,11 @@ parent:
// Use only for testing!
sync GetFilePath()
returns (nsString filePath);
child:
// This method must be called by the parent when the PBlobParent is fully
// created in order to release the known blob.
CreatedFromKnownBlob();
};
} // namespace dom

View File

@ -99,9 +99,9 @@ private:
return NS_ERROR_FAILURE;
}
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
{
aRanges.AppendElement(MediaByteRange(0, mLength));
aRanges += MediaByteRange(0, int64_t(mLength));
return NS_OK;
}

View File

@ -39,16 +39,8 @@
#include "MediaOmxReader.h"
#include "nsIPrincipal.h"
#include "mozilla/dom/HTMLMediaElement.h"
#if ANDROID_VERSION >= 18
#include "MediaCodecDecoder.h"
#include "MediaCodecReader.h"
#endif
#endif
#ifdef NECKO_PROTOCOL_rtsp
#if ANDROID_VERSION >= 18
#include "RtspMediaCodecDecoder.h"
#include "RtspMediaCodecReader.h"
#endif
#include "RtspOmxDecoder.h"
#include "RtspOmxReader.h"
#endif
@ -592,25 +584,13 @@ InstantiateDecoder(const nsACString& aType, MediaDecoderOwner* aOwner)
return nullptr;
}
}
#if ANDROID_VERSION >= 18
decoder = MediaDecoder::IsOmxAsyncEnabled()
? static_cast<MediaDecoder*>(new MediaCodecDecoder(aOwner))
: static_cast<MediaDecoder*>(new MediaOmxDecoder(aOwner));
#else
decoder = new MediaOmxDecoder(aOwner);
#endif
return decoder.forget();
}
#endif
#ifdef NECKO_PROTOCOL_rtsp
if (IsRtspSupportedType(aType)) {
#if ANDROID_VERSION >= 18
decoder = MediaDecoder::IsOmxAsyncEnabled()
? static_cast<MediaDecoder*>(new RtspMediaCodecDecoder(aOwner))
: static_cast<MediaDecoder*>(new RtspOmxDecoder(aOwner));
#else
decoder = new RtspOmxDecoder(aOwner);
#endif
return decoder.forget();
}
#endif
@ -682,13 +662,7 @@ MediaDecoderReader* DecoderTraits::CreateReader(const nsACString& aType, Abstrac
#endif
#ifdef MOZ_OMX_DECODER
if (IsOmxSupportedType(aType)) {
#if ANDROID_VERSION >= 18
decoderReader = MediaDecoder::IsOmxAsyncEnabled()
? static_cast<MediaDecoderReader*>(new MediaCodecReader(aDecoder))
: static_cast<MediaDecoderReader*>(new MediaOmxReader(aDecoder));
#else
decoderReader = new MediaOmxReader(aDecoder);
#endif
} else
#endif
#ifdef MOZ_ANDROID_OMX

View File

@ -188,6 +188,9 @@ public:
SelfType Span(const SelfType& aOther) const
{
if (IsEmpty()) {
return aOther;
}
SelfType result(*this);
if (aOther.mStart < mStart) {
result.mStart = aOther.mStart;
@ -398,7 +401,7 @@ public:
return intervals;
}
SelfType operator+ (const ElemType& aInterval)
SelfType operator+ (const ElemType& aInterval) const
{
SelfType intervals(*this);
intervals.Add(aInterval);
@ -439,7 +442,14 @@ public:
return *this;
}
SelfType operator- (const ElemType& aInterval)
SelfType operator- (const SelfType& aInterval) const
{
SelfType intervals(*this);
intervals -= aInterval;
return intervals;
}
SelfType operator- (const ElemType& aInterval) const
{
SelfType intervals(*this);
intervals -= aInterval;
@ -652,6 +662,23 @@ public:
return mIntervals.end();
}
ElemType& LastInterval()
{
MOZ_ASSERT(!mIntervals.IsEmpty());
return mIntervals.LastElement();
}
const ElemType& LastInterval() const
{
MOZ_ASSERT(!mIntervals.IsEmpty());
return mIntervals.LastElement();
}
void Clear()
{
mIntervals.Clear();
}
protected:
ContainerType mIntervals;

View File

@ -214,24 +214,6 @@ private:
};
class NotifyDataArrivedFilter {
public:
media::IntervalSet<int64_t> NotifyDataArrived(uint32_t aLength, int64_t aOffset) {
media::Interval<int64_t> interval(aOffset, aOffset + aLength);
media::IntervalSet<int64_t> newIntervals(interval);
newIntervals -= mIntervals;
mIntervals += interval;
return newIntervals;
}
const media::IntervalSet<int64_t>& GetIntervals() {
return mIntervals;
}
private:
media::IntervalSet<int64_t> mIntervals;
};
} // namespace mozilla
#endif

View File

@ -2442,7 +2442,7 @@ MediaCacheStream::InitAsClone(MediaCacheStream* aOriginal)
return NS_OK;
}
nsresult MediaCacheStream::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
nsresult MediaCacheStream::GetCachedRanges(MediaByteRangeSet& aRanges)
{
// Take the monitor, so that the cached data ranges can't grow while we're
// trying to loop over them.
@ -2457,7 +2457,7 @@ nsresult MediaCacheStream::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
int64_t endOffset = GetCachedDataEndInternal(startOffset);
NS_ASSERTION(startOffset < endOffset, "Buffered range must end after its start");
// Bytes [startOffset..endOffset] are cached.
aRanges.AppendElement(MediaByteRange(startOffset, endOffset));
aRanges += MediaByteRange(startOffset, endOffset);
startOffset = GetNextCachedDataInternal(endOffset);
NS_ASSERTION(startOffset == -1 || startOffset > endOffset,
"Must have advanced to start of next range, or hit end of stream");

View File

@ -11,13 +11,14 @@
#include "nsCOMPtr.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "Intervals.h"
class nsIPrincipal;
namespace mozilla {
// defined in MediaResource.h
class ChannelMediaResource;
class MediaByteRange;
typedef media::IntervalSet<int64_t> MediaByteRangeSet;
class MediaResource;
class ReentrantMonitorAutoEnter;
@ -300,7 +301,7 @@ public:
// cached. Locks the media cache while running, to prevent any ranges
// growing. The stream should be pinned while this runs and while its results
// are used, to ensure no data is evicted.
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges);
nsresult GetCachedRanges(MediaByteRangeSet& aRanges);
// Reads from buffered data only. Will fail if not all data to be read is
// in the cache. Will not mark blocks as read. Can be called from the main

View File

@ -615,6 +615,12 @@ MediaDecoder::Shutdown()
mTimedMetadataListener.Disconnect();
mMetadataLoadedListener.Disconnect();
mFirstFrameLoadedListener.Disconnect();
mOnPlaybackStart.Disconnect();
mOnPlaybackStop.Disconnect();
mOnPlaybackEnded.Disconnect();
mOnDecodeError.Disconnect();
mOnInvalidate.Disconnect();
mOnSeekingStart.Disconnect();
}
// Force any outstanding seek and byterange requests to complete
@ -698,6 +704,19 @@ MediaDecoder::SetStateMachineParameters()
AbstractThread::MainThread(), this, &MediaDecoder::MetadataLoaded);
mFirstFrameLoadedListener = mDecoderStateMachine->FirstFrameLoadedEvent().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::FirstFrameLoaded);
mOnPlaybackStart = mDecoderStateMachine->OnPlaybackStart().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackStarted);
mOnPlaybackStop = mDecoderStateMachine->OnPlaybackStop().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::OnPlaybackStopped);
mOnPlaybackEnded = mDecoderStateMachine->OnPlaybackEnded().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::PlaybackEnded);
mOnDecodeError = mDecoderStateMachine->OnDecodeError().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::DecodeError);
mOnInvalidate = mDecoderStateMachine->OnInvalidate().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::Invalidate);
mOnSeekingStart = mDecoderStateMachine->OnSeekingStart().Connect(
AbstractThread::MainThread(), this, &MediaDecoder::SeekingStarted);
}
void
@ -1641,16 +1660,6 @@ MediaDecoder::IsOmxEnabled()
{
return Preferences::GetBool("media.omx.enabled", false);
}
bool
MediaDecoder::IsOmxAsyncEnabled()
{
#if ANDROID_VERSION >= 16
return Preferences::GetBool("media.omx.async.enabled", false);
#else
return false;
#endif
}
#endif
#ifdef MOZ_ANDROID_OMX

View File

@ -570,26 +570,6 @@ private:
// so recompute it. The monitor must be held.
virtual void UpdatePlaybackRate();
// Used to estimate rates of data passing through the decoder's channel.
// Records activity stopping on the channel.
void DispatchPlaybackStarted() {
RefPtr<MediaDecoder> self = this;
nsCOMPtr<nsIRunnable> r =
NS_NewRunnableFunction([self] () { self->mPlaybackStatistics->Start(); });
AbstractThread::MainThread()->Dispatch(r.forget());
}
// Used to estimate rates of data passing through the decoder's channel.
// Records activity stopping on the channel.
void DispatchPlaybackStopped() {
RefPtr<MediaDecoder> self = this;
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction([self] () {
self->mPlaybackStatistics->Stop();
self->ComputePlaybackRate();
});
AbstractThread::MainThread()->Dispatch(r.forget());
}
// The actual playback rate computation. The monitor must be held.
void ComputePlaybackRate();
@ -701,7 +681,6 @@ private:
#ifdef MOZ_OMX_DECODER
static bool IsOmxEnabled();
static bool IsOmxAsyncEnabled();
#endif
#ifdef MOZ_ANDROID_OMX
@ -821,6 +800,18 @@ private:
MediaEventSource<void>*
DataArrivedEvent() override { return &mDataArrivedEvent; }
// Used to estimate rates of data passing through the decoder's channel.
// Records activity stopping on the channel.
void OnPlaybackStarted() { mPlaybackStatistics->Start(); }
// Used to estimate rates of data passing through the decoder's channel.
// Records activity stopping on the channel.
void OnPlaybackStopped()
{
mPlaybackStatistics->Stop();
ComputePlaybackRate();
}
MediaEventProducer<void> mDataArrivedEvent;
// The state machine object for handling the decoding. It is safe to
@ -942,6 +933,13 @@ protected:
MediaEventListener mMetadataLoadedListener;
MediaEventListener mFirstFrameLoadedListener;
MediaEventListener mOnPlaybackStart;
MediaEventListener mOnPlaybackStop;
MediaEventListener mOnPlaybackEnded;
MediaEventListener mOnDecodeError;
MediaEventListener mOnInvalidate;
MediaEventListener mOnSeekingStart;
protected:
// Whether the state machine is shut down.
Mirror<bool> mStateMachineIsShutdown;

View File

@ -1054,7 +1054,7 @@ void MediaDecoderStateMachine::StopPlayback()
MOZ_ASSERT(OnTaskQueue());
DECODER_LOG("StopPlayback()");
mDecoder->DispatchPlaybackStopped();
mOnPlaybackStop.Notify();
if (IsPlaying()) {
mMediaSink->SetPlaying(false);
@ -1087,7 +1087,7 @@ void MediaDecoderStateMachine::MaybeStartPlayback()
}
DECODER_LOG("MaybeStartPlayback() starting playback");
mDecoder->DispatchPlaybackStarted();
mOnPlaybackStart.Notify();
StartMediaSink();
if (!IsPlaying()) {
@ -1599,12 +1599,7 @@ MediaDecoderStateMachine::InitiateSeek()
StopPlayback();
UpdatePlaybackPositionInternal(mCurrentSeek.mTarget.mTime);
nsCOMPtr<nsIRunnable> startEvent =
NS_NewRunnableMethodWithArg<MediaDecoderEventVisibility>(
mDecoder,
&MediaDecoder::SeekingStarted,
mCurrentSeek.mTarget.mEventVisibility);
AbstractThread::MainThread()->Dispatch(startEvent.forget());
mOnSeekingStart.Notify(mCurrentSeek.mTarget.mEventVisibility);
// Reset our state machine and decoding pipeline before seeking.
Reset();
@ -1897,9 +1892,7 @@ MediaDecoderStateMachine::DecodeError()
// MediaDecoder::DecodeError notifies the owner, and then shuts down the state
// machine.
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::DecodeError);
AbstractThread::MainThread()->Dispatch(event.forget());
mOnDecodeError.Notify();
}
void
@ -2158,9 +2151,7 @@ MediaDecoderStateMachine::SeekCompleted()
if (video) {
mMediaSink->Redraw();
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::Invalidate);
AbstractThread::MainThread()->Dispatch(event.forget());
mOnInvalidate.Notify();
}
}
@ -2413,9 +2404,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
// Ensure readyState is updated before firing the 'ended' event.
UpdateNextFrameStatus();
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackEnded);
AbstractThread::MainThread()->Dispatch(event.forget());
mOnPlaybackEnded.Notify();
mSentPlaybackEndedEvent = true;

View File

@ -233,6 +233,15 @@ public:
MediaDecoderEventVisibility>&
FirstFrameLoadedEvent() { return mFirstFrameLoadedEvent; }
MediaEventSource<void>& OnPlaybackStart() { return mOnPlaybackStart; }
MediaEventSource<void>& OnPlaybackStop() { return mOnPlaybackStop; }
MediaEventSource<void>& OnPlaybackEnded() { return mOnPlaybackEnded; }
MediaEventSource<void>& OnDecodeError() { return mOnDecodeError; }
MediaEventSource<void>& OnInvalidate() { return mOnInvalidate; }
MediaEventSource<MediaDecoderEventVisibility>&
OnSeekingStart() { return mOnSeekingStart; }
// Immutable after construction - may be called on any thread.
bool IsRealTime() const { return mRealTime; }
@ -1201,6 +1210,13 @@ private:
MediaEventProducerExc<nsAutoPtr<MediaInfo>,
MediaDecoderEventVisibility> mFirstFrameLoadedEvent;
MediaEventProducer<void> mOnPlaybackStart;
MediaEventProducer<void> mOnPlaybackStop;
MediaEventProducer<void> mOnPlaybackEnded;
MediaEventProducer<void> mOnDecodeError;
MediaEventProducer<void> mOnInvalidate;
MediaEventProducer<MediaDecoderEventVisibility> mOnSeekingStart;
// True if audio is offloading.
// Playback will not start when audio is offloading.
bool mAudioOffloading;

View File

@ -236,7 +236,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
// Content-Range header tells us otherwise.
bool boundedSeekLimit = true;
// Check response code for byte-range requests (seeking, chunk requests).
if (!mByteRange.IsNull() && (responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
if (!mByteRange.IsEmpty() && (responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
// Parse Content-Range header.
int64_t rangeStart = 0;
int64_t rangeEnd = 0;
@ -273,7 +273,7 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
mOffset = rangeStart;
// We received 'Content-Range', so the server accepts range requests.
acceptsRanges = true;
} else if (((mOffset > 0) || !mByteRange.IsNull())
} else if (((mOffset > 0) || !mByteRange.IsEmpty())
&& (responseStatus == HTTP_OK_CODE)) {
// If we get an OK response but we were seeking, or requesting a byte
// range, then we have to assume that seeking doesn't work. We also need
@ -534,7 +534,7 @@ nsresult ChannelMediaResource::OpenChannel(nsIStreamListener** aStreamListener)
*aStreamListener = nullptr;
}
if (mByteRange.IsNull()) {
if (mByteRange.IsEmpty()) {
// We're not making a byte range request, so set the content length,
// if it's available as an HTTP header. This ensures that MediaResource
// wrapping objects for platform libraries that expect to know
@ -583,14 +583,14 @@ nsresult ChannelMediaResource::SetupChannelHeaders()
// Use |mByteRange| for a specific chunk, or |mOffset| if seeking in a
// complete file download.
nsAutoCString rangeString("bytes=");
if (!mByteRange.IsNull()) {
if (!mByteRange.IsEmpty()) {
rangeString.AppendInt(mByteRange.mStart);
mOffset = mByteRange.mStart;
} else {
rangeString.AppendInt(mOffset);
}
rangeString.Append('-');
if (!mByteRange.IsNull()) {
if (!mByteRange.IsEmpty()) {
rangeString.AppendInt(mByteRange.mEnd);
}
nsresult rv = hc->SetRequestHeader(NS_LITERAL_CSTRING("Range"), rangeString, false);
@ -738,7 +738,7 @@ int64_t ChannelMediaResource::Tell()
return mCacheStream.Tell();
}
nsresult ChannelMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
nsresult ChannelMediaResource::GetCachedRanges(MediaByteRangeSet& aRanges)
{
return mCacheStream.GetCachedRanges(aRanges);
}
@ -1202,7 +1202,7 @@ public:
virtual bool IsSuspended() override { return true; }
virtual bool IsTransportSeekable() override { return true; }
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override;
nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override;
virtual size_t SizeOfExcludingThis(
MallocSizeOf aMallocSizeOf) const override
@ -1274,7 +1274,7 @@ void FileMediaResource::EnsureSizeInitialized()
}
}
nsresult FileMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
nsresult FileMediaResource::GetCachedRanges(MediaByteRangeSet& aRanges)
{
MutexAutoLock lock(mLock);
@ -1282,7 +1282,7 @@ nsresult FileMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
if (mSize == -1) {
return NS_ERROR_FAILURE;
}
aRanges.AppendElement(MediaByteRange(0, mSize));
aRanges += MediaByteRange(0, mSize);
return NS_OK;
}

View File

@ -14,6 +14,7 @@
#include "nsIStreamListener.h"
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "Intervals.h"
#include "MediaCache.h"
#include "MediaData.h"
#include "MediaResourceCallback.h"
@ -128,87 +129,11 @@ private:
bool mIsStarted;
};
// Forward declaration for use in MediaByteRange.
class TimestampedMediaByteRange;
// Represents a section of contiguous media, with a start and end offset.
// Used to denote ranges of data which are cached.
class MediaByteRange {
public:
MediaByteRange() : mStart(0), mEnd(0) {}
MediaByteRange(int64_t aStart, int64_t aEnd)
: mStart(aStart), mEnd(aEnd)
{
NS_ASSERTION(mStart <= mEnd, "Range should end after start!");
}
explicit MediaByteRange(TimestampedMediaByteRange& aByteRange);
bool IsNull() const {
return mStart == 0 && mEnd == 0;
}
bool operator==(const MediaByteRange& aRange) const {
return mStart == aRange.mStart && mEnd == aRange.mEnd;
}
// Clears byte range values.
void Clear() {
mStart = 0;
mEnd = 0;
}
bool Contains(const MediaByteRange& aByteRange) const {
return aByteRange.mStart >= mStart && aByteRange.mEnd <= mEnd;
}
MediaByteRange Extents(const MediaByteRange& aByteRange) const {
if (IsNull()) {
return aByteRange;
}
return MediaByteRange(std::min(mStart, aByteRange.mStart),
std::max(mEnd, aByteRange.mEnd));
}
int64_t Length() const {
return mEnd - mStart;
}
int64_t mStart, mEnd;
};
// Represents a section of contiguous media, with a start and end offset, and
// a timestamp representing the start time.
class TimestampedMediaByteRange : public MediaByteRange {
public:
TimestampedMediaByteRange() : MediaByteRange(), mStartTime(-1) {}
TimestampedMediaByteRange(int64_t aStart, int64_t aEnd, int64_t aStartTime)
: MediaByteRange(aStart, aEnd), mStartTime(aStartTime)
{
NS_ASSERTION(aStartTime >= 0, "Start time should not be negative!");
}
bool IsNull() const {
return MediaByteRange::IsNull() && mStartTime == -1;
}
// Clears byte range values.
void Clear() {
MediaByteRange::Clear();
mStartTime = -1;
}
// In usecs.
int64_t mStartTime;
};
inline MediaByteRange::MediaByteRange(TimestampedMediaByteRange& aByteRange)
: mStart(aByteRange.mStart), mEnd(aByteRange.mEnd)
{
NS_ASSERTION(mStart < mEnd, "Range should end after start!");
}
typedef media::Interval<int64_t> MediaByteRange;
typedef media::IntervalSet<int64_t> MediaByteRangeSet;
class RtspMediaResource;
@ -400,7 +325,7 @@ public:
* in the media cache. Stream should be pinned during call and while
* aRanges is being used.
*/
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) = 0;
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) = 0;
// Ensure that the media cache writes any data held in its partial block.
// Called on the main thread only.
@ -712,7 +637,7 @@ public:
};
friend class Listener;
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override;
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override;
protected:
// These are called on the main thread by Listener.

View File

@ -162,7 +162,7 @@ public:
return false;
}
// dummy
nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override {
nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override {
return NS_ERROR_FAILURE;
}

View File

@ -11,7 +11,6 @@
#include "AudioSinkFilter.h"
#include "SourceFilter.h"
#include "SampleSink.h"
#include "MediaResource.h"
#include "VideoUtils.h"
using namespace mozilla::media;
@ -384,17 +383,19 @@ DirectShowReader::NotifyDataArrivedInternal()
}
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return;
}
IntervalSet<int64_t> intervals;
for (auto& range : byteRanges) {
intervals += mFilter.NotifyDataArrived(range.Length(), range.mStart);
if (byteRanges == mLastCachedRanges) {
return;
}
MediaByteRangeSet intervals = byteRanges - mLastCachedRanges;
mLastCachedRanges = byteRanges;
for (const auto& interval : intervals) {
RefPtr<MediaByteBuffer> bytes =
resource->MediaReadAt(interval.mStart, interval.Length());

View File

@ -9,6 +9,7 @@
#include "windows.h" // HRESULT, DWORD
#include "MediaDecoderReader.h"
#include "MediaResource.h"
#include "mozilla/RefPtr.h"
#include "MP3FrameParser.h"
@ -105,7 +106,7 @@ private:
// Duration of the stream, in microseconds.
int64_t mDuration;
NotifyDataArrivedFilter mFilter;
MediaByteRangeSet mLastCachedRanges;
};
} // namespace mozilla

View File

@ -59,9 +59,6 @@ private:
RefPtr<MP4Demuxer> mParent;
RefPtr<mp4_demuxer::ResourceStream> mStream;
UniquePtr<TrackInfo> mInfo;
// We do not actually need a monitor, however MoofParser (in mIndex) will
// assert if a monitor isn't held.
Monitor mMonitor;
RefPtr<mp4_demuxer::Index> mIndex;
UniquePtr<mp4_demuxer::SampleIterator> mIterator;
Maybe<media::TimeUnit> mNextKeyframeTime;
@ -228,12 +225,10 @@ MP4TrackDemuxer::MP4TrackDemuxer(MP4Demuxer* aParent,
: mParent(aParent)
, mStream(new mp4_demuxer::ResourceStream(mParent->mResource))
, mInfo(Move(aInfo))
, mMonitor("MP4TrackDemuxer")
, mIndex(new mp4_demuxer::Index(indices,
mStream,
mInfo->mTrackId,
mInfo->IsAudio(),
&mMonitor))
mInfo->IsAudio()))
, mIterator(MakeUnique<mp4_demuxer::SampleIterator>(mIndex))
, mNeedReIndex(true)
{
@ -264,12 +259,11 @@ MP4TrackDemuxer::EnsureUpToDateIndex()
return;
}
AutoPinned<MediaResource> resource(mParent->mResource);
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return;
}
MonitorAutoLock mon(mMonitor);
mIndex->UpdateMoofIndex(byteRanges);
mNeedReIndex = false;
}
@ -280,7 +274,6 @@ MP4TrackDemuxer::Seek(media::TimeUnit aTime)
int64_t seekTime = aTime.ToMicroseconds();
mQueuedSample = nullptr;
MonitorAutoLock mon(mMonitor);
mIterator->Seek(seekTime);
// Check what time we actually seeked to.
@ -307,7 +300,6 @@ MP4TrackDemuxer::GetSamples(int32_t aNumSamples)
mQueuedSample = nullptr;
aNumSamples--;
}
MonitorAutoLock mon(mMonitor);
RefPtr<MediaRawData> sample;
while (aNumSamples && (sample = mIterator->GetNext())) {
samples->mSamples.AppendElement(sample);
@ -338,7 +330,6 @@ MP4TrackDemuxer::Reset()
{
mQueuedSample = nullptr;
// TODO, Seek to first frame available, which isn't always 0.
MonitorAutoLock mon(mMonitor);
mIterator->Seek(0);
SetNextKeyFrameTime();
}
@ -386,7 +377,6 @@ MP4TrackDemuxer::GetNextRandomAccessPoint(media::TimeUnit* aTime)
RefPtr<MP4TrackDemuxer::SkipAccessPointPromise>
MP4TrackDemuxer::SkipToNextRandomAccessPoint(media::TimeUnit aTimeThreshold)
{
MonitorAutoLock mon(mMonitor);
mQueuedSample = nullptr;
// Loop until we reach the next keyframe after the threshold.
uint32_t parsed = 0;
@ -413,24 +403,14 @@ MP4TrackDemuxer::GetBuffered()
{
EnsureUpToDateIndex();
AutoPinned<MediaResource> resource(mParent->mResource);
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return media::TimeIntervals();
}
nsTArray<mp4_demuxer::Interval<int64_t>> timeRanges;
MonitorAutoLock mon(mMonitor);
mIndex->ConvertByteRangesToTimeRanges(byteRanges, &timeRanges);
// convert timeRanges.
media::TimeIntervals ranges = media::TimeIntervals();
for (size_t i = 0; i < timeRanges.Length(); i++) {
ranges +=
media::TimeInterval(media::TimeUnit::FromMicroseconds(timeRanges[i].start),
media::TimeUnit::FromMicroseconds(timeRanges[i].end));
}
return ranges;
return mIndex->ConvertByteRangesToTimeRanges(byteRanges);
}
void

View File

@ -885,7 +885,7 @@ media::TimeIntervals GStreamerReader::GetBuffered()
GstFormat format = GST_FORMAT_TIME;
#endif
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> ranges;
MediaByteRangeSet ranges;
resource->GetCachedRanges(ranges);
if (resource->IsDataCachedToEndOfResource(0)) {
@ -1286,17 +1286,18 @@ void GStreamerReader::NotifyDataArrivedInternal()
}
AutoPinned<MediaResource> resource(mResource.GetResource());
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return;
}
IntervalSet<int64_t> intervals;
for (auto& range : byteRanges) {
intervals += mFilter.NotifyDataArrived(range.Length(), range.mStart);
if (byteRanges == mLastCachedRanges) {
return;
}
MediaByteRangeSet intervals = byteRanges - mLastCachedRanges;
mLastCachedRanges = byteRanges;
for (const auto& interval : intervals) {
RefPtr<MediaByteBuffer> bytes =
resource->MediaReadAt(interval.mStart, interval.Length());

View File

@ -256,7 +256,7 @@ private:
int fpsDen;
MediaResourceIndex mResource;
NotifyDataArrivedFilter mFilter;
MediaByteRangeSet mLastCachedRanges;
};
} // namespace mozilla

View File

@ -77,7 +77,7 @@ MockMediaResource::MockClearBufferedRanges()
void
MockMediaResource::MockAddBufferedRange(int64_t aStart, int64_t aEnd)
{
mRanges.AppendElement(MediaByteRange(aStart, aEnd));
mRanges += MediaByteRange(aStart, aEnd);
}
int64_t
@ -107,10 +107,9 @@ MockMediaResource::GetCachedDataEnd(int64_t aOffset)
}
nsresult
MockMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
MockMediaResource::GetCachedRanges(MediaByteRangeSet& aRanges)
{
aRanges.Clear();
aRanges.AppendElements(mRanges);
aRanges = mRanges;
return NS_OK;
}

View File

@ -58,7 +58,7 @@ public:
virtual bool IsTransportSeekable() override { return true; }
virtual nsresult Open(nsIStreamListener** aStreamListener) override;
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges)
override;
virtual const nsCString& GetContentType() const override
{
@ -74,7 +74,7 @@ protected:
private:
FILE* mFileHandle;
const char* mFileName;
nsTArray<MediaByteRange> mRanges;
MediaByteRangeSet mRanges;
Atomic<int> mEntry;
nsCString mContentType;
};

View File

@ -267,7 +267,7 @@ public:
return false;
}
if (mCompleteMediaHeaderRange.IsNull()) {
if (mCompleteMediaHeaderRange.IsEmpty()) {
mCompleteMediaHeaderRange = MediaByteRange(mapping[0].mSyncOffset,
mapping[0].mEndOffset);
}
@ -334,7 +334,6 @@ class MP4ContainerParser : public ContainerParser {
public:
explicit MP4ContainerParser(const nsACString& aType)
: ContainerParser(aType)
, mMonitor("MP4ContainerParser Index Monitor")
{}
bool IsInitSegmentPresent(MediaByteBuffer* aData) override
@ -421,8 +420,6 @@ public:
bool ParseStartAndEndTimestamps(MediaByteBuffer* aData,
int64_t& aStart, int64_t& aEnd) override
{
MonitorAutoLock mon(mMonitor); // We're not actually racing against anything,
// but mParser requires us to hold a monitor.
bool initSegment = IsInitSegmentPresent(aData);
if (initSegment) {
mResource = new SourceBufferResource(NS_LITERAL_CSTRING("video/mp4"));
@ -431,17 +428,16 @@ public:
// consumers of ParseStartAndEndTimestamps to add their timestamp offset
// manually. This allows the ContainerParser to be shared across different
// timestampOffsets.
mParser = new mp4_demuxer::MoofParser(mStream, 0, /* aIsAudio = */ false, &mMonitor);
mParser = new mp4_demuxer::MoofParser(mStream, 0, /* aIsAudio = */ false);
mInitData = new MediaByteBuffer();
} else if (!mStream || !mParser) {
return false;
}
mResource->AppendData(aData);
nsTArray<MediaByteRange> byteRanges;
MediaByteRange mbr =
MediaByteRange(mParser->mOffset, mResource->GetLength());
byteRanges.AppendElement(mbr);
MediaByteRangeSet byteRanges;
byteRanges +=
MediaByteRange(int64_t(mParser->mOffset), mResource->GetLength());
mParser->RebuildFragmentedIndex(byteRanges);
if (initSegment || !HasCompleteInitData()) {
@ -496,7 +492,6 @@ public:
private:
RefPtr<MP4Stream> mStream;
nsAutoPtr<mp4_demuxer::MoofParser> mParser;
Monitor mMonitor;
};
#endif // MOZ_FMP4
@ -610,7 +605,7 @@ public:
return false;
}
mHasInitData = true;
mCompleteInitSegmentRange = MediaByteRange(0, header.header_length);
mCompleteInitSegmentRange = MediaByteRange(0, int64_t(header.header_length));
// Cache raw header in case the caller wants a copy.
mInitData = new MediaByteBuffer(header.header_length);

View File

@ -54,10 +54,10 @@ public:
return RefPtr<nsIPrincipal>(mPrincipal).forget();
}
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
{
UNIMPLEMENTED();
aRanges.AppendElement(MediaByteRange(0, GetLength()));
aRanges += MediaByteRange(0, GetLength());
return NS_OK;
}

View File

@ -70,12 +70,12 @@ public:
virtual bool IsTransportSeekable() override { UNIMPLEMENTED(); return true; }
virtual nsresult Open(nsIStreamListener** aStreamListener) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) override
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
{
ReentrantMonitorAutoEnter mon(mMonitor);
if (mInputBuffer.GetLength()) {
aRanges.AppendElement(MediaByteRange(mInputBuffer.GetOffset(),
mInputBuffer.GetLength()));
aRanges += MediaByteRange(mInputBuffer.GetOffset(),
mInputBuffer.GetLength());
}
return NS_OK;
}

View File

@ -680,7 +680,7 @@ TrackBuffersManager::SegmentParserLoop()
// 5. If the append state equals PARSING_INIT_SEGMENT, then run the
// following steps:
if (mAppendState == AppendState::PARSING_INIT_SEGMENT) {
if (mParser->InitSegmentRange().IsNull()) {
if (mParser->InitSegmentRange().IsEmpty()) {
mInputBuffer = nullptr;
NeedMoreData();
return;
@ -707,7 +707,7 @@ TrackBuffersManager::SegmentParserLoop()
ResetDemuxingState();
return;
}
if (newData || !mParser->MediaSegmentRange().IsNull()) {
if (newData || !mParser->MediaSegmentRange().IsEmpty()) {
if (mPendingInputBuffer) {
// We now have a complete media segment header. We can resume parsing
// the data.
@ -1135,7 +1135,7 @@ TrackBuffersManager::CodedFrameProcessing()
MOZ_ASSERT(mProcessingPromise.IsEmpty());
MediaByteRange mediaRange = mParser->MediaSegmentRange();
if (mediaRange.IsNull()) {
if (mediaRange.IsEmpty()) {
AppendDataToCurrentInputBuffer(mInputBuffer);
mInputBuffer = nullptr;
} else {
@ -1309,7 +1309,7 @@ TrackBuffersManager::CompleteCodedFrameProcessing()
}
// 5. If the input buffer does not contain a complete media segment, then jump to the need more data step below.
if (mParser->MediaSegmentRange().IsNull()) {
if (mParser->MediaSegmentRange().IsEmpty()) {
ResolveProcessing(true, __func__);
return;
}

View File

@ -85,7 +85,7 @@ TEST(ContainerParser, ADTSHeader) {
ASSERT_NE(init, nullptr);
EXPECT_EQ(init->Length(), header->Length());
EXPECT_EQ(parser->InitSegmentRange(), MediaByteRange(0, header->Length()));
EXPECT_EQ(parser->InitSegmentRange(), MediaByteRange(0, int64_t(header->Length())));
// Media segment range should be empty here.
EXPECT_EQ(parser->MediaHeaderRange(), MediaByteRange());
EXPECT_EQ(parser->MediaSegmentRange(), MediaByteRange());

View File

@ -1160,12 +1160,12 @@ nsresult OggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
{
MOZ_ASSERT(OnTaskQueue());
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> cached;
MediaByteRangeSet cached;
nsresult res = resource->GetCachedRanges(cached);
NS_ENSURE_SUCCESS(res, res);
for (uint32_t index = 0; index < cached.Length(); index++) {
MediaByteRange& range = cached[index];
auto& range = cached[index];
int64_t startTime = -1;
int64_t endTime = -1;
if (NS_FAILED(ResetDecode())) {
@ -1841,7 +1841,7 @@ media::TimeIntervals OggReader::GetBuffered()
}
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> ranges;
MediaByteRangeSet ranges;
nsresult res = resource->GetCachedRanges(ranges);
NS_ENSURE_SUCCESS(res, media::TimeIntervals::Invalid());

View File

@ -1,32 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaCodecDecoder.h"
#include "MediaCodecReader.h"
#include "MediaDecoderStateMachine.h"
namespace mozilla {
MediaDecoder*
MediaCodecDecoder::Clone(MediaDecoderOwner* aOwner)
{
return new MediaCodecDecoder(aOwner);
}
MediaOmxCommonReader*
MediaCodecDecoder::CreateReader()
{
return new MediaCodecReader(this);
}
MediaDecoderStateMachine*
MediaCodecDecoder::CreateStateMachineFromReader(MediaOmxCommonReader* aReader)
{
return new MediaDecoderStateMachine(this, aReader);
}
} // namespace mozilla

View File

@ -1,30 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MEDIA_CODEC_DECODER_H
#define MEDIA_CODEC_DECODER_H
#include "MediaOmxCommonDecoder.h"
namespace mozilla {
// MediaDecoder that uses MediaCodecReader.
class MediaCodecDecoder : public MediaOmxCommonDecoder
{
public:
explicit MediaCodecDecoder(MediaDecoderOwner* aOwner)
: MediaOmxCommonDecoder(aOwner) {}
virtual MediaDecoder* Clone(MediaDecoderOwner* aOwner);
virtual MediaOmxCommonReader* CreateReader();
virtual MediaDecoderStateMachine* CreateStateMachineFromReader(MediaOmxCommonReader* aReader);
};
} // namespace mozilla
#endif // MEDIA_CODEC_DECODER_H

File diff suppressed because it is too large Load Diff

View File

@ -1,414 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MEDIA_CODEC_READER_H
#define MEDIA_CODEC_READER_H
#include <utils/threads.h>
#include <base/message_loop.h>
#include <mozilla/CheckedInt.h>
#include <mozilla/Mutex.h>
#include <mozilla/Monitor.h>
#include <nsDataHashtable.h>
#include "MediaData.h"
#include "I420ColorConverterHelper.h"
#include "MediaCodecProxy.h"
#include "MediaOmxCommonReader.h"
#include "mozilla/layers/FenceUtils.h"
#if MOZ_WIDGET_GONK && ANDROID_VERSION >= 17
#include <ui/Fence.h>
#endif
#include "MP3FrameParser.h"
namespace android {
struct ALooper;
struct AMessage;
class MOZ_EXPORT MediaExtractor;
class MOZ_EXPORT MetaData;
class MOZ_EXPORT MediaBuffer;
struct MOZ_EXPORT MediaSource;
class GonkNativeWindow;
} // namespace android
namespace mozilla {
class FlushableTaskQueue;
class MP3FrameParser;
namespace layers {
class TextureClient;
} // namespace mozilla::layers
class MediaCodecReader : public MediaOmxCommonReader
{
typedef mozilla::layers::TextureClient TextureClient;
typedef mozilla::layers::FenceHandle FenceHandle;
typedef MediaOmxCommonReader::MediaResourcePromise MediaResourcePromise;
public:
MediaCodecReader(AbstractMediaDecoder* aDecoder);
virtual ~MediaCodecReader();
// Release media resources they should be released in dormant state
virtual void ReleaseMediaResources();
// Destroys the decoding state. The reader cannot be made usable again.
// This is different from ReleaseMediaResources() as Shutdown() is
// irreversible, whereas ReleaseMediaResources() is reversible.
virtual RefPtr<ShutdownPromise> Shutdown();
protected:
// Used to retrieve some special information that can only be retrieved after
// all contents have been continuously parsed. (ex. total duration of some
// variable-bit-rate MP3 files.)
virtual void NotifyDataArrivedInternal() override;
public:
// Flush the TaskQueue, flush MediaCodec and raise the mDiscontinuity.
virtual nsresult ResetDecode() override;
// Disptach a DecodeVideoFrameTask to decode video data.
virtual RefPtr<VideoDataPromise>
RequestVideoData(bool aSkipToNextKeyframe,
int64_t aTimeThreshold) override;
// Disptach a DecodeAduioDataTask to decode video data.
virtual RefPtr<AudioDataPromise> RequestAudioData() override;
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata() override;
// Moves the decode head to aTime microseconds. aStartTime and aEndTime
// denote the start and end times of the media in usecs, and aCurrentTime
// is the current playback position in microseconds.
virtual RefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) override;
virtual bool IsMediaSeekable() override;
virtual android::sp<android::MediaSource> GetAudioOffloadTrack();
virtual bool IsAsync() const override { return true; }
protected:
struct TrackInputCopier
{
virtual ~TrackInputCopier();
virtual bool Copy(android::MediaBuffer* aSourceBuffer,
android::sp<android::ABuffer> aCodecBuffer);
};
struct Track
{
enum Type
{
kUnknown = 0,
kAudio,
kVideo,
};
Track(Type type=kUnknown);
const Type mType;
// pipeline parameters
android::sp<android::MediaSource> mSource;
bool mSourceIsStopped;
android::sp<android::MediaCodecProxy> mCodec;
android::Vector<android::sp<android::ABuffer> > mInputBuffers;
android::Vector<android::sp<android::ABuffer> > mOutputBuffers;
android::sp<android::GonkNativeWindow> mNativeWindow;
#if ANDROID_VERSION >= 21
android::sp<android::IGraphicBufferProducer> mGraphicBufferProducer;
#endif
// pipeline copier
nsAutoPtr<TrackInputCopier> mInputCopier;
// Protected by mTrackMonitor.
// mDurationUs might be read or updated from multiple threads.
int64_t mDurationUs;
// playback parameters
CheckedUint32 mInputIndex;
bool mInputEndOfStream;
bool mOutputEndOfStream;
int64_t mSeekTimeUs;
bool mFlushed; // meaningless when mSeekTimeUs is invalid.
bool mDiscontinuity;
RefPtr<TaskQueue> mTaskQueue;
Monitor mTrackMonitor;
private:
// Forbidden
Track(const Track &rhs) = delete;
const Track &operator=(const Track&) = delete;
};
// Receive a message from MessageHandler.
// Called on MediaCodecReader::mLooper thread.
void onMessageReceived(const android::sp<android::AMessage>& aMessage);
virtual bool CreateExtractor();
virtual void HandleResourceAllocated();
android::sp<android::MediaExtractor> mExtractor;
MozPromiseHolder<MediaDecoderReader::MetadataPromise> mMetadataPromise;
// XXX Remove after bug 1168008 land.
MozPromiseRequestHolder<MediaResourcePromise> mMediaResourceRequest;
MozPromiseHolder<MediaResourcePromise> mMediaResourcePromise;
MozPromiseRequestHolder<android::MediaCodecProxy::CodecPromise> mVideoCodecRequest;
private:
virtual bool HasAudio() override;
virtual bool HasVideo() override;
class VorbisInputCopier : public TrackInputCopier
{
virtual bool Copy(android::MediaBuffer* aSourceBuffer,
android::sp<android::ABuffer> aCodecBuffer);
};
struct AudioTrack : public Track
{
AudioTrack();
// Protected by mTrackMonitor.
MozPromiseHolder<AudioDataPromise> mAudioPromise;
private:
// Forbidden
AudioTrack(const AudioTrack &rhs) = delete;
const AudioTrack &operator=(const AudioTrack &rhs) = delete;
};
struct VideoTrack : public Track
{
VideoTrack();
int32_t mWidth;
int32_t mHeight;
int32_t mStride;
int32_t mSliceHeight;
int32_t mColorFormat;
int32_t mRotation;
nsIntSize mFrameSize;
nsIntRect mPictureRect;
gfx::IntRect mRelativePictureRect;
// Protected by mTrackMonitor.
MozPromiseHolder<VideoDataPromise> mVideoPromise;
RefPtr<TaskQueue> mReleaseBufferTaskQueue;
private:
// Forbidden
VideoTrack(const VideoTrack &rhs) = delete;
const VideoTrack &operator=(const VideoTrack &rhs) = delete;
};
struct CodecBufferInfo
{
CodecBufferInfo();
android::sp<android::ABuffer> mBuffer;
size_t mIndex;
size_t mOffset;
size_t mSize;
int64_t mTimeUs;
uint32_t mFlags;
};
class SignalObject
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SignalObject)
SignalObject(const char* aName);
void Wait();
void Signal();
protected:
~SignalObject();
private:
// Forbidden
SignalObject() = delete;
SignalObject(const SignalObject &rhs) = delete;
const SignalObject &operator=(const SignalObject &rhs) = delete;
Monitor mMonitor;
bool mSignaled;
};
class ParseCachedDataRunnable : public nsRunnable
{
public:
ParseCachedDataRunnable(RefPtr<MediaCodecReader> aReader,
const char* aBuffer,
uint32_t aLength,
int64_t aOffset,
RefPtr<SignalObject> aSignal);
NS_IMETHOD Run() override;
private:
// Forbidden
ParseCachedDataRunnable() = delete;
ParseCachedDataRunnable(const ParseCachedDataRunnable &rhs) = delete;
const ParseCachedDataRunnable &operator=(const ParseCachedDataRunnable &rhs) = delete;
RefPtr<MediaCodecReader> mReader;
nsAutoArrayPtr<const char> mBuffer;
uint32_t mLength;
int64_t mOffset;
RefPtr<SignalObject> mSignal;
};
friend class ParseCachedDataRunnable;
class ProcessCachedDataTask : public Task
{
public:
ProcessCachedDataTask(RefPtr<MediaCodecReader> aReader,
int64_t aOffset);
void Run() override;
private:
// Forbidden
ProcessCachedDataTask() = delete;
ProcessCachedDataTask(const ProcessCachedDataTask &rhs) = delete;
const ProcessCachedDataTask &operator=(const ProcessCachedDataTask &rhs) = delete;
RefPtr<MediaCodecReader> mReader;
int64_t mOffset;
};
friend class ProcessCachedDataTask;
// Forbidden
MediaCodecReader() = delete;
const MediaCodecReader& operator=(const MediaCodecReader& rhs) = delete;
bool ReallocateExtractorResources();
void ReleaseCriticalResources();
void ReleaseResources();
bool CreateLooper();
void DestroyLooper();
void DestroyExtractor();
bool CreateMediaSources();
void DestroyMediaSources();
RefPtr<MediaResourcePromise> CreateMediaCodecs();
bool CreateMediaCodec(android::sp<android::ALooper>& aLooper,
Track& aTrack,
bool& aIsWaiting);
static bool ConfigureMediaCodec(Track& aTrack);
void DestroyMediaCodecs();
static void DestroyMediaCodec(Track& aTrack);
bool CreateTaskQueues();
void ShutdownTaskQueues();
void DecodeVideoFrameTask(int64_t aTimeThreshold);
void DecodeVideoFrameSync(int64_t aTimeThreshold);
void DecodeAudioDataTask();
void DecodeAudioDataSync();
void DispatchVideoTask(int64_t aTimeThreshold);
void DispatchAudioTask();
inline bool CheckVideoResources() {
return (HasVideo() && mVideoTrack.mSource != nullptr &&
mVideoTrack.mTaskQueue);
}
inline bool CheckAudioResources() {
return (HasAudio() && mAudioTrack.mSource != nullptr &&
mAudioTrack.mTaskQueue);
}
bool TriggerIncrementalParser();
bool UpdateDuration();
bool UpdateAudioInfo();
bool UpdateVideoInfo();
android::status_t FlushCodecData(Track& aTrack);
android::status_t FillCodecInputData(Track& aTrack);
android::status_t GetCodecOutputData(Track& aTrack,
CodecBufferInfo& aBuffer,
int64_t aThreshold,
const TimeStamp& aTimeout);
bool EnsureCodecFormatParsed(Track& aTrack);
uint8_t* GetColorConverterBuffer(int32_t aWidth, int32_t aHeight);
void ClearColorConverterBuffer();
int64_t ProcessCachedData(int64_t aOffset,
RefPtr<SignalObject> aSignal);
bool ParseDataSegment(const char* aBuffer,
uint32_t aLength,
int64_t aOffset);
static void TextureClientRecycleCallback(TextureClient* aClient,
void* aClosure);
void TextureClientRecycleCallback(TextureClient* aClient);
void WaitFenceAndReleaseOutputBuffer();
void ReleaseRecycledTextureClients();
void ReleaseAllTextureClients();
android::sp<android::ALooper> mLooper;
android::sp<android::MetaData> mMetaData;
Mutex mTextureClientIndexesLock;
nsDataHashtable<nsPtrHashKey<TextureClient>, size_t> mTextureClientIndexes;
// media tracks
AudioTrack mAudioTrack;
VideoTrack mVideoTrack;
AudioTrack mAudioOffloadTrack; // only Track::mSource is valid
// color converter
android::I420ColorConverterHelper mColorConverter;
nsAutoArrayPtr<uint8_t> mColorConverterBuffer;
size_t mColorConverterBufferSize;
// incremental parser
Monitor mParserMonitor;
bool mParseDataFromCache;
int64_t mNextParserPosition;
int64_t mParsedDataLength;
nsAutoPtr<MP3FrameParser> mMP3FrameParser;
// mReleaseIndex corresponding to a graphic buffer, and the mReleaseFence is
// the graohic buffer's fence. We must wait for the fence signaled by
// compositor, otherwise we will see the flicker because the HW decoder and
// compositor use the buffer concurrently.
struct ReleaseItem {
ReleaseItem(size_t aIndex, const FenceHandle& aFence)
: mReleaseIndex(aIndex)
, mReleaseFence(aFence) {}
size_t mReleaseIndex;
FenceHandle mReleaseFence;
};
nsTArray<ReleaseItem> mPendingReleaseItems;
NotifyDataArrivedFilter mFilter;
};
} // namespace mozilla
#endif // MEDIA_CODEC_READER_H

View File

@ -464,17 +464,19 @@ void MediaOmxReader::NotifyDataArrivedInternal()
}
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {
return;
}
IntervalSet<int64_t> intervals;
for (auto& range : byteRanges) {
intervals += mFilter.NotifyDataArrived(range.Length(), range.mStart);
if (byteRanges == mLastCachedRanges) {
return;
}
MediaByteRangeSet intervals = byteRanges - mLastCachedRanges;
mLastCachedRanges = byteRanges;
for (const auto& interval : intervals) {
RefPtr<MediaByteBuffer> bytes =
resource->MediaReadAt(interval.mStart, interval.Length());

View File

@ -120,7 +120,7 @@ private:
already_AddRefed<AbstractMediaDecoder> SafeGetDecoder();
NotifyDataArrivedFilter mFilter;
MediaByteRangeSet mLastCachedRanges;
};
} // namespace mozilla

View File

@ -1,115 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "RtspMediaCodecReader.h"
#include "RtspExtractor.h"
#include "RtspMediaResource.h"
#include "RtspMediaCodecDecoder.h"
using namespace android;
namespace mozilla {
RtspMediaCodecReader::RtspMediaCodecReader(AbstractMediaDecoder* aDecoder)
: MediaCodecReader(aDecoder)
{
NS_ASSERTION(mDecoder, "RtspMediaCodecReader mDecoder is null.");
NS_ASSERTION(mDecoder->GetResource(),
"RtspMediaCodecReader mDecoder->GetResource() is null.");
mRtspResource = mDecoder->GetResource()->GetRtspPointer();
MOZ_ASSERT(mRtspResource);
}
RtspMediaCodecReader::~RtspMediaCodecReader() {}
bool
RtspMediaCodecReader::CreateExtractor()
{
if (mExtractor != nullptr) {
return true;
}
mExtractor = new RtspExtractor(mRtspResource);
return mExtractor != nullptr;
}
RefPtr<MediaDecoderReader::SeekPromise>
RtspMediaCodecReader::Seek(int64_t aTime, int64_t aEndTime)
{
// The seek function of Rtsp is time-based, we call the SeekTime function in
// RtspMediaResource. The SeekTime function finally send a seek command to
// Rtsp stream server through network and also clear the buffer data in
// RtspMediaResource.
mRtspResource->SeekTime(aTime);
return MediaCodecReader::Seek(aTime, aEndTime);
}
void
RtspMediaCodecReader::SetIdle()
{
nsIStreamingProtocolController* controller =
mRtspResource->GetMediaStreamController();
if (controller) {
controller->Pause();
}
mRtspResource->SetSuspend(true);
}
void
RtspMediaCodecReader::EnsureActive()
{
// Need to start RTSP streaming OMXCodec decoding.
nsIStreamingProtocolController* controller =
mRtspResource->GetMediaStreamController();
if (controller) {
controller->Play();
}
mRtspResource->SetSuspend(false);
}
RefPtr<MediaDecoderReader::AudioDataPromise>
RtspMediaCodecReader::RequestAudioData()
{
EnsureActive();
return MediaCodecReader::RequestAudioData();
}
RefPtr<MediaDecoderReader::VideoDataPromise>
RtspMediaCodecReader::RequestVideoData(bool aSkipToNextKeyframe,
int64_t aTimeThreshold)
{
EnsureActive();
return MediaCodecReader::RequestVideoData(aSkipToNextKeyframe, aTimeThreshold);
}
RefPtr<MediaDecoderReader::MetadataPromise>
RtspMediaCodecReader::AsyncReadMetadata()
{
mRtspResource->DisablePlayoutDelay();
EnsureActive();
RefPtr<MediaDecoderReader::MetadataPromise> p =
MediaCodecReader::AsyncReadMetadata();
// Send a PAUSE to the RTSP server because the underlying media resource is
// not ready.
SetIdle();
return p;
}
void
RtspMediaCodecReader::HandleResourceAllocated()
{
EnsureActive();
MediaCodecReader::HandleResourceAllocated();
mRtspResource->EnablePlayoutDelay();;
}
} // namespace mozilla

View File

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(RtspMediaCodecReader_h_)
#define RtspMediaCodecReader_h_
#include "MediaCodecReader.h"
namespace mozilla {
class AbstractMediaDecoder;
class RtspMediaResource;
/* RtspMediaCodecReader is a subclass of MediaCodecReader.
* The major reason that RtspMediaCodecReader inherit from MediaCodecReader is
* the same video/audio decoding logic we can reuse.
*/
class RtspMediaCodecReader final : public MediaCodecReader
{
protected:
// Provide a Rtsp extractor.
virtual bool CreateExtractor() override;
// Ensure the play command is sent to Rtsp server.
void EnsureActive();
public:
RtspMediaCodecReader(AbstractMediaDecoder* aDecoder);
virtual ~RtspMediaCodecReader();
// Implement a time-based seek instead of byte-based.
virtual RefPtr<SeekPromise>
Seek(int64_t aTime, int64_t aEndTime) override;
// Override GetBuffered() to do nothing for below reasons:
// 1. Because the Rtsp stream is a/v separated. The buffered data in a/v
// tracks are not consistent with time stamp.
// For example: audio buffer: 1~2s, video buffer: 1.5~2.5s
// 2. Since the Rtsp is a realtime streaming, the buffer we made for
// RtspMediaResource is quite small. The small buffer implies the time ranges
// we returned are not useful for the MediaDecodeStateMachine. Unlike the
// ChannelMediaResource, it has a "cache" that can store the whole streaming
// data so the |GetBuffered| function can retrieve useful time ranges.
virtual media::TimeIntervals GetBuffered() override {
return media::TimeIntervals::Invalid();
}
virtual void SetIdle() override;
// Disptach a DecodeVideoFrameTask to decode video data.
virtual RefPtr<VideoDataPromise>
RequestVideoData(bool aSkipToNextKeyframe,
int64_t aTimeThreshold) override;
// Disptach a DecodeAudioDataTask to decode audio data.
virtual RefPtr<AudioDataPromise> RequestAudioData() override;
virtual RefPtr<MediaDecoderReader::MetadataPromise> AsyncReadMetadata()
override;
virtual void HandleResourceAllocated() override;
private:
// A pointer to RtspMediaResource for calling the Rtsp specific function.
// The lifetime of mRtspResource is controlled by MediaDecoder. MediaDecoder
// holds the MediaDecoderStateMachine and RtspMediaResource.
// And MediaDecoderStateMachine holds this RtspMediaCodecReader.
RtspMediaResource* mRtspResource;
};
} // namespace mozilla
#endif

View File

@ -54,28 +54,15 @@ if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
'RtspOmxDecoder.cpp',
'RtspOmxReader.cpp',
]
if CONFIG['ANDROID_VERSION'] >= '18':
EXPORTS += [
'RtspMediaCodecDecoder.h',
'RtspMediaCodecReader.h',
]
SOURCES += [
'RtspMediaCodecDecoder.cpp',
'RtspMediaCodecReader.cpp',
]
if CONFIG['ANDROID_VERSION'] >= '18':
EXPORTS += [
'I420ColorConverterHelper.h',
'MediaCodecDecoder.h',
'MediaCodecProxy.h',
'MediaCodecReader.h',
]
SOURCES += [
'I420ColorConverterHelper.cpp',
'MediaCodecDecoder.cpp',
'MediaCodecProxy.cpp',
'MediaCodecReader.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -4,16 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MediaDecoderReader.h"
#include "PlatformDecoderModule.h"
#include "nsRect.h"
#include "mozilla/RefPtr.h"
#include "mozilla/CheckedInt.h"
#include "VideoUtils.h"
#include "ImageContainer.h"
#include "MediaDecoderReader.h"
#include "MediaInfo.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/mozalloc.h" // for operator new, and new (fallible)
#include "mozilla/RefPtr.h"
#include "mozilla/TaskQueue.h"
#include "nsRect.h"
#include "PlatformDecoderModule.h"
#include "TimeUnits.h"
#include "VideoUtils.h"
namespace mozilla {
@ -58,6 +59,9 @@ public:
mCreator->Create(media::TimeUnit::FromMicroseconds(mSample->mTime),
media::TimeUnit::FromMicroseconds(mSample->mDuration),
mSample->mOffset);
if (!data) {
return NS_ERROR_OUT_OF_MEMORY;
}
mCallback->Output(data);
return NS_OK;
}
@ -183,7 +187,11 @@ public:
frames.value() > (UINT32_MAX / mChannelCount)) {
return nullptr;
}
auto samples = MakeUnique<AudioDataValue[]>(frames.value() * mChannelCount);
UniquePtr<AudioDataValue[]> samples(
new (fallible) AudioDataValue[frames.value() * mChannelCount]);
if (!samples) {
return nullptr;
}
// Fill the sound buffer with an A4 tone.
static const float pi = 3.14159265f;
static const float noteHz = 440.0f;

View File

@ -383,7 +383,7 @@ void WebMBufferedState::Reset() {
mTimeMapping.Clear();
}
void WebMBufferedState::UpdateIndex(const nsTArray<MediaByteRange>& aRanges, MediaResource* aResource)
void WebMBufferedState::UpdateIndex(const MediaByteRangeSet& aRanges, MediaResource* aResource)
{
for (uint32_t index = 0; index < aRanges.Length(); index++) {
const MediaByteRange& range = aRanges[index];

View File

@ -266,7 +266,7 @@ public:
void NotifyDataArrived(const unsigned char* aBuffer, uint32_t aLength, int64_t aOffset);
void Reset();
void UpdateIndex(const nsTArray<MediaByteRange>& aRanges, MediaResource* aResource);
void UpdateIndex(const MediaByteRangeSet& aRanges, MediaResource* aResource);
bool CalculateBufferedForRange(int64_t aStartOffset, int64_t aEndOffset,
uint64_t* aStartTime, uint64_t* aEndTime);

View File

@ -439,7 +439,7 @@ WebMDemuxer::EnsureUpToDateIndex()
return;
}
AutoPinned<MediaResource> resource(mResource.GetResource());
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv) || !byteRanges.Length()) {
return;
@ -732,7 +732,7 @@ WebMDemuxer::GetBuffered()
media::TimeIntervals buffered;
nsTArray<MediaByteRange> ranges;
MediaByteRangeSet ranges;
nsresult rv = resource->GetCachedRanges(ranges);
if (NS_FAILED(rv)) {
return media::TimeIntervals();

View File

@ -749,7 +749,7 @@ media::TimeIntervals WebMReader::GetBuffered()
// Either we the file is not fully cached, or we couldn't find a duration in
// the WebM bitstream.
nsTArray<MediaByteRange> ranges;
MediaByteRangeSet ranges;
nsresult res = resource->GetCachedRanges(ranges);
NS_ENSURE_SUCCESS(res, media::TimeIntervals::Invalid());
@ -788,7 +788,7 @@ void WebMReader::NotifyDataArrivedInternal()
{
MOZ_ASSERT(OnTaskQueue());
AutoPinned<MediaResource> resource(mDecoder->GetResource());
nsTArray<MediaByteRange> byteRanges;
MediaByteRangeSet byteRanges;
nsresult rv = resource->GetCachedRanges(byteRanges);
if (NS_FAILED(rv)) {

View File

@ -1737,7 +1737,7 @@ nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
RefPtr<PaintedLayer> root = layerManager->CreatePaintedLayer();
if (root) {
nsIntRect dirtyRect = aRegion.GetBounds();
root->SetVisibleRegion(dirtyRect);
root->SetVisibleRegion(LayerIntRegion::FromUnknownRegion(dirtyRect));
layerManager->SetRoot(root);
}

View File

@ -396,9 +396,11 @@ struct RegionParamTraits
}
};
template<>
struct ParamTraits<nsIntRegion>
: RegionParamTraits<nsIntRegion, mozilla::gfx::IntRect, nsIntRegionRectIterator>
template<class Units>
struct ParamTraits<mozilla::gfx::IntRegionTyped<Units>>
: RegionParamTraits<mozilla::gfx::IntRegionTyped<Units>,
mozilla::gfx::IntRectTyped<Units>,
typename mozilla::gfx::IntRegionTyped<Units>::RectIterator>
{};
template<>

View File

@ -343,14 +343,14 @@ public:
return nullptr;
}
nsIntRegion GetVisibleRegion() const
LayerIntRegion GetVisibleRegion() const
{
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetVisibleRegion();
}
nsIntRegion region = mLayer->GetVisibleRegion();
LayerIntRegion region = mLayer->GetVisibleRegion();
region.Transform(mLayer->GetTransform());
return region;
}

View File

@ -76,8 +76,8 @@ static gfxFloat RecoverZDepth(const Matrix4x4& aTransform, const gfxPoint& aPoin
* unsolved without changing our rendering code.
*/
static LayerSortOrder CompareDepth(Layer* aOne, Layer* aTwo) {
gfxRect ourRect = ThebesRect(aOne->GetEffectiveVisibleRegion().GetBounds());
gfxRect otherRect = ThebesRect(aTwo->GetEffectiveVisibleRegion().GetBounds());
gfxRect ourRect = ThebesRect(aOne->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds());
gfxRect otherRect = ThebesRect(aTwo->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds());
MOZ_ASSERT(aOne->GetParent() && aOne->GetParent()->Extend3DContext() &&
aTwo->GetParent() && aTwo->GetParent()->Extend3DContext());

View File

@ -125,7 +125,7 @@ NotifySubdocumentInvalidationRecursive(Layer* aLayer, NotifySubDocInvalidationFu
NotifySubdocumentInvalidationRecursive(child, aCallback);
}
aCallback(container, container->GetVisibleRegion());
aCallback(container, container->GetVisibleRegion().ToUnknownRegion());
}
struct LayerPropertiesBase : public LayerProperties
@ -133,7 +133,7 @@ struct LayerPropertiesBase : public LayerProperties
explicit LayerPropertiesBase(Layer* aLayer)
: mLayer(aLayer)
, mMaskLayer(nullptr)
, mVisibleRegion(aLayer->GetVisibleRegion())
, mVisibleRegion(aLayer->GetVisibleRegion().ToUnknownRegion())
, mInvalidRegion(aLayer->GetInvalidRegion())
, mPostXScale(aLayer->GetPostXScale())
, mPostYScale(aLayer->GetPostYScale())
@ -235,13 +235,13 @@ struct LayerPropertiesBase : public LayerProperties
IntRect NewTransformedBounds()
{
return TransformRect(mLayer->GetVisibleRegion().GetBounds(),
return TransformRect(mLayer->GetVisibleRegion().ToUnknownRegion().GetBounds(),
GetTransformForInvalidation(mLayer));
}
IntRect OldTransformedBounds()
{
return TransformRect(mVisibleRegion.GetBounds(), mTransform);
return TransformRect(mVisibleRegion.ToUnknownRegion().GetBounds(), mTransform);
}
virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback,
@ -347,7 +347,7 @@ struct ContainerLayerProperties : public LayerPropertiesBase
}
if (invalidateChildsCurrentArea) {
aGeometryChanged = true;
AddTransformedRegion(result, child->GetVisibleRegion(),
AddTransformedRegion(result, child->GetVisibleRegion().ToUnknownRegion(),
GetTransformForInvalidation(child));
if (aCallback) {
NotifySubdocumentInvalidationRecursive(child, aCallback);
@ -454,7 +454,7 @@ struct ImageLayerProperties : public LayerPropertiesBase
{
ImageLayer* imageLayer = static_cast<ImageLayer*>(mLayer.get());
if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) {
if (!imageLayer->GetVisibleRegion().ToUnknownRegion().IsEqual(mVisibleRegion)) {
aGeometryChanged = true;
IntRect result = NewTransformedBounds();
result = result.Union(OldTransformedBounds());
@ -596,7 +596,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
} else {
ClearInvalidations(aRoot);
}
IntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(),
IntRect result = TransformRect(aRoot->GetVisibleRegion().ToUnknownRegion().GetBounds(),
aRoot->GetLocalTransform());
result = result.Union(OldTransformedBounds());
if (aGeometryChanged != nullptr) {

View File

@ -619,7 +619,7 @@ Layer::GetEffectiveClipRect()
return GetClipRect();
}
const nsIntRegion&
const LayerIntRegion&
Layer::GetEffectiveVisibleRegion()
{
if (LayerComposite* shadow = AsLayerComposite()) {
@ -1023,7 +1023,7 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult,
}
IntPoint offset;
aResult = GetEffectiveVisibleRegion();
aResult = GetEffectiveVisibleRegion().ToUnknownRegion();
for (Layer* layer = this; layer; layer = layer->GetParent()) {
gfx::Matrix matrix;
if (!layer->GetLocalTransform().Is2D(&matrix) ||
@ -1060,7 +1060,7 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult,
// Retreive the translation from sibling to |layer|. The accumulated
// visible region is currently oriented with |layer|.
IntPoint siblingOffset = RoundedToInt(siblingMatrix.GetTranslation());
nsIntRegion siblingVisibleRegion(sibling->GetEffectiveVisibleRegion());
nsIntRegion siblingVisibleRegion(sibling->GetEffectiveVisibleRegion().ToUnknownRegion());
// Translate the siblings region to |layer|'s origin.
siblingVisibleRegion.MoveBy(-siblingOffset.x, -siblingOffset.y);
// Apply the sibling's clip.
@ -1894,7 +1894,7 @@ Layer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
AppendToString(aStream, mLayerBounds, " [bounds=", "]");
}
if (!mVisibleRegion.IsEmpty()) {
AppendToString(aStream, mVisibleRegion, " [visible=", "]");
AppendToString(aStream, mVisibleRegion.ToUnknownRegion(), " [visible=", "]");
} else {
aStream << " [not visible]";
}
@ -2013,7 +2013,7 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
DumpTransform(s->mutable_transform(), lc->GetShadowTransform());
}
if (!lc->GetShadowVisibleRegion().IsEmpty()) {
DumpRegion(s->mutable_vregion(), lc->GetShadowVisibleRegion());
DumpRegion(s->mutable_vregion(), lc->GetShadowVisibleRegion().ToUnknownRegion());
}
}
// Clip
@ -2025,8 +2025,8 @@ Layer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
DumpTransform(layer->mutable_transform(), mTransform);
}
// Visible region
if (!mVisibleRegion.IsEmpty()) {
DumpRegion(layer->mutable_vregion(), mVisibleRegion);
if (!mVisibleRegion.ToUnknownRegion().IsEmpty()) {
DumpRegion(layer->mutable_vregion(), mVisibleRegion.ToUnknownRegion());
}
// EventRegions
if (!mEventRegions.IsEmpty()) {
@ -2422,7 +2422,7 @@ PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite)
AppendToString(aStream, aLayerComposite->GetShadowTransform(), " [shadow-transform=", "]");
}
if (!aLayerComposite->GetShadowVisibleRegion().IsEmpty()) {
AppendToString(aStream, aLayerComposite->GetShadowVisibleRegion(), " [shadow-visible=", "]");
AppendToString(aStream, aLayerComposite->GetShadowVisibleRegion().ToUnknownRegion(), " [shadow-visible=", "]");
}
}
@ -2435,7 +2435,7 @@ SetAntialiasingFlags(Layer* aLayer, DrawTarget* aTarget)
return;
}
const IntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
const IntRect& bounds = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds();
gfx::Rect transformedBounds = aTarget->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
Float(bounds.width), Float(bounds.height)));
transformedBounds.RoundOut();

View File

@ -845,7 +845,7 @@ public:
* visible region will be ignored. So if a layer draws outside the bounds
* of its visible region, it needs to ensure that what it draws is valid.
*/
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
{
if (!mVisibleRegion.IsEqual(aRegion)) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) VisibleRegion was %s is %s", this,
@ -1261,7 +1261,7 @@ public:
const Maybe<ParentLayerIntRect>& GetClipRect() const { return mClipRect; }
uint32_t GetContentFlags() { return mContentFlags; }
const gfx::IntRect& GetLayerBounds() const { return mLayerBounds; }
const nsIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
const FrameMetrics& GetFrameMetrics(uint32_t aIndex) const;
uint32_t GetFrameMetricsCount() const { return mFrameMetrics.Length(); }
const nsTArray<FrameMetrics>& GetAllFrameMetrics() { return mFrameMetrics; }
@ -1473,7 +1473,7 @@ public:
// values that should be used when drawing this layer to screen,
// accounting for this layer possibly being a shadow.
const Maybe<ParentLayerIntRect>& GetEffectiveClipRect();
const nsIntRegion& GetEffectiveVisibleRegion();
const LayerIntRegion& GetEffectiveVisibleRegion();
bool Extend3DContext() {
return GetContentFlags() & CONTENT_EXTEND_3D_CONTEXT;
@ -1644,7 +1644,7 @@ public:
/**
* Mark the entirety of the layer's visible region as being invalid.
*/
void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion(); }
void SetInvalidRectToVisibleRegion() { mInvalidRegion = GetVisibleRegion().ToUnknownRegion(); }
/**
* Adds to the current invalid rect.
@ -1787,7 +1787,7 @@ protected:
nsTArray<RefPtr<Layer>> mAncestorMaskLayers;
gfx::UserData mUserData;
gfx::IntRect mLayerBounds;
nsIntRegion mVisibleRegion;
LayerIntRegion mVisibleRegion;
nsTArray<FrameMetrics> mFrameMetrics;
EventRegions mEventRegions;
gfx::Matrix4x4 mTransform;
@ -2088,7 +2088,7 @@ public:
RenderTargetIntRect GetIntermediateSurfaceRect()
{
NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface");
return RenderTargetIntRect::FromUnknownRect(mVisibleRegion.GetBounds());
return RenderTargetIntRect::FromUnknownRect(GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds());
}
/**

View File

@ -63,7 +63,7 @@ FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset)
nsIntPoint backgroundOffset(int32_t(backgroundTransform._31), int32_t(backgroundTransform._32));
IntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize());
const nsIntRegion& visibleRegion = l->GetEffectiveVisibleRegion();
const nsIntRegion visibleRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion();
if (!visibleRegion.Intersects(rectInBackground))
continue;
// Since l is present in the background, from here on we either choose l

View File

@ -221,14 +221,14 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
// Also clip to the visible region if we're told to.
if (!aLayer->GetValidRegion().Contains(BufferRect()) ||
(ToData(aLayer)->GetClipToVisibleRegion() &&
!aLayer->GetVisibleRegion().Contains(BufferRect())) ||
IsClippingCheap(aTarget, aLayer->GetEffectiveVisibleRegion())) {
!aLayer->GetVisibleRegion().ToUnknownRegion().Contains(BufferRect())) ||
IsClippingCheap(aTarget, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion())) {
// We don't want to draw invalid stuff, so we need to clip. Might as
// well clip to the smallest area possible --- the visible region.
// Bug 599189 if there is a non-integer-translation transform in aTarget,
// we might sample pixels outside GetEffectiveVisibleRegion(), which is wrong
// and may cause gray lines.
gfxUtils::ClipToRegion(aTarget, aLayer->GetEffectiveVisibleRegion());
gfxUtils::ClipToRegion(aTarget, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion());
clipped = true;
}
@ -454,7 +454,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
while (true) {
mode = aLayer->GetSurfaceMode();
neededRegion = aLayer->GetVisibleRegion();
neededRegion = aLayer->GetVisibleRegion().ToUnknownRegion();
canReuseBuffer &= BufferSizeOkFor(neededRegion.GetBounds().Size());
result.mContentType = layerContentType;

View File

@ -708,7 +708,7 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
// When the mouse is outside the window we still want to handle dragging
// but we won't find an APZC. Fallback to root APZC then.
if (!apzc) {
if (!apzc && mRootNode) {
apzc = mRootNode->GetApzc();
}

View File

@ -2080,7 +2080,7 @@ protected:
if (aScrollId == FrameMetrics::START_SCROLL_ID) {
metrics.SetIsLayersIdRoot(true);
}
IntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
IntRect layerBound = aLayer->GetVisibleRegion().ToUnknownRegion().GetBounds();
metrics.SetCompositionBounds(ParentLayerRect(layerBound.x, layerBound.y,
layerBound.width, layerBound.height));
metrics.SetScrollableRect(aScrollableRect);
@ -2755,7 +2755,7 @@ TEST_F(APZHitTestingTester, Bug1148350) {
}
mcc->AdvanceByMillis(100);
layers[0]->SetVisibleRegion(nsIntRegion(IntRect(0,50,200,150)));
layers[0]->SetVisibleRegion(LayerIntRegion(LayerIntRect(0,50,200,150)));
layers[0]->SetBaseTransform(Matrix4x4::Translation(0, 50, 0));
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);

View File

@ -24,7 +24,7 @@ public:
CopyableCanvasLayer(aLayerManager, static_cast<BasicImplData*>(this))
{ }
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -39,7 +39,7 @@ protected:
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -109,7 +109,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect)
return false;
nsIntPoint offset(int32_t(transform._31), int32_t(transform._32));
gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset);
gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds() + offset);
nsIntRegion covered;
for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) {
@ -121,7 +121,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect)
ThebesMatrix(childTransform).HasNonIntegerTranslation() ||
l->GetEffectiveOpacity() != 1.0)
return false;
nsIntRegion childRegion = l->GetEffectiveVisibleRegion();
nsIntRegion childRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion();
childRegion.MoveBy(int32_t(childTransform._31), int32_t(childTransform._32));
childRegion.And(childRegion, rect);
if (l->GetClipRect()) {

View File

@ -29,7 +29,7 @@ protected:
virtual ~BasicContainerLayer();
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -38,7 +38,7 @@ protected:
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -128,16 +128,6 @@ BasicLayerManager::PushGroupForLayer(gfxContext* aContext, Layer* aLayer, const
Matrix maskTransform;
RefPtr<SourceSurface> maskSurf = GetMaskForLayer(aLayer, &maskTransform);
if (maskSurf) {
// The returned transform will transform the mask to device space on the
// destination. Since the User->Device space transform will be applied
// to the mask by PopGroupAndBlend we need to adjust the transform to
// transform the mask to user space.
Matrix currentTransform = ToMatrix(group.mFinalTarget->CurrentMatrix());
currentTransform.Invert();
maskTransform = maskTransform * currentTransform;
}
if (aLayer->CanUseOpaqueSurface() &&
((didCompleteClip && aRegion.GetNumRects() == 1) ||
!aContext->CurrentMatrix().HasNonIntegerTranslation())) {
@ -182,12 +172,8 @@ BasicLayerManager::PopGroupForLayer(PushedGroup &group)
RefPtr<SourceSurface> src = sourceDT->Snapshot();
if (group.mMaskSurface) {
Point finalOffset = group.mFinalTarget->GetDeviceOffset();
dt->SetTransform(group.mMaskTransform * Matrix::Translation(-finalOffset));
Matrix surfTransform = group.mMaskTransform;
surfTransform.Invert();
dt->MaskSurface(SurfacePattern(src, ExtendMode::CLAMP, surfTransform *
Matrix::Translation(group.mGroupOffset.x, group.mGroupOffset.y)),
dt->SetTransform(group.mMaskTransform * Matrix::Translation(-group.mFinalTarget->GetDeviceOffset()));
dt->MaskSurface(SurfacePattern(src, ExtendMode::CLAMP, Matrix::Translation(group.mGroupOffset.x, group.mGroupOffset.y)),
group.mMaskSurface, Point(0, 0), DrawOptions(group.mOpacity, group.mOperator));
} else {
// For now this is required since our group offset is in device space of the final target,
@ -259,7 +245,7 @@ public:
// Set the opaque rect to match the bounds of the visible region.
void AnnotateOpaqueRect()
{
const nsIntRegion& visibleRegion = mLayer->GetEffectiveVisibleRegion();
const nsIntRegion visibleRegion = mLayer->GetEffectiveVisibleRegion().ToUnknownRegion();
const IntRect& bounds = visibleRegion.GetBounds();
DrawTarget *dt = mTarget->GetDrawTarget();
@ -446,7 +432,7 @@ MarkLayersHidden(Layer* aLayer, const IntRect& aClipRect,
return;
}
nsIntRegion region = aLayer->GetEffectiveVisibleRegion();
nsIntRegion region = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion();
IntRect r = region.GetBounds();
TransformIntRect(r, transform, ToOutsideIntRect);
r.IntersectRect(r, aDirtyRect);
@ -934,7 +920,7 @@ BasicLayerManager::FlushGroup(PaintLayerContext& aPaintContext, bool aNeedsClipT
if (!mTransactionIncomplete) {
if (aNeedsClipToVisibleRegion) {
gfxUtils::ClipToRegion(aPaintContext.mTarget,
aPaintContext.mLayer->GetEffectiveVisibleRegion());
aPaintContext.mLayer->GetEffectiveVisibleRegion().ToUnknownRegion());
}
CompositionOp op = GetEffectiveOperator(aPaintContext.mLayer);
@ -1046,7 +1032,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
paintLayerContext.Apply2DTransform();
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
const nsIntRegion visibleRegion = aLayer->GetEffectiveVisibleRegion().ToUnknownRegion();
// If needsGroup is true, we'll clip to the visible region after we've popped the group
if (needsClipToVisibleRegion && !needsGroup) {
gfxUtils::ClipToRegion(aTarget, visibleRegion);
@ -1067,7 +1053,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
if (is2D) {
if (needsGroup) {
PushedGroup pushedGroup =
PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion());
PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion().ToUnknownRegion());
PaintSelfOrChildren(paintLayerContext, pushedGroup.mGroupTarget);
PopGroupForLayer(pushedGroup);
} else {

View File

@ -62,7 +62,7 @@ protected:
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -63,7 +63,7 @@ BasicPaintedLayer::PaintThebes(gfxContext* aContext,
mValidRegion.SetEmpty();
mContentClient->Clear();
nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion(), aContext);
nsIntRegion toDraw = IntersectWithClip(GetEffectiveVisibleRegion().ToUnknownRegion(), aContext);
RenderTraceInvalidateStart(this, "FFFF00", toDraw.GetBounds());
@ -168,7 +168,7 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
// from RGB to RGBA, because we might need to repaint with
// subpixel AA)
state.mRegionToInvalidate.And(state.mRegionToInvalidate,
GetEffectiveVisibleRegion());
GetEffectiveVisibleRegion().ToUnknownRegion());
SetAntialiasingFlags(this, target);
RenderTraceInvalidateStart(this, "FFFF00", state.mRegionToDraw.GetBounds());

View File

@ -44,7 +44,7 @@ protected:
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
@ -119,7 +119,7 @@ protected:
// here (OR doesn't automatically simplify to the simplest possible
// representation of a region.)
nsIntRegion tmp;
tmp.Or(mVisibleRegion, aExtendedRegionToDraw);
tmp.Or(mVisibleRegion.ToUnknownRegion(), aExtendedRegionToDraw);
mValidRegion.Or(mValidRegion, tmp);
}

View File

@ -44,7 +44,7 @@ protected:
virtual ~ClientCanvasLayer();
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -34,7 +34,7 @@ protected:
}
public:
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
virtual void SetVisibleRegion(const LayerIntRegion& aRegion)
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -71,7 +71,7 @@ public:
}
}
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");

View File

@ -46,7 +46,7 @@ protected:
mImageClientTypeContainer = CompositableType::UNKNOWN;
}
virtual void SetVisibleRegion(const nsIntRegion& aRegion) override
virtual void SetVisibleRegion(const LayerIntRegion& aRegion) override
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");

Some files were not shown because too many files have changed in this diff Show More