Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2014-07-03 14:28:45 +02:00
Родитель 6bed0d46b8 072d7e9cad
Коммит 502a09111b
390 изменённых файлов: 34535 добавлений и 3052 удалений

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="276ce45e78b09c4a4ee643646f691d22804754c1">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

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

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>

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

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "4e3596b10de8df9202d9c0a7f64b7913bdfaaead",
"revision": "c560e79619f1e741655d2e1447cb92469a0419c0",
"repo_path": "/integration/gaia-central"
}

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

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

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="96cdde4b5b5d8d3785b36c3c68cd746aff3005cc"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7f9ec13a30f1b2cc8bdb1a199b7da54b9ab8860f"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6848631d1fe8baf973e3d1257f7b50427295477b"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d7a517f0bde32072f1799e4a47ea34c6d786c287"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="230f11aff069d90d20fc2dc63b48e9ae3d4bdcd1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

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

@ -1,5 +1,5 @@
// Force SafeBrowsing to be initialized for the tests
Services.prefs.setCharPref("urlclassifier.malware_table", "test-malware-simple");
Services.prefs.setCharPref("urlclassifier.phish_table", "test-phish-simple");
Services.prefs.setCharPref("urlclassifier.malwareTable", "test-malware-simple");
Services.prefs.setCharPref("urlclassifier.phishTable", "test-phish-simple");
SafeBrowsing.init();

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

@ -82,7 +82,42 @@ define(MOZ_ARG_HEADER, [# $1])
dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file
AC_DEFUN([MOZ_READ_MOZCONFIG],
[AC_REQUIRE([AC_INIT_BINSH])dnl
# Read in '.mozconfig' script to set the initial options.
# See the mozconfig2configure script for more details.
_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf
. $_AUTOCONF_TOOLS_DIR/mozconfig2configure])
inserted=
dnl Shell is hard, so here is what the following does:
dnl - Reset $@ (command line arguments)
dnl - Add the configure options from mozconfig to $@ one by one
dnl - Add the original command line arguments after that, one by one
dnl
dnl There are several tricks involved:
dnl - It is not possible to preserve the whitespaces in $@ by assigning to
dnl another variable, so the two first steps above need to happen in the first
dnl iteration of the third step.
dnl - We always want the configure options to be added, so the loop must be
dnl iterated at least once, so we add a dummy argument first, and discard it.
dnl - something | while read line ... makes the while run in a subshell, meaning
dnl that anything it does is not propagated to the main shell, so we can't do
dnl set -- foo there. As a consequence, what the while loop reading mach
dnl environment output does is output a set of shell commands for the main shell
dnl to eval.
dnl - Extra care is due when lines from mach environment output contain special
dnl shell characters, so we use ' for quoting and ensure no ' end up in between
dnl the quoting mark unescaped.
dnl Some of the above is directly done in mach environment --format=configure.
failed_eval() {
echo "Failed eval'ing the following:"
$(dirname [$]0)/[$1]/mach environment --format=configure
exit 1
}
set -- dummy "[$]@"
for ac_option
do
if test -z "$inserted"; then
set --
eval "$($(dirname [$]0)/[$1]/mach environment --format=configure)" || failed_eval
inserted=1
else
set -- "[$]@" "$ac_option"
fi
done
])

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

@ -1,76 +0,0 @@
#! /bin/sh
#
# 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/.
# mozconfigfind - Loads options from .mozconfig onto configure's
# command-line. The .mozconfig file is searched for in the
# order:
# If $MOZCONFIG is set, use that.
# If one of $TOPSRCDIR/.mozconfig or $TOPSRCDIR/mozconfig exists, use it.
# If both exist, or if various legacy locations contain a mozconfig, error.
# Otherwise, use the default build options.
#
topsrcdir=$1
abspath() {
if uname -s | grep -q MINGW; then
# We have no way to figure out whether we're in gmake or pymake right
# now. gmake gives us Unix-style paths while pymake gives us Windows-style
# paths, so attempt to handle both.
regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/'
else
regexes='^\/'
fi
for regex in $regexes; do
if echo $1 | grep -q $regex; then
echo $1
return
fi
done
# If we're at this point, we have a relative path
echo `pwd`/$1
}
if [ -n "$MOZCONFIG" ] && ! [ -f "$MOZCONFIG" ]; then
echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" 1>&2
exit 1
fi
if [ -n "$MOZ_MYCONFIG" ]; then
echo "Your environment currently has the MOZ_MYCONFIG variable set to \"$MOZ_MYCONFIG\". MOZ_MYCONFIG is no longer supported. Please use MOZCONFIG instead." 1>&2
exit 1
fi
if [ -z "$MOZCONFIG" ] && [ -f "$topsrcdir/.mozconfig" ] && [ -f "$topsrcdir/mozconfig" ]; then
echo "Both \$topsrcdir/.mozconfig and \$topsrcdir/mozconfig are supported, but you must choose only one. Please remove the other." 1>&2
exit 1
fi
for _config in "$MOZCONFIG" \
"$topsrcdir/.mozconfig" \
"$topsrcdir/mozconfig"
do
if test -f "$_config"; then
abspath $_config
exit 0
fi
done
# We used to support a number of other implicit .mozconfig locations. We now
# detect if we were about to use any of these locations and issue an error if we
# find any.
for _config in "$topsrcdir/mozconfig.sh" \
"$topsrcdir/myconfig.sh" \
"$HOME/.mozconfig" \
"$HOME/.mozconfig.sh" \
"$HOME/.mozmyconfig.sh"
do
if test -f "$_config"; then
echo "You currently have a mozconfig at \"$_config\". This implicit location is no longer supported. Please move it to $topsrcdir/.mozconfig or specify it explicitly via \$MOZCONFIG." 1>&2
exit 1
fi
done

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

@ -1,76 +0,0 @@
#! /bin/sh
#
# 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/.
# mozconfig2client-mk - Translates .mozconfig into options for client.mk.
# Prints defines to stdout.
#
# See mozconfig2configure for more details
print_header() {
cat <<EOF
# gmake
# This file is automatically generated for client.mk.
# Do not edit. Edit $FOUND_MOZCONFIG instead.
EOF
}
ac_add_options() {
for _opt
do
case "$_opt" in
--target=*)
echo $_opt | sed s/--target/CONFIG_GUESS/
;;
*)
echo "# $_opt is used by configure (not client.mk)"
;;
esac
done
}
ac_add_app_options() {
echo "# $* is used by configure (not client.mk)"
}
mk_add_options() {
for _opt
do
# Escape shell characters, space, tab, dollar, quote, backslash,
# and substitute '@<word>@' with '$(<word>)'.
_opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
echo $_opt;
done
}
# Main
#--------------------------------------------------
scriptdir=`dirname $0`
topsrcdir=$1
# If the path changes, configure should be rerun
echo "# PATH=$PATH"
# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
isfoundset=${FOUND_MOZCONFIG+yes}
if [ -z $isfoundset ]; then
FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir`
if [ $? -ne 0 ]; then
echo '$(error Fix above errors before continuing.)'
else
isfoundset=yes
fi
fi
if [ -n $isfoundset ]; then
if [ "$FOUND_MOZCONFIG" ]
then
print_header
. "$FOUND_MOZCONFIG"
echo "FOUND_MOZCONFIG := $FOUND_MOZCONFIG"
fi
fi

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

@ -1,103 +0,0 @@
#! /bin/sh
#
# 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/.
# mozconfig2configure - Loads options from .mozconfig onto configure's
# command-line. See mozconfig-find for how the config file is
# found
#
# The options from .mozconfig are inserted into the command-line
# before the real command-line options. This way the real options
# will override any .mozconfig options.
#
# .mozconfig is a shell script. To add an option to configure's
# command-line use the pre-defined function, ac_add_options,
#
# ac_add_options <configure-option> [<configure-option> ... ]
#
# For example,
#
# ac_add_options --with-pthreads --enable-debug
#
# ac_add_options can be called multiple times in .mozconfig.
# Each call adds more options to configure's command-line.
# Note: $_AUTOCONF_TOOLS_DIR must be defined in the script that includes this.
ac_add_options() {
for _opt
do
# Escape shell characters, space, tab, dollar, quote, backslash, parentheses.
_opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'`
_opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'`
# Avoid adding duplicates
case "$ac_options" in
# Note that all options in $ac_options are enclosed in quotes,
# so there will always be a last character to match [^-A-Za-z0-9_]
*"\"$_opt[^-A-Za-z0-9_]"* ) ;;
* ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;;
esac
done
}
ac_add_app_options() {
APP=$1
shift;
if [ "$APP" = "$MOZ_BUILD_APP" ]; then
ac_add_options "$*";
fi
}
mk_add_options() {
# These options are for client.mk
# configure can safely ignore them.
:
}
ac_echo_options() {
echo "Adding configure options from $FOUND_MOZCONFIG:"
eval "set -- $mozconfig_ac_options"
for _opt
do
echo " $_opt"
done
}
# Main
#--------------------------------------------------
topsrcdir=$(cd `dirname $0`; pwd -W 2>/dev/null || pwd)
ac_options=
mozconfig_ac_options=
# Save the real command-line options
for _opt
do
# Escape shell characters, space, tab, dollar, quote, backslash.
_opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'`
ac_options="$ac_options \"$_opt\""
done
# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
isfoundset=${FOUND_MOZCONFIG+yes}
if [ -z $isfoundset ]; then
FOUND_MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir`
if [ $? -ne 0 ]; then
echo "Fix above errors before continuing." 1>&2
exit 1
fi
fi
if [ "$FOUND_MOZCONFIG" ]; then
. "$FOUND_MOZCONFIG"
fi
export FOUND_MOZCONFIG
if [ "$mozconfig_ac_options" ]; then
ac_echo_options 1>&2
fi
eval "set -- $mozconfig_ac_options $ac_options"

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

@ -145,42 +145,47 @@ def bootstrap(topsrcdir, mozilla_dir=None):
# case. For default behavior, we educate users and give them an opportunity
# to react. We always exit after creating the directory because users don't
# like surprises.
state_user_dir = os.path.expanduser('~/.mozbuild')
state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
if state_env_dir:
if not os.path.exists(state_env_dir):
print('Creating global state directory from environment variable: %s'
% state_env_dir)
os.makedirs(state_env_dir, mode=0o770)
print('Please re-run mach.')
sys.exit(1)
state_dir = state_env_dir
else:
if not os.path.exists(state_user_dir):
print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
try:
for i in range(20, -1, -1):
time.sleep(1)
sys.stdout.write('%d ' % i)
sys.stdout.flush()
except KeyboardInterrupt:
sys.exit(1)
print('\nCreating default state directory: %s' % state_user_dir)
os.mkdir(state_user_dir)
print('Please re-run mach.')
sys.exit(1)
state_dir = state_user_dir
try:
import mach.main
except ImportError:
sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
import mach.main
def populate_context(context):
context.state_dir = state_dir
context.topdir = topsrcdir
def populate_context(context, key=None):
if key is None:
return
if key == 'state_dir':
state_user_dir = os.path.expanduser('~/.mozbuild')
state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None)
if state_env_dir:
if not os.path.exists(state_env_dir):
print('Creating global state directory from environment variable: %s'
% state_env_dir)
os.makedirs(state_env_dir, mode=0o770)
print('Please re-run mach.')
sys.exit(1)
state_dir = state_env_dir
else:
if not os.path.exists(state_user_dir):
print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir))
try:
for i in range(20, -1, -1):
time.sleep(1)
sys.stdout.write('%d ' % i)
sys.stdout.flush()
except KeyboardInterrupt:
sys.exit(1)
print('\nCreating default state directory: %s' % state_user_dir)
os.mkdir(state_user_dir)
print('Please re-run mach.')
sys.exit(1)
state_dir = state_user_dir
return state_dir
if key == 'topdir':
return topsrcdir
raise AttributeError(key)
mach = mach.main.Mach(os.getcwd())
mach.populate_context_handler = populate_context

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

@ -6,6 +6,7 @@
#include "nsNullPrincipalURI.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "nsNetUtil.h"
@ -20,7 +21,7 @@ nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec)
int32_t dividerPosition = aSpec.FindChar(':');
NS_ASSERTION(dividerPosition != -1, "Malformed URI!");
int32_t n = aSpec.Left(mScheme, dividerPosition);
mozilla::DebugOnly<int32_t> n = aSpec.Left(mScheme, dividerPosition);
NS_ASSERTION(n == dividerPosition, "Storing the scheme failed!");
int32_t count = aSpec.Length() - dividerPosition - 1;

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

@ -71,8 +71,6 @@
using namespace mozilla;
using namespace mozilla::dom;
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
nsIIOService *nsScriptSecurityManager::sIOService = nullptr;
nsIStringBundle *nsScriptSecurityManager::sStrBundle = nullptr;
JSRuntime *nsScriptSecurityManager::sRuntime = 0;

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

@ -50,7 +50,6 @@ endif
ifndef TOPSRCDIR
ifeq (,$(wildcard client.mk))
TOPSRCDIR := $(patsubst %/,%,$(dir $(MAKEFILE_LIST)))
MOZ_OBJDIR = .
else
TOPSRCDIR := $(CWD)
endif
@ -99,8 +98,6 @@ endif
# See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
define CR
@ -112,7 +109,8 @@ endef
# followed by a space (since sed doesn't remove newlines), except on the
# last line, so replace both '|| ' and '||'.
# Also, make MOZ_PGO available to mozconfig when passed on make command line.
MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) | sed 's/$$/||/')))
# Likewise for MOZ_CURRENT_PROJECT.
MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell $(addprefix MOZ_CURRENT_PROJECT=,$(MOZ_CURRENT_PROJECT)) MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/mach environment --format=client.mk | sed 's/$$/||/')))
$(eval $(MOZCONFIG_CONTENT))
export FOUND_MOZCONFIG
@ -143,28 +141,18 @@ ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
endif
ifndef MOZ_OBJDIR
MOZ_OBJDIR = obj-$(CONFIG_GUESS)
endif
ifdef MOZ_BUILD_PROJECTS
ifdef MOZ_CURRENT_PROJECT
OBJDIR = $(MOZ_OBJDIR)/$(MOZ_CURRENT_PROJECT)
MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT)
export MOZ_CURRENT_PROJECT
else
OBJDIR = $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.)
endif
else # MOZ_BUILD_PROJECTS
OBJDIR = $(MOZ_OBJDIR)
MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
endif # MOZ_BUILD_PROJECTS
MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
# 'configure' scripts generated by autoconf.
CONFIGURES := $(TOPSRCDIR)/configure
CONFIGURES += $(TOPSRCDIR)/js/src/configure
@ -196,7 +184,7 @@ WANT_MOZCONFIG_MK = 1
endif
ifdef WANT_MOZCONFIG_MK
# For now, only output "export" lines from mozconfig2client-mk output.
# For now, only output "export" lines from mach environment --format=client.mk output.
MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
$(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
@ -229,17 +217,11 @@ everything: clean build
# This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this
# is usable in multi-pass builds, where you might not have a runnable
# application until all the build passes and postflight scripts have run.
ifdef MOZ_OBJDIR
PGO_OBJDIR = $(MOZ_OBJDIR)
else
PGO_OBJDIR := $(TOPSRCDIR)
endif
profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1
$(MAKE) -C $(PGO_OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
rm -f ${PGO_OBJDIR}/jarlog/en-US.log
MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(PGO_OBJDIR) pgo-profile-run
$(MAKE) -C $(OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT=
rm -f $(OBJDIR)/jarlog/en-US.log
MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(OBJDIR) pgo-profile-run
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
@ -320,6 +302,7 @@ CONFIG_STATUS_DEPS := \
$(TOPSRCDIR)/build/virtualenv_packages.txt \
$(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \
$(TOPSRCDIR)/testing/mozbase/packages.txt \
$(OBJDIR)/.mozconfig.json \
$(NULL)
CONFIGURE_ENV_ARGS += \
@ -347,8 +330,13 @@ configure-preqs = \
$(call mkdir_deps,$(OBJDIR)) \
$(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
save-mozconfig \
$(OBJDIR)/.mozconfig.json \
$(NULL)
CREATE_MOZCONFIG_JSON := $(shell $(TOPSRCDIR)/mach environment --format=json -o $(OBJDIR)/.mozconfig.json)
$(OBJDIR)/.mozconfig.json: $(call mkdir_deps,$(OBJDIR))
@$(TOPSRCDIR)/mach environment --format=json -o $@
save-mozconfig: $(FOUND_MOZCONFIG)
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
@ -367,7 +355,7 @@ $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS)
else
$(OBJDIR)/Makefile: $(CONFIG_STATUS_DEPS)
endif
@$(MAKE) -f $(TOPSRCDIR)/client.mk configure
@$(MAKE) -f $(TOPSRCDIR)/client.mk configure CREATE_MOZCONFIG_JSON=
ifneq (,$(CONFIG_STATUS))
$(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in

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

@ -971,13 +971,9 @@ nsCSPContext::AsyncReportViolation(nsISupports* aBlockedContentSource,
* In order to determine the URI of the parent document (one causing the load
* of this protected document), this function obtains the docShellTreeItem,
* then walks up the hierarchy until it finds a privileged (chrome) tree item.
* Getting the parent's URI looks like this in pseudocode:
* Getting the a tree item's URI looks like this in pseudocode:
*
* nsIDocShell->QI(nsIInterfaceRequestor)
* ->GI(nsIDocShellTreeItem)
* ->QI(nsIInterfaceRequestor)
* ->GI(nsIWebNavigation)
* ->GetCurrentURI();
* nsIDocShellTreeItem->GetDocument()->GetDocumentURI();
*
* aDocShell is the docShell for the protected document.
*/
@ -999,21 +995,18 @@ nsCSPContext::PermitsAncestry(nsIDocShell* aDocShell, bool* outPermitsAncestry)
nsCOMPtr<nsIInterfaceRequestor> ir(do_QueryInterface(aDocShell));
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_GetInterface(ir));
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
nsCOMPtr<nsIWebNavigation> webNav;
nsCOMPtr<nsIURI> currentURI;
nsCOMPtr<nsIURI> uriClone;
// iterate through each docShell parent item
while (NS_SUCCEEDED(treeItem->GetParent(getter_AddRefs(parentTreeItem))) &&
parentTreeItem != nullptr) {
ir = do_QueryInterface(parentTreeItem);
NS_ASSERTION(ir, "Could not QI docShellTreeItem to nsIInterfaceRequestor");
webNav = do_GetInterface(ir);
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
nsIDocument* doc = parentTreeItem->GetDocument();
NS_ASSERTION(doc, "Could not get nsIDocument from nsIDocShellTreeItem in nsCSPContext::PermitsAncestry");
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
rv = webNav->GetCurrentURI(getter_AddRefs(currentURI));
NS_ENSURE_SUCCESS(rv, rv);
currentURI = doc->GetDocumentURI();
if (currentURI) {
// stop when reaching chrome
@ -1025,8 +1018,11 @@ nsCSPContext::PermitsAncestry(nsIDocShell* aDocShell, bool* outPermitsAncestry)
// delete the userpass from the URI.
rv = currentURI->CloneIgnoringRef(getter_AddRefs(uriClone));
NS_ENSURE_SUCCESS(rv, rv);
rv = uriClone->SetUserPass(EmptyCString());
NS_ENSURE_SUCCESS(rv, rv);
// We don't care if this succeeds, just want to delete a userpass if
// there was one.
uriClone->SetUserPass(EmptyCString());
#ifdef PR_LOGGING
{
nsAutoCString spec;

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

@ -2826,9 +2826,8 @@ nsDocument::InitCSP(nsIChannel* aChannel)
// PermitsAncestry sends violation reports when necessary
rv = csp->PermitsAncestry(docShell, &safeAncestry);
NS_ENSURE_SUCCESS(rv, rv);
if (!safeAncestry) {
if (NS_FAILED(rv) || !safeAncestry) {
#ifdef PR_LOGGING
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
("CSP doesn't like frame's ancestry, not loading."));

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

@ -1974,6 +1974,7 @@ GK_ATOM(durationchange, "durationchange")
GK_ATOM(volumechange, "volumechange")
GK_ATOM(ondataavailable, "ondataavailable")
GK_ATOM(onwarning, "onwarning")
GK_ATOM(onstart, "onstart")
GK_ATOM(onstop, "onstop")
#ifdef MOZ_GAMEPAD
GK_ATOM(ongamepadbuttondown, "ongamepadbuttondown")
@ -2261,7 +2262,6 @@ GK_ATOM(onspeechstart, "onspeechstart")
GK_ATOM(onspeechend, "onspeechend")
GK_ATOM(onresult, "onresult")
GK_ATOM(onnomatch, "onnomatch")
GK_ATOM(onstart, "onstart")
GK_ATOM(onresume, "onresume")
GK_ATOM(onmark, "onmark")
GK_ATOM(onboundary, "onboundary")

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

@ -27,7 +27,29 @@ var framesThatShouldLoad = {
//abb2_block: -1, /* innermost frame denies a */
};
var expectedViolationsLeft = 6;
// we normally expect _6_ violations (6 test cases that cause blocks), but many
// of the cases cause violations due to the // origin of the test harness (same
// as 'a'). When the violation is cross-origin, the URI passed to the observers
// is null (see bug 846978). This means we can't tell if it's part of the test
// case or if it is the test harness frame (also origin 'a').
// As a result, we'll get an extra violation for the following cases:
// ab_block "frame-ancestors 'none'" (outer frame and test harness)
// aba2_block "frame-ancestors b" (outer frame and test harness)
// abb2_block "frame-ancestors b" (outer frame and test harness)
//
// and while we can detect the test harness check for this one case since
// the violations are not cross-origin and we get the URI:
// aba2_block "frame-ancestors b" (outer frame and test harness)
//
// we can't for these other ones:
// ab_block "frame-ancestors 'none'" (outer frame and test harness)
// abb2_block "frame-ancestors b" (outer frame and test harness)
//
// so that results in 2 extra violation notifications due to the test harness.
// expected = 6, total = 8
//
// Number of tests that pass for this file should be 12 (8 violations 4 loads)
var expectedViolationsLeft = 8;
// This is used to watch the blocked data bounce off CSP and allowed data
// get sent out to the wire.
@ -36,22 +58,31 @@ function examiner() {
}
examiner.prototype = {
observe: function(subject, topic, data) {
// subject should be an nsURI, and should be either allowed or blocked.
if (!SpecialPowers.can_QI(subject))
// subject should be an nsURI... though could be null since CSP
// prohibits cross-origin URI reporting during frame ancestors checks.
if (subject && !SpecialPowers.can_QI(subject))
return;
var asciiSpec = subject;
try {
asciiSpec = SpecialPowers.getPrivilegedProps(
SpecialPowers.do_QueryInterface(subject, "nsIURI"),
"asciiSpec");
// skip checks on the test harness -- can't do this skipping for
// cross-origin blocking since the observer doesn't get the URI. This
// can cause this test to over-succeed (but only in specific cases).
if (asciiSpec.contains("test_CSP_frameancestors.html")) {
return;
}
} catch (ex) {
// was not an nsIURI, so it was probably a cross-origin report.
}
if (topic === "csp-on-violate-policy") {
//these were blocked... record that they were blocked
var asciiSpec = subject;
// Except CSP prohibits cross-origin URI reporting during frame ancestors
// checks so this URI could be null.
try {
asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec");
} catch (ex) {
// was not an nsIURI, so it was probably a cross-origin report.
}
window.frameBlocked(asciiSpec, data);
}
},

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

@ -942,7 +942,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream,
if (end >= aTo) {
toWrite = ticksNeeded;
} else {
toWrite = TimeToTicksRoundDown(mSampleRate, end - aFrom);
toWrite = TimeToTicksRoundDown(mSampleRate, end - t);
}
ticksNeeded -= toWrite;

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

@ -13,7 +13,7 @@
#include "mozilla/WindowsVersion.h"
#endif
#ifdef MOZ_FFMPEG
#include "FFmpegDecoderModule.h"
#include "FFmpegRuntimeLinker.h"
#endif
namespace mozilla {
@ -79,7 +79,7 @@ IsFFmpegAvailable()
// If we can link to FFmpeg, then we can almost certainly play H264 and AAC
// with it.
return FFmpegDecoderModule::Link();
return FFmpegRuntimeLinker::Link();
#endif
}

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

@ -9,7 +9,7 @@
#include "WMFDecoderModule.h"
#endif
#ifdef MOZ_FFMPEG
#include "FFmpegDecoderModule.h"
#include "FFmpegRuntimeLinker.h"
#endif
#include "mozilla/Preferences.h"
@ -56,7 +56,7 @@ PlatformDecoderModule::Create()
#endif
#ifdef MOZ_FFMPEG
if (sFFmpegDecoderEnabled) {
return new FFmpegDecoderModule();
return FFmpegRuntimeLinker::CreateDecoderModule();
}
#endif
return nullptr;

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

@ -16,17 +16,16 @@ typedef mp4_demuxer::MP4Sample MP4Sample;
namespace mozilla
{
FFmpegAACDecoder::FFmpegAACDecoder(
FFmpegAACDecoder<LIBAV_VER>::FFmpegAACDecoder(
MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
const mp4_demuxer::AudioDecoderConfig &aConfig)
: FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_AAC)
, mCallback(aCallback)
const mp4_demuxer::AudioDecoderConfig& aConfig)
: FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_AAC), mCallback(aCallback)
{
MOZ_COUNT_CTOR(FFmpegAACDecoder);
}
nsresult
FFmpegAACDecoder::Init()
FFmpegAACDecoder<LIBAV_VER>::Init()
{
nsresult rv = FFmpegDataDecoder::Init();
NS_ENSURE_SUCCESS(rv, rv);
@ -64,7 +63,7 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumSamples)
}
void
FFmpegAACDecoder::DecodePacket(MP4Sample* aSample)
FFmpegAACDecoder<LIBAV_VER>::DecodePacket(MP4Sample* aSample)
{
nsAutoPtr<AVFrame> frame(avcodec_alloc_frame());
avcodec_get_frame_defaults(frame);
@ -106,7 +105,7 @@ FFmpegAACDecoder::DecodePacket(MP4Sample* aSample)
}
nsresult
FFmpegAACDecoder::Input(MP4Sample* aSample)
FFmpegAACDecoder<LIBAV_VER>::Input(MP4Sample* aSample)
{
mTaskQueue->Dispatch(NS_NewRunnableMethodWithArg<nsAutoPtr<MP4Sample> >(
this, &FFmpegAACDecoder::DecodePacket, nsAutoPtr<MP4Sample>(aSample)));
@ -115,13 +114,14 @@ FFmpegAACDecoder::Input(MP4Sample* aSample)
}
nsresult
FFmpegAACDecoder::Drain()
FFmpegAACDecoder<LIBAV_VER>::Drain()
{
// AAC is never delayed; nothing to do here.
return NS_OK;
}
FFmpegAACDecoder::~FFmpegAACDecoder() {
FFmpegAACDecoder<LIBAV_VER>::~FFmpegAACDecoder()
{
MOZ_COUNT_DTOR(FFmpegAACDecoder);
}

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

@ -13,12 +13,17 @@
namespace mozilla
{
class FFmpegAACDecoder : public FFmpegDataDecoder
template <int V> class FFmpegAACDecoder
{
};
template <>
class FFmpegAACDecoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
{
public:
FFmpegAACDecoder(MediaTaskQueue* aTaskQueue,
MediaDataDecoderCallback* aCallback,
const mp4_demuxer::AudioDecoderConfig &aConfig);
const mp4_demuxer::AudioDecoderConfig& aConfig);
virtual ~FFmpegAACDecoder();
virtual nsresult Init() MOZ_OVERRIDE;

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

@ -9,23 +9,25 @@
#include "MediaTaskQueue.h"
#include "mp4_demuxer/mp4_demuxer.h"
#include "FFmpegRuntimeLinker.h"
#include "FFmpegLibs.h"
#include "FFmpegLog.h"
#include "FFmpegDataDecoder.h"
#include "prsystem.h"
namespace mozilla
{
bool FFmpegDataDecoder::sFFmpegInitDone = false;
bool FFmpegDataDecoder<LIBAV_VER>::sFFmpegInitDone = false;
FFmpegDataDecoder::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue,
AVCodecID aCodecID)
FFmpegDataDecoder<LIBAV_VER>::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue,
AVCodecID aCodecID)
: mTaskQueue(aTaskQueue), mCodecID(aCodecID)
{
MOZ_COUNT_CTOR(FFmpegDataDecoder);
}
FFmpegDataDecoder::~FFmpegDataDecoder() {
FFmpegDataDecoder<LIBAV_VER>::~FFmpegDataDecoder()
{
MOZ_COUNT_DTOR(FFmpegDataDecoder);
}
@ -51,15 +53,10 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const PixelFormat* aFormats)
}
nsresult
FFmpegDataDecoder::Init()
FFmpegDataDecoder<LIBAV_VER>::Init()
{
FFMPEG_LOG("Initialising FFmpeg decoder.");
if (!FFmpegRuntimeLinker::Link()) {
NS_WARNING("Failed to link FFmpeg shared libraries.");
return NS_ERROR_FAILURE;
}
if (!sFFmpegInitDone) {
av_register_all();
#ifdef DEBUG
@ -87,6 +84,10 @@ FFmpegDataDecoder::Init()
// FFmpeg will call back to this to negotiate a video pixel format.
mCodecContext.get_format = ChoosePixelFormat;
mCodecContext.thread_count = PR_GetNumberOfProcessors();
mCodecContext.thread_type = FF_THREAD_FRAME;
mCodecContext.thread_safe_callbacks = false;
mCodecContext.extradata = mExtraData.begin();
mCodecContext.extradata_size = mExtraData.length();
@ -108,7 +109,7 @@ FFmpegDataDecoder::Init()
}
nsresult
FFmpegDataDecoder::Flush()
FFmpegDataDecoder<LIBAV_VER>::Flush()
{
mTaskQueue->Flush();
avcodec_flush_buffers(&mCodecContext);
@ -116,7 +117,7 @@ FFmpegDataDecoder::Flush()
}
nsresult
FFmpegDataDecoder::Shutdown()
FFmpegDataDecoder<LIBAV_VER>::Shutdown()
{
if (sFFmpegInitDone) {
avcodec_close(&mCodecContext);

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

@ -7,16 +7,21 @@
#ifndef __FFmpegDataDecoder_h__
#define __FFmpegDataDecoder_h__
#include "FFmpegDecoderModule.h"
#include "FFmpegRuntimeLinker.h"
#include "FFmpegCompat.h"
#include "PlatformDecoderModule.h"
#include "FFmpegLibs.h"
#include "mozilla/Vector.h"
namespace mozilla
{
template <int V>
class FFmpegDataDecoder : public MediaDataDecoder
{
};
template <>
class FFmpegDataDecoder<LIBAV_VER> : public MediaDataDecoder
{
public:
FFmpegDataDecoder(MediaTaskQueue* aTaskQueue, AVCodecID aCodecID);
virtual ~FFmpegDataDecoder();

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

@ -4,78 +4,10 @@
* 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 "FFmpegRuntimeLinker.h"
#include "FFmpegAACDecoder.h"
#include "FFmpegH264Decoder.h"
#include "FFmpegDecoderModule.h"
namespace mozilla
{
namespace mozilla {
PRLogModuleInfo* GetFFmpegDecoderLog()
{
static PRLogModuleInfo* sFFmpegDecoderLog = nullptr;
if (!sFFmpegDecoderLog) {
sFFmpegDecoderLog = PR_NewLogModule("FFmpegDecoderModule");
}
return sFFmpegDecoderLog;
}
bool FFmpegDecoderModule::sFFmpegLinkDone = false;
FFmpegDecoderModule::FFmpegDecoderModule()
{
MOZ_COUNT_CTOR(FFmpegDecoderModule);
}
FFmpegDecoderModule::~FFmpegDecoderModule() {
MOZ_COUNT_DTOR(FFmpegDecoderModule);
}
bool
FFmpegDecoderModule::Link()
{
if (sFFmpegLinkDone) {
return true;
}
if (!FFmpegRuntimeLinker::Link()) {
NS_WARNING("Failed to link FFmpeg shared libraries.");
return false;
}
sFFmpegLinkDone = true;
return true;
}
nsresult
FFmpegDecoderModule::Shutdown()
{
// Nothing to do here.
return NS_OK;
}
MediaDataDecoder*
FFmpegDecoderModule::CreateH264Decoder(
const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
{
FFMPEG_LOG("Creating FFmpeg H264 decoder.");
return new FFmpegH264Decoder(aVideoTaskQueue, aCallback, aConfig,
aImageContainer);
}
MediaDataDecoder*
FFmpegDecoderModule::CreateAACDecoder(
const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback)
{
FFMPEG_LOG("Creating FFmpeg AAC decoder.");
return new FFmpegAACDecoder(aAudioTaskQueue, aCallback, aConfig);
}
template class FFmpegDecoderModule<LIBAV_VER>;
} // namespace mozilla

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

@ -8,41 +8,41 @@
#define __FFmpegDecoderModule_h__
#include "PlatformDecoderModule.h"
#include "FFmpegAACDecoder.h"
#include "FFmpegH264Decoder.h"
namespace mozilla
{
#ifdef PR_LOGGING
extern PRLogModuleInfo* GetFFmpegDecoderLog();
#define FFMPEG_LOG(...) PR_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__))
#else
#define FFMPEG_LOG(...)
#endif
template <int V>
class FFmpegDecoderModule : public PlatformDecoderModule
{
public:
FFmpegDecoderModule();
virtual ~FFmpegDecoderModule();
static PlatformDecoderModule* Create() { return new FFmpegDecoderModule(); }
static bool Link();
FFmpegDecoderModule() {}
virtual ~FFmpegDecoderModule() {}
virtual nsresult Shutdown() MOZ_OVERRIDE;
virtual nsresult Shutdown() MOZ_OVERRIDE { return NS_OK; }
virtual MediaDataDecoder* CreateH264Decoder(
const mp4_demuxer::VideoDecoderConfig& aConfig,
mozilla::layers::LayersBackend aLayersBackend,
mozilla::layers::ImageContainer* aImageContainer,
MediaTaskQueue* aVideoTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
MOZ_OVERRIDE
{
return new FFmpegH264Decoder<V>(aVideoTaskQueue, aCallback, aConfig,
aImageContainer);
}
virtual MediaDataDecoder* CreateAACDecoder(
const mp4_demuxer::AudioDecoderConfig& aConfig,
MediaTaskQueue* aAudioTaskQueue,
MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
private:
static bool sFFmpegLinkDone;
MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback)
MOZ_OVERRIDE
{
return new FFmpegAACDecoder<V>(aAudioTaskQueue, aCallback, aConfig);
}
};
} // namespace mozilla

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

@ -2,24 +2,27 @@
* 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/. */
AV_FUNC(LIBAVCODEC, avcodec_align_dimensions2)
AV_FUNC(LIBAVCODEC, avcodec_alloc_frame)
AV_FUNC(LIBAVCODEC, avcodec_close)
AV_FUNC(LIBAVCODEC, avcodec_decode_audio4)
AV_FUNC(LIBAVCODEC, avcodec_decode_video2)
AV_FUNC(LIBAVCODEC, avcodec_default_get_buffer)
AV_FUNC(LIBAVCODEC, avcodec_default_release_buffer)
AV_FUNC(LIBAVCODEC, avcodec_find_decoder)
AV_FUNC(LIBAVCODEC, avcodec_flush_buffers)
AV_FUNC(LIBAVCODEC, avcodec_get_context_defaults3)
AV_FUNC(LIBAVCODEC, avcodec_get_edge_width)
AV_FUNC(LIBAVCODEC, avcodec_get_frame_defaults)
AV_FUNC(LIBAVCODEC, avcodec_open2)
AV_FUNC(LIBAVCODEC, av_init_packet)
AV_FUNC(LIBAVCODEC, av_dict_get)
/* libavformat */
AV_FUNC(av_register_all)
AV_FUNC(LIBAVFORMAT, av_register_all)
/* libavcodec */
AV_FUNC(avcodec_align_dimensions2)
AV_FUNC(avcodec_alloc_frame)
AV_FUNC(avcodec_close)
AV_FUNC(avcodec_decode_audio4)
AV_FUNC(avcodec_decode_video2)
AV_FUNC(avcodec_default_get_buffer)
AV_FUNC(avcodec_default_release_buffer)
AV_FUNC(avcodec_find_decoder)
AV_FUNC(avcodec_flush_buffers)
AV_FUNC(avcodec_get_context_defaults3)
AV_FUNC(avcodec_get_edge_width)
AV_FUNC(avcodec_get_frame_defaults)
AV_FUNC(avcodec_open2)
AV_FUNC(av_init_packet)
AV_FUNC(av_dict_get)
AV_FUNC(LIBAVUTIL, av_image_fill_linesizes)
AV_FUNC(LIBAVUTIL, av_image_fill_pointers)
AV_FUNC(LIBAVUTIL, av_log_set_level)
/* libavutil */
AV_FUNC(av_image_fill_linesizes)
AV_FUNC(av_image_fill_pointers)
AV_FUNC(av_log_set_level)

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

@ -10,7 +10,6 @@
#include "ImageContainer.h"
#include "mp4_demuxer/mp4_demuxer.h"
#include "FFmpegRuntimeLinker.h"
#include "FFmpegH264Decoder.h"
@ -24,9 +23,9 @@ typedef mp4_demuxer::MP4Sample MP4Sample;
namespace mozilla
{
FFmpegH264Decoder::FFmpegH264Decoder(
FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
const mp4_demuxer::VideoDecoderConfig &aConfig,
const mp4_demuxer::VideoDecoderConfig& aConfig,
ImageContainer* aImageContainer)
: FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_H264)
, mCallback(aCallback)
@ -37,18 +36,19 @@ FFmpegH264Decoder::FFmpegH264Decoder(
}
nsresult
FFmpegH264Decoder::Init()
FFmpegH264Decoder<LIBAV_VER>::Init()
{
nsresult rv = FFmpegDataDecoder::Init();
NS_ENSURE_SUCCESS(rv, rv);
mCodecContext.get_buffer = AllocateBufferCb;
mCodecContext.release_buffer = ReleaseBufferCb;
return NS_OK;
}
void
FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
FFmpegH264Decoder<LIBAV_VER>::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
{
AVPacket packet;
av_init_packet(&packet);
@ -82,20 +82,12 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
info.mHasVideo = true;
data = VideoData::CreateFromImage(
info, mImageContainer, aSample->byte_offset, aSample->composition_timestamp,
aSample->duration, mCurrentImage, aSample->is_sync_point, -1,
info, mImageContainer, aSample->byte_offset,
aSample->composition_timestamp, aSample->duration,
reinterpret_cast<Image*>(frame->opaque), aSample->is_sync_point, -1,
gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height));
// Insert the frame into the heap for reordering.
mDelayedFrames.Push(data.forget());
// Reorder video frames from decode order to presentation order. The minimum
// size of the heap comes from one P frame + |max_b_frames| B frames, which
// is the maximum number of frames in a row which will be out-of-order.
if (mDelayedFrames.Length() > (uint32_t)mCodecContext.max_b_frames + 1) {
VideoData* d = mDelayedFrames.Pop();
mCallback->Output(d);
}
mCallback->Output(data.forget());
}
if (mTaskQueue->IsEmpty()) {
@ -104,7 +96,7 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
}
static void
PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData &aData,
PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData& aData,
AVFrame* aFrame)
{
aData.mPicX = aData.mPicY = 0;
@ -125,8 +117,8 @@ PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData &aData,
}
/* static */ int
FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext,
AVFrame* aFrame)
FFmpegH264Decoder<LIBAV_VER>::AllocateBufferCb(AVCodecContext* aCodecContext,
AVFrame* aFrame)
{
MOZ_ASSERT(aCodecContext->codec_type == AVMEDIA_TYPE_VIDEO);
@ -141,9 +133,16 @@ FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext,
}
}
int
FFmpegH264Decoder::AllocateYUV420PVideoBuffer(AVCodecContext* aCodecContext,
/* static */ void
FFmpegH264Decoder<LIBAV_VER>::ReleaseBufferCb(AVCodecContext* aCodecContext,
AVFrame* aFrame)
{
reinterpret_cast<Image*>(aFrame->opaque)->Release();
}
int
FFmpegH264Decoder<LIBAV_VER>::AllocateYUV420PVideoBuffer(
AVCodecContext* aCodecContext, AVFrame* aFrame)
{
// Older versions of ffmpeg require that edges be allocated* around* the
// actual image.
@ -203,32 +202,24 @@ FFmpegH264Decoder::AllocateYUV420PVideoBuffer(AVCodecContext* aCodecContext,
PlanarYCbCrDataFromAVFrame(data, aFrame);
ycbcr->SetDataNoCopy(data);
mCurrentImage.swap(image);
aFrame->opaque = reinterpret_cast<void*>(image.forget().take());
return 0;
}
nsresult
FFmpegH264Decoder::Input(mp4_demuxer::MP4Sample* aSample)
FFmpegH264Decoder<LIBAV_VER>::Input(mp4_demuxer::MP4Sample* aSample)
{
mTaskQueue->Dispatch(
NS_NewRunnableMethodWithArg<nsAutoPtr<mp4_demuxer::MP4Sample> >(
this, &FFmpegH264Decoder::DecodeFrame,
this, &FFmpegH264Decoder<LIBAV_VER>::DecodeFrame,
nsAutoPtr<mp4_demuxer::MP4Sample>(aSample)));
return NS_OK;
}
void
FFmpegH264Decoder::OutputDelayedFrames()
{
while (!mDelayedFrames.IsEmpty()) {
mCallback->Output(mDelayedFrames.Pop());
}
}
nsresult
FFmpegH264Decoder::Drain()
FFmpegH264Decoder<LIBAV_VER>::Drain()
{
// The maximum number of frames that can be waiting to be decoded is
// max_b_frames + 1: One P frame and max_b_frames B frames.
@ -241,24 +232,20 @@ FFmpegH264Decoder::Drain()
NS_ENSURE_SUCCESS(rv, rv);
}
mTaskQueue->Dispatch(
NS_NewRunnableMethod(this, &FFmpegH264Decoder::OutputDelayedFrames));
return NS_OK;
}
nsresult
FFmpegH264Decoder::Flush()
FFmpegH264Decoder<LIBAV_VER>::Flush()
{
nsresult rv = FFmpegDataDecoder::Flush();
// Even if the above fails we may as well clear our frame queue.
mDelayedFrames.Clear();
return rv;
}
FFmpegH264Decoder::~FFmpegH264Decoder() {
FFmpegH264Decoder<LIBAV_VER>::~FFmpegH264Decoder()
{
MOZ_COUNT_DTOR(FFmpegH264Decoder);
MOZ_ASSERT(mDelayedFrames.IsEmpty());
}
} // namespace mozilla

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

@ -7,14 +7,18 @@
#ifndef __FFmpegH264Decoder_h__
#define __FFmpegH264Decoder_h__
#include "nsTPriorityQueue.h"
#include "FFmpegDataDecoder.h"
namespace mozilla
{
class FFmpegH264Decoder : public FFmpegDataDecoder
template <int V>
class FFmpegH264Decoder : public FFmpegDataDecoder<V>
{
};
template <>
class FFmpegH264Decoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
{
typedef mozilla::layers::Image Image;
typedef mozilla::layers::ImageContainer ImageContainer;
@ -22,7 +26,7 @@ class FFmpegH264Decoder : public FFmpegDataDecoder
public:
FFmpegH264Decoder(MediaTaskQueue* aTaskQueue,
MediaDataDecoderCallback* aCallback,
const mp4_demuxer::VideoDecoderConfig &aConfig,
const mp4_demuxer::VideoDecoderConfig& aConfig,
ImageContainer* aImageContainer);
virtual ~FFmpegH264Decoder();
@ -45,37 +49,10 @@ private:
AVFrame* aFrame);
static int AllocateBufferCb(AVCodecContext* aCodecContext, AVFrame* aFrame);
static void ReleaseBufferCb(AVCodecContext* aCodecContext, AVFrame* aFrame);
MediaDataDecoderCallback* mCallback;
nsRefPtr<ImageContainer> mImageContainer;
/**
* Pass Image back from the allocator to our DoDecode method.
* We *should* return the image back through ffmpeg wrapped in an AVFrame like
* we're meant to. However, if avcodec_decode_video2 fails, it returns a
* completely different frame from the one holding our image and it will be
* leaked.
* This could be handled in the future by wrapping our Image in a reference
* counted AVBuffer and letting ffmpeg hold the nsAutoPtr<Image>, but
* currently we have to support older versions of ffmpeg which lack
* refcounting.
*/
nsRefPtr<Image> mCurrentImage;
struct VideoDataComparator
{
bool LessThan(VideoData* const &a, VideoData* const &b) const
{
return a->mTime < b->mTime;
}
};
/**
* FFmpeg returns frames in DTS order, so we need to keep a heap of the
* previous MAX_B_FRAMES + 1 frames (all B frames in a GOP + one P frame)
* ordered by PTS to make sure we present video frames in the intended order.
*/
nsTPriorityQueue<VideoData*, VideoDataComparator> mDelayedFrames;
};
} // namespace mozilla

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

@ -0,0 +1,34 @@
/* -*- 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 __FFmpegLibs_h__
#define __FFmpegLibs_h__
extern "C" {
#pragma GCC visibility push(default)
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#pragma GCC visibility pop
}
#if LIBAVCODEC_VERSION_MAJOR < 55
#define AV_CODEC_ID_H264 CODEC_ID_H264
#define AV_CODEC_ID_AAC CODEC_ID_AAC
typedef CodecID AVCodecID;
#endif
enum { LIBAV_VER = LIBAVFORMAT_VERSION_MAJOR };
namespace mozilla {
#define AV_FUNC(func) extern typeof(func)* func;
#include "FFmpegFunctionList.h"
#undef AV_FUNC
}
#endif // __FFmpegLibs_h__

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

@ -0,0 +1,17 @@
/* -*- 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 "prlog.h"
PRLogModuleInfo* GetFFmpegDecoderLog()
{
static PRLogModuleInfo* sFFmpegDecoderLog = nullptr;
if (!sFFmpegDecoderLog) {
sFFmpegDecoderLog = PR_NewLogModule("FFmpegDecoderModule");
}
return sFFmpegDecoderLog;
}

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

@ -4,15 +4,14 @@
* 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 __FFmpegCompat_h__
#define __FFmpegCompat_h__
#ifndef __FFmpegLog_h__
#define __FFmpegLog_h__
#include <libavcodec/version.h>
#if LIBAVCODEC_VERSION_MAJOR < 55
#define AV_CODEC_ID_H264 CODEC_ID_H264
#define AV_CODEC_ID_AAC CODEC_ID_AAC
typedef CodecID AVCodecID;
#ifdef PR_LOGGING
extern PRLogModuleInfo* GetFFmpegDecoderLog();
#define FFMPEG_LOG(...) PR_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__))
#else
#define FFMPEG_LOG(...)
#endif
#endif // __FFmpegCompat_h__
#endif // __FFmpegLog_h__

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

@ -6,34 +6,40 @@
#include <dlfcn.h>
#include "nsDebug.h"
#include "FFmpegRuntimeLinker.h"
// For FFMPEG_LOG
#include "FFmpegDecoderModule.h"
#include "mozilla/ArrayUtils.h"
#include "FFmpegLog.h"
#define NUM_ELEMENTS(X) (sizeof(X) / sizeof((X)[0]))
#define LIBAVCODEC 0
#define LIBAVFORMAT 1
#define LIBAVUTIL 2
namespace mozilla
{
FFmpegRuntimeLinker::LinkStatus FFmpegRuntimeLinker::sLinkStatus =
LinkStatus_INIT;
static const char * const sLibNames[] = {
"libavcodec.so.53", "libavformat.so.53", "libavutil.so.51",
struct AvFormatLib
{
const char* Name;
PlatformDecoderModule* (*Factory)();
};
void* FFmpegRuntimeLinker::sLinkedLibs[NUM_ELEMENTS(sLibNames)] = {
nullptr, nullptr, nullptr
template <int V> class FFmpegDecoderModule
{
public:
static PlatformDecoderModule* Create();
};
#define AV_FUNC(lib, func) typeof(func) func;
static const AvFormatLib sLibs[] = {
{ "libavformat.so.55", FFmpegDecoderModule<55>::Create },
{ "libavformat.so.54", FFmpegDecoderModule<54>::Create },
{ "libavformat.so.53", FFmpegDecoderModule<53>::Create },
};
void* FFmpegRuntimeLinker::sLinkedLib = nullptr;
const AvFormatLib* FFmpegRuntimeLinker::sLib = nullptr;
#define AV_FUNC(func) void (*func)();
#include "FFmpegFunctionList.h"
#undef AV_FUNC
@ -44,41 +50,60 @@ FFmpegRuntimeLinker::Link()
return sLinkStatus == LinkStatus_SUCCEEDED;
}
for (uint32_t i = 0; i < NUM_ELEMENTS(sLinkedLibs); i++) {
if (!(sLinkedLibs[i] = dlopen(sLibNames[i], RTLD_NOW | RTLD_LOCAL))) {
NS_WARNING("Couldn't link ffmpeg libraries.");
goto fail;
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
const AvFormatLib* lib = &sLibs[i];
sLinkedLib = dlopen(lib->Name, RTLD_NOW | RTLD_LOCAL);
if (sLinkedLib) {
if (Bind(lib->Name)) {
sLib = lib;
sLinkStatus = LinkStatus_SUCCEEDED;
return true;
}
// Shouldn't happen but if it does then we try the next lib..
Unlink();
}
}
#define AV_FUNC(lib, func) \
func = (typeof(func))dlsym(sLinkedLibs[lib], #func); \
if (!func) { \
NS_WARNING("Couldn't load FFmpeg function " #func "."); \
goto fail; \
FFMPEG_LOG("H264/AAC codecs unsupported without [");
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
FFMPEG_LOG("%s %s", i ? "," : "", sLibs[i].Name);
}
#include "FFmpegFunctionList.h"
#undef AV_FUNC
FFMPEG_LOG(" ]\n");
sLinkStatus = LinkStatus_SUCCEEDED;
return true;
fail:
Unlink();
sLinkStatus = LinkStatus_FAILED;
return false;
return nullptr;
}
/* static */ bool
FFmpegRuntimeLinker::Bind(const char* aLibName)
{
#define AV_FUNC(func) \
if (!(func = (typeof(func))dlsym(sLinkedLib, #func))) { \
FFMPEG_LOG("Couldn't load function " #func " from %s.", aLibName); \
return false; \
}
#include "FFmpegFunctionList.h"
#undef AV_FUNC
return true;
}
/* static */ PlatformDecoderModule*
FFmpegRuntimeLinker::CreateDecoderModule()
{
PlatformDecoderModule* module = sLib->Factory();
return module;
}
/* static */ void
FFmpegRuntimeLinker::Unlink()
{
FFMPEG_LOG("Unlinking ffmpeg libraries.");
for (uint32_t i = 0; i < NUM_ELEMENTS(sLinkedLibs); i++) {
if (sLinkedLibs[i]) {
dlclose(sLinkedLibs[i]);
sLinkedLibs[i] = nullptr;
}
if (sLinkedLib) {
dlclose(sLinkedLib);
sLinkedLib = nullptr;
sLib = nullptr;
sLinkStatus = LinkStatus_INIT;
}
}

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

@ -7,27 +7,24 @@
#ifndef __FFmpegRuntimeLinker_h__
#define __FFmpegRuntimeLinker_h__
extern "C" {
#pragma GCC visibility push(default)
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/imgutils.h>
#pragma GCC visibility pop
}
#include "nsAutoPtr.h"
namespace mozilla
{
class PlatformDecoderModule;
struct AvFormatLib;
class FFmpegRuntimeLinker
{
public:
static bool Link();
static void Unlink();
static PlatformDecoderModule* CreateDecoderModule();
private:
static void* sLinkedLibs[];
static void* sLinkedLib;
static const AvFormatLib* sLib;
static bool Bind(const char* aLibName);
static enum LinkStatus {
LinkStatus_INIT = 0,
@ -36,9 +33,6 @@ private:
} sLinkStatus;
};
#define AV_FUNC(lib, func) extern typeof(func)* func;
#include "FFmpegFunctionList.h"
#undef AV_FUNC
}
#endif // __FFmpegRuntimeLinker_h__

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

@ -1,4 +1,4 @@
These headers are taken from Libav version 0.8.9.
These headers are taken from Libav versions 0.8.9, 0.9 and 1.0.
These headers are licensed under the GNU Lesser General Public License version
2.1. For more information see the file COPYING.LGPLv2.1

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше