This commit is contained in:
Ryan VanderMeulen 2013-12-10 15:47:09 -05:00
Родитель f1c64af7fe 2b769f4918
Коммит 021d8ef6cd
197 изменённых файлов: 2475 добавлений и 2681 удалений

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

@ -621,7 +621,7 @@ TextAttrsMgr::FontWeightTextAttr::
if (font->IsSyntheticBold())
return 700;
#ifdef MOZ_PANGO
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
// On Linux, font->GetStyle()->weight will give the absolute weight requested
// of the font face. The Linux code uses the gfxFontEntry constructor which
// doesn't initialize the weight field.

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

@ -377,11 +377,7 @@ function getPotentialLeaks() {
let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].
getService(Ci.nsIMemoryReporterManager);
let enm = mgr.enumerateReporters();
while (enm.hasMoreElements()) {
let mr = enm.getNext().QueryInterface(Ci.nsIMemoryReporter);
mr.collectReports(logReporter, null);
}
mgr.getReportsForThisProcess(logReporter, null);
return { compartments: compartments, windows: windows };
}

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

@ -5,7 +5,7 @@
"use strict"
function debug(str) {
//dump("-*- ContentPermissionPrompt: " + str + "\n");
//dump("-*- ContentPermissionPrompt: " + s + "\n");
}
const Ci = Components.interfaces;
@ -13,14 +13,11 @@ const Cr = Components.results;
const Cu = Components.utils;
const Cc = Components.classes;
const PROMPT_FOR_UNKNOWN = ["audio-capture",
"desktop-notification",
"geolocation",
"video-capture"];
const PROMPT_FOR_UNKNOWN = ["geolocation", "desktop-notification",
"audio-capture"];
// Due to privary issue, permission requests like GetUserMedia should prompt
// every time instead of providing session persistence.
const PERMISSION_NO_SESSION = ["audio-capture", "video-capture"];
const ALLOW_MULTIPLE_REQUESTS = ["audio-capture", "video-capture"];
const PERMISSION_NO_SESSION = ["audio-capture"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -44,21 +41,7 @@ XPCOMUtils.defineLazyServiceGetter(this,
"@mozilla.org/telephony/audiomanager;1",
"nsIAudioManager");
/**
* aTypesInfo is an array of {permission, access, action, deny} which keeps
* the information of each permission. This arrary is initialized in
* ContentPermissionPrompt.prompt and used among functions.
*
* aTypesInfo[].permission : permission name
* aTypesInfo[].access : permission name + request.access
* aTypesInfo[].action : the default action of this permission
* aTypesInfo[].deny : true if security manager denied this app's origin
* principal.
* Note:
* aTypesInfo[].permission will be sent to prompt only when
* aTypesInfo[].action is PROMPT_ACTION and aTypesInfo[].deny is false.
*/
function rememberPermission(aTypesInfo, aPrincipal, aSession)
function rememberPermission(aPermission, aPrincipal, aSession)
{
function convertPermToAllow(aPerm, aPrincipal)
{
@ -66,13 +49,12 @@ function rememberPermission(aTypesInfo, aPrincipal, aSession)
permissionManager.testExactPermissionFromPrincipal(aPrincipal, aPerm);
if (type == Ci.nsIPermissionManager.PROMPT_ACTION ||
(type == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
PROMPT_FOR_UNKNOWN.indexOf(aPerm) >= 0)) {
debug("add " + aPerm + " to permission manager with ALLOW_ACTION");
PROMPT_FOR_UNKNOWN.indexOf(aPermission) >= 0)) {
if (!aSession) {
permissionManager.addFromPrincipal(aPrincipal,
aPerm,
Ci.nsIPermissionManager.ALLOW_ACTION);
} else if (PERMISSION_NO_SESSION.indexOf(aPerm) < 0) {
} else if (PERMISSION_NO_SESSION.indexOf(aPermission) < 0) {
permissionManager.addFromPrincipal(aPrincipal,
aPerm,
Ci.nsIPermissionManager.ALLOW_ACTION,
@ -81,18 +63,14 @@ function rememberPermission(aTypesInfo, aPrincipal, aSession)
}
}
for (let i in aTypesInfo) {
// Expand the permission to see if we have multiple access properties
// to convert
let perm = aTypesInfo[i].permission;
let access = PermissionsTable[perm].access;
if (access) {
for (let idx in access) {
convertPermToAllow(perm + "-" + access[idx], aPrincipal);
}
} else {
convertPermToAllow(perm, aPrincipal);
// Expand the permission to see if we have multiple access properties to convert
let access = PermissionsTable[aPermission].access;
if (access) {
for (let idx in access) {
convertPermToAllow(aPermission + "-" + access[idx], aPrincipal);
}
} else {
convertPermToAllow(aPermission, aPrincipal);
}
}
@ -100,66 +78,23 @@ function ContentPermissionPrompt() {}
ContentPermissionPrompt.prototype = {
handleExistingPermission: function handleExistingPermission(request,
typesInfo) {
typesInfo.forEach(function(type) {
type.action =
Services.perms.testExactPermissionFromPrincipal(request.principal,
type.access);
if (type.action == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
PROMPT_FOR_UNKNOWN.indexOf(type.access) >= 0) {
type.action = Ci.nsIPermissionManager.PROMPT_ACTION;
}
});
// If all permissions are allowed already, call allow() without prompting.
let checkAllowPermission = function(type) {
if (type.action == Ci.nsIPermissionManager.ALLOW_ACTION) {
return true;
}
return false;
}
if (typesInfo.every(checkAllowPermission)) {
debug("all permission requests are allowed");
handleExistingPermission: function handleExistingPermission(request) {
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
request.type;
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, access);
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
request.allow();
return true;
}
// If all permissions are DENY_ACTION or UNKNOWN_ACTION, call cancel()
// without prompting.
let checkDenyPermission = function(type) {
if (type.action == Ci.nsIPermissionManager.DENY_ACTION ||
type.action == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
return true;
}
return false;
}
if (typesInfo.every(checkDenyPermission)) {
debug("all permission requests are denied");
if (result == Ci.nsIPermissionManager.DENY_ACTION ||
result == Ci.nsIPermissionManager.UNKNOWN_ACTION && PROMPT_FOR_UNKNOWN.indexOf(access) < 0) {
request.cancel();
return true;
}
return false;
},
// multiple requests should be audio and video
checkMultipleRequest: function checkMultipleRequest(typesInfo) {
if (typesInfo.length == 1) {
return true;
} else if (typesInfo.length > 1) {
let checkIfAllowMultiRequest = function(type) {
return (ALLOW_MULTIPLE_REQUESTS.indexOf(type.access) !== -1);
}
if (typesInfo.every(checkIfAllowMultiRequest)) {
debug("legal multiple requests");
return true;
}
}
return false;
},
handledByApp: function handledByApp(request, typesInfo) {
handledByApp: function handledByApp(request) {
if (request.principal.appId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
request.principal.appId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID) {
// This should not really happen
@ -171,94 +106,49 @@ ContentPermissionPrompt.prototype = {
.getService(Ci.nsIAppsService);
let app = appsService.getAppByLocalId(request.principal.appId);
// Check each permission if it's denied by permission manager with app's
// URL.
let notDenyAppPrincipal = function(type) {
let url = Services.io.newURI(app.origin, null, null);
let principal = secMan.getAppCodebasePrincipal(url,
request.principal.appId,
/*mozbrowser*/false);
let result = Services.perms.testExactPermissionFromPrincipal(principal,
type.access);
let url = Services.io.newURI(app.origin, null, null);
let principal = secMan.getAppCodebasePrincipal(url, request.principal.appId,
/*mozbrowser*/false);
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
request.type;
let result = Services.perms.testExactPermissionFromPrincipal(principal, access);
if (result == Ci.nsIPermissionManager.ALLOW_ACTION ||
result == Ci.nsIPermissionManager.PROMPT_ACTION) {
type.deny = false;
}
return !type.deny;
}
if (typesInfo.filter(notDenyAppPrincipal).length === 0) {
request.cancel();
return true;
if (result == Ci.nsIPermissionManager.ALLOW_ACTION ||
result == Ci.nsIPermissionManager.PROMPT_ACTION) {
return false;
}
return false;
request.cancel();
return true;
},
handledByPermissionType: function handledByPermissionType(request, typesInfo) {
for (let i in typesInfo) {
if (permissionSpecificChecker.hasOwnProperty(typesInfo[i].permission) &&
permissionSpecificChecker[typesInfo[i].permission](request)) {
return true;
}
}
return false;
handledByPermissionType: function handledByPermissionType(request) {
return permissionSpecificChecker.hasOwnProperty(request.type)
? permissionSpecificChecker[request.type](request)
: false;
},
_id: 0,
prompt: function(request) {
if (secMan.isSystemPrincipal(request.principal)) {
request.allow();
return;
return true;
}
// Initialize the typesInfo and set the default value.
let typesInfo = [];
let perms = request.types.QueryInterface(Ci.nsIArray);
for (let idx = 0; idx < perms.length; idx++) {
let perm = perms.queryElementAt(idx, Ci.nsIContentPermissionType);
let tmp = {
permission: perm.type,
access: (perm.access && perm.access !== "unused") ?
perm.type + "-" + perm.access : perm.type,
deny: true,
action: Ci.nsIPermissionManager.UNKNOWN_ACTION
};
typesInfo.push(tmp);
}
if (typesInfo.length == 0) {
request.cancel();
return;
}
if(!this.checkMultipleRequest(typesInfo)) {
request.cancel();
return;
}
if (this.handledByApp(request, typesInfo) ||
this.handledByPermissionType(request, typesInfo)) {
if (this.handledByApp(request) ||
this.handledByPermissionType(request)) {
return;
}
// returns true if the request was handled
if (this.handleExistingPermission(request, typesInfo)) {
if (this.handleExistingPermission(request))
return;
}
// prompt PROMPT_ACTION request only.
typesInfo.forEach(function(aType, aIndex) {
if (aType.action != Ci.nsIPermissionManager.PROMPT_ACTION || aType.deny) {
typesInfo.splice(aIndex);
}
});
let frame = request.element;
let requestId = this._id++;
if (!frame) {
this.delegatePrompt(request, requestId, typesInfo);
this.delegatePrompt(request, requestId);
return;
}
@ -273,7 +163,7 @@ ContentPermissionPrompt.prototype = {
if (evt.detail.visible === true)
return;
self.cancelPrompt(request, requestId, typesInfo);
self.cancelPrompt(request, requestId);
cancelRequest();
}
@ -290,7 +180,7 @@ ContentPermissionPrompt.prototype = {
// away but the request is still here.
frame.addEventListener("mozbrowservisibilitychange", onVisibilityChange);
self.delegatePrompt(request, requestId, typesInfo, function onCallback() {
self.delegatePrompt(request, requestId, function onCallback() {
frame.removeEventListener("mozbrowservisibilitychange", onVisibilityChange);
});
};
@ -301,17 +191,22 @@ ContentPermissionPrompt.prototype = {
}
},
cancelPrompt: function(request, requestId, typesInfo) {
this.sendToBrowserWindow("cancel-permission-prompt", request, requestId,
typesInfo);
cancelPrompt: function(request, requestId) {
this.sendToBrowserWindow("cancel-permission-prompt", request, requestId);
},
delegatePrompt: function(request, requestId, typesInfo, callback) {
delegatePrompt: function(request, requestId, callback) {
let access = (request.access && request.access !== "unused") ? request.type + "-" + request.access :
request.type;
let principal = request.principal;
this.sendToBrowserWindow("permission-prompt", request, requestId, typesInfo,
function(type, remember) {
this._permission = access;
this._uri = principal.URI.spec;
this._origin = principal.origin;
this.sendToBrowserWindow("permission-prompt", request, requestId, function(type, remember) {
if (type == "permission-allow") {
rememberPermission(typesInfo, request.principal, !remember);
rememberPermission(request.type, principal, !remember);
if (callback) {
callback();
}
@ -319,20 +214,14 @@ ContentPermissionPrompt.prototype = {
return;
}
let addDenyPermission = function(type) {
debug("add " + type.permission +
" to permission manager with DENY_ACTION");
if (remember) {
Services.perms.addFromPrincipal(request.principal, type.access,
Ci.nsIPermissionManager.DENY_ACTION);
} else if (PERMISSION_NO_SESSION.indexOf(aPerm) < 0) {
Services.perms.addFromPrincipal(request.principal, type.access,
Ci.nsIPermissionManager.DENY_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION,
0);
}
if (remember) {
Services.perms.addFromPrincipal(principal, access,
Ci.nsIPermissionManager.DENY_ACTION);
} else {
Services.perms.addFromPrincipal(principal, access,
Ci.nsIPermissionManager.DENY_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION, 0);
}
typesInfo.forEach(addDenyPermission);
if (callback) {
callback();
@ -341,7 +230,7 @@ ContentPermissionPrompt.prototype = {
});
},
sendToBrowserWindow: function(type, request, requestId, typesInfo, callback) {
sendToBrowserWindow: function(type, request, requestId, callback) {
let browser = Services.wm.getMostRecentWindow("navigator:browser");
let content = browser.getContentWindow();
if (!content)
@ -364,15 +253,10 @@ ContentPermissionPrompt.prototype = {
principal.appStatus == Ci.nsIPrincipal.APP_STATUS_CERTIFIED)
? true
: request.remember;
let permissions = {};
for (let i in typesInfo) {
debug("prompt " + typesInfo[i].permission);
permissions[typesInfo[i].permission] = [];
}
let details = {
type: type,
permissions: permissions,
permission: request.type,
id: requestId,
origin: principal.origin,
isApp: isApp,
@ -405,5 +289,6 @@ ContentPermissionPrompt.prototype = {
};
})();
//module initialization
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);

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

@ -47,8 +47,8 @@ FilePicker.prototype = {
/* members */
mParent: undefined,
mExtraProps: {},
mFilterTypes: [],
mExtraProps: undefined,
mFilterTypes: undefined,
mFileEnumerator: undefined,
mFilePickerShownCallback: undefined,
@ -56,6 +56,8 @@ FilePicker.prototype = {
init: function(parent, title, mode) {
this.mParent = parent;
this.mExtraProps = {};
this.mFilterTypes = [];
this.mMode = mode;
if (mode != Ci.nsIFilePicker.modeOpen &&
@ -177,12 +179,13 @@ FilePicker.prototype = {
return;
}
var mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
var mimeInfo = mimeSvc.getFromTypeAndExtension(data.result.blob.type, '');
var name = 'blob';
if (mimeInfo) {
name += '.' + mimeInfo.primaryExtension;
if (data.result.blob.type) {
let mimeSvc = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let mimeInfo = mimeSvc.getFromTypeAndExtension(data.result.blob.type, '');
if (mimeInfo) {
name += '.' + mimeInfo.primaryExtension;
}
}
let file = new this.mParent.File(data.result.blob,

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

@ -1,4 +1,4 @@
{
"revision": "bb23044d4a97be1381be924064817dddbd2ea47b",
"revision": "9f1117fde1d221d998c065a87e0614af6239b585",
"repo_path": "/integration/gaia-central"
}

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

@ -2037,21 +2037,13 @@ ContentPermissionPrompt.prototype = {
prompt: function CPP_prompt(request) {
// Only allow exactly one permission rquest here.
let types = request.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
request.cancel();
return;
}
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
const kFeatureKeys = { "geolocation" : "geo",
"desktop-notification" : "desktop-notification",
"pointerLock" : "pointerLock",
};
// Make sure that we support the request.
if (!(perm.type in kFeatureKeys)) {
if (!(request.type in kFeatureKeys)) {
return;
}
@ -2063,7 +2055,7 @@ ContentPermissionPrompt.prototype = {
return;
var autoAllow = false;
var permissionKey = kFeatureKeys[perm.type];
var permissionKey = kFeatureKeys[request.type];
var result = Services.perms.testExactPermissionFromPrincipal(requestingPrincipal, permissionKey);
if (result == Ci.nsIPermissionManager.DENY_ACTION) {
@ -2074,7 +2066,7 @@ ContentPermissionPrompt.prototype = {
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
autoAllow = true;
// For pointerLock, we still want to show a warning prompt.
if (perm.type != "pointerLock") {
if (request.type != "pointerLock") {
request.allow();
return;
}
@ -2088,7 +2080,7 @@ ContentPermissionPrompt.prototype = {
return;
// Show the prompt.
switch (perm.type) {
switch (request.type) {
case "geolocation":
this._promptGeo(request);
break;

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

@ -44,8 +44,6 @@ let IndexedDB = {
}
let prompt = Cc["@mozilla.org/content-permission/prompt;1"].createInstance(Ci.nsIContentPermissionPrompt);
let types = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
types.appendElement({type: type, access: "unused"}, false);
// If the user waits a long time before responding, we default to UNKNOWN_ACTION.
let timeoutId = setTimeout(function() {
@ -62,7 +60,7 @@ let IndexedDB = {
}
prompt.prompt({
types: types,
type: type,
uri: Services.io.newURI(payload.location, null, null),
window: null,
element: aMessage.target,

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

@ -56,8 +56,8 @@ ContentPermissionPrompt.prototype = {
return chromeWin.Browser.getNotificationBox(request.element);
},
handleExistingPermission: function handleExistingPermission(request, type) {
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, type);
handleExistingPermission: function handleExistingPermission(request) {
let result = Services.perms.testExactPermissionFromPrincipal(request.principal, request.type);
if (result == Ci.nsIPermissionManager.ALLOW_ACTION) {
request.allow();
return true;
@ -70,28 +70,20 @@ ContentPermissionPrompt.prototype = {
},
prompt: function(request) {
// Only allow exactly one permission rquest here.
let types = request.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
request.cancel();
return;
}
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
// returns true if the request was handled
if (this.handleExistingPermission(request, perm.type))
if (this.handleExistingPermission(request))
return;
let pm = Services.perms;
let notificationBox = this.getNotificationBoxForRequest(request);
let browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let notification = notificationBox.getNotificationWithValue(perm.type);
let notification = notificationBox.getNotificationWithValue(request.type);
if (notification)
return;
let entityName = kEntities[perm.type];
let icon = kIcons[perm.type] || "";
let entityName = kEntities[request.type];
let icon = kIcons[request.type] || "";
let buttons = [{
label: browserBundle.GetStringFromName(entityName + ".allow"),
@ -104,7 +96,7 @@ ContentPermissionPrompt.prototype = {
label: browserBundle.GetStringFromName("contentPermissions.alwaysForSite"),
accessKey: "",
callback: function(notification) {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.addFromPrincipal(request.principal, request.type, Ci.nsIPermissionManager.ALLOW_ACTION);
request.allow();
}
},
@ -112,7 +104,7 @@ ContentPermissionPrompt.prototype = {
label: browserBundle.GetStringFromName("contentPermissions.neverForSite"),
accessKey: "",
callback: function(notification) {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.DENY_ACTION);
Services.perms.addFromPrincipal(request.principal, request.type, Ci.nsIPermissionManager.DENY_ACTION);
request.cancel();
}
}];
@ -120,12 +112,12 @@ ContentPermissionPrompt.prototype = {
let message = browserBundle.formatStringFromName(entityName + ".wantsTo",
[request.principal.URI.host], 1);
let newBar = notificationBox.appendNotification(message,
perm.type,
request.type,
icon,
notificationBox.PRIORITY_WARNING_MEDIUM,
buttons);
if (perm.type == "geolocation") {
if (request.type == "geolocation") {
// Add the "learn more" link.
let link = newBar.ownerDocument.createElement("label");
link.setAttribute("value", browserBundle.GetStringFromName("geolocation.learnMore"));

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

@ -3983,7 +3983,6 @@ LIBJPEG_TURBO_ASFLAGS=
LIBJPEG_TURBO_X86_ASM=
LIBJPEG_TURBO_X64_ASM=
LIBJPEG_TURBO_ARM_ASM=
MOZ_PANGO=1
MOZ_PERMISSIONS=1
MOZ_PLACES=1
MOZ_SOCIAL=1
@ -4731,34 +4730,16 @@ AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
AC_SUBST(MOZ_DISTRIBUTION_ID)
dnl ========================================================
dnl complex text support off by default
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(pango,
[ --disable-pango Disable usage of Pango ],
MOZ_PANGO=,
MOZ_PANGO=1)
dnl ========================================================
dnl = Pango
dnl ========================================================
if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
then
AC_SUBST(MOZ_PANGO)
PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
if test "$MOZ_PANGO"
then
PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)
AC_DEFINE(MOZ_PANGO)
else
PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0)
AC_SUBST(FT2_CFLAGS)
AC_SUBST(FT2_LIBS)
fi
PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
AC_SUBST(MOZ_PANGO_CFLAGS)
AC_SUBST(MOZ_PANGO_LIBS)
fi
dnl ========================================================

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

@ -642,13 +642,13 @@ nsDOMMemoryFile::DataOwner::sDataOwners;
/* static */ bool
nsDOMMemoryFile::DataOwner::sMemoryReporterRegistered;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(DOMMemoryFileDataOwnerMallocSizeOf)
class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL
: public MemoryMultiReporter
: public nsIMemoryReporter
{
public:
nsDOMMemoryFileDataOwnerMemoryReporter() {}
NS_DECL_THREADSAFE_ISUPPORTS
NS_IMETHOD CollectReports(nsIMemoryReporterCallback *aCallback,
nsISupports *aClosure)
@ -723,6 +723,8 @@ public:
}
};
NS_IMPL_ISUPPORTS1(nsDOMMemoryFileDataOwnerMemoryReporter, nsIMemoryReporter)
/* static */ void
nsDOMMemoryFile::DataOwner::EnsureMemoryReporterRegistered()
{

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

@ -217,8 +217,6 @@
#include "mozilla/dom/XPathEvaluator.h"
#include "nsIDocumentEncoder.h"
#include "nsIStructuredCloneContainer.h"
#include "nsIMutableArray.h"
#include "nsContentPermissionHelper.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2645,6 +2643,33 @@ nsDocument::InitCSP(nsIChannel* aChannel)
#endif
nsresult rv;
// If Document is an app check to see if we already set CSP and return early
// if that is indeed the case.
//
// In general (see bug 947831), we should not be setting CSP on a principal
// that aliases another document. For non-app code this is not a problem
// since we only share the underlying principal with nested browsing
// contexts for which a header cannot be set (e.g., about:blank and
// about:srcodoc iframes) and thus won't try to set the CSP again. This
// check ensures that we do not try to set CSP for an app.
if (applyAppDefaultCSP || applyAppManifestCSP) {
nsCOMPtr<nsIContentSecurityPolicy> csp;
rv = principal->GetCsp(getter_AddRefs(csp));
NS_ENSURE_SUCCESS(rv, rv);
if (csp) {
#ifdef PR_LOGGING
PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s",
"This document is sharing principal with another document.",
"Since the document is an app, CSP was already set.",
"Skipping attempt to set CSP."));
#endif
return NS_OK;
}
}
// create new CSP object
csp = do_CreateInstance("@mozilla.org/contentsecuritypolicy;1", &rv);
if (NS_FAILED(rv)) {
@ -2724,16 +2749,12 @@ nsDocument::InitCSP(nsIChannel* aChannel)
}
}
if (csp) {
// Copy into principal
nsIPrincipal* principal = GetPrincipal();
rv = principal->SetCsp(csp);
NS_ENSURE_SUCCESS(rv, rv);
rv = principal->SetCsp(csp);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef PR_LOGGING
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
("Inserted CSP into principal %p", principal));
PR_LOG(gCspPRLog, PR_LOG_DEBUG,
("Inserted CSP into principal %p", principal));
#endif
}
return NS_OK;
}
@ -10731,11 +10752,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPointerLockPermissionRequest,
nsIContentPermissionRequest)
NS_IMETHODIMP
nsPointerLockPermissionRequest::GetTypes(nsIArray** aTypes)
nsPointerLockPermissionRequest::GetType(nsACString& aType)
{
return CreatePermissionArray(NS_LITERAL_CSTRING("pointerLock"),
NS_LITERAL_CSTRING("unused"),
aTypes);
aType = "pointerLock";
return NS_OK;
}
NS_IMETHODIMP
nsPointerLockPermissionRequest::GetAccess(nsACString& aAccess)
{
aAccess = "unused";
return NS_OK;
}
NS_IMETHODIMP

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

@ -1130,13 +1130,11 @@ struct MessageManagerReferentCount
namespace mozilla {
namespace dom {
class MessageManagerReporter MOZ_FINAL : public MemoryMultiReporter
class MessageManagerReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
MessageManagerReporter() {}
NS_IMETHOD CollectReports(nsIMemoryReporterCallback* aCallback,
nsISupports* aData);
NS_DECL_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
static const size_t kSuspectReferentCount = 300;
protected:
@ -1144,6 +1142,8 @@ protected:
MessageManagerReferentCount* aReferentCount);
};
NS_IMPL_ISUPPORTS1(MessageManagerReporter, nsIMemoryReporter)
static PLDHashOperator
CollectMessageListenerData(const nsAString& aKey,
nsAutoTObserverArray<nsMessageListenerInfo, 1>* aListeners,

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

@ -85,7 +85,7 @@ WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
return NS_OK;
}
NS_IMPL_ISUPPORTS_INHERITED0(WebGLMemoryTracker, MemoryMultiReporter)
NS_IMPL_ISUPPORTS1(WebGLMemoryTracker, nsIMemoryReporter)
StaticRefPtr<WebGLMemoryTracker> WebGLMemoryTracker::sUniqueInstance;
@ -113,7 +113,7 @@ WebGLMemoryTracker::~WebGLMemoryTracker()
UnregisterWeakMemoryReporter(this);
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WebGLBufferMallocSizeOf)
int64_t
WebGLMemoryTracker::GetBufferCacheMemoryUsed() {
@ -131,7 +131,7 @@ WebGLMemoryTracker::GetBufferCacheMemoryUsed() {
return result;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WebGLShaderMallocSizeOf)
int64_t
WebGLMemoryTracker::GetShaderSize() {

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

@ -19,9 +19,10 @@
namespace mozilla {
class WebGLMemoryTracker : public MemoryMultiReporter
class WebGLMemoryTracker : public nsIMemoryReporter
{
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
WebGLMemoryTracker();
virtual ~WebGLMemoryTracker();
@ -55,9 +56,6 @@ class WebGLMemoryTracker : public MemoryMultiReporter
}
}
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData);
private:
static int64_t GetTextureMemoryUsed() {
const ContextsArrayType & contexts = Contexts();

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

@ -54,9 +54,10 @@ PRLogModuleInfo* gMediaDecoderLog;
#define DECODER_LOG(type, msg)
#endif
class MediaMemoryTracker : public MemoryMultiReporter
class MediaMemoryTracker : public nsIMemoryReporter
{
NS_DECL_ISUPPORTS
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
MediaMemoryTracker();
virtual ~MediaMemoryTracker();
@ -93,14 +94,11 @@ public:
sUniqueInstance = nullptr;
}
}
NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData);
};
StaticRefPtr<MediaMemoryTracker> MediaMemoryTracker::sUniqueInstance;
NS_IMPL_ISUPPORTS_INHERITED0(MediaMemoryTracker, MemoryMultiReporter)
NS_IMPL_ISUPPORTS1(MediaMemoryTracker, nsIMemoryReporter)
NS_IMPL_ISUPPORTS1(MediaDecoder, nsIObserver)

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

@ -5,7 +5,6 @@
#ifndef MEDIAENGINE_H_
#define MEDIAENGINE_H_
#include "mozilla/RefPtr.h"
#include "nsIDOMFile.h"
#include "DOMMediaStream.h"
#include "MediaStreamGraph.h"
@ -36,7 +35,7 @@ enum {
kAudioTrack = 2
};
class MediaEngine : public RefCounted<MediaEngine>
class MediaEngine
{
public:
virtual ~MediaEngine() {}

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

@ -101,7 +101,7 @@ MediaEngineWebRTC::EnumerateVideoDevices(nsTArray<nsRefPtr<MediaEngineVideoSourc
// We've already seen this device, just append.
aVSources->AppendElement(vSource.get());
} else {
vSource = new MediaEngineWebRTCVideoSource(mCameraManager, i);
vSource = new MediaEngineWebRTCVideoSource(mCameraManager, i, mWindowId);
mVideoSources.Put(uuid, vSource); // Hashtable takes ownership.
aVSources->AppendElement(vSource);
}

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

@ -52,7 +52,6 @@
#include "ImageContainer.h"
#include "nsGlobalWindow.h"
#include "prprf.h"
#include "nsProxyRelease.h"
#endif
#include "NullTransport.h"
@ -74,7 +73,7 @@ class GetCameraNameRunnable;
* mSources, mImageContainer, mSources, mState, mImage, mLastCapture
*
* MainThread:
* mDOMCameraControl, mCaptureIndex, mCameraThread, mCameraManager,
* mDOMCameraControl, mCaptureIndex, mCameraThread, mWindowId, mCameraManager,
* mNativeCameraControl, mPreviewStream, mState, mLastCapture, mWidth, mHeight
*
* Where mWidth, mHeight, mImage are protected by mMonitor
@ -97,10 +96,11 @@ class MediaEngineWebRTCVideoSource : public MediaEngineVideoSource
public:
#ifdef MOZ_B2G_CAMERA
MediaEngineWebRTCVideoSource(nsDOMCameraManager* aCameraManager,
int aIndex)
int aIndex, uint64_t aWindowId)
: mCameraManager(aCameraManager)
, mNativeCameraControl(nullptr)
, mPreviewStream(nullptr)
, mWindowId(aWindowId)
, mCallbackMonitor("WebRTCCamera.CallbackMonitor")
, mCaptureIndex(aIndex)
, mMonitor("WebRTCCamera.Monitor")
@ -223,6 +223,7 @@ private:
nsRefPtr<nsDOMCameraControl> mDOMCameraControl;
nsRefPtr<nsGonkCameraControl> mNativeCameraControl;
nsRefPtr<DOMCameraPreview> mPreviewStream;
uint64_t mWindowId;
mozilla::ReentrantMonitor mCallbackMonitor; // Monitor for camera callback handling
nsRefPtr<nsIThread> mCameraThread;
nsRefPtr<nsIDOMFile> mLastCapture;
@ -351,14 +352,15 @@ class MediaEngineWebRTC : public MediaEngine
{
public:
#ifdef MOZ_B2G_CAMERA
MediaEngineWebRTC(nsDOMCameraManager* aCameraManager)
MediaEngineWebRTC(nsDOMCameraManager* aCameraManager, uint64_t aWindowId)
: mMutex("mozilla::MediaEngineWebRTC")
, mVideoEngine(nullptr)
, mVoiceEngine(nullptr)
, mVideoEngineInit(false)
, mAudioEngineInit(false)
, mHasTabVideoSource(false)
, mCameraManager(aCameraManager)
, mWindowId(aWindowId)
, mHasTabVideoSource(false)
{
AsyncLatencyLogger::Get(true)->AddRef();
mLoadMonitor = new LoadMonitor();
@ -399,8 +401,6 @@ private:
nsRefPtrHashtable<nsStringHashKey, MediaEngineWebRTCAudioSource > mAudioSources;
#ifdef MOZ_B2G_CAMERA
// XXX Should use nsMainThreadPtrHandle/etc
// MediaEngine hold this DOM object, and the MediaEngine is hold by Navigator
// Their life time is always much longer than this object. Use a raw-pointer
// here should be safe.
@ -409,6 +409,7 @@ private:
// avoid any bad thing do to addref/release DOM-object on other thread, we use
// raw-pointer for now.
nsDOMCameraManager* mCameraManager;
uint64_t mWindowId;
#endif
nsRefPtr<LoadMonitor> mLoadMonitor;

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

@ -312,6 +312,7 @@ nsresult
MediaEngineWebRTCVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
{
LOG((__FUNCTION__));
int error = 0;
if (!mInitDone || !aStream) {
return NS_ERROR_FAILURE;
}
@ -340,7 +341,7 @@ MediaEngineWebRTCVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
}
#else
mState = kStarted;
int error = mViERender->AddRenderer(mCaptureIndex, webrtc::kVideoI420, (webrtc::ExternalRenderer*)this);
error = mViERender->AddRenderer(mCaptureIndex, webrtc::kVideoI420, (webrtc::ExternalRenderer*)this);
if (error == -1) {
return NS_ERROR_FAILURE;
}
@ -491,9 +492,12 @@ void
MediaEngineWebRTCVideoSource::AllocImpl() {
MOZ_ASSERT(NS_IsMainThread());
ErrorResult rv;
mDOMCameraControl = mCameraManager->GetCameraControl(mCaptureIndex,
this, this, rv);
mDOMCameraControl = new nsDOMCameraControl(mCaptureIndex,
mCameraThread,
this,
this,
nsGlobalWindow::GetInnerWindowWithId(mWindowId));
mCameraManager->Register(mDOMCameraControl);
}
void
@ -502,7 +506,6 @@ MediaEngineWebRTCVideoSource::DeallocImpl() {
mNativeCameraControl->ReleaseHardware(this, this);
mNativeCameraControl = nullptr;
mDOMCameraControl = nullptr;
}
void

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

@ -45,6 +45,7 @@ support-files =
skip-if = true # disabled-for-intermittent-failures--bug-701060
[test_length.xhtml]
skip-if = true
[test_lengthParsing.html]
[test_nonAnimStrings.xhtml]
[test_non-scaling-stroke.html]
[test_pathAnimInterpolation.xhtml]

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

@ -0,0 +1,77 @@
<!doctype html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=946529
-->
<head>
<meta charset="utf-8">
<title>Test transform parsing</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=946529">Mozilla Bug 946529</a>
<p id="display"></p>
<div id="content" style="display: none">
<svg width="100%" height="1" id="svg">
<rect id="rect"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
// Test cases
checkParseOk("", 0);
checkParseOk("-.1", -0.1);
checkParseOk("1e1", 10);
checkParseOk("1em", 1, "em");
checkParseOk("1ex", 1, "ex");
checkParseOk("1e1em", 10, "em");
checkParseOk("1E+2", 100);
checkParseOk(".1e-2", 0.001);
// Fail cases
checkParseFail("1e");
checkParseFail("1 e");
checkParseFail("1 em");
checkParseFail("1ee");
function checkParseOk(spec, valueInUnits, units) {
var rect = document.getElementById("rect");
// Clear previous value
rect.removeAttribute("x");
rect.setAttribute("x", spec);
// Check number part
const tolerance = 1 / 65535;
var actual = rect.x.baseVal.valueInSpecifiedUnits;
ok(Math.abs(actual - valueInUnits) < tolerance,
spec + ' (value) - got ' + actual + ', expected ' + valueInUnits);
// Check unit part
var unitMapping = {
"unknown": SVGLength.SVG_LENGTHTYPE_UNKNOWN,
"": SVGLength.SVG_LENGTHTYPE_NUMBER,
"%": SVGLength.SVG_LENGTHTYPE_PERCENTAGE,
"em": SVGLength.SVG_LENGTHTYPE_EMS,
"ex": SVGLength.SVG_LENGTHTYPE_EXS,
"px": SVGLength.SVG_LENGTHTYPE_PX,
"cm": SVGLength.SVG_LENGTHTYPE_CM,
"mm": SVGLength.SVG_LENGTHTYPE_MM,
"in": SVGLength.SVG_LENGTHTYPE_IN,
"pt": SVGLength.SVG_LENGTHTYPE_PT,
"pc": SVGLength.SVG_LENGTHTYPE_PC
};
if (typeof units == "undefined") {
units = "";
}
ise(rect.x.baseVal.unitType, unitMapping[units], spec + " (unit)");
}
function checkParseFail(spec) {
checkParseOk(spec, 0);
}
</script>
</pre>
</body>
</html>

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

@ -323,11 +323,6 @@ this.PermissionsTable = { geolocation: {
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
"video-capture": {
app: PROMPT_ACTION,
privileged: PROMPT_ACTION,
certified: PROMPT_ACTION
},
};
/**

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

@ -21,7 +21,6 @@
#include "mozilla/dom/quota/QuotaObject.h"
#include "mozilla/dom/quota/UsageInfo.h"
#include "mozilla/unused.h"
#include "nsContentUtils.h"
#include "nsIAtom.h"
#include "nsIFile.h"
#include "nsIPrincipal.h"
@ -975,7 +974,7 @@ DeallocEntryChild(PAsmJSCacheEntryChild* aActor)
namespace {
bool
OpenFile(JS::Handle<JSObject*> aGlobal,
OpenFile(nsIPrincipal* aPrincipal,
OpenMode aOpenMode,
size_t aSizeToWrite,
File::AutoClose* aFile)
@ -998,17 +997,14 @@ OpenFile(JS::Handle<JSObject*> aGlobal,
return false;
}
// This assumes a non-worker global.
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(aGlobal);
// If we are in a child process, we need to synchronously call into the
// parent process to open the file and interact with the QuotaManager. The
// child can then map the file into its address space to perform I/O.
nsRefPtr<File> file;
if (IsMainProcess()) {
file = new SingleProcessRunnable(principal, aOpenMode, aSizeToWrite);
file = new SingleProcessRunnable(aPrincipal, aOpenMode, aSizeToWrite);
} else {
file = new ChildProcessRunnable(principal, aOpenMode, aSizeToWrite);
file = new ChildProcessRunnable(aPrincipal, aOpenMode, aSizeToWrite);
}
if (!file->BlockUntilOpen(aFile)) {
@ -1028,7 +1024,7 @@ static const uint32_t sAsmJSCookie = 0x600d600d;
static const size_t sMinCachedModuleLength = 10000;
bool
OpenEntryForRead(JS::Handle<JSObject*> aGlobal,
OpenEntryForRead(nsIPrincipal* aPrincipal,
const jschar* aBegin,
const jschar* aLimit,
size_t* aSize,
@ -1040,7 +1036,7 @@ OpenEntryForRead(JS::Handle<JSObject*> aGlobal,
}
File::AutoClose file;
if (!OpenFile(aGlobal, eOpenForRead, 0, &file)) {
if (!OpenFile(aPrincipal, eOpenForRead, 0, &file)) {
return false;
}
@ -1082,7 +1078,7 @@ CloseEntryForRead(JS::Handle<JSObject*> global,
}
bool
OpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
OpenEntryForWrite(nsIPrincipal* aPrincipal,
const jschar* aBegin,
const jschar* aEnd,
size_t aSize,
@ -1097,7 +1093,7 @@ OpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
aSize += sizeof(AsmJSCookieType);
File::AutoClose file;
if (!OpenFile(aGlobal, eOpenForWrite, aSize, &file)) {
if (!OpenFile(aPrincipal, eOpenForWrite, aSize, &file)) {
return false;
}

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

@ -32,10 +32,20 @@ enum OpenMode
NUM_OPEN_MODES
};
// Implementation of AsmJSCacheOps, installed by nsJSEnvironment:
// Implementation of AsmJSCacheOps, installed for the main JSRuntime by
// nsJSEnvironment.cpp and DOM Worker JSRuntimes in RuntimeService.cpp.
//
// The Open* functions cannot be called directly from AsmJSCacheOps: they take
// an nsIPrincipal as the first argument instead of a Handle<JSObject*>. The
// caller must map the object to an nsIPrincipal.
//
// These methods may be called off the main thread and guarantee not to
// access the given aPrincipal except on the main thread. In exchange, the
// caller must ensure the given principal is alive from when OpenEntryForX is
// called to when CloseEntryForX returns.
bool
OpenEntryForRead(JS::Handle<JSObject*> aGlobal,
OpenEntryForRead(nsIPrincipal* aPrincipal,
const jschar* aBegin,
const jschar* aLimit,
size_t* aSize,
@ -47,7 +57,7 @@ CloseEntryForRead(JS::Handle<JSObject*> aGlobal,
const uint8_t* aMemory,
intptr_t aHandle);
bool
OpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
OpenEntryForWrite(nsIPrincipal* aPrincipal,
const jschar* aBegin,
const jschar* aEnd,
size_t aSize,

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

@ -6,156 +6,20 @@
#include "GonkPermission.h"
#include "mozilla/dom/ContentParent.h"
#endif // MOZ_WIDGET_GONK
#include "nsContentPermissionHelper.h"
#include "nsIContentPermissionPrompt.h"
#include "nsCOMPtr.h"
#include "nsIDOMElement.h"
#include "nsIPrincipal.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/PContentPermission.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/unused.h"
#include "nsComponentManagerUtils.h"
#include "nsArrayUtils.h"
#include "nsIMutableArray.h"
#include "nsContentPermissionHelper.h"
using mozilla::unused; // <snicker>
using namespace mozilla::dom;
using namespace mozilla;
namespace mozilla {
namespace dom {
class ContentPermissionRequestParent : public PContentPermissionRequestParent
{
public:
ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
Element* element,
const IPC::Principal& principal);
virtual ~ContentPermissionRequestParent();
bool IsBeingDestroyed();
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<Element> mElement;
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
nsTArray<PermissionRequest> mRequests;
private:
virtual bool Recvprompt();
virtual void ActorDestroy(ActorDestroyReason why);
};
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
Element* aElement,
const IPC::Principal& aPrincipal)
{
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
mPrincipal = aPrincipal;
mElement = aElement;
mRequests = aRequests;
}
ContentPermissionRequestParent::~ContentPermissionRequestParent()
{
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
}
bool
ContentPermissionRequestParent::Recvprompt()
{
mProxy = new nsContentPermissionRequestProxy();
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
if (NS_FAILED(mProxy->Init(mRequests, this))) {
mProxy->Cancel();
}
return true;
}
void
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
{
if (mProxy) {
mProxy->OnParentDestroyed();
}
}
bool
ContentPermissionRequestParent::IsBeingDestroyed()
{
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
// to send out any message now.
TabParent* tabParent = static_cast<TabParent*>(Manager());
return tabParent->IsDestroyed();
}
NS_IMPL_ISUPPORTS1(ContentPermissionType, nsIContentPermissionType)
ContentPermissionType::ContentPermissionType(const nsACString& aType,
const nsACString& aAccess)
{
mType = aType;
mAccess = aAccess;
}
ContentPermissionType::~ContentPermissionType()
{
}
NS_IMETHODIMP
ContentPermissionType::GetType(nsACString& aType)
{
aType = mType;
return NS_OK;
}
NS_IMETHODIMP
ContentPermissionType::GetAccess(nsACString& aAccess)
{
aAccess = mAccess;
return NS_OK;
}
uint32_t
ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
nsIMutableArray* aDesArray)
{
uint32_t len = aSrcArray.Length();
for (uint32_t i = 0; i < len; i++) {
nsRefPtr<ContentPermissionType> cpt =
new ContentPermissionType(aSrcArray[i].type(), aSrcArray[i].access());
aDesArray->AppendElement(cpt, false);
}
return len;
}
nsresult
CreatePermissionArray(const nsACString& aType,
const nsACString& aAccess,
nsIArray** aTypesArray)
{
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
nsRefPtr<ContentPermissionType> permType = new ContentPermissionType(aType,
aAccess);
types->AppendElement(permType, false);
types.forget(aTypesArray);
return NS_OK;
}
PContentPermissionRequestParent*
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
Element* element,
const IPC::Principal& principal)
{
return new ContentPermissionRequestParent(aRequests, element, principal);
}
} // namespace dom
} // namespace mozilla
nsContentPermissionRequestProxy::nsContentPermissionRequestProxy()
{
MOZ_COUNT_CTOR(nsContentPermissionRequestProxy);
@ -167,12 +31,14 @@ nsContentPermissionRequestProxy::~nsContentPermissionRequestProxy()
}
nsresult
nsContentPermissionRequestProxy::Init(const nsTArray<PermissionRequest>& requests,
nsContentPermissionRequestProxy::Init(const nsACString & type,
const nsACString & access,
ContentPermissionRequestParent* parent)
{
NS_ASSERTION(parent, "null parent");
mParent = parent;
mPermissionRequests = requests;
mType = type;
mAccess = access;
nsCOMPtr<nsIContentPermissionPrompt> prompt = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
if (!prompt) {
@ -192,14 +58,17 @@ nsContentPermissionRequestProxy::OnParentDestroyed()
NS_IMPL_ISUPPORTS1(nsContentPermissionRequestProxy, nsIContentPermissionRequest)
NS_IMETHODIMP
nsContentPermissionRequestProxy::GetTypes(nsIArray** aTypes)
nsContentPermissionRequestProxy::GetType(nsACString & aType)
{
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
if (ConvertPermissionRequestToArray(mPermissionRequests, types)) {
types.forget(aTypes);
return NS_OK;
}
return NS_ERROR_FAILURE;
aType = mType;
return NS_OK;
}
NS_IMETHODIMP
nsContentPermissionRequestProxy::GetAccess(nsACString & aAccess)
{
aAccess = mAccess;
return NS_OK;
}
NS_IMETHODIMP
@ -267,18 +136,10 @@ nsContentPermissionRequestProxy::Allow()
}
#ifdef MOZ_WIDGET_GONK
uint32_t len = mPermissionRequests.Length();
for (uint32_t i = 0; i < len; i++) {
if (mPermissionRequests[i].type().Equals("audio-capture")) {
GonkPermissionService::GetInstance()->addGrantInfo(
"android.permission.RECORD_AUDIO",
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
}
if (mPermissionRequests[i].type().Equals("video-capture")) {
GonkPermissionService::GetInstance()->addGrantInfo(
"android.permission.CAMERA",
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
}
if (mType.Equals("audio-capture")) {
GonkPermissionService::GetInstance()->addGrantInfo(
"android.permission.RECORD_AUDIO",
static_cast<TabParent*>(mParent->Manager())->Manager()->Pid());
}
#endif
@ -286,3 +147,55 @@ nsContentPermissionRequestProxy::Allow()
mParent = nullptr;
return NS_OK;
}
namespace mozilla {
namespace dom {
ContentPermissionRequestParent::ContentPermissionRequestParent(const nsACString& aType,
const nsACString& aAccess,
Element* aElement,
const IPC::Principal& aPrincipal)
{
MOZ_COUNT_CTOR(ContentPermissionRequestParent);
mPrincipal = aPrincipal;
mElement = aElement;
mType = aType;
mAccess = aAccess;
}
ContentPermissionRequestParent::~ContentPermissionRequestParent()
{
MOZ_COUNT_DTOR(ContentPermissionRequestParent);
}
bool
ContentPermissionRequestParent::Recvprompt()
{
mProxy = new nsContentPermissionRequestProxy();
NS_ASSERTION(mProxy, "Alloc of request proxy failed");
if (NS_FAILED(mProxy->Init(mType, mAccess, this))) {
mProxy->Cancel();
}
return true;
}
void
ContentPermissionRequestParent::ActorDestroy(ActorDestroyReason why)
{
if (mProxy) {
mProxy->OnParentDestroyed();
}
}
bool
ContentPermissionRequestParent::IsBeingDestroyed()
{
// When TabParent::Destroy() is called, we are being destroyed. It's unsafe
// to send out any message now.
TabParent* tabParent = static_cast<TabParent*>(Manager());
return tabParent->IsDestroyed();
}
} // namespace dom
} // namespace mozilla

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

@ -6,75 +6,60 @@
#define nsContentPermissionHelper_h
#include "nsIContentPermissionPrompt.h"
#include "nsTArray.h"
#include "nsIMutableArray.h"
#include "nsString.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
class nsContentPermissionRequestProxy;
// Forward declare IPC::Principal here which is defined in
// PermissionMessageUtils.h. Include this file will transitively includes
// "windows.h" and it defines
// #define CreateEvent CreateEventW
// #define LoadImage LoadImageW
// That will mess up windows build.
namespace IPC {
class Principal;
}
namespace mozilla {
namespace dom {
class Element;
class PermissionRequest;
class ContentPermissionRequestParent;
class PContentPermissionRequestParent;
class ContentPermissionType : public nsIContentPermissionType
class ContentPermissionRequestParent : public PContentPermissionRequestParent
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONTYPE
public:
ContentPermissionRequestParent(const nsACString& type,
const nsACString& access,
Element* element,
const IPC::Principal& principal);
virtual ~ContentPermissionRequestParent();
ContentPermissionType(const nsACString& aType, const nsACString& aAccess);
virtual ~ContentPermissionType();
bool IsBeingDestroyed();
protected:
nsCOMPtr<nsIPrincipal> mPrincipal;
nsCOMPtr<Element> mElement;
nsCOMPtr<nsContentPermissionRequestProxy> mProxy;
nsCString mType;
nsCString mAccess;
private:
virtual bool Recvprompt();
virtual void ActorDestroy(ActorDestroyReason why);
};
uint32_t ConvertPermissionRequestToArray(nsTArray<PermissionRequest>& aSrcArray,
nsIMutableArray* aDesArray);
nsresult CreatePermissionArray(const nsACString& aType,
const nsACString& aAccess,
nsIArray** aTypesArray);
PContentPermissionRequestParent*
CreateContentPermissionRequestParent(const nsTArray<PermissionRequest>& aRequests,
Element* element,
const IPC::Principal& principal);
} // namespace dom
} // namespace mozilla
class nsContentPermissionRequestProxy : public nsIContentPermissionRequest
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
nsContentPermissionRequestProxy();
virtual ~nsContentPermissionRequestProxy();
nsresult Init(const nsTArray<mozilla::dom::PermissionRequest>& requests,
mozilla::dom::ContentPermissionRequestParent* parent);
nsresult Init(const nsACString& type, const nsACString& access, mozilla::dom::ContentPermissionRequestParent* parent);
void OnParentDestroyed();
NS_DECL_ISUPPORTS
NS_DECL_NSICONTENTPERMISSIONREQUEST
private:
// Non-owning pointer to the ContentPermissionRequestParent object which owns this proxy.
mozilla::dom::ContentPermissionRequestParent* mParent;
nsTArray<mozilla::dom::PermissionRequest> mPermissionRequests;
nsCString mType;
nsCString mAccess;
};
#endif // nsContentPermissionHelper_h

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

@ -1687,7 +1687,7 @@ ReportAndDump(JSContext *cx, unsigned argc, JS::Value *vp)
dmd::ClearReports();
fprintf(stderr, "DMD: running reporters...\n");
dmd::RunReporters();
dmd::RunReportersForThisProcess();
dmd::Writer writer(FpWrite, fp);
dmd::Dump(writer);
@ -2831,6 +2831,32 @@ NS_DOMStructuredCloneError(JSContext* cx,
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
}
static bool
AsmJSCacheOpenEntryForRead(JS::Handle<JSObject*> aGlobal,
const jschar* aBegin,
const jschar* aLimit,
size_t* aSize,
const uint8_t** aMemory,
intptr_t *aHandle)
{
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(aGlobal);
return asmjscache::OpenEntryForRead(principal, aBegin, aLimit, aSize, aMemory,
aHandle);
}
static bool
AsmJSCacheOpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
const jschar* aBegin,
const jschar* aEnd,
size_t aSize,
uint8_t** aMemory,
intptr_t* aHandle)
{
nsIPrincipal* principal = nsContentUtils::GetObjectPrincipal(aGlobal);
return asmjscache::OpenEntryForWrite(principal, aBegin, aEnd, aSize, aMemory,
aHandle);
}
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
void
@ -2879,9 +2905,9 @@ nsJSContext::EnsureStatics()
// Set up the asm.js cache callbacks
static JS::AsmJSCacheOps asmJSCacheOps = {
asmjscache::OpenEntryForRead,
AsmJSCacheOpenEntryForRead,
asmjscache::CloseEntryForRead,
asmjscache::OpenEntryForWrite,
AsmJSCacheOpenEntryForWrite,
asmjscache::CloseEntryForWrite,
asmjscache::GetBuildId
};

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

@ -166,7 +166,7 @@ AppendWindowURI(nsGlobalWindow *aWindow, nsACString& aStr)
}
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WindowsMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(WindowsMallocSizeOf)
// The key is the window ID.
typedef nsDataHashtable<nsUint64HashKey, nsCString> WindowPaths;

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

@ -7652,8 +7652,13 @@ class CGProxySpecialOperation(CGPerSignatureCall):
"""
Base class for classes for calling an indexed or named special operation
(don't use this directly, use the derived classes below).
If checkFound is False, will just assert that the prop is found instead of
checking that it is before wrapping the value.
"""
def __init__(self, descriptor, operation):
def __init__(self, descriptor, operation, checkFound=True):
self.checkFound = checkFound;
nativeName = MakeNativeName(descriptor.binaryNames.get(operation, operation))
operation = descriptor.operations[operation]
assert len(operation.signatures()) == 1
@ -7699,15 +7704,26 @@ class CGProxySpecialOperation(CGPerSignatureCall):
return ""
wrap = CGGeneric(wrapForType(self.returnType, self.descriptor, self.templateValues))
wrap = CGIfWrapper(wrap, "found")
if self.checkFound:
wrap = CGIfWrapper(wrap, "found")
else:
wrap = CGList([CGGeneric("MOZ_ASSERT(found);"), wrap], "\n")
return "\n" + wrap.define()
class CGProxyIndexedOperation(CGProxySpecialOperation):
"""
Class to generate a call to an indexed operation.
If doUnwrap is False, the caller is responsible for making sure a variable
named 'self' holds the C++ object somewhere where the code we generate
will see it.
If checkFound is False, will just assert that the prop is found instead of
checking that it is before wrapping the value.
"""
def __init__(self, descriptor, name):
CGProxySpecialOperation.__init__(self, descriptor, name)
def __init__(self, descriptor, name, doUnwrap=True, checkFound=True):
self.doUnwrap = doUnwrap
CGProxySpecialOperation.__init__(self, descriptor, name, checkFound)
def define(self):
# Our first argument is the id we're getting.
argName = self.arguments[0].identifier.name
@ -7716,18 +7732,30 @@ class CGProxyIndexedOperation(CGProxySpecialOperation):
setIndex = ""
else:
setIndex = "uint32_t %s = index;\n" % argName
return (setIndex +
"%s* self = UnwrapProxy(proxy);\n" +
if self.doUnwrap:
unwrap = "%s* self = UnwrapProxy(proxy);\n"
else:
unwrap = ""
return (setIndex + unwrap +
CGProxySpecialOperation.define(self))
class CGProxyIndexedGetter(CGProxyIndexedOperation):
"""
Class to generate a call to an indexed getter. If templateValues is not None
the returned value will be wrapped with wrapForType using templateValues.
If doUnwrap is False, the caller is responsible for making sure a variable
named 'self' holds the C++ object somewhere where the code we generate
will see it.
If checkFound is False, will just assert that the prop is found instead of
checking that it is before wrapping the value.
"""
def __init__(self, descriptor, templateValues=None):
def __init__(self, descriptor, templateValues=None, doUnwrap=True,
checkFound=True):
self.templateValues = templateValues
CGProxyIndexedOperation.__init__(self, descriptor, 'IndexedGetter')
CGProxyIndexedOperation.__init__(self, descriptor, 'IndexedGetter',
doUnwrap, checkFound)
class CGProxyIndexedPresenceChecker(CGProxyIndexedGetter):
"""
@ -8364,65 +8392,55 @@ class CGDOMJSProxyHandler_finalize(ClassMethod):
return ("%s self = UnwrapProxy(proxy);\n\n" % (self.descriptor.nativeType + "*") +
finalizeHook(self.descriptor, FINALIZE_HOOK_NAME, self.args[0].name).define())
class CGDOMJSProxyHandler_getElementIfPresent(ClassMethod):
class CGDOMJSProxyHandler_slice(ClassMethod):
def __init__(self, descriptor):
assert descriptor.supportsIndexedProperties()
args = [Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'proxy'),
Argument('JS::Handle<JSObject*>', 'receiver'),
Argument('uint32_t', 'index'),
Argument('JS::MutableHandle<JS::Value>', 'vp'),
Argument('bool*', 'present')]
ClassMethod.__init__(self, "getElementIfPresent", "bool", args)
Argument('uint32_t', 'begin'),
Argument('uint32_t', 'end'),
Argument('JS::Handle<JSObject*>', 'array')]
ClassMethod.__init__(self, "slice", "bool", args)
self.descriptor = descriptor
def getBody(self):
successCode = ("*present = found;\n"
"return true;")
templateValues = {'jsvalRef': 'vp', 'jsvalHandle': 'vp',
# Just like getOwnPropertyNames we'll assume that we have no holes, so
# we have all properties from 0 to length. If that ever changes
# (unlikely), we'll need to do something a bit more clever with how we
# forward on to our ancestor.
header = CGGeneric(
'JS::Rooted<JS::Value> temp(cx);\n'
'MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),\n'
' "Should not have a XrayWrapper here");\n'
'\n'
'%s* self = UnwrapProxy(proxy);\n'
'uint32_t length = self->Length();\n'
"// Compute the end of the indices we'll get ourselves\n"
'uint32_t ourEnd = std::max(begin, std::min(end, length));' %
self.descriptor.nativeType)
successCode = ("js::UnsafeDefineElement(cx, array, index - begin, temp);\n"
"continue;")
templateValues = {'jsvalRef': 'temp', 'jsvalHandle': '&temp',
'obj': 'proxy', 'successCode': successCode}
if self.descriptor.supportsIndexedProperties():
get = (CGProxyIndexedGetter(self.descriptor, templateValues).define() + "\n"
"// We skip the expando object and any named getters if\n"
"// there is an indexed getter.\n" +
"\n") % (self.descriptor.nativeType)
else:
if self.descriptor.supportsNamedProperties():
get = CGProxyNamedGetter(self.descriptor, templateValues,
"UINT_TO_JSVAL(index)").define()
get += """
get = CGProxyIndexedGetter(self.descriptor, templateValues, False, False)
JS::Rooted<JSObject*> expando(cx, GetExpandoObject(proxy));
if (expando) {
bool isPresent;
if (!JS_GetElementIfPresent(cx, expando, index, expando, vp, &isPresent)) {
return false;
}
if (isPresent) {
*present = true;
return true;
}
}
"""
getOurElements = CGWrapper(
CGIndenter(get),
pre="for (uint32_t index = begin; index < ourEnd; ++index) {\n",
post="\n}")
return """MOZ_ASSERT(!xpc::WrapperFactory::IsXrayWrapper(proxy),
"Should not have a XrayWrapper here");
getProtoElements = CGIfWrapper(
CGGeneric("JS::Rooted<JSObject*> proto(cx);\n"
"if (!js::GetObjectProto(cx, proxy, &proto)) {\n"
" return false;\n"
"}\n"
"return js::SliceSlowly(cx, proto, proxy, ourEnd, end, array);"),
"end > ourEnd")
""" + get + """
JS::Rooted<JSObject*> proto(cx);
if (!js::GetObjectProto(cx, proxy, &proto)) {
return false;
}
if (proto) {
bool isPresent;
if (!JS_GetElementIfPresent(cx, proto, index, proxy, vp, &isPresent)) {
return false;
}
*present = isPresent;
return true;
}
*present = false;
// Can't Debug_SetValueRangeToCrashOnTouch because it's not public
return true;"""
return CGList([header, getOurElements, getProtoElements,
CGGeneric("return true;")], "\n\n").define();
class CGDOMJSProxyHandler_getInstance(ClassMethod):
def __init__(self):
@ -8446,9 +8464,11 @@ class CGDOMJSProxyHandler(CGClass):
CGDOMJSProxyHandler_className(descriptor),
CGDOMJSProxyHandler_finalizeInBackground(descriptor),
CGDOMJSProxyHandler_finalize(descriptor),
CGDOMJSProxyHandler_getElementIfPresent(descriptor),
CGDOMJSProxyHandler_getInstance(),
CGDOMJSProxyHandler_delete(descriptor)]
if descriptor.supportsIndexedProperties():
methods.append(CGDOMJSProxyHandler_slice(descriptor))
CGClass.__init__(self, 'DOMProxyHandler',
bases=[ClassBase('mozilla::dom::DOMProxyHandler')],
constructors=constructors,

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

@ -105,31 +105,6 @@ nsDOMCameraManager::CreateInstance(nsPIDOMWindow* aWindow)
return cameraManager.forget();
}
nsDOMCameraControl*
nsDOMCameraManager::GetCameraControl(uint32_t aDeviceNum,
nsICameraGetCameraCallback* onSuccess,
nsICameraErrorCallback* onError,
ErrorResult& aRv)
{
aRv = NS_OK;
// reuse the same camera thread to conserve resources
if (!mCameraThread) {
aRv = NS_NewThread(getter_AddRefs(mCameraThread));
if (aRv.Failed()) {
return nullptr;
}
}
// Creating this object will trigger the onSuccess handler
nsDOMCameraControl* cameraControl = new nsDOMCameraControl(aDeviceNum, mCameraThread,
onSuccess, onError, mWindow);
if (cameraControl) {
Register(cameraControl);
}
return cameraControl;
}
void
nsDOMCameraManager::GetCamera(const CameraSelector& aOptions,
nsICameraGetCameraCallback* onSuccess,
@ -141,10 +116,22 @@ nsDOMCameraManager::GetCamera(const CameraSelector& aOptions,
cameraId = 1;
}
// reuse the same camera thread to conserve resources
if (!mCameraThread) {
aRv = NS_NewThread(getter_AddRefs(mCameraThread));
if (aRv.Failed()) {
return;
}
}
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
// Creating this object will trigger the onSuccess handler
nsRefPtr<nsDOMCameraControl> cameraControl =
GetCameraControl(cameraId, onSuccess, onError.WasPassed() ? onError.Value() : nullptr, aRv);
new nsDOMCameraControl(cameraId, mCameraThread,
onSuccess, onError.WasPassed() ? onError.Value() : nullptr, mWindow);
Register(cameraControl);
}
void

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

@ -49,11 +49,6 @@ public:
CreateInstance(nsPIDOMWindow* aWindow);
static bool IsWindowStillActive(uint64_t aWindowId);
// Build us an nsDOMCameraControl
mozilla::nsDOMCameraControl* GetCameraControl(uint32_t aDeviceNum,
nsICameraGetCameraCallback* onSuccess,
nsICameraErrorCallback* onError,
mozilla::ErrorResult& aRv);
void Register(mozilla::nsDOMCameraControl* aDOMCameraControl);
void OnNavigation(uint64_t aWindowId);

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

@ -28,7 +28,7 @@
#define RE_LOGE(fmt, ...) DOM_CAMERA_LOGE("[%s:%d]" fmt,__FILE__,__LINE__, ## __VA_ARGS__)
#include <binder/IPCThreadState.h>
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
# include <media/openmax/OMX_Audio.h>
#endif
#include <media/stagefright/foundation/ADebug.h>
@ -683,7 +683,7 @@ status_t GonkRecorder::start() {
status = startAMRRecording();
break;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
case OUTPUT_FORMAT_AAC_ADIF:
case OUTPUT_FORMAT_AAC_ADTS:
status = startAACRecording();
@ -735,7 +735,7 @@ sp<MediaSource> GonkRecorder::createAudioSource() {
case AUDIO_ENCODER_AMR_WB:
mime = MEDIA_MIMETYPE_AUDIO_AMR_WB;
break;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
case AUDIO_ENCODER_AAC:
mime = MEDIA_MIMETYPE_AUDIO_AAC;
encMeta->setInt32(kKeyAACProfile, OMX_AUDIO_AACObjectLC);
@ -780,7 +780,7 @@ sp<MediaSource> GonkRecorder::createAudioSource() {
return audioEncoder;
}
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
status_t GonkRecorder::startAACRecording() {
// FIXME:
// Add support for OUTPUT_FORMAT_AAC_ADIF
@ -871,7 +871,7 @@ status_t GonkRecorder::startMPEG2TSRecording() {
sp<MediaWriter> writer = new MPEG2TSWriter(mOutputFd);
if (mAudioSource != AUDIO_SOURCE_CNT) {
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
if (mAudioEncoder != AUDIO_ENCODER_AAC &&
mAudioEncoder != AUDIO_ENCODER_HE_AAC &&
mAudioEncoder != AUDIO_ENCODER_AAC_ELD) {
@ -1257,7 +1257,7 @@ status_t GonkRecorder::setupVideoEncoder(
uint32_t encoder_flags = 0;
if (mIsMetaDataStoredInVideoBuffers) {
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
#else
encoder_flags |= OMXCodec::kHardwareCodecsOnly;
@ -1293,7 +1293,7 @@ status_t GonkRecorder::setupAudioEncoder(const sp<MediaWriter>& writer) {
switch(mAudioEncoder) {
case AUDIO_ENCODER_AMR_NB:
case AUDIO_ENCODER_AMR_WB:
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
case AUDIO_ENCODER_AAC:
case AUDIO_ENCODER_HE_AAC:
case AUDIO_ENCODER_AAC_ELD:

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

@ -129,7 +129,7 @@ private:
sp<MetaData> *meta);
status_t startMPEG4Recording();
status_t startAMRRecording();
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
status_t startAACRecording();
#endif
status_t startRawAudioRecording();

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

@ -49,7 +49,6 @@
#include "nsIStringBundle.h"
#include "nsIDocument.h"
#include <algorithm>
#include "nsContentPermissionHelper.h"
#include "mozilla/dom/DeviceStorageBinding.h"
@ -1734,14 +1733,17 @@ nsDOMDeviceStorageCursor::GetStorageType(nsAString & aType)
}
NS_IMETHODIMP
nsDOMDeviceStorageCursor::GetTypes(nsIArray** aTypes)
nsDOMDeviceStorageCursor::GetType(nsACString & aType)
{
nsCString type;
nsresult rv =
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
NS_ENSURE_SUCCESS(rv, rv);
return DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
aType);
}
return CreatePermissionArray(type, NS_LITERAL_CSTRING("read"), aTypes);
NS_IMETHODIMP
nsDOMDeviceStorageCursor::GetAccess(nsACString & aAccess)
{
aAccess = NS_LITERAL_CSTRING("read");
return NS_OK;
}
NS_IMETHODIMP
@ -2249,10 +2251,8 @@ public:
if (NS_FAILED(rv)) {
return rv;
}
nsTArray<PermissionRequest> permArray;
permArray.AppendElement(PermissionRequest(type, access));
child->SendPContentPermissionRequestConstructor(
this, permArray, IPC::Principal(mPrincipal));
this, type, access, IPC::Principal(mPrincipal));
Sendprompt();
return NS_OK;
@ -2266,23 +2266,26 @@ public:
return NS_OK;
}
NS_IMETHODIMP GetTypes(nsIArray** aTypes)
NS_IMETHOD GetType(nsACString & aType)
{
nsCString type;
nsresult rv =
DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType, type);
nsresult rv
= DeviceStorageTypeChecker::GetPermissionForType(mFile->mStorageType,
aType);
if (NS_FAILED(rv)) {
return rv;
}
return NS_OK;
}
nsCString access;
rv = DeviceStorageTypeChecker::GetAccessForRequest(
DeviceStorageRequestType(mRequestType), access);
NS_IMETHOD GetAccess(nsACString & aAccess)
{
nsresult rv = DeviceStorageTypeChecker::GetAccessForRequest(
DeviceStorageRequestType(mRequestType), aAccess);
if (NS_FAILED(rv)) {
return rv;
}
return CreatePermissionArray(type, access, aTypes);
return NS_OK;
}
NS_IMETHOD GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
@ -3296,10 +3299,8 @@ nsDOMDeviceStorage::EnumerateInternal(const nsAString& aPath,
if (aRv.Failed()) {
return nullptr;
}
nsTArray<PermissionRequest> permArray;
permArray.AppendElement(PermissionRequest(type, NS_LITERAL_CSTRING("read")));
child->SendPContentPermissionRequestConstructor(r,
permArray,
child->SendPContentPermissionRequestConstructor(r, type,
NS_LITERAL_CSTRING("read"),
IPC::Principal(mPrincipal));
r->Sendprompt();

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

@ -396,7 +396,6 @@ let FormAssistant = {
range = getSelectionRange(this.focusedElement);
if (range[0] !== this.selectionStart ||
range[1] !== this.selectionEnd) {
this.sendKeyboardState(this.focusedElement);
this.updateSelection();
}
break;

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

@ -7,13 +7,15 @@
interface nsIPrincipal;
interface nsIDOMWindow;
interface nsIDOMElement;
interface nsIArray;
/**
* Interface provides the request type and its access.
* Interface allows access to a content to request
* permission to perform a privileged operation such as
* geolocation.
*/
[scriptable, builtinclass, uuid(384b6cc4-a66b-4bea-98e0-eb10562a9ba4)]
interface nsIContentPermissionType : nsISupports {
[scriptable, uuid(1de67000-2de8-11e2-81c1-0800200c9a66)]
interface nsIContentPermissionRequest : nsISupports {
/**
* The type of the permission request, such as
* "geolocation".
@ -25,22 +27,8 @@ interface nsIContentPermissionType : nsISupports {
* "read".
*/
readonly attribute ACString access;
};
/**
* Interface allows access to a content to request
* permission to perform a privileged operation such as
* geolocation.
*/
[scriptable, uuid(69a39d88-d1c4-4ba9-9b19-bafc7a1bb783)]
interface nsIContentPermissionRequest : nsISupports {
/**
* The array will include the request types. Elements of this array are
* nsIContentPermissionType object.
*/
readonly attribute nsIArray types;
/*
* The principal of the permission request.
*/
readonly attribute nsIPrincipal principal;

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

@ -497,19 +497,12 @@ ContentChild::RecvPMemoryReportRequestConstructor(
GetProcessName(process);
AppendProcessId(process);
// Run each reporter. The callback will turn each measurement into a
// Run the reporters. The callback will turn each measurement into a
// MemoryReport.
nsCOMPtr<nsISimpleEnumerator> e;
mgr->EnumerateReporters(getter_AddRefs(e));
nsRefPtr<MemoryReportsWrapper> wrappedReports =
new MemoryReportsWrapper(&reports);
nsRefPtr<MemoryReportCallback> cb = new MemoryReportCallback(process);
bool more;
while (NS_SUCCEEDED(e->HasMoreElements(&more)) && more) {
nsCOMPtr<nsIMemoryReporter> r;
e->GetNext(getter_AddRefs(r));
r->CollectReports(cb, wrappedReports);
}
mgr->GetReportsForThisProcess(cb, wrappedReports);
child->Send__delete__(child, generation, reports);
return true;

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

@ -193,15 +193,15 @@ MemoryReportRequestParent::~MemoryReportRequestParent()
}
// A memory reporter for ContentParent objects themselves.
class ContentParentsMemoryReporter MOZ_FINAL : public MemoryMultiReporter
class ContentParentsMemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
ContentParentsMemoryReporter() {}
NS_IMETHOD CollectReports(nsIMemoryReporterCallback* cb,
nsISupports* aClosure);
NS_DECL_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
};
NS_IMPL_ISUPPORTS1(ContentParentsMemoryReporter, nsIMemoryReporter)
NS_IMETHODIMP
ContentParentsMemoryReporter::CollectReports(nsIMemoryReporterCallback* cb,
nsISupports* aClosure)

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

@ -16,7 +16,6 @@ include protocol PIndexedDB;
include DOMTypes;
include JavaScriptTypes;
include URIParams;
include PContentPermission;
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
@ -207,8 +206,10 @@ parent:
* Initiates an asynchronous request for permission for the
* provided principal.
*
* @param aRequests
* The array of permissions to request.
* @param aType
* The type of permission to request.
* @param aAccess
* Access type. "read" for example.
* @param aPrincipal
* The principal of the request.
*
@ -216,7 +217,7 @@ parent:
* principals that can live in the content process should
* provided.
*/
PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal);
PContentPermissionRequest(nsCString aType, nsCString aAccess, Principal principal);
PContentDialog(uint32_t aType, nsCString aName, nsCString aFeatures,
int32_t[] aIntParams, nsString[] aStringParams);
@ -345,6 +346,13 @@ child:
*/
HandleLongTap(CSSIntPoint point);
/**
* Notifies the child that the parent has begun or finished transforming
* the visible child content area. Useful for showing/hiding scrollbars.
*/
NotifyTransformBegin(ViewID aViewId);
NotifyTransformEnd(ViewID aViewId);
/**
* Sending an activate message moves focus to the child.
*/

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

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
namespace mozilla {
namespace dom {
struct PermissionRequest {
nsCString type;
nsCString access;
};
} // namespace dom
} // namespace mozilla

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

@ -1157,11 +1157,12 @@ TabChild::ArraysToParams(const InfallibleTArray<int>& aIntParams,
#ifdef DEBUG
PContentPermissionRequestChild*
TabChild:: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
const InfallibleTArray<PermissionRequest>& aRequests,
const nsCString& aType,
const nsCString& aAccess,
const IPC::Principal& aPrincipal)
{
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aRequests, aPrincipal);
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
child->mIPCOpen = true;
return request;
}
@ -1659,6 +1660,32 @@ TabChild::RecvHandleLongTap(const CSSIntPoint& aPoint)
return true;
}
bool
TabChild::RecvNotifyTransformBegin(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStarted();
}
}
return true;
}
bool
TabChild::RecvNotifyTransformEnd(const ViewID& aViewId)
{
nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(aViewId);
if (sf) {
nsIScrollbarOwner* scrollbarOwner = do_QueryFrame(sf);
if (scrollbarOwner) {
scrollbarOwner->ScrollbarActivityStopped();
}
}
return true;
}
bool
TabChild::RecvActivate()
{
@ -2013,8 +2040,7 @@ TabChild::DeallocPContentDialogChild(PContentDialogChild* aDialog)
}
PContentPermissionRequestChild*
TabChild::AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
const IPC::Principal& aPrincipal)
TabChild::AllocPContentPermissionRequestChild(const nsCString& aType, const nsCString& aAccess, const IPC::Principal&)
{
NS_RUNTIMEABORT("unused");
return nullptr;

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

@ -217,6 +217,8 @@ public:
virtual bool RecvHandleDoubleTap(const CSSIntPoint& aPoint);
virtual bool RecvHandleSingleTap(const CSSIntPoint& aPoint);
virtual bool RecvHandleLongTap(const CSSIntPoint& aPoint);
virtual bool RecvNotifyTransformBegin(const ViewID& aViewId);
virtual bool RecvNotifyTransformEnd(const ViewID& aViewId);
virtual bool RecvActivate();
virtual bool RecvDeactivate();
virtual bool RecvMouseEvent(const nsString& aType,
@ -278,11 +280,13 @@ public:
#ifdef DEBUG
virtual PContentPermissionRequestChild*
SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
const InfallibleTArray<PermissionRequest>& aRequests,
const nsCString& aType,
const nsCString& aAccess,
const IPC::Principal& aPrincipal);
#endif /* DEBUG */
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
virtual PContentPermissionRequestChild* AllocPContentPermissionRequestChild(const nsCString& aType,
const nsCString& aAccess,
const IPC::Principal& aPrincipal);
virtual bool DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor);

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

@ -15,7 +15,6 @@
#include "mozilla/BrowserElementParent.h"
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/Hal.h"
#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/layers/CompositorParent.h"
@ -522,6 +521,20 @@ void TabParent::HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers)
}
}
void TabParent::NotifyTransformBegin(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformBegin(aViewId);
}
}
void TabParent::NotifyTransformEnd(ViewID aViewId)
{
if (!mIsDestroyed) {
unused << SendNotifyTransformEnd(aViewId);
}
}
void
TabParent::Activate()
{
@ -580,10 +593,9 @@ TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor)
}
PContentPermissionRequestParent*
TabParent::AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
const IPC::Principal& aPrincipal)
TabParent::AllocPContentPermissionRequestParent(const nsCString& type, const nsCString& access, const IPC::Principal& principal)
{
return CreateContentPermissionRequestParent(aRequests, mFrameElement, aPrincipal);
return new ContentPermissionRequestParent(type, access, mFrameElement, principal);
}
bool

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

@ -196,6 +196,8 @@ public:
void HandleDoubleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void HandleSingleTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void HandleLongTap(const CSSIntPoint& aPoint, int32_t aModifiers);
void NotifyTransformBegin(ViewID aViewId);
void NotifyTransformEnd(ViewID aViewId);
void Activate();
void Deactivate();
@ -225,8 +227,7 @@ public:
virtual bool DeallocPDocumentRendererParent(PDocumentRendererParent* actor);
virtual PContentPermissionRequestParent*
AllocPContentPermissionRequestParent(const InfallibleTArray<PermissionRequest>& aRequests,
const IPC::Principal& aPrincipal);
AllocPContentPermissionRequestParent(const nsCString& aType, const nsCString& aAccess, const IPC::Principal& aPrincipal);
virtual bool DeallocPContentPermissionRequestParent(PContentPermissionRequestParent* actor);
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdateParent(

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

@ -68,7 +68,6 @@ IPDL_SOURCES += [
'PBrowser.ipdl',
'PContent.ipdl',
'PContentDialog.ipdl',
'PContentPermission.ipdlh',
'PContentPermissionRequest.ipdl',
'PCrashReporter.ipdl',
'PDocumentRenderer.ipdl',

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

@ -41,7 +41,7 @@
#include "MediaEngineWebRTC.h"
#endif
#ifdef MOZ_B2G
#ifdef MOZ_WIDGET_GONK
#include "MediaPermissionGonk.h"
#endif
@ -756,7 +756,7 @@ public:
, mListener(aListener)
, mPrefs(aPrefs)
, mDeviceChosen(false)
, mBackend(nullptr)
, mBackendChosen(false)
, mManager(MediaManager::GetInstance())
{}
@ -778,11 +778,15 @@ public:
, mListener(aListener)
, mPrefs(aPrefs)
, mDeviceChosen(false)
, mBackendChosen(true)
, mBackend(aBackend)
, mManager(MediaManager::GetInstance())
{}
~GetUserMediaRunnable() {
if (mBackendChosen) {
delete mBackend;
}
}
NS_IMETHOD
@ -790,15 +794,14 @@ public:
{
NS_ASSERTION(!NS_IsMainThread(), "Don't call on main thread");
MediaEngine* backend = mBackend;
// Was a backend provided?
if (!backend) {
backend = mManager->GetBackend(mWindowID);
if (!mBackendChosen) {
mBackend = mManager->GetBackend(mWindowID);
}
// Was a device provided?
if (!mDeviceChosen) {
nsresult rv = SelectDevice(backend);
nsresult rv = SelectDevice();
if (rv != NS_OK) {
return rv;
}
@ -870,10 +873,10 @@ public:
}
nsresult
SelectDevice(MediaEngine* backend)
SelectDevice()
{
if (mConstraints.mPicture || mConstraints.mVideo) {
ScopedDeletePtr<SourceSet> sources (GetSources(backend,
ScopedDeletePtr<SourceSet> sources (GetSources(mBackend,
mConstraints.mVideom, &MediaEngine::EnumerateVideoDevices));
if (!sources->Length()) {
@ -887,7 +890,7 @@ public:
}
if (mConstraints.mAudio) {
ScopedDeletePtr<SourceSet> sources (GetSources(backend,
ScopedDeletePtr<SourceSet> sources (GetSources(mBackend,
mConstraints.mAudiom, &MediaEngine::EnumerateAudioDevices));
if (!sources->Length()) {
@ -981,8 +984,9 @@ private:
MediaEnginePrefs mPrefs;
bool mDeviceChosen;
bool mBackendChosen;
RefPtr<MediaEngine> mBackend;
MediaEngine* mBackend;
nsRefPtr<MediaManager> mManager; // get ref to this when creating the runnable
};
@ -1262,10 +1266,10 @@ MediaManager::GetUserMedia(JSContext* aCx, bool aPrivileged,
// Force MediaManager to startup before we try to access it from other threads
// Hack: should init singleton earlier unless it's expensive (mem or CPU)
(void) MediaManager::Get();
#ifdef MOZ_B2G
#ifdef MOZ_WIDGET_GONK
// Initialize MediaPermissionManager before send out any permission request.
(void) MediaPermissionManager::GetInstance();
#endif //MOZ_B2G
#endif //MOZ_WIDGET_GONK
}
// Store the WindowID in a hash table and mark as active. The entry is removed
@ -1411,11 +1415,11 @@ MediaManager::GetBackend(uint64_t aWindowId)
MutexAutoLock lock(mMutex);
if (!mBackend) {
#if defined(MOZ_WEBRTC)
#ifndef MOZ_B2G_CAMERA
#ifndef MOZ_B2G_CAMERA
mBackend = new MediaEngineWebRTC(mPrefs);
#else
mBackend = new MediaEngineWebRTC(mCameraManager);
#endif
#else
mBackend = new MediaEngineWebRTC(mCameraManager, aWindowId);
#endif
#else
mBackend = new MediaEngineDefault();
#endif

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

@ -513,7 +513,9 @@ private:
// Make private because we want only one instance of this class
MediaManager();
~MediaManager() {}
~MediaManager() {
delete mBackend;
}
nsresult MediaCaptureWindowStateInternal(nsIDOMWindow* aWindow, bool* aVideo,
bool* aAudio);
@ -528,11 +530,11 @@ private:
Mutex mMutex;
// protected with mMutex:
RefPtr<MediaEngine> mBackend;
MediaEngine* mBackend;
static StaticRefPtr<MediaManager> sSingleton;
#ifdef MOZ_B2G_CAMERA
#ifdef MOZ_WIDGET_GONK
nsRefPtr<nsDOMCameraManager> mCameraManager;
#endif
};

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

@ -20,36 +20,14 @@
#include "mozilla/dom/MediaStreamTrackBinding.h"
#include "nsISupportsPrimitives.h"
#include "nsServiceManagerUtils.h"
#include "nsArrayUtils.h"
#include "nsContentPermissionHelper.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#define AUDIO_PERMISSION_NAME "audio-capture"
#define VIDEO_PERMISSION_NAME "video-capture"
using namespace mozilla::dom;
namespace mozilla {
static MediaPermissionManager *gMediaPermMgr = nullptr;
static uint32_t
ConvertArrayToPermissionRequest(nsIArray* aSrcArray,
nsTArray<PermissionRequest>& aDesArray)
{
uint32_t len = 0;
aSrcArray->GetLength(&len);
for (uint32_t i = 0; i < len; i++) {
nsCOMPtr<nsIContentPermissionType> cpt = do_QueryElementAt(aSrcArray, i);
nsAutoCString type;
nsAutoCString access;
cpt->GetType(type);
cpt->GetAccess(access);
aDesArray.AppendElement(PermissionRequest(type, access));
}
return len;
}
// Helper function for notifying permission granted
static nsresult
NotifyPermissionAllow(const nsAString &aCallID, nsTArray<nsCOMPtr<nsIMediaDevice> > &aDevices)
@ -115,7 +93,6 @@ public:
private:
bool mAudio; // Request for audio permission
bool mVideo; // Request for video permission
nsRefPtr<dom::GetUserMediaRequest> mRequest;
nsTArray<nsCOMPtr<nsIMediaDevice> > mDevices; // candiate device list
};
@ -131,7 +108,6 @@ MediaPermissionRequest::MediaPermissionRequest(nsRefPtr<dom::GetUserMediaRequest
mRequest->GetConstraints(constraints);
mAudio = constraints.mAudio;
mVideo = constraints.mVideo;
for (uint32_t i = 0; i < aDevices.Length(); ++i) {
nsCOMPtr<nsIMediaDevice> device(aDevices[i]);
@ -140,34 +116,10 @@ MediaPermissionRequest::MediaPermissionRequest(nsRefPtr<dom::GetUserMediaRequest
if (mAudio && deviceType.EqualsLiteral("audio")) {
mDevices.AppendElement(device);
}
if (mVideo && deviceType.EqualsLiteral("video")) {
mDevices.AppendElement(device);
}
}
}
// nsIContentPermissionRequest methods
NS_IMETHODIMP
MediaPermissionRequest::GetTypes(nsIArray** aTypes)
{
nsCOMPtr<nsIMutableArray> types = do_CreateInstance(NS_ARRAY_CONTRACTID);
if (mAudio) {
nsCOMPtr<ContentPermissionType> AudioType =
new ContentPermissionType(NS_LITERAL_CSTRING(AUDIO_PERMISSION_NAME),
NS_LITERAL_CSTRING("unused"));
types->AppendElement(AudioType, false);
}
if (mVideo) {
nsCOMPtr<ContentPermissionType> VideoType =
new ContentPermissionType(NS_LITERAL_CSTRING(VIDEO_PERMISSION_NAME),
NS_LITERAL_CSTRING("unused"));
types->AppendElement(VideoType, false);
}
NS_IF_ADDREF(*aTypes = types);
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetPrincipal(nsIPrincipal **aRequestingPrincipal)
{
@ -183,6 +135,24 @@ MediaPermissionRequest::GetPrincipal(nsIPrincipal **aRequestingPrincipal)
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetType(nsACString &aType)
{
if (mAudio) {
aType = AUDIO_PERMISSION_NAME;
return NS_OK;
}
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetAccess(nsACString &aAccess)
{
aAccess = "unused";
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetWindow(nsIDOMWindow** aRequestingWindow)
{
@ -308,12 +278,13 @@ MediaDeviceSuccessCallback::DoPrompt(nsRefPtr<MediaPermissionRequest> &req)
dom::TabChild* child = dom::TabChild::GetFrom(window->GetDocShell());
NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);
nsCOMPtr<nsIArray> typeArray;
rv = req->GetTypes(getter_AddRefs(typeArray));
nsAutoCString type;
rv = req->GetType(type);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<PermissionRequest> permArray;
ConvertArrayToPermissionRequest(typeArray, permArray);
nsAutoCString access;
rv = req->GetAccess(access);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrincipal> principal;
rv = req->GetPrincipal(getter_AddRefs(principal));
@ -321,7 +292,8 @@ MediaDeviceSuccessCallback::DoPrompt(nsRefPtr<MediaPermissionRequest> &req)
req->AddRef();
child->SendPContentPermissionRequestConstructor(req,
permArray,
type,
access,
IPC::Principal(principal));
req->Sendprompt();

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

@ -110,7 +110,6 @@ this.SystemMessagePermissionsTable = {
"nfc-powerlevel-change": {
"settings": ["read", "write"]
},
"rtsp-open-video": {},
};
this.SystemMessagePermissionsChecker = {

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

@ -256,11 +256,13 @@ MmsConnection.prototype = {
let networkManager =
Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
let activeNetwork = networkManager.active;
if (activeNetwork.serviceId != this.serviceId) {
let rilNetwork = activeNetwork.QueryInterface(Ci.nsIRilNetworkInterface);
if (rilNetwork.serviceId != this.serviceId) {
if (DEBUG) debug("Sevice ID between active/MMS network doesn't match.");
return;
}
let rilNetwork = activeNetwork.QueryInterface(Ci.nsIRilNetworkInterface);
// Set up the MMS APN setting based on the connected MMS network,
// which is going to be used for the HTTP requests later.
this.setApnSetting(rilNetwork);

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

@ -169,7 +169,11 @@ function expandPermissions(aPerms) {
aPerms.forEach(function(el) {
var access = permTable[el].access ? "readwrite" : null;
var expanded = SpecialPowers.unwrap(expand(el, access));
perms = perms.concat(expanded.slice(0));
// COW arrays don't behave array-like enough, to allow
// using expanded.slice(0) here.
for (let i = 0; i < expanded.length; i++) {
perms.push(expanded[i]);
}
});
return perms;

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

@ -386,11 +386,17 @@ nsGeolocationRequest::GetPrincipal(nsIPrincipal * *aRequestingPrincipal)
}
NS_IMETHODIMP
nsGeolocationRequest::GetTypes(nsIArray** aTypes)
nsGeolocationRequest::GetType(nsACString & aType)
{
return CreatePermissionArray(NS_LITERAL_CSTRING("geolocation"),
NS_LITERAL_CSTRING("unused"),
aTypes);
aType = "geolocation";
return NS_OK;
}
NS_IMETHODIMP
nsGeolocationRequest::GetAccess(nsACString & aAccess)
{
aAccess = "unused";
return NS_OK;
}
NS_IMETHODIMP
@ -1447,15 +1453,12 @@ Geolocation::RegisterRequestWithPrompt(nsGeolocationRequest* request)
return false;
}
nsTArray<PermissionRequest> permArray;
permArray.AppendElement(PermissionRequest(NS_LITERAL_CSTRING("geolocation"),
NS_LITERAL_CSTRING("unused")));
// Retain a reference so the object isn't deleted without IPDL's knowledge.
// Corresponding release occurs in DeallocPContentPermissionRequest.
request->AddRef();
child->SendPContentPermissionRequestConstructor(request,
permArray,
NS_LITERAL_CSTRING("geolocation"),
NS_LITERAL_CSTRING("unused"),
IPC::Principal(mPrincipal));
request->Sendprompt();

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

@ -15,7 +15,6 @@
#include "PCOMContentPermissionRequestChild.h"
#include "nsIScriptSecurityManager.h"
#include "nsServiceManagerUtils.h"
#include "PermissionMessageUtils.h"
namespace mozilla {
namespace dom {
@ -180,12 +179,9 @@ DesktopNotification::Init()
// Corresponding release occurs in DeallocPContentPermissionRequest.
nsRefPtr<DesktopNotificationRequest> copy = request;
nsTArray<PermissionRequest> permArray;
permArray.AppendElement(PermissionRequest(
NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused")));
child->SendPContentPermissionRequestConstructor(copy.forget().get(),
permArray,
NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused"),
IPC::Principal(mPrincipal));
request->Sendprompt();
@ -357,11 +353,17 @@ DesktopNotificationRequest::Allow()
}
NS_IMETHODIMP
DesktopNotificationRequest::GetTypes(nsIArray** aTypes)
DesktopNotificationRequest::GetType(nsACString & aType)
{
return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused"),
aTypes);
aType = "desktop-notification";
return NS_OK;
}
NS_IMETHODIMP
DesktopNotificationRequest::GetAccess(nsACString & aAccess)
{
aAccess = "unused";
return NS_OK;
}
} // namespace dom

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

@ -24,7 +24,6 @@
#include "nsDOMJSUtils.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "nsContentPermissionHelper.h"
#ifdef MOZ_B2G
#include "nsIDOMDesktopNotification.h"
#endif
@ -268,11 +267,9 @@ NotificationPermissionRequest::Run()
// Corresponding release occurs in DeallocPContentPermissionRequest.
AddRef();
nsTArray<PermissionRequest> permArray;
permArray.AppendElement(PermissionRequest(
NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused")));
child->SendPContentPermissionRequestConstructor(this, permArray,
NS_NAMED_LITERAL_CSTRING(type, "desktop-notification");
NS_NAMED_LITERAL_CSTRING(access, "unused");
child->SendPContentPermissionRequestConstructor(this, type, access,
IPC::Principal(mPrincipal));
Sendprompt();
@ -345,11 +342,17 @@ NotificationPermissionRequest::CallCallback()
}
NS_IMETHODIMP
NotificationPermissionRequest::GetTypes(nsIArray** aTypes)
NotificationPermissionRequest::GetAccess(nsACString& aAccess)
{
return CreatePermissionArray(NS_LITERAL_CSTRING("desktop-notification"),
NS_LITERAL_CSTRING("unused"),
aTypes);
aAccess.AssignLiteral("unused");
return NS_OK;
}
NS_IMETHODIMP
NotificationPermissionRequest::GetType(nsACString& aType)
{
aType.AssignLiteral("desktop-notification");
return NS_OK;
}
bool

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

@ -2761,9 +2761,10 @@ this.PDU_CDMA_MSG_TYPE_BROADCAST = 0x01; // Broadcast
this.PDU_CDMA_MSG_TYPE_ACK = 0x02; // Acknowledge
// SMS Teleservice Identitifier, as defined in 3GPP2 N.S0005, Table 175
this.PDU_CDMA_MSG_TELESERIVCIE_ID_SMS = 0x1002; // SMS
this.PDU_CDMA_MSG_TELESERIVCIE_ID_WEMT = 0x1005; // Wireless Enhanced Messaging Teleservice
// required for fragmented SMS
this.PDU_CDMA_MSG_TELESERIVCIE_ID_SMS = 0x1002; // SMS
this.PDU_CDMA_MSG_TELESERIVCIE_ID_WAP = 0x1004; // WAP
this.PDU_CDMA_MSG_TELESERIVCIE_ID_WEMT = 0x1005; // Wireless Enhanced Messaging Teleservice
// required for fragmented SMS
// SMS Service Category, as defined in 3GPP2 C.R1001-D, Table 9.3.1-1
this.PDU_CDMA_MSG_CATEGORY_UNSPEC = 0x00; // Unknown/Unspecified

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

@ -4312,6 +4312,61 @@ let RIL = {
return PDU_FCS_OK;
},
/**
* Helper for processing CDMA SMS WAP Push Message
*
* @param message
* decoded WAP message from CdmaPDUHelper.
*
* @return A failure cause defined in 3GPP 23.040 clause 9.2.3.22.
*/
_processCdmaSmsWapPush: function _processCdmaSmsWapPush(message) {
if (!message.data) {
if (DEBUG) debug("no data inside WAP Push message.");
return PDU_FCS_OK;
}
// See 6.5. MAPPING OF WDP TO CDMA SMS in WAP-295-WDP.
//
// Field | Length (bits)
// -----------------------------------------
// MSG_TYPE | 8
// TOTAL_SEGMENTS | 8
// SEGMENT_NUMBER | 8
// DATAGRAM | (NUM_FIELDS – 3) * 8
let index = 0;
if (message.data[index++] !== 0) {
if (DEBUG) debug("Ignore a WAP Message which is not WDP.");
return PDU_FCS_OK;
}
// 1. Originator Address in SMS-TL + Message_Id in SMS-TS are used to identify a unique WDP datagram.
// 2. TOTAL_SEGMENTS, SEGMENT_NUMBER are used to verify that a complete
// datagram has been received and is ready to be passed to a higher layer.
message.header = {
segmentRef: message.msgId,
segmentMaxSeq: message.data[index++],
segmentSeq: message.data[index++] + 1 // It's zero-based in CDMA WAP Push.
};
if (message.header.segmentSeq > message.header.segmentMaxSeq) {
if (DEBUG) debug("Wrong WDP segment info.");
return PDU_FCS_OK;
}
// Ports are only specified in 1st segment.
if (message.header.segmentSeq == 1) {
message.header.originatorPort = message.data[index++] << 8;
message.header.originatorPort |= message.data[index++];
message.header.destinationPort = message.data[index++] << 8;
message.header.destinationPort |= message.data[index++];
}
message.data = message.data.subarray(index);
return this._processSmsMultipart(message);
},
/**
* Helper for processing received multipart SMS.
*
@ -4347,6 +4402,22 @@ let RIL = {
delete original.body;
}
options.receivedSegments++;
// The port information is only available in 1st segment for CDMA WAP Push.
// If the segments of a WAP Push are not received in sequence
// (e.g., SMS with seq == 1 is not the 1st segment received by the device),
// we have to retrieve the port information from 1st segment and
// save it into the cached options.header.
if (original.teleservice === PDU_CDMA_MSG_TELESERIVCIE_ID_WAP && seq === 1) {
if (!options.header.originatorPort && original.header.originatorPort) {
options.header.originatorPort = original.header.originatorPort;
}
if (!options.header.destinationPort && original.header.destinationPort) {
options.header.destinationPort = original.header.destinationPort;
}
}
if (options.receivedSegments < options.segmentMaxSeq) {
if (DEBUG) {
debug("Got segment no." + seq + " of a multipart SMS: "
@ -6215,7 +6286,9 @@ RIL[UNSOLICITED_RESPONSE_CDMA_NEW_SMS] = function UNSOLICITED_RESPONSE_CDMA_NEW_
let [message, result] = CdmaPDUHelper.processReceivedSms(length);
if (message) {
if (message.subMsgType === PDU_CDMA_MSG_TYPE_DELIVER_ACK) {
if (message.teleservice === PDU_CDMA_MSG_TELESERIVCIE_ID_WAP) {
result = this._processCdmaSmsWapPush(message);
} else if (message.subMsgType === PDU_CDMA_MSG_TYPE_DELIVER_ACK) {
result = this._processCdmaSmsStatusReport(message);
} else {
result = this._processSmsMultipart(message);
@ -7997,6 +8070,25 @@ let BitBufferHelper = {
return result;
},
backwardReadPilot: function backwardReadPilot(length) {
if (length <= 0) {
return;
}
// Zero-based position.
let bitIndexToRead = this.readIndex * 8 - this.readCacheSize - length;
if (bitIndexToRead < 0) {
return;
}
// Update readIndex, readCache, readCacheSize accordingly.
let readBits = bitIndexToRead % 8;
this.readIndex = Math.floor(bitIndexToRead / 8) + ((readBits) ? 1 : 0);
this.readCache = (readBits) ? this.readBuffer[this.readIndex - 1] : 0;
this.readCacheSize = (readBits) ? (8 - readBits) : 0;
},
writeBits: function writeBits(value, length) {
if (length <= 0 || length > 32) {
return;
@ -8463,17 +8555,17 @@ let CdmaPDUHelper = {
// Bearer Data Sub-Parameter: User Data
let userData = message[PDU_CDMA_MSG_USERDATA_BODY];
[message.header, message.body, message.encoding] =
(userData)? [userData.header, userData.body, userData.encoding]
: [null, null, null];
[message.header, message.body, message.encoding, message.data] =
(userData) ? [userData.header, userData.body, userData.encoding, userData.data]
: [null, null, null, null];
// Bearer Data Sub-Parameter: Message Status
// Success Delivery (0) if both Message Status and User Data are absent.
// Message Status absent (-1) if only User Data is available.
let msgStatus = message[PDU_CDMA_MSG_USER_DATA_MSG_STATUS];
[message.errorClass, message.msgStatus] =
(msgStatus)? [msgStatus.errorClass, msgStatus.msgStatus]
: ((message.body)? [-1, -1]: [0, 0]);
(msgStatus) ? [msgStatus.errorClass, msgStatus.msgStatus]
: ((message.body) ? [-1, -1] : [0, 0]);
// Transform message to GSM msg
let msg = {
@ -8489,7 +8581,7 @@ let CdmaPDUHelper = {
replace: false,
header: message.header,
body: message.body,
data: null,
data: message.data,
timestamp: message[PDU_CDMA_MSG_USERDATA_TIMESTAMP],
language: message[PDU_CDMA_LANGUAGE_INDICATOR],
status: null,
@ -8502,7 +8594,8 @@ let CdmaPDUHelper = {
subMsgType: message[PDU_CDMA_MSG_USERDATA_MSG_ID].msgType,
msgId: message[PDU_CDMA_MSG_USERDATA_MSG_ID].msgId,
errorClass: message.errorClass,
msgStatus: message.msgStatus
msgStatus: message.msgStatus,
teleservice: message.teleservice
};
return msg;
@ -8939,6 +9032,15 @@ let CdmaPDUHelper = {
msgBodySize -= result.header.length;
}
// Store original payload if enconding is OCTET for further handling of WAP Push, etc.
if (encoding === PDU_CDMA_MSG_CODING_OCTET && msgBodySize > 0) {
result.data = new Uint8Array(msgBodySize);
for (let i = 0; i < msgBodySize; i++) {
result.data[i] = BitBufferHelper.readBits(8);
}
BitBufferHelper.backwardReadPilot(8 * msgBodySize);
}
// Decode sms content
result.body = this.decodeCdmaPDUMsg(encoding, msgType, msgBodySize);

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

@ -26,6 +26,164 @@ function _getWorker() {
};
}
/*
* Helper function to covert a HEX string to a byte array.
*
* @param hexString
* A hexadecimal string of which the length is even.
*/
function hexStringToBytes(hexString) {
let bytes = [];
let length = hexString.length;
for (let i = 0; i < length; i += 2) {
bytes.push(Number.parseInt(hexString.substr(i, 2), 16));
}
return bytes;
}
/*
* Helper function to covert a byte array to a HEX string.
*
* @param bytes
* Could be a regular byte array or Uint8Array.
*/
function bytesToHexString(bytes) {
let hexString = "";
let hex;
for (let i = 0; i < bytes.length; i++) {
hex = bytes[i].toString(16).toUpperCase();
if (hex.length === 1) {
hexString += "0";
}
hexString += hex;
}
return hexString;
}
/*
* Helper function to ecode Opaque UserData
*
* @param msg_type
* PDU_CDMA_MSG_TYPE_SUBMIT or PDU_CDMA_MSG_TYPE_DELIVER
* @param data
* The byte array of opaque data to be encoded.
*/
function encodeOpaqueUserData(bitBufferHelper, options) {
let bearerDataBuffer = [];
bitBufferHelper.startWrite(bearerDataBuffer);
// Msg-Id
bitBufferHelper.writeBits(PDU_CDMA_MSG_USERDATA_MSG_ID, 8);
bitBufferHelper.writeBits(3, 8);
bitBufferHelper.writeBits(options.msg_type, 4); // MSG_TYPE
bitBufferHelper.writeBits(1, 16); // MSG_ID
bitBufferHelper.flushWithPadding(); // HEADER_IND (1) + RESERVED (3)
// User Data
bitBufferHelper.writeBits(PDU_CDMA_MSG_USERDATA_BODY, 8);
let dataLength = options.data.length;
bitBufferHelper.writeBits(2 + dataLength, 8); // 2 bytes for MSG_ENCODING, NUM_FIELDS
bitBufferHelper.writeBits(PDU_CDMA_MSG_CODING_OCTET, 5); //MSG_ENCODING
// MSG_TYPE is omitted if MSG_ENCODING is CODING_OCTET
bitBufferHelper.writeBits(dataLength, 8); // NUM_FIELDS
for (let i = 0; i < dataLength; i++) { // CHARi
bitBufferHelper.writeBits(options.data[i], 8);
}
bitBufferHelper.flushWithPadding(); // RESERVED (3 filling bits)
return bearerDataBuffer;
}
function newSmsParcel(cdmaPduHelper, pdu) {
return newIncomingParcel(-1,
RESPONSE_TYPE_UNSOLICITED,
UNSOLICITED_RESPONSE_CDMA_NEW_SMS,
pduToParcelData(cdmaPduHelper, pdu));
}
/*
* Helper function to encode PDU into Parcel.
* See ril_cdma_sms.h for the structure definition of RIL_CDMA_SMS_Message
*
* @param teleservice
* The Teleservice-Id of this PDU.
* See PDU_CDMA_MSG_TELESERIVCIE_ID_XXX in ril_const.js.
* @param address
* The Orginating or Destinating address.
* @param bearerData
* The byte array of the encoded bearer data.
*/
function pduToParcelData(cdmaPduHelper, pdu) {
let addrInfo = cdmaPduHelper.encodeAddr(pdu.address);
// Teleservice, isServicePresent, ServiceCategory,
// addrInfo {digitMode, numberMode, numberType, numberPlan, address.length, address}
// Sub Address
// bearerData length, bearerData.
let dataLength = 4 + 4 + 4
+ (5 + addrInfo.address.length) * 4
+ 3 * 4
+ 4 + pdu.bearerData.length * 4;
let data = new Uint8Array(dataLength);
let offset = 0;
function writeInt(value) {
data[offset++] = value & 0xFF;
data[offset++] = (value >> 8) & 0xFF;
data[offset++] = (value >> 16) & 0xFF;
data[offset++] = (value >> 24) & 0xFF;
}
function writeByte(value) {
data[offset++] = value & 0xFF;
data[offset++] = 0;
data[offset++] = 0;
data[offset++] = 0;
}
// Teleservice
writeInt(pdu.teleservice);
// isServicePresent
writeByte(0);
// ServiceCategory
writeInt(PDU_CDMA_MSG_CATEGORY_UNSPEC);
// AddrInfo
writeByte(addrInfo.digitMode);
writeByte(addrInfo.numberMode);
writeByte(addrInfo.numberType);
writeByte(addrInfo.numberPlan);
let addressLength = addrInfo.address.length;
writeByte(addressLength);
for (let i = 0; i < addressLength; i++) {
writeByte(addrInfo.address[i]);
}
// Subaddress
writeByte(0);
writeByte(0);
writeByte(0);
// Bearer Data Length
let dataLength = pdu.bearerData.length;
writeByte(dataLength);
// Bearer Data
for (let i = 0; i < dataLength; i++) {
writeByte(pdu.bearerData[i]);
}
return data;
}
/**
* Verify CDMA SMS Delivery ACK Message.
*/
@ -73,7 +231,7 @@ add_test(function test_processCdmaSmsStatusReport() {
let postedMessage = workerHelper.postedMessage;
// Check if pending token is removed.
do_check_true((errorClass === 2)? !!sentSmsMap[msgId]: !sentSmsMap[msgId]);
do_check_true((errorClass === 2) ? !!sentSmsMap[msgId] : !sentSmsMap[msgId]);
// Check the response message accordingly.
if (errorClass === -1) {
@ -98,3 +256,67 @@ add_test(function test_processCdmaSmsStatusReport() {
run_next_test();
});
/**
* Verify WAP Push over CDMA SMS Message.
*/
add_test(function test_processCdmaSmsWapPush() {
let workerHelper = _getWorker(),
worker = workerHelper.worker,
bitBufferHelper = worker.BitBufferHelper,
cdmaPduHelper = worker.CdmaPDUHelper;
function test_CdmaSmsWapPdu(wdpData, reversed) {
let orig_address = "0987654321",
hexString,
fullDataHexString = "";
for (let i = 0; i < wdpData.length; i++) {
let dataIndex = (reversed) ? (wdpData.length - i - 1) : i;
hexString = "00"; // MSG_TYPE
hexString += bytesToHexString([wdpData.length]); // TOTAL_SEG
hexString += bytesToHexString([dataIndex]); // SEG_NUM (zero-based)
if ((dataIndex === 0)) {
hexString += "23F00B84"; // SOURCE_PORT, DEST_PORT for 1st segment
}
hexString += wdpData[dataIndex]; // WDP DATA
do_print("hexString: " + hexString);
fullDataHexString += wdpData[i];
let pdu = {
teleservice: PDU_CDMA_MSG_TELESERIVCIE_ID_WAP,
address: orig_address,
bearerData: encodeOpaqueUserData(bitBufferHelper,
{ msg_type: PDU_CDMA_MSG_TYPE_DELIVER,
data: hexStringToBytes(hexString) })
};
worker.onRILMessage(newSmsParcel(cdmaPduHelper, pdu));
}
let postedMessage = workerHelper.postedMessage;
do_print("fullDataHexString: " + fullDataHexString);
do_check_eq("sms-received", postedMessage.rilMessageType);
do_check_eq(PDU_CDMA_MSG_TELESERIVCIE_ID_WAP, postedMessage.teleservice);
do_check_eq(orig_address, postedMessage.sender);
do_check_eq(0x23F0, postedMessage.header.originatorPort);
do_check_eq(0x0B84, postedMessage.header.destinationPort);
do_check_eq(fullDataHexString, bytesToHexString(postedMessage.fullData));
}
// Verify Single WAP PDU
test_CdmaSmsWapPdu(["000102030405060708090A0B0C0D0E0F"]);
// Verify Concatenated WAP PDUs
test_CdmaSmsWapPdu(["000102030405060708090A0B0C0D0E0F", "0F0E0D0C0B0A09080706050403020100"]);
// Verify Concatenated WAP PDUs received in reversed order.
// Note: the port information is only available in 1st segment in CDMA WAP Push.
test_CdmaSmsWapPdu(["000102030405060708090A0B0C0D0E0F", "0F0E0D0C0B0A09080706050403020100"], true);
run_next_test();
});

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

@ -27,6 +27,7 @@
#include "jsfriendapi.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/AtomList.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/ErrorEventBinding.h"
@ -766,6 +767,53 @@ CTypesActivityCallback(JSContext* aCx,
}
}
static nsIPrincipal*
GetPrincipalForAsmJSCacheOp()
{
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
if (!workerPrivate) {
return nullptr;
}
// asmjscache::OpenEntryForX guarnatee to only access the given nsIPrincipal
// from the main thread.
return workerPrivate->GetPrincipalDontAssertMainThread();
}
static bool
AsmJSCacheOpenEntryForRead(JS::Handle<JSObject*> aGlobal,
const jschar* aBegin,
const jschar* aLimit,
size_t* aSize,
const uint8_t** aMemory,
intptr_t *aHandle)
{
nsIPrincipal* principal = GetPrincipalForAsmJSCacheOp();
if (!principal) {
return false;
}
return asmjscache::OpenEntryForRead(principal, aBegin, aLimit, aSize, aMemory,
aHandle);
}
static bool
AsmJSCacheOpenEntryForWrite(JS::Handle<JSObject*> aGlobal,
const jschar* aBegin,
const jschar* aEnd,
size_t aSize,
uint8_t** aMemory,
intptr_t* aHandle)
{
nsIPrincipal* principal = GetPrincipalForAsmJSCacheOp();
if (!principal) {
return false;
}
return asmjscache::OpenEntryForWrite(principal, aBegin, aEnd, aSize, aMemory,
aHandle);
}
struct WorkerThreadRuntimePrivate : public PerThreadAtomCache
{
WorkerPrivate* mWorkerPrivate;
@ -808,6 +856,16 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
};
SetDOMCallbacks(aRuntime, &DOMCallbacks);
// Set up the asm.js cache callbacks
static JS::AsmJSCacheOps asmJSCacheOps = {
AsmJSCacheOpenEntryForRead,
asmjscache::CloseEntryForRead,
AsmJSCacheOpenEntryForWrite,
asmjscache::CloseEntryForWrite,
asmjscache::GetBuildId
};
JS::SetAsmJSCacheOps(aRuntime, &asmJSCacheOps);
JSContext* workerCx = JS_NewContext(aRuntime, 0);
if (!workerCx) {
NS_WARNING("Could not create new context!");

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

@ -94,7 +94,7 @@ using mozilla::AutoSafeJSContext;
USING_WORKERS_NAMESPACE
using namespace mozilla::dom;
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(JsWorkerMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(JsWorkerMallocSizeOf)
namespace {
@ -2006,8 +2006,10 @@ struct WorkerPrivate::TimeoutInfo
bool mCanceled;
};
class WorkerPrivate::MemoryReporter MOZ_FINAL : public MemoryMultiReporter
class WorkerPrivate::MemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
NS_DECL_THREADSAFE_ISUPPORTS
friend class WorkerPrivate;
SharedMutex mMutex;
@ -2119,6 +2121,8 @@ private:
}
};
NS_IMPL_ISUPPORTS1(WorkerPrivate::MemoryReporter, nsIMemoryReporter)
template <class Derived>
WorkerPrivateParent<Derived>::WorkerPrivateParent(
JSContext* aCx,

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

@ -600,6 +600,15 @@ public:
return mLoadInfo.mPrincipal;
}
// This method allows the principal to be retrieved off the main thread.
// Principals are main-thread objects so the caller must ensure that all
// access occurs on the main thread.
nsIPrincipal*
GetPrincipalDontAssertMainThread() const
{
return mLoadInfo.mPrincipal;
}
void
SetPrincipal(nsIPrincipal* aPrincipal);

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

@ -60,4 +60,6 @@ LOCAL_INCLUDES += [
'/xpcom/build',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'gklayout'

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

@ -431,7 +431,6 @@ public:
// XXX I expect we will want to move mWidget into this class and implement
// these methods properly.
virtual nsIWidget* GetWidget() const { return nullptr; }
virtual const nsIntSize& GetWidgetSize() = 0;
// Call before and after any rendering not done by this compositor but which
// might affect the compositor's internal state or the state of any APIs it

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

@ -133,15 +133,6 @@ LayerManager::CreateDrawTarget(const IntSize &aSize,
CreateOffscreenCanvasDrawTarget(aSize, aFormat);
}
TextureFactoryIdentifier
LayerManager::GetTextureFactoryIdentifier()
{
//TODO[nrc] make pure virtual when all layer managers use Compositor
NS_ERROR("Should have been overridden");
return TextureFactoryIdentifier();
}
#ifdef DEBUG
void
LayerManager::Mutated(Layer* aLayer)
@ -184,6 +175,7 @@ Layer::Layer(LayerManager* aManager, void* aImplData) :
mIsFixedPosition(false),
mMargins(0, 0, 0, 0),
mStickyPositionData(nullptr),
mIsScrollbar(false),
mDebugColorIndex(0),
mAnimationGeneration(0)
{}
@ -1278,6 +1270,13 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
if (GetContentFlags() & CONTENT_COMPONENT_ALPHA) {
aTo += " [componentAlpha]";
}
if (GetIsScrollbar()) {
if (GetScrollbarDirection() == VERTICAL) {
aTo.AppendPrintf(" [vscrollbar=%lld]", GetScrollbarTargetContainerId());
} else {
aTo.AppendPrintf(" [hscrollbar=%lld]", GetScrollbarTargetContainerId());
}
}
if (GetIsFixedPosition()) {
aTo.AppendPrintf(" [isFixedPosition anchor=%f,%f]", mAnchor.x, mAnchor.y);
}

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

@ -437,12 +437,6 @@ public:
virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; }
/**
* Returns a TextureFactoryIdentifier which describes properties of the backend
* used to decide what kind of texture and buffer clients to create
*/
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier();
/**
* returns the maximum texture size on this layer backend, or INT32_MAX
* if there is no maximum
@ -972,6 +966,29 @@ public:
}
}
enum ScrollDirection {
VERTICAL,
HORIZONTAL
};
/**
* CONSTRUCTION PHASE ONLY
* If a layer is a scrollbar layer, |aScrollId| holds the scroll identifier
* of the scrollable content that the scrollbar is for.
*/
void SetScrollbarData(FrameMetrics::ViewID aScrollId, ScrollDirection aDir)
{
if (mIsScrollbar ||
mScrollbarTargetId != aScrollId ||
mScrollbarDirection != aDir) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ScrollbarData", this));
mIsScrollbar = true;
mScrollbarTargetId = aScrollId;
mScrollbarDirection = aDir;
Mutated();
}
}
// These getters can be used anytime.
float GetOpacity() { return mOpacity; }
gfxContext::GraphicsOperator GetMixBlendMode() const { return mMixBlendMode; }
@ -996,6 +1013,9 @@ public:
FrameMetrics::ViewID GetStickyScrollContainerId() { return mStickyPositionData->mScrollId; }
const LayerRect& GetStickyScrollRangeOuter() { return mStickyPositionData->mOuter; }
const LayerRect& GetStickyScrollRangeInner() { return mStickyPositionData->mInner; }
bool GetIsScrollbar() { return mIsScrollbar; }
FrameMetrics::ViewID GetScrollbarTargetContainerId() { return mScrollbarTargetId; }
ScrollDirection GetScrollbarDirection() { return mScrollbarDirection; }
Layer* GetMaskLayer() const { return mMaskLayer; }
// Note that all lengths in animation data are either in CSS pixels or app
@ -1367,6 +1387,9 @@ protected:
LayerRect mInner;
};
nsAutoPtr<StickyPositionData> mStickyPositionData;
bool mIsScrollbar;
FrameMetrics::ViewID mScrollbarTargetId;
ScrollDirection mScrollbarDirection;
DebugOnly<uint32_t> mDebugColorIndex;
// If this layer is used for OMTA, then this counter is used to ensure we
// stay in sync with the animation manager

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

@ -220,7 +220,6 @@ CreateBasicDeprecatedTextureHost(SurfaceDescriptorType aDescriptorType,
BasicCompositor::BasicCompositor(nsIWidget *aWidget)
: mWidget(aWidget)
, mWidgetSize(-1, -1)
{
MOZ_COUNT_CTOR(BasicCompositor);
sBackend = LAYERS_BASIC;
@ -540,7 +539,6 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
nsIntRect intRect;
mWidget->GetClientBounds(intRect);
Rect rect = Rect(0, 0, intRect.width, intRect.height);
mWidgetSize = intRect.Size();
nsIntRect invalidRect = aInvalidRegion.GetBounds();
mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);

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

@ -119,10 +119,6 @@ public:
virtual const char* Name() const { return "Basic"; }
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
{
return mWidgetSize;
}
gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; }

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

@ -73,7 +73,7 @@ public:
virtual already_AddRefed<ColorLayer> CreateColorLayer();
virtual already_AddRefed<RefLayer> CreateRefLayer();
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
TextureFactoryIdentifier GetTextureFactoryIdentifier()
{
return mForwarder->GetTextureFactoryIdentifier();
}

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

@ -501,9 +501,9 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
mLayerManager->GetCompositor()->SetScreenRenderOffset(offset);
gfx3DMatrix transform(gfx3DMatrix(treeTransform) * aLayer->GetTransform());
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
// GetTransform already takes the pre- and post-scale into account. Since we
// will apply the pre- and post-scale again when computing the effective
// transform, we must apply the inverses here.
transform.Scale(1.0f/container->GetPreXScale(),
1.0f/container->GetPreYScale(),
1);
@ -524,9 +524,69 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
appliedTransform = true;
}
if (container->GetIsScrollbar()) {
ApplyAsyncTransformToScrollbar(container);
}
return appliedTransform;
}
void
AsyncCompositionManager::ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer)
{
// If this layer corresponds to a scrollbar, then search backwards through the
// siblings until we find the container layer with the right ViewID; this is
// the content that this scrollbar is for. Pick up the transient async transform
// from that layer and use it to update the scrollbar position.
// Note that it is possible that the content layer is no longer there; in
// this case we don't need to do anything because there can't be an async
// transform on the content.
for (Layer* scrollTarget = aLayer->GetPrevSibling();
scrollTarget;
scrollTarget = scrollTarget->GetPrevSibling()) {
if (!scrollTarget->AsContainerLayer()) {
continue;
}
AsyncPanZoomController* apzc = scrollTarget->AsContainerLayer()->GetAsyncPanZoomController();
if (!apzc) {
continue;
}
const FrameMetrics& metrics = scrollTarget->AsContainerLayer()->GetFrameMetrics();
if (metrics.mScrollId != aLayer->GetScrollbarTargetContainerId()) {
continue;
}
gfx3DMatrix asyncTransform = gfx3DMatrix(apzc->GetCurrentAsyncTransform());
gfx3DMatrix nontransientTransform = apzc->GetNontransientAsyncTransform();
gfx3DMatrix transientTransform = asyncTransform * nontransientTransform.Inverse();
gfx3DMatrix scrollbarTransform;
if (aLayer->GetScrollbarDirection() == Layer::VERTICAL) {
float scale = metrics.CalculateCompositedRectInCssPixels().height / metrics.mScrollableRect.height;
scrollbarTransform.ScalePost(1.f, 1.f / transientTransform.GetYScale(), 1.f);
scrollbarTransform.TranslatePost(gfxPoint3D(0, -transientTransform._42 * scale, 0));
}
if (aLayer->GetScrollbarDirection() == Layer::HORIZONTAL) {
float scale = metrics.CalculateCompositedRectInCssPixels().width / metrics.mScrollableRect.width;
scrollbarTransform.ScalePost(1.f / transientTransform.GetXScale(), 1.f, 1.f);
scrollbarTransform.TranslatePost(gfxPoint3D(-transientTransform._41 * scale, 0, 0));
}
gfx3DMatrix transform = scrollbarTransform * aLayer->GetTransform();
// GetTransform already takes the pre- and post-scale into account. Since we
// will apply the pre- and post-scale again when computing the effective
// transform, we must apply the inverses here.
transform.Scale(1.0f/aLayer->GetPreXScale(),
1.0f/aLayer->GetPreYScale(),
1);
transform.ScalePost(1.0f/aLayer->GetPostXScale(),
1.0f/aLayer->GetPostYScale(),
1);
aLayer->AsLayerComposite()->SetShadowTransform(transform);
return;
}
}
void
AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
{

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

@ -123,6 +123,11 @@ private:
// controller wants another animation frame.
bool ApplyAsyncContentTransformToTree(TimeStamp aCurrentFrame, Layer* aLayer,
bool* aWantNextFrame);
/**
* Update the shadow trasnform for aLayer assuming that is a scrollbar,
* so that it stays in sync with the content that is being scrolled by APZ.
*/
void ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer);
void SetFirstPaintViewport(const LayerIntPoint& aOffset,
const CSSToLayerScale& aZoom,

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

@ -203,6 +203,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
EndTransactionFlags aFlags)
{
NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
NS_ASSERTION(!aCallback && !aCallbackData, "Not expecting callbacks here");
mInTransaction = false;
if (!mIsCompositorReady) {
@ -240,13 +241,7 @@ LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
// so we don't need to pass any global transform here.
mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
mThebesLayerCallback = aCallback;
mThebesLayerCallbackData = aCallbackData;
Render();
mThebesLayerCallback = nullptr;
mThebesLayerCallbackData = nullptr;
}
mCompositor->SetTargetContext(nullptr);
@ -307,7 +302,7 @@ LayerManagerComposite::RootLayer() const
return nullptr;
}
return static_cast<LayerComposite*>(mRoot->ImplData());
return ToLayerComposite(mRoot);
}
static uint16_t sFrameCount = 0;
@ -723,7 +718,7 @@ LayerManagerComposite::AutoAddMaskEffect::AutoAddMaskEffect(Layer* aMaskLayer,
return;
}
mCompositable = static_cast<LayerComposite*>(aMaskLayer->ImplData())->GetCompositableHost();
mCompositable = ToLayerComposite(aMaskLayer)->GetCompositableHost();
if (!mCompositable) {
NS_WARNING("Mask layer with no compositable host");
return;
@ -786,25 +781,6 @@ LayerComposite::Destroy()
}
}
const nsIntSize&
LayerManagerComposite::GetWidgetSize()
{
return mCompositor->GetWidgetSize();
}
void
LayerManagerComposite::SetCompositorID(uint32_t aID)
{
NS_ASSERTION(mCompositor, "No compositor");
mCompositor->SetCompositorID(aID);
}
void
LayerManagerComposite::NotifyShadowTreeTransaction()
{
mCompositor->NotifyLayersTransaction();
}
bool
LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
{
@ -812,18 +788,6 @@ LayerManagerComposite::CanUseCanvasLayerForSize(const gfxIntSize &aSize)
aSize.height));
}
TextureFactoryIdentifier
LayerManagerComposite::GetTextureFactoryIdentifier()
{
return mCompositor->GetTextureFactoryIdentifier();
}
int32_t
LayerManagerComposite::GetMaxTextureSize() const
{
return mCompositor->GetMaxTextureSize();
}
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
/*static*/ bool

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

@ -110,8 +110,6 @@ public:
}
void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget);
void NotifyShadowTreeTransaction();
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
virtual void EndTransaction(DrawThebesLayerCallback aCallback,
void* aCallbackData,
@ -119,11 +117,14 @@ public:
virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; }
// XXX[nrc]: never called, we should move this logic to ClientLayerManager
// (bug 946926).
virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) MOZ_OVERRIDE;
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE;
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE
{
MOZ_CRASH("Call on compositor, not LayerManagerComposite");
}
virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
@ -141,24 +142,16 @@ public:
virtual LayersBackend GetBackendType() MOZ_OVERRIDE
{
return LAYERS_NONE;
MOZ_CRASH("Shouldn't be called for composited layer manager");
}
virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE
{
MOZ_ASSERT(false, "Shouldn't be called for composited layer manager");
name.AssignLiteral("Composite");
MOZ_CRASH("Shouldn't be called for composited layer manager");
}
virtual already_AddRefed<gfxASurface>
CreateOptimalMaskSurface(const gfxIntSize &aSize) MOZ_OVERRIDE;
DrawThebesLayerCallback GetThebesLayerCallback() const
{ return mThebesLayerCallback; }
void* GetThebesLayerCallbackData() const
{ return mThebesLayerCallbackData; }
virtual const char* Name() const MOZ_OVERRIDE { return ""; }
enum WorldTransforPolicy {
@ -195,11 +188,9 @@ public:
* layermanager.
*/
virtual TemporaryRef<mozilla::gfx::DrawTarget>
CreateDrawTarget(const mozilla::gfx::IntSize &aSize,
CreateDrawTarget(const mozilla::gfx::IntSize& aSize,
mozilla::gfx::SurfaceFormat aFormat) MOZ_OVERRIDE;
const nsIntSize& GetWidgetSize();
/**
* Calculates the 'completeness' of the rendering that intersected with the
* screen on the last render. This is only useful when progressive tile
@ -217,8 +208,6 @@ public:
static void PlatformSyncBeforeReplyUpdate();
void SetCompositorID(uint32_t aID);
void AddInvalidRegion(const nsIntRegion& aRegion)
{
mInvalidRegion.Or(mInvalidRegion, aRegion);
@ -245,7 +234,7 @@ private:
nsIntRect mRenderBounds;
/** Current root layer. */
LayerComposite *RootLayer() const;
LayerComposite* RootLayer() const;
/**
* Recursive helper method for use by ComputeRenderIntegrity. Subtracts
@ -275,10 +264,6 @@ private:
/** Our more efficient but less powerful alter ego, if one is available. */
nsRefPtr<Composer2D> mComposer2D;
/* Thebes layer callbacks; valid at the end of a transaciton,
* while rendering */
DrawThebesLayerCallback mThebesLayerCallback;
void *mThebesLayerCallbackData;
gfxMatrix mWorldMatrix;
bool mInTransaction;

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

@ -549,6 +549,8 @@ MemoryTextureHost::MemoryTextureHost(uint64_t aID,
MemoryTextureHost::~MemoryTextureHost()
{
DeallocateDeviceData();
NS_ASSERTION(!mBuffer || (mFlags & TEXTURE_DEALLOCATE_CLIENT),
"Leaking our buffer");
MOZ_COUNT_DTOR(MemoryTextureHost);
}

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

@ -139,14 +139,6 @@ public:
virtual void NotifyLayersTransaction() MOZ_OVERRIDE { }
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
{
NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. "
"You should not do that outside of BeginFrame, so the best we can do is return "
"the last size we got, that might not be up to date. So you probably shouldn't "
"use this method.");
return mSize;
}
ID3D11Device* GetDevice() { return mDevice; }

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

@ -86,14 +86,6 @@ public:
virtual void NotifyLayersTransaction() MOZ_OVERRIDE {}
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE
{
NS_ASSERTION(false, "Getting the widget size on windows causes some kind of resizing of buffers. "
"You should not do that outside of BeginFrame, so the best we can do is return "
"the last size we got, that might not be up to date. So you probably shouldn't "
"use this method.");
return mSize;
}
IDirect3DDevice9* device() const
{

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

@ -1647,9 +1647,11 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformBegin();
mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformEnd();
mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
}
}
}

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

@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "CompositorParent.h"
#include "CompositorCocoaWidgetHelper.h"
#include "nsDebug.h"
namespace mozilla {
namespace layers {
namespace compositor {
LayerManagerComposite*
GetLayerManager(CompositorParent* aParent)
{
return aParent->GetLayerManager();
}
}
}
}

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

@ -1,29 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_CompositorCocoaWidgetHelper_h
#define mozilla_layers_CompositorCocoaWidgetHelper_h
// Note we can't include IPDL-generated headers here, since this file is being
// used as a workaround for Bug 719036.
namespace mozilla {
namespace layers {
class CompositorParent;
class LayerManagerComposite;
namespace compositor {
// Needed when we cannot directly include CompositorParent.h since it includes
// an IPDL-generated header (e.g. in widget/cocoa/nsChildView.mm; see Bug 719036).
LayerManagerComposite* GetLayerManager(CompositorParent* aParent);
}
}
}
#endif // mozilla_layers_CompositorCocoaWidgetHelper_h

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

@ -62,6 +62,7 @@ namespace layers {
CompositorParent::LayerTreeState::LayerTreeState()
: mParent(nullptr)
, mLayerManager(nullptr)
{
}
@ -237,6 +238,7 @@ CompositorParent::Destroy()
// Ensure that the layer manager is destructed on the compositor thread.
mLayerManager = nullptr;
mCompositor = nullptr;
mCompositionManager = nullptr;
mApzcTreeManager->ClearTree();
mApzcTreeManager = nullptr;
@ -263,10 +265,12 @@ CompositorParent::RecvWillStop()
LayerTreeState* lts = &it->second;
if (lts->mParent == this) {
mLayerManager->ClearCachedResources(lts->mRoot);
lts->mLayerManager = nullptr;
}
}
mLayerManager->Destroy();
mLayerManager = nullptr;
mCompositor = nullptr;
mCompositionManager = nullptr;
}
@ -371,7 +375,9 @@ CompositorParent::ActorDestroy(ActorDestroyReason why)
if (mLayerManager) {
mLayerManager->Destroy();
mLayerManager = nullptr;
sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = nullptr;
mCompositionManager = nullptr;
mCompositor = nullptr;
}
}
@ -394,7 +400,7 @@ CompositorParent::PauseComposition()
if (!mPaused) {
mPaused = true;
mLayerManager->GetCompositor()->Pause();
mCompositor->Pause();
}
// if anyone's waiting to make sure that composition really got paused, tell them
@ -409,7 +415,7 @@ CompositorParent::ResumeComposition()
MonitorAutoLock lock(mResumeCompositionMonitor);
if (!mLayerManager->GetCompositor()->Resume()) {
if (!mCompositor->Resume()) {
#ifdef MOZ_WIDGET_ANDROID
// We can't get a surface. This could be because the activity changed between
// the time resume was scheduled and now.
@ -440,8 +446,8 @@ CompositorParent::SetEGLSurfaceSize(int width, int height)
{
NS_ASSERTION(mUseExternalSurfaceSize, "Compositor created without UseExternalSurfaceSize provided");
mEGLSurfaceSize.SizeTo(width, height);
if (mLayerManager) {
mLayerManager->GetCompositor()->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height));
if (mCompositor) {
mCompositor->SetDestinationSurfaceSize(gfx::IntSize(mEGLSurfaceSize.width, mEGLSurfaceSize.height));
}
}
@ -503,7 +509,7 @@ CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint)
AutoResolveRefLayers resolve(mCompositionManager);
mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(), aIsFirstPaint, aId);
mLayerManager->AsLayerManagerComposite()->NotifyShadowTreeTransaction();
mCompositor->NotifyLayersTransaction();
}
ScheduleComposition();
}
@ -697,7 +703,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
}
}
ScheduleComposition();
mLayerManager->NotifyShadowTreeTransaction();
mCompositor->NotifyLayersTransaction();
}
void
@ -706,34 +712,32 @@ CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackend
NS_ASSERTION(!mLayerManager, "Already initialised mLayerManager");
for (size_t i = 0; i < aBackendHints.Length(); ++i) {
RefPtr<LayerManagerComposite> layerManager;
RefPtr<Compositor> compositor;
if (aBackendHints[i] == LAYERS_OPENGL) {
layerManager =
new LayerManagerComposite(new CompositorOGL(mWidget,
mEGLSurfaceSize.width,
mEGLSurfaceSize.height,
mUseExternalSurfaceSize));
compositor = new CompositorOGL(mWidget,
mEGLSurfaceSize.width,
mEGLSurfaceSize.height,
mUseExternalSurfaceSize);
} else if (aBackendHints[i] == LAYERS_BASIC) {
layerManager =
new LayerManagerComposite(new BasicCompositor(mWidget));
compositor = new BasicCompositor(mWidget);
#ifdef XP_WIN
} else if (aBackendHints[i] == LAYERS_D3D11) {
layerManager =
new LayerManagerComposite(new CompositorD3D11(mWidget));
compositor = new CompositorD3D11(mWidget);
} else if (aBackendHints[i] == LAYERS_D3D9) {
layerManager =
new LayerManagerComposite(new CompositorD3D9(this, mWidget));
compositor = new CompositorD3D9(this, mWidget);
#endif
}
if (!layerManager) {
continue;
}
MOZ_ASSERT(compositor, "Passed invalid backend hint");
layerManager->SetCompositorID(mCompositorID);
compositor->SetCompositorID(mCompositorID);
RefPtr<LayerManagerComposite> layerManager = new LayerManagerComposite(compositor);
if (layerManager->Initialize()) {
mLayerManager = layerManager;
MOZ_ASSERT(compositor);
mCompositor = compositor;
sIndirectLayerTrees[mRootLayerTreeID].mLayerManager = layerManager;
return;
}
}
@ -765,7 +769,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aB
mCompositionManager = new AsyncCompositionManager(mLayerManager);
*aSuccess = true;
*aTextureFactoryIdentifier = mLayerManager->GetTextureFactoryIdentifier();
*aTextureFactoryIdentifier = mCompositor->GetTextureFactoryIdentifier();
LayerTransactionParent* p = new LayerTransactionParent(mLayerManager, this, 0);
p->AddIPDLReference();
return p;
@ -851,6 +855,7 @@ void
CompositorParent::NotifyChildCreated(uint64_t aChild)
{
sIndirectLayerTrees[aChild].mParent = this;
sIndirectLayerTrees[aChild].mLayerManager = mLayerManager;
}
/*static*/ uint64_t
@ -921,6 +926,17 @@ CompositorParent::GetAPZCTreeManager(uint64_t aLayersId)
return nullptr;
}
float
CompositorParent::ComputeRenderIntegrity()
{
if (mLayerManager) {
return mLayerManager->ComputeRenderIntegrity();
}
return 1.0f;
}
/**
* This class handles layer updates pushed directly from child
* processes to the compositor thread. It's associated with a
@ -1071,9 +1087,9 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<Layers
{
MOZ_ASSERT(aId != 0);
if (sIndirectLayerTrees[aId].mParent) {
LayerManagerComposite* lm = sIndirectLayerTrees[aId].mParent->GetLayerManager();
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
if (sIndirectLayerTrees[aId].mLayerManager) {
LayerManagerComposite* lm = sIndirectLayerTrees[aId].mLayerManager;
*aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier();
*aSuccess = true;
LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId);
p->AddIPDLReference();

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

@ -47,6 +47,7 @@ namespace layers {
class APZCTreeManager;
class AsyncCompositionManager;
class Compositor;
class LayerManagerComposite;
class LayerTransactionParent;
@ -107,8 +108,6 @@ public:
void ForceIsFirstPaint();
void Destroy();
LayerManagerComposite* GetLayerManager() { return mLayerManager; }
void NotifyChildCreated(uint64_t aChild);
void AsyncRender();
@ -203,6 +202,7 @@ public:
nsRefPtr<Layer> mRoot;
nsRefPtr<GeckoContentController> mController;
CompositorParent* mParent;
LayerManagerComposite* mLayerManager;
TargetConfig mTargetConfig;
};
@ -213,6 +213,8 @@ public:
*/
static const LayerTreeState* GetIndirectShadowTree(uint64_t aId);
float ComputeRenderIntegrity();
/**
* Tell all CompositorParents to update their last refresh to aTime and sample
* animations at this time stamp. If aIsTesting is true, the
@ -295,6 +297,7 @@ private:
bool CanComposite();
nsRefPtr<LayerManagerComposite> mLayerManager;
nsRefPtr<Compositor> mCompositor;
RefPtr<AsyncCompositionManager> mCompositionManager;
nsIWidget* mWidget;
CancelableTask *mCurrentCompositeTask;

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

@ -81,8 +81,8 @@ public:
* the apzc is modifying the view, including panning, zooming, and
* fling.
*/
virtual void NotifyTransformBegin() {}
virtual void NotifyTransformEnd() {}
virtual void NotifyTransformBegin(const ScrollableLayerGuid& aGuid) {}
virtual void NotifyTransformEnd(const ScrollableLayerGuid& aGuid) {}
GeckoContentController() {}
virtual ~GeckoContentController() {}

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

@ -279,6 +279,10 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
common.stickyScrollRangeOuter(),
common.stickyScrollRangeInner());
}
if (common.isScrollbar()) {
layer->SetScrollbarData(common.scrollbarTargetContainerId(),
static_cast<Layer::ScrollDirection>(common.scrollbarDirection()));
}
if (PLayerParent* maskLayer = common.maskLayerParent()) {
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
} else {

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

@ -197,6 +197,9 @@ struct CommonLayerAttributes {
uint64_t stickyScrollContainerId;
LayerRect stickyScrollRangeOuter;
LayerRect stickyScrollRangeInner;
bool isScrollbar;
uint64_t scrollbarTargetContainerId;
uint32_t scrollbarDirection;
nullable PLayer maskLayer;
// Animated colors will only honored for ColorLayers.
Animation[] animations;

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

@ -528,6 +528,11 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, bool
common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter();
common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner();
}
common.isScrollbar() = mutant->GetIsScrollbar();
if (mutant->GetIsScrollbar()) {
common.scrollbarTargetContainerId() = mutant->GetScrollbarTargetContainerId();
common.scrollbarDirection() = mutant->GetScrollbarDirection();
}
if (Layer* maskLayer = mutant->GetMaskLayer()) {
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
} else {

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

@ -128,7 +128,6 @@ EXPORTS.mozilla.layers += [
'ipc/CompositableForwarder.h',
'ipc/CompositableTransactionParent.h',
'ipc/CompositorChild.h',
'ipc/CompositorCocoaWidgetHelper.h',
'ipc/CompositorParent.h',
'ipc/GeckoContentController.h',
'ipc/GestureEventListener.h',
@ -240,7 +239,6 @@ UNIFIED_SOURCES += [
'ipc/Axis.cpp',
'ipc/CompositableTransactionParent.cpp',
'ipc/CompositorChild.cpp',
'ipc/CompositorCocoaWidgetHelper.cpp',
'ipc/CompositorParent.cpp',
'ipc/GestureEventListener.cpp',
'ipc/ImageBridgeChild.cpp',

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

@ -158,9 +158,6 @@ public:
virtual bool Resume() MOZ_OVERRIDE;
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
virtual const nsIntSize& GetWidgetSize() MOZ_OVERRIDE {
return mWidgetSize;
}
GLContext* gl() const { return mGLContext; }
ShaderProgramType GetFBOLayerProgramType() const {

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

@ -6,7 +6,6 @@
#include "GLManager.h"
#include "CompositorOGL.h" // for CompositorOGL
#include "GLContext.h" // for GLContext
#include "Layers.h" // for LayerManager
#include "mozilla/Assertions.h" // for MOZ_CRASH
#include "mozilla/Attributes.h" // for MOZ_OVERRIDE
#include "mozilla/RefPtr.h" // for RefPtr
@ -15,7 +14,6 @@
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/mozalloc.h" // for operator new, etc
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsISupportsImpl.h" // for LayerManager::AddRef, etc
using namespace mozilla::gl;
@ -49,21 +47,14 @@ private:
};
/* static */ GLManager*
GLManager::CreateGLManager(LayerManager* aManager)
GLManager::CreateGLManager(LayerManagerComposite* aManager)
{
if (!aManager) {
return nullptr;
if (aManager &&
Compositor::GetBackend() == LAYERS_OPENGL) {
return new GLManagerCompositor(static_cast<CompositorOGL*>(
aManager->GetCompositor()));
}
if (aManager->GetBackendType() == LAYERS_NONE) {
if (Compositor::GetBackend() == LAYERS_OPENGL) {
return new GLManagerCompositor(static_cast<CompositorOGL*>(
static_cast<LayerManagerComposite*>(aManager)->GetCompositor()));
} else {
return nullptr;
}
}
MOZ_CRASH("Cannot create GLManager for non-GL layer manager");
return nullptr;
}
}

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

@ -16,7 +16,7 @@ class GLContext;
namespace layers {
class LayerManager;
class LayerManagerComposite;
/**
* Minimal interface to allow widgets to draw using OpenGL. Abstracts
@ -26,7 +26,7 @@ class LayerManager;
class GLManager
{
public:
static GLManager* CreateGLManager(LayerManager* aManager);
static GLManager* CreateGLManager(LayerManagerComposite* aManager);
virtual ~GLManager() {}

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

@ -256,8 +256,17 @@ private:
nsRegion& Copy (const nsRect& aRect)
{
pixman_box32_t box = RectToBox(aRect);
pixman_region32_reset(&mImpl, &box);
// pixman needs to distinguish between an empty region and a region
// with one rect so that it can return a different number of rectangles.
// Empty rect: data = empty_box
// 1 rect: data = NULL
// >1 rect: data = rects
if (aRect.IsEmpty()) {
pixman_region32_clear(&mImpl);
} else {
pixman_box32_t box = RectToBox(aRect);
pixman_region32_reset(&mImpl, &box);
}
return *this;
}

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

@ -631,10 +631,10 @@ PR_STATIC_ASSERT(uint32_t(CAIRO_SURFACE_TYPE_SKIA) ==
static int64_t gSurfaceMemoryUsed[gfxSurfaceTypeMax] = { 0 };
class SurfaceMemoryReporter MOZ_FINAL : public MemoryMultiReporter
class SurfaceMemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
SurfaceMemoryReporter() { }
NS_DECL_ISUPPORTS
NS_IMETHOD CollectReports(nsIMemoryReporterCallback *aCb,
nsISupports *aClosure)
@ -651,8 +651,7 @@ public:
}
nsresult rv = aCb->Callback(EmptyCString(), nsCString(path),
nsIMemoryReporter::KIND_OTHER,
nsIMemoryReporter::UNITS_BYTES,
KIND_OTHER, UNITS_BYTES,
gSurfaceMemoryUsed[i],
nsCString(desc), aClosure);
NS_ENSURE_SUCCESS(rv, rv);
@ -663,6 +662,8 @@ public:
}
};
NS_IMPL_ISUPPORTS1(SurfaceMemoryReporter, nsIMemoryReporter)
void
gfxASurface::RecordMemoryUsedForSurfaceType(gfxSurfaceType aType,
int32_t aBytes)

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

@ -1360,7 +1360,9 @@ gfxFontFamily::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
* shaped-word caches to free up memory.
*/
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontCacheMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(FontCacheMallocSizeOf)
NS_IMPL_ISUPPORTS1(gfxFontCache::MemoryReporter, nsIMemoryReporter)
NS_IMETHODIMP
gfxFontCache::MemoryReporter::CollectReports

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

@ -951,13 +951,11 @@ public:
FontCacheSizes* aSizes) const;
protected:
class MemoryReporter MOZ_FINAL : public mozilla::MemoryMultiReporter
class MemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
MemoryReporter() {}
NS_IMETHOD CollectReports(nsIMemoryReporterCallback* aCb,
nsISupports* aClosure);
NS_DECL_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
};
// Observer for notifications that the font cache cares about

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

@ -71,10 +71,9 @@ gfxFontListPrefObserver::Observe(nsISupports *aSubject,
return NS_OK;
}
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(FontListMallocSizeOf)
MOZ_DEFINE_MALLOC_SIZE_OF(FontListMallocSizeOf)
gfxPlatformFontList::MemoryReporter::MemoryReporter()
{}
NS_IMPL_ISUPPORTS1(gfxPlatformFontList::MemoryReporter, nsIMemoryReporter)
NS_IMETHODIMP
gfxPlatformFontList::MemoryReporter::CollectReports
@ -91,23 +90,20 @@ gfxPlatformFontList::MemoryReporter::CollectReports
aCb->Callback(EmptyCString(),
NS_LITERAL_CSTRING("explicit/gfx/font-list"),
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
sizes.mFontListSize,
KIND_HEAP, UNITS_BYTES, sizes.mFontListSize,
NS_LITERAL_CSTRING("Memory used to manage the list of font families and faces."),
aClosure);
aCb->Callback(EmptyCString(),
NS_LITERAL_CSTRING("explicit/gfx/font-charmaps"),
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
sizes.mCharMapsSize,
KIND_HEAP, UNITS_BYTES, sizes.mCharMapsSize,
NS_LITERAL_CSTRING("Memory used to record the character coverage of individual fonts."),
aClosure);
if (sizes.mFontTableCacheSize) {
aCb->Callback(EmptyCString(),
NS_LITERAL_CSTRING("explicit/gfx/font-tables"),
nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES,
sizes.mFontTableCacheSize,
KIND_HEAP, UNITS_BYTES, sizes.mFontTableCacheSize,
NS_LITERAL_CSTRING("Memory used for cached font metrics and layout tables."),
aClosure);
}

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

@ -178,12 +178,11 @@ public:
void RemoveCmap(const gfxCharacterMap *aCharMap);
protected:
class MemoryReporter MOZ_FINAL : public mozilla::MemoryMultiReporter
class MemoryReporter MOZ_FINAL : public nsIMemoryReporter
{
public:
MemoryReporter();
NS_IMETHOD CollectReports(nsIMemoryReporterCallback *aCb,
nsISupports *aClosure);
NS_DECL_ISUPPORTS
NS_DECL_NSIMEMORYREPORTER
};
gfxPlatformFontList(bool aNeedFullnamePostscriptNames = true);

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

@ -3,10 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef MOZ_PANGO
#define PANGO_ENABLE_BACKEND
#define PANGO_ENABLE_ENGINE
#endif
#include "gfxPlatformGtk.h"
#include "prenv.h"
@ -14,16 +12,10 @@
#include "nsUnicharUtils.h"
#include "nsUnicodeProperties.h"
#include "gfxFontconfigUtils.h"
#ifdef MOZ_PANGO
#include "gfxPangoFonts.h"
#include "gfxContext.h"
#include "gfxUserFontSet.h"
#include "gfxFT2FontBase.h"
#else
#include <ft2build.h>
#include FT_FREETYPE_H
#include "gfxFT2Fonts.h"
#endif
#include "mozilla/gfx/2D.h"
@ -56,16 +48,6 @@ using namespace mozilla::unicode;
gfxFontconfigUtils *gfxPlatformGtk::sFontconfigUtils = nullptr;
#ifndef MOZ_PANGO
typedef nsDataHashtable<nsStringHashKey, nsRefPtr<FontFamily> > FontTable;
typedef nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > PrefFontTable;
static FontTable *gPlatformFonts = nullptr;
static FontTable *gPlatformFontAliases = nullptr;
static PrefFontTable *gPrefFonts = nullptr;
static gfxSparseBitSet *gCodepointsWithNoFonts = nullptr;
static FT_Library gPlatformFTLibrary = nullptr;
#endif
static cairo_user_data_key_t cairo_gdk_drawable_key;
#ifdef MOZ_X11
@ -80,17 +62,6 @@ gfxPlatformGtk::gfxPlatformGtk()
sUseXRender = mozilla::Preferences::GetBool("gfx.xrender.enabled");
#endif
#ifndef MOZ_PANGO
FT_Init_FreeType(&gPlatformFTLibrary);
gPlatformFonts = new FontTable();
gPlatformFonts->Init(100);
gPlatformFontAliases = new FontTable();
gPlatformFontAliases->Init(100);
gPrefFonts = new PrefFontTable();
gPrefFonts->Init(100);
gCodepointsWithNoFonts = new gfxSparseBitSet();
UpdateFontList();
#endif
uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
uint32_t contentMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
InitBackendPrefs(canvasMask, BACKEND_CAIRO,
@ -102,28 +73,7 @@ gfxPlatformGtk::~gfxPlatformGtk()
gfxFontconfigUtils::Shutdown();
sFontconfigUtils = nullptr;
#ifdef MOZ_PANGO
gfxPangoFontGroup::Shutdown();
#else
delete gPlatformFonts;
gPlatformFonts = nullptr;
delete gPlatformFontAliases;
gPlatformFontAliases = nullptr;
delete gPrefFonts;
gPrefFonts = nullptr;
delete gCodepointsWithNoFonts;
gCodepointsWithNoFonts = nullptr;
#ifdef NS_FREE_PERMANENT_DATA
// do cairo cleanup *before* closing down the FTLibrary,
// otherwise we'll crash when the gfxPlatform destructor
// calls it (bug 605009)
cairo_debug_reset_static_data();
FT_Done_FreeType(gPlatformFTLibrary);
gPlatformFTLibrary = nullptr;
#endif
#endif
#if 0
// It would be nice to do this (although it might need to be after
@ -187,8 +137,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
return newSurface.forget();
}
#ifdef MOZ_PANGO
nsresult
gfxPlatformGtk::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
@ -270,188 +218,6 @@ gfxPlatformGtk::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
return true;
}
#else
nsresult
gfxPlatformGtk::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
aListOfFonts);
}
nsresult
gfxPlatformGtk::UpdateFontList()
{
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *fs = nullptr;
int32_t result = -1;
pat = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, nullptr);
fs = FcFontList(nullptr, pat, os);
for (int i = 0; i < fs->nfont; i++) {
char *str;
if (FcPatternGetString(fs->fonts[i], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
//printf("Family: %s\n", str);
nsAutoString name(NS_ConvertUTF8toUTF16(nsDependentCString(str)).get());
nsAutoString key(name);
ToLowerCase(key);
nsRefPtr<FontFamily> ff;
if (!gPlatformFonts->Get(key, &ff)) {
ff = new FontFamily(name);
gPlatformFonts->Put(key, ff);
}
FontEntry *fe = new FontEntry(ff->Name());
ff->AddFontEntry(fe);
if (FcPatternGetString(fs->fonts[i], FC_FILE, 0, (FcChar8 **) &str) == FcResultMatch) {
fe->mFilename = nsDependentCString(str);
//printf(" - file: %s\n", str);
}
int x;
if (FcPatternGetInteger(fs->fonts[i], FC_INDEX, 0, &x) == FcResultMatch) {
//printf(" - index: %d\n", x);
fe->mFTFontIndex = x;
} else {
fe->mFTFontIndex = 0;
}
fe->mWeight = gfxFontconfigUtils::GetThebesWeight(fs->fonts[i]);
//printf(" - weight: %d\n", fe->mWeight);
fe->mItalic = false;
if (FcPatternGetInteger(fs->fonts[i], FC_SLANT, 0, &x) == FcResultMatch) {
switch (x) {
case FC_SLANT_ITALIC:
case FC_SLANT_OBLIQUE:
fe->mItalic = true;
}
//printf(" - slant: %d\n", x);
}
//if (FcPatternGetInteger(fs->fonts[i], FC_WIDTH, 0, &x) == FcResultMatch)
//printf(" - width: %d\n", x);
// XXX deal with font-stretch stuff later
}
if (pat)
FcPatternDestroy(pat);
if (os)
FcObjectSetDestroy(os);
if (fs)
FcFontSetDestroy(fs);
return sFontconfigUtils->UpdateFontList();
}
nsresult
gfxPlatformGtk::ResolveFontName(const nsAString& aFontName,
FontResolverCallback aCallback,
void *aClosure,
bool& aAborted)
{
nsAutoString name(aFontName);
ToLowerCase(name);
nsRefPtr<FontFamily> ff;
if (gPlatformFonts->Get(name, &ff) ||
gPlatformFontAliases->Get(name, &ff)) {
aAborted = !(*aCallback)(ff->Name(), aClosure);
return NS_OK;
}
nsAutoCString utf8Name = NS_ConvertUTF16toUTF8(aFontName);
FcPattern *npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, nullptr);
FcFontSet *nfs = FcFontList(nullptr, npat, nos);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
if (FcPatternGetString(nfs->fonts[k], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
nsAutoString altName = NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str)));
ToLowerCase(altName);
if (gPlatformFonts->Get(altName, &ff)) {
//printf("Adding alias: %s -> %s\n", utf8Name.get(), str);
gPlatformFontAliases->Put(name, ff);
aAborted = !(*aCallback)(NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str))), aClosure);
goto DONE;
}
}
FcPatternDestroy(npat);
FcObjectSetDestroy(nos);
FcFontSetDestroy(nfs);
{
npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcPatternDel(npat, FC_LANG);
FcConfigSubstitute(nullptr, npat, FcMatchPattern);
FcDefaultSubstitute(npat);
nos = FcObjectSetBuild(FC_FAMILY, nullptr);
nfs = FcFontList(nullptr, npat, nos);
FcResult fresult;
FcPattern *match = FcFontMatch(nullptr, npat, &fresult);
if (match)
FcFontSetAdd(nfs, match);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
if (FcPatternGetString(nfs->fonts[k], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
nsAutoString altName = NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str)));
ToLowerCase(altName);
if (gPlatformFonts->Get(altName, &ff)) {
//printf("Adding alias: %s -> %s\n", utf8Name.get(), str);
gPlatformFontAliases->Put(name, ff);
aAborted = !(*aCallback)(NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str))), aClosure);
goto DONE;
}
}
}
DONE:
FcPatternDestroy(npat);
FcObjectSetDestroy(nos);
FcFontSetDestroy(nfs);
return NS_OK;
}
nsresult
gfxPlatformGtk::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
{
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
}
gfxFontGroup *
gfxPlatformGtk::CreateFontGroup(const nsAString &aFamilies,
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet)
{
return new gfxFT2FontGroup(aFamilies, aStyle, aUserFontSet);
}
#endif
static int32_t sDPI = 0;
int32_t
@ -637,90 +403,6 @@ gfxPlatformGtk::GetPlatformCMSOutputProfile()
}
#ifndef MOZ_PANGO
FT_Library
gfxPlatformGtk::GetFTLibrary()
{
return gPlatformFTLibrary;
}
FontFamily *
gfxPlatformGtk::FindFontFamily(const nsAString& aName)
{
nsAutoString name(aName);
ToLowerCase(name);
nsRefPtr<FontFamily> ff;
if (!gPlatformFonts->Get(name, &ff)) {
return nullptr;
}
return ff.get();
}
FontEntry *
gfxPlatformGtk::FindFontEntry(const nsAString& aName, const gfxFontStyle& aFontStyle)
{
nsRefPtr<FontFamily> ff = FindFontFamily(aName);
if (!ff)
return nullptr;
return ff->FindFontEntry(aFontStyle);
}
static PLDHashOperator
FindFontForCharProc(nsStringHashKey::KeyType aKey,
nsRefPtr<FontFamily>& aFontFamily,
void* aUserArg)
{
GlobalFontMatch *data = (GlobalFontMatch*)aUserArg;
aFontFamily->FindFontForChar(data);
return PL_DHASH_NEXT;
}
already_AddRefed<gfxFont>
gfxPlatformGtk::FindFontForChar(uint32_t aCh, gfxFont *aFont)
{
if (!gPlatformFonts || !gCodepointsWithNoFonts)
return nullptr;
// is codepoint with no matching font? return null immediately
if (gCodepointsWithNoFonts->test(aCh)) {
return nullptr;
}
GlobalFontMatch data(aCh, GetScriptCode(aCh),
(aFont ? aFont->GetStyle() : nullptr));
// find fonts that support the character
gPlatformFonts->Enumerate(FindFontForCharProc, &data);
if (data.mBestMatch) {
nsRefPtr<gfxFT2Font> font =
gfxFT2Font::GetOrMakeFont(static_cast<FontEntry*>(data.mBestMatch.get()),
aFont->GetStyle());
gfxFont* ret = font.forget().get();
return already_AddRefed<gfxFont>(ret);
}
// no match? add to set of non-matching codepoints
gCodepointsWithNoFonts->set(aCh);
return nullptr;
}
bool
gfxPlatformGtk::GetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList)
{
return gPrefFonts->Get(aKey, aFontEntryList);
}
void
gfxPlatformGtk::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList)
{
gPrefFonts->Put(aKey, aFontEntryList);
}
#endif
#if (MOZ_WIDGET_GTK == 2)
void
gfxPlatformGtk::SetGdkDrawable(cairo_surface_t *target,

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

@ -17,11 +17,6 @@ extern "C" {
#endif
class gfxFontconfigUtils;
#ifndef MOZ_PANGO
class FontFamily;
class FontEntry;
typedef struct FT_LibraryRec_ *FT_Library;
#endif
class gfxPlatformGtk : public gfxPlatform {
public:
@ -54,7 +49,6 @@ public:
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet);
#ifdef MOZ_PANGO
/**
* Look up a local platform font using the full font face name (needed to
* support @font-face src local() )
@ -76,19 +70,6 @@ public:
*/
virtual bool IsFontFormatSupported(nsIURI *aFontURI,
uint32_t aFormatFlags);
#endif
#ifndef MOZ_PANGO
FontFamily *FindFontFamily(const nsAString& aName);
FontEntry *FindFontEntry(const nsAString& aFamilyName, const gfxFontStyle& aFontStyle);
already_AddRefed<gfxFont> FindFontForChar(uint32_t aCh, gfxFont *aFont);
bool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList);
void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
#endif
#ifndef MOZ_PANGO
FT_Library GetFTLibrary();
#endif
#if (MOZ_WIDGET_GTK == 2)
static void SetGdkDrawable(cairo_surface_t *target,

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

@ -27,13 +27,9 @@
#include "gfxQPainterSurface.h"
#include "nsUnicodeProperties.h"
#ifdef MOZ_PANGO
#include "gfxPangoFonts.h"
#include "gfxContext.h"
#include "gfxUserFontSet.h"
#else
#include "gfxFT2Fonts.h"
#endif
#include "nsUnicharUtils.h"
@ -47,11 +43,6 @@
#include "qcms.h"
#ifndef MOZ_PANGO
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
#include "mozilla/Preferences.h"
using namespace mozilla;
@ -75,16 +66,6 @@ static void do_qt_pixmap_unref (void *data)
static gfxImageFormat sOffscreenFormat = gfxImageFormatRGB24;
#ifndef MOZ_PANGO
typedef nsDataHashtable<nsStringHashKey, nsRefPtr<FontFamily> > FontTable;
typedef nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<FontEntry> > > PrefFontTable;
static FontTable *gPlatformFonts = nullptr;
static FontTable *gPlatformFontAliases = nullptr;
static PrefFontTable *gPrefFonts = nullptr;
static gfxSparseBitSet *gCodepointsWithNoFonts = nullptr;
static FT_Library gPlatformFTLibrary = nullptr;
#endif
gfxQtPlatform::gfxQtPlatform()
{
mPrefFonts.Init(50);
@ -92,20 +73,7 @@ gfxQtPlatform::gfxQtPlatform()
if (!sFontconfigUtils)
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
#ifdef MOZ_PANGO
g_type_init();
#else
FT_Init_FreeType(&gPlatformFTLibrary);
gPlatformFonts = new FontTable();
gPlatformFonts->Init(100);
gPlatformFontAliases = new FontTable();
gPlatformFontAliases->Init(100);
gPrefFonts = new PrefFontTable();
gPrefFonts->Init(100);
gCodepointsWithNoFonts = new gfxSparseBitSet();
UpdateFontList();
#endif
nsresult rv;
// 0 - default gfxQPainterSurface
@ -148,23 +116,7 @@ gfxQtPlatform::~gfxQtPlatform()
gfxFontconfigUtils::Shutdown();
sFontconfigUtils = nullptr;
#ifdef MOZ_PANGO
gfxPangoFontGroup::Shutdown();
#else
delete gPlatformFonts;
gPlatformFonts = nullptr;
delete gPlatformFontAliases;
gPlatformFontAliases = nullptr;
delete gPrefFonts;
gPrefFonts = nullptr;
delete gCodepointsWithNoFonts;
gCodepointsWithNoFonts = nullptr;
cairo_debug_reset_static_data();
FT_Done_FreeType(gPlatformFTLibrary);
gPlatformFTLibrary = nullptr;
#endif
#if 0
// It would be nice to do this (although it might need to be after
@ -259,103 +211,6 @@ gfxQtPlatform::GetFontList(nsIAtom *aLangGroup,
nsresult
gfxQtPlatform::UpdateFontList()
{
#ifndef MOZ_PANGO
FcPattern *pat = nullptr;
FcObjectSet *os = nullptr;
FcFontSet *fs = nullptr;
pat = FcPatternCreate();
os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_INDEX, FC_WEIGHT, FC_SLANT, FC_WIDTH, nullptr);
fs = FcFontList(nullptr, pat, os);
for (int i = 0; i < fs->nfont; i++) {
char *str;
if (FcPatternGetString(fs->fonts[i], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
nsAutoString name(NS_ConvertUTF8toUTF16(nsDependentCString(str)).get());
nsAutoString key(name);
ToLowerCase(key);
nsRefPtr<FontFamily> ff;
if (!gPlatformFonts->Get(key, &ff)) {
ff = new FontFamily(name);
gPlatformFonts->Put(key, ff);
}
FontEntry *fe = new FontEntry(ff->Name());
ff->AddFontEntry(fe);
if (FcPatternGetString(fs->fonts[i], FC_FILE, 0, (FcChar8 **) &str) == FcResultMatch) {
fe->mFilename = nsDependentCString(str);
}
int x;
if (FcPatternGetInteger(fs->fonts[i], FC_INDEX, 0, &x) == FcResultMatch) {
fe->mFTFontIndex = x;
} else {
fe->mFTFontIndex = 0;
}
if (FcPatternGetInteger(fs->fonts[i], FC_WEIGHT, 0, &x) == FcResultMatch) {
switch(x) {
case 0:
fe->mWeight = 100;
break;
case 40:
fe->mWeight = 200;
break;
case 50:
fe->mWeight = 300;
break;
case 75:
case 80:
fe->mWeight = 400;
break;
case 100:
fe->mWeight = 500;
break;
case 180:
fe->mWeight = 600;
break;
case 200:
fe->mWeight = 700;
break;
case 205:
fe->mWeight = 800;
break;
case 210:
fe->mWeight = 900;
break;
default:
// rough estimate
fe->mWeight = (((x * 4) + 100) / 100) * 100;
break;
}
}
fe->mItalic = false;
if (FcPatternGetInteger(fs->fonts[i], FC_SLANT, 0, &x) == FcResultMatch) {
switch (x) {
case FC_SLANT_ITALIC:
case FC_SLANT_OBLIQUE:
fe->mItalic = true;
}
}
// XXX deal with font-stretch (FC_WIDTH) stuff later
}
if (pat)
FcPatternDestroy(pat);
if (os)
FcObjectSetDestroy(os);
if (fs)
FcFontSetDestroy(fs);
#endif
return sFontconfigUtils->UpdateFontList();
}
@ -365,80 +220,8 @@ gfxQtPlatform::ResolveFontName(const nsAString& aFontName,
void *aClosure,
bool& aAborted)
{
#ifdef MOZ_PANGO
return sFontconfigUtils->ResolveFontName(aFontName, aCallback,
aClosure, aAborted);
#else
nsAutoString name(aFontName);
ToLowerCase(name);
nsRefPtr<FontFamily> ff;
if (gPlatformFonts->Get(name, &ff) ||
gPlatformFontAliases->Get(name, &ff)) {
aAborted = !(*aCallback)(ff->Name(), aClosure);
return NS_OK;
}
nsAutoCString utf8Name = NS_ConvertUTF16toUTF8(aFontName);
FcPattern *npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcObjectSet *nos = FcObjectSetBuild(FC_FAMILY, nullptr);
FcFontSet *nfs = FcFontList(nullptr, npat, nos);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
if (FcPatternGetString(nfs->fonts[k], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
nsAutoString altName = NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str)));
ToLowerCase(altName);
if (gPlatformFonts->Get(altName, &ff)) {
gPlatformFontAliases->Put(name, ff);
aAborted = !(*aCallback)(NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str))), aClosure);
goto DONE;
}
}
FcPatternDestroy(npat);
FcObjectSetDestroy(nos);
FcFontSetDestroy(nfs);
{
npat = FcPatternCreate();
FcPatternAddString(npat, FC_FAMILY, (FcChar8*)utf8Name.get());
FcPatternDel(npat, FC_LANG);
FcConfigSubstitute(nullptr, npat, FcMatchPattern);
FcDefaultSubstitute(npat);
nos = FcObjectSetBuild(FC_FAMILY, nullptr);
nfs = FcFontList(nullptr, npat, nos);
FcResult fresult;
FcPattern *match = FcFontMatch(nullptr, npat, &fresult);
if (match)
FcFontSetAdd(nfs, match);
for (int k = 0; k < nfs->nfont; k++) {
FcChar8 *str;
if (FcPatternGetString(nfs->fonts[k], FC_FAMILY, 0, (FcChar8 **) &str) != FcResultMatch)
continue;
nsAutoString altName = NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str)));
ToLowerCase(altName);
if (gPlatformFonts->Get(altName, &ff)) {
gPlatformFontAliases->Put(name, ff);
aAborted = !(*aCallback)(NS_ConvertUTF8toUTF16(nsDependentCString(reinterpret_cast<char*>(str))), aClosure);
goto DONE;
}
}
}
DONE:
FcPatternDestroy(npat);
FcObjectSetDestroy(nos);
FcFontSetDestroy(nfs);
return NS_OK;
#endif
}
nsresult
@ -452,14 +235,9 @@ gfxQtPlatform::CreateFontGroup(const nsAString &aFamilies,
const gfxFontStyle *aStyle,
gfxUserFontSet* aUserFontSet)
{
#ifdef MOZ_PANGO
return new gfxPangoFontGroup(aFamilies, aStyle, aUserFontSet);
#else
return new gfxFT2FontGroup(aFamilies, aStyle, aUserFontSet);
#endif
}
#ifdef MOZ_PANGO
gfxFontEntry*
gfxQtPlatform::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
const nsAString& aFontName)
@ -501,7 +279,6 @@ gfxQtPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
// no format hint set, need to look at data
return true;
}
#endif
qcms_profile*
gfxQtPlatform::GetPlatformCMSOutputProfile()
@ -509,91 +286,6 @@ gfxQtPlatform::GetPlatformCMSOutputProfile()
return nullptr;
}
#ifndef MOZ_PANGO
FT_Library
gfxQtPlatform::GetFTLibrary()
{
return gPlatformFTLibrary;
}
FontFamily *
gfxQtPlatform::FindFontFamily(const nsAString& aName)
{
nsAutoString name(aName);
ToLowerCase(name);
nsRefPtr<FontFamily> ff;
if (!gPlatformFonts->Get(name, &ff)) {
return nullptr;
}
return ff.get();
}
FontEntry *
gfxQtPlatform::FindFontEntry(const nsAString& aName, const gfxFontStyle& aFontStyle)
{
nsRefPtr<FontFamily> ff = FindFontFamily(aName);
if (!ff)
return nullptr;
return ff->FindFontEntry(aFontStyle);
}
static PLDHashOperator
FindFontForCharProc(nsStringHashKey::KeyType aKey,
nsRefPtr<FontFamily>& aFontFamily,
void* aUserArg)
{
GlobalFontMatch *data = (GlobalFontMatch*)aUserArg;
aFontFamily->FindFontForChar(data);
return PL_DHASH_NEXT;
}
already_AddRefed<gfxFont>
gfxQtPlatform::FindFontForChar(uint32_t aCh, gfxFont *aFont)
{
if (!gPlatformFonts || !gCodepointsWithNoFonts)
return nullptr;
// is codepoint with no matching font? return null immediately
if (gCodepointsWithNoFonts->test(aCh)) {
return nullptr;
}
GlobalFontMatch data(aCh, GetScriptCode(aCh),
(aFont ? aFont->GetStyle() : nullptr));
// find fonts that support the character
gPlatformFonts->Enumerate(FindFontForCharProc, &data);
if (data.mBestMatch) {
nsRefPtr<gfxFT2Font> font =
gfxFT2Font::GetOrMakeFont(static_cast<FontEntry*>(data.mBestMatch.get()),
aFont->GetStyle());
gfxFont* ret = font.forget().get();
return already_AddRefed<gfxFont>(ret);
}
// no match? add to set of non-matching codepoints
gCodepointsWithNoFonts->set(aCh);
return nullptr;
}
bool
gfxQtPlatform::GetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> > *array)
{
return mPrefFonts.Get(aKey, array);
}
void
gfxQtPlatform::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> >& array)
{
mPrefFonts.Put(aKey, array);
}
#endif
int32_t
gfxQtPlatform::GetDPI()
{

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

@ -16,12 +16,6 @@
class gfxFontconfigUtils;
class QWidget;
#ifndef MOZ_PANGO
typedef struct FT_LibraryRec_ *FT_Library;
class FontFamily;
class FontEntry;
#endif
class gfxQtPlatform : public gfxPlatform {
public:
@ -63,7 +57,6 @@ public:
const gfxFontStyle *aStyle,
gfxUserFontSet* aUserFontSet);
#ifdef MOZ_PANGO
/**
* Look up a local platform font using the full font face name (needed to
* support @font-face src local() )
@ -85,22 +78,9 @@ public:
*/
virtual bool IsFontFormatSupported(nsIURI *aFontURI,
uint32_t aFormatFlags);
#endif
#ifndef MOZ_PANGO
FontFamily *FindFontFamily(const nsAString& aName);
FontEntry *FindFontEntry(const nsAString& aFamilyName, const gfxFontStyle& aFontStyle);
already_AddRefed<gfxFont> FindFontForChar(uint32_t aCh, gfxFont *aFont);
bool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList);
void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
#endif
void ClearPrefFonts() { mPrefFonts.Clear(); }
#ifndef MOZ_PANGO
FT_Library GetFTLibrary();
#endif
RenderMode GetRenderMode() { return mRenderMode; }
void SetRenderMode(RenderMode rmode) { mRenderMode = rmode; }

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

@ -209,7 +209,7 @@ typedef HRESULT (WINAPI*D3D11CreateDeviceFunc)(
ID3D11DeviceContext *ppImmediateContext
);
class GPUAdapterReporter : public MemoryMultiReporter
class GPUAdapterReporter : public nsIMemoryReporter
{
// Callers must Release the DXGIAdapter after use or risk mem-leak
static bool GetDXGIAdapter(IDXGIAdapter **DXGIAdapter)
@ -229,7 +229,7 @@ class GPUAdapterReporter : public MemoryMultiReporter
}
public:
GPUAdapterReporter() {}
NS_DECL_ISUPPORTS
NS_IMETHOD
CollectReports(nsIMemoryReporterCallback* aCb,
@ -339,6 +339,8 @@ public:
}
};
NS_IMPL_ISUPPORTS1(GPUAdapterReporter, nsIMemoryReporter)
static __inline void
BuildKeyNameFromFontName(nsAString &aName)
{

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

@ -103,6 +103,7 @@ elif CONFIG['MOZ_WIDGET_GTK']:
EXPORTS += [
'gfxFT2FontBase.h',
'gfxGdkNativeRenderer.h',
'gfxPangoFonts.h',
'gfxPDFSurface.h',
'gfxPlatformGtk.h',
'gfxPSSurface.h',
@ -113,6 +114,7 @@ elif CONFIG['MOZ_WIDGET_GTK']:
'gfxFT2FontBase.cpp',
'gfxFT2Utils.cpp',
'gfxGdkNativeRenderer.cpp',
'gfxPangoFonts.cpp',
'gfxPDFSurface.cpp',
'gfxPlatformGtk.cpp',
'gfxPSSurface.cpp',
@ -129,16 +131,6 @@ elif CONFIG['MOZ_WIDGET_GTK']:
'gfxXlibSurface.cpp',
]
if CONFIG['MOZ_PANGO']:
EXPORTS += ['gfxPangoFonts.h']
SOURCES += [
'gfxPangoFonts.cpp',
]
else:
EXPORTS += ['gfxFT2Fonts.h']
SOURCES += [
'gfxPangoFonts.cpp',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
EXPORTS += [
'gfxOS2Fonts.h',
@ -157,6 +149,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
EXPORTS += [
'gfxFT2FontBase.h',
'gfxPangoFonts.h',
'gfxPDFSurface.h',
'gfxQPainterSurface.h',
'gfxQtNativeRenderer.h',
@ -166,6 +159,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
'gfxFontconfigUtils.cpp',
'gfxFT2FontBase.cpp',
'gfxFT2Utils.cpp',
'gfxPangoFonts.cpp',
'gfxPDFSurface.cpp',
'gfxQPainterSurface.cpp',
'gfxQtPlatform.cpp',
@ -181,16 +175,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
'gfxXlibSurface.cpp',
]
if CONFIG['MOZ_PANGO']:
EXPORTS += ['gfxPangoFonts.h']
SOURCES += [
'gfxPangoFonts.cpp',
]
else:
EXPORTS += ['gfxFT2Fonts.h']
SOURCES += [
'gfxFT2Fonts.cpp',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXPORTS += [
'gfxD2DSurface.h',

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

@ -349,7 +349,7 @@ Decoder::PostFrameStop(FrameBlender::FrameAlpha aFrameAlpha /* = FrameBlender::k
}
mCurrentFrame->SetFrameDisposalMethod(aDisposalMethod);
mCurrentFrame->SetTimeout(aTimeout);
mCurrentFrame->SetRawTimeout(aTimeout);
mCurrentFrame->SetBlendMethod(aBlendMethod);
mCurrentFrame->ImageUpdated(mCurrentFrame->GetRect());

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