Merge m-c to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2013-11-29 12:56:15 +01:00
commit 3863e877fc
597 changed files with 8672 additions and 7524 deletions

View File

@ -1,3 +0,0 @@
# 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/.

View File

@ -3,39 +3,6 @@
# 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/.
MOCHITEST_A11Y_FILES =\
dumbfile.xpi \
formimage.png \
letters.gif \
moz.png \
$(topsrcdir)/content/media/test/bug461281.ogg \
longdesc_src.html \
actions.js \
attributes.js \
autocomplete.js \
browser.js \
common.js \
events.js \
grid.js \
layout.js \
name.js \
pivot.js \
relations.js \
role.js \
selectable.js \
states.js \
table.js \
value.js \
test_aria_token_attrs.html \
test_bug420863.html \
test_descr.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \
test_OuterDocAccessible.html \
test_textboxes.html \
test_textboxes.xul \
testTextboxes.js \
text.js \
treeview.css \
treeview.js \
$(NULL)
MOCHITEST_A11Y_FILES += \
$(topsrcdir)/content/media/test/bug461281.ogg \
$(NULL)

View File

@ -0,0 +1,36 @@
[DEFAULT]
support-files =
dumbfile.xpi
formimage.png
letters.gif
moz.png
longdesc_src.html
actions.js
attributes.js
autocomplete.js
browser.js
common.js
events.js
grid.js
layout.js
name.js
pivot.js
relations.js
role.js
selectable.js
states.js
table.js
value.js
testTextboxes.js
text.js
treeview.css
treeview.js
[test_aria_token_attrs.html]
[test_bug420863.html]
[test_descr.html]
[test_nsIAccessibleDocument.html]
[test_nsIAccessibleImage.html]
[test_OuterDocAccessible.html]
[test_textboxes.html]
[test_textboxes.xul]

View File

@ -28,7 +28,11 @@ DIRS += [
'textattrs',
'textcaret',
'textselection',
'tree',
'treeupdate',
'value',
]
A11Y_MANIFESTS += [
'a11y.ini',
'tree/a11y.ini',
]

View File

@ -1,43 +0,0 @@
#
# 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/.
MOCHITEST_A11Y_FILES =\
dockids.html \
$(filter disabled-temporarily--bug-561508, test_applicationacc.xul) \
test_aria_globals.html \
test_aria_grid.html \
test_aria_imgmap.html \
test_aria_list.html \
test_aria_menu.html \
test_aria_presentation.html \
test_brokencontext.html \
test_button.xul \
test_canvas.html \
test_combobox.xul \
test_cssoverflow.html \
test_dochierarchy.html \
test_dockids.html \
test_filectrl.html \
test_formctrl.html \
test_formctrl.xul \
test_gencontent.html \
test_groupbox.xul \
test_iframe.html \
test_img.html \
test_invalid_img.xhtml \
test_invalidationlist.html \
test_list.html \
test_map.html \
test_media.html \
test_select.html \
test_tabbox.xul \
test_tabbrowser.xul \
test_table.html \
test_tree.xul \
test_txtcntr.html \
test_txtctrl.html \
test_txtctrl.xul \
wnd.xul \
$(NULL)

View File

@ -0,0 +1,40 @@
[DEFAULT]
support-files =
dockids.html
wnd.xul
[test_applicationacc.xul]
skip-if = true # Bug 561508
[test_aria_globals.html]
[test_aria_grid.html]
[test_aria_imgmap.html]
[test_aria_list.html]
[test_aria_menu.html]
[test_aria_presentation.html]
[test_brokencontext.html]
[test_button.xul]
[test_canvas.html]
[test_combobox.xul]
[test_cssoverflow.html]
[test_dochierarchy.html]
[test_dockids.html]
[test_filectrl.html]
[test_formctrl.html]
[test_formctrl.xul]
[test_gencontent.html]
[test_groupbox.xul]
[test_iframe.html]
[test_img.html]
[test_invalid_img.xhtml]
[test_invalidationlist.html]
[test_list.html]
[test_map.html]
[test_media.html]
[test_select.html]
[test_tabbox.xul]
[test_tabbrowser.xul]
[test_table.html]
[test_tree.xul]
[test_txtcntr.html]
[test_txtctrl.html]
[test_txtctrl.xul]

View File

@ -1,6 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

View File

@ -838,3 +838,7 @@ pref("b2g.neterror.url", "app://system.gaiamobile.org/net_error.html");
// Enable Web Speech synthesis API
pref("media.webspeech.synth.enabled", true);
// Downloads API
pref("dom.mozDownloads.enabled", true);
pref("dom.downloads.max_retention_days", 7);

View File

@ -26,6 +26,8 @@ Cu.import('resource://gre/modules/NetworkStatsService.jsm');
Cu.import('resource://gre/modules/SignInToWebsite.jsm');
SignInToWebsiteController.init();
Cu.import('resource://gre/modules/DownloadsAPI.jsm');
XPCOMUtils.defineLazyServiceGetter(Services, 'env',
'@mozilla.org/process/environment;1',
'nsIEnvironment');
@ -1464,3 +1466,21 @@ Services.obs.addObserver(function resetProfile(subject, topic, data) {
.getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
}, 'b2g-reset-profile', false);
/**
* CID of our implementation of nsIDownloadManagerUI.
*/
const kTransferCid = Components.ID("{1b4c85df-cbdd-4bb6-b04e-613caece083c}");
/**
* Contract ID of the service implementing nsITransfer.
*/
const kTransferContractId = "@mozilla.org/transfer;1";
// Override Toolkit's nsITransfer implementation with the one from the
// JavaScript API for downloads. This will eventually be removed when
// nsIDownloadManager will not be available anymore (bug 851471). The
// old code in this module will be removed in bug 899110.
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(kTransferCid, "",
kTransferContractId, null);

View File

@ -1,4 +1,4 @@
{
"revision": "3fe38577e17209728a54b14624143dbf99ade2df",
"revision": "121f70034b7ef01836aa345f8ff37b61b96ac88e",
"repo_path": "/integration/gaia-central"
}

View File

@ -58,3 +58,5 @@ MOZ_B2G=1
#MOZ_NUWA_PROCESS=1
MOZ_FOLD_LIBS=1
MOZ_JSDOWNLOADS=1

View File

@ -54,6 +54,10 @@ ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS)))
DEFINES += -DMOZ_RTSP
endif
ifdef GKMEDIAS_SHARED_LIBRARY
DEFINES += -DGKMEDIAS_SHARED_LIBRARY
endif
ifdef MOZ_PKG_MANIFEST_P
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) FORCE
$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)

View File

@ -43,7 +43,7 @@
[xpcom]
@BINPATH@/dependentlibs.list
#ifdef XP_WIN32
#ifdef GKMEDIAS_SHARED_LIBRARY
@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
#endif
#ifndef MOZ_STATIC_JS
@ -393,6 +393,8 @@
@BINPATH@/components/jsconsole-clhandler.js
@BINPATH@/components/nsDownloadManagerUI.manifest
@BINPATH@/components/nsDownloadManagerUI.js
@BINPATH@/components/Downloads.manifest
@BINPATH@/components/DownloadLegacy.js
@BINPATH@/components/nsSidebar.manifest
@BINPATH@/components/nsSidebar.js
@ -562,6 +564,9 @@
@BINPATH@/components/PaymentRequestInfo.js
@BINPATH@/components/Payment.manifest
@BINPATH@/components/DownloadsAPI.js
@BINPATH@/components/DownloadsAPI.manifest
; InputMethod API
@BINPATH@/components/MozKeyboard.js
@BINPATH@/components/InputMethod.manifest
@ -748,6 +753,13 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
#endif
[b2g]
#ifndef MOZ_WIDGET_GONK
#ifdef XP_WIN32
@BINPATH@/xpcshell.exe
#else
@BINPATH@/xpcshell
#endif
#endif
@BINPATH@/chrome/icons/
@BINPATH@/chrome/chrome@JAREXT@
@BINPATH@/chrome/chrome.manifest
@ -778,6 +790,7 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/B2GAboutRedirector.js
@BINPATH@/components/FilePicker.js
@BINPATH@/components/HelperAppDialog.js
@BINPATH@/components/DownloadsUI.js
@BINPATH@/components/DataStore.manifest
@BINPATH@/components/DataStoreService.js

View File

@ -18,6 +18,10 @@ function test() {
win.gBrowser.selectedTab = newTab;
let tabBrowser = win.gBrowser.getBrowserForTab(newTab);
tabBrowser.addEventListener("load", function tabLoadListener() {
if (win.gBrowser.contentWindow.location != "about:sessionrestore") {
win.gBrowser.selectedBrowser.loadURI("about:sessionrestore");
return;
}
tabBrowser.removeEventListener("load", tabLoadListener, true);
executeSoon(function() {
info("about:sessionrestore got loaded");

View File

@ -4,4 +4,4 @@
# 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/.
TEST_DIRS += ['test']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -1,70 +0,0 @@
#
# 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/.
MOCHITEST_BROWSER_FILES = \
browser_cmd_addon.js \
$(browser_cmd_calllog.js disabled until bug 845831 is fixed) \
$(browser_cmd_calllog_chrome.js disabled until bug 845831 is fixed) \
browser_cmd_appcache_invalid.js \
browser_cmd_appcache_invalid_appcache.appcache \
browser_cmd_appcache_invalid_appcache.appcache^headers^ \
browser_cmd_appcache_invalid_index.html \
browser_cmd_appcache_invalid_page1.html \
browser_cmd_appcache_invalid_page2.html \
browser_cmd_appcache_invalid_page3.html \
browser_cmd_appcache_invalid_page3.html^headers^ \
browser_cmd_appcache_valid.js \
browser_cmd_appcache_valid_appcache.appcache \
browser_cmd_appcache_valid_appcache.appcache^headers^ \
browser_cmd_appcache_valid_index.html \
browser_cmd_appcache_valid_page1.html \
browser_cmd_appcache_valid_page2.html \
browser_cmd_appcache_valid_page3.html \
browser_cmd_commands.js \
browser_cmd_cookie.html \
browser_cmd_cookie.js \
browser_cmd_jsb.js \
browser_cmd_jsb_script.jsi \
browser_cmd_media.html \
browser_cmd_media.js \
browser_cmd_pagemod_export.html \
browser_cmd_pagemod_export.js \
browser_cmd_pref.js \
browser_cmd_restart.js \
browser_cmd_screenshot.html \
browser_cmd_screenshot.js \
browser_cmd_settings.js \
browser_gcli_async.js \
browser_gcli_canon.js \
browser_gcli_cli.js \
browser_gcli_completion.js \
$(browser_gcli_date.js disabled until TZ bug is fixed) \
browser_gcli_exec.js \
browser_gcli_fail.js \
browser_gcli_file.js \
browser_gcli_focus.js \
browser_gcli_history.js \
browser_gcli_incomplete.js \
browser_gcli_inputter.js \
browser_gcli_intro.js \
browser_gcli_js.js \
browser_gcli_keyboard1.js \
browser_gcli_keyboard2.js \
browser_gcli_keyboard3.js \
browser_gcli_menu.js \
browser_gcli_node.js \
browser_gcli_remote.js \
browser_gcli_resource.js \
browser_gcli_scratchpad.js \
browser_gcli_spell.js \
browser_gcli_split.js \
browser_gcli_tokenize.js \
browser_gcli_tooltip.js \
browser_gcli_types.js \
browser_gcli_util.js \
head.js \
helpers.js \
mockCommands.js \
$(NULL)

View File

@ -0,0 +1,69 @@
[DEFAULT]
support-files =
head.js
helpers.js
mockCommands.js
[browser_cmd_addon.js]
[browser_cmd_calllog.js]
skip-if = true # Bug 845831
[browser_cmd_calllog_chrome.js]
skip-if = true # Bug 845831
[browser_cmd_appcache_invalid.js]
[browser_cmd_appcache_invalid_appcache.appcache]
[browser_cmd_appcache_invalid_appcache.appcache^headers^]
[browser_cmd_appcache_invalid_index.html]
[browser_cmd_appcache_invalid_page1.html]
[browser_cmd_appcache_invalid_page2.html]
[browser_cmd_appcache_invalid_page3.html]
[browser_cmd_appcache_invalid_page3.html^headers^]
[browser_cmd_appcache_valid.js]
[browser_cmd_appcache_valid_appcache.appcache]
[browser_cmd_appcache_valid_appcache.appcache^headers^]
[browser_cmd_appcache_valid_index.html]
[browser_cmd_appcache_valid_page1.html]
[browser_cmd_appcache_valid_page2.html]
[browser_cmd_appcache_valid_page3.html]
[browser_cmd_commands.js]
[browser_cmd_cookie.html]
[browser_cmd_cookie.js]
[browser_cmd_jsb.js]
[browser_cmd_jsb_script.jsi]
[browser_cmd_media.html]
[browser_cmd_media.js]
[browser_cmd_pagemod_export.html]
[browser_cmd_pagemod_export.js]
[browser_cmd_pref.js]
[browser_cmd_restart.js]
[browser_cmd_screenshot.html]
[browser_cmd_screenshot.js]
[browser_cmd_settings.js]
[browser_gcli_async.js]
[browser_gcli_canon.js]
[browser_gcli_cli.js]
[browser_gcli_completion.js]
[browser_gcli_date.js]
skip-if = true # Disabled until TZ bug is fixed
[browser_gcli_exec.js]
[browser_gcli_fail.js]
[browser_gcli_file.js]
[browser_gcli_focus.js]
[browser_gcli_history.js]
[browser_gcli_incomplete.js]
[browser_gcli_inputter.js]
[browser_gcli_intro.js]
[browser_gcli_js.js]
[browser_gcli_keyboard1.js]
[browser_gcli_keyboard2.js]
[browser_gcli_keyboard3.js]
[browser_gcli_menu.js]
[browser_gcli_node.js]
[browser_gcli_remote.js]
[browser_gcli_resource.js]
[browser_gcli_scratchpad.js]
[browser_gcli_spell.js]
[browser_gcli_split.js]
[browser_gcli_tokenize.js]
[browser_gcli_tooltip.js]
[browser_gcli_types.js]
[browser_gcli_util.js]

View File

@ -1,6 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

View File

@ -3,10 +3,11 @@
# 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/.
TEST_DIRS += ['test']
JS_MODULES_PATH = 'modules/devtools/debugger'
EXTRA_JS_MODULES += [
'debugger-panel.js'
]
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -1,22 +0,0 @@
# 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/.
# Bug 888811 & bug 891176:
# Disable browser_dbg_on-pause-raise.js due to frequent failures
# Bug 847558:
# Disable browser_dbg_chrome-create.js to fix Ubuntu hangs
ifneq (Linux,$(OS_ARCH))
MOCHITEST_BROWSER_FILES += \
browser_dbg_chrome-create.js \
browser_dbg_on-pause-raise.js \
$(NULL)
endif
# Bug 895426:
# Disable browser_dbg_break-on-dom-event.js due to frequent failures
ifneq (Darwin,$(OS_ARCH))
MOCHITEST_BROWSER_FILES += \
browser_dbg_break-on-dom-event.js \
$(NULL)
endif

View File

@ -201,3 +201,9 @@ skip-if = true
[browser_dbg_variables-view-webidl.js]
[browser_dbg_watch-expressions-01.js]
[browser_dbg_watch-expressions-02.js]
[browser_dbg_chrome-create.js]
skip-if = os == "linux" # Bug 847558
[browser_dbg_on-pause-raise.js]
skip-if = os == "linux" # Bug 888811 & bug 891176
[browser_dbg_break-on-dom-event.js]
skip-if = os == "mac" # Bug 895426

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
BROWSER_CHROME_MANIFESTS += ['browser.ini']

View File

@ -3,63 +3,12 @@
# 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/.
MOCHITEST_BROWSER_FILES = \
browser_bug683672.js \
browser_styleinspector_bug_672746_default_styles.js \
browser_styleinspector_bug_672744_search_filter.js \
$(filter awaiting-promise-based-init, browser_bug589375_keybindings.js) \
browser_styleinspector_bug_689759_no_results_placeholder.js \
browser_bug_692400_element_style.js \
browser_csslogic_inherited.js \
browser_ruleview_734259_style_editor_link.js \
browser_ruleview_editor.js \
browser_ruleview_editor_changedvalues.js \
browser_ruleview_copy.js \
browser_ruleview_focus.js \
browser_ruleview_inherit.js \
browser_ruleview_manipulation.js \
browser_ruleview_override.js \
browser_ruleview_ui.js \
browser_ruleview_update.js \
browser_ruleview_livepreview.js \
browser_bug705707_is_content_stylesheet.js \
browser_bug722196_property_view_media_queries.js \
browser_bug722196_rule_view_media_queries.js \
browser_bug_592743_specificity.js \
browser_bug722691_rule_view_increment.js \
browser_computedview_734259_style_editor_link.js \
browser_computedview_copy.js\
browser_styleinspector_bug_677930_urls_clickable.js \
browser_bug893965_css_property_completion_new_property.js \
browser_bug893965_css_property_completion_existing_property.js \
browser_bug894376_css_value_completion_new_property_value_pair.js \
browser_bug894376_css_value_completion_existing_property_value_pair.js \
browser_ruleview_bug_902966_revert_value_on_ESC.js \
browser_ruleview_pseudoelement.js \
browser_computedview_bug835808_keyboard_nav.js \
browser_bug913014_matched_expand.js \
browser_bug765105_background_image_tooltip.js \
browser_bug889638_rule_view_color_picker.js \
head.js \
$(NULL)
include $(topsrcdir)/config/makefiles/mochitest.mk
MOCHITEST_BROWSER_FILES += \
browser_bug683672.html \
browser_bug705707_is_content_stylesheet.html \
browser_bug705707_is_content_stylesheet_imported.css \
browser_bug705707_is_content_stylesheet_imported2.css \
browser_bug705707_is_content_stylesheet_linked.css \
browser_bug705707_is_content_stylesheet_script.css \
browser_bug705707_is_content_stylesheet.xul \
browser_bug705707_is_content_stylesheet_xul.css \
browser_bug722196_identify_media_queries.html \
browser_styleinspector_bug_677930_urls_clickable.html \
test-image.png \
browser_ruleview_pseudoelement.html \
$(NULL)
mochitest_browser_dest := $(call mochitestdir,browser)
MOCHITEST_BUG_677940_DATA_FILES = \
mochitest_bug_677930_data_FILES = \
browser_styleinspector_bug_677930_urls_clickable/browser_styleinspector_bug_677930_urls_clickable.css \
$(NULL)
MOCHITEST_BUG_677940_DATA_DEST = $(MOCHITEST_BROWSER_DEST)/browser_styleinspector_bug_677930_urls_clickable
INSTALL_TARGETS += MOCHITEST_BUG_677940_DATA
mochitest_bug_677930_data_DEST = $(mochitest_browser_dest)/browser_styleinspector_bug_677930_urls_clickable
INSTALL_TARGETS += mochitest_bug_677930_data

View File

@ -0,0 +1,55 @@
[DEFAULT]
support-files =
head.js
browser_bug722196_identify_media_queries.html
[browser_bug683672.js]
support-files = browser_bug683672.html
[browser_styleinspector_bug_672746_default_styles.js]
[browser_styleinspector_bug_672744_search_filter.js]
[browser_bug589375_keybindings.js]
skip-if = true # awaiting promise-based init
[browser_styleinspector_bug_689759_no_results_placeholder.js]
[browser_bug_692400_element_style.js]
[browser_csslogic_inherited.js]
[browser_ruleview_734259_style_editor_link.js]
[browser_ruleview_editor.js]
[browser_ruleview_editor_changedvalues.js]
[browser_ruleview_copy.js]
[browser_ruleview_focus.js]
[browser_ruleview_inherit.js]
[browser_ruleview_manipulation.js]
[browser_ruleview_override.js]
[browser_ruleview_ui.js]
[browser_ruleview_update.js]
[browser_ruleview_livepreview.js]
[browser_bug705707_is_content_stylesheet.js]
support-files =
browser_bug705707_is_content_stylesheet.html
browser_bug705707_is_content_stylesheet_imported.css
browser_bug705707_is_content_stylesheet_imported2.css
browser_bug705707_is_content_stylesheet_linked.css
browser_bug705707_is_content_stylesheet_script.css
browser_bug705707_is_content_stylesheet.xul
browser_bug705707_is_content_stylesheet_xul.css
[browser_bug722196_property_view_media_queries.js]
[browser_bug722196_rule_view_media_queries.js]
[browser_bug_592743_specificity.js]
[browser_bug722691_rule_view_increment.js]
[browser_computedview_734259_style_editor_link.js]
[browser_computedview_copy.js]
[browser_styleinspector_bug_677930_urls_clickable.js]
support-files =
test-image.png
browser_styleinspector_bug_677930_urls_clickable.html
[browser_bug893965_css_property_completion_new_property.js]
[browser_bug893965_css_property_completion_existing_property.js]
[browser_bug894376_css_value_completion_new_property_value_pair.js]
[browser_bug894376_css_value_completion_existing_property_value_pair.js]
[browser_ruleview_bug_902966_revert_value_on_ESC.js]
[browser_ruleview_pseudoelement.js]
support-files = browser_ruleview_pseudoelement.html
[browser_computedview_bug835808_keyboard_nav.js]
[browser_bug913014_matched_expand.js]
[browser_bug765105_background_image_tooltip.js]
[browser_bug889638_rule_view_color_picker.js]

View File

@ -4,3 +4,4 @@
# 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/.
BROWSER_CHROME_MANIFESTS += ['browser.ini']

View File

@ -75,6 +75,10 @@ ifdef NECKO_WIFI
DEFINES += -DNECKO_WIFI
endif
ifdef GKMEDIAS_SHARED_LIBRARY
DEFINES += -DGKMEDIAS_SHARED_LIBRARY
endif
ifdef MOZ_PKG_MANIFEST_P
MOZ_PKG_MANIFEST = package-manifest

View File

@ -52,7 +52,7 @@
[xpcom]
@BINPATH@/dependentlibs.list
#ifdef XP_WIN32
#ifdef GKMEDIAS_SHARED_LIBRARY
@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
#endif
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@

View File

@ -25,6 +25,15 @@
fun:_ZN13CrashReporter14SetRestartArgsEiPPc
...
}
{
PR_SetEnv requires its argument to be leaked, but does not appear on stacks. (See bug 793548.)
Memcheck:Leak
fun:malloc
...
fun:_Z12ToNewCStringRK19nsACString_internal
fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
...
}
####################################
# Leaks in third party libraries #
@ -59,246 +68,35 @@
# Other leaks #
#################
# XXX: temporary disabling
#{
# Bug 793532
# Memcheck:Leak
# fun:malloc
# fun:_ZN8JSObject25allocateSlowArrayElementsEP9JSContext
# ...
#}
#{
# Bug 793533 (all 64-bit systems)
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipalbPP8JSObjectPP13JSCompartment
# ...
#}
#{
# Bug 793533 (all 64-bit systems)
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN3xpc18CreateGlobalObjectEP9JSContextP7JSClassP12nsIPrincipalm
# ...
#}
#{
# Bug 793536 (all 64-bit systems)
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEm
# ...
#}
#{
# Bug 793536 (all 32-bit systems)
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZNSt11_Deque_baseIN11MessageLoop11PendingTaskESaIS1_EE17_M_initialize_mapEj
# ...
#}
#{
# Bug 793548
# Memcheck:Leak
# fun:malloc
# ...
# fun:_Z12ToNewCStringRK19nsACString_internal
# fun:_ZN13CrashReporter14SetupExtraDataEP7nsIFileRK19nsACString_internal
# ...
#}
#{
# Bug 793608
# Memcheck:Leak
# ...
# fun:gaih_inet
# fun:getaddrinfo
# fun:PR_GetAddrInfoByName
# fun:_ZN14nsHostResolver10ThreadFuncEPv
# fun:_pt_root
# fun:start_thread
# fun:clone
#}
#{
# Bug 793608 variant
# Memcheck:Leak
# fun:malloc
# fun:__libc_res_nsend
# fun:__libc_res_nquery
# fun:__libc_res_nquerydomain
# fun:__libc_res_nsearch
# obj:*
# ...
#}
#{
# Bug 793608 variant 2
# Memcheck:Leak
# fun:malloc
# fun:make_request
# fun:__check_pf
# fun:getaddrinfo
# fun:PR_GetAddrInfoByName
# fun:_ZN14nsHostResolver10ThreadFuncEPv
# fun:_pt_root
# fun:start_thread
# fun:clone
#}
#{
# Bug 793615
# Memcheck:Leak
# fun:malloc
# fun:sqlite3MemMalloc
# ...
#}
#{
# Bug 794350
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN11MessageLoopC1ENS_4TypeE
# fun:_ZN4base6Thread10ThreadMainEv
# fun:_ZL10ThreadFuncPv
# fun:start_thread
# fun:clone
#}
#{
# Bug 794354
# Memcheck:Leak
# ...
# fun:_ZN7mozilla12safebrowsing10Classifier12ApplyUpdatesEP8nsTArrayIPNS0_11TableUpdateE24nsTArrayDefaultAllocatorE
# fun:_ZN30nsUrlClassifierDBServiceWorker11ApplyUpdateEv
# fun:_ZN30nsUrlClassifierDBServiceWorker12FinishUpdateEv
# ...
#}
#{
# Bug 794358
# Memcheck:Leak
# fun:malloc
# ...
# fun:PK11_InitPin
# fun:_ZN11nsPK11Token12InitPasswordEPKt
# ...
#}
#{
# Bug 794369
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN20mozJSComponentLoader10LoadModuleERN7mozilla12FileLocationE
# ...
#}
#{
# Bug 794370
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN22nsComponentManagerImpl15RegisterFactoryERK4nsIDPKcS4_P10nsIFactory
# ...
#}
#{
# Bug 794372
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN22nsComponentManagerImpl16RegisterCIDEntryEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
# ...
#}
#{
# Bug 794372
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN22nsComponentManagerImpl22RegisterCIDEntryLockedEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
# ...
#}
#{
# Bug 794374
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_ZN22nsComponentManagerImpl17ManifestComponentERNS_25ManifestProcessingContextEiPKPc
# ...
#}
#{
# Bug 803386
# Memcheck:Free
# fun:_ZdlPv
# fun:_ZN16SkMallocPixelRefD0Ev
# fun:_ZNK8SkRefCnt16internal_disposeEv
# fun:_ZN8SkBitmap10freePixelsEv
# fun:_ZN8SkBitmapD1Ev
# fun:_ZN7mozilla3gfx5ScaleEPhiiiS1_iiiNS0_13SurfaceFormatE
# ...
#}
#{
# Bug 812422
# Memcheck:Leak
# fun:malloc
# fun:moz_xmalloc
# fun:_Z22NS_NewComputedDOMStylePN7mozilla3dom7ElementERK18nsAString_internalP12nsIPresShellN18nsComputedDOMStyle9StyleTypeE
# fun:_ZN14nsGlobalWindow22GetComputedStyleHelperEP13nsIDOMElementRK18nsAString_internalbPP25nsIDOMCSSStyleDeclaration
# ...
#}
#{
# Bug 812423
# Memcheck:Leak
# fun:malloc
# fun:_ZN2js15ArgumentsObject6createI18CopyStackFrameArgsEEPS0_P9JSContextN2JS6HandleIP8JSScriptEENS7_IP10JSFunctionEEjRT_
# fun:_ZN2js15ArgumentsObject14createExpectedEP9JSContextPNS_10StackFrameE
# ...
#}
#{
# Bug 812423
# Memcheck:Leak
# fun:malloc
# fun:_ZN2js15ArgumentsObject6createI13CopyFrameArgsEEPS0_P9JSContextN2JS6HandleIP8JSScriptEENS7_IP10JSFunctionEEjRT_
# fun:_ZN2js15ArgumentsObject14createExpectedEP9JSContextNS_16AbstractFramePtrE
# ...
#}
#{
# Bug 823782
# Memcheck:Leak
# fun:malloc
# ...
# fun:_ZN2js6ctypes7LibraryL7DeclareEP9JSContextjPN2JS5ValueE
# ...
#}
#{
# Bug 823782
# Memcheck:Leak
# fun:malloc
# fun:_ZN2js6ctypes5CData6CreateEP9JSContextN2JS6HandleIP8JSObjectEES8_Pvb
# ...
#}
#{
# Bug 823782
# Memcheck:Leak
# fun:malloc
# ...
# fun:_ZN2js6ctypes10StructTypeL6CreateEP9JSContextjPN2JS5ValueE
# ...
#}
#{
# Bug 823782
# Memcheck:Leak
# fun:malloc
# fun:_ZN2js6ctypes9Int64Base9ConstructEP9JSContextN2JS6HandleIP8JSObjectEEmb
# ...
#}
#{
# Bug 824323
# Memcheck:Leak
# fun:malloc
# ...
# fun:_ZN7mozilla3dom7workers13WorkerPrivate9DoRunLoopEP9JSContext
# ...
#}
#{
# Bug 874658
# Memcheck:Leak
# fun:malloc
# ...
# fun:_Z31mozilla_sampler_register_threadPKc
# ...
#}
{
Bug 794369
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN20mozJSComponentLoader10LoadModuleERN7mozilla12FileLocationE
...
}
{
Bug 794370
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN22nsComponentManagerImpl15RegisterFactoryERK4nsIDPKcS4_P10nsIFactory
...
}
{
Bug 794372
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN22nsComponentManagerImpl22RegisterCIDEntryLockedEPKN7mozilla6Module8CIDEntryEPNS_11KnownModuleE
...
}
{
Bug 794374
Memcheck:Leak
fun:malloc
fun:moz_xmalloc
fun:_ZN22nsComponentManagerImpl17ManifestComponentERNS_25ManifestProcessingContextEiPKPc
...
}

View File

@ -49,13 +49,3 @@
obj:/lib/libgobject-2.0.so.0.2200.5
...
}
# XXX: temporary disabling
#{
# Bug 850134
# Memcheck:Leak
# fun:realloc
# fun:_ZN2js6VectorIyLj0ENS_15TempAllocPolicyEE13growStorageByEj
# fun:_ZN2js8SCOutput5writeEy
# fun:_ZN2js8SCOutput9writePairEjj
# ...
#}

View File

@ -49,13 +49,3 @@
obj:/lib64/libgobject-2.0.so.0.2200.5
...
}
# XXX: temporary disabling
#{
# Bug 850134
# Memcheck:Leak
# fun:realloc
# fun:_ZN2js6VectorImLm0ENS_15TempAllocPolicyEE13growStorageByEm
# fun:_ZN2js8SCOutput5writeEm
# fun:_ZN2js8SCOutput9writePairEjj
# ...
#}

View File

@ -55,10 +55,6 @@ include $(topsrcdir)/config/rules.mk
HOST_CFLAGS += -DUNICODE -D_UNICODE
ifeq ($(OS_CONFIG),SunOS4.1)
NSPR_CFLAGS += -I$(srcdir)/../nsprpub/pr/include/md
endif
# Generate a new buildid every time we "export" in config... that's only
# supposed to be once per-build!
export::

View File

@ -33,18 +33,14 @@ if CONFIG['MOZ_VP8'] and not CONFIG['MOZ_NATIVE_LIBVPX']:
if CONFIG['MOZ_OGG']:
external_dirs += ['media/libogg', 'media/libtheora']
if CONFIG['MOZ_SPEEX_RESAMPLER']:
external_dirs += ['media/libspeex_resampler']
if CONFIG['MOZ_SOUNDTOUCH']:
external_dirs += ['media/libsoundtouch']
if CONFIG['MOZ_CUBEB']:
external_dirs += ['media/libcubeb']
if not CONFIG['MOZ_NATIVE_PNG']:
external_dirs += ['media/libpng']
external_dirs += ['media/kiss_fft']
external_dirs += [
'media/kiss_fft',
'media/libcubeb',
'media/libspeex_resampler',
'media/libsoundtouch',
]
PARALLEL_DIRS += ['../../' + i for i in external_dirs]

View File

@ -24,3 +24,6 @@ if CONFIG['HOST_OS_ARCH'] != 'WINNT':
'pathsub.c',
]
HOST_PROGRAM = 'nsinstall_real'
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
DEFINES['GKMEDIAS_SHARED_LIBRARY'] = True

View File

@ -117,7 +117,7 @@ CPPSRCS += $(CPP_UNIT_TESTS)
CPP_UNIT_TEST_BINS := $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
SIMPLE_PROGRAMS += $(CPP_UNIT_TEST_BINS)
INCLUDES += -I$(DIST)/include/testing
LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS) $(if $(JS_SHARED_LIBRARY),,$(MOZ_ZLIB_LIBS))
LIBS += $(XPCOM_GLUE_LDOPTS) $(NSPR_LIBS)
ifndef MOZ_PROFILE_GENERATE
libs:: $(CPP_UNIT_TEST_BINS) $(call mkdir_deps,$(DIST)/cppunittests)

View File

@ -1092,7 +1092,7 @@ vpx/vpx_encoder.h
vpx/vp8cx.h
vpx/vp8dx.h
#endif
#ifdef XP_WIN
#ifdef GKMEDIAS_SHARED_LIBRARY
vpx/vpx_codec.h
vpx/vpx_decoder.h
vpx/vpx_encoder.h

View File

@ -3938,9 +3938,6 @@ MOZ_JSDEBUGGER=1
MOZ_AUTH_EXTENSION=1
MOZ_OGG=1
MOZ_RAW=
MOZ_SPEEX_RESAMPLER=1
MOZ_SOUNDTOUCH=1
MOZ_CUBEB=
MOZ_VORBIS=
MOZ_TREMOR=
MOZ_WAVE=1
@ -5201,7 +5198,6 @@ MOZ_ARG_DISABLE_BOOL(ogg,
if test -n "$MOZ_OGG"; then
AC_DEFINE(MOZ_OGG)
MOZ_CUBEB=1
dnl Checks for __attribute__(aligned()) directive
AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
@ -5261,7 +5257,6 @@ MOZ_ARG_DISABLE_BOOL(directshow,
if test -n "$MOZ_DIRECTSHOW"; then
AC_DEFINE(MOZ_DIRECTSHOW)
MOZ_CUBEB=1
fi;
dnl ========================================================
@ -5281,7 +5276,6 @@ MOZ_ARG_DISABLE_BOOL(wmf,
if test -n "$MOZ_WMF"; then
AC_DEFINE(MOZ_WMF)
MOZ_CUBEB=1
fi;
dnl ========================================================
@ -5412,7 +5406,6 @@ AC_SUBST(MOZ_LIBVPX_CFLAGS)
AC_SUBST(MOZ_LIBVPX_LIBS)
if test "$MOZ_WEBM" -o "$MOZ_OGG"; then
MOZ_CUBEB=1
if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
MOZ_VORBIS=1
else
@ -5514,25 +5507,12 @@ MOZ_ARG_DISABLE_BOOL(wave,
if test -n "$MOZ_WAVE"; then
AC_DEFINE(MOZ_WAVE)
MOZ_CUBEB=1
fi
dnl ========================================================
dnl = Handle dependent CUBEB and MEDIA defines
dnl = Handle dependent MEDIA defines
dnl ========================================================
if test -n "$MOZ_SPEEX_RESAMPLER"; then
AC_DEFINE(MOZ_SPEEX_RESAMPLER)
fi
if test -n "$MOZ_SOUNDTOUCH"; then
AC_DEFINE(MOZ_SOUNDTOUCH)
fi
if test -n "$MOZ_CUBEB"; then
AC_DEFINE(MOZ_CUBEB)
fi
if test -n "$MOZ_OPUS" -a -z "$MOZ_OGG"; then
AC_MSG_ERROR([MOZ_OPUS requires MOZ_OGG which is disabled.])
fi
@ -5562,12 +5542,12 @@ if test -n "$MOZ_OPUS"; then
AC_DEFINE(MOZ_OPUS)
fi
dnl ====================================================
dnl = Check alsa availability on Linux if using libcubeb
dnl ====================================================
dnl ==================================
dnl = Check alsa availability on Linux
dnl ==================================
dnl If using libcubeb with Linux, ensure that the alsa library is available
if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux"; then
dnl If using Linux, ensure that the alsa library is available
if test "$OS_TARGET" = "Linux"; then
MOZ_ALSA=1
fi
@ -5577,7 +5557,6 @@ MOZ_ARG_ENABLE_BOOL(alsa,
MOZ_ALSA=)
if test -n "$MOZ_ALSA"; then
AC_DEFINE(MOZ_CUBEB)
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
[echo "$MOZ_ALSA_PKG_ERRORS"
AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
@ -5591,8 +5570,8 @@ dnl ========================================================
dnl = Disable PulseAudio
dnl ========================================================
dnl If using libcubeb with Linux, ensure that the PA library is available
if test -n "$MOZ_CUBEB" -a "$OS_TARGET" = "Linux" -a -z "$MOZ_B2G"; then
dnl If using Linux, ensure that the PA library is available
if test "$OS_TARGET" = "Linux" -a -z "$MOZ_B2G"; then
MOZ_PULSEAUDIO=1
fi
@ -5602,7 +5581,6 @@ MOZ_ARG_DISABLE_BOOL(pulseaudio,
MOZ_PULSEAUDIO=1)
if test -n "$MOZ_PULSEAUDIO"; then
AC_DEFINE(MOZ_CUBEB)
if test -z "$gonkdir"; then
PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
[echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
@ -7770,6 +7748,20 @@ AC_SUBST(JS_SHARED_LIBRARY)
AC_SUBST(LIBXUL_LIBS)
XPCOM_LIBS="$LIBXUL_LIBS"
if test "$OS_ARCH" = "WINNT"; then
GKMEDIAS_SHARED_LIBRARY=1
fi
AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
if test -z "$MOZ_NATIVE_ZLIB"; then
if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
ZLIB_IN_MOZGLUE=1
AC_DEFINE(ZLIB_IN_MOZGLUE)
fi
fi
AC_SUBST(ZLIB_IN_MOZGLUE)
dnl ========================================================
dnl =
dnl = Standalone module options
@ -8651,9 +8643,6 @@ AC_SUBST(MOZ_NSS_PATCH)
AC_SUBST(MOZ_APP_COMPONENT_LIBS)
AC_SUBST(MOZ_APP_EXTRA_LIBS)
AC_SUBST(MOZ_SPEEX_RESAMPLER)
AC_SUBST(MOZ_SOUNDTOUCH)
AC_SUBST(MOZ_CUBEB)
AC_SUBST(MOZ_WAVE)
AC_SUBST(MOZ_VORBIS)
AC_SUBST(MOZ_TREMOR)
@ -9217,7 +9206,7 @@ fi
if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
export MOZ_GLUE_PROGRAM_LDFLAGS
fi
if test "$MOZ_NATIVE_ZLIB" != 1 -a "$OS_ARCH" = "WINNT"; then
if test -n "$ZLIB_IN_MOZGLUE"; then
MOZ_ZLIB_LIBS=
fi
export MOZ_NATIVE_ZLIB
@ -9232,6 +9221,7 @@ export STLPORT_LDFLAGS
export STLPORT_LIBS
export JS_STANDALONE=no
export MOZ_LINKER
export ZLIB_IN_MOZGLUE
if ! test -e js; then
mkdir js

View File

@ -712,14 +712,22 @@ nsContentList::ContentAppended(nsIDocument* aDocument, nsIContent* aContainer,
/*
* If the state is LIST_DIRTY then we have no useful information in our list
* and we want to put off doing work as much as possible. Also, if
* aContainer is anonymous from our point of view, we know that we can't
* possibly be matching any of the kids.
* and we want to put off doing work as much as possible.
*
* Also, if aContainer is anonymous from our point of view, we know that we
* can't possibly be matching any of the kids.
*
* Optimize out also the common case when just one new node is appended and
* it doesn't match us.
*/
if (mState == LIST_DIRTY ||
!nsContentUtils::IsInSameAnonymousTree(mRootNode, aContainer) ||
!MayContainRelevantNodes(aContainer))
!MayContainRelevantNodes(aContainer) ||
(!aFirstNewContent->HasChildren() &&
!aFirstNewContent->GetNextSibling() &&
!MatchSelf(aFirstNewContent))) {
return;
}
/*
* We want to handle the case of ContentAppended by sometimes

View File

@ -417,7 +417,7 @@ nsContentUtils::Init()
return NS_ERROR_OUT_OF_MEMORY;
}
NS_RegisterMemoryReporter(new DOMEventListenerManagersHashReporter);
RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
}
sBlockedScriptRunners = new nsTArray< nsCOMPtr<nsIRunnable> >;

View File

@ -733,9 +733,7 @@ nsDOMMemoryFile::DataOwner::EnsureMemoryReporterRegistered()
return;
}
nsRefPtr<nsDOMMemoryFileDataOwnerMemoryReporter> reporter = new
nsDOMMemoryFileDataOwnerMemoryReporter();
NS_RegisterMemoryReporter(reporter);
RegisterStrongMemoryReporter(new nsDOMMemoryFileDataOwnerMemoryReporter());
sMemoryReporterRegistered = true;
}

View File

@ -1300,7 +1300,7 @@ NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult)
nsFrameMessageManager* mm = new nsFrameMessageManager(nullptr,
nullptr,
MM_CHROME | MM_GLOBAL | MM_BROADCASTER);
NS_RegisterMemoryReporter(new MessageManagerReporter());
RegisterStrongMemoryReporter(new MessageManagerReporter());
return CallQueryInterface(mm, aResult);
}
@ -1835,7 +1835,7 @@ NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
cb = new SameChildProcessMessageManagerCallback();
} else {
cb = new ChildProcessMessageManagerCallback();
NS_RegisterMemoryReporter(new MessageManagerReporter());
RegisterStrongMemoryReporter(new MessageManagerReporter());
}
nsFrameMessageManager* mm = new nsFrameMessageManager(cb,
nullptr,

View File

@ -53,7 +53,7 @@ nsHostObjectProtocolHandler::nsHostObjectProtocolHandler()
if (!initialized) {
initialized = true;
NS_RegisterMemoryReporter(new mozilla::HostObjectURLsReporter());
RegisterStrongMemoryReporter(new mozilla::HostObjectURLsReporter());
}
}

View File

@ -739,6 +739,14 @@ nsINode::CompareDocumentPosition(nsINode& aOtherNode) const
if (this == &aOtherNode) {
return 0;
}
if (GetPreviousSibling() == &aOtherNode) {
MOZ_ASSERT(GetParentNode() == aOtherNode.GetParentNode());
return static_cast<uint16_t>(nsIDOMNode::DOCUMENT_POSITION_PRECEDING);
}
if (GetNextSibling() == &aOtherNode) {
MOZ_ASSERT(GetParentNode() == aOtherNode.GetParentNode());
return static_cast<uint16_t>(nsIDOMNode::DOCUMENT_POSITION_FOLLOWING);
}
nsAutoTArray<const nsINode*, 32> parents1, parents2;

View File

@ -8,11 +8,3 @@ MOCHITEST_FILES = \
nochrome_bug765993.js \
nochrome_bug765993.js^headers^ \
$(NULL)
ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
MOCHITEST_CHROME_FILES += \
test_cpows.xul \
cpows_parent.xul \
cpows_child.js \
$(NULL)
endif

View File

@ -2,6 +2,8 @@
support-files =
blockNoPlugins.xml
blockPluginHard.xml
cpows_child.js
cpows_parent.xul
file_bug391728.html
file_bug391728_2.html
file_bug549682.xul
@ -43,6 +45,8 @@ support-files =
[test_bug814638.xul]
[test_bug816340.xul]
[test_bug914381.html]
[test_cpows.xul]
skip-if = toolkit == "cocoa"
[test_document_register.xul]
[test_domparsing.xul]
[test_fileconstructor.xul]

View File

@ -888,7 +888,7 @@ CanvasRenderingContext2D::EnsureTarget()
static bool registered = false;
if (!registered) {
registered = true;
NS_RegisterMemoryReporter(new Canvas2dPixelsReporter());
RegisterStrongMemoryReporter(new Canvas2dPixelsReporter());
}
gCanvasAzureMemoryUsed += mWidth * mHeight * 4;

View File

@ -38,6 +38,7 @@
#include "GLContextProvider.h"
#include "GLContext.h"
#include "ScopedGLHelpers.h"
#include "gfxCrashReporterUtils.h"

View File

@ -5,39 +5,26 @@
#include "WebGLContext.h"
#include "WebGLMemoryTracker.h"
#include "nsIMemoryReporter.h"
using namespace mozilla;
NS_IMPL_ISUPPORTS1(WebGLMemoryPressureObserver, nsIObserver)
class WebGLMemoryReporter MOZ_FINAL : public MemoryMultiReporter
{
public:
WebGLMemoryReporter()
: MemoryMultiReporter("webgl")
{}
NS_IMETHOD CollectReports(nsIMemoryReporterCallback* aCb,
nsISupports* aClosure);
};
NS_IMETHODIMP
WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
nsISupports* aClosure)
WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData)
{
#define REPORT(_path, _kind, _units, _amount, _desc) \
do { \
nsresult rv; \
rv = aCb->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path), _kind, \
_units, _amount, NS_LITERAL_CSTRING(_desc), \
aClosure); \
rv = aHandleReport->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path), \
_kind, _units, _amount, \
NS_LITERAL_CSTRING(_desc), aData); \
NS_ENSURE_SUCCESS(rv, rv); \
} while (0)
REPORT("webgl-texture-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryTracker::GetTextureMemoryUsed(),
KIND_OTHER, UNITS_BYTES, GetTextureMemoryUsed(),
"Memory used by WebGL textures.The OpenGL"
" implementation is free to store these textures in either video"
" memory or main memory. This measurement is only a lower bound,"
@ -45,13 +32,11 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
" is strided.");
REPORT("webgl-texture-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryTracker::GetTextureCount(),
KIND_OTHER, UNITS_COUNT, GetTextureCount(),
"Number of WebGL textures.");
REPORT("webgl-buffer-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryTracker::GetBufferMemoryUsed(),
KIND_OTHER, UNITS_BYTES, GetBufferMemoryUsed(),
"Memory used by WebGL buffers. The OpenGL"
" implementation is free to store these buffers in either video"
" memory or main memory. This measurement is only a lower bound,"
@ -59,8 +44,7 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
" is strided.");
REPORT("explicit/webgl/buffer-cache-memory",
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryTracker::GetBufferCacheMemoryUsed(),
KIND_HEAP, UNITS_BYTES, GetBufferCacheMemoryUsed(),
"Memory used by WebGL buffer caches. The WebGL"
" implementation caches the contents of element array buffers"
" only.This adds up with the webgl-buffer-memory value, but"
@ -68,13 +52,11 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
" not managed by OpenGL.");
REPORT("webgl-buffer-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryTracker::GetBufferCount(),
KIND_OTHER, UNITS_COUNT, GetBufferCount(),
"Number of WebGL buffers.");
REPORT("webgl-renderbuffer-memory",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryTracker::GetRenderbufferMemoryUsed(),
KIND_OTHER, UNITS_BYTES, GetRenderbufferMemoryUsed(),
"Memory used by WebGL renderbuffers. The OpenGL"
" implementation is free to store these renderbuffers in either"
" video memory or main memory. This measurement is only a lower"
@ -82,24 +64,20 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
" storage is strided.");
REPORT("webgl-renderbuffer-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryTracker::GetRenderbufferCount(),
KIND_OTHER, UNITS_COUNT, GetRenderbufferCount(),
"Number of WebGL renderbuffers.");
REPORT("explicit/webgl/shader",
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
WebGLMemoryTracker::GetShaderSize(),
KIND_HEAP, UNITS_BYTES, GetShaderSize(),
"Combined size of WebGL shader ASCII sources and translation"
" logs cached on the heap.");
REPORT("webgl-shader-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryTracker::GetShaderCount(),
KIND_OTHER, UNITS_COUNT, GetShaderCount(),
"Number of WebGL shaders.");
REPORT("webgl-context-count",
nsIMemoryReporter::KIND_OTHER, nsIMemoryReporter::UNITS_COUNT,
WebGLMemoryTracker::GetContextCount(),
KIND_OTHER, UNITS_COUNT, GetContextCount(),
"Number of WebGL contexts.");
#undef REPORT
@ -107,7 +85,7 @@ WebGLMemoryReporter::CollectReports(nsIMemoryReporterCallback* aCb,
return NS_OK;
}
NS_IMPL_ISUPPORTS1(WebGLMemoryTracker, nsISupports)
NS_IMPL_ISUPPORTS_INHERITED0(WebGLMemoryTracker, MemoryMultiReporter)
StaticRefPtr<WebGLMemoryTracker> WebGLMemoryTracker::sUniqueInstance;
@ -115,19 +93,25 @@ WebGLMemoryTracker* WebGLMemoryTracker::UniqueInstance()
{
if (!sUniqueInstance) {
sUniqueInstance = new WebGLMemoryTracker;
sUniqueInstance->InitMemoryReporter();
}
return sUniqueInstance;
}
WebGLMemoryTracker::WebGLMemoryTracker()
: MemoryMultiReporter("webgl")
{
mReporter = new WebGLMemoryReporter;
NS_RegisterMemoryReporter(mReporter);
}
void
WebGLMemoryTracker::InitMemoryReporter()
{
RegisterWeakMemoryReporter(this);
}
WebGLMemoryTracker::~WebGLMemoryTracker()
{
NS_UnregisterMemoryReporter(mReporter);
UnregisterWeakMemoryReporter(this);
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)

View File

@ -15,10 +15,11 @@
#include "WebGLTexture.h"
#include "WebGLRenderbuffer.h"
#include "mozilla/StaticPtr.h"
#include "nsIMemoryReporter.h"
namespace mozilla {
class WebGLMemoryTracker : public nsISupports
class WebGLMemoryTracker : public MemoryMultiReporter
{
NS_DECL_ISUPPORTS
@ -26,13 +27,13 @@ class WebGLMemoryTracker : public nsISupports
virtual ~WebGLMemoryTracker();
static StaticRefPtr<WebGLMemoryTracker> sUniqueInstance;
// here we store plain pointers, not RefPtrs: we don't want the
// Here we store plain pointers, not RefPtrs: we don't want the
// WebGLMemoryTracker unique instance to keep alive all
// WebGLContexts ever created.
typedef nsTArray<const WebGLContext*> ContextsArrayType;
ContextsArrayType mContexts;
nsCOMPtr<nsIMemoryReporter> mReporter;
void InitMemoryReporter();
static WebGLMemoryTracker* UniqueInstance();
@ -54,6 +55,10 @@ class WebGLMemoryTracker : public nsISupports
}
}
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData);
private:
static int64_t GetTextureMemoryUsed() {
const ContextsArrayType & contexts = Contexts();
int64_t result = 0;

View File

@ -8,6 +8,7 @@
#include "WebGLTexture.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "GLContext.h"
#include "ScopedGLHelpers.h"
using namespace mozilla;
using namespace mozilla::gl;
@ -17,7 +18,7 @@ DepthStencilDepthFormat(GLContext* gl) {
// We might not be able to get 24-bit, so let's pretend!
if (gl->IsGLES2() && !gl->IsExtensionSupported(gl::GLContext::OES_depth24))
return LOCAL_GL_DEPTH_COMPONENT16;
return LOCAL_GL_DEPTH_COMPONENT24;
}
@ -127,7 +128,7 @@ WebGLRenderbuffer::BindRenderbuffer() const {
* `mSecondaryRB` is used when we have to pretend that the renderbuffer is
* DEPTH_STENCIL, when it's actually one DEPTH buffer `mPrimaryRB` and one
* STENCIL buffer `mSecondaryRB`.
*
*
* In the DEPTH_STENCIL emulation case, we're actually juggling two RBs, but
* we can only bind one of them at a time. We choose to unconditionally bind
* the depth RB. When we need to ask about the stencil buffer (say, how many
@ -151,7 +152,7 @@ WebGLRenderbuffer::RenderbufferStorage(GLenum internalFormat, GLsizei width, GLs
}
gl->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER, primaryFormat, width, height);
if (!mSecondaryRB) {
MOZ_ASSERT(!secondaryFormat);
return;

View File

@ -6,6 +6,7 @@
#include "WebGLContext.h"
#include "WebGLTexture.h"
#include "GLContext.h"
#include "ScopedGLHelpers.h"
#include "WebGLTexelConversions.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include <algorithm>

View File

@ -5,4 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['public', 'src']
TEST_DIRS += ['test']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']

View File

@ -1,15 +0,0 @@
#
# 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/.
# Disabled due to timeouts.
# test_bug563329.html
ifeq (,$(filter gonk,$(MOZ_WIDGET_TOOLKIT)))
# THESE TESTS (BELOW) DO NOT RUN ON B2G
MOCHITEST_FILES += \
test_bug864040.html \
$(NULL)
# THESE TESTS (ABOVE) DO NOT RUN ON B2G
endif

View File

@ -52,6 +52,8 @@ support-files =
[test_bug547996-1.html]
[test_bug547996-2.xhtml]
[test_bug556493.html]
[test_bug563329.html]
skip-if = true # Disabled due to timeouts.
[test_bug574663.html]
[test_bug591815.html]
[test_bug593959.html]
@ -80,6 +82,8 @@ support-files =
[test_bug812744.html]
[test_bug847597.html]
[test_bug855741.html]
[test_bug864040.html]
skip-if = toolkit == "gonk"
[test_clickevent_on_input.html]
[test_continuous_wheel_events.html]
[test_dblclick_explicit_original_target.html]

View File

@ -1,10 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
MOCHITEST_MANIFESTS += ['mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']

View File

@ -128,6 +128,10 @@ const kEventConstructors = {
return new DeviceStorageChangeEvent(aName, aProps);
},
},
DownloadEvent: { create: function (aName, aProps) {
return new DownloadEvent(aName, aProps);
},
},
DOMTransactionEvent: { create: function (aName, aProps) {
return new DOMTransactionEvent(aName, aProps);
},

View File

@ -73,6 +73,12 @@ function resize() {
}
function finish() {
if (win.outerWidth != oldWidth ||
win.outerHeight != oldHeight) {
// We should eventually get back to the original size.
setTimeout(finish, 0);
return;
}
is(mozBeforeResizeHasFired, true, "The MozBeforeResize event should already have fired");
sbo.scrollBy(scrollX, scrollY);

View File

@ -111,7 +111,7 @@ HTMLAudioElement::MozSetup(uint32_t aChannels, uint32_t aRate, ErrorResult& aRv)
}
#endif
mAudioStream = AudioStream::AllocateStream();
mAudioStream = new AudioStream();
aRv = mAudioStream->Init(aChannels, aRate, mAudioChannelType, AudioStream::HighLatency);
if (aRv.Failed()) {
mAudioStream->Shutdown();

View File

@ -5,4 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['public', 'src']
TEST_DIRS += ['test']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']

View File

@ -1,74 +0,0 @@
#
# 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/.
MOCHITEST_FILES = test_bug1682.html \
test_bug1823.html \
test_bug57600.html \
test_bug196523.html \
bug196523-subframe.html \
test_bug199692.html \
bug199692-nested.html \
bug199692-nested-d2.html \
bug199692-popup.html \
bug199692-scrolled.html \
test_bug172261.html \
test_bug255820.html \
test_bug259332.html \
test_bug311681.html \
test_bug311681.xhtml \
test_bug324378.html \
test_bug332848.xhtml \
test_bug340017.xhtml \
test_bug359657.html \
test_bug369370.html \
bug369370-popup.png \
test_bug380383.html \
test_bug391777.html \
test_bug402680.html \
test_bug403868.html \
test_bug403868.xhtml \
$(filter disabled-for-timeouts, test_bug435128.html) \
test_bug463104.html \
test_form-parsing.html \
test_viewport.html \
test_documentAll.html \
test_document-element-inserted.html \
test_document.watch.html \
$(filter disabled-temporarily--bug-559932, test_bug445004.html) \
bug445004-inner.js \
bug445004-outer-rel.html \
bug445004-outer-abs.html \
bug445004-outer-write.html \
bug445004-inner.html \
test_bug446483.html \
bug446483-iframe.html \
test_bug448564.html \
bug448564-iframe-1.html \
bug448564-iframe-2.html \
bug448564-iframe-3.html \
bug448564-echo.sjs \
bug448564-submit.js \
test_bug478251.html \
test_bug481440.html \
test_bug481647.html \
test_bug482659.html \
test_bug486741.html \
test_bug489532.html \
test_bug497242.xhtml \
test_bug499092.html \
bug499092.xml \
bug499092.html \
test_bug512367.html \
test_bug677495.html \
test_bug677495-1.html \
test_bug741266.html \
test_non-ascii-cookie.html \
test_non-ascii-cookie.html^headers^ \
test_bug765780.html \
test_bug871161.html \
file_bug871161-1.html \
file_bug871161-2.html \
$(NULL)

View File

@ -0,0 +1,71 @@
[DEFAULT]
support-files =
bug196523-subframe.html
bug199692-nested.html
bug199692-nested-d2.html
bug199692-popup.html
bug199692-scrolled.html
bug369370-popup.png
bug445004-inner.js
bug445004-outer-rel.html
bug445004-outer-abs.html
bug445004-outer-write.html
bug445004-inner.html
bug446483-iframe.html
bug448564-iframe-1.html
bug448564-iframe-2.html
bug448564-iframe-3.html
bug448564-echo.sjs
bug448564-submit.js
bug499092.xml
bug499092.html
test_non-ascii-cookie.html^headers^
[test_bug1682.html]
[test_bug1823.html]
[test_bug57600.html]
[test_bug196523.html]
[test_bug199692.html]
[test_bug172261.html]
[test_bug255820.html]
[test_bug259332.html]
[test_bug311681.html]
[test_bug311681.xhtml]
[test_bug324378.html]
[test_bug332848.xhtml]
[test_bug340017.xhtml]
[test_bug359657.html]
[test_bug369370.html]
[test_bug380383.html]
[test_bug391777.html]
[test_bug402680.html]
[test_bug403868.html]
[test_bug403868.xhtml]
[test_bug435128.html]
skip-if = true # Disabled for timeouts.
[test_bug463104.html]
[test_form-parsing.html]
[test_viewport.html]
[test_documentAll.html]
[test_document-element-inserted.html]
[test_document.watch.html]
[test_bug445004.html]
skip-if = true # Disabled permanently (bug 559932).
[test_bug446483.html]
[test_bug448564.html]
[test_bug478251.html]
[test_bug481440.html]
[test_bug481647.html]
[test_bug482659.html]
[test_bug486741.html]
[test_bug489532.html]
[test_bug497242.xhtml]
[test_bug499092.html]
[test_bug512367.html]
[test_bug677495.html]
[test_bug677495-1.html]
[test_bug741266.html]
[test_non-ascii-cookie.html]
[test_bug765780.html]
[test_bug871161.html]
support-files = file_bug871161-1.html file_bug871161-2.html

View File

@ -16,104 +16,91 @@
#include "soundtouch/SoundTouch.h"
#include "Latency.h"
#if defined(MOZ_CUBEB)
#include "nsAutoRef.h"
#include "cubeb/cubeb.h"
template <>
class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
{
public:
static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
};
#endif
namespace mozilla {
#ifdef PR_LOGGING
PRLogModuleInfo* gAudioStreamLog = nullptr;
#endif
#define PREF_VOLUME_SCALE "media.volume_scale"
#define PREF_CUBEB_LATENCY "media.cubeb_latency_ms"
static Mutex* gAudioPrefsLock = nullptr;
static double gVolumeScale;
static uint32_t gCubebLatency;
static bool gCubebLatencyPrefSet;
static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100;
StaticMutex AudioStream::mMutex;
uint32_t AudioStream::mPreferredSampleRate = 0;
/**
* When MOZ_DUMP_AUDIO is set in the environment (to anything),
* we'll drop a series of files in the current working directory named
* dumped-audio-<nnn>.wav, one per nsBufferedAudioStream created, containing
* dumped-audio-<nnn>.wav, one per AudioStream created, containing
* the audio for the stream including any skips due to underruns.
*/
#if defined(MOZ_CUBEB)
static int gDumpedAudioCount = 0;
#endif
static int PrefChanged(const char* aPref, void* aClosure)
#define PREF_VOLUME_SCALE "media.volume_scale"
#define PREF_CUBEB_LATENCY "media.cubeb_latency_ms"
static const uint32_t CUBEB_NORMAL_LATENCY_MS = 100;
StaticMutex AudioStream::sMutex;
cubeb* AudioStream::sCubebContext;
uint32_t AudioStream::sPreferredSampleRate;
double AudioStream::sVolumeScale;
uint32_t AudioStream::sCubebLatency;
bool AudioStream::sCubebLatencyPrefSet;
/*static*/ int AudioStream::PrefChanged(const char* aPref, void* aClosure)
{
if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {
nsAdoptingString value = Preferences::GetString(aPref);
MutexAutoLock lock(*gAudioPrefsLock);
StaticMutexAutoLock lock(sMutex);
if (value.IsEmpty()) {
gVolumeScale = 1.0;
sVolumeScale = 1.0;
} else {
NS_ConvertUTF16toUTF8 utf8(value);
gVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));
sVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));
}
} else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {
// Arbitrary default stream latency of 100ms. The higher this
// value, the longer stream volume changes will take to become
// audible.
gCubebLatencyPrefSet = Preferences::HasUserValue(aPref);
sCubebLatencyPrefSet = Preferences::HasUserValue(aPref);
uint32_t value = Preferences::GetUint(aPref, CUBEB_NORMAL_LATENCY_MS);
MutexAutoLock lock(*gAudioPrefsLock);
gCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 1), 1000);
StaticMutexAutoLock lock(sMutex);
sCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 1), 1000);
}
return 0;
}
#if defined(MOZ_CUBEB)
static double GetVolumeScale()
/*static*/ double AudioStream::GetVolumeScale()
{
MutexAutoLock lock(*gAudioPrefsLock);
return gVolumeScale;
StaticMutexAutoLock lock(sMutex);
return sVolumeScale;
}
static cubeb* gCubebContext;
static cubeb* GetCubebContext()
/*static*/ cubeb* AudioStream::GetCubebContext()
{
MutexAutoLock lock(*gAudioPrefsLock);
if (gCubebContext ||
cubeb_init(&gCubebContext, "AudioStream") == CUBEB_OK) {
return gCubebContext;
StaticMutexAutoLock lock(sMutex);
return GetCubebContextUnlocked();
}
/*static*/ cubeb* AudioStream::GetCubebContextUnlocked()
{
sMutex.AssertCurrentThreadOwns();
if (sCubebContext ||
cubeb_init(&sCubebContext, "AudioStream") == CUBEB_OK) {
return sCubebContext;
}
NS_WARNING("cubeb_init failed");
return nullptr;
}
static uint32_t GetCubebLatency()
/*static*/ uint32_t AudioStream::GetCubebLatency()
{
MutexAutoLock lock(*gAudioPrefsLock);
return gCubebLatency;
StaticMutexAutoLock lock(sMutex);
return sCubebLatency;
}
static bool CubebLatencyPrefSet()
/*static*/ bool AudioStream::CubebLatencyPrefSet()
{
MutexAutoLock lock(*gAudioPrefsLock);
return gCubebLatencyPrefSet;
StaticMutexAutoLock lock(sMutex);
return sCubebLatencyPrefSet;
}
#endif
#if defined(MOZ_CUBEB) && defined(__ANDROID__) && defined(MOZ_B2G)
#if defined(__ANDROID__) && defined(MOZ_B2G)
static cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannelType aType)
{
switch(aType) {
@ -139,52 +126,64 @@ static cubeb_stream_type ConvertChannelToCubebType(dom::AudioChannelType aType)
#endif
AudioStream::AudioStream()
: mInRate(0),
mOutRate(0),
mChannels(0),
mWritten(0),
mAudioClock(MOZ_THIS_IN_INITIALIZER_LIST()),
mLatencyRequest(HighLatency),
mReadPoint(0)
{}
void AudioStream::InitLibrary()
: mMonitor("AudioStream")
, mInRate(0)
, mOutRate(0)
, mChannels(0)
, mWritten(0)
, mAudioClock(MOZ_THIS_IN_INITIALIZER_LIST())
, mLatencyRequest(HighLatency)
, mReadPoint(0)
, mLostFrames(0)
, mDumpFile(nullptr)
, mVolume(1.0)
, mBytesPerFrame(0)
, mState(INITIALIZED)
{
#ifdef PR_LOGGING
gAudioStreamLog = PR_NewLogModule("AudioStream");
#endif
gAudioPrefsLock = new Mutex("AudioStream::gAudioPrefsLock");
PrefChanged(PREF_VOLUME_SCALE, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE);
#if defined(MOZ_CUBEB)
PrefChanged(PREF_CUBEB_LATENCY, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
#endif
}
void AudioStream::ShutdownLibrary()
{
Preferences::UnregisterCallback(PrefChanged, PREF_VOLUME_SCALE);
#if defined(MOZ_CUBEB)
Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
#endif
delete gAudioPrefsLock;
gAudioPrefsLock = nullptr;
#if defined(MOZ_CUBEB)
if (gCubebContext) {
cubeb_destroy(gCubebContext);
gCubebContext = nullptr;
}
#endif
// keep a ref in case we shut down later than nsLayoutStatics
mLatencyLog = AsyncLatencyLogger::Get(true);
}
AudioStream::~AudioStream()
{
Shutdown();
if (mDumpFile) {
fclose(mDumpFile);
}
}
/*static*/ void AudioStream::InitLibrary()
{
#ifdef PR_LOGGING
gAudioStreamLog = PR_NewLogModule("AudioStream");
#endif
PrefChanged(PREF_VOLUME_SCALE, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_VOLUME_SCALE);
PrefChanged(PREF_CUBEB_LATENCY, nullptr);
Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
}
/*static*/ void AudioStream::ShutdownLibrary()
{
Preferences::UnregisterCallback(PrefChanged, PREF_VOLUME_SCALE);
Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_LATENCY);
StaticMutexAutoLock lock(sMutex);
if (sCubebContext) {
cubeb_destroy(sCubebContext);
sCubebContext = nullptr;
}
}
nsresult AudioStream::EnsureTimeStretcherInitialized()
{
MonitorAutoLock mon(mMonitor);
return EnsureTimeStretcherInitializedUnlocked();
}
nsresult AudioStream::EnsureTimeStretcherInitializedUnlocked()
{
mMonitor.AssertCurrentThreadOwns();
if (!mTimeStretcher) {
// SoundTouch does not support a number of channels > 2
if (mChannels > 2) {
@ -214,7 +213,6 @@ nsresult AudioStream::SetPlaybackRate(double aPlaybackRate)
mAudioClock.SetPlaybackRate(aPlaybackRate);
mOutRate = mInRate / aPlaybackRate;
if (mAudioClock.GetPreservesPitch()) {
mTimeStretcher->setTempo(aPlaybackRate);
mTimeStretcher->setRate(1.0f);
@ -254,224 +252,43 @@ int64_t AudioStream::GetWritten()
return mWritten;
}
#if defined(MOZ_CUBEB)
class nsCircularByteBuffer
/*static*/ int AudioStream::MaxNumberOfChannels()
{
public:
nsCircularByteBuffer()
: mBuffer(nullptr), mCapacity(0), mStart(0), mCount(0)
{}
// Set the capacity of the buffer in bytes. Must be called before any
// call to append or pop elements.
void SetCapacity(uint32_t aCapacity) {
NS_ABORT_IF_FALSE(!mBuffer, "Buffer allocated.");
mCapacity = aCapacity;
mBuffer = new uint8_t[mCapacity];
}
uint32_t Length() {
return mCount;
}
uint32_t Capacity() {
return mCapacity;
}
uint32_t Available() {
return Capacity() - Length();
}
// Append aLength bytes from aSrc to the buffer. Caller must check that
// sufficient space is available.
void AppendElements(const uint8_t* aSrc, uint32_t aLength) {
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
NS_ABORT_IF_FALSE(aLength <= Available(), "Buffer full.");
uint32_t end = (mStart + mCount) % mCapacity;
uint32_t toCopy = std::min(mCapacity - end, aLength);
memcpy(&mBuffer[end], aSrc, toCopy);
memcpy(&mBuffer[0], aSrc + toCopy, aLength - toCopy);
mCount += aLength;
}
// Remove aSize bytes from the buffer. Caller must check returned size in
// aSize{1,2} before using the pointer returned in aData{1,2}. Caller
// must not specify an aSize larger than Length().
void PopElements(uint32_t aSize, void** aData1, uint32_t* aSize1,
void** aData2, uint32_t* aSize2) {
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
NS_ABORT_IF_FALSE(aSize <= Length(), "Request too large.");
*aData1 = &mBuffer[mStart];
*aSize1 = std::min(mCapacity - mStart, aSize);
*aData2 = &mBuffer[0];
*aSize2 = aSize - *aSize1;
mCount -= *aSize1 + *aSize2;
mStart += *aSize1 + *aSize2;
mStart %= mCapacity;
}
private:
nsAutoArrayPtr<uint8_t> mBuffer;
uint32_t mCapacity;
uint32_t mStart;
uint32_t mCount;
};
class BufferedAudioStream : public AudioStream
{
public:
BufferedAudioStream();
~BufferedAudioStream();
nsresult Init(int32_t aNumChannels, int32_t aRate,
const dom::AudioChannelType aAudioChannelType,
AudioStream::LatencyRequest aLatencyRequest);
void Shutdown();
nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTime = nullptr);
uint32_t Available();
void SetVolume(double aVolume);
void Drain();
void Start();
void Pause();
void Resume();
int64_t GetPosition();
int64_t GetPositionInFrames();
int64_t GetPositionInFramesInternal();
int64_t GetLatencyInFrames();
bool IsPaused();
void GetBufferInsertTime(int64_t &aTimeMs);
// This method acquires the monitor and forward the call to the base
// class, to prevent a race on |mTimeStretcher|, in
// |AudioStream::EnsureTimeStretcherInitialized|.
nsresult EnsureTimeStretcherInitialized();
private:
static long DataCallback_S(cubeb_stream*, void* aThis, void* aBuffer, long aFrames)
{
return static_cast<BufferedAudioStream*>(aThis)->DataCallback(aBuffer, aFrames);
}
static void StateCallback_S(cubeb_stream*, void* aThis, cubeb_state aState)
{
static_cast<BufferedAudioStream*>(aThis)->StateCallback(aState);
}
long DataCallback(void* aBuffer, long aFrames);
void StateCallback(cubeb_state aState);
// aTime is the time in ms the samples were inserted into MediaStreamGraph
long GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTime);
long GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTime);
long GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t &aTime);
// Shared implementation of underflow adjusted position calculation.
// Caller must own the monitor.
int64_t GetPositionInFramesUnlocked();
void StartUnlocked();
// The monitor is held to protect all access to member variables. Write()
// waits while mBuffer is full; DataCallback() notifies as it consumes
// data from mBuffer. Drain() waits while mState is DRAINING;
// StateCallback() notifies when mState is DRAINED.
Monitor mMonitor;
// Sum of silent frames written when DataCallback requests more frames
// than are available in mBuffer.
uint64_t mLostFrames;
// Output file for dumping audio
FILE* mDumpFile;
// Temporary audio buffer. Filled by Write() and consumed by
// DataCallback(). Once mBuffer is full, Write() blocks until sufficient
// space becomes available in mBuffer. mBuffer is sized in bytes, not
// frames.
nsCircularByteBuffer mBuffer;
// Software volume level. Applied during the servicing of DataCallback().
double mVolume;
// Owning reference to a cubeb_stream. cubeb_stream_destroy is called by
// nsAutoRef's destructor.
nsAutoRef<cubeb_stream> mCubebStream;
uint32_t mBytesPerFrame;
uint32_t BytesToFrames(uint32_t aBytes) {
NS_ASSERTION(aBytes % mBytesPerFrame == 0,
"Byte count not aligned on frames size.");
return aBytes / mBytesPerFrame;
}
uint32_t FramesToBytes(uint32_t aFrames) {
return aFrames * mBytesPerFrame;
}
enum StreamState {
INITIALIZED, // Initialized, playback has not begun.
STARTED, // Started by a call to Write() (iff INITIALIZED) or Resume().
STOPPED, // Stopped by a call to Pause().
DRAINING, // Drain requested. DataCallback will indicate end of stream
// once the remaining contents of mBuffer are requested by
// cubeb, after which StateCallback will indicate drain
// completion.
DRAINED, // StateCallback has indicated that the drain is complete.
ERRORED // Stream disabled due to an internal error.
};
StreamState mState;
};
#endif
AudioStream* AudioStream::AllocateStream()
{
#if defined(MOZ_CUBEB)
return new BufferedAudioStream();
#endif
return nullptr;
}
int AudioStream::MaxNumberOfChannels()
{
#if defined(MOZ_CUBEB)
cubeb* cubebContext = GetCubebContext();
uint32_t maxNumberOfChannels;
if (cubeb_get_max_channel_count(GetCubebContext(),
if (cubebContext &&
cubeb_get_max_channel_count(cubebContext,
&maxNumberOfChannels) == CUBEB_OK) {
return static_cast<int>(maxNumberOfChannels);
}
#endif
return 0;
}
int AudioStream::PreferredSampleRate()
/*static*/ int AudioStream::PreferredSampleRate()
{
StaticMutexAutoLock lock(AudioStream::mMutex);
const int fallbackSampleRate = 44100;
StaticMutexAutoLock lock(sMutex);
if (sPreferredSampleRate != 0) {
return sPreferredSampleRate;
}
cubeb* cubebContext = GetCubebContextUnlocked();
if (!cubebContext) {
sPreferredSampleRate = fallbackSampleRate;
}
// Get the preferred samplerate for this platform, or fallback to something
// sensible if we fail. We cache the value, because this might be accessed
// often, and the complexity of the function call below depends on the
// backend used.
const int fallbackSampleRate = 44100;
if (mPreferredSampleRate == 0) {
#if defined(MOZ_CUBEB)
if (cubeb_get_preferred_sample_rate(GetCubebContext(),
&mPreferredSampleRate) == CUBEB_OK) {
return mPreferredSampleRate;
}
#endif
mPreferredSampleRate = fallbackSampleRate;
if (cubeb_get_preferred_sample_rate(cubebContext,
&sPreferredSampleRate) != CUBEB_OK) {
sPreferredSampleRate = fallbackSampleRate;
}
return mPreferredSampleRate;
return sPreferredSampleRate;
}
#if defined(MOZ_CUBEB)
static void SetUint16LE(uint8_t* aDest, uint16_t aValue)
{
aDest[0] = aValue & 0xFF;
@ -541,33 +358,10 @@ WriteDumpFile(FILE* aDumpFile, AudioStream* aStream, uint32_t aFrames,
fflush(aDumpFile);
}
BufferedAudioStream::BufferedAudioStream()
: mMonitor("BufferedAudioStream"), mLostFrames(0), mDumpFile(nullptr),
mVolume(1.0), mBytesPerFrame(0), mState(INITIALIZED)
{
// keep a ref in case we shut down later than nsLayoutStatics
mLatencyLog = AsyncLatencyLogger::Get(true);
}
BufferedAudioStream::~BufferedAudioStream()
{
Shutdown();
if (mDumpFile) {
fclose(mDumpFile);
}
}
nsresult
BufferedAudioStream::EnsureTimeStretcherInitialized()
{
MonitorAutoLock mon(mMonitor);
return AudioStream::EnsureTimeStretcherInitialized();
}
nsresult
BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
const dom::AudioChannelType aAudioChannelType,
AudioStream::LatencyRequest aLatencyRequest)
AudioStream::Init(int32_t aNumChannels, int32_t aRate,
const dom::AudioChannelType aAudioChannelType,
LatencyRequest aLatencyRequest)
{
cubeb* cubebContext = GetCubebContext();
@ -610,7 +404,7 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
// for low latency playback, try to get the lowest latency possible.
// Otherwise, for normal streams, use 100ms.
uint32_t latency;
if (aLatencyRequest == AudioStream::LowLatency && !CubebLatencyPrefSet()) {
if (aLatencyRequest == LowLatency && !CubebLatencyPrefSet()) {
if (cubeb_get_min_latency(cubebContext, params, &latency) != CUBEB_OK) {
latency = GetCubebLatency();
}
@ -620,7 +414,7 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
{
cubeb_stream* stream;
if (cubeb_stream_init(cubebContext, &stream, "BufferedAudioStream", params,
if (cubeb_stream_init(cubebContext, &stream, "AudioStream", params,
latency, DataCallback_S, StateCallback_S, this) == CUBEB_OK) {
mCubebStream.own(stream);
}
@ -639,8 +433,8 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
// Start the stream right away when low latency has been requested. This means
// that the DataCallback will feed silence to cubeb, until the first frames
// are writtent to this BufferedAudioStream.
if (mLatencyRequest == AudioStream::LowLatency) {
// are writtent to this AudioStream.
if (mLatencyRequest == LowLatency) {
Start();
}
@ -648,7 +442,7 @@ BufferedAudioStream::Init(int32_t aNumChannels, int32_t aRate,
}
void
BufferedAudioStream::Shutdown()
AudioStream::Shutdown()
{
if (mState == STARTED) {
Pause();
@ -660,7 +454,7 @@ BufferedAudioStream::Shutdown()
// aTime is the time in ms the samples were inserted into MediaStreamGraph
nsresult
BufferedAudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTime)
AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTime)
{
MonitorAutoLock mon(mMonitor);
if (!mCubebStream || mState == ERRORED) {
@ -715,7 +509,7 @@ BufferedAudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeSta
}
uint32_t
BufferedAudioStream::Available()
AudioStream::Available()
{
MonitorAutoLock mon(mMonitor);
NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated.");
@ -723,7 +517,7 @@ BufferedAudioStream::Available()
}
void
BufferedAudioStream::SetVolume(double aVolume)
AudioStream::SetVolume(double aVolume)
{
MonitorAutoLock mon(mMonitor);
NS_ABORT_IF_FALSE(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume");
@ -731,7 +525,7 @@ BufferedAudioStream::SetVolume(double aVolume)
}
void
BufferedAudioStream::Drain()
AudioStream::Drain()
{
MonitorAutoLock mon(mMonitor);
if (mState != STARTED) {
@ -745,14 +539,14 @@ BufferedAudioStream::Drain()
}
void
BufferedAudioStream::Start()
AudioStream::Start()
{
MonitorAutoLock mon(mMonitor);
StartUnlocked();
}
void
BufferedAudioStream::StartUnlocked()
AudioStream::StartUnlocked()
{
mMonitor.AssertCurrentThreadOwns();
if (!mCubebStream || mState != INITIALIZED) {
@ -771,7 +565,7 @@ BufferedAudioStream::StartUnlocked()
}
void
BufferedAudioStream::Pause()
AudioStream::Pause()
{
MonitorAutoLock mon(mMonitor);
if (!mCubebStream || mState != STARTED) {
@ -789,7 +583,7 @@ BufferedAudioStream::Pause()
}
void
BufferedAudioStream::Resume()
AudioStream::Resume()
{
MonitorAutoLock mon(mMonitor);
if (!mCubebStream || mState != STOPPED) {
@ -807,7 +601,7 @@ BufferedAudioStream::Resume()
}
int64_t
BufferedAudioStream::GetPosition()
AudioStream::GetPosition()
{
return mAudioClock.GetPosition();
}
@ -817,7 +611,7 @@ BufferedAudioStream::GetPosition()
#pragma optimize("", off)
#endif
int64_t
BufferedAudioStream::GetPositionInFrames()
AudioStream::GetPositionInFrames()
{
return mAudioClock.GetPositionInFrames();
}
@ -826,14 +620,14 @@ BufferedAudioStream::GetPositionInFrames()
#endif
int64_t
BufferedAudioStream::GetPositionInFramesInternal()
AudioStream::GetPositionInFramesInternal()
{
MonitorAutoLock mon(mMonitor);
return GetPositionInFramesUnlocked();
}
int64_t
BufferedAudioStream::GetPositionInFramesUnlocked()
AudioStream::GetPositionInFramesUnlocked()
{
mMonitor.AssertCurrentThreadOwns();
@ -859,10 +653,10 @@ BufferedAudioStream::GetPositionInFramesUnlocked()
}
int64_t
BufferedAudioStream::GetLatencyInFrames()
AudioStream::GetLatencyInFrames()
{
uint32_t latency;
if(cubeb_stream_get_latency(mCubebStream, &latency)) {
if (cubeb_stream_get_latency(mCubebStream, &latency)) {
NS_WARNING("Could not get cubeb latency.");
return 0;
}
@ -870,14 +664,14 @@ BufferedAudioStream::GetLatencyInFrames()
}
bool
BufferedAudioStream::IsPaused()
AudioStream::IsPaused()
{
MonitorAutoLock mon(mMonitor);
return mState == STOPPED;
}
void
BufferedAudioStream::GetBufferInsertTime(int64_t &aTimeMs)
AudioStream::GetBufferInsertTime(int64_t &aTimeMs)
{
if (mInserts.Length() > 0) {
// Find the right block, but don't leave the array empty
@ -894,7 +688,7 @@ BufferedAudioStream::GetBufferInsertTime(int64_t &aTimeMs)
}
long
BufferedAudioStream::GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTimeMs)
AudioStream::GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTimeMs)
{
uint8_t* wpos = reinterpret_cast<uint8_t*>(aBuffer);
@ -925,7 +719,7 @@ BufferedAudioStream::GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTimeM
// Get unprocessed samples, and pad the beginning of the buffer with silence if
// there is not enough data.
long
BufferedAudioStream::GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t& aTimeMs)
AudioStream::GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t& aTimeMs)
{
uint32_t toPopBytes = FramesToBytes(aFrames);
uint32_t available = std::min(toPopBytes, mBuffer.Length());
@ -949,12 +743,12 @@ BufferedAudioStream::GetUnprocessedWithSilencePadding(void* aBuffer, long aFrame
}
long
BufferedAudioStream::GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTimeMs)
AudioStream::GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTimeMs)
{
long processedFrames = 0;
// We need to call the non-locking version, because we already have the lock.
if (AudioStream::EnsureTimeStretcherInitialized() != NS_OK) {
if (EnsureTimeStretcherInitializedUnlocked() != NS_OK) {
return 0;
}
@ -990,7 +784,7 @@ BufferedAudioStream::GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTim
}
long
BufferedAudioStream::DataCallback(void* aBuffer, long aFrames)
AudioStream::DataCallback(void* aBuffer, long aFrames)
{
MonitorAutoLock mon(mMonitor);
uint32_t available = std::min(static_cast<uint32_t>(FramesToBytes(aFrames)), mBuffer.Length());
@ -1006,7 +800,7 @@ BufferedAudioStream::DataCallback(void* aBuffer, long aFrames)
// underrun at the beginning of the buffer, so the first buffer is not cut
// in half by the silence inserted to compensate for the underrun.
if (mInRate == mOutRate) {
if (mLatencyRequest == AudioStream::LowLatency && !mWritten) {
if (mLatencyRequest == LowLatency && !mWritten) {
servicedFrames = GetUnprocessedWithSilencePadding(output, aFrames, insertTime);
} else {
servicedFrames = GetUnprocessed(output, aFrames, insertTime);
@ -1060,7 +854,7 @@ BufferedAudioStream::DataCallback(void* aBuffer, long aFrames)
}
void
BufferedAudioStream::StateCallback(cubeb_state aState)
AudioStream::StateCallback(cubeb_state aState)
{
MonitorAutoLock mon(mMonitor);
if (aState == CUBEB_STATE_DRAINED) {
@ -1071,8 +865,6 @@ BufferedAudioStream::StateCallback(cubeb_state aState)
mon.NotifyAll();
}
#endif
AudioClock::AudioClock(AudioStream* aStream)
:mAudioStream(aStream),
mOldOutRate(0),

View File

@ -9,10 +9,20 @@
#include "AudioSampleFormat.h"
#include "AudioChannelCommon.h"
#include "nsAutoPtr.h"
#include "nsAutoRef.h"
#include "nsCOMPtr.h"
#include "Latency.h"
#include "mozilla/StaticMutex.h"
#include "cubeb/cubeb.h"
template <>
class nsAutoRefTraits<cubeb_stream> : public nsPointerRefTraits<cubeb_stream>
{
public:
static void Release(cubeb_stream* aStream) { cubeb_stream_destroy(aStream); }
};
namespace soundtouch {
class SoundTouch;
}
@ -23,84 +33,141 @@ class AudioStream;
class AudioClock
{
public:
AudioClock(mozilla::AudioStream* aStream);
// Initialize the clock with the current AudioStream. Need to be called
// before querying the clock. Called on the audio thread.
void Init();
// Update the number of samples that has been written in the audio backend.
// Called on the state machine thread.
void UpdateWritePosition(uint32_t aCount);
// Get the read position of the stream, in microseconds.
// Called on the state machine thead.
uint64_t GetPosition();
// Get the read position of the stream, in frames.
// Called on the state machine thead.
uint64_t GetPositionInFrames();
// Set the playback rate.
// Called on the audio thread.
void SetPlaybackRate(double aPlaybackRate);
// Get the current playback rate.
// Called on the audio thread.
double GetPlaybackRate();
// Set if we are preserving the pitch.
// Called on the audio thread.
void SetPreservesPitch(bool aPreservesPitch);
// Get the current pitch preservation state.
// Called on the audio thread.
bool GetPreservesPitch();
// Get the number of frames written to the backend.
int64_t GetWritten();
private:
// This AudioStream holds a strong reference to this AudioClock. This
// pointer is garanteed to always be valid.
AudioStream* mAudioStream;
// The old output rate, to compensate audio latency for the period inbetween
// the moment resampled buffers are pushed to the hardware and the moment the
// clock should take the new rate into account for A/V sync.
int mOldOutRate;
// Position at which the last playback rate change occured
int64_t mBasePosition;
// Offset, in frames, at which the last playback rate change occured
int64_t mBaseOffset;
// Old base offset (number of samples), used when changing rate to compute the
// position in the stream.
int64_t mOldBaseOffset;
// Old base position (number of microseconds), when changing rate. This is the
// time in the media, not wall clock position.
int64_t mOldBasePosition;
// Write position at which the playbackRate change occured.
int64_t mPlaybackRateChangeOffset;
// The previous position reached in the media, used when compensating
// latency, to have the position at which the playbackRate change occured.
int64_t mPreviousPosition;
// Number of samples effectivelly written in backend, i.e. write position.
int64_t mWritten;
// Output rate in Hz (characteristic of the playback rate)
int mOutRate;
// Input rate in Hz (characteristic of the media being played)
int mInRate;
// True if the we are timestretching, false if we are resampling.
bool mPreservesPitch;
// True if we are playing at the old playbackRate after it has been changed.
bool mCompensatingLatency;
public:
AudioClock(AudioStream* aStream);
// Initialize the clock with the current AudioStream. Need to be called
// before querying the clock. Called on the audio thread.
void Init();
// Update the number of samples that has been written in the audio backend.
// Called on the state machine thread.
void UpdateWritePosition(uint32_t aCount);
// Get the read position of the stream, in microseconds.
// Called on the state machine thead.
uint64_t GetPosition();
// Get the read position of the stream, in frames.
// Called on the state machine thead.
uint64_t GetPositionInFrames();
// Set the playback rate.
// Called on the audio thread.
void SetPlaybackRate(double aPlaybackRate);
// Get the current playback rate.
// Called on the audio thread.
double GetPlaybackRate();
// Set if we are preserving the pitch.
// Called on the audio thread.
void SetPreservesPitch(bool aPreservesPitch);
// Get the current pitch preservation state.
// Called on the audio thread.
bool GetPreservesPitch();
// Get the number of frames written to the backend.
int64_t GetWritten();
private:
// This AudioStream holds a strong reference to this AudioClock. This
// pointer is garanteed to always be valid.
AudioStream* mAudioStream;
// The old output rate, to compensate audio latency for the period inbetween
// the moment resampled buffers are pushed to the hardware and the moment the
// clock should take the new rate into account for A/V sync.
int mOldOutRate;
// Position at which the last playback rate change occured
int64_t mBasePosition;
// Offset, in frames, at which the last playback rate change occured
int64_t mBaseOffset;
// Old base offset (number of samples), used when changing rate to compute the
// position in the stream.
int64_t mOldBaseOffset;
// Old base position (number of microseconds), when changing rate. This is the
// time in the media, not wall clock position.
int64_t mOldBasePosition;
// Write position at which the playbackRate change occured.
int64_t mPlaybackRateChangeOffset;
// The previous position reached in the media, used when compensating
// latency, to have the position at which the playbackRate change occured.
int64_t mPreviousPosition;
// Number of samples effectivelly written in backend, i.e. write position.
int64_t mWritten;
// Output rate in Hz (characteristic of the playback rate)
int mOutRate;
// Input rate in Hz (characteristic of the media being played)
int mInRate;
// True if the we are timestretching, false if we are resampling.
bool mPreservesPitch;
// True if we are playing at the old playbackRate after it has been changed.
bool mCompensatingLatency;
};
class CircularByteBuffer
{
public:
CircularByteBuffer()
: mBuffer(nullptr), mCapacity(0), mStart(0), mCount(0)
{}
// Set the capacity of the buffer in bytes. Must be called before any
// call to append or pop elements.
void SetCapacity(uint32_t aCapacity) {
NS_ABORT_IF_FALSE(!mBuffer, "Buffer allocated.");
mCapacity = aCapacity;
mBuffer = new uint8_t[mCapacity];
}
uint32_t Length() {
return mCount;
}
uint32_t Capacity() {
return mCapacity;
}
uint32_t Available() {
return Capacity() - Length();
}
// Append aLength bytes from aSrc to the buffer. Caller must check that
// sufficient space is available.
void AppendElements(const uint8_t* aSrc, uint32_t aLength) {
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
NS_ABORT_IF_FALSE(aLength <= Available(), "Buffer full.");
uint32_t end = (mStart + mCount) % mCapacity;
uint32_t toCopy = std::min(mCapacity - end, aLength);
memcpy(&mBuffer[end], aSrc, toCopy);
memcpy(&mBuffer[0], aSrc + toCopy, aLength - toCopy);
mCount += aLength;
}
// Remove aSize bytes from the buffer. Caller must check returned size in
// aSize{1,2} before using the pointer returned in aData{1,2}. Caller
// must not specify an aSize larger than Length().
void PopElements(uint32_t aSize, void** aData1, uint32_t* aSize1,
void** aData2, uint32_t* aSize2) {
NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized.");
NS_ABORT_IF_FALSE(aSize <= Length(), "Request too large.");
*aData1 = &mBuffer[mStart];
*aSize1 = std::min(mCapacity - mStart, aSize);
*aData2 = &mBuffer[0];
*aSize2 = aSize - *aSize1;
mCount -= *aSize1 + *aSize2;
mStart += *aSize1 + *aSize2;
mStart %= mCapacity;
}
private:
nsAutoArrayPtr<uint8_t> mBuffer;
uint32_t mCapacity;
uint32_t mStart;
uint32_t mCount;
};
// Access to a single instance of this class must be synchronized by
// callers, or made from a single thread. One exception is that access to
// GetPosition, GetPositionInFrames, SetVolume, and Get{Rate,Channels}
// is thread-safe without external synchronization.
class AudioStream
class AudioStream MOZ_FINAL
{
public:
enum LatencyRequest {
HighLatency,
LowLatency
};
AudioStream();
virtual ~AudioStream();
// Initialize Audio Library. Some Audio backends require initializing the
// library before using it.
static void InitLibrary();
@ -109,11 +176,6 @@ public:
// library after using it.
static void ShutdownLibrary();
// AllocateStream will return either a local stream or a remoted stream
// depending on where you call it from. If you call this from a child process,
// you may receive an implementation which forwards to a compositing process.
static AudioStream* AllocateStream();
// Returns the maximum number of channels supported by the audio hardware.
static int MaxNumberOfChannels();
@ -121,79 +183,124 @@ public:
// samplerate the hardware/mixer supports.
static int PreferredSampleRate();
AudioStream();
~AudioStream();
enum LatencyRequest {
HighLatency,
LowLatency
};
// Initialize the audio stream. aNumChannels is the number of audio
// channels (1 for mono, 2 for stereo, etc) and aRate is the sample rate
// (22050Hz, 44100Hz, etc).
virtual nsresult Init(int32_t aNumChannels, int32_t aRate,
const dom::AudioChannelType aAudioStreamType,
LatencyRequest aLatencyRequest) = 0;
nsresult Init(int32_t aNumChannels, int32_t aRate,
const dom::AudioChannelType aAudioStreamType,
LatencyRequest aLatencyRequest);
// Closes the stream. All future use of the stream is an error.
virtual void Shutdown() = 0;
void Shutdown();
// Write audio data to the audio hardware. aBuf is an array of AudioDataValues
// AudioDataValue of length aFrames*mChannels. If aFrames is larger
// than the result of Available(), the write will block until sufficient
// buffer space is available. aTime is the time in ms associated with the first sample
// for latency calculations
virtual nsresult Write(const mozilla::AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTime = nullptr) = 0;
nsresult Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp* aTime = nullptr);
// Return the number of audio frames that can be written without blocking.
virtual uint32_t Available() = 0;
uint32_t Available();
// Set the current volume of the audio playback. This is a value from
// 0 (meaning muted) to 1 (meaning full volume). Thread-safe.
virtual void SetVolume(double aVolume) = 0;
void SetVolume(double aVolume);
// Block until buffered audio data has been consumed.
virtual void Drain() = 0;
void Drain();
// Start the stream.
virtual void Start() = 0;
void Start();
// Return the number of frames written so far in the stream. This allow the
// caller to check if it is safe to start the stream, if needed.
virtual int64_t GetWritten();
int64_t GetWritten();
// Pause audio playback.
virtual void Pause() = 0;
void Pause();
// Resume audio playback.
virtual void Resume() = 0;
void Resume();
// Return the position in microseconds of the audio frame being played by
// the audio hardware, compensated for playback rate change. Thread-safe.
virtual int64_t GetPosition() = 0;
int64_t GetPosition();
// Return the position, measured in audio frames played since the stream
// was opened, of the audio hardware. Thread-safe.
virtual int64_t GetPositionInFrames() = 0;
int64_t GetPositionInFrames();
// Return the position, measured in audio framed played since the stream was
// opened, of the audio hardware, not adjusted for the changes of playback
// rate.
virtual int64_t GetPositionInFramesInternal() = 0;
int64_t GetPositionInFramesInternal();
// Returns true when the audio stream is paused.
virtual bool IsPaused() = 0;
bool IsPaused();
int GetRate() { return mOutRate; }
int GetChannels() { return mChannels; }
// This should be called before attempting to use the time stretcher.
virtual nsresult EnsureTimeStretcherInitialized();
nsresult EnsureTimeStretcherInitialized();
// Set playback rate as a multiple of the intrinsic playback rate. This is to
// be called only with aPlaybackRate > 0.0.
virtual nsresult SetPlaybackRate(double aPlaybackRate);
nsresult SetPlaybackRate(double aPlaybackRate);
// Switch between resampling (if false) and time stretching (if true, default).
virtual nsresult SetPreservesPitch(bool aPreservesPitch);
nsresult SetPreservesPitch(bool aPreservesPitch);
private:
static int PrefChanged(const char* aPref, void* aClosure);
static double GetVolumeScale();
static cubeb* GetCubebContext();
static cubeb* GetCubebContextUnlocked();
static uint32_t GetCubebLatency();
static bool CubebLatencyPrefSet();
static long DataCallback_S(cubeb_stream*, void* aThis, void* aBuffer, long aFrames)
{
return static_cast<AudioStream*>(aThis)->DataCallback(aBuffer, aFrames);
}
static void StateCallback_S(cubeb_stream*, void* aThis, cubeb_state aState)
{
static_cast<AudioStream*>(aThis)->StateCallback(aState);
}
long DataCallback(void* aBuffer, long aFrames);
void StateCallback(cubeb_state aState);
nsresult EnsureTimeStretcherInitializedUnlocked();
// aTime is the time in ms the samples were inserted into MediaStreamGraph
long GetUnprocessed(void* aBuffer, long aFrames, int64_t &aTime);
long GetTimeStretched(void* aBuffer, long aFrames, int64_t &aTime);
long GetUnprocessedWithSilencePadding(void* aBuffer, long aFrames, int64_t &aTime);
// Shared implementation of underflow adjusted position calculation.
// Caller must own the monitor.
int64_t GetPositionInFramesUnlocked();
int64_t GetLatencyInFrames();
void GetBufferInsertTime(int64_t &aTimeMs);
void StartUnlocked();
// The monitor is held to protect all access to member variables. Write()
// waits while mBuffer is full; DataCallback() notifies as it consumes
// data from mBuffer. Drain() waits while mState is DRAINING;
// StateCallback() notifies when mState is DRAINED.
Monitor mMonitor;
protected:
// This mutex protects the mPreferedSamplerate member below.
static StaticMutex mMutex;
// Prefered samplerate, in Hz (characteristic of the
// hardware/mixer/platform/API used).
static uint32_t mPreferredSampleRate;
// Input rate in Hz (characteristic of the media being played)
int mInRate;
// Output rate in Hz (characteristic of the playback rate)
@ -218,7 +325,65 @@ protected:
int64_t mTimeMs;
int64_t mFrames;
};
nsAutoTArray<Inserts,8> mInserts;
nsAutoTArray<Inserts, 8> mInserts;
// Sum of silent frames written when DataCallback requests more frames
// than are available in mBuffer.
uint64_t mLostFrames;
// Output file for dumping audio
FILE* mDumpFile;
// Temporary audio buffer. Filled by Write() and consumed by
// DataCallback(). Once mBuffer is full, Write() blocks until sufficient
// space becomes available in mBuffer. mBuffer is sized in bytes, not
// frames.
CircularByteBuffer mBuffer;
// Software volume level. Applied during the servicing of DataCallback().
double mVolume;
// Owning reference to a cubeb_stream. cubeb_stream_destroy is called by
// nsAutoRef's destructor.
nsAutoRef<cubeb_stream> mCubebStream;
uint32_t mBytesPerFrame;
uint32_t BytesToFrames(uint32_t aBytes) {
NS_ASSERTION(aBytes % mBytesPerFrame == 0,
"Byte count not aligned on frames size.");
return aBytes / mBytesPerFrame;
}
uint32_t FramesToBytes(uint32_t aFrames) {
return aFrames * mBytesPerFrame;
}
enum StreamState {
INITIALIZED, // Initialized, playback has not begun.
STARTED, // Started by a call to Write() (iff INITIALIZED) or Resume().
STOPPED, // Stopped by a call to Pause().
DRAINING, // Drain requested. DataCallback will indicate end of stream
// once the remaining contents of mBuffer are requested by
// cubeb, after which StateCallback will indicate drain
// completion.
DRAINED, // StateCallback has indicated that the drain is complete.
ERRORED // Stream disabled due to an internal error.
};
StreamState mState;
// This mutex protects the static members below.
static StaticMutex sMutex;
static cubeb* sCubebContext;
// Prefered samplerate, in Hz (characteristic of the
// hardware/mixer/platform/API used).
static uint32_t sPreferredSampleRate;
static double sVolumeScale;
static uint32_t sCubebLatency;
static bool sCubebLatencyPrefSet;
};
} // namespace mozilla

View File

@ -54,17 +54,20 @@ PRLogModuleInfo* gMediaDecoderLog;
#define DECODER_LOG(type, msg)
#endif
class MediaMemoryTracker : public nsISupports
class MediaMemoryTracker : public MemoryMultiReporter
{
NS_DECL_ISUPPORTS
MediaMemoryTracker();
virtual ~MediaMemoryTracker();
void InitMemoryReporter();
static StaticRefPtr<MediaMemoryTracker> sUniqueInstance;
static MediaMemoryTracker* UniqueInstance() {
if (!sUniqueInstance) {
sUniqueInstance = new MediaMemoryTracker();
sUniqueInstance->InitMemoryReporter();
}
return sUniqueInstance;
}
@ -76,8 +79,6 @@ class MediaMemoryTracker : public nsISupports
DecodersArray mDecoders;
nsCOMPtr<nsIMemoryReporter> mReporter;
public:
static void AddMediaDecoder(MediaDecoder* aDecoder)
{
@ -93,21 +94,13 @@ public:
}
}
static void GetAmounts(int64_t* aVideo, int64_t* aAudio)
{
*aVideo = 0;
*aAudio = 0;
DecodersArray& decoders = Decoders();
for (size_t i = 0; i < decoders.Length(); ++i) {
*aVideo += decoders[i]->VideoQueueMemoryInUse();
*aAudio += decoders[i]->AudioQueueMemoryInUse();
}
}
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData);
};
StaticRefPtr<MediaMemoryTracker> MediaMemoryTracker::sUniqueInstance;
NS_IMPL_ISUPPORTS1(MediaMemoryTracker, nsISupports)
NS_IMPL_ISUPPORTS_INHERITED0(MediaMemoryTracker, MemoryMultiReporter)
NS_IMPL_ISUPPORTS1(MediaDecoder, nsIObserver)
@ -1776,38 +1769,34 @@ MediaDecoder::IsAppleMP3Enabled()
}
#endif
class MediaReporter MOZ_FINAL : public MemoryMultiReporter
NS_IMETHODIMP
MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData)
{
public:
MediaReporter()
: MemoryMultiReporter("media")
{}
NS_IMETHOD CollectReports(nsIMemoryReporterCallback* aCb,
nsISupports* aClosure)
{
int64_t video, audio;
MediaMemoryTracker::GetAmounts(&video, &audio);
#define REPORT(_path, _amount, _desc) \
do { \
nsresult rv; \
rv = aCb->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path), \
nsIMemoryReporter::KIND_HEAP, \
nsIMemoryReporter::UNITS_BYTES, _amount, \
NS_LITERAL_CSTRING(_desc), aClosure); \
NS_ENSURE_SUCCESS(rv, rv); \
} while (0)
REPORT("explicit/media/decoded-video", video,
"Memory used by decoded video frames.");
REPORT("explicit/media/decoded-audio", audio,
"Memory used by decoded audio chunks.");
return NS_OK;
int64_t video = 0, audio = 0;
DecodersArray& decoders = Decoders();
for (size_t i = 0; i < decoders.Length(); ++i) {
video += decoders[i]->VideoQueueMemoryInUse();
audio += decoders[i]->AudioQueueMemoryInUse();
}
};
#define REPORT(_path, _amount, _desc) \
do { \
nsresult rv; \
rv = aHandleReport->Callback(EmptyCString(), NS_LITERAL_CSTRING(_path), \
KIND_HEAP, UNITS_BYTES, _amount, \
NS_LITERAL_CSTRING(_desc), aData); \
NS_ENSURE_SUCCESS(rv, rv); \
} while (0)
REPORT("explicit/media/decoded-video", video,
"Memory used by decoded video frames.");
REPORT("explicit/media/decoded-audio", audio,
"Memory used by decoded audio chunks.");
return NS_OK;
}
MediaDecoderOwner*
MediaDecoder::GetOwner()
@ -1817,14 +1806,19 @@ MediaDecoder::GetOwner()
}
MediaMemoryTracker::MediaMemoryTracker()
: mReporter(new MediaReporter())
: MemoryMultiReporter("media")
{
NS_RegisterMemoryReporter(mReporter);
}
void
MediaMemoryTracker::InitMemoryReporter()
{
RegisterWeakMemoryReporter(this);
}
MediaMemoryTracker::~MediaMemoryTracker()
{
NS_UnregisterMemoryReporter(mReporter);
UnregisterWeakMemoryReporter(this);
}
} // namespace mozilla

View File

@ -191,7 +191,6 @@ destroying the MediaDecoder object.
#include "necko-config.h"
class nsIStreamListener;
class nsIMemoryReporter;
class nsIPrincipal;
class nsITimer;

View File

@ -1056,7 +1056,7 @@ void MediaDecoderStateMachine::AudioLoop()
// AudioStream initialization can block for extended periods in unusual
// circumstances, so we take care to drop the decoder monitor while
// initializing.
nsAutoPtr<AudioStream> audioStream(AudioStream::AllocateStream());
nsAutoPtr<AudioStream> audioStream(new AudioStream());
audioStream->Init(channels, rate, audioChannelType, AudioStream::HighLatency);
audioStream->SetVolume(volume);
if (audioStream->SetPreservesPitch(preservesPitch) != NS_OK) {

View File

@ -778,7 +778,7 @@ MediaStreamGraphImpl::CreateOrDestroyAudioStreams(GraphTime aAudioOutputStartTim
aStream->mAudioOutputStreams.AppendElement();
audioOutputStream->mAudioPlaybackStartTime = aAudioOutputStartTime;
audioOutputStream->mBlockedAudioTime = 0;
audioOutputStream->mStream = AudioStream::AllocateStream();
audioOutputStream->mStream = new AudioStream();
// XXX for now, allocate stereo output. But we need to fix this to
// match the system's ideal channel configuration.
audioOutputStream->mStream->Init(2, tracks->GetRate(), AUDIO_CHANNEL_NORMAL, AudioStream::LowLatency);

View File

@ -1,5 +0,0 @@
# 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 $(topsrcdir)/config/rules.mk

View File

@ -1,5 +0,0 @@
# 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 $(topsrcdir)/config/rules.mk

View File

@ -4,7 +4,7 @@
# 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/.
SOURCES += [
UNIFIED_SOURCES += [
'nsPicoService.cpp',
'PicoModule.cpp'
]

View File

@ -5,4 +5,5 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += ['src']
TEST_DIRS += ['test']
MOCHITEST_MANIFESTS += ['test/mochitest.ini']

View File

@ -73,7 +73,7 @@ SVGFEBlendElement::Mode()
FilterPrimitiveDescription
SVGFEBlendElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
uint32_t mode = mEnumAttributes[MODE].GetAnimValue();
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eBlend);

View File

@ -32,7 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -87,7 +87,7 @@ SVGFEColorMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources
FilterPrimitiveDescription
SVGFEColorMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
uint32_t type = mEnumAttributes[TYPE].GetAnimValue();
const SVGNumberList &values = mNumberListAttributes[VALUES].GetAnimValue();

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -54,7 +54,7 @@ SVGFEComponentTransferElement::GetStringInfo()
FilterPrimitiveDescription
SVGFEComponentTransferElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
nsRefPtr<SVGComponentTransferFunctionElement> childForChannel[4];

View File

@ -32,7 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -112,7 +112,7 @@ SVGFECompositeElement::SetK(float k1, float k2, float k3, float k4)
FilterPrimitiveDescription
SVGFECompositeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eComposite);
uint32_t op = mEnumAttributes[OPERATOR].GetAnimValue();

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -166,7 +166,7 @@ SVGFEConvolveMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSour
FilterPrimitiveDescription
SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
const FilterPrimitiveDescription failureDescription(FilterPrimitiveDescription::eNone);

View File

@ -42,7 +42,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -63,7 +63,7 @@ SVGFEDiffuseLightingElement::KernelUnitLengthY()
FilterPrimitiveDescription
SVGFEDiffuseLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float diffuseConstant = mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue();

View File

@ -32,7 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;

View File

@ -93,7 +93,7 @@ SVGFEDisplacementMapElement::YChannelSelector()
FilterPrimitiveDescription
SVGFEDisplacementMapElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float scale = aInstance->GetPrimitiveNumber(SVGContentUtils::XY,
&mNumberAttributes[SCALE]);

View File

@ -33,7 +33,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -35,7 +35,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFloodElement)
FilterPrimitiveDescription
SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eFlood);
nsIFrame* frame = GetPrimaryFrame();

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }
// nsIContent interface

View File

@ -68,7 +68,7 @@ static const float kMaxStdDeviation = 500;
FilterPrimitiveDescription
SVGFEGaussianBlurElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float stdX = aInstance->GetPrimitiveNumber(SVGContentUtils::X,
&mNumberPairAttributes[STD_DEV],

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -193,7 +193,7 @@ SVGFEImageElement::Href()
FilterPrimitiveDescription
SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
nsIFrame* frame = GetPrimaryFrame();
if (!frame) {
@ -220,6 +220,11 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
return FilterPrimitiveDescription(FilterPrimitiveDescription::eNone);
}
gfxPlatform* platform = gfxPlatform::GetPlatform();
DrawTarget* dt = platform->ScreenReferenceDrawTarget();
RefPtr<SourceSurface> image =
platform->GetSourceSurfaceForSurface(dt, currentFrame);
IntSize nativeSize;
imageContainer->GetWidth(&nativeSize.width);
imageContainer->GetHeight(&nativeSize.height);
@ -239,7 +244,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
// Append the image to aInputImages and store its index in the description.
size_t imageIndex = aInputImages.Length();
aInputImages.AppendElement(currentFrame);
aInputImages.AppendElement(image);
descr.Attributes().Set(eImageInputIndex, (uint32_t)imageIndex);
return descr;

View File

@ -41,7 +41,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -30,7 +30,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeElement)
FilterPrimitiveDescription
SVGFEMergeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
return FilterPrimitiveDescription(FilterPrimitiveDescription::eMerge);
}

View File

@ -32,7 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) MOZ_OVERRIDE;

View File

@ -114,7 +114,7 @@ SVGFEMorphologyElement::GetRXY(int32_t *aRX, int32_t *aRY,
FilterPrimitiveDescription
SVGFEMorphologyElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
int32_t rx, ry;
GetRXY(&rx, &ry, *aInstance);

View File

@ -35,7 +35,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -72,7 +72,7 @@ SVGFEOffsetElement::GetOffset(const nsSVGFilterInstance& aInstance)
FilterPrimitiveDescription
SVGFEOffsetElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eOffset);
nsIntPoint offset = GetOffset(*aInstance);

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }

View File

@ -70,7 +70,7 @@ SVGFESpecularLightingElement::KernelUnitLengthY()
FilterPrimitiveDescription
SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue();
float specularConstant = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue();

View File

@ -36,7 +36,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;

View File

@ -51,7 +51,7 @@ SVGFETileElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
FilterPrimitiveDescription
SVGFETileElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages)
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
return FilterPrimitiveDescription(FilterPrimitiveDescription::eTile);
}

View File

@ -34,7 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
nsTArray<nsRefPtr<gfxASurface> >& aInputImages) MOZ_OVERRIDE;
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

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