mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Merge m-c to fx-team, a=merge
--HG-- extra : commitid : DhYTrQryYUJ
This commit is contained in:
commit
4582cabbf5
@ -9,7 +9,6 @@ obj*/**
|
||||
# below.
|
||||
accessible/**
|
||||
addon-sdk/**
|
||||
b2g/**
|
||||
build/**
|
||||
caps/**
|
||||
chrome/**
|
||||
@ -77,6 +76,11 @@ xpcom/**
|
||||
xpfe/**
|
||||
xulrunner/**
|
||||
|
||||
# b2g exclusions (pref files).
|
||||
b2g/app/b2g.js
|
||||
b2g/graphene/graphene.js
|
||||
b2g/locales/en-US/b2g-l10n.js
|
||||
|
||||
# browser/ exclusions
|
||||
browser/app/**
|
||||
browser/base/content/browser-social.js
|
||||
|
@ -1087,6 +1087,9 @@ pref("identity.fxaccounts.enabled", true);
|
||||
// Mobile Identity API.
|
||||
pref("services.mobileid.server.uri", "https://msisdn.services.mozilla.com");
|
||||
|
||||
pref("identity.fxaccounts.remote.oauth.uri", "https://oauth.accounts.firefox.com/v1");
|
||||
pref("identity.fxaccounts.remote.profile.uri", "https://profile.accounts.firefox.com/v1");
|
||||
|
||||
// Enable mapped array buffer.
|
||||
#ifndef XP_WIN
|
||||
pref("dom.mapped_arraybuffer.enabled", true);
|
||||
|
@ -219,11 +219,11 @@ var RemoteDebugger = {
|
||||
return root;
|
||||
};
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
DebuggerServer.on("connectionchange", function() {
|
||||
AdbController.updateState();
|
||||
});
|
||||
#endif
|
||||
if (isGonk) {
|
||||
DebuggerServer.on("connectionchange", function() {
|
||||
AdbController.updateState();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -373,9 +373,7 @@ var WiFiRemoteDebugger = {
|
||||
e + "\n" + e.stack + "\n");
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
AdbController.setRemoteDebuggerState(value != "disabled");
|
||||
#endif
|
||||
isGonk && AdbController.setRemoteDebuggerState(value != "disabled");
|
||||
});
|
||||
|
||||
SettingsListener.observe("devtools.remote.wifi.enabled", false,
|
||||
|
@ -22,12 +22,14 @@ Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
Cu.import('resource://gre/modules/Services.jsm');
|
||||
Cu.import('resource://gre/modules/AppConstants.jsm');
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
#endif
|
||||
const isGonk = AppConstants.platform === 'gonk';
|
||||
|
||||
if (isGonk) {
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
|
||||
"@mozilla.org/uuid-generator;1",
|
||||
@ -152,10 +154,8 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
||||
(function DeviceInfoToSettings() {
|
||||
// MOZ_B2G_VERSION is set in b2g/confvars.sh, and is output as a #define value
|
||||
// from configure.in, defaults to 1.0.0 if this value is not exist.
|
||||
#filter attemptSubstitution
|
||||
let os_version = '@MOZ_B2G_VERSION@';
|
||||
let os_name = '@MOZ_B2G_OS_NAME@';
|
||||
#unfilter attemptSubstitution
|
||||
let os_version = AppConstants.MOZ_B2G_VERSION;
|
||||
let os_name = AppConstants.MOZ_B2G_OS_NAME;
|
||||
|
||||
let appInfo = Cc["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Ci.nsIXULAppInfo);
|
||||
@ -167,14 +167,14 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
||||
let product_model = null;
|
||||
let product_device = null;
|
||||
let build_number = null;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (isGonk) {
|
||||
hardware_info = libcutils.property_get('ro.hardware');
|
||||
firmware_revision = libcutils.property_get('ro.firmware_revision');
|
||||
product_manufacturer = libcutils.property_get('ro.product.manufacturer');
|
||||
product_model = libcutils.property_get('ro.product.model');
|
||||
product_device = libcutils.property_get('ro.product.device');
|
||||
build_number = libcutils.property_get('ro.build.version.incremental');
|
||||
#endif
|
||||
}
|
||||
|
||||
// Populate deviceinfo settings,
|
||||
// copying any existing deviceinfo.os into deviceinfo.previous_os
|
||||
@ -218,32 +218,31 @@ SettingsListener.observe('devtools.overlay', false, (value) => {
|
||||
}
|
||||
});
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (isGonk) {
|
||||
var LogShake;
|
||||
(function() {
|
||||
let scope = {};
|
||||
Cu.import('resource://gre/modules/LogShake.jsm', scope);
|
||||
LogShake = scope.LogShake;
|
||||
LogShake.init();
|
||||
})();
|
||||
|
||||
var LogShake;
|
||||
(function() {
|
||||
let scope = {};
|
||||
Cu.import('resource://gre/modules/LogShake.jsm', scope);
|
||||
LogShake = scope.LogShake;
|
||||
LogShake.init();
|
||||
})();
|
||||
SettingsListener.observe('devtools.logshake.enabled', false, value => {
|
||||
if (value) {
|
||||
LogShake.enableDeviceMotionListener();
|
||||
} else {
|
||||
LogShake.disableDeviceMotionListener();
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('devtools.logshake.enabled', false, value => {
|
||||
if (value) {
|
||||
LogShake.enableDeviceMotionListener();
|
||||
} else {
|
||||
LogShake.disableDeviceMotionListener();
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('devtools.logshake.qa_enabled', false, value => {
|
||||
if (value) {
|
||||
LogShake.enableQAMode();
|
||||
} else {
|
||||
LogShake.disableQAMode();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
SettingsListener.observe('devtools.logshake.qa_enabled', false, value => {
|
||||
if (value) {
|
||||
LogShake.enableQAMode();
|
||||
} else {
|
||||
LogShake.disableQAMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// =================== Device Storage ====================
|
||||
SettingsListener.observe('device.storage.writable.name', 'sdcard', function(value) {
|
||||
@ -380,15 +379,13 @@ setUpdateTrackingId();
|
||||
var enabled = false;
|
||||
if (Services.prefs.getPrefType('layers.composer2d.enabled') == Ci.nsIPrefBranch.PREF_BOOL) {
|
||||
enabled = Services.prefs.getBoolPref('layers.composer2d.enabled');
|
||||
} else {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
} else if (isGonk) {
|
||||
let androidVersion = libcutils.property_get("ro.build.version.sdk");
|
||||
if (androidVersion >= 17 ) {
|
||||
enabled = true;
|
||||
} else {
|
||||
enabled = (libcutils.property_get('ro.display.colorfill') === '1');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
navigator.mozSettings.createLock().set({'layers.composer2d.enabled': enabled });
|
||||
}
|
||||
@ -443,11 +440,7 @@ setUpdateTrackingId();
|
||||
return;
|
||||
}
|
||||
// Gaia setting has not been set; set the gaia setting to default.
|
||||
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
|
||||
let prefValue = true;
|
||||
#else
|
||||
let prefValue = false;
|
||||
#endif
|
||||
let prefValue = AppConstants.MOZ_TELEMETRY_ON_BY_DEFAULT;
|
||||
try {
|
||||
prefValue = Services.prefs.getBoolPref(geckoPrefName);
|
||||
} catch (e) {
|
||||
@ -571,47 +564,47 @@ SettingsListener.observe("theme.selected",
|
||||
setPAC();
|
||||
})();
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppsUtils",
|
||||
"resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
// ======================= Dogfooders FOTA ==========================
|
||||
SettingsListener.observe('debug.performance_data.dogfooding', false,
|
||||
isDogfooder => {
|
||||
if (!isDogfooder) {
|
||||
dump('AUS:Settings: Not a dogfooder!\n');
|
||||
return;
|
||||
}
|
||||
if (AppConstants.MOZ_B2G_RIL) {
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AppsUtils",
|
||||
"resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
if (!('mozTelephony' in navigator)) {
|
||||
dump('AUS:Settings: There is no mozTelephony!\n');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!('mozMobileConnections' in navigator)) {
|
||||
dump('AUS:Settings: There is no mozMobileConnections!\n');
|
||||
return;
|
||||
}
|
||||
|
||||
let conn = navigator.mozMobileConnections[0];
|
||||
conn.addEventListener('radiostatechange', function onradiostatechange() {
|
||||
if (conn.radioState !== 'enabled') {
|
||||
SettingsListener.observe('debug.performance_data.dogfooding', false,
|
||||
isDogfooder => {
|
||||
if (!isDogfooder) {
|
||||
dump('AUS:Settings: Not a dogfooder!\n');
|
||||
return;
|
||||
}
|
||||
|
||||
conn.removeEventListener('radiostatechange', onradiostatechange);
|
||||
navigator.mozTelephony.dial('*#06#').then(call => {
|
||||
return call.result.then(res => {
|
||||
if (res.success && res.statusMessage
|
||||
&& (res.serviceCode === 'scImei')) {
|
||||
Services.prefs.setCharPref("app.update.imei_hash",
|
||||
AppsUtils.computeHash(res.statusMessage, "SHA512"));
|
||||
}
|
||||
if (!('mozTelephony' in navigator)) {
|
||||
dump('AUS:Settings: There is no mozTelephony!\n');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!('mozMobileConnections' in navigator)) {
|
||||
dump('AUS:Settings: There is no mozMobileConnections!\n');
|
||||
return;
|
||||
}
|
||||
|
||||
let conn = navigator.mozMobileConnections[0];
|
||||
conn.addEventListener('radiostatechange', function onradiostatechange() {
|
||||
if (conn.radioState !== 'enabled') {
|
||||
return;
|
||||
}
|
||||
|
||||
conn.removeEventListener('radiostatechange', onradiostatechange);
|
||||
navigator.mozTelephony.dial('*#06#').then(call => {
|
||||
return call.result.then(res => {
|
||||
if (res.success && res.statusMessage
|
||||
&& (res.serviceCode === 'scImei')) {
|
||||
Services.prefs.setCharPref("app.update.imei_hash",
|
||||
AppsUtils.computeHash(res.statusMessage, "SHA512"));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
// =================== Various simple mapping ======================
|
||||
var settingsToObserve = {
|
||||
@ -663,18 +656,11 @@ var settingsToObserve = {
|
||||
'layers.draw-borders': false,
|
||||
'layers.draw-tile-borders': false,
|
||||
'layers.dump': false,
|
||||
#ifdef XP_WIN
|
||||
'layers.enable-tiles': false,
|
||||
#else
|
||||
'layers.enable-tiles': AppConstants.platform !== "win",
|
||||
'layers.enable-tiles': true,
|
||||
#endif
|
||||
'layers.effect.invert': false,
|
||||
'layers.effect.grayscale': false,
|
||||
'layers.effect.contrast': '0.0',
|
||||
#ifdef MOZ_GRAPHENE
|
||||
// Restart required
|
||||
'layers.async-pan-zoom.enabled': false,
|
||||
#endif
|
||||
'layout.display-list.dump': false,
|
||||
'mms.debugging.enabled': false,
|
||||
'network.debugging.enabled': false,
|
||||
@ -729,6 +715,11 @@ var settingsToObserve = {
|
||||
'wap.UAProf.url': ''
|
||||
};
|
||||
|
||||
if (AppConstants.MOZ_GRAPHENE) {
|
||||
// Restart required
|
||||
settingsToObserve['layers.async-pan-zoom.enabled'] = false;
|
||||
}
|
||||
|
||||
function settingObserver(setPref, prefName, setting) {
|
||||
return value => {
|
||||
setPref(prefName, value);
|
||||
|
@ -19,11 +19,13 @@ Cu.import('resource://gre/modules/ErrorPage.jsm');
|
||||
Cu.import('resource://gre/modules/AlertsHelper.jsm');
|
||||
Cu.import('resource://gre/modules/RequestSyncService.jsm');
|
||||
Cu.import('resource://gre/modules/SystemUpdateService.jsm');
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
Cu.import('resource://gre/modules/MultiscreenHandler.jsm');
|
||||
Cu.import('resource://gre/modules/NetworkStatsService.jsm');
|
||||
Cu.import('resource://gre/modules/ResourceStatsService.jsm');
|
||||
#endif
|
||||
|
||||
if (isGonk) {
|
||||
Cu.import('resource://gre/modules/MultiscreenHandler.jsm');
|
||||
Cu.import('resource://gre/modules/NetworkStatsService.jsm');
|
||||
Cu.import('resource://gre/modules/ResourceStatsService.jsm');
|
||||
}
|
||||
|
||||
Cu.import('resource://gre/modules/KillSwitchMain.jsm');
|
||||
|
||||
// Identity
|
||||
@ -62,21 +64,21 @@ XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
});
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
#endif
|
||||
if (isGonk) {
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(Services, 'captivePortalDetector',
|
||||
'@mozilla.org/toolkit/captive-detector;1',
|
||||
'nsICaptivePortalDetector');
|
||||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
|
||||
"resource://gre/modules/SafeBrowsing.jsm");
|
||||
#endif
|
||||
if (AppConstants.MOZ_SAFE_BROWSING) {
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
|
||||
"resource://gre/modules/SafeBrowsing.jsm");
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SafeMode",
|
||||
"resource://gre/modules/SafeMode.jsm");
|
||||
@ -120,25 +122,21 @@ function restart() {
|
||||
appStartup.quit(Ci.nsIAppStartup.eForceQuit | Ci.nsIAppStartup.eRestart);
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
function debugCrashReport(aStr) {
|
||||
dump('Crash reporter : ' + aStr);
|
||||
AppConstants.MOZ_CRASHREPORTER && dump('Crash reporter : ' + aStr);
|
||||
}
|
||||
#else
|
||||
function debugCrashReport(aStr) {}
|
||||
#endif
|
||||
|
||||
var shell = {
|
||||
|
||||
get CrashSubmit() {
|
||||
delete this.CrashSubmit;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
Cu.import("resource://gre/modules/CrashSubmit.jsm", this);
|
||||
return this.CrashSubmit;
|
||||
#else
|
||||
dump('Crash reporter : disabled at build time.');
|
||||
return this.CrashSubmit = null;
|
||||
#endif
|
||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
Cu.import("resource://gre/modules/CrashSubmit.jsm", this);
|
||||
return this.CrashSubmit;
|
||||
} else {
|
||||
dump('Crash reporter : disabled at build time.');
|
||||
return this.CrashSubmit = null;
|
||||
}
|
||||
},
|
||||
|
||||
onlineForCrashReport: function shell_onlineForCrashReport() {
|
||||
@ -265,10 +263,10 @@ var shell = {
|
||||
},
|
||||
|
||||
bootstrap: function() {
|
||||
#ifdef MOZ_B2GDROID
|
||||
Cc["@mozilla.org/b2g/b2gdroid-setup;1"]
|
||||
.getService(Ci.nsIObserver).observe(window, "shell-startup", null);
|
||||
#endif
|
||||
if (AppConstants.MOZ_B2GDROID) {
|
||||
Cc["@mozilla.org/b2g/b2gdroid-setup;1"]
|
||||
.getService(Ci.nsIObserver).observe(window, "shell-startup", null);
|
||||
}
|
||||
|
||||
window.performance.mark('gecko-shell-bootstrap');
|
||||
|
||||
@ -278,15 +276,13 @@ var shell = {
|
||||
Cc['@mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap']
|
||||
.getService(Ci.nsISupports).wrappedJSObject.startManifestURL;
|
||||
|
||||
#ifdef MOZ_GRAPHENE
|
||||
// If --start-manifest hasn't been specified, we re-use the latest specified manifest.
|
||||
// If it's the first launch, we will fallback to b2g.default.start_manifest_url
|
||||
if (!startManifestURL) {
|
||||
if (AppConstants.MOZ_GRAPHENE && !startManifestURL) {
|
||||
try {
|
||||
startManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url");
|
||||
} catch(e) {}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!startManifestURL) {
|
||||
try {
|
||||
@ -296,13 +292,13 @@ var shell = {
|
||||
|
||||
if (startManifestURL) {
|
||||
Cu.import('resource://gre/modules/Bootstraper.jsm');
|
||||
#ifdef MOZ_GRAPHENE
|
||||
if (Bootstraper.isInstallRequired(startManifestURL)) {
|
||||
|
||||
if (AppConstants.MOZ_GRAPHENE && Bootstraper.isInstallRequired(startManifestURL)) {
|
||||
// Installing the app my take some time. We don't want to keep the
|
||||
// native window hidden.
|
||||
showInstallScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
Bootstraper.ensureSystemAppInstall(startManifestURL)
|
||||
.then(this.start.bind(this))
|
||||
.catch(Bootstraper.bailout);
|
||||
@ -334,34 +330,34 @@ var shell = {
|
||||
}
|
||||
catch (e) { }
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Annotate crash report
|
||||
let annotations = [ [ "Android_Hardware", "ro.hardware" ],
|
||||
[ "Android_Device", "ro.product.device" ],
|
||||
[ "Android_CPU_ABI2", "ro.product.cpu.abi2" ],
|
||||
[ "Android_CPU_ABI", "ro.product.cpu.abi" ],
|
||||
[ "Android_Manufacturer", "ro.product.manufacturer" ],
|
||||
[ "Android_Brand", "ro.product.brand" ],
|
||||
[ "Android_Model", "ro.product.model" ],
|
||||
[ "Android_Board", "ro.product.board" ],
|
||||
];
|
||||
if (isGonk) {
|
||||
// Annotate crash report
|
||||
let annotations = [ [ "Android_Hardware", "ro.hardware" ],
|
||||
[ "Android_Device", "ro.product.device" ],
|
||||
[ "Android_CPU_ABI2", "ro.product.cpu.abi2" ],
|
||||
[ "Android_CPU_ABI", "ro.product.cpu.abi" ],
|
||||
[ "Android_Manufacturer", "ro.product.manufacturer" ],
|
||||
[ "Android_Brand", "ro.product.brand" ],
|
||||
[ "Android_Model", "ro.product.model" ],
|
||||
[ "Android_Board", "ro.product.board" ],
|
||||
];
|
||||
|
||||
annotations.forEach(function (element) {
|
||||
cr.annotateCrashReport(element[0], libcutils.property_get(element[1]));
|
||||
annotations.forEach(function (element) {
|
||||
cr.annotateCrashReport(element[0], libcutils.property_get(element[1]));
|
||||
});
|
||||
|
||||
let androidVersion = libcutils.property_get("ro.build.version.sdk") +
|
||||
"(" + libcutils.property_get("ro.build.version.codename") + ")";
|
||||
cr.annotateCrashReport("Android_Version", androidVersion);
|
||||
|
||||
SettingsListener.observe("deviceinfo.os", "", function(value) {
|
||||
try {
|
||||
let cr = Cc["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Ci.nsICrashReporter);
|
||||
cr.annotateCrashReport("B2G_OS_Version", value);
|
||||
} catch(e) { }
|
||||
});
|
||||
|
||||
let androidVersion = libcutils.property_get("ro.build.version.sdk") +
|
||||
"(" + libcutils.property_get("ro.build.version.codename") + ")";
|
||||
cr.annotateCrashReport("Android_Version", androidVersion);
|
||||
|
||||
SettingsListener.observe("deviceinfo.os", "", function(value) {
|
||||
try {
|
||||
let cr = Cc["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Ci.nsICrashReporter);
|
||||
cr.annotateCrashReport("B2G_OS_Version", value);
|
||||
} catch(e) { }
|
||||
});
|
||||
#endif
|
||||
}
|
||||
} catch(e) {
|
||||
debugCrashReport('exception: ' + e);
|
||||
}
|
||||
@ -385,13 +381,15 @@ var shell = {
|
||||
systemAppFrame.setAttribute('allowfullscreen', 'true');
|
||||
systemAppFrame.setAttribute('src', 'blank.html');
|
||||
let container = document.getElementById('container');
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
// See shell.html
|
||||
let hotfix = document.getElementById('placeholder');
|
||||
if (hotfix) {
|
||||
container.removeChild(hotfix);
|
||||
|
||||
if (AppConstants.platform == 'macosx') {
|
||||
// See shell.html
|
||||
let hotfix = document.getElementById('placeholder');
|
||||
if (hotfix) {
|
||||
container.removeChild(hotfix);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
this.contentBrowser = container.appendChild(systemAppFrame);
|
||||
|
||||
let webNav = systemAppFrame.contentWindow
|
||||
@ -399,9 +397,9 @@ var shell = {
|
||||
.getInterface(Ci.nsIWebNavigation);
|
||||
webNav.sessionHistory = Cc["@mozilla.org/browser/shistory;1"].createInstance(Ci.nsISHistory);
|
||||
|
||||
#ifdef MOZ_GRAPHENE
|
||||
webNav.QueryInterface(Ci.nsIDocShell).windowDraggingAllowed = true;
|
||||
#endif
|
||||
if (AppConstants.MOZ_GRAPHENE) {
|
||||
webNav.QueryInterface(Ci.nsIDocShell).windowDraggingAllowed = true;
|
||||
}
|
||||
|
||||
let audioChannels = systemAppFrame.allowedAudioChannels;
|
||||
audioChannels && audioChannels.forEach(function(audioChannel) {
|
||||
@ -451,11 +449,12 @@ var shell = {
|
||||
ppmm.addMessageListener("sms-handler", this);
|
||||
ppmm.addMessageListener("mail-handler", this);
|
||||
ppmm.addMessageListener("file-picker", this);
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
setTimeout(function() {
|
||||
SafeBrowsing.init();
|
||||
}, 5000);
|
||||
#endif
|
||||
|
||||
if (AppConstants.MOZ_SAFE_BROWSING) {
|
||||
setTimeout(function() {
|
||||
SafeBrowsing.init();
|
||||
}, 5000);
|
||||
}
|
||||
},
|
||||
|
||||
stop: function shell_stop() {
|
||||
@ -754,45 +753,40 @@ var shell = {
|
||||
|
||||
Services.obs.notifyObservers(null, 'content-start', null);
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
Cu.import('resource://gre/modules/OperatorApps.jsm');
|
||||
#endif
|
||||
isGonk && Cu.import('resource://gre/modules/OperatorApps.jsm');
|
||||
|
||||
#ifdef MOZ_GRAPHENE
|
||||
if (Services.prefs.getBoolPref("b2g.nativeWindowGeometry.fullscreen")) {
|
||||
if (AppConstants.MOZ_GRAPHENE &&
|
||||
Services.prefs.getBoolPref("b2g.nativeWindowGeometry.fullscreen")) {
|
||||
window.fullScreen = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
shell.handleCmdLine();
|
||||
},
|
||||
|
||||
handleCmdLine: function() {
|
||||
// This isn't supported on devices.
|
||||
#ifndef ANDROID
|
||||
let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"]
|
||||
.getService(Ci.nsISupports);
|
||||
let args = b2gcmds.wrappedJSObject.cmdLine;
|
||||
try {
|
||||
// Returns null if -url is not present.
|
||||
let url = args.handleFlagWithParam("url", false);
|
||||
if (url) {
|
||||
this.sendChromeEvent({type: "mozbrowseropenwindow", url});
|
||||
args.preventDefault = true;
|
||||
// This isn't supported on devices.
|
||||
if (!isGonk && !AppConstants.MOZ_B2GDROID) {
|
||||
let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"]
|
||||
.getService(Ci.nsISupports);
|
||||
let args = b2gcmds.wrappedJSObject.cmdLine;
|
||||
try {
|
||||
// Returns null if -url is not present.
|
||||
let url = args.handleFlagWithParam("url", false);
|
||||
if (url) {
|
||||
this.sendChromeEvent({type: "mozbrowseropenwindow", url});
|
||||
args.preventDefault = true;
|
||||
}
|
||||
} catch(e) {
|
||||
// Throws if -url is present with no params.
|
||||
}
|
||||
} catch(e) {
|
||||
// Throws if -url is present with no params.
|
||||
}
|
||||
#endif
|
||||
},
|
||||
|
||||
// This gets called when window.onload fires on the System app content window,
|
||||
// which means things in <html> are parsed and statically referenced <script>s
|
||||
// and <script defer>s are loaded and run.
|
||||
notifyContentWindowLoaded: function shell_notifyContentWindowLoaded() {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
libcutils.property_set('sys.boot_completed', '1');
|
||||
#endif
|
||||
isGonk && libcutils.property_set('sys.boot_completed', '1');
|
||||
|
||||
// This will cause Gonk Widget to remove boot animation from the screen
|
||||
// and reveals the page.
|
||||
@ -1124,7 +1118,10 @@ window.addEventListener('ContentStart', function update_onContentStart() {
|
||||
Cu.import('resource://gre/modules/WebappsUpdater.jsm');
|
||||
WebappsUpdater.handleContentStart(shell);
|
||||
|
||||
#ifdef MOZ_UPDATER
|
||||
if (!AppConstants.MOZ_UPDATER) {
|
||||
return;
|
||||
}
|
||||
|
||||
let promptCc = Cc["@mozilla.org/updates/update-prompt;1"];
|
||||
if (!promptCc) {
|
||||
return;
|
||||
@ -1136,7 +1133,6 @@ window.addEventListener('ContentStart', function update_onContentStart() {
|
||||
}
|
||||
|
||||
updatePrompt.wrappedJSObject.handleContentStart(shell);
|
||||
#endif
|
||||
});
|
||||
|
||||
(function geolocationStatusTracker() {
|
||||
@ -1313,36 +1309,34 @@ window.addEventListener('ContentStart', function update_onContentStart() {
|
||||
}, 'volume-state-changed', false);
|
||||
})();
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Devices don't have all the same partition size for /cache where we
|
||||
// store the http cache.
|
||||
(function setHTTPCacheSize() {
|
||||
let path = Services.prefs.getCharPref("browser.cache.disk.parent_directory");
|
||||
let volumeService = Cc["@mozilla.org/telephony/volume-service;1"]
|
||||
.getService(Ci.nsIVolumeService);
|
||||
if (isGonk) {
|
||||
// Devices don't have all the same partition size for /cache where we
|
||||
// store the http cache.
|
||||
(function setHTTPCacheSize() {
|
||||
let path = Services.prefs.getCharPref("browser.cache.disk.parent_directory");
|
||||
let volumeService = Cc["@mozilla.org/telephony/volume-service;1"]
|
||||
.getService(Ci.nsIVolumeService);
|
||||
|
||||
let stats = volumeService.createOrGetVolumeByPath(path).getStats();
|
||||
let stats = volumeService.createOrGetVolumeByPath(path).getStats();
|
||||
|
||||
// We must set the size in KB, and keep a bit of free space.
|
||||
let size = Math.floor(stats.totalBytes / 1024) - 1024;
|
||||
// We must set the size in KB, and keep a bit of free space.
|
||||
let size = Math.floor(stats.totalBytes / 1024) - 1024;
|
||||
|
||||
// keep the default value if it is smaller than the physical partition size.
|
||||
let oldSize = Services.prefs.getIntPref("browser.cache.disk.capacity");
|
||||
if (size < oldSize) {
|
||||
Services.prefs.setIntPref("browser.cache.disk.capacity", size);
|
||||
// keep the default value if it is smaller than the physical partition size.
|
||||
let oldSize = Services.prefs.getIntPref("browser.cache.disk.capacity");
|
||||
if (size < oldSize) {
|
||||
Services.prefs.setIntPref("browser.cache.disk.capacity", size);
|
||||
}
|
||||
})();
|
||||
|
||||
try {
|
||||
let gmpService = Cc["@mozilla.org/gecko-media-plugin-service;1"]
|
||||
.getService(Ci.mozIGeckoMediaPluginChromeService);
|
||||
gmpService.addPluginDirectory("/system/b2g/gmp-clearkey/0.1");
|
||||
} catch(e) {
|
||||
dump("Failed to add clearkey path! " + e + "\n");
|
||||
}
|
||||
})();
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
try {
|
||||
let gmpService = Cc["@mozilla.org/gecko-media-plugin-service;1"]
|
||||
.getService(Ci.mozIGeckoMediaPluginChromeService);
|
||||
gmpService.addPluginDirectory("/system/b2g/gmp-clearkey/0.1");
|
||||
} catch(e) {
|
||||
dump("Failed to add clearkey path! " + e + "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Calling this observer will cause a shutdown an a profile reset.
|
||||
// Use eg. : Services.obs.notifyObservers(null, 'b2g-reset-profile', null);
|
||||
@ -1353,42 +1347,42 @@ Services.obs.addObserver(function resetProfile(subject, topic, data) {
|
||||
// sequence, but still has xpcom access.
|
||||
Services.obs.addObserver(function clearProfile(subject, topic, data) {
|
||||
Services.obs.removeObserver(clearProfile, topic);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
let json = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
|
||||
json.initWithPath('/system/b2g/webapps/webapps.json');
|
||||
let toRemove = json.exists()
|
||||
// This is a user build, just rm -r /data/local /data/b2g/mozilla
|
||||
? ['/data/local', '/data/b2g/mozilla']
|
||||
// This is an eng build. We clear the profile and a set of files
|
||||
// under /data/local.
|
||||
: ['/data/b2g/mozilla',
|
||||
'/data/local/permissions.sqlite',
|
||||
'/data/local/storage',
|
||||
'/data/local/OfflineCache'];
|
||||
if (isGonk) {
|
||||
let json = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
|
||||
json.initWithPath('/system/b2g/webapps/webapps.json');
|
||||
let toRemove = json.exists()
|
||||
// This is a user build, just rm -r /data/local /data/b2g/mozilla
|
||||
? ['/data/local', '/data/b2g/mozilla']
|
||||
// This is an eng build. We clear the profile and a set of files
|
||||
// under /data/local.
|
||||
: ['/data/b2g/mozilla',
|
||||
'/data/local/permissions.sqlite',
|
||||
'/data/local/storage',
|
||||
'/data/local/OfflineCache'];
|
||||
|
||||
toRemove.forEach(function(dir) {
|
||||
try {
|
||||
let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
|
||||
file.initWithPath(dir);
|
||||
file.remove(true);
|
||||
} catch(e) { dump(e); }
|
||||
});
|
||||
#else
|
||||
// Desktop builds.
|
||||
let profile = Services.dirsvc.get('ProfD', Ci.nsIFile);
|
||||
toRemove.forEach(function(dir) {
|
||||
try {
|
||||
let file = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile);
|
||||
file.initWithPath(dir);
|
||||
file.remove(true);
|
||||
} catch(e) { dump(e); }
|
||||
});
|
||||
} else {
|
||||
// Desktop builds.
|
||||
let profile = Services.dirsvc.get('ProfD', Ci.nsIFile);
|
||||
|
||||
// We don't want to remove everything from the profile, since this
|
||||
// would prevent us from starting up.
|
||||
let whitelist = ['defaults', 'extensions', 'settings.json',
|
||||
'user.js', 'webapps'];
|
||||
let enumerator = profile.directoryEntries;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (whitelist.indexOf(file.leafName) == -1) {
|
||||
file.remove(true);
|
||||
// We don't want to remove everything from the profile, since this
|
||||
// would prevent us from starting up.
|
||||
let whitelist = ['defaults', 'extensions', 'settings.json',
|
||||
'user.js', 'webapps'];
|
||||
let enumerator = profile.directoryEntries;
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
|
||||
if (whitelist.indexOf(file.leafName) == -1) {
|
||||
file.remove(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
},
|
||||
'profile-before-change2', false);
|
||||
|
||||
@ -1397,63 +1391,61 @@ Services.obs.addObserver(function resetProfile(subject, topic, data) {
|
||||
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
}, 'b2g-reset-profile', false);
|
||||
|
||||
#ifdef MOZ_GRAPHENE
|
||||
if (AppConstants.MOZ_GRAPHENE) {
|
||||
const restoreWindowGeometry = () => {
|
||||
let screenX = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenX");
|
||||
let screenY = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenY");
|
||||
let width = Services.prefs.getIntPref("b2g.nativeWindowGeometry.width");
|
||||
let height = Services.prefs.getIntPref("b2g.nativeWindowGeometry.height");
|
||||
|
||||
const restoreWindowGeometry = () => {
|
||||
let screenX = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenX");
|
||||
let screenY = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenY");
|
||||
let width = Services.prefs.getIntPref("b2g.nativeWindowGeometry.width");
|
||||
let height = Services.prefs.getIntPref("b2g.nativeWindowGeometry.height");
|
||||
if (screenX == -1) {
|
||||
// Center
|
||||
screenX = (screen.width - width) / 2;
|
||||
screenY = (screen.height - height) / 2;
|
||||
}
|
||||
|
||||
if (screenX == -1) {
|
||||
// Center
|
||||
screenX = (screen.width - width) / 2;
|
||||
screenY = (screen.height - height) / 2;
|
||||
moveTo(screenX, screenY);
|
||||
resizeTo(width, height);
|
||||
}
|
||||
restoreWindowGeometry();
|
||||
|
||||
const saveWindowGeometry = () => {
|
||||
window.removeEventListener("unload", saveWindowGeometry);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenX", screenX);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenY", screenY);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.width", outerWidth);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.height", outerHeight);
|
||||
}
|
||||
window.addEventListener("unload", saveWindowGeometry);
|
||||
|
||||
var baseWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIBaseWindow);
|
||||
|
||||
const showNativeWindow = () => baseWindow.visibility = true;
|
||||
const hideNativeWindow = () => baseWindow.visibility = false;
|
||||
|
||||
const showInstallScreen = () => {
|
||||
const grapheneStrings =
|
||||
Services.strings.createBundle('chrome://b2g-l10n/locale/graphene.properties');
|
||||
document.querySelector('#installing > .message').textContent =
|
||||
grapheneStrings.GetStringFromName('installing');
|
||||
showNativeWindow();
|
||||
}
|
||||
|
||||
moveTo(screenX, screenY);
|
||||
resizeTo(width, height);
|
||||
}
|
||||
restoreWindowGeometry();
|
||||
const hideInstallScreen = () => {
|
||||
document.body.classList.add('content-loaded');
|
||||
}
|
||||
|
||||
const saveWindowGeometry = () => {
|
||||
window.removeEventListener("unload", saveWindowGeometry);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenX", screenX);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenY", screenY);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.width", outerWidth);
|
||||
Services.prefs.setIntPref("b2g.nativeWindowGeometry.height", outerHeight);
|
||||
}
|
||||
window.addEventListener("unload", saveWindowGeometry);
|
||||
|
||||
var baseWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIBaseWindow);
|
||||
|
||||
const showNativeWindow = () => baseWindow.visibility = true;
|
||||
const hideNativeWindow = () => baseWindow.visibility = false;
|
||||
|
||||
const showInstallScreen = () => {
|
||||
const grapheneStrings =
|
||||
Services.strings.createBundle('chrome://b2g-l10n/locale/graphene.properties');
|
||||
document.querySelector('#installing > .message').textContent =
|
||||
grapheneStrings.GetStringFromName('installing');
|
||||
showNativeWindow();
|
||||
}
|
||||
|
||||
const hideInstallScreen = () => {
|
||||
document.body.classList.add('content-loaded');
|
||||
}
|
||||
|
||||
window.addEventListener('ContentStart', () => {
|
||||
shell.contentBrowser.contentWindow.addEventListener('load', () => {
|
||||
hideInstallScreen();
|
||||
showNativeWindow();
|
||||
window.addEventListener('ContentStart', () => {
|
||||
shell.contentBrowser.contentWindow.addEventListener('load', () => {
|
||||
hideInstallScreen();
|
||||
showNativeWindow();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
hideNativeWindow();
|
||||
|
||||
#endif
|
||||
hideNativeWindow();
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ chrome.jar:
|
||||
% content b2g %content/
|
||||
|
||||
content/arrow.svg (content/arrow.svg)
|
||||
* content/settings.js (content/settings.js)
|
||||
content/settings.js (content/settings.js)
|
||||
* content/shell.html (content/shell.html)
|
||||
* content/shell.js (content/shell.js)
|
||||
content/shell.js (content/shell.js)
|
||||
content/shell_remote.html (content/shell_remote.html)
|
||||
content/shell_remote.js (content/shell_remote.js)
|
||||
* content/shell.css (content/shell.css)
|
||||
@ -20,7 +20,7 @@ chrome.jar:
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
content/devtools/adb.js (content/devtools/adb.js)
|
||||
#endif
|
||||
* content/devtools/debugger.js (content/devtools/debugger.js)
|
||||
content/devtools/debugger.js (content/devtools/debugger.js)
|
||||
content/devtools/hud.js (content/devtools/hud.js)
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
content/desktop.css (content/desktop.css)
|
||||
|
@ -9,6 +9,7 @@ const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const XRE_OS_UPDATE_APPLY_TO_DIR = "OSUpdApplyToD"
|
||||
const UPDATE_ARCHIVE_DIR = "UpdArchD"
|
||||
@ -57,8 +58,14 @@ DirectoryProvider.prototype = {
|
||||
|
||||
_profD: null,
|
||||
|
||||
getFile: function dp_getFile(prop, persistent) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
getFile: function(prop, persistent) {
|
||||
if (AppConstants.platform === "gonk") {
|
||||
return this.getFileOnGonk(prop, persistent);
|
||||
}
|
||||
return this.getFileNotGonk(prop, persistent);
|
||||
},
|
||||
|
||||
getFileOnGonk: function(prop, persistent) {
|
||||
let localProps = ["cachePDir", "webappsDir", "PrefD", "indexedDBPDir",
|
||||
"permissionDBPDir", "UpdRootD"];
|
||||
if (localProps.indexOf(prop) != -1) {
|
||||
@ -97,7 +104,10 @@ DirectoryProvider.prototype = {
|
||||
// before apply, check if free space is 1.1 times of update.mar
|
||||
return this.getUpdateDir(persistent, FOTA_DIR, 1.1);
|
||||
}
|
||||
#else
|
||||
return null;
|
||||
},
|
||||
|
||||
getFileNotGonk: function(prop, persistent) {
|
||||
// In desktop builds, coreAppsDir is the same as the profile
|
||||
// directory unless otherwise specified. We just need to get the
|
||||
// path from the parent, and it is then used to build
|
||||
@ -137,7 +147,6 @@ DirectoryProvider.prototype = {
|
||||
persistent.value = true;
|
||||
return file;
|
||||
}
|
||||
#endif
|
||||
return null;
|
||||
},
|
||||
|
||||
|
@ -39,7 +39,7 @@ HelperAppLauncherDialog.prototype = {
|
||||
aSuggestedFileExt,
|
||||
aForcePrompt) {
|
||||
// Retrieve the user's default download directory.
|
||||
Task.spawn(function() {
|
||||
Task.spawn(function*() {
|
||||
let file = null;
|
||||
try {
|
||||
let defaultFolder = yield Downloads.getPreferredDownloadsDirectory();
|
||||
|
@ -10,6 +10,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm");
|
||||
@ -27,14 +28,14 @@ XPCOMUtils.defineLazyGetter(this, "permMgr", function() {
|
||||
.getService(Ci.nsIPermissionManager);
|
||||
});
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
#else
|
||||
this.libcutils = null;
|
||||
#endif
|
||||
if (AppConstants.platform === "gonk") {
|
||||
XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
return libcutils;
|
||||
});
|
||||
} else {
|
||||
this.libcutils = null;
|
||||
}
|
||||
|
||||
const DEBUG = false;
|
||||
|
||||
|
@ -9,6 +9,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ctypes.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const RECOVERYSERVICE_CID = Components.ID("{b3caca5d-0bb0-48c6-912b-6be6cbf08832}");
|
||||
const RECOVERYSERVICE_CONTRACTID = "@mozilla.org/recovery-service;1";
|
||||
@ -17,43 +18,45 @@ function log(msg) {
|
||||
dump("-*- RecoveryService: " + msg + "\n");
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
var librecovery = (function() {
|
||||
let library;
|
||||
try {
|
||||
library = ctypes.open("librecovery.so");
|
||||
} catch (e) {
|
||||
log("Unable to open librecovery.so");
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
// Bug 1163956, modify updatePath from ctyps.char.ptr to ctype.char.array(4096)
|
||||
// align with librecovery.h. 4096 comes from PATH_MAX
|
||||
let FotaUpdateStatus = new ctypes.StructType("FotaUpdateStatus", [
|
||||
{ result: ctypes.int },
|
||||
{ updatePath: ctypes.char.array(4096) }
|
||||
]);
|
||||
const isGonk = AppConstants.platform === 'gonk';
|
||||
|
||||
return {
|
||||
factoryReset: library.declare("factoryReset",
|
||||
ctypes.default_abi,
|
||||
ctypes.int),
|
||||
installFotaUpdate: library.declare("installFotaUpdate",
|
||||
ctypes.default_abi,
|
||||
ctypes.int,
|
||||
ctypes.char.ptr,
|
||||
ctypes.int),
|
||||
if (isGonk) {
|
||||
var librecovery = (function() {
|
||||
let library;
|
||||
try {
|
||||
library = ctypes.open("librecovery.so");
|
||||
} catch (e) {
|
||||
log("Unable to open librecovery.so");
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
// Bug 1163956, modify updatePath from ctyps.char.ptr to ctype.char.array(4096)
|
||||
// align with librecovery.h. 4096 comes from PATH_MAX
|
||||
let FotaUpdateStatus = new ctypes.StructType("FotaUpdateStatus", [
|
||||
{ result: ctypes.int },
|
||||
{ updatePath: ctypes.char.array(4096) }
|
||||
]);
|
||||
|
||||
FotaUpdateStatus: FotaUpdateStatus,
|
||||
getFotaUpdateStatus: library.declare("getFotaUpdateStatus",
|
||||
ctypes.default_abi,
|
||||
ctypes.int,
|
||||
FotaUpdateStatus.ptr)
|
||||
};
|
||||
})();
|
||||
return {
|
||||
factoryReset: library.declare("factoryReset",
|
||||
ctypes.default_abi,
|
||||
ctypes.int),
|
||||
installFotaUpdate: library.declare("installFotaUpdate",
|
||||
ctypes.default_abi,
|
||||
ctypes.int,
|
||||
ctypes.char.ptr,
|
||||
ctypes.int),
|
||||
|
||||
const gFactoryResetFile = "__post_reset_cmd__";
|
||||
FotaUpdateStatus: FotaUpdateStatus,
|
||||
getFotaUpdateStatus: library.declare("getFotaUpdateStatus",
|
||||
ctypes.default_abi,
|
||||
ctypes.int,
|
||||
FotaUpdateStatus.ptr)
|
||||
};
|
||||
})();
|
||||
|
||||
#endif
|
||||
const gFactoryResetFile = "__post_reset_cmd__";
|
||||
|
||||
}
|
||||
|
||||
function RecoveryService() {}
|
||||
|
||||
@ -68,7 +71,10 @@ RecoveryService.prototype = {
|
||||
}),
|
||||
|
||||
factoryReset: function RS_factoryReset(reason) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (!isGonk) {
|
||||
Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
function doReset() {
|
||||
// If this succeeds, then the device reboots and this never returns
|
||||
if (librecovery.factoryReset() != 0) {
|
||||
@ -119,12 +125,13 @@ RecoveryService.prototype = {
|
||||
} else {
|
||||
doReset();
|
||||
}
|
||||
#endif
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
},
|
||||
|
||||
installFotaUpdate: function RS_installFotaUpdate(updatePath) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (!isGonk) {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// If this succeeds, then the device reboots and this never returns
|
||||
if (librecovery.installFotaUpdate(updatePath, updatePath.length) != 0) {
|
||||
log("Error: FOTA install failed. Trying again after clearing cache.");
|
||||
@ -134,20 +141,18 @@ RecoveryService.prototype = {
|
||||
if (librecovery.installFotaUpdate(updatePath, updatePath.length) != 0) {
|
||||
log("Error: FOTA install failed again");
|
||||
}
|
||||
#endif
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
},
|
||||
|
||||
getFotaUpdateStatus: function RS_getFotaUpdateStatus() {
|
||||
let status = Ci.nsIRecoveryService.FOTA_UPDATE_UNKNOWN;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
let cStatus = librecovery.FotaUpdateStatus();
|
||||
|
||||
if (librecovery.getFotaUpdateStatus(cStatus.address()) == 0) {
|
||||
status = cStatus.result;
|
||||
if (isGonk) {
|
||||
let cStatus = librecovery.FotaUpdateStatus();
|
||||
|
||||
if (librecovery.getFotaUpdateStatus(cStatus.address()) == 0) {
|
||||
status = cStatus.result;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
};
|
||||
|
@ -13,6 +13,7 @@ const Cr = Components.results;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/WebappsUpdater.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const VERBOSE = 1;
|
||||
var log =
|
||||
@ -399,30 +400,30 @@ UpdatePrompt.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
let window = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let pinReq = window.navigator.mozIccManager.getCardLock("pin");
|
||||
pinReq.onsuccess = function(e) {
|
||||
if (e.target.result.enabled) {
|
||||
// The SIM is pin locked. Don't use a fallback timer. This means that
|
||||
// the user has to press Install to apply the update. If we use the
|
||||
// timer, and the timer reboots the phone, then the phone will be
|
||||
// unusable until the SIM is unlocked.
|
||||
log("SIM is pin locked. Not starting fallback timer.");
|
||||
} else {
|
||||
// This means that no pin lock is enabled, so we go ahead and start
|
||||
// the fallback timer.
|
||||
if (AppConstants.MOZ_B2G_RIL) {
|
||||
let window = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let pinReq = window.navigator.mozIccManager.getCardLock("pin");
|
||||
pinReq.onsuccess = function(e) {
|
||||
if (e.target.result.enabled) {
|
||||
// The SIM is pin locked. Don't use a fallback timer. This means that
|
||||
// the user has to press Install to apply the update. If we use the
|
||||
// timer, and the timer reboots the phone, then the phone will be
|
||||
// unusable until the SIM is unlocked.
|
||||
log("SIM is pin locked. Not starting fallback timer.");
|
||||
} else {
|
||||
// This means that no pin lock is enabled, so we go ahead and start
|
||||
// the fallback timer.
|
||||
this._applyPromptTimer = this.createTimer(this.applyPromptTimeout);
|
||||
}
|
||||
}.bind(this);
|
||||
pinReq.onerror = function(e) {
|
||||
this._applyPromptTimer = this.createTimer(this.applyPromptTimeout);
|
||||
}
|
||||
}.bind(this);
|
||||
pinReq.onerror = function(e) {
|
||||
}.bind(this);
|
||||
} else {
|
||||
// Schedule a fallback timeout in case the UI is unable to respond or show
|
||||
// a prompt for some reason.
|
||||
this._applyPromptTimer = this.createTimer(this.applyPromptTimeout);
|
||||
}.bind(this);
|
||||
#else
|
||||
// Schedule a fallback timeout in case the UI is unable to respond or show
|
||||
// a prompt for some reason.
|
||||
this._applyPromptTimer = this.createTimer(this.applyPromptTimeout);
|
||||
#endif
|
||||
}
|
||||
},
|
||||
|
||||
_copyProperties: ["appVersion", "buildID", "detailsURL", "displayVersion",
|
||||
@ -553,16 +554,16 @@ UpdatePrompt.prototype = {
|
||||
log("Update downloaded, restarting to apply it");
|
||||
|
||||
let callbackAfterSet = function() {
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup);
|
||||
appStartup.quit(appStartup.eForceQuit | appStartup.eRestart);
|
||||
#else
|
||||
// NB: on Gonk, we rely on the system process manager to restart us.
|
||||
let pmService = Cc["@mozilla.org/power/powermanagerservice;1"]
|
||||
.getService(Ci.nsIPowerManagerService);
|
||||
pmService.restart();
|
||||
#endif
|
||||
if (AppConstants.platform !== "gonk") {
|
||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup);
|
||||
appStartup.quit(appStartup.eForceQuit | appStartup.eRestart);
|
||||
} else {
|
||||
// NB: on Gonk, we rely on the system process manager to restart us.
|
||||
let pmService = Cc["@mozilla.org/power/powermanagerservice;1"]
|
||||
.getService(Ci.nsIPowerManagerService);
|
||||
pmService.restart();
|
||||
}
|
||||
}
|
||||
|
||||
if (useSettings()) {
|
||||
|
@ -44,13 +44,13 @@ EXTRA_PP_COMPONENTS += [
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G'] and not CONFIG['MOZ_B2GDROID']:
|
||||
EXTRA_PP_COMPONENTS += [
|
||||
EXTRA_COMPONENTS += [
|
||||
'DirectoryProvider.js',
|
||||
'RecoveryService.js',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_UPDATER']:
|
||||
EXTRA_PP_COMPONENTS += [
|
||||
EXTRA_COMPONENTS += [
|
||||
'UpdatePrompt.js',
|
||||
]
|
||||
|
||||
@ -64,6 +64,7 @@ EXTRA_JS_MODULES += [
|
||||
'ErrorPage.jsm',
|
||||
'Frames.jsm',
|
||||
'FxAccountsMgmtService.jsm',
|
||||
'KillSwitchMain.jsm',
|
||||
'LogCapture.jsm',
|
||||
'LogParser.jsm',
|
||||
'LogShake.jsm',
|
||||
@ -77,10 +78,6 @@ EXTRA_JS_MODULES += [
|
||||
'WebappsUpdater.jsm',
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
'KillSwitchMain.jsm'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
|
||||
EXTRA_JS_MODULES += [
|
||||
'GlobalSimulatorScreen.jsm'
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
|
||||
<!-- Gecko and Gaia -->
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<!-- Gonk-specific things and forks -->
|
||||
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
|
||||
<project name="platform_build" path="build" remote="b2g" revision="1b0db93fb6b870b03467aff50d6419771ba0d88c">
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
|
||||
<!-- Gecko and Gaia -->
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<!-- Gonk-specific things and forks -->
|
||||
<project name="platform_bionic" path="bionic" remote="b2g" revision="e2b3733ba3fa5e3f404e983d2e4142b1f6b1b846"/>
|
||||
<project name="platform_build" path="build" remote="b2g" revision="1b0db93fb6b870b03467aff50d6419771ba0d88c">
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "97266c579c544f5ba57a701f39893cc86d46774a",
|
||||
"git_revision": "23a94087e701c4bc592f2943e1007e25a9242f97",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "91dde717827095968985b59e5a645b6ac774d015",
|
||||
"revision": "1a71a5a828091c47b1306ca850d8ac882c7c0c0d",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
|
@ -18,10 +18,10 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="97266c579c544f5ba57a701f39893cc86d46774a"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="23a94087e701c4bc592f2943e1007e25a9242f97"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="4a962bdab532e18f53e9d2d114c349983262c6b7"/>
|
||||
@ -24,7 +24,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="5f931350fbc87c3df9db8b0ceb37734b8b471593"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="48d8c7c950745f1b166b42125e6f0d3293d71636"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5de6856fad82857028f9f059f50680a9bea5b75c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="2d70fdfc0244a7217df1cfa7df9f4798cbfa3af6"/>
|
||||
<project name="platform_hardware_libhardware_moz" path="hardware/libhardware_moz" remote="b2g" revision="fdf3a143dc777e5f9d33a88373af7ea161d3b440"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
|
@ -20,10 +20,10 @@ if test -n "$MOZ_NATIVE_ICU"; then
|
||||
PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
|
||||
MOZ_SHARED_ICU=1
|
||||
else
|
||||
MOZ_ICU_CFLAGS="-I$_topsrcdir/intl/icu/source/common -I$_topsrcdir/intl/icu/source/i18n"
|
||||
AC_SUBST_LIST(MOZ_ICU_CFLAGS)
|
||||
MOZ_ICU_INCLUDES="/intl/icu/source/common /intl/icu/source/i18n"
|
||||
fi
|
||||
|
||||
AC_SUBST_LIST(MOZ_ICU_INCLUDES)
|
||||
AC_SUBST(MOZ_NATIVE_ICU)
|
||||
|
||||
MOZ_ARG_WITH_STRING(intl-api,
|
||||
|
@ -183,6 +183,7 @@ app/Message.h
|
||||
app/MessageRunner.h
|
||||
arpa/inet.h
|
||||
arpa/nameser.h
|
||||
array
|
||||
asm/page.h
|
||||
asm/sigcontext.h
|
||||
asm/signal.h
|
||||
|
@ -375,19 +375,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Registry)
|
||||
cb.NoteXPCOMChild(callbacks->mDetachedCallback.Value());
|
||||
}
|
||||
}
|
||||
for (auto iter = tmp->mCandidatesMap.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsTArray<RefPtr<Element>>* elems = iter.UserData();
|
||||
for (size_t i = 0; i < elems->Length(); ++i) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mCandidatesMap->Element");
|
||||
cb.NoteXPCOMChild(elems->ElementAt(i));
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Registry)
|
||||
tmp->mCustomDefinitions.Clear();
|
||||
tmp->mCandidatesMap.Clear();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Registry)
|
||||
@ -5782,16 +5774,16 @@ nsDocument::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTypeName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<Element>>* unresolved;
|
||||
nsTArray<nsWeakPtr>* unresolved;
|
||||
mRegistry->mCandidatesMap.Get(&key, &unresolved);
|
||||
if (!unresolved) {
|
||||
unresolved = new nsTArray<RefPtr<Element>>();
|
||||
unresolved = new nsTArray<nsWeakPtr>();
|
||||
// Ownership of unresolved is taken by mCandidatesMap.
|
||||
mRegistry->mCandidatesMap.Put(&key, unresolved);
|
||||
}
|
||||
|
||||
RefPtr<Element>* elem = unresolved->AppendElement();
|
||||
*elem = aElement;
|
||||
nsWeakPtr* elem = unresolved->AppendElement();
|
||||
*elem = do_GetWeakReference(aElement);
|
||||
aElement->AddStates(NS_EVENT_STATE_UNRESOLVED);
|
||||
|
||||
return NS_OK;
|
||||
@ -6175,11 +6167,14 @@ nsDocument::RegisterElement(JSContext* aCx, const nsAString& aType,
|
||||
definitions.Put(&key, definition);
|
||||
|
||||
// Do element upgrade.
|
||||
nsAutoPtr<nsTArray<RefPtr<Element>>> candidates;
|
||||
nsAutoPtr<nsTArray<nsWeakPtr>> candidates;
|
||||
mRegistry->mCandidatesMap.RemoveAndForget(&key, candidates);
|
||||
if (candidates) {
|
||||
for (size_t i = 0; i < candidates->Length(); ++i) {
|
||||
Element *elem = candidates->ElementAt(i);
|
||||
nsCOMPtr<Element> elem = do_QueryReferent(candidates->ElementAt(i));
|
||||
if (!elem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
elem->RemoveStates(NS_EVENT_STATE_UNRESOLVED);
|
||||
|
||||
|
@ -427,7 +427,7 @@ protected:
|
||||
mozilla::dom::CustomElementDefinition>
|
||||
DefinitionMap;
|
||||
typedef nsClassHashtable<mozilla::dom::CustomElementHashKey,
|
||||
nsTArray<RefPtr<mozilla::dom::Element>>>
|
||||
nsTArray<nsWeakPtr>>
|
||||
CandidateMap;
|
||||
|
||||
// Hashtable for custom element definitions in web components.
|
||||
|
@ -410,51 +410,17 @@ class CGDOMJSClass(CGThing):
|
||||
return ""
|
||||
|
||||
def define(self):
|
||||
traceHook = 'nullptr'
|
||||
callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
|
||||
objectMovedHook = OBJECT_MOVED_HOOK_NAME if self.descriptor.wrapperCache else 'nullptr'
|
||||
slotCount = INSTANCE_RESERVED_SLOTS + self.descriptor.interface.totalMembersInSlots
|
||||
classFlags = "JSCLASS_IS_DOMJSCLASS | "
|
||||
classExtensionAndObjectOps = fill(
|
||||
"""
|
||||
{
|
||||
false, /* isWrappedNative */
|
||||
nullptr, /* weakmapKeyDelegateOp */
|
||||
${objectMoved} /* objectMovedOp */
|
||||
},
|
||||
JS_NULL_OBJECT_OPS
|
||||
""",
|
||||
objectMoved=objectMovedHook)
|
||||
if self.descriptor.isGlobal():
|
||||
classFlags += "JSCLASS_DOM_GLOBAL | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS)"
|
||||
traceHook = "JS_GlobalObjectTraceHook"
|
||||
reservedSlots = "JSCLASS_GLOBAL_APPLICATION_SLOTS"
|
||||
if self.descriptor.interface.identifier.name == "Window":
|
||||
classExtensionAndObjectOps = fill(
|
||||
"""
|
||||
{
|
||||
false, /* isWrappedNative */
|
||||
nullptr, /* weakmapKeyDelegateOp */
|
||||
${objectMoved} /* objectMovedOp */
|
||||
},
|
||||
{
|
||||
nullptr, /* lookupProperty */
|
||||
nullptr, /* defineProperty */
|
||||
nullptr, /* hasProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
nullptr, /* getOwnPropertyDescriptor */
|
||||
nullptr, /* deleteProperty */
|
||||
nullptr, /* watch */
|
||||
nullptr, /* unwatch */
|
||||
nullptr, /* getElements */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* funToString */
|
||||
}
|
||||
""",
|
||||
objectMoved=objectMovedHook)
|
||||
else:
|
||||
classFlags += "JSCLASS_HAS_RESERVED_SLOTS(%d)" % slotCount
|
||||
traceHook = 'nullptr'
|
||||
reservedSlots = slotCount
|
||||
if self.descriptor.interface.getExtendedAttribute("NeedResolve"):
|
||||
resolveHook = RESOLVE_HOOK_NAME
|
||||
@ -487,7 +453,12 @@ class CGDOMJSClass(CGThing):
|
||||
nullptr, /* construct */
|
||||
${trace}, /* trace */
|
||||
JS_NULL_CLASS_SPEC,
|
||||
$*{classExtensionAndObjectOps}
|
||||
{
|
||||
false, /* isWrappedNative */
|
||||
nullptr, /* weakmapKeyDelegateOp */
|
||||
${objectMoved} /* objectMovedOp */
|
||||
},
|
||||
JS_NULL_OBJECT_OPS
|
||||
},
|
||||
$*{descriptor}
|
||||
};
|
||||
@ -505,7 +476,7 @@ class CGDOMJSClass(CGThing):
|
||||
finalize=FINALIZE_HOOK_NAME,
|
||||
call=callHook,
|
||||
trace=traceHook,
|
||||
classExtensionAndObjectOps=classExtensionAndObjectOps,
|
||||
objectMoved=objectMovedHook,
|
||||
descriptor=DOMClass(self.descriptor),
|
||||
instanceReservedSlots=INSTANCE_RESERVED_SLOTS,
|
||||
reservedSlots=reservedSlots,
|
||||
|
@ -107,3 +107,4 @@ LOCAL_INCLUDES += [
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
|
@ -2965,6 +2965,15 @@ ContentChild::RecvShutdown()
|
||||
|
||||
GetIPCChannel()->SetAbortOnError(false);
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
if (profiler_is_active()) {
|
||||
// We're shutting down while we were profiling. Send the
|
||||
// profile up to the parent so that we don't lose this
|
||||
// information.
|
||||
Unused << RecvGatherProfile();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Ignore errors here. If this fails, the parent will kill us after a
|
||||
// timeout.
|
||||
Unused << SendFinishShutdown();
|
||||
|
@ -1569,6 +1569,11 @@ ContentParent::Init()
|
||||
rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsISupports> gatherer;
|
||||
rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
|
||||
|
||||
StartProfiler(currentProfilerParams);
|
||||
}
|
||||
#endif
|
||||
@ -2089,6 +2094,12 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
||||
|
||||
mConsoleService = nullptr;
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
if (mGatherer && !mProfile.IsEmpty()) {
|
||||
mGatherer->OOPExitProfile(mProfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (obs) {
|
||||
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
|
||||
|
||||
@ -3293,6 +3304,7 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
StartProfiler(params);
|
||||
}
|
||||
else if (!strcmp(aTopic, "profiler-stopped")) {
|
||||
mGatherer = nullptr;
|
||||
Unused << SendStopProfiler();
|
||||
}
|
||||
else if (!strcmp(aTopic, "profiler-paused")) {
|
||||
@ -3302,9 +3314,10 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||
Unused << SendPauseProfiler(false);
|
||||
}
|
||||
else if (!strcmp(aTopic, "profiler-subprocess-gather")) {
|
||||
mGatherer = static_cast<ProfileGatherer*>(aSubject);
|
||||
mGatherer->WillGatherOOPProfile();
|
||||
Unused << SendGatherProfile();
|
||||
if (mGatherer) {
|
||||
mGatherer->WillGatherOOPProfile();
|
||||
Unused << SendGatherProfile();
|
||||
}
|
||||
}
|
||||
else if (!strcmp(aTopic, "profiler-subprocess")) {
|
||||
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
|
||||
@ -5656,7 +5669,6 @@ ContentParent::RecvProfile(const nsCString& aProfile)
|
||||
}
|
||||
mProfile = aProfile;
|
||||
mGatherer->GatheredOOPProfile();
|
||||
mGatherer = nullptr;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@ -5747,6 +5759,14 @@ ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
|
||||
ipcParams.threadFilters() = aParams->GetThreadFilterNames();
|
||||
|
||||
Unused << SendStartProfiler(ipcParams);
|
||||
|
||||
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
|
||||
if (NS_WARN_IF(!profiler)) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsISupports> gatherer;
|
||||
profiler->GetProfileGatherer(getter_AddRefs(gatherer));
|
||||
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
void SetCapacity(uint32_t aCapacity) {
|
||||
MOZ_ASSERT(!mBuffer, "Buffer allocated.");
|
||||
mCapacity = aCapacity;
|
||||
mBuffer = new uint8_t[mCapacity];
|
||||
mBuffer = MakeUnique<uint8_t[]>(mCapacity);
|
||||
}
|
||||
|
||||
uint32_t Length() {
|
||||
@ -137,12 +137,12 @@ public:
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
size_t amount = 0;
|
||||
amount += mBuffer.SizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += aMallocSizeOf(mBuffer.get());
|
||||
return amount;
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoArrayPtr<uint8_t> mBuffer;
|
||||
UniquePtr<uint8_t[]> mBuffer;
|
||||
uint32_t mCapacity;
|
||||
uint32_t mStart;
|
||||
uint32_t mCount;
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "MediaCache.h"
|
||||
#include "nsDeque.h"
|
||||
@ -96,7 +97,7 @@ public:
|
||||
explicit BlockChange(const uint8_t* aData)
|
||||
: mSourceBlockIndex(-1)
|
||||
{
|
||||
mData = new uint8_t[BLOCK_SIZE];
|
||||
mData = MakeUnique<uint8_t[]>(BLOCK_SIZE);
|
||||
memcpy(mData.get(), aData, BLOCK_SIZE);
|
||||
}
|
||||
|
||||
@ -105,7 +106,7 @@ public:
|
||||
explicit BlockChange(int32_t aSourceBlockIndex)
|
||||
: mSourceBlockIndex(aSourceBlockIndex) {}
|
||||
|
||||
nsAutoArrayPtr<uint8_t> mData;
|
||||
UniquePtr<uint8_t[]> mData;
|
||||
const int32_t mSourceBlockIndex;
|
||||
|
||||
bool IsMove() const {
|
||||
|
@ -379,7 +379,7 @@ MediaCacheStream::MediaCacheStream(ChannelMediaResource* aClient)
|
||||
mPinCount(0),
|
||||
mCurrentMode(MODE_PLAYBACK),
|
||||
mMetadataInPartialBlockBuffer(false),
|
||||
mPartialBlockBuffer(new int64_t[BLOCK_SIZE/sizeof(int64_t)])
|
||||
mPartialBlockBuffer(MakeUnique<int64_t[]>(BLOCK_SIZE/sizeof(int64_t)))
|
||||
{
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@ size_t MediaCacheStream::SizeOfExcludingThis(
|
||||
size += mReadaheadBlocks.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size += mMetadataBlocks.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size += mPlayedBlocks.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size += mPartialBlockBuffer.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size += aMallocSizeOf(mPartialBlockBuffer.get());
|
||||
|
||||
return size;
|
||||
}
|
||||
@ -1842,7 +1842,7 @@ MediaCacheStream::FlushPartialBlockInternal(bool aNotifyAll,
|
||||
// Write back the partial block
|
||||
memset(reinterpret_cast<char*>(mPartialBlockBuffer.get()) + blockOffset, 0,
|
||||
BLOCK_SIZE - blockOffset);
|
||||
gMediaCache->AllocateAndWriteBlock(this, mPartialBlockBuffer,
|
||||
gMediaCache->AllocateAndWriteBlock(this, mPartialBlockBuffer.get(),
|
||||
mMetadataInPartialBlockBuffer ? MODE_METADATA : MODE_PLAYBACK);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "Intervals.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
||||
@ -510,7 +511,7 @@ private:
|
||||
// Use int64_t so that the data is well-aligned.
|
||||
// Heap allocate this buffer since the exact power-of-2 will cause allocation
|
||||
// slop when combined with the rest of the object members.
|
||||
nsAutoArrayPtr<int64_t> mPartialBlockBuffer;
|
||||
UniquePtr<int64_t[]> mPartialBlockBuffer;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -12,6 +12,7 @@
|
||||
#endif
|
||||
#include "VideoUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <cutils/properties.h>
|
||||
@ -533,8 +534,7 @@ MediaRawData::EnsureCapacity(size_t aSize)
|
||||
if (mData && mCapacity >= sizeNeeded) {
|
||||
return true;
|
||||
}
|
||||
nsAutoArrayPtr<uint8_t> newBuffer;
|
||||
newBuffer = new (fallible) uint8_t[sizeNeeded];
|
||||
auto newBuffer = MakeUniqueFallible<uint8_t[]>(sizeNeeded);
|
||||
if (!newBuffer) {
|
||||
return false;
|
||||
}
|
||||
@ -546,7 +546,7 @@ MediaRawData::EnsureCapacity(size_t aSize)
|
||||
MOZ_ASSERT(uintptr_t(newData) % (RAW_DATA_ALIGNMENT+1) == 0);
|
||||
memcpy(newData, mData, mSize);
|
||||
|
||||
mBuffer = newBuffer.forget();
|
||||
mBuffer = Move(newBuffer);
|
||||
mCapacity = sizeNeeded;
|
||||
mData = newData;
|
||||
|
||||
|
@ -425,7 +425,7 @@ private:
|
||||
bool EnsureCapacity(size_t aSize);
|
||||
uint8_t* mData;
|
||||
size_t mSize;
|
||||
nsAutoArrayPtr<uint8_t> mBuffer;
|
||||
UniquePtr<uint8_t[]> mBuffer;
|
||||
uint32_t mCapacity;
|
||||
CryptoSample mCryptoInternal;
|
||||
MediaRawData(const MediaRawData&); // Not implemented
|
||||
|
@ -577,7 +577,7 @@ private:
|
||||
|
||||
// Returns true if we can play the entire media through without stopping
|
||||
// to buffer, given the current download and playback rates.
|
||||
bool CanPlayThrough();
|
||||
virtual bool CanPlayThrough();
|
||||
|
||||
void SetAudioChannel(dom::AudioChannel aChannel) { mAudioChannel = aChannel; }
|
||||
dom::AudioChannel GetAudioChannel() { return mAudioChannel; }
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIStreamingProtocolService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
@ -72,7 +73,7 @@ public:
|
||||
MOZ_COUNT_CTOR(RtspTrackBuffer);
|
||||
mTrackIdx = aTrackIdx;
|
||||
MOZ_ASSERT(mSlotSize < UINT32_MAX / BUFFER_SLOT_NUM);
|
||||
mRingBuffer = new uint8_t[mTotalBufferSize];
|
||||
mRingBuffer = MakeUnique<uint8_t[]>(mTotalBufferSize);
|
||||
Reset();
|
||||
};
|
||||
~RtspTrackBuffer() {
|
||||
@ -85,7 +86,7 @@ public:
|
||||
size_t size = aMallocSizeOf(this);
|
||||
|
||||
// excluding this
|
||||
size += mRingBuffer.SizeOfExcludingThis(aMallocSizeOf);
|
||||
size += aMallocSizeOf(mRingBuffer.get());
|
||||
|
||||
return size;
|
||||
}
|
||||
@ -179,7 +180,7 @@ private:
|
||||
BufferSlotData mBufferSlotData[BUFFER_SLOT_NUM];
|
||||
|
||||
// The ring buffer pointer.
|
||||
nsAutoArrayPtr<uint8_t> mRingBuffer;
|
||||
UniquePtr<uint8_t[]> mRingBuffer;
|
||||
// Each slot's size.
|
||||
uint32_t mSlotSize;
|
||||
// Total mRingBuffer's total size.
|
||||
|
@ -68,7 +68,7 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
|
||||
data.mYSize = gfx::IntSize(aSize.width, aSize.height);
|
||||
data.mYStride = (int32_t) (aSize.width * lumaBpp / 8.0);
|
||||
data.mCbCrStride = (int32_t) (aSize.width * chromaBpp / 8.0);
|
||||
data.mCbChannel = frame.rwget() + aSize.height * data.mYStride;
|
||||
data.mCbChannel = frame.get() + aSize.height * data.mYStride;
|
||||
data.mCrChannel = data.mCbChannel + aSize.height * data.mCbCrStride / 2;
|
||||
data.mCbCrSize = gfx::IntSize(aSize.width / 2, aSize.height / 2);
|
||||
data.mPicX = 0;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISocketTransport.h"
|
||||
@ -263,7 +264,7 @@ ServeResourceEvent::Run() {
|
||||
// HTTP response headers sent below. A static_assert ensures
|
||||
// this where the buffer is used.
|
||||
const int buffer_size = 32768;
|
||||
nsAutoArrayPtr<char> b(new char[buffer_size]);
|
||||
auto b = MakeUnique<char[]>(buffer_size);
|
||||
|
||||
// If we know the length of the resource, send a Content-Length header.
|
||||
int64_t contentlength = resource->GetLength() - start;
|
||||
@ -271,8 +272,8 @@ ServeResourceEvent::Run() {
|
||||
static_assert (buffer_size > 1024,
|
||||
"buffer_size must be large enough "
|
||||
"to hold response headers");
|
||||
snprintf(b, buffer_size, "Content-Length: %" PRId64 "\r\n", contentlength);
|
||||
rv = WriteAll(b, strlen(b));
|
||||
snprintf(b.get(), buffer_size, "Content-Length: %" PRId64 "\r\n", contentlength);
|
||||
rv = WriteAll(b.get(), strlen(b.get()));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
}
|
||||
|
||||
@ -282,10 +283,10 @@ ServeResourceEvent::Run() {
|
||||
static_assert (buffer_size > 1024,
|
||||
"buffer_size must be large enough "
|
||||
"to hold response headers");
|
||||
snprintf(b, buffer_size, "Content-Range: "
|
||||
snprintf(b.get(), buffer_size, "Content-Range: "
|
||||
"bytes %" PRId64 "-%" PRId64 "/%" PRId64 "\r\n",
|
||||
start, resource->GetLength() - 1, resource->GetLength());
|
||||
rv = WriteAll(b, strlen(b));
|
||||
rv = WriteAll(b.get(), strlen(b.get()));
|
||||
if (NS_FAILED(rv)) { Shutdown(); return NS_OK; }
|
||||
}
|
||||
|
||||
@ -297,7 +298,7 @@ ServeResourceEvent::Run() {
|
||||
|
||||
// Read data from media resource
|
||||
uint32_t bytesRead = 0; // Number of bytes read/written to streams
|
||||
rv = resource->ReadAt(start, b, buffer_size, &bytesRead);
|
||||
rv = resource->ReadAt(start, b.get(), buffer_size, &bytesRead);
|
||||
while (NS_SUCCEEDED(rv) && bytesRead != 0) {
|
||||
// Keep track of what we think the starting position for the next read
|
||||
// is. This is used in subsequent ReadAt calls to ensure we are reading
|
||||
@ -306,10 +307,10 @@ ServeResourceEvent::Run() {
|
||||
start += bytesRead;
|
||||
|
||||
// Write data obtained from media resource to output stream
|
||||
rv = WriteAll(b, bytesRead);
|
||||
rv = WriteAll(b.get(), bytesRead);
|
||||
if (NS_FAILED (rv)) break;
|
||||
|
||||
rv = resource->ReadAt(start, b, 32768, &bytesRead);
|
||||
rv = resource->ReadAt(start, b.get(), 32768, &bytesRead);
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
|
@ -209,11 +209,12 @@ MediaKeySession::GenerateRequest(const nsAString& aInitDataType,
|
||||
aInitDataType, data);
|
||||
|
||||
EME_LOG("MediaKeySession[%p,'%s'] GenerateRequest() sent, "
|
||||
"promiseId=%d initData(base64)='%s'",
|
||||
"promiseId=%d initData(base64)='%s' initDataType='%s'",
|
||||
this,
|
||||
NS_ConvertUTF16toUTF8(mSessionId).get(),
|
||||
pid,
|
||||
base64InitData.get());
|
||||
base64InitData.get(),
|
||||
NS_ConvertUTF16toUTF8(aInitDataType).get());
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
@ -441,9 +441,12 @@ GetSupportedConfig(mozIGeckoMediaPluginService* aGMPService,
|
||||
if (aCandidate.mInitDataTypes.WasPassed()) {
|
||||
nsTArray<nsString> initDataTypes;
|
||||
for (const nsString& candidate : aCandidate.mInitDataTypes.Value()) {
|
||||
// All supported keySystems can handle "cenc" initDataType.
|
||||
// ClearKey also supports "keyids" and "webm" initDataTypes.
|
||||
if (candidate.EqualsLiteral("cenc")) {
|
||||
initDataTypes.AppendElement(candidate);
|
||||
} else if (candidate.EqualsLiteral("keyids") &&
|
||||
} else if ((candidate.EqualsLiteral("keyids") ||
|
||||
candidate.EqualsLiteral("webm)")) &&
|
||||
aKeySystem.EqualsLiteral("org.w3.clearkey")) {
|
||||
initDataTypes.AppendElement(candidate);
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ TrackRunBox::fillSampleTable()
|
||||
return 0;
|
||||
}
|
||||
uint32_t len = frames.Length();
|
||||
sample_info_table = new tbl[len];
|
||||
sample_info_table = MakeUnique<tbl[]>(len);
|
||||
// Create sample table according to 14496-12 8.8.8.2.
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
// Sample size.
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "MuxerOperation.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#define WRITE_FULLBOX(_compositor, _size) \
|
||||
BoxSizeChecker checker(_compositor, _size); \
|
||||
@ -262,7 +263,7 @@ public:
|
||||
// the following are optional fields
|
||||
uint32_t data_offset; // data offset exists when audio/video are present in file.
|
||||
uint32_t first_sample_flags;
|
||||
nsAutoArrayPtr<tbl> sample_info_table;
|
||||
UniquePtr<tbl[]> sample_info_table;
|
||||
|
||||
// MuxerOperation methods
|
||||
nsresult Generate(uint32_t* aBoxSize) override;
|
||||
@ -404,7 +405,7 @@ public:
|
||||
} tbl;
|
||||
|
||||
uint32_t entry_count;
|
||||
nsAutoArrayPtr<tbl> sample_tbl;
|
||||
UniquePtr<tbl[]> sample_tbl;
|
||||
|
||||
// MuxerOperation methods
|
||||
nsresult Generate(uint32_t* aBoxSize) override;
|
||||
@ -430,7 +431,7 @@ public:
|
||||
} tbl;
|
||||
|
||||
uint32_t entry_count;
|
||||
nsAutoArrayPtr<tbl> sample_tbl;
|
||||
UniquePtr<tbl[]> sample_tbl;
|
||||
|
||||
// MuxerOperation methods
|
||||
nsresult Generate(uint32_t* aBoxSize) override;
|
||||
@ -455,7 +456,7 @@ public:
|
||||
} tbl;
|
||||
|
||||
uint32_t entry_count;
|
||||
nsAutoArrayPtr<tbl> sample_tbl;
|
||||
UniquePtr<tbl[]> sample_tbl;
|
||||
|
||||
// MuxerOperation methods
|
||||
nsresult Generate(uint32_t* aBoxSize) override;
|
||||
|
@ -44,7 +44,7 @@ MP4Stream::BlockingReadIntoCache(int64_t aOffset, size_t aCount, Monitor* aToUnl
|
||||
MOZ_ASSERT(block.mCount >= bytesRead);
|
||||
block.mCount = bytesRead;
|
||||
|
||||
mCache.AppendElement(block);
|
||||
mCache.AppendElement(Move(block));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -74,9 +75,15 @@ private:
|
||||
int64_t mOffset;
|
||||
size_t mCount;
|
||||
|
||||
CacheBlock(CacheBlock&& aOther)
|
||||
: mOffset(aOther.mOffset)
|
||||
, mCount(aOther.mCount)
|
||||
, mBuffer(Move(aOther.mBuffer))
|
||||
{}
|
||||
|
||||
bool Init()
|
||||
{
|
||||
mBuffer = new (fallible) char[mCount];
|
||||
mBuffer = MakeUniqueFallible<char[]>(mCount);
|
||||
return !!mBuffer;
|
||||
}
|
||||
|
||||
@ -87,7 +94,10 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoArrayPtr<char> mBuffer;
|
||||
CacheBlock(const CacheBlock&) = delete;
|
||||
CacheBlock& operator=(const CacheBlock&) = delete;
|
||||
|
||||
UniquePtr<char[]> mBuffer;
|
||||
};
|
||||
nsTArray<CacheBlock> mCache;
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "GMPLoader.h"
|
||||
#include <stdio.h>
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "gmp-entrypoints.h"
|
||||
#include "prlink.h"
|
||||
#include "prenv.h"
|
||||
@ -247,12 +248,12 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath,
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<wchar_t> widePath(new wchar_t[pathLen]);
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, widePath, pathLen) == 0) {
|
||||
auto widePath = MakeUnique<wchar_t[]>(pathLen);
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, widePath.get(), pathLen) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
libSpec.value.pathname_u = widePath;
|
||||
libSpec.value.pathname_u = widePath.get();
|
||||
libSpec.type = PR_LibSpec_PathnameU;
|
||||
#else
|
||||
libSpec.value.pathname = aUTF8LibPath;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "MediaFormatReader.h"
|
||||
#include "MediaSourceDemuxer.h"
|
||||
#include "SourceBufferList.h"
|
||||
#include <algorithm>
|
||||
|
||||
extern mozilla::LogModule* GetMediaSourceLog();
|
||||
|
||||
@ -250,6 +251,47 @@ MediaSourceDecoder::GetDuration()
|
||||
return ExplicitDuration();
|
||||
}
|
||||
|
||||
MediaDecoderOwner::NextFrameStatus
|
||||
MediaSourceDecoder::NextFrameBufferedStatus()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
// Next frame hasn't been decoded yet.
|
||||
// Use the buffered range to consider if we have the next frame available.
|
||||
TimeUnit currentPosition = TimeUnit::FromMicroseconds(CurrentPosition());
|
||||
TimeInterval interval(currentPosition,
|
||||
currentPosition + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED),
|
||||
MediaSourceDemuxer::EOS_FUZZ);
|
||||
return GetBuffered().Contains(interval)
|
||||
? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
|
||||
: MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
|
||||
}
|
||||
|
||||
bool
|
||||
MediaSourceDecoder::CanPlayThrough()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (IsNaN(mMediaSource->Duration())) {
|
||||
// Don't have any data yet.
|
||||
return false;
|
||||
}
|
||||
TimeUnit duration = TimeUnit::FromSeconds(mMediaSource->Duration());
|
||||
TimeUnit currentPosition = TimeUnit::FromMicroseconds(CurrentPosition());
|
||||
if (duration.IsInfinite()) {
|
||||
// We can't make an informed decision and just assume that it's a live stream
|
||||
return true;
|
||||
} else if (duration <= currentPosition) {
|
||||
return true;
|
||||
}
|
||||
// If we have data up to the mediasource's duration or 30s ahead, we can
|
||||
// assume that we can play without interruption.
|
||||
TimeUnit timeAhead =
|
||||
std::min(duration, currentPosition + TimeUnit::FromSeconds(30));
|
||||
TimeInterval interval(currentPosition,
|
||||
timeAhead,
|
||||
MediaSourceDemuxer::EOS_FUZZ);
|
||||
return GetBuffered().Contains(interval);
|
||||
}
|
||||
|
||||
#undef MSE_DEBUG
|
||||
#undef MSE_DEBUGV
|
||||
|
||||
|
@ -77,6 +77,9 @@ public:
|
||||
|
||||
void AddSizeOfResources(ResourceSizes* aSizes) override;
|
||||
|
||||
MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus() override;
|
||||
bool CanPlayThrough() override;
|
||||
|
||||
private:
|
||||
void DoSetMediaSourceDuration(double aDuration);
|
||||
|
||||
|
@ -19,11 +19,6 @@ typedef TrackInfo::TrackType TrackType;
|
||||
using media::TimeUnit;
|
||||
using media::TimeIntervals;
|
||||
|
||||
// Gap allowed between frames. Due to inaccuracies in determining buffer end
|
||||
// frames (Bug 1065207). This value is based on the end of frame
|
||||
// default value used in Blink, kDefaultBufferDurationInMs.
|
||||
#define EOS_FUZZ_US 125000
|
||||
|
||||
MediaSourceDemuxer::MediaSourceDemuxer()
|
||||
: mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true))
|
||||
@ -32,6 +27,11 @@ MediaSourceDemuxer::MediaSourceDemuxer()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
}
|
||||
|
||||
// Due to inaccuracies in determining buffer end
|
||||
// frames (Bug 1065207). This value is based on the end of frame
|
||||
// default value used in Blink, kDefaultBufferDurationInMs.
|
||||
const TimeUnit MediaSourceDemuxer::EOS_FUZZ = media::TimeUnit::FromMicroseconds(125000);
|
||||
|
||||
RefPtr<MediaSourceDemuxer::InitPromise>
|
||||
MediaSourceDemuxer::Init()
|
||||
{
|
||||
@ -375,7 +375,7 @@ RefPtr<MediaSourceTrackDemuxer::SeekPromise>
|
||||
MediaSourceTrackDemuxer::DoSeek(media::TimeUnit aTime)
|
||||
{
|
||||
TimeIntervals buffered = mManager->Buffered(mType);
|
||||
buffered.SetFuzz(TimeUnit::FromMicroseconds(EOS_FUZZ_US));
|
||||
buffered.SetFuzz(MediaSourceDemuxer::EOS_FUZZ);
|
||||
|
||||
if (!buffered.Contains(aTime)) {
|
||||
// We don't have the data to seek to.
|
||||
@ -383,7 +383,7 @@ MediaSourceTrackDemuxer::DoSeek(media::TimeUnit aTime)
|
||||
__func__);
|
||||
}
|
||||
TimeUnit seekTime =
|
||||
mManager->Seek(mType, aTime, TimeUnit::FromMicroseconds(EOS_FUZZ_US));
|
||||
mManager->Seek(mType, aTime, MediaSourceDemuxer::EOS_FUZZ);
|
||||
{
|
||||
MonitorAutoLock mon(mMonitor);
|
||||
mNextRandomAccessPoint = mManager->GetNextRandomAccessPoint(mType);
|
||||
@ -395,9 +395,10 @@ RefPtr<MediaSourceTrackDemuxer::SamplesPromise>
|
||||
MediaSourceTrackDemuxer::DoGetSamples(int32_t aNumSamples)
|
||||
{
|
||||
bool error;
|
||||
RefPtr<MediaRawData> sample = mManager->GetSample(mType,
|
||||
TimeUnit::FromMicroseconds(EOS_FUZZ_US),
|
||||
error);
|
||||
RefPtr<MediaRawData> sample =
|
||||
mManager->GetSample(mType,
|
||||
MediaSourceDemuxer::EOS_FUZZ,
|
||||
error);
|
||||
if (!sample) {
|
||||
if (error) {
|
||||
return SamplesPromise::CreateAndReject(DemuxerFailureReason::DEMUXER_ERROR, __func__);
|
||||
|
@ -55,6 +55,9 @@ public:
|
||||
|
||||
void AddSizeOfResources(MediaSourceDecoder::ResourceSizes* aSizes);
|
||||
|
||||
// Gap allowed between frames.
|
||||
static const media::TimeUnit EOS_FUZZ;
|
||||
|
||||
private:
|
||||
~MediaSourceDemuxer();
|
||||
friend class MediaSourceTrackDemuxer;
|
||||
|
@ -63,6 +63,8 @@ skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac"))
|
||||
[test_MultipleInitSegments.html]
|
||||
[test_MultipleInitSegments_mp4.html]
|
||||
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
|
||||
[test_PlayEvents.html]
|
||||
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
|
||||
[test_SeekableAfterEndOfStream.html]
|
||||
[test_SeekableAfterEndOfStream_mp4.html]
|
||||
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
|
||||
|
156
dom/media/mediasource/test/test_PlayEvents.html
Normal file
156
dom/media/mediasource/test/test_PlayEvents.html
Normal file
@ -0,0 +1,156 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>MSE: basic functionality</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="mediasource.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// This test checks that readyState is properly set and the appropriate events are being fired accordingly:
|
||||
// 1. Load 1.6s of data and ensure that canplay event is fired.
|
||||
// 2. Load data to have a complete buffered range from 0 to duration and ensure that canplaythrough is fired.
|
||||
// 3. Seek to an area with no buffered data, and ensure that readyState goes back to HAVE_METADATA
|
||||
// 4. Load 1.6s of data at the seek position and ensure that canplay is fired and that readyState is now HAVE_FUTURE_DATA
|
||||
// 5. Start playing video and check that once it reaches a position with no data, readyState goes back to HAVE_CURRENT_DATA and waiting event is fired.
|
||||
// 6. Add 1.6s of data once video element fired waiting, that canplay is fired once readyState is HAVE_FUTURE_DATA.
|
||||
// 7. Finally load data to the end and ensure that canplaythrough is fired and that readyState is now HAVE_ENOUGH_DATA
|
||||
|
||||
runWithMSE(function(ms, el) {
|
||||
el.controls = true;
|
||||
once(ms, 'sourceopen').then(function() {
|
||||
ok(true, "Receive a sourceopen event");
|
||||
var videosb = ms.addSourceBuffer("video/mp4");
|
||||
el.addEventListener("error", function(e) {
|
||||
ok(false, "should not fire '" + e + "' event");
|
||||
});
|
||||
is(el.readyState, el.HAVE_NOTHING, "readyState is HAVE_NOTHING");
|
||||
fetchAndLoad(videosb, 'bipbop/bipbop_video', ['init'], '.mp4')
|
||||
.then(once.bind(null, el, 'loadedmetadata'))
|
||||
.then(function() {
|
||||
ok(true, "got loadedmetadata event");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'loadeddata'));
|
||||
promises.push(once(el, 'canplay'));
|
||||
// Load [0, 1.601666). We must ensure that we load over 25 frames as the
|
||||
// windows H264 decoder will not produce a sample until then
|
||||
// (bug 1191138).
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(1, 3), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got canplay event");
|
||||
// set element duration to 3.203333s. We do so in order to guarantee that
|
||||
// the end of the buffered range will be equal to duration, causing
|
||||
// canplaythrough to be fired later.
|
||||
ms.duration = 3.203333;
|
||||
return once(el, 'durationchange');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got durationchange event");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'canplaythrough'));
|
||||
// Load [0.801666, 3.203333]
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(3, 5), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got canplaythrough event");
|
||||
// set element duration to 9.203333s, this value is set to coincide with
|
||||
// data added later (we now have an empty range from 6s to 9.203333s).
|
||||
ms.duration = 9.203333;
|
||||
return once(el, 'durationchange');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got durationchange event");
|
||||
// An arbitrary value, so we are guaranteed to be in a range with no data.
|
||||
el.currentTime = 6;
|
||||
videosb.timestampOffset = 6;
|
||||
ok(el.seeking, "seeking started");
|
||||
return once(el, 'seeking');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got seeking event");
|
||||
is(el.readyState, el.HAVE_METADATA, "readyState is HAVE_METADATA");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'seeked'));
|
||||
promises.push(once(el, 'canplay'));
|
||||
// Load [6+0, 6+1.601666)
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(1, 3), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got seeked and canplay event");
|
||||
is(el.currentTime, 6, "seeked to 6s");
|
||||
is(el.readyState, el.HAVE_FUTURE_DATA, "readyState is HAVE_FUTURE_DATA");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'canplaythrough'));
|
||||
// Load [6+1.60166, 6+3.203333]
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(3, 5), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got canplaythrough event");
|
||||
// set element duration to 19.805s, this value is set to coincide with
|
||||
// data added later (we now have an empty range from 15 to 19.805).
|
||||
ms.duration = 19.805;
|
||||
return once(el, 'durationchange');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got durationchange event");
|
||||
el.currentTime = 15;
|
||||
videosb.timestampOffset = 15;
|
||||
ok(el.seeking, "seeking started");
|
||||
return once(el, 'seeking');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got seeking event");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'seeked'));
|
||||
// Load [15+0, 15+1.601666)
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(1, 3), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got seeked event");
|
||||
// Load [15+1.60166, 15+3.203333]
|
||||
return fetchAndLoad(videosb, 'bipbop/bipbop_video', range(3, 5), '.m4s');
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "data loaded");
|
||||
// Playback we play for a little while then stall.
|
||||
var promises = [];
|
||||
promises.push(once(el, 'playing'));
|
||||
promises.push(once(el, 'waiting'));
|
||||
el.play();
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got playing and waiting event");
|
||||
// Playback has stalled, readyState is back to HAVE_CURRENT_DATA.
|
||||
is(el.readyState, el.HAVE_CURRENT_DATA, "readyState is HAVE_CURRENT_DATA");
|
||||
var promises = [];
|
||||
promises.push(once(el, 'playing'));
|
||||
promises.push(once(el, 'canplay'));
|
||||
promises.push(once(el, 'canplaythrough'));
|
||||
// Load [15+3.203333, 15+4.805)
|
||||
// Our final buffered range will now be [0, 3.203333)[6, 9.203333)[15, 19.805)
|
||||
promises.push(fetchAndLoad(videosb, 'bipbop/bipbop_video', range(5, 7), '.m4s'));
|
||||
return Promise.all(promises);
|
||||
})
|
||||
.then(function() {
|
||||
ok(true, "got playing, canplay and canplaythrough event");
|
||||
SimpleTest.finish();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/mozalloc.h" // for operator new, and new (fallible)
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsRect.h"
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "TimeUnits.h"
|
||||
@ -118,12 +119,12 @@ public:
|
||||
// with a U and V plane that are half the size of the Y plane, i.e 8 bit,
|
||||
// 2x2 subsampled. Have the data pointers of each frame point to the
|
||||
// first plane, they'll always be zero'd memory anyway.
|
||||
nsAutoArrayPtr<uint8_t> frame(new uint8_t[mFrameWidth * mFrameHeight]);
|
||||
memset(frame, 0, mFrameWidth * mFrameHeight);
|
||||
auto frame = MakeUnique<uint8_t[]>(mFrameWidth * mFrameHeight);
|
||||
memset(frame.get(), 0, mFrameWidth * mFrameHeight);
|
||||
VideoData::YCbCrBuffer buffer;
|
||||
|
||||
// Y plane.
|
||||
buffer.mPlanes[0].mData = frame;
|
||||
buffer.mPlanes[0].mData = frame.get();
|
||||
buffer.mPlanes[0].mStride = mFrameWidth;
|
||||
buffer.mPlanes[0].mHeight = mFrameHeight;
|
||||
buffer.mPlanes[0].mWidth = mFrameWidth;
|
||||
@ -131,7 +132,7 @@ public:
|
||||
buffer.mPlanes[0].mSkip = 0;
|
||||
|
||||
// Cb plane.
|
||||
buffer.mPlanes[1].mData = frame;
|
||||
buffer.mPlanes[1].mData = frame.get();
|
||||
buffer.mPlanes[1].mStride = mFrameWidth / 2;
|
||||
buffer.mPlanes[1].mHeight = mFrameHeight / 2;
|
||||
buffer.mPlanes[1].mWidth = mFrameWidth / 2;
|
||||
@ -139,7 +140,7 @@ public:
|
||||
buffer.mPlanes[1].mSkip = 0;
|
||||
|
||||
// Cr plane.
|
||||
buffer.mPlanes[2].mData = frame;
|
||||
buffer.mPlanes[2].mData = frame.get();
|
||||
buffer.mPlanes[2].mStride = mFrameWidth / 2;
|
||||
buffer.mPlanes[2].mHeight = mFrameHeight / 2;
|
||||
buffer.mPlanes[2].mWidth = mFrameWidth / 2;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "MediaInfo.h"
|
||||
#include "AppleATDecoder.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
extern mozilla::LogModule* GetPDMLog();
|
||||
#define LOG(...) MOZ_LOG(GetPDMLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
|
||||
@ -211,8 +212,7 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample)
|
||||
const uint32_t maxDecodedSamples = MAX_AUDIO_FRAMES * channels;
|
||||
|
||||
// Descriptions for _decompressed_ audio packets. ignored.
|
||||
nsAutoArrayPtr<AudioStreamPacketDescription>
|
||||
packets(new AudioStreamPacketDescription[MAX_AUDIO_FRAMES]);
|
||||
auto packets = MakeUnique<AudioStreamPacketDescription[]>(MAX_AUDIO_FRAMES);
|
||||
|
||||
// This API insists on having packets spoon-fed to it from a callback.
|
||||
// This structure exists only to pass our state.
|
||||
@ -220,7 +220,7 @@ AppleATDecoder::DecodeSample(MediaRawData* aSample)
|
||||
{ channels, (UInt32)aSample->Size(), aSample->Data() };
|
||||
|
||||
// Decompressed audio buffer
|
||||
nsAutoArrayPtr<AudioDataValue> decoded(new AudioDataValue[maxDecodedSamples]);
|
||||
auto decoded = MakeUnique<AudioDataValue[]>(maxDecodedSamples);
|
||||
|
||||
do {
|
||||
AudioBufferList decBuffer;
|
||||
@ -328,14 +328,13 @@ AppleATDecoder::GetInputAudioDescription(AudioStreamBasicDescription& aDesc,
|
||||
return NS_OK;
|
||||
}
|
||||
size_t listCount = formatListSize / sizeof(AudioFormatListItem);
|
||||
nsAutoArrayPtr<AudioFormatListItem> formatList(
|
||||
new AudioFormatListItem[listCount]);
|
||||
auto formatList = MakeUnique<AudioFormatListItem[]>(listCount);
|
||||
|
||||
rv = AudioFormatGetProperty(kAudioFormatProperty_FormatList,
|
||||
sizeof(formatInfo),
|
||||
&formatInfo,
|
||||
&formatListSize,
|
||||
formatList);
|
||||
formatList.get());
|
||||
if (rv) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -348,7 +347,7 @@ AppleATDecoder::GetInputAudioDescription(AudioStreamBasicDescription& aDesc,
|
||||
UInt32 indexSize = sizeof(itemIndex);
|
||||
rv = AudioFormatGetProperty(kAudioFormatProperty_FirstPlayableFormatFromList,
|
||||
formatListSize,
|
||||
formatList,
|
||||
formatList.get(),
|
||||
&indexSize,
|
||||
&itemIndex);
|
||||
if (rv) {
|
||||
@ -438,9 +437,9 @@ _MetadataCallback(void* aAppleATDecoder,
|
||||
decoder->mFileStreamError = true;
|
||||
return;
|
||||
}
|
||||
nsAutoArrayPtr<uint8_t> data(new uint8_t[size]);
|
||||
auto data = MakeUnique<uint8_t[]>(size);
|
||||
rv = AudioFileStreamGetProperty(aStream, aProperty,
|
||||
&size, data);
|
||||
&size, data.get());
|
||||
if (rv) {
|
||||
LOG("Couldn't get property '%s' (%s)",
|
||||
FourCC2Str(aProperty), FourCC2Str(rv));
|
||||
|
@ -669,8 +669,7 @@ GonkVideoDecoderManager::GetColorConverterBuffer(int32_t aWidth, int32_t aHeight
|
||||
size_t yuv420p_v_size = yuv420p_u_size;
|
||||
size_t yuv420p_size = yuv420p_y_size + yuv420p_u_size + yuv420p_v_size;
|
||||
if (mColorConverterBufferSize != yuv420p_size) {
|
||||
mColorConverterBuffer = nullptr; // release the previous buffer first
|
||||
mColorConverterBuffer = new uint8_t[yuv420p_size];
|
||||
mColorConverterBuffer = MakeUnique<uint8_t[]>(yuv420p_size);
|
||||
mColorConverterBufferSize = yuv420p_size;
|
||||
}
|
||||
return mColorConverterBuffer.get();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "GonkNativeWindow.h"
|
||||
#include "GonkNativeWindowClient.h"
|
||||
#include "mozilla/layers/FenceUtils.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include <ui/Fence.h>
|
||||
|
||||
using namespace android;
|
||||
@ -112,7 +113,7 @@ private:
|
||||
|
||||
// color converter
|
||||
android::I420ColorConverterHelper mColorConverter;
|
||||
nsAutoArrayPtr<uint8_t> mColorConverterBuffer;
|
||||
UniquePtr<uint8_t[]> mColorConverterBuffer;
|
||||
size_t mColorConverterBufferSize;
|
||||
|
||||
android::sp<android::GonkNativeWindow> mNativeWindow;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "VideoUtils.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::media;
|
||||
@ -138,7 +139,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
int64_t currentFrameTime = USECS_PER_S * mCurrentFrame / mFrameRate;
|
||||
uint32_t length = mFrameSize - sizeof(RawPacketHeader);
|
||||
|
||||
nsAutoArrayPtr<uint8_t> buffer(new uint8_t[length]);
|
||||
auto buffer = MakeUnique<uint8_t[]>(length);
|
||||
|
||||
// We're always decoding one frame when called
|
||||
while(true) {
|
||||
@ -151,7 +152,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ReadFromResource(buffer, length)) {
|
||||
if (!ReadFromResource(buffer.get(), length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -165,7 +166,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
}
|
||||
|
||||
VideoData::YCbCrBuffer b;
|
||||
b.mPlanes[0].mData = buffer;
|
||||
b.mPlanes[0].mData = buffer.get();
|
||||
b.mPlanes[0].mStride = mMetadata.frameWidth * mMetadata.lumaChannelBpp / 8.0;
|
||||
b.mPlanes[0].mHeight = mMetadata.frameHeight;
|
||||
b.mPlanes[0].mWidth = mMetadata.frameWidth;
|
||||
@ -173,7 +174,7 @@ bool RawReader::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
|
||||
uint32_t cbcrStride = mMetadata.frameWidth * mMetadata.chromaChannelBpp / 8.0;
|
||||
|
||||
b.mPlanes[1].mData = buffer + mMetadata.frameHeight * b.mPlanes[0].mStride;
|
||||
b.mPlanes[1].mData = buffer.get() + mMetadata.frameHeight * b.mPlanes[0].mStride;
|
||||
b.mPlanes[1].mStride = cbcrStride;
|
||||
b.mPlanes[1].mHeight = mMetadata.frameHeight / 2;
|
||||
b.mPlanes[1].mWidth = mMetadata.frameWidth / 2;
|
||||
|
@ -128,7 +128,6 @@ public:
|
||||
}
|
||||
|
||||
CamerasChild* GetCamerasChild() {
|
||||
MOZ_ASSERT(mCamerasChild);
|
||||
return mCamerasChild;
|
||||
}
|
||||
|
||||
@ -137,8 +136,8 @@ private:
|
||||
};
|
||||
|
||||
static CamerasChild*
|
||||
Cameras() {
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
GetCamerasChild() {
|
||||
CamerasSingleton::Mutex().AssertCurrentThreadOwns();
|
||||
if (!CamerasSingleton::Child()) {
|
||||
MOZ_ASSERT(!NS_IsMainThread(), "Should not be on the main Thread");
|
||||
MOZ_ASSERT(!CamerasSingleton::Thread());
|
||||
@ -162,7 +161,9 @@ Cameras() {
|
||||
sr->DispatchToThread(CamerasSingleton::Thread());
|
||||
CamerasSingleton::Child() = runnable->GetCamerasChild();
|
||||
}
|
||||
MOZ_ASSERT(CamerasSingleton::Child());
|
||||
if (!CamerasSingleton::Child()) {
|
||||
LOG(("Failed to set up CamerasChild, are we in shutdown?"));
|
||||
}
|
||||
return CamerasSingleton::Child();
|
||||
}
|
||||
|
||||
@ -190,7 +191,13 @@ CamerasChild::RecvReplySuccess(void)
|
||||
|
||||
int NumberOfCapabilities(CaptureEngine aCapEngine, const char* deviceUniqueIdUTF8)
|
||||
{
|
||||
return Cameras()->NumberOfCapabilities(aCapEngine, deviceUniqueIdUTF8);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->NumberOfCapabilities(aCapEngine, deviceUniqueIdUTF8);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -209,10 +216,8 @@ bool
|
||||
CamerasChild::DispatchToParent(nsIRunnable* aRunnable,
|
||||
MonitorAutoLock& aMonitor)
|
||||
{
|
||||
{
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasSingleton::Thread()->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
CamerasSingleton::Mutex().AssertCurrentThreadOwns();
|
||||
CamerasSingleton::Thread()->Dispatch(aRunnable, NS_DISPATCH_NORMAL);
|
||||
// We can't see if the send worked, so we need to be able to bail
|
||||
// out on shutdown (when it failed and we won't get a reply).
|
||||
if (!mIPCIsAlive) {
|
||||
@ -260,7 +265,13 @@ CamerasChild::NumberOfCapabilities(CaptureEngine aCapEngine,
|
||||
|
||||
int NumberOfCaptureDevices(CaptureEngine aCapEngine)
|
||||
{
|
||||
return Cameras()->NumberOfCaptureDevices(aCapEngine);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->NumberOfCaptureDevices(aCapEngine);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -300,10 +311,16 @@ int GetCaptureCapability(CaptureEngine aCapEngine, const char* unique_idUTF8,
|
||||
const unsigned int capability_number,
|
||||
webrtc::CaptureCapability& capability)
|
||||
{
|
||||
return Cameras()->GetCaptureCapability(aCapEngine,
|
||||
unique_idUTF8,
|
||||
capability_number,
|
||||
capability);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->GetCaptureCapability(aCapEngine,
|
||||
unique_idUTF8,
|
||||
capability_number,
|
||||
capability);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -355,12 +372,18 @@ int GetCaptureDevice(CaptureEngine aCapEngine,
|
||||
char* unique_idUTF8,
|
||||
const unsigned int unique_idUTF8Length)
|
||||
{
|
||||
return Cameras()->GetCaptureDevice(aCapEngine,
|
||||
list_number,
|
||||
device_nameUTF8,
|
||||
device_nameUTF8Length,
|
||||
unique_idUTF8,
|
||||
unique_idUTF8Length);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->GetCaptureDevice(aCapEngine,
|
||||
list_number,
|
||||
device_nameUTF8,
|
||||
device_nameUTF8Length,
|
||||
unique_idUTF8,
|
||||
unique_idUTF8Length);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -409,10 +432,16 @@ int AllocateCaptureDevice(CaptureEngine aCapEngine,
|
||||
const unsigned int unique_idUTF8Length,
|
||||
int& capture_id)
|
||||
{
|
||||
return Cameras()->AllocateCaptureDevice(aCapEngine,
|
||||
unique_idUTF8,
|
||||
unique_idUTF8Length,
|
||||
capture_id);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->AllocateCaptureDevice(aCapEngine,
|
||||
unique_idUTF8,
|
||||
unique_idUTF8Length,
|
||||
capture_id);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -456,7 +485,13 @@ CamerasChild::RecvReplyAllocateCaptureDevice(const int& numdev)
|
||||
|
||||
int ReleaseCaptureDevice(CaptureEngine aCapEngine, const int capture_id)
|
||||
{
|
||||
return Cameras()->ReleaseCaptureDevice(aCapEngine, capture_id);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->ReleaseCaptureDevice(aCapEngine, capture_id);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -509,10 +544,16 @@ int StartCapture(CaptureEngine aCapEngine,
|
||||
webrtc::CaptureCapability& webrtcCaps,
|
||||
webrtc::ExternalRenderer* cb)
|
||||
{
|
||||
return Cameras()->StartCapture(aCapEngine,
|
||||
capture_id,
|
||||
webrtcCaps,
|
||||
cb);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->StartCapture(aCapEngine,
|
||||
capture_id,
|
||||
webrtcCaps,
|
||||
cb);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -547,7 +588,13 @@ CamerasChild::StartCapture(CaptureEngine aCapEngine,
|
||||
|
||||
int StopCapture(CaptureEngine aCapEngine, const int capture_id)
|
||||
{
|
||||
return Cameras()->StopCapture(aCapEngine, capture_id);
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
CamerasChild* child = GetCamerasChild();
|
||||
if (child) {
|
||||
return child->StopCapture(aCapEngine, capture_id);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@ -573,16 +620,14 @@ CamerasChild::StopCapture(CaptureEngine aCapEngine, const int capture_id)
|
||||
void
|
||||
Shutdown(void)
|
||||
{
|
||||
{
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
if (!CamerasSingleton::Child()) {
|
||||
// We don't want to cause everything to get fired up if we're
|
||||
// really already shut down.
|
||||
LOG(("Shutdown when already shut down"));
|
||||
return;
|
||||
}
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
if (!CamerasSingleton::Child()) {
|
||||
// We don't want to cause everything to get fired up if we're
|
||||
// really already shut down.
|
||||
LOG(("Shutdown when already shut down"));
|
||||
return;
|
||||
}
|
||||
Cameras()->Shutdown();
|
||||
GetCamerasChild()->Shutdown();
|
||||
}
|
||||
|
||||
class ShutdownRunnable : public nsRunnable {
|
||||
@ -615,7 +660,6 @@ CamerasChild::Shutdown()
|
||||
monitor.NotifyAll();
|
||||
}
|
||||
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
if (CamerasSingleton::Thread()) {
|
||||
LOG(("Dispatching actor deletion"));
|
||||
// Delete the parent actor.
|
||||
@ -708,7 +752,10 @@ CamerasChild::~CamerasChild()
|
||||
{
|
||||
LOG(("~CamerasChild: %p", this));
|
||||
|
||||
Shutdown();
|
||||
{
|
||||
OffTheBooksMutexAutoLock lock(CamerasSingleton::Mutex());
|
||||
Shutdown();
|
||||
}
|
||||
|
||||
MOZ_COUNT_DTOR(CamerasChild);
|
||||
}
|
||||
|
@ -186,6 +186,7 @@ CamerasParent::DispatchToVideoCaptureThread(nsRunnable *event)
|
||||
void
|
||||
CamerasParent::StopVideoCapture()
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
// We are called from the main thread (xpcom-shutdown) or
|
||||
// from PBackground (when the Actor shuts down).
|
||||
// Shut down the WebRTC stack (on the capture thread)
|
||||
@ -407,6 +408,7 @@ CamerasParent::SetupEngine(CaptureEngine aCapEngine)
|
||||
void
|
||||
CamerasParent::CloseEngines()
|
||||
{
|
||||
LOG((__PRETTY_FUNCTION__));
|
||||
if (!mWebRTCAlive) {
|
||||
return;
|
||||
}
|
||||
@ -700,10 +702,12 @@ CamerasParent::RecvReleaseCaptureDevice(const int& aCapEngine,
|
||||
RefPtr<nsIRunnable> ipc_runnable =
|
||||
media::NewRunnableFrom([self, error, numdev]() -> nsresult {
|
||||
if (self->IsShuttingDown()) {
|
||||
LOG(("In Shutdown, not Releasing"));
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (error) {
|
||||
Unused << self->SendReplyFailure();
|
||||
LOG(("Failed to free device nr %d", numdev));
|
||||
return NS_ERROR_FAILURE;
|
||||
} else {
|
||||
Unused << self->SendReplySuccess();
|
||||
|
@ -619,7 +619,7 @@ skip-if = (os == 'win' && os_version == '5.1') || (os != 'win' && toolkit != 'go
|
||||
[test_eme_session_callable_value.html]
|
||||
[test_eme_canvas_blocked.html]
|
||||
skip-if = toolkit == 'android' # bug 1149374
|
||||
[test_eme_key_ids_initdata.html]
|
||||
[test_eme_initDataTypes.html]
|
||||
skip-if = toolkit == 'android' # bug 1149374
|
||||
[test_eme_non_mse_fails.html]
|
||||
skip-if = toolkit == 'android' # bug 1149374
|
||||
|
@ -14,6 +14,7 @@
|
||||
var tests = [
|
||||
{
|
||||
name: "One keyId",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"]}',
|
||||
expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"],"type":"temporary"}',
|
||||
sessionType: 'temporary',
|
||||
@ -21,6 +22,7 @@ var tests = [
|
||||
},
|
||||
{
|
||||
name: "Two keyIds",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
|
||||
expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"temporary"}',
|
||||
sessionType: 'temporary',
|
||||
@ -28,6 +30,7 @@ var tests = [
|
||||
},
|
||||
{
|
||||
name: "Two keyIds, temporary session",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"type":"temporary", "kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
|
||||
expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"temporary"}',
|
||||
sessionType: 'temporary',
|
||||
@ -35,6 +38,7 @@ var tests = [
|
||||
},
|
||||
{
|
||||
name: "Two keyIds, persistent session, type before kids",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"type":"persistent", "kids":["LwVHf8JLtPrv2GUXFW2v_A", "0DdtU9od-Bh5L3xbv0Xf_A"]}',
|
||||
expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A","0DdtU9od-Bh5L3xbv0Xf_A"],"type":"persistent"}',
|
||||
sessionType: 'persistent',
|
||||
@ -42,24 +46,28 @@ var tests = [
|
||||
},
|
||||
{
|
||||
name: "Invalid keyId",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":["0"]}',
|
||||
sessionType: 'temporary',
|
||||
expectPass: false,
|
||||
},
|
||||
{
|
||||
name: "Empty keyId",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":[""]}',
|
||||
sessionType: 'temporary',
|
||||
expectPass: false,
|
||||
},
|
||||
{
|
||||
name: "SessionType in license doesn't match MediaKeySession's sessionType",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"]}',
|
||||
sessionType: 'persistent',
|
||||
expectPass: false,
|
||||
},
|
||||
{
|
||||
name: "One valid and one invalid kid",
|
||||
initDataType: 'keyids',
|
||||
initData: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A", "invalid"]}',
|
||||
expectedRequest: '{"kids":["LwVHf8JLtPrv2GUXFW2v_A"],"type":"temporary"}',
|
||||
sessionType: 'temporary',
|
||||
@ -67,12 +75,37 @@ var tests = [
|
||||
},
|
||||
{
|
||||
name: "Invalid initData",
|
||||
initDataType: 'keyids',
|
||||
initData: 'invalid initData',
|
||||
sessionType: 'temporary',
|
||||
expectPass: false,
|
||||
},
|
||||
{
|
||||
name: "'webm' initDataType",
|
||||
initDataType: 'webm',
|
||||
initData: 'YAYeAX5Hfod+V9ANHtANHg==',
|
||||
expectedRequest: '{"kids":["YAYeAX5Hfod-V9ANHtANHg"],"type":"temporary"}',
|
||||
sessionType: 'temporary',
|
||||
expectPass: true,
|
||||
},
|
||||
{
|
||||
name: "'webm' initDataType with non 16 byte keyid",
|
||||
initDataType: 'webm',
|
||||
initData: 'YAYeAX5Hfod',
|
||||
sessionType: 'temporary',
|
||||
expectPass: false,
|
||||
},
|
||||
];
|
||||
|
||||
function PrepareInitData(initDataType, initData)
|
||||
{
|
||||
if (initDataType == "keyids") {
|
||||
return new TextEncoder().encode(initData);
|
||||
} else if (initDataType == "webm") {
|
||||
return StringToArrayBuffer(atob(initData));
|
||||
}
|
||||
}
|
||||
|
||||
function Test(test) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{initDataTypes: ['keyids']}]).then(
|
||||
@ -80,7 +113,6 @@ function Test(test) {
|
||||
).then(
|
||||
(mediaKeys) => {
|
||||
var session = mediaKeys.createSession(test.sessionType);
|
||||
var initData = new TextEncoder().encode(test.initData);
|
||||
session.addEventListener("message", function(event) {
|
||||
is(event.messageType, "license-request", "'" + test.name + "' MediaKeyMessage type should be license-request.");
|
||||
var text = new TextDecoder().decode(event.message);
|
||||
@ -89,7 +121,8 @@ function Test(test) {
|
||||
"'" + test.name + "' expected to " + (test.expectPass ? "pass" : "fail"));
|
||||
resolve();
|
||||
});
|
||||
return session.generateRequest('keyids', initData);
|
||||
var initData = PrepareInitData(test.initDataType, test.initData);
|
||||
return session.generateRequest(test.initDataType, initData);
|
||||
}
|
||||
).catch((x) => {
|
||||
ok(!test.expectPass, "'" + test.name + "' expected to fail.");
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla::media;
|
||||
@ -191,9 +192,9 @@ bool WaveReader::DecodeAudioData()
|
||||
|
||||
static_assert(uint64_t(BLOCK_SIZE) < UINT_MAX / sizeof(char),
|
||||
"BLOCK_SIZE too large for enumerator.");
|
||||
nsAutoArrayPtr<char> dataBuffer(new char[static_cast<size_t>(readSize)]);
|
||||
auto dataBuffer = MakeUnique<char[]>(static_cast<size_t>(readSize));
|
||||
|
||||
if (!ReadAll(dataBuffer, readSize)) {
|
||||
if (!ReadAll(dataBuffer.get(), readSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -406,7 +407,7 @@ WaveReader::LoadFormatChunk(uint32_t aChunkSize)
|
||||
if (extra > 0) {
|
||||
static_assert(UINT16_MAX + (UINT16_MAX % 2) < UINT_MAX / sizeof(char),
|
||||
"chunkExtension array too large for iterator.");
|
||||
nsAutoArrayPtr<char> chunkExtension(new char[extra]);
|
||||
auto chunkExtension = MakeUnique<char[]>(extra);
|
||||
if (!ReadAll(chunkExtension.get(), extra)) {
|
||||
return false;
|
||||
}
|
||||
@ -528,7 +529,7 @@ WaveReader::LoadListChunk(uint32_t aChunkSize,
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<char> chunk(new char[aChunkSize]);
|
||||
auto chunk = MakeUnique<char[]>(aChunkSize);
|
||||
if (!ReadAll(chunk.get(), aChunkSize)) {
|
||||
return false;
|
||||
}
|
||||
@ -652,7 +653,7 @@ WaveReader::LoadAllChunks(nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags)
|
||||
static const int64_t MAX_CHUNK_SIZE = 1 << 16;
|
||||
static_assert(uint64_t(MAX_CHUNK_SIZE) < UINT_MAX / sizeof(char),
|
||||
"MAX_CHUNK_SIZE too large for enumerator.");
|
||||
nsAutoArrayPtr<char> chunk(new char[MAX_CHUNK_SIZE]);
|
||||
auto chunk = MakeUnique<char[]>(MAX_CHUNK_SIZE);
|
||||
while (forward.value() > 0) {
|
||||
int64_t size = std::min(forward.value(), MAX_CHUNK_SIZE);
|
||||
if (!ReadAll(chunk.get(), size)) {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "WebAudioUtils.h"
|
||||
#include "blink/Biquad.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "AudioParamTimeline.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -316,7 +317,7 @@ BiquadFilterNode::GetFrequencyResponse(const Float32Array& aFrequencyHz,
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoArrayPtr<float> frequencies(new float[length]);
|
||||
auto frequencies = MakeUnique<float[]>(length);
|
||||
float* frequencyHz = aFrequencyHz.Data();
|
||||
const double nyquist = Context()->SampleRate() * 0.5;
|
||||
|
||||
@ -338,7 +339,7 @@ BiquadFilterNode::GetFrequencyResponse(const Float32Array& aFrequencyHz,
|
||||
|
||||
WebCore::Biquad biquad;
|
||||
SetParamsOnBiquad(biquad, Context()->SampleRate(), mType, freq, q, gain, detune);
|
||||
biquad.getFrequencyResponse(int(length), frequencies, aMagResponse.Data(), aPhaseResponse.Data());
|
||||
biquad.getFrequencyResponse(int(length), frequencies.get(), aMagResponse.Data(), aPhaseResponse.Data());
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -69,8 +69,8 @@ size_t DynamicsCompressor::sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSize
|
||||
}
|
||||
}
|
||||
|
||||
amount += m_sourceChannels.SizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += m_destinationChannels.SizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += aMallocSizeOf(m_sourceChannels.get());
|
||||
amount += aMallocSizeOf(m_destinationChannels.get());
|
||||
amount += m_compressor.sizeOfExcludingThis(aMallocSizeOf);
|
||||
return amount;
|
||||
}
|
||||
@ -308,8 +308,8 @@ void DynamicsCompressor::setNumberOfChannels(unsigned numberOfChannels)
|
||||
m_postFilterPacks.AppendElement(new ZeroPoleFilterPack4());
|
||||
}
|
||||
|
||||
m_sourceChannels = new const float* [numberOfChannels];
|
||||
m_destinationChannels = new float* [numberOfChannels];
|
||||
m_sourceChannels = mozilla::MakeUnique<const float* []>(numberOfChannels);
|
||||
m_destinationChannels = mozilla::MakeUnique<float* []>(numberOfChannels);
|
||||
|
||||
m_compressor.setNumberOfChannels(numberOfChannels);
|
||||
m_numberOfChannels = numberOfChannels;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
class AudioBlock;
|
||||
@ -115,8 +116,8 @@ protected:
|
||||
nsTArray<nsAutoPtr<ZeroPoleFilterPack4> > m_preFilterPacks;
|
||||
nsTArray<nsAutoPtr<ZeroPoleFilterPack4> > m_postFilterPacks;
|
||||
|
||||
nsAutoArrayPtr<const float*> m_sourceChannels;
|
||||
nsAutoArrayPtr<float*> m_destinationChannels;
|
||||
mozilla::UniquePtr<const float*[]> m_sourceChannels;
|
||||
mozilla::UniquePtr<float*[]> m_destinationChannels;
|
||||
|
||||
void setEmphasisStageParameters(unsigned stageIndex, float gain, float normalizedFrequency /* 0 -> 1 */);
|
||||
void setEmphasisParameters(float gain, float anchorFreq, float filterStageRatio);
|
||||
|
@ -40,6 +40,7 @@ using namespace std;
|
||||
using namespace mozilla::dom; // for WebAudioUtils
|
||||
using mozilla::IsInfinite;
|
||||
using mozilla::IsNaN;
|
||||
using mozilla::MakeUnique;
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
@ -78,7 +79,7 @@ size_t DynamicsCompressorKernel::sizeOfExcludingThis(mozilla::MallocSizeOf aMall
|
||||
size_t amount = 0;
|
||||
amount += m_preDelayBuffers.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (size_t i = 0; i < m_preDelayBuffers.Length(); i++) {
|
||||
amount += m_preDelayBuffers[i].SizeOfExcludingThis(aMallocSizeOf);
|
||||
amount += aMallocSizeOf(m_preDelayBuffers[i].get());
|
||||
}
|
||||
|
||||
return amount;
|
||||
@ -91,7 +92,7 @@ void DynamicsCompressorKernel::setNumberOfChannels(unsigned numberOfChannels)
|
||||
|
||||
m_preDelayBuffers.Clear();
|
||||
for (unsigned i = 0; i < numberOfChannels; ++i)
|
||||
m_preDelayBuffers.AppendElement(new float[MaxPreDelayFrames]);
|
||||
m_preDelayBuffers.AppendElement(MakeUnique<float[]>(MaxPreDelayFrames));
|
||||
}
|
||||
|
||||
void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime)
|
||||
@ -104,7 +105,7 @@ void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime)
|
||||
if (m_lastPreDelayFrames != preDelayFrames) {
|
||||
m_lastPreDelayFrames = preDelayFrames;
|
||||
for (unsigned i = 0; i < m_preDelayBuffers.Length(); ++i)
|
||||
memset(m_preDelayBuffers[i], 0, sizeof(float) * MaxPreDelayFrames);
|
||||
memset(m_preDelayBuffers[i].get(), 0, sizeof(float) * MaxPreDelayFrames);
|
||||
|
||||
m_preDelayReadIndex = 0;
|
||||
m_preDelayWriteIndex = preDelayFrames;
|
||||
@ -387,7 +388,7 @@ void DynamicsCompressorKernel::process(float* sourceChannels[],
|
||||
|
||||
// Predelay signal, computing compression amount from un-delayed version.
|
||||
for (unsigned i = 0; i < numberOfChannels; ++i) {
|
||||
float* delayBuffer = m_preDelayBuffers[i];
|
||||
float* delayBuffer = m_preDelayBuffers[i].get();
|
||||
float undelayedSource = sourceChannels[i][frameIndex];
|
||||
delayBuffer[preDelayWriteIndex] = undelayedSource;
|
||||
|
||||
@ -453,7 +454,7 @@ void DynamicsCompressorKernel::process(float* sourceChannels[],
|
||||
|
||||
// Apply final gain.
|
||||
for (unsigned i = 0; i < numberOfChannels; ++i) {
|
||||
float* delayBuffer = m_preDelayBuffers[i];
|
||||
float* delayBuffer = m_preDelayBuffers[i].get();
|
||||
destinationChannels[i][frameIndex] = delayBuffer[preDelayReadIndex] * totalGain;
|
||||
}
|
||||
|
||||
@ -479,7 +480,7 @@ void DynamicsCompressorKernel::reset()
|
||||
|
||||
// Predelay section.
|
||||
for (unsigned i = 0; i < m_preDelayBuffers.Length(); ++i)
|
||||
memset(m_preDelayBuffers[i], 0, sizeof(float) * MaxPreDelayFrames);
|
||||
memset(m_preDelayBuffers[i].get(), 0, sizeof(float) * MaxPreDelayFrames);
|
||||
|
||||
m_preDelayReadIndex = 0;
|
||||
m_preDelayWriteIndex = DefaultPreDelayFrames;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
@ -89,7 +90,7 @@ protected:
|
||||
unsigned m_lastPreDelayFrames;
|
||||
void setPreDelayTime(float);
|
||||
|
||||
nsTArray<nsAutoArrayPtr<float> > m_preDelayBuffers;
|
||||
nsTArray<mozilla::UniquePtr<float[]>> m_preDelayBuffers;
|
||||
int m_preDelayReadIndex;
|
||||
int m_preDelayWriteIndex;
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "PeriodicWave.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include "mozilla/FFTBlock.h"
|
||||
|
||||
const unsigned MinPeriodicWaveSize = 4096; // This must be a power of two.
|
||||
@ -51,7 +52,19 @@ PeriodicWave::create(float sampleRate,
|
||||
if (isGood) {
|
||||
RefPtr<PeriodicWave> periodicWave =
|
||||
new PeriodicWave(sampleRate, numberOfComponents);
|
||||
periodicWave->createBandLimitedTables(real, imag, numberOfComponents);
|
||||
|
||||
// Limit the number of components used to those for frequencies below the
|
||||
// Nyquist of the fixed length inverse FFT.
|
||||
size_t halfSize = periodicWave->m_periodicWaveSize / 2;
|
||||
numberOfComponents = std::min(numberOfComponents, halfSize);
|
||||
periodicWave->m_numberOfComponents = numberOfComponents;
|
||||
periodicWave->m_realComponents = new AudioFloatArray(numberOfComponents);
|
||||
periodicWave->m_imagComponents = new AudioFloatArray(numberOfComponents);
|
||||
memcpy(periodicWave->m_realComponents->Elements(), real,
|
||||
numberOfComponents * sizeof(float));
|
||||
memcpy(periodicWave->m_imagComponents->Elements(), imag,
|
||||
numberOfComponents * sizeof(float));
|
||||
|
||||
return periodicWave.forget();
|
||||
}
|
||||
return nullptr;
|
||||
@ -96,6 +109,7 @@ PeriodicWave::createTriangle(float sampleRate)
|
||||
PeriodicWave::PeriodicWave(float sampleRate, size_t numberOfComponents)
|
||||
: m_sampleRate(sampleRate)
|
||||
, m_centsPerRange(CentsPerRange)
|
||||
, m_lowestRequestedFundamentalFrequency(std::numeric_limits<float>::max())
|
||||
{
|
||||
float nyquist = 0.5 * m_sampleRate;
|
||||
|
||||
@ -107,6 +121,7 @@ PeriodicWave::PeriodicWave(float sampleRate, size_t numberOfComponents)
|
||||
}
|
||||
|
||||
m_numberOfRanges = (unsigned)(3.0f*logf(m_periodicWaveSize)/logf(2.0f));
|
||||
m_bandLimitedTables.SetLength(m_numberOfRanges);
|
||||
m_lowestFundamentalFrequency = nyquist / maxNumberOfPartials();
|
||||
m_rateScale = m_periodicWaveSize / m_sampleRate;
|
||||
}
|
||||
@ -127,10 +142,22 @@ size_t PeriodicWave::sizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) co
|
||||
|
||||
void PeriodicWave::waveDataForFundamentalFrequency(float fundamentalFrequency, float* &lowerWaveData, float* &higherWaveData, float& tableInterpolationFactor)
|
||||
{
|
||||
|
||||
// Negative frequencies are allowed, in which case we alias
|
||||
// to the positive frequency.
|
||||
fundamentalFrequency = fabsf(fundamentalFrequency);
|
||||
|
||||
if (fundamentalFrequency < m_lowestRequestedFundamentalFrequency) {
|
||||
for (unsigned rangeIndex = 0; rangeIndex < m_numberOfRanges; ++rangeIndex) {
|
||||
m_bandLimitedTables[rangeIndex] = 0;
|
||||
}
|
||||
|
||||
// We need to create the first table to determine the normalization
|
||||
// constant.
|
||||
createBandLimitedTables(fundamentalFrequency, 0);
|
||||
m_lowestRequestedFundamentalFrequency = fundamentalFrequency;
|
||||
}
|
||||
|
||||
// Calculate the pitch range.
|
||||
float ratio = fundamentalFrequency > 0 ? fundamentalFrequency / m_lowestFundamentalFrequency : 0.5;
|
||||
float centsAboveLowestFrequency = logf(ratio)/logf(2.0f) * 1200;
|
||||
@ -149,6 +176,12 @@ void PeriodicWave::waveDataForFundamentalFrequency(float fundamentalFrequency, f
|
||||
unsigned rangeIndex1 = static_cast<unsigned>(pitchRange);
|
||||
unsigned rangeIndex2 = rangeIndex1 < m_numberOfRanges - 1 ? rangeIndex1 + 1 : rangeIndex1;
|
||||
|
||||
if (!m_bandLimitedTables[rangeIndex1].get())
|
||||
createBandLimitedTables(fundamentalFrequency, rangeIndex1);
|
||||
|
||||
if (!m_bandLimitedTables[rangeIndex2].get())
|
||||
createBandLimitedTables(fundamentalFrequency, rangeIndex2);
|
||||
|
||||
lowerWaveData = m_bandLimitedTables[rangeIndex2]->Elements();
|
||||
higherWaveData = m_bandLimitedTables[rangeIndex1]->Elements();
|
||||
|
||||
@ -179,66 +212,64 @@ unsigned PeriodicWave::numberOfPartialsForRange(unsigned rangeIndex) const
|
||||
// One table is created for each range for non-aliasing playback
|
||||
// at different playback rates. Thus, higher ranges have more
|
||||
// high-frequency partials culled out.
|
||||
void PeriodicWave::createBandLimitedTables(const float* realData, const float* imagData, unsigned numberOfComponents)
|
||||
void PeriodicWave::createBandLimitedTables(float fundamentalFrequency,
|
||||
unsigned rangeIndex)
|
||||
{
|
||||
float normalizationScale = 1;
|
||||
|
||||
unsigned fftSize = m_periodicWaveSize;
|
||||
unsigned halfSize = fftSize / 2;
|
||||
unsigned i;
|
||||
|
||||
// Limit the number of components used to those for frequencies below the
|
||||
// Nyquist of the fixed length inverse FFT.
|
||||
numberOfComponents = std::min(numberOfComponents, halfSize);
|
||||
const float *realData = m_realComponents->Elements();
|
||||
const float *imagData = m_imagComponents->Elements();
|
||||
|
||||
m_bandLimitedTables.SetCapacity(m_numberOfRanges);
|
||||
// This FFTBlock is used to cull partials (represented by frequency bins).
|
||||
FFTBlock frame(fftSize);
|
||||
|
||||
for (unsigned rangeIndex = 0; rangeIndex < m_numberOfRanges; ++rangeIndex) {
|
||||
// This FFTBlock is used to cull partials (represented by frequency bins).
|
||||
FFTBlock frame(fftSize);
|
||||
// Find the starting bin where we should start culling the aliasing
|
||||
// partials for this pitch range. We need to clear out the highest
|
||||
// frequencies to band-limit the waveform.
|
||||
unsigned numberOfPartials = numberOfPartialsForRange(rangeIndex);
|
||||
// Also limit to the number of components that are provided.
|
||||
numberOfPartials = std::min(numberOfPartials, m_numberOfComponents - 1);
|
||||
|
||||
// Find the starting bin where we should start culling the aliasing
|
||||
// partials for this pitch range. We need to clear out the highest
|
||||
// frequencies to band-limit the waveform.
|
||||
unsigned numberOfPartials = numberOfPartialsForRange(rangeIndex);
|
||||
// Also limit to the number of components that are provided.
|
||||
numberOfPartials = std::min(numberOfPartials, numberOfComponents - 1);
|
||||
// Limit number of partials to those below Nyquist frequency
|
||||
float nyquist = 0.5 * m_sampleRate;
|
||||
numberOfPartials = std::min(numberOfPartials,
|
||||
(unsigned)(nyquist / fundamentalFrequency));
|
||||
|
||||
// Copy from loaded frequency data and generate complex conjugate
|
||||
// because of the way the inverse FFT is defined.
|
||||
// The coefficients of higher partials remain zero, as initialized in
|
||||
// the FFTBlock constructor.
|
||||
for (i = 0; i < numberOfPartials + 1; ++i) {
|
||||
frame.RealData(i) = realData[i];
|
||||
frame.ImagData(i) = -imagData[i];
|
||||
}
|
||||
|
||||
// Clear any DC-offset.
|
||||
frame.RealData(0) = 0;
|
||||
// Clear value which has no effect.
|
||||
frame.ImagData(0) = 0;
|
||||
|
||||
// Create the band-limited table.
|
||||
AlignedAudioFloatArray* table = new AlignedAudioFloatArray(m_periodicWaveSize);
|
||||
m_bandLimitedTables.AppendElement(table);
|
||||
|
||||
// Apply an inverse FFT to generate the time-domain table data.
|
||||
float* data = m_bandLimitedTables[rangeIndex]->Elements();
|
||||
frame.GetInverseWithoutScaling(data);
|
||||
|
||||
// For the first range (which has the highest power), calculate
|
||||
// its peak value then compute normalization scale.
|
||||
if (!rangeIndex) {
|
||||
float maxValue;
|
||||
maxValue = AudioBufferPeakValue(data, m_periodicWaveSize);
|
||||
|
||||
if (maxValue)
|
||||
normalizationScale = 1.0f / maxValue;
|
||||
}
|
||||
|
||||
// Apply normalization scale.
|
||||
AudioBufferInPlaceScale(data, normalizationScale, m_periodicWaveSize);
|
||||
// Copy from loaded frequency data and generate complex conjugate
|
||||
// because of the way the inverse FFT is defined.
|
||||
// The coefficients of higher partials remain zero, as initialized in
|
||||
// the FFTBlock constructor.
|
||||
for (i = 0; i < numberOfPartials + 1; ++i) {
|
||||
frame.RealData(i) = realData[i];
|
||||
frame.ImagData(i) = -imagData[i];
|
||||
}
|
||||
|
||||
// Clear any DC-offset.
|
||||
frame.RealData(0) = 0;
|
||||
// Clear value which has no effect.
|
||||
frame.ImagData(0) = 0;
|
||||
|
||||
// Create the band-limited table.
|
||||
AlignedAudioFloatArray* table = new AlignedAudioFloatArray(m_periodicWaveSize);
|
||||
m_bandLimitedTables[rangeIndex] = table;
|
||||
|
||||
// Apply an inverse FFT to generate the time-domain table data.
|
||||
float* data = m_bandLimitedTables[rangeIndex]->Elements();
|
||||
frame.GetInverseWithoutScaling(data);
|
||||
|
||||
// For the first range (which has the highest power), calculate
|
||||
// its peak value then compute normalization scale.
|
||||
if (!rangeIndex) {
|
||||
float maxValue;
|
||||
maxValue = AudioBufferPeakValue(data, m_periodicWaveSize);
|
||||
|
||||
if (maxValue)
|
||||
m_normalizationScale = 1.0f / maxValue;
|
||||
}
|
||||
|
||||
// Apply normalization scale.
|
||||
AudioBufferInPlaceScale(data, m_normalizationScale, m_periodicWaveSize);
|
||||
}
|
||||
|
||||
void PeriodicWave::generateBasicWaveform(OscillatorType shape)
|
||||
@ -247,10 +278,11 @@ void PeriodicWave::generateBasicWaveform(OscillatorType shape)
|
||||
unsigned fftSize = periodicWaveSize();
|
||||
unsigned halfSize = fftSize / 2;
|
||||
|
||||
AudioFloatArray real(halfSize);
|
||||
AudioFloatArray imag(halfSize);
|
||||
float* realP = real.Elements();
|
||||
float* imagP = imag.Elements();
|
||||
m_numberOfComponents = halfSize;
|
||||
m_realComponents = new AudioFloatArray(halfSize);
|
||||
m_imagComponents = new AudioFloatArray(halfSize);
|
||||
float* realP = m_realComponents->Elements();
|
||||
float* imagP = m_imagComponents->Elements();
|
||||
|
||||
// Clear DC and imag value which is ignored.
|
||||
realP[0] = 0;
|
||||
@ -305,8 +337,6 @@ void PeriodicWave::generateBasicWaveform(OscillatorType shape)
|
||||
realP[n] = a;
|
||||
imagP[n] = b;
|
||||
}
|
||||
|
||||
createBandLimitedTables(realP, imagP, halfSize);
|
||||
}
|
||||
|
||||
} // namespace WebCore
|
||||
|
@ -85,6 +85,9 @@ private:
|
||||
unsigned m_periodicWaveSize;
|
||||
unsigned m_numberOfRanges;
|
||||
float m_centsPerRange;
|
||||
unsigned m_numberOfComponents;
|
||||
nsAutoPtr<AudioFloatArray> m_realComponents;
|
||||
nsAutoPtr<AudioFloatArray> m_imagComponents;
|
||||
|
||||
// The lowest frequency (in Hertz) where playback will include all of the
|
||||
// partials. Playing back lower than this frequency will gradually lose
|
||||
@ -101,8 +104,10 @@ private:
|
||||
|
||||
unsigned numberOfPartialsForRange(unsigned rangeIndex) const;
|
||||
|
||||
// Creates tables based on numberOfComponents Fourier coefficients.
|
||||
void createBandLimitedTables(const float* real, const float* imag, unsigned numberOfComponents);
|
||||
// Creates table for specified index based on fundamental frequency.
|
||||
void createBandLimitedTables(float fundamentalFrequency, unsigned rangeIndex);
|
||||
float m_lowestRequestedFundamentalFrequency;
|
||||
float m_normalizationScale;
|
||||
nsTArray<nsAutoPtr<AlignedAudioFloatArray> > m_bandLimitedTables;
|
||||
};
|
||||
|
||||
|
@ -21,8 +21,8 @@ void EbmlComposer::GenerateHeader()
|
||||
// Write the EBML header.
|
||||
EbmlGlobal ebml;
|
||||
// The WEbM header default size usually smaller than 1k.
|
||||
nsAutoArrayPtr<uint8_t> buffer(new uint8_t[DEFAULT_HEADER_SIZE +
|
||||
mCodecPrivateData.Length()]);
|
||||
auto buffer = MakeUnique<uint8_t[]>(DEFAULT_HEADER_SIZE +
|
||||
mCodecPrivateData.Length());
|
||||
ebml.buf = buffer.get();
|
||||
ebml.offset = 0;
|
||||
writeHeader(&ebml);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "Layers.h"
|
||||
#include "ImageContainer.h"
|
||||
@ -314,7 +315,7 @@ public:
|
||||
// If we allow arbitrary frequencies, there's no guarantee we won't get rounded here
|
||||
// We could include an error term and adjust for it in generation; not worth the trouble
|
||||
//MOZ_ASSERT(mTotalLength * aFrequency == aSampleRate);
|
||||
mAudioBuffer = new int16_t[mTotalLength];
|
||||
mAudioBuffer = MakeUnique<int16_t[]>(mTotalLength);
|
||||
for (int i = 0; i < mTotalLength; i++) {
|
||||
// Set volume to -20db. It's from 32768.0 * 10^(-20/20) = 3276.8
|
||||
mAudioBuffer[i] = (3276.8f * sin(2 * M_PI * i / mTotalLength));
|
||||
@ -333,7 +334,7 @@ public:
|
||||
} else {
|
||||
processSamples = mTotalLength - mReadLength;
|
||||
}
|
||||
memcpy(aBuffer, mAudioBuffer + mReadLength, processSamples * bytesPerSample);
|
||||
memcpy(aBuffer, &mAudioBuffer[mReadLength], processSamples * bytesPerSample);
|
||||
aBuffer += processSamples;
|
||||
mReadLength += processSamples;
|
||||
remaining -= processSamples;
|
||||
@ -344,7 +345,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoArrayPtr<int16_t> mAudioBuffer;
|
||||
UniquePtr<int16_t[]> mAudioBuffer;
|
||||
int16_t mTotalLength;
|
||||
int16_t mReadLength;
|
||||
};
|
||||
|
@ -152,8 +152,8 @@ FakeDirectAudioSynth::Speak(const nsAString& aText, const nsAString& aUri,
|
||||
// Just an arbitrary multiplier. Pretend that each character is
|
||||
// synthesized to 40 frames.
|
||||
uint32_t frames_length = 40 * mText.Length();
|
||||
nsAutoArrayPtr<int16_t> frames(new int16_t[frames_length]());
|
||||
mTask->SendAudioNative(frames, frames_length);
|
||||
auto frames = MakeUnique<int16_t[]>(frames_length);
|
||||
mTask->SendAudioNative(frames.get(), frames_length);
|
||||
|
||||
mTask->SendAudioNative(nullptr, 0);
|
||||
|
||||
|
@ -627,6 +627,25 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
|
||||
bool profilerActive = false;
|
||||
DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
if (profilerActive) {
|
||||
nsCOMPtr<nsIProfilerStartParams> currentProfilerParams;
|
||||
rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
nsCOMPtr<nsISupports> gatherer;
|
||||
rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer));
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
|
||||
|
||||
StartProfiler(currentProfilerParams);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3162,26 +3181,11 @@ PluginProfilerObserver::Observe(nsISupports *aSubject,
|
||||
{
|
||||
if (!strcmp(aTopic, "profiler-started")) {
|
||||
nsCOMPtr<nsIProfilerStartParams> params(do_QueryInterface(aSubject));
|
||||
uint32_t entries;
|
||||
double interval;
|
||||
params->GetEntries(&entries);
|
||||
params->GetInterval(&interval);
|
||||
const nsTArray<nsCString>& features = params->GetFeatures();
|
||||
const nsTArray<nsCString>& threadFilterNames = params->GetThreadFilterNames();
|
||||
|
||||
ProfilerInitParams ipcParams;
|
||||
ipcParams.enabled() = true;
|
||||
ipcParams.entries() = entries;
|
||||
ipcParams.interval() = interval;
|
||||
ipcParams.features() = features;
|
||||
ipcParams.threadFilters() = threadFilterNames;
|
||||
|
||||
Unused << mPmp->SendStartProfiler(ipcParams);
|
||||
mPmp->StartProfiler(params);
|
||||
} else if (!strcmp(aTopic, "profiler-stopped")) {
|
||||
Unused << mPmp->SendStopProfiler();
|
||||
mPmp->StopProfiler();
|
||||
} else if (!strcmp(aTopic, "profiler-subprocess-gather")) {
|
||||
RefPtr<ProfileGatherer> gatherer = static_cast<ProfileGatherer*>(aSubject);
|
||||
mPmp->GatherAsyncProfile(gatherer);
|
||||
mPmp->GatherAsyncProfile();
|
||||
} else if (!strcmp(aTopic, "profiler-subprocess")) {
|
||||
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
|
||||
mPmp->GatheredAsyncProfile(pse);
|
||||
@ -3215,9 +3219,44 @@ PluginModuleChromeParent::ShutdownPluginProfiling()
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChromeParent::GatherAsyncProfile(ProfileGatherer* aGatherer)
|
||||
PluginModuleChromeParent::StartProfiler(nsIProfilerStartParams* aParams)
|
||||
{
|
||||
mGatherer = aGatherer;
|
||||
if (NS_WARN_IF(!aParams)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProfilerInitParams ipcParams;
|
||||
|
||||
ipcParams.enabled() = true;
|
||||
aParams->GetEntries(&ipcParams.entries());
|
||||
aParams->GetInterval(&ipcParams.interval());
|
||||
ipcParams.features() = aParams->GetFeatures();
|
||||
ipcParams.threadFilters() = aParams->GetThreadFilterNames();
|
||||
|
||||
Unused << SendStartProfiler(ipcParams);
|
||||
|
||||
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
|
||||
if (NS_WARN_IF(!profiler)) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsISupports> gatherer;
|
||||
profiler->GetProfileGatherer(getter_AddRefs(gatherer));
|
||||
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChromeParent::StopProfiler()
|
||||
{
|
||||
mGatherer = nullptr;
|
||||
Unused << SendStopProfiler();
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChromeParent::GatherAsyncProfile()
|
||||
{
|
||||
if (NS_WARN_IF(!mGatherer)) {
|
||||
return;
|
||||
}
|
||||
mGatherer->WillGatherOOPProfile();
|
||||
Unused << SendGatherProfile();
|
||||
}
|
||||
@ -3242,7 +3281,6 @@ PluginModuleChromeParent::RecvProfile(const nsCString& aProfile)
|
||||
|
||||
mProfile = aProfile;
|
||||
mGatherer->GatheredOOPProfile();
|
||||
mGatherer = nullptr;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -456,8 +456,10 @@ class PluginModuleChromeParent
|
||||
void OnExitedSyncSend() override;
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
void GatherAsyncProfile(mozilla::ProfileGatherer* aGatherer);
|
||||
void GatherAsyncProfile();
|
||||
void GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent);
|
||||
void StartProfiler(nsIProfilerStartParams* aParams);
|
||||
void StopProfiler();
|
||||
#endif
|
||||
|
||||
virtual bool
|
||||
|
@ -38,14 +38,11 @@ using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::services;
|
||||
|
||||
inline static PRLogModuleInfo*
|
||||
GetPresentationSessionInfoLog()
|
||||
{
|
||||
static PRLogModuleInfo* log = PR_NewLogModule("PresentationSessionInfo");
|
||||
return log;
|
||||
}
|
||||
|
||||
static LazyLogModule gPresentationSessionInfoLog("PresentationSessionInfo");
|
||||
|
||||
#undef LOG
|
||||
#define LOG(...) MOZ_LOG(GetPresentationSessionInfoLog(), mozilla::LogLevel::Error, (__VA_ARGS__))
|
||||
#define LOG(...) MOZ_LOG(gPresentationSessionInfoLog, mozilla::LogLevel::Error, (__VA_ARGS__))
|
||||
|
||||
|
||||
/*
|
||||
|
6
dom/xslt/crashtests/1205163.xml
Normal file
6
dom/xslt/crashtests/1205163.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet type="text/xsl" href="1205163.xsl"?>
|
||||
<result>
|
||||
<Title>Example</Title>
|
||||
<Error>Error</Error>
|
||||
</result>
|
11
dom/xslt/crashtests/1205163.xsl
Normal file
11
dom/xslt/crashtests/1205163.xsl
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="text"/>
|
||||
<xsl:template match="node()|@*">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="Error"/>
|
||||
</xsl:stylesheet>
|
@ -16,3 +16,4 @@ load 602115.html
|
||||
load 603844.html
|
||||
load 667315.xml
|
||||
load 1089049.html
|
||||
load 1205163.xml
|
||||
|
@ -81,6 +81,11 @@ txMozillaTextOutput::endDocument(nsresult aResult)
|
||||
nsresult rv = mTextParent->AppendChildTo(text, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// This should really be handled by nsIDocument::EndLoad
|
||||
MOZ_ASSERT(mDocument->GetReadyStateEnum() ==
|
||||
nsIDocument::READYSTATE_LOADING, "Bad readyState");
|
||||
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_INTERACTIVE);
|
||||
|
||||
if (NS_SUCCEEDED(aResult)) {
|
||||
nsCOMPtr<nsITransformObserver> observer = do_QueryReferent(mObserver);
|
||||
if (observer) {
|
||||
@ -134,6 +139,10 @@ txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument,
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(mDocument),
|
||||
aLoadedAsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// This should really be handled by nsIDocument::BeginLoad
|
||||
MOZ_ASSERT(mDocument->GetReadyStateEnum() ==
|
||||
nsIDocument::READYSTATE_UNINITIALIZED, "Bad readyState");
|
||||
mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_LOADING);
|
||||
nsCOMPtr<nsIDocument> source = do_QueryInterface(aSourceDocument);
|
||||
NS_ENSURE_STATE(source);
|
||||
bool hasHadScriptObject = false;
|
||||
|
@ -208,6 +208,16 @@ void GetUniformBlockInfo(const std::vector<VarT> &fields,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline void SetIfDirty(T *dest, const T &source, bool *dirtyFlag)
|
||||
{
|
||||
ASSERT(dest != NULL);
|
||||
ASSERT(dirtyFlag != NULL);
|
||||
|
||||
*dirtyFlag = *dirtyFlag || (memcmp(dest, &source, sizeof(T)) != 0);
|
||||
*dest = source;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool TransposeMatrix(T *target,
|
||||
const GLfloat *value,
|
||||
@ -1911,16 +1921,6 @@ void ProgramD3D::defineUniform(GLenum shaderType,
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline void SetIfDirty(T *dest, const T &source, bool *dirtyFlag)
|
||||
{
|
||||
ASSERT(dest != NULL);
|
||||
ASSERT(dirtyFlag != NULL);
|
||||
|
||||
*dirtyFlag = *dirtyFlag || (memcmp(dest, &source, sizeof(T)) != 0);
|
||||
*dest = source;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ProgramD3D::setUniform(GLint location, GLsizei countIn, const T *v, GLenum targetUniformType)
|
||||
{
|
||||
|
@ -1919,6 +1919,19 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
|
||||
|
||||
mX.EndTouch(aEvent.mTime);
|
||||
mY.EndTouch(aEvent.mTime);
|
||||
|
||||
// Drop any velocity on axes where we don't have room to scroll anyways
|
||||
// (in this APZC, or an APZC further in the handoff chain).
|
||||
// This ensures that we don't enlarge the display port unnecessarily.
|
||||
RefPtr<const OverscrollHandoffChain> overscrollHandoffChain =
|
||||
CurrentPanGestureBlock()->GetOverscrollHandoffChain();
|
||||
if (!overscrollHandoffChain->CanScrollInDirection(this, Layer::HORIZONTAL)) {
|
||||
mX.SetVelocity(0);
|
||||
}
|
||||
if (!overscrollHandoffChain->CanScrollInDirection(this, Layer::VERTICAL)) {
|
||||
mY.SetVelocity(0);
|
||||
}
|
||||
|
||||
SetState(NOTHING);
|
||||
RequestContentRepaint();
|
||||
|
||||
|
@ -76,7 +76,7 @@ void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, ParentLayerCoord
|
||||
return;
|
||||
}
|
||||
|
||||
float newVelocity = mAxisLocked ? 0.0f : (float)(mPos - aPos - aAdditionalDelta) / (float)(aTimestampMs - mPosTimeMs);
|
||||
float newVelocity = mAxisLocked ? 0.0f : (float)(mPos - aPos + aAdditionalDelta) / (float)(aTimestampMs - mPosTimeMs);
|
||||
if (gfxPrefs::APZMaxVelocity() > 0.0f) {
|
||||
bool velocityIsNegative = (newVelocity < 0);
|
||||
newVelocity = fabs(newVelocity);
|
||||
|
@ -716,24 +716,6 @@ ClientLayerManager::GetTexturePool(SurfaceFormat aFormat, TextureFlags aFlags)
|
||||
return mTexturePools.LastElement();
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::ReturnTextureClientDeferred(TextureClient& aClient) {
|
||||
GetTexturePool(aClient.GetFormat(),
|
||||
aClient.GetFlags())->ReturnTextureClientDeferred(&aClient);
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::ReturnTextureClient(TextureClient& aClient) {
|
||||
GetTexturePool(aClient.GetFormat(),
|
||||
aClient.GetFlags())->ReturnTextureClient(&aClient);
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::ReportClientLost(TextureClient& aClient) {
|
||||
GetTexturePool(aClient.GetFormat(),
|
||||
aClient.GetFlags())->ReportClientLost();
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::ClearCachedResources(Layer* aSubtree)
|
||||
{
|
||||
|
@ -123,11 +123,6 @@ public:
|
||||
|
||||
TextureClientPool* GetTexturePool(gfx::SurfaceFormat aFormat, TextureFlags aFlags);
|
||||
|
||||
/// Utility methods for managing texture clients.
|
||||
void ReturnTextureClientDeferred(TextureClient& aClient);
|
||||
void ReturnTextureClient(TextureClient& aClient);
|
||||
void ReportClientLost(TextureClient& aClient);
|
||||
|
||||
/**
|
||||
* Pass through call to the forwarder for nsPresContext's
|
||||
* CollectPluginGeometryUpdates. Passes widget configuration information
|
||||
|
@ -256,6 +256,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
USE_LIBS += [
|
||||
'icu',
|
||||
]
|
||||
|
@ -10,6 +10,7 @@ SOURCES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
LOCAL_INCLUDES += [
|
||||
'../locale',
|
||||
'../lwbrk',
|
||||
|
23
intl/icu-patches/bug-1228227-libc++-gcc_hidden.diff
Normal file
23
intl/icu-patches/bug-1228227-libc++-gcc_hidden.diff
Normal file
@ -0,0 +1,23 @@
|
||||
Limit libstdc++ workaround to not upset libc++ with pragma visibility.
|
||||
|
||||
diff --git a/intl/icu/source/common/unicode/std_string.h b/intl/icu/source/common/unicode/std_string.h
|
||||
--- a/intl/icu/source/common/unicode/std_string.h
|
||||
+++ b/intl/icu/source/common/unicode/std_string.h
|
||||
@@ -22,16 +22,16 @@
|
||||
* \brief C++ API: Central ICU header for including the C++ standard <string>
|
||||
* header and for related definitions.
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#if U_HAVE_STD_STRING
|
||||
|
||||
-#if !defined(_MSC_VER)
|
||||
+#if defined(__GLIBCXX__)
|
||||
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#endif // U_HAVE_STD_STRING
|
||||
|
||||
#endif // __STD_STRING_H__
|
@ -27,7 +27,7 @@
|
||||
|
||||
#if U_HAVE_STD_STRING
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#if defined(__GLIBCXX__)
|
||||
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
|
||||
#endif
|
||||
#include <string>
|
||||
|
@ -12,6 +12,7 @@ UNIFIED_SOURCES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
LOCAL_INCLUDES += [
|
||||
'..',
|
||||
]
|
||||
|
@ -20,5 +20,6 @@ LOCAL_INCLUDES += [
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
|
||||
DIST_INSTALL = True
|
||||
|
@ -41,6 +41,7 @@ if CONFIG['_MSC_VER']:
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
USE_LIBS += ['icu']
|
||||
|
||||
DIST_INSTALL = True
|
||||
|
@ -13,6 +13,7 @@ UNIFIED_SOURCES += [
|
||||
|
||||
if CONFIG['ENABLE_INTL_API']:
|
||||
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
|
||||
LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
|
||||
USE_LIBS += ['icu']
|
||||
|
||||
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE',
|
||||
|
@ -58,6 +58,7 @@ patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-1172609-icu-fix.d
|
||||
patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-1172609-timezone-recreateDefault.diff
|
||||
patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-1198952-workaround-make-3.82-bug.diff
|
||||
patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/icu-release-56-1-flagparser-fix.patch
|
||||
patch -d ${icu_dir}/../../ -p1 < ${icu_dir}/../icu-patches/bug-1228227-libc++-gcc_hidden.diff
|
||||
|
||||
# NOTE: If you're updating this script for a new ICU version, you have to rerun
|
||||
# js/src/tests/ecma_6/String/make-normalize-generateddata-input.py for any
|
||||
|
@ -1799,12 +1799,9 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext* cx)
|
||||
MOZ_CRASH();
|
||||
void* callee = nullptr;
|
||||
(void)callerRetAddr;
|
||||
#elif defined(JS_CODEGEN_MIPS32)
|
||||
Instruction* instr = (Instruction*)(callerRetAddr - 4 * sizeof(uint32_t));
|
||||
void* callee = (void*)Assembler::ExtractLuiOriValue(instr, instr->next());
|
||||
#elif defined(JS_CODEGEN_MIPS64)
|
||||
Instruction* instr = (Instruction*)(callerRetAddr - 6 * sizeof(uint32_t));
|
||||
void* callee = (void*)Assembler::ExtractLoad64Value(instr);
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
uint8_t* instr = callerRetAddr - Assembler::PatchWrite_NearCallSize();
|
||||
void* callee = (void*)Assembler::ExtractInstructionImmediate(instr);
|
||||
#elif defined(JS_CODEGEN_NONE)
|
||||
MOZ_CRASH();
|
||||
void* callee = nullptr;
|
||||
@ -1829,13 +1826,8 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext* cx)
|
||||
#elif defined(JS_CODEGEN_ARM64)
|
||||
(void)newCallee;
|
||||
MOZ_CRASH();
|
||||
#elif defined(JS_CODEGEN_MIPS32)
|
||||
Assembler::WriteLuiOriInstructions(instr, instr->next(),
|
||||
ScratchRegister, (uint32_t)newCallee);
|
||||
instr[2] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
|
||||
#elif defined(JS_CODEGEN_MIPS64)
|
||||
Assembler::WriteLoad64Instructions(instr, ScratchRegister, (uint64_t)newCallee);
|
||||
instr[4] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
Assembler::PatchInstructionImmediate(instr, PatchedImmPtr(newCallee));
|
||||
#elif defined(JS_CODEGEN_NONE)
|
||||
MOZ_CRASH();
|
||||
#else
|
||||
|
@ -139,13 +139,6 @@ CompareExchange(Scalar::Type viewType, int32_t oldCandidate, int32_t newCandidat
|
||||
oldval, newval);
|
||||
return oldval;
|
||||
}
|
||||
case Scalar::Uint8Clamped: {
|
||||
uint8_t oldval = ClampIntForUint8Array(oldCandidate);
|
||||
uint8_t newval = ClampIntForUint8Array(newCandidate);
|
||||
oldval = jit::AtomicOperations::compareExchangeSeqCst(viewData.cast<uint8_t*>() + offset,
|
||||
oldval, newval);
|
||||
return oldval;
|
||||
}
|
||||
case Scalar::Int16: {
|
||||
int16_t oldval = (int16_t)oldCandidate;
|
||||
int16_t newval = (int16_t)newCandidate;
|
||||
@ -235,8 +228,7 @@ js::atomics_load(JSContext* cx, unsigned argc, Value* vp)
|
||||
|
||||
SharedMem<void*> viewData = view->viewDataShared();
|
||||
switch (view->type()) {
|
||||
case Scalar::Uint8:
|
||||
case Scalar::Uint8Clamped: {
|
||||
case Scalar::Uint8: {
|
||||
uint8_t v = jit::AtomicOperations::loadSeqCst(viewData.cast<uint8_t*>() + offset);
|
||||
r.setInt32(v);
|
||||
return true;
|
||||
@ -300,11 +292,6 @@ ExchangeOrStore(Scalar::Type viewType, int32_t numberValue, SharedMem<void*> vie
|
||||
INT_OP(viewData.cast<uint8_t*>() + offset, value);
|
||||
return value;
|
||||
}
|
||||
case Scalar::Uint8Clamped: {
|
||||
uint8_t value = ClampIntForUint8Array(numberValue);
|
||||
INT_OP(viewData.cast<uint8_t*>() + offset, value);
|
||||
return value;
|
||||
}
|
||||
case Scalar::Int16: {
|
||||
int16_t value = (int16_t)numberValue;
|
||||
INT_OP(viewData.cast<int16_t*>() + offset, value);
|
||||
@ -406,26 +393,6 @@ AtomicsBinop(JSContext* cx, HandleValue objv, HandleValue idxv, HandleValue valv
|
||||
r.setInt32(T::operate(viewData.cast<uint8_t*>() + offset, v));
|
||||
return true;
|
||||
}
|
||||
case Scalar::Uint8Clamped: {
|
||||
// Spec says:
|
||||
// - clamp the input value
|
||||
// - perform the operation
|
||||
// - clamp the result
|
||||
// - store the result
|
||||
// This requires a CAS loop.
|
||||
int32_t value = ClampIntForUint8Array(numberValue);
|
||||
SharedMem<uint8_t*> loc = viewData.cast<uint8_t*>() + offset;
|
||||
for (;;) {
|
||||
uint8_t old = jit::AtomicOperations::loadSafeWhenRacy(loc);
|
||||
uint8_t result = (uint8_t)ClampIntForUint8Array(T::perform(old, value));
|
||||
uint8_t tmp = jit::AtomicOperations::compareExchangeSeqCst(loc, old, result);
|
||||
if (tmp == old) {
|
||||
r.setInt32(old);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case Scalar::Int16: {
|
||||
int16_t v = (int16_t)numberValue;
|
||||
r.setInt32(T::operate(viewData.cast<int16_t*>() + offset, v));
|
||||
|
@ -409,6 +409,19 @@ function testIsLockFree() {
|
||||
assertEq(Atomics.isLockFree(12), false);
|
||||
}
|
||||
|
||||
function testUint8Clamped(sab) {
|
||||
var ta = new Uint8ClampedArray(sab);
|
||||
var thrown = false;
|
||||
try {
|
||||
CLONE(testMethod)(ta, 0);
|
||||
}
|
||||
catch (e) {
|
||||
thrown = true;
|
||||
assertEq(e instanceof TypeError, true);
|
||||
}
|
||||
assertEq(thrown, true);
|
||||
}
|
||||
|
||||
function isLittleEndian() {
|
||||
var xxx = new ArrayBuffer(2);
|
||||
var xxa = new Int16Array(xxx);
|
||||
@ -440,7 +453,6 @@ function runTests() {
|
||||
// Test that invoking as Atomics.whatever() works, on correct arguments.
|
||||
CLONE(testMethod)(new Int8Array(sab), 0, 42, 4095);
|
||||
CLONE(testMethod)(new Uint8Array(sab), 0, 42, 4095);
|
||||
CLONE(testMethod)(new Uint8ClampedArray(sab), 0, 42, 4095);
|
||||
CLONE(testMethod)(new Int16Array(sab), 0, 42, 2047);
|
||||
CLONE(testMethod)(new Uint16Array(sab), 0, 42, 2047);
|
||||
CLONE(testMethod)(new Int32Array(sab), 0, 42, 1023);
|
||||
@ -460,7 +472,6 @@ function runTests() {
|
||||
|
||||
CLONE(testFunction)(new Int8Array(sab), 0, 42, 4095);
|
||||
CLONE(testFunction)(new Uint8Array(sab), 0, 42, 4095);
|
||||
CLONE(testFunction)(new Uint8ClampedArray(sab), 0, 42, 4095);
|
||||
CLONE(testFunction)(new Int16Array(sab), 0, 42, 2047);
|
||||
CLONE(testFunction)(new Uint16Array(sab), 0, 42, 2047);
|
||||
CLONE(testFunction)(new Int32Array(sab), 0, 42, 1023);
|
||||
@ -497,6 +508,9 @@ function runTests() {
|
||||
testInt16Extremes(new Int16Array(sab));
|
||||
testUint32(new Uint32Array(sab));
|
||||
|
||||
// Test that Uint8ClampedArray is not accepted.
|
||||
testUint8Clamped(sab);
|
||||
|
||||
// Misc ad-hoc tests
|
||||
adHocExchange();
|
||||
|
||||
|
@ -408,7 +408,23 @@ class ExecutableAllocator
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
static void cacheFlush(void* code, size_t size)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
#if defined(_MIPS_ARCH_LOONGSON3A)
|
||||
// On Loongson3-CPUs, The cache flushed automatically
|
||||
// by hardware. Just need to execute an instruction hazard.
|
||||
uintptr_t tmp;
|
||||
asm volatile (
|
||||
".set push \n"
|
||||
".set noreorder \n"
|
||||
"move %[tmp], $ra \n"
|
||||
"bal 1f \n"
|
||||
"daddiu $ra, 8 \n"
|
||||
"1: \n"
|
||||
"jr.hb $ra \n"
|
||||
"move $ra, %[tmp] \n"
|
||||
".set pop\n"
|
||||
:[tmp]"=&r"(tmp)
|
||||
);
|
||||
#elif defined(__GNUC__)
|
||||
intptr_t end = reinterpret_cast<intptr_t>(code) + size;
|
||||
__builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end));
|
||||
#else
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user