Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-02-21 13:21:36 +01:00
commit eeb86f607c
260 changed files with 4883 additions and 8830 deletions

View File

@ -118,8 +118,8 @@ this.AccessFu = {
Output.start();
TouchAdapter.start();
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
Services.obs.addObserver(this, 'remote-browser-shown', false);
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
Services.obs.addObserver(this, 'Accessibility:Focus', false);
@ -162,8 +162,8 @@ this.AccessFu = {
Utils.win.removeEventListener('TabClose', this);
Utils.win.removeEventListener('TabSelect', this);
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
Services.obs.removeObserver(this, 'in-process-browser-or-app-frame-shown');
Services.obs.removeObserver(this, 'remote-browser-shown');
Services.obs.removeObserver(this, 'inprocess-browser-shown');
Services.obs.removeObserver(this, 'Accessibility:NextObject');
Services.obs.removeObserver(this, 'Accessibility:PreviousObject');
Services.obs.removeObserver(this, 'Accessibility:Focus');
@ -304,11 +304,15 @@ this.AccessFu = {
case 'Accessibility:MoveByGranularity':
this.Input.moveByGranularity(JSON.parse(aData));
break;
case 'remote-browser-frame-shown':
case 'in-process-browser-or-app-frame-shown':
case 'remote-browser-shown':
case 'inprocess-browser-shown':
{
let mm = aSubject.QueryInterface(Ci.nsIFrameLoader).messageManager;
this._handleMessageManager(mm);
// Ignore notifications that aren't from a BrowserOrApp
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
if (!frameLoader.ownerIsBrowserOrAppFrame) {
return;
}
this._handleMessageManager(frameLoader.messageManager);
break;
}
}

View File

@ -756,6 +756,9 @@ pref("memory.free_dirty_pages", true);
// Enable the Linux-specific, system-wide memory reporter.
pref("memory.system_memory_reporter", true);
// Don't dump memory reports on OOM, by default.
pref("memory.dump_reports_on_oom", false);
pref("layout.imagevisibility.enabled", true);
pref("layout.imagevisibility.numscrollportwidths", 1);
pref("layout.imagevisibility.numscrollportheights", 1);

View File

@ -65,8 +65,8 @@ let devtoolsWidgetPanel = {
}
}
Services.obs.addObserver(this, 'remote-browser-frame-pending', false);
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
Services.obs.addObserver(this, 'remote-browser-pending', false);
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
Services.obs.addObserver(this, 'message-manager-disconnect', false);
let systemapp = document.querySelector('#systemapp');
@ -91,8 +91,8 @@ let devtoolsWidgetPanel = {
this.untrackApp(manifest);
}
Services.obs.removeObserver(this, 'remote-browser-frame-pending');
Services.obs.removeObserver(this, 'in-process-browser-or-app-frame-shown');
Services.obs.removeObserver(this, 'remote-browser-pending');
Services.obs.removeObserver(this, 'inprocess-browser-shown');
Services.obs.removeObserver(this, 'message-manager-disconnect');
this._client.close();
@ -150,11 +150,15 @@ let devtoolsWidgetPanel = {
switch(topic) {
// listen for frame creation in OOP (device) as well as in parent process (b2g desktop)
case 'remote-browser-frame-pending':
case 'in-process-browser-or-app-frame-shown':
case 'remote-browser-pending':
case 'inprocess-browser-shown':
let frameLoader = subject;
// get a ref to the app <iframe>
frameLoader.QueryInterface(Ci.nsIFrameLoader);
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
return;
}
manifestURL = frameLoader.ownerElement.appManifestURL;
if (!manifestURL) // Ignore all frames but apps
return;

View File

@ -170,12 +170,16 @@ let ErrorPage = {
},
init: function errorPageInit() {
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
Services.obs.addObserver(this, 'remote-browser-shown', false);
},
observe: function errorPageObserve(aSubject, aTopic, aData) {
let frameLoader = aSubject.QueryInterface(Ci.nsIFrameLoader);
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
return;
}
this._listenError(frameLoader);
}
};

View File

@ -977,11 +977,11 @@ pref("dom.ipc.plugins.enabled.x86_64", true);
pref("dom.ipc.plugins.enabled", true);
#endif
#if defined(NIGHTLY_BUILD) && defined(XP_MACOSX)
// In Nightly, browser.tabs.remote is enabled on platforms that
// support OMTC. However, users won't actually get remote tabs unless
// they enable browser.tabs.remote.autostart or they use the "New OOP
// Window" menu option.
#if defined(NIGHTLY_BUILD)
// browser.tabs.remote is enabled on nightly. However, users won't
// actually get remote tabs unless they enable
// browser.tabs.remote.autostart or they use the "New OOP Window" menu
// option.
pref("browser.tabs.remote", true);
#else
pref("browser.tabs.remote", false);

View File

@ -3197,7 +3197,12 @@ function OpenBrowserWindow(options)
}
if (options && options.remote) {
extraFeatures += ",remote";
let omtcEnabled = gPrefService.getBoolPref("layers.offmainthreadcomposition.enabled");
if (!omtcEnabled) {
alert("To use out-of-process tabs, you must set the layers.offmainthreadcomposition.enabled preference and restart. Opening a normal window instead.");
} else {
extraFeatures += ",remote";
}
} else if (options && options.remote === false) {
extraFeatures += ",non-remote";
}

View File

@ -2492,6 +2492,15 @@
if (this.tabs.length == 1)
return null;
let event = new CustomEvent("TabBecomingWindow", {
bubbles: true,
cancelable: true
});
aTab.dispatchEvent(event);
if (event.defaultPrevented) {
return null;
}
var options = "chrome,dialog=no,all";
for (var name in aOptions)
options += "," + name + "=" + aOptions[name];

View File

@ -33,6 +33,7 @@ const PanelUI = {
};
},
_initialized: false,
init: function() {
for (let [k, v] of Iterator(this.kElements)) {
// Need to do fresh let-bindings per iteration
@ -46,6 +47,7 @@ const PanelUI = {
this.menuButton.addEventListener("mousedown", this);
this.menuButton.addEventListener("keypress", this);
this._initialized = true;
},
_eventListenersAdded: false,
@ -201,6 +203,18 @@ const PanelUI = {
return this._readyPromise;
}
this._readyPromise = Task.spawn(function() {
if (!this._initialized) {
let delayedStartupDeferred = Promise.defer();
let delayedStartupObserver = (aSubject, aTopic, aData) => {
if (aSubject == window) {
Services.obs.removeObserver(delayedStartupObserver, "browser-delayed-startup-finished");
delayedStartupDeferred.resolve();
}
};
Services.obs.addObserver(delayedStartupObserver, "browser-delayed-startup-finished", false);
yield delayedStartupDeferred.promise;
}
this.contents.setAttributeNS("http://www.w3.org/XML/1998/namespace", "lang",
getLocale());
if (!this._scrollWidth) {

View File

@ -42,11 +42,17 @@ this.UITour = {
seenPageIDs: new Set(),
pageIDSourceTabs: new WeakMap(),
pageIDSourceWindows: new WeakMap(),
/* Map from browser windows to a set of tabs in which a tour is open */
originTabs: new WeakMap(),
/* Map from browser windows to a set of pinned tabs opened by (a) tour(s) */
pinnedTabs: new WeakMap(),
urlbarCapture: new WeakMap(),
appMenuOpenForAnnotation: new Set(),
_detachingTab: false,
_queuedEvents: [],
_pendingDoc: null,
highlightEffects: ["random", "wobble", "zoom", "color"],
targets: new Map([
["accountStatus", {
@ -138,7 +144,20 @@ this.UITour = {
return false;
let window = this.getChromeWindow(contentDocument);
// Do this before bailing if there's no tab, so later we can pick up the pieces:
window.gBrowser.tabContainer.addEventListener("TabSelect", this);
let tab = window.gBrowser._getTabForContentWindow(contentDocument.defaultView);
if (!tab) {
// This should only happen while detaching a tab:
if (this._detachingTab) {
this._queuedEvents.push(aEvent);
this._pendingDoc = Cu.getWeakReference(contentDocument);
return;
}
Cu.reportError("Discarding tabless UITour event (" + action + ") while not detaching a tab." +
"This shouldn't happen!");
return;
}
switch (action) {
case "registerPageID": {
@ -299,10 +318,10 @@ this.UITour = {
if (!this.originTabs.has(window))
this.originTabs.set(window, new Set());
this.originTabs.get(window).add(tab);
this.originTabs.get(window).add(tab);
tab.addEventListener("TabClose", this);
window.gBrowser.tabContainer.addEventListener("TabSelect", this);
tab.addEventListener("TabBecomingWindow", this);
window.addEventListener("SSWindowClosing", this);
return true;
@ -316,6 +335,9 @@ this.UITour = {
break;
}
case "TabBecomingWindow":
this._detachingTab = true;
// Fall through
case "TabClose": {
let tab = aEvent.target;
if (this.pageIDSourceTabs.has(tab)) {
@ -346,13 +368,34 @@ this.UITour = {
}
let window = aEvent.target.ownerDocument.defaultView;
let selectedTab = window.gBrowser.selectedTab;
let pinnedTab = this.pinnedTabs.get(window);
if (pinnedTab && pinnedTab.tab == window.gBrowser.selectedTab)
if (pinnedTab && pinnedTab.tab == selectedTab)
break;
let originTabs = this.originTabs.get(window);
if (originTabs && originTabs.has(window.gBrowser.selectedTab))
if (originTabs && originTabs.has(selectedTab))
break;
let pendingDoc;
if (this._detachingTab && this._pendingDoc && (pendingDoc = this._pendingDoc.get())) {
if (selectedTab.linkedBrowser.contentDocument == pendingDoc) {
if (!this.originTabs.get(window)) {
this.originTabs.set(window, new Set());
}
this.originTabs.get(window).add(selectedTab);
this.pendingDoc = null;
this._detachingTab = false;
while (this._queuedEvents.length) {
try {
this.onPageEvent(this._queuedEvents.shift());
} catch (ex) {
Cu.reportError(ex);
}
}
break;
}
}
this.teardownTour(window);
break;
}
@ -413,8 +456,10 @@ this.UITour = {
let originTabs = this.originTabs.get(aWindow);
if (originTabs) {
for (let tab of originTabs)
for (let tab of originTabs) {
tab.removeEventListener("TabClose", this);
tab.removeEventListener("TabBecomingWindow", this);
}
}
this.originTabs.delete(aWindow);

View File

@ -12,6 +12,7 @@ skip-if = os == "linux" # Intermittent failures, bug 951965
[browser_UITour2.js]
[browser_UITour3.js]
[browser_UITour_panel_close_annotation.js]
[browser_UITour_detach_tab.js]
[browser_UITour_registerPageID.js]
[browser_UITour_sync.js]
[browser_taskbar_preview.js]

View File

@ -0,0 +1,80 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Tests that annotations disappear when their target is hidden.
*/
"use strict";
let gTestTab;
let gContentAPI;
let gContentWindow;
let gContentDoc;
let highlight = document.getElementById("UITourHighlight");
let tooltip = document.getElementById("UITourTooltip");
Components.utils.import("resource:///modules/UITour.jsm");
function test() {
registerCleanupFunction(function() {
gContentDoc = null;
});
UITourTest();
}
let tests = [
function test_move_tab_to_new_window(done) {
let gOpenedWindow;
let onVisibilityChange = (aEvent) => {
if (!document.hidden && window != UITour.getChromeWindow(aEvent.target)) {
gContentAPI.showHighlight("appMenu");
}
};
let onDOMWindowDestroyed = (aWindow, aTopic, aData) => {
if (gOpenedWindow && aWindow == gOpenedWindow) {
Services.obs.removeObserver(onDOMWindowDestroyed, "dom-window-destroyed", false);
done();
}
};
let onBrowserDelayedStartup = (aWindow, aTopic, aData) => {
gOpenedWindow = aWindow;
Services.obs.removeObserver(onBrowserDelayedStartup, "browser-delayed-startup-finished");
try {
let newWindowHighlight = gOpenedWindow.document.getElementById("UITourHighlight");
let selectedTab = aWindow.gBrowser.selectedTab;
is(selectedTab.linkedBrowser && selectedTab.linkedBrowser.contentDocument, gContentDoc, "Document should be selected in new window");
ok(UITour.originTabs && UITour.originTabs.has(aWindow), "Window should be known");
ok(UITour.originTabs.get(aWindow).has(selectedTab), "Tab should be known");
waitForElementToBeVisible(newWindowHighlight, function checkHighlightIsThere() {
gContentAPI.showMenu("appMenu");
isnot(aWindow.PanelUI.panel.state, "closed", "Panel should be open");
ok(aWindow.PanelUI.contents.children.length > 0, "Panel contents should have children");
gContentAPI.hideHighlight();
gContentAPI.hideMenu("appMenu");
gTestTab = null;
aWindow.close();
}, "Highlight should be shown in new window.");
} catch (ex) {
Cu.reportError(ex);
ok(false, "An error occurred running UITour tab detach test.");
} finally {
gContentDoc.removeEventListener("visibilitychange", onVisibilityChange, false);
Services.obs.addObserver(onDOMWindowDestroyed, "dom-window-destroyed", false);
}
};
Services.obs.addObserver(onBrowserDelayedStartup, "browser-delayed-startup-finished", false);
// NB: we're using this rather than gContentWindow.document because the latter wouldn't
// have an XRayWrapper, and we need to compare this to the doc we get using this method
// later on...
gContentDoc = gBrowser.selectedTab.linkedBrowser.contentDocument;
gContentDoc.addEventListener("visibilitychange", onVisibilityChange, false);
gContentAPI.showHighlight("appMenu");
waitForElementToBeVisible(highlight, function checkForInitialHighlight() {
gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
});
},
];

View File

@ -78,7 +78,7 @@ function is_element_hidden(element, msg) {
}
function loadUITourTestPage(callback, host = "https://example.com/") {
if (gTestTab)
if (gTestTab)
gBrowser.removeTab(gTestTab);
let url = getRootDirectory(gTestPath) + "uitour.html";

View File

@ -18,6 +18,9 @@
[App]
Vendor=@MOZ_APP_VENDOR@
Name=@MOZ_APP_BASENAME@
#ifdef MOZ_APP_DISPLAYNAME
CodeName=@MOZ_APP_DISPLAYNAME@
#endif
Version=@MOZ_APP_VERSION@
#ifdef MOZ_APP_PROFILE
Profile=@MOZ_APP_PROFILE@

View File

@ -30,6 +30,9 @@ for var in ('GRE_MILESTONE', 'MOZ_APP_VERSION', 'MOZ_APP_BASENAME',
'ACCEPTED_MAR_CHANNEL_IDS'):
DEFINES[var] = CONFIG[var]
if CONFIG['MOZ_APP_DISPLAYNAME'] != CONFIG['MOZ_APP_BASENAME']:
DEFINES['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME']
if CONFIG['MOZ_BUILD_APP'] == 'browser':
DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True

View File

@ -89,7 +89,7 @@ class MachCommands(MachCommandBase):
env = os.environ.copy()
env['G_SLICE'] = 'always-malloc'
env['XPCOM_CC_RUN_DURING_SHUTDOWN'] = '1'
env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1'
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['XPCOM_DEBUG_BREAK'] = 'warn'

View File

@ -4398,6 +4398,19 @@ AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
dnl ========================================================
dnl Disable printing
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(printing,
[ --disable-printing Disable printing support],
NS_PRINTING=,
NS_PRINTING=1)
if test "$NS_PRINTING"; then
AC_DEFINE(NS_PRINTING)
AC_DEFINE(NS_PRINT_PREVIEW)
fi
dnl ========================================================
dnl = QT support
dnl ========================================================
@ -4418,19 +4431,20 @@ then
case $QT_VERSION in
5.*)
AC_MSG_RESULT("Using qt5: $QT_VERSION")
PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5OpenGL Qt5Widgets Qt5PrintSupport, ,
PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
[
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
])
QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
;;
4.*)
AC_MSG_RESULT("Using qt4: $QT_VERSION")
PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL, ,
[
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qt4 development package, (On Ubuntu, you might try installing the packages libqt4-dev libqt4-opengl-dev.)])
])
if test "$NS_PRINTING"; then
PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
[
AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
])
MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
fi
;;
*)
AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
@ -4447,20 +4461,15 @@ then
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
case $QT_VERSION in
5.*)
AC_MSG_RESULT("Using qt5: $QT_VERSION")
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml -lQt5OpenGL"
MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtWidgets"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
;;
4.*)
AC_MSG_RESULT("Using qt4: $QT_VERSION")
MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
if test "$NS_PRINTING"; then
MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
fi
;;
*)
AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
@ -4471,12 +4480,10 @@ then
HOST_RCC="$QTDIR/bin/rcc"
fi
if test -z "$HOST_MOC"; then
AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
incorrect])
AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
fi
if test -z "$HOST_RCC"; then
AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
incorrect])
AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
fi
MOC=$HOST_MOC
@ -4525,6 +4532,30 @@ incorrect])
])
fi
MOZ_ENABLE_QT5FEEDBACK=
PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
MOZ_ENABLE_QT5FEEDBACK=1,
MOZ_ENABLE_QT5FEEDBACK=)
if test "$MOZ_ENABLE_QT5FEEDBACK"; then
MOZ_ENABLE_QT5FEEDBACK=1
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
fi
MOZ_ENABLE_QT5GEOPOSITION=
PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
MOZ_ENABLE_QT5GEOPOSITION=1,
MOZ_ENABLE_QT5GEOPOSITION=)
if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
MOZ_ENABLE_QT5GEOPOSITION=1
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
fi
if test "$MOZ_ENABLE_CONTENTACTION"; then
MOZ_ENABLE_CONTENTACTION=1
AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
@ -4960,19 +4991,6 @@ if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
fi
dnl ========================================================
dnl Disable printing
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(printing,
[ --disable-printing Disable printing support],
NS_PRINTING=,
NS_PRINTING=1)
if test "$NS_PRINTING"; then
AC_DEFINE(NS_PRINTING)
AC_DEFINE(NS_PRINT_PREVIEW)
fi
dnl Turn off webrtc for OS's we don't handle yet, but allow
dnl --enable-webrtc to override. Can disable for everything in
dnl the master list above.

View File

@ -112,7 +112,7 @@ interface nsIContentViewManager : nsISupports
readonly attribute nsIContentView rootContentView;
};
[scriptable, builtinclass, uuid(4c9f91c0-7a5d-11e3-981f-0800200c9a66)]
[scriptable, builtinclass, uuid(a723673b-a26e-4cc6-ae23-ec70df9d97c9)]
interface nsIFrameLoader : nsISupports
{
/**
@ -280,6 +280,11 @@ interface nsIFrameLoader : nsISupports
* have a notion of visibility in the parent process when frames are OOP.
*/
[infallible] attribute boolean visible;
/**
* Find out whether the owner content really is a browser or app frame
*/
readonly attribute boolean ownerIsBrowserOrAppFrame;
};
%{C++

View File

@ -5842,9 +5842,7 @@ nsContentUtils::IsUserFocusIgnored(nsINode* aNode)
return true;
}
nsPIDOMWindow* win = aNode->OwnerDoc()->GetWindow();
if (win) {
aNode = win->GetFrameElementInternal();
}
aNode = win ? win->GetFrameElementInternal() : nullptr;
}
return false;

View File

@ -462,9 +462,9 @@ nsFrameLoader::ReallyStartLoadingInternal()
if (!mRemoteBrowser) {
if (!mPendingFrameSent) {
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (OwnerIsBrowserOrAppFrame() && os && !mRemoteBrowserInitialized) {
if (os && !mRemoteBrowserInitialized) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"remote-browser-frame-pending", nullptr);
"remote-browser-pending", nullptr);
mPendingFrameSent = true;
}
}
@ -995,14 +995,14 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size,
EnsureMessageManager();
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (OwnerIsBrowserOrAppFrame() && os && !mRemoteBrowserInitialized) {
if (os && !mRemoteBrowserInitialized) {
if (!mPendingFrameSent) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"remote-browser-frame-pending", nullptr);
"remote-browser-pending", nullptr);
mPendingFrameSent = true;
}
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"remote-browser-frame-shown", nullptr);
"remote-browser-shown", nullptr);
mRemoteBrowserInitialized = true;
}
} else {
@ -1449,6 +1449,14 @@ nsFrameLoader::OwnerIsBrowserOrAppFrame()
return browserFrame ? browserFrame->GetReallyIsBrowserOrApp() : false;
}
// The xpcom getter version
NS_IMETHODIMP
nsFrameLoader::GetOwnerIsBrowserOrAppFrame(bool* aResult)
{
*aResult = OwnerIsBrowserOrAppFrame();
return NS_OK;
}
bool
nsFrameLoader::OwnerIsAppFrame()
{
@ -1715,19 +1723,17 @@ nsFrameLoader::MaybeCreateDocShell()
mDocShell->SetIsBrowserInsideApp(containingAppId);
}
if (OwnerIsBrowserOrAppFrame()) {
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"in-process-browser-or-app-frame-shown", nullptr);
}
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this),
"inprocess-browser-shown", nullptr);
}
if (mMessageManager) {
mMessageManager->LoadFrameScript(
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true,
/* aRunInGlobalScope */ true);
}
if (OwnerIsBrowserOrAppFrame() && mMessageManager) {
mMessageManager->LoadFrameScript(
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true,
/* aRunInGlobalScope */ true);
}
return NS_OK;

View File

@ -460,7 +460,7 @@ private:
// forwards some input events to out-of-process content.
uint32_t mEventMode;
// Indicate if we have sent 'remote-browser-frame-pending'.
// Indicate if we have sent 'remote-browser-pending'.
bool mPendingFrameSent;
};

0
content/canvas/src/CanvasRenderingContext2D.cpp Normal file → Executable file
View File

View File

@ -1220,10 +1220,8 @@ void
WebGLContext::DummyFramebufferOperation(const char *info)
{
GLenum status = CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (status == LOCAL_GL_FRAMEBUFFER_COMPLETE)
return;
else
return ErrorInvalidFramebufferOperation("%s: incomplete framebuffer", info);
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE)
ErrorInvalidFramebufferOperation("%s: incomplete framebuffer", info);
}
// We use this timer for many things. Here are the things that it is activated for:

View File

@ -944,6 +944,8 @@ protected:
// -------------------------------------------------------------------------
// Validation functions (implemented in WebGLContextValidate.cpp)
GLenum BaseTexFormat(GLenum internalFormat) const;
bool InitAndValidateGL();
bool ValidateBlendEquationEnum(GLenum cap, const char *info);
bool ValidateBlendFuncDstEnum(GLenum mode, const char *info);
@ -953,8 +955,7 @@ protected:
bool ValidateComparisonEnum(GLenum target, const char *info);
bool ValidateStencilOpEnum(GLenum action, const char *info);
bool ValidateFaceEnum(GLenum face, const char *info);
bool ValidateTexFormatAndType(GLenum format, GLenum type, int jsArrayType,
uint32_t *texelSize, const char *info);
bool ValidateTexInputData(GLenum type, int jsArrayType, WebGLTexImageFunc func);
bool ValidateDrawModeEnum(GLenum mode, const char *info);
bool ValidateAttribIndex(GLuint index, const char *info);
bool ValidateStencilParamsForDrawCall();
@ -962,10 +963,34 @@ protected:
bool ValidateGLSLVariableName(const nsAString& name, const char *info);
bool ValidateGLSLCharacter(char16_t c);
bool ValidateGLSLString(const nsAString& string, const char *info);
bool ValidateTexImage2DFormat(GLenum format, const char* info);
bool ValidateTexImage2DTarget(GLenum target, GLsizei width, GLsizei height, const char* info);
bool ValidateCompressedTextureSize(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, uint32_t byteLength, const char* info);
bool ValidateLevelWidthHeightForTarget(GLenum target, GLint level, GLsizei width, GLsizei height, const char* info);
bool ValidateTexImage(GLuint dims, GLenum target,
GLint level, GLint internalFormat,
GLint xoffset, GLint yoffset, GLint zoffset,
GLint width, GLint height, GLint depth,
GLint border, GLenum format, GLenum type,
WebGLTexImageFunc func);
bool ValidateTexImageTarget(GLuint dims, GLenum target, WebGLTexImageFunc func);
bool ValidateTexImageFormat(GLenum format, WebGLTexImageFunc func);
bool ValidateTexImageType(GLenum type, WebGLTexImageFunc func);
bool ValidateTexImageFormatAndType(GLenum format, GLenum type, WebGLTexImageFunc func);
bool ValidateTexImageSize(GLenum target, GLint level,
GLint width, GLint height, GLint depth,
WebGLTexImageFunc func);
bool ValidateTexSubImageSize(GLint x, GLint y, GLint z,
GLsizei width, GLsizei height, GLsizei depth,
GLsizei baseWidth, GLsizei baseHeight, GLsizei baseDepth,
WebGLTexImageFunc func);
bool ValidateCompTexImageSize(GLenum target, GLint level, GLenum format,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLsizei levelWidth, GLsizei levelHeight,
WebGLTexImageFunc func);
bool ValidateCompTexImageDataSize(GLint level, GLenum format,
GLsizei width, GLsizei height,
uint32_t byteLength, WebGLTexImageFunc func);
static uint32_t GetBitsPerTexel(GLenum format, GLenum type);
@ -1052,7 +1077,11 @@ private:
protected:
int32_t MaxTextureSizeForTarget(GLenum target) const {
return target == LOCAL_GL_TEXTURE_2D ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize;
MOZ_ASSERT(target == LOCAL_GL_TEXTURE_2D ||
(target >= LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X &&
target <= LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z),
"Invalid target enum");
return (target == LOCAL_GL_TEXTURE_2D) ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize;
}
/** like glBufferData but if the call may change the buffer size, checks any GL error generated

View File

@ -389,9 +389,17 @@ WebGLContext::CopyTexSubImage2D_base(GLenum target,
GLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
GLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
const char *info = sub ? "copyTexSubImage2D" : "copyTexImage2D";
const char* info = sub ? "copyTexSubImage2D" : "copyTexImage2D";
WebGLTexImageFunc func = sub ? WebGLTexImageFunc::CopyTexSubImage : WebGLTexImageFunc::CopyTexImage;
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, info)) {
// TODO: This changes with color_buffer_float. Reassess when the
// patch lands.
if (!ValidateTexImage(2, target, level, internalformat,
xoffset, yoffset, 0,
width, height, 0,
0, internalformat, LOCAL_GL_UNSIGNED_BYTE,
func))
{
return;
}
@ -415,10 +423,11 @@ WebGLContext::CopyTexSubImage2D_base(GLenum target,
// first, compute the size of the buffer we should allocate to initialize the texture as black
uint32_t texelSize = 0;
if (!ValidateTexFormatAndType(internalformat, LOCAL_GL_UNSIGNED_BYTE, -1, &texelSize, info))
if (!ValidateTexInputData(LOCAL_GL_UNSIGNED_BYTE, -1, func))
return;
uint32_t texelSize = GetBitsPerTexel(internalformat, LOCAL_GL_UNSIGNED_BYTE) / 8;
CheckedUint32 checked_neededByteLength =
GetImageSize(height, width, texelSize, mPixelStoreUnpackAlignment);
@ -432,7 +441,7 @@ WebGLContext::CopyTexSubImage2D_base(GLenum target,
// We need some zero pages, because GL doesn't guarantee the
// contents of a texture allocated with nullptr data.
// Hopefully calloc will just mmap zero pages here.
void *tempZeroData = calloc(1, bytesNeeded);
void* tempZeroData = calloc(1, bytesNeeded);
if (!tempZeroData)
return ErrorOutOfMemory("%s: could not allocate %d bytes (for zero fill)", info, bytesNeeded);
@ -486,76 +495,34 @@ WebGLContext::CopyTexImage2D(GLenum target,
if (IsContextLost())
return;
switch (target) {
case LOCAL_GL_TEXTURE_2D:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
break;
default:
return ErrorInvalidEnumInfo("copyTexImage2D: target", target);
// copyTexImage2D only generates textures with type = UNSIGNED_BYTE
const WebGLTexImageFunc func = WebGLTexImageFunc::CopyTexImage;
GLenum type = LOCAL_GL_UNSIGNED_BYTE;
if (!ValidateTexImage(2, target, level, internalformat,
0, 0, 0,
width, height, 0,
border, internalformat, type,
func))
{
return;
}
switch (internalformat) {
case LOCAL_GL_RGB:
case LOCAL_GL_LUMINANCE:
case LOCAL_GL_RGBA:
case LOCAL_GL_ALPHA:
case LOCAL_GL_LUMINANCE_ALPHA:
break;
default:
return ErrorInvalidEnumInfo("copyTexImage2D: internal format", internalformat);
}
if (border != 0)
return ErrorInvalidValue("copyTexImage2D: border must be 0");
if (width < 0 || height < 0)
return ErrorInvalidValue("copyTexImage2D: width and height may not be negative");
if (level < 0)
return ErrorInvalidValue("copyTexImage2D: level may not be negative");
GLsizei maxTextureSize = MaxTextureSizeForTarget(target);
if (!(maxTextureSize >> level))
return ErrorInvalidValue("copyTexImage2D: 2^level exceeds maximum texture size");
if (level >= 1) {
if (!(is_pot_assuming_nonnegative(width) &&
is_pot_assuming_nonnegative(height)))
return ErrorInvalidValue("copyTexImage2D: with level > 0, width and height must be powers of two");
}
if (internalformat == LOCAL_GL_DEPTH_COMPONENT ||
internalformat == LOCAL_GL_DEPTH_STENCIL)
return ErrorInvalidOperation("copyTexImage2D: a base internal format of DEPTH_COMPONENT or DEPTH_STENCIL isn't supported");
WebGLTexture *tex = activeBoundTextureForTarget(target);
if (!tex)
return ErrorInvalidOperation("copyTexImage2D: no texture bound to this target");
if (mBoundFramebuffer)
if (!mBoundFramebuffer->CheckAndInitializeAttachments())
return ErrorInvalidFramebufferOperation("copyTexImage2D: incomplete framebuffer");
if (mBoundFramebuffer && !mBoundFramebuffer->CheckAndInitializeAttachments())
return ErrorInvalidFramebufferOperation("copyTexImage2D: incomplete framebuffer");
bool texFormatRequiresAlpha = internalformat == LOCAL_GL_RGBA ||
internalformat == LOCAL_GL_ALPHA ||
internalformat == LOCAL_GL_LUMINANCE_ALPHA;
internalformat == LOCAL_GL_ALPHA ||
internalformat == LOCAL_GL_LUMINANCE_ALPHA;
bool fboFormatHasAlpha = mBoundFramebuffer ? mBoundFramebuffer->ColorAttachment(0).HasAlpha()
: bool(gl->GetPixelFormat().alpha > 0);
if (texFormatRequiresAlpha && !fboFormatHasAlpha)
return ErrorInvalidOperation("copyTexImage2D: texture format requires an alpha channel "
"but the framebuffer doesn't have one");
// copyTexImage2D only generates textures with type = UNSIGNED_BYTE
GLenum type = LOCAL_GL_UNSIGNED_BYTE;
// check if the memory size of this texture may change with this call
bool sizeMayChange = true;
WebGLTexture* tex = activeBoundTextureForTarget(target);
if (tex->HasImageInfoAt(target, level)) {
const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(target, level);
@ -565,17 +532,18 @@ WebGLContext::CopyTexImage2D(GLenum target,
type != imageInfo.Type();
}
if (sizeMayChange) {
if (sizeMayChange)
UpdateWebGLErrorAndClearGLError();
CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
if (sizeMayChange) {
GLenum error = LOCAL_GL_NO_ERROR;
UpdateWebGLErrorAndClearGLError(&error);
if (error) {
GenerateWarning("copyTexImage2D generated error %s", ErrorName(error));
return;
}
} else {
CopyTexSubImage2D_base(target, level, internalformat, 0, 0, x, y, width, height, false);
}
tex->SetImageInfo(target, level, width, height, internalformat, type,
@ -3356,37 +3324,28 @@ WebGLContext::CompressedTexImage2D(GLenum target, GLint level, GLenum internalfo
GLsizei width, GLsizei height, GLint border,
const ArrayBufferView& view)
{
if (IsContextLost()) {
if (IsContextLost())
return;
}
if (!ValidateTexImage2DTarget(target, width, height, "compressedTexImage2D")) {
return;
}
const WebGLTexImageFunc func = WebGLTexImageFunc::CompTexImage;
WebGLTexture *tex = activeBoundTextureForTarget(target);
if (!tex) {
ErrorInvalidOperation("compressedTexImage2D: no texture is bound to this target");
return;
}
if (!mCompressedTextureFormats.Contains(internalformat)) {
ErrorInvalidEnum("compressedTexImage2D: compressed texture format 0x%x is not supported", internalformat);
return;
}
if (border) {
ErrorInvalidValue("compressedTexImage2D: border is not 0");
if (!ValidateTexImage(2, target, level, internalformat,
0, 0, 0, width, height, 0,
border, internalformat, LOCAL_GL_UNSIGNED_BYTE,
func))
{
return;
}
uint32_t byteLength = view.Length();
if (!ValidateCompressedTextureSize(target, level, internalformat, width, height, byteLength, "compressedTexImage2D")) {
if (!ValidateCompTexImageDataSize(target, internalformat, width, height, byteLength, func)) {
return;
}
MakeContextCurrent();
gl->fCompressedTexImage2D(target, level, internalformat, width, height, border, byteLength, view.Data());
WebGLTexture* tex = activeBoundTextureForTarget(target);
MOZ_ASSERT(tex);
tex->SetImageInfo(target, level, width, height, internalformat, LOCAL_GL_UNSIGNED_BYTE,
WebGLImageDataStatus::InitializedImageData);
@ -3398,102 +3357,43 @@ WebGLContext::CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLsizei width, GLsizei height,
GLenum format, const ArrayBufferView& view)
{
if (IsContextLost()) {
if (IsContextLost())
return;
}
switch (target) {
case LOCAL_GL_TEXTURE_2D:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
break;
default:
return ErrorInvalidEnumInfo("texSubImage2D: target", target);
const WebGLTexImageFunc func = WebGLTexImageFunc::CompTexSubImage;
if (!ValidateTexImage(2, target,
level, format,
xoffset, yoffset, 0,
width, height, 0,
0, format, LOCAL_GL_UNSIGNED_BYTE,
func))
{
return;
}
WebGLTexture *tex = activeBoundTextureForTarget(target);
if (!tex) {
ErrorInvalidOperation("compressedTexSubImage2D: no texture is bound to this target");
return;
}
MOZ_ASSERT(tex);
WebGLTexture::ImageInfo& levelInfo = tex->ImageInfoAt(target, level);
if (!mCompressedTextureFormats.Contains(format)) {
ErrorInvalidEnum("compressedTexSubImage2D: compressed texture format 0x%x is not supported", format);
return;
}
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "compressedTexSubImage2D")) {
if (!ValidateCompTexImageSize(target, level, format,
xoffset, yoffset,
width, height,
levelInfo.Width(), levelInfo.Height(),
func))
{
return;
}
uint32_t byteLength = view.Length();
if (!ValidateCompressedTextureSize(target, level, format, width, height, byteLength, "compressedTexSubImage2D")) {
if (!ValidateCompTexImageDataSize(target, format, width, height, byteLength, func))
return;
}
if (!tex->HasImageInfoAt(target, level)) {
ErrorInvalidOperation("compressedTexSubImage2D: no texture image previously defined for this level and face");
return;
}
const WebGLTexture::ImageInfo &imageInfo = tex->ImageInfoAt(target, level);
if (!CanvasUtils::CheckSaneSubrectSize(xoffset, yoffset, width, height, imageInfo.Width(), imageInfo.Height())) {
ErrorInvalidValue("compressedTexSubImage2D: subtexture rectangle out of bounds");
return;
}
switch (format) {
case LOCAL_GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case LOCAL_GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
{
if (xoffset < 0 || xoffset % 4 != 0) {
ErrorInvalidOperation("compressedTexSubImage2D: xoffset is not a multiple of 4");
return;
}
if (yoffset < 0 || yoffset % 4 != 0) {
ErrorInvalidOperation("compressedTexSubImage2D: yoffset is not a multiple of 4");
return;
}
if (width % 4 != 0 && width != imageInfo.Width()) {
ErrorInvalidOperation("compressedTexSubImage2D: width is not a multiple of 4 or equal to texture width");
return;
}
if (height % 4 != 0 && height != imageInfo.Height()) {
ErrorInvalidOperation("compressedTexSubImage2D: height is not a multiple of 4 or equal to texture height");
return;
}
break;
}
case LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1:
case LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1:
case LOCAL_GL_COMPRESSED_RGBA_PVRTC_4BPPV1:
case LOCAL_GL_COMPRESSED_RGBA_PVRTC_2BPPV1:
{
if (xoffset || yoffset ||
width != imageInfo.Width() ||
height != imageInfo.Height())
{
ErrorInvalidValue("compressedTexSubImage2D: the update rectangle doesn't match the existing image");
return;
}
}
}
if (imageInfo.HasUninitializedImageData()) {
if (levelInfo.HasUninitializedImageData())
tex->DoDeferredImageInitialization(target, level);
}
MakeContextCurrent();
gl->fCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, byteLength, view.Data());
return;
}
JS::Value
@ -3733,48 +3633,28 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat,
int jsArrayType, // a TypedArray format enum, or -1 if not relevant
WebGLTexelFormat srcFormat, bool srcPremultiplied)
{
if (!ValidateTexImage2DTarget(target, width, height, "texImage2D")) {
const WebGLTexImageFunc func = WebGLTexImageFunc::TexImage;
if (!ValidateTexImage(2, target, level, internalformat,
0, 0, 0,
width, height, 0,
border, format, type, func))
{
return;
}
if (!ValidateTexImage2DFormat(format, "texImage2D: format"))
return;
if (format != internalformat)
return ErrorInvalidOperation("texImage2D: format does not match internalformat");
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "texImage2D")) {
return;
}
if (level >= 1) {
if (!(is_pot_assuming_nonnegative(width) &&
is_pot_assuming_nonnegative(height)))
return ErrorInvalidValue("texImage2D: with level > 0, width and height must be powers of two");
}
if (border != 0)
return ErrorInvalidValue("texImage2D: border must be 0");
const bool isDepthTexture = format == LOCAL_GL_DEPTH_COMPONENT ||
format == LOCAL_GL_DEPTH_STENCIL;
if (isDepthTexture) {
if (IsExtensionEnabled(WEBGL_depth_texture)) {
if (target != LOCAL_GL_TEXTURE_2D || data != nullptr || level != 0)
return ErrorInvalidOperation("texImage2D: "
"with format of DEPTH_COMPONENT or DEPTH_STENCIL, "
"target must be TEXTURE_2D, "
"data must be nullptr, "
"level must be zero"); // Haiku by unknown Zen master
} else {
return ErrorInvalidEnum("texImage2D: attempt to create a depth texture "
"without having enabled the WEBGL_depth_texture extension.");
}
if (data != nullptr || level != 0)
return ErrorInvalidOperation("texImage2D: "
"with format of DEPTH_COMPONENT or DEPTH_STENCIL, "
"data must be nullptr, "
"level must be zero");
}
uint32_t dstTexelSize = 0;
if (!ValidateTexFormatAndType(format, type, jsArrayType, &dstTexelSize, "texImage2D"))
if (!ValidateTexInputData(type, jsArrayType, func))
return;
WebGLTexelFormat dstFormat = GetWebGLTexelFormat(format, type);
@ -3834,6 +3714,7 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat,
if (byteLength) {
size_t srcStride = srcStrideOrZero ? srcStrideOrZero : checked_alignedRowSize.value();
uint32_t dstTexelSize = GetBitsPerTexel(format, type) / 8;
size_t dstPlainRowSize = dstTexelSize * width;
size_t unpackAlignment = mPixelStoreUnpackAlignment;
size_t dstStride = ((dstPlainRowSize + unpackAlignment-1) / unpackAlignment) * unpackAlignment;
@ -3926,36 +3807,17 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
int jsArrayType,
WebGLTexelFormat srcFormat, bool srcPremultiplied)
{
switch (target) {
case LOCAL_GL_TEXTURE_2D:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
break;
default:
return ErrorInvalidEnumInfo("texSubImage2D: target", target);
}
const WebGLTexImageFunc func = WebGLTexImageFunc::TexSubImage;
if (!ValidateLevelWidthHeightForTarget(target, level, width, height, "texSubImage2D")) {
if (!ValidateTexImage(2, target, level, format,
xoffset, yoffset, 0,
width, height, 0,
0, format, type, func))
{
return;
}
if (level >= 1) {
if (!(is_pot_assuming_nonnegative(width) &&
is_pot_assuming_nonnegative(height)))
return ErrorInvalidValue("texSubImage2D: with level > 0, width and height must be powers of two");
}
if (IsExtensionEnabled(WEBGL_depth_texture) &&
(format == LOCAL_GL_DEPTH_COMPONENT || format == LOCAL_GL_DEPTH_STENCIL)) {
return ErrorInvalidOperation("texSubImage2D: format");
}
uint32_t dstTexelSize = 0;
if (!ValidateTexFormatAndType(format, type, jsArrayType, &dstTexelSize, "texSubImage2D"))
if (!ValidateTexInputData(type, jsArrayType, func))
return;
WebGLTexelFormat dstFormat = GetWebGLTexelFormat(format, type);
@ -3983,38 +3845,24 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
return ErrorInvalidOperation("texSubImage2D: not enough data for operation (need %d, have %d)", bytesNeeded, byteLength);
WebGLTexture *tex = activeBoundTextureForTarget(target);
if (!tex)
return ErrorInvalidOperation("texSubImage2D: no texture is bound to this target");
if (!tex->HasImageInfoAt(target, level))
return ErrorInvalidOperation("texSubImage2D: no texture image previously defined for this level and face");
const WebGLTexture::ImageInfo &imageInfo = tex->ImageInfoAt(target, level);
if (!CanvasUtils::CheckSaneSubrectSize(xoffset, yoffset, width, height, imageInfo.Width(), imageInfo.Height()))
return ErrorInvalidValue("texSubImage2D: subtexture rectangle out of bounds");
// Require the format and type in texSubImage2D to match that of the existing texture as created by texImage2D
if (imageInfo.InternalFormat() != format || imageInfo.Type() != type)
return ErrorInvalidOperation("texSubImage2D: format or type doesn't match the existing texture");
if (imageInfo.HasUninitializedImageData()) {
if (imageInfo.HasUninitializedImageData())
tex->DoDeferredImageInitialization(target, level);
}
MakeContextCurrent();
size_t srcStride = srcStrideOrZero ? srcStrideOrZero : checked_alignedRowSize.value();
uint32_t dstTexelSize = GetBitsPerTexel(format, type) / 8;
size_t dstPlainRowSize = dstTexelSize * width;
// There are checks above to ensure that this won't overflow.
size_t dstStride = RoundedToNextMultipleOf(dstPlainRowSize, mPixelStoreUnpackAlignment).value();
// convert type for half float if not on GLES2
GLenum realType = type;
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2()) {
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2())
realType = LOCAL_GL_HALF_FLOAT;
}
if (actualSrcFormat == dstFormat &&
srcPremultiplied == mPixelStorePremultiplyAlpha &&

File diff suppressed because it is too large Load Diff

View File

@ -134,6 +134,15 @@ MOZ_BEGIN_ENUM_CLASS(WebGLTexelFormat, int)
RGBA32F // OES_texture_float
MOZ_END_ENUM_CLASS(WebGLTexelFormat)
MOZ_BEGIN_ENUM_CLASS(WebGLTexImageFunc, int)
TexImage,
TexSubImage,
CopyTexImage,
CopyTexSubImage,
CompTexImage,
CompTexSubImage,
MOZ_END_ENUM_CLASS(WebGLTexImageFunc)
} // namespace mozilla
#endif

View File

@ -1,6 +1,7 @@
<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<html>
<head>
<meta charset="utf-8"/>
<!--
Tests for the OpenGL ES 2.0 HTML Canvas context
@ -28,79 +29,88 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
-->
<link rel="stylesheet" type="text/css" href="../unit.css" />
<script type="application/x-javascript" src="../unit.js"></script>
<script type="application/x-javascript" src="../util.js"></script>
<script type="application/x-javascript">
<link rel="stylesheet" type="text/css" href="../../../resources/js-test-style.css" />
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<canvas id="canvas" width="16" height="16" style="width: 50px; height: 50px; border: 1px solid black;"></canvas>
<div id="console"></div>
Tests.startUnit = function () {
var canvas = document.getElementById('gl');
var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID));
return [gl];
}
<script>
var wtu = WebGLTestUtils;
Tests.setup = function(gl) {
description("Test bad arguments to texImage2D");
var canvas = document.getElementById('canvas');
var gl = wtu.create3DContext(canvas);
function setup(gl) {
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
return [gl]
return tex;
}
Tests.teardown = function(gl,tex) {
function teardown(gl, tex) {
gl.bindTexture(gl.TEXTURE_2D, null);
gl.deleteTexture(tex);
}
Tests.testTexImage2D = function(gl) {
var data = new Uint8Array(4);
assertGLError(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2,1,0,gl.RGBA,gl.UNSIGNED_BYTE, data);
});
assertGLError(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,2,0,gl.RGBA,gl.UNSIGNED_BYTE, data);
});
assertGLError(gl, gl.INVALID_ENUM, "bad target", function(){
gl.texImage2D(gl.FLOAT, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_ENUM, "bad internal format/format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.FLOAT, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_VALUE, "border > 0", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,48,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
// The spec says zero size is OK. If you disagree please list the section
// in the spec that details this issue.
assertOk("zero size", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_VALUE, "negative width", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, -1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_VALUE, "negative height", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,-1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_ENUM, "bad format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
assertGLError(gl, gl.INVALID_ENUM, "bad type", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.TEXTURE_2D, null);
});
assertGLError(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array(3));
});
assertGLError(gl, gl.INVALID_OPERATION, "format and type incompatible",function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_SHORT_5_6_5, null);
});
assertGLError(gl, gl.INVALID_OPERATION, "format and type incompatible",function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1,1,0,gl.RGB,gl.UNSIGNED_SHORT_4_4_4_4, null);
});
function testrunner(gl, expected, desc, fn) {
var tex = setup(gl);
fn();
glErrorShouldBe(gl, expected, desc);
teardown(gl, tex);
}
var data = new Uint8Array(4);
testrunner(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2,1,0,gl.RGBA,gl.UNSIGNED_BYTE, data);
});
testrunner(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,2,0,gl.RGBA,gl.UNSIGNED_BYTE, data);
});
testrunner(gl, gl.INVALID_ENUM, "bad target", function(){
gl.texImage2D(gl.FLOAT, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_ENUM, "bad internal format/format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.FLOAT, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_VALUE, "border > 0", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,48,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
// The spec says zero size is OK. If you disagree please list the section
// in the spec that details this issue.
testrunner(gl, gl.NO_ERROR, "zero size", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0,0,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_VALUE, "negative width", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, -1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_VALUE, "negative height", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,-1,0,gl.RGBA,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_ENUM, "bad format", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.FLOAT,gl.UNSIGNED_BYTE, null);
});
testrunner(gl, gl.INVALID_ENUM, "bad type", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.TEXTURE_2D, null);
});
testrunner(gl, gl.INVALID_OPERATION, "not enough data", function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_BYTE, new Uint8Array(3));
});
testrunner(gl, gl.INVALID_OPERATION, "format and type incompatible",function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1,1,0,gl.RGBA,gl.UNSIGNED_SHORT_5_6_5, null);
});
testrunner(gl, gl.INVALID_OPERATION, "format and type incompatible",function(){
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 1,1,0,gl.RGB,gl.UNSIGNED_SHORT_4_4_4_4, null);
});
Tests.endUnit = function(gl) {
}
debug("");
var successfullyParsed = true;
</script>
<style>canvas{ position:absolute; }</style>
</head><body>
<canvas id="gl" width="16" height="16"></canvas>
</body></html>
<script>finishTest();</script>
</body>
</html>

View File

@ -120,6 +120,7 @@ class RestoreSelectionState;
class nsTextEditorState : public mozilla::SupportsWeakPtr<nsTextEditorState> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsTextEditorState)
explicit nsTextEditorState(nsITextControlElement* aOwningElement);
~nsTextEditorState();

View File

@ -25,6 +25,7 @@ class SharedThreadPool;
// to make this threadsafe for objects that aren't already threadsafe.
class MediaTaskQueue : public AtomicRefCounted<MediaTaskQueue> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaTaskQueue)
MediaTaskQueue(TemporaryRef<SharedThreadPool> aPool);
~MediaTaskQueue();

View File

@ -1090,8 +1090,8 @@ nsresult OggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
if (startTime != -1 &&
((endTime = RangeEndTime(endOffset)) != -1))
{
NS_ASSERTION(startTime < endTime,
"Start time must be before end time");
NS_WARN_IF_FALSE(startTime < endTime,
"Start time must be before end time");
aRanges.AppendElement(SeekRange(startOffset,
endOffset,
startTime,

View File

@ -25,6 +25,7 @@ class PannerNode : public AudioNode,
public SupportsWeakPtr<PannerNode>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(PannerNode)
explicit PannerNode(AudioContext* aContext);
virtual ~PannerNode();

View File

@ -156,6 +156,7 @@ public:
class LoadInfo : public mozilla::RefCounted<LoadInfo>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(LoadInfo)
double GetSystemLoad() { return mSystemLoad.GetLoad(); };
double GetProcessLoad() { return mProcessLoad.GetLoad(); };
nsresult UpdateSystemLoad();

View File

@ -39,6 +39,7 @@ enum {
class MediaEngine : public RefCounted<MediaEngine>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MediaEngine)
virtual ~MediaEngine() {}
static const int DEFAULT_VIDEO_FPS = 30;

View File

@ -285,6 +285,7 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph,
class SineWaveGenerator : public RefCounted<SineWaveGenerator>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SineWaveGenerator)
static const int bytesPerSample = 2;
static const int millisecondsPerSecond = 1000;
static const int frequency = 1000;

View File

@ -58,6 +58,7 @@ class SpeechRecognition MOZ_FINAL : public nsDOMEventTargetHelper,
public SupportsWeakPtr<SpeechRecognition>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SpeechRecognition)
SpeechRecognition(nsPIDOMWindow* aOwnerWindow);
virtual ~SpeechRecognition() {};

View File

@ -106,7 +106,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
(eventType.EqualsLiteral("contextmenu") && mIsContext)))
return NS_OK;
uint16_t button;
int16_t button;
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
if (!mouseEvent) {

View File

@ -143,6 +143,7 @@ class nsDocShell : public nsDocLoader,
friend class nsDSURIContentListener;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsDocShell)
// Object Management
nsDocShell();

View File

@ -1083,6 +1083,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
#endif
mShowFocusRingForContent(false),
mFocusByKeyOccurred(false),
mInnerObjectsFreed(false),
mHasGamepad(false),
#ifdef MOZ_GAMEPAD
mHasSeenGamepadInput(false),
@ -1520,6 +1521,8 @@ nsGlobalWindow::FreeInnerObjects()
// re-create.
NotifyDOMWindowDestroyed(this);
mInnerObjectsFreed = true;
// Kill all of the workers for this window.
mozilla::dom::workers::CancelWorkersForWindow(this);
@ -1806,6 +1809,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCrypto)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
#ifdef DEBUG
void
nsGlobalWindow::RiskyUnlink()
{
NS_CYCLE_COLLECTION_INNERNAME.Unlink(this);
}
#endif
struct TraceData
{
const TraceCallbacks& callbacks;
@ -12561,7 +12572,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
NS_ASSERTION(mTimeoutsSuspendDepth, "Mismatched calls to ResumeTimeouts!");
--mTimeoutsSuspendDepth;
bool shouldResume = (mTimeoutsSuspendDepth == 0);
bool shouldResume = (mTimeoutsSuspendDepth == 0) && !mInnerObjectsFreed;
nsresult rv;
if (shouldResume) {

View File

@ -604,6 +604,12 @@ public:
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindow,
nsIDOMEventTarget)
#ifdef DEBUG
// Call Unlink on this window. This may cause bad things to happen, so use
// with caution.
void RiskyUnlink();
#endif
virtual NS_HIDDEN_(JSObject*)
GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey);
@ -1407,6 +1413,10 @@ protected:
// should be displayed.
bool mFocusByKeyOccurred : 1;
// Ensure that a call to ResumeTimeouts() after FreeInnerObjects() does nothing.
// This member is only used by inner windows.
bool mInnerObjectsFreed : 1;
// Indicates whether this window wants gamepad input events
bool mHasGamepad : 1;
#ifdef MOZ_GAMEPAD

View File

@ -836,3 +836,45 @@ nsWindowMemoryReporter::GhostWindowsReporter::DistinguishedAmount()
return ghostWindows.Count();
}
#ifdef DEBUG
static PLDHashOperator
UnlinkGhostWindowsEnumerator(nsUint64HashKey* aIDHashKey, void *)
{
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
if (!windowsById) {
return PL_DHASH_NEXT;
}
nsRefPtr<nsGlobalWindow> window = windowsById->Get(aIDHashKey->GetKey());
if (window) {
window->RiskyUnlink();
}
return PL_DHASH_NEXT;
}
/* static */ void
nsWindowMemoryReporter::UnlinkGhostWindows()
{
if (!sWindowReporter) {
return;
}
nsGlobalWindow::WindowByIdTable* windowsById =
nsGlobalWindow::GetWindowsTable();
if (!windowsById) {
return;
}
// Hold on to every window in memory so that window objects can't be
// destroyed while we're calling the UnlinkGhostWindows callback.
WindowArray windows;
windowsById->Enumerate(GetWindows, &windows);
// Get the IDs of all the "ghost" windows, and unlink them all.
nsTHashtable<nsUint64HashKey> ghostWindows;
sWindowReporter->CheckForGhostWindows(&ghostWindows);
ghostWindows.EnumerateEntries(UnlinkGhostWindowsEnumerator, nullptr);
}
#endif

View File

@ -146,6 +146,14 @@ public:
static void Init();
#ifdef DEBUG
/**
* Unlink all known ghost windows, to enable investigating what caused them
* to become ghost windows in the first place.
*/
static void UnlinkGhostWindows();
#endif
private:
/**
* nsGhostWindowReporter generates the "ghost-windows" report, which counts

View File

@ -65,8 +65,8 @@ BrowserElementParentFactory.prototype = {
// alive for as long as its frame element lives.
this._bepMap = new WeakMap();
Services.obs.addObserver(this, 'remote-browser-frame-pending', /* ownsWeak = */ true);
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', /* ownsWeak = */ true);
Services.obs.addObserver(this, 'remote-browser-pending', /* ownsWeak = */ true);
Services.obs.addObserver(this, 'inprocess-browser-shown', /* ownsWeak = */ true);
},
_browserFramesPrefEnabled: function() {
@ -79,6 +79,10 @@ BrowserElementParentFactory.prototype = {
},
_observeInProcessBrowserFrameShown: function(frameLoader) {
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsBrowserOrAppFrame) {
return;
}
debug("In-process browser frame shown " + frameLoader);
this._createBrowserElementParent(frameLoader,
/* hasRemoteFrame = */ false,
@ -86,6 +90,10 @@ BrowserElementParentFactory.prototype = {
},
_observeRemoteBrowserFramePending: function(frameLoader) {
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.QueryInterface(Ci.nsIFrameLoader).ownerIsBrowserOrAppFrame) {
return;
}
debug("Remote browser frame shown " + frameLoader);
this._createBrowserElementParent(frameLoader,
/* hasRemoteFrame = */ true,
@ -108,10 +116,10 @@ BrowserElementParentFactory.prototype = {
this._init();
}
break;
case 'remote-browser-frame-pending':
case 'remote-browser-pending':
this._observeRemoteBrowserFramePending(subject);
break;
case 'in-process-browser-or-app-frame-shown':
case 'inprocess-browser-shown':
this._observeInProcessBrowserFrameShown(subject);
break;
}

View File

@ -312,6 +312,7 @@ private:
class VolumeNameCache : public mozilla::RefCounted<VolumeNameCache>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(VolumeNameCache)
nsTArray<nsString> mVolumeNames;
};
static mozilla::StaticRefPtr<VolumeNameCache> sVolumeNameCache;

View File

@ -13,6 +13,7 @@ class DeviceStorageFileDescriptor MOZ_FINAL
: public mozilla::RefCounted<DeviceStorageFileDescriptor>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageFileDescriptor)
nsRefPtr<DeviceStorageFile> mDSFile;
mozilla::ipc::FileDescriptor mFileDescriptor;
};

View File

@ -182,6 +182,7 @@ DeviceStorageUsedSpaceCache::SetUsedSizes(const nsAString& aStorageName,
class GlobalDirs : public RefCounted<GlobalDirs>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GlobalDirs)
#if !defined(MOZ_WIDGET_GONK)
nsCOMPtr<nsIFile> pictures;
nsCOMPtr<nsIFile> videos;

View File

@ -121,6 +121,7 @@ private:
class CacheEntry : public mozilla::RefCounted<CacheEntry>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeviceStorageUsedSpaceCache::CacheEntry)
bool mDirty;
nsString mStorageName;
int64_t mFreeBytes;

View File

@ -96,7 +96,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
uint16_t aButton,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList)
{
@ -179,14 +179,14 @@ nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButton(uint16_t* aButton)
nsDOMMouseEvent::GetButton(int16_t* aButton)
{
NS_ENSURE_ARG_POINTER(aButton);
*aButton = Button();
return NS_OK;
}
uint16_t
int16_t
nsDOMMouseEvent::Button()
{
switch(mEvent->eventStructType)

View File

@ -47,7 +47,7 @@ public:
bool ShiftKey();
bool AltKey();
bool MetaKey();
uint16_t Button();
int16_t Button();
uint16_t Buttons();
already_AddRefed<mozilla::dom::EventTarget> GetRelatedTarget();
void InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
@ -108,7 +108,7 @@ protected:
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
uint16_t aButton,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList);
};

View File

@ -4103,6 +4103,7 @@ nsEventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
}
event->refPoint = aMouseEvent->refPoint;
event->modifiers = aMouseEvent->modifiers;
event->button = aMouseEvent->button;
event->buttons = aMouseEvent->buttons;
event->pluginEvent = aMouseEvent->pluginEvent;
event->relatedTarget = aRelatedContent;

View File

@ -313,7 +313,7 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
return; // ignore untrusted event.
}
uint16_t button;
int16_t button;
rv = aMouseEvent->GetButton(&button);
NS_ENSURE_SUCCESS_VOID(rv);
if (button != 0) {

View File

@ -52,8 +52,8 @@ this.Keyboard = {
},
init: function keyboardInit() {
Services.obs.addObserver(this, 'in-process-browser-or-app-frame-shown', false);
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'inprocess-browser-shown', false);
Services.obs.addObserver(this, 'remote-browser-shown', false);
Services.obs.addObserver(this, 'oop-frameloader-crashed', false);
for (let name of this._messageNames)
@ -71,6 +71,10 @@ this.Keyboard = {
this.sendToKeyboard('Keyboard:FocusChange', { 'type': 'blur' });
}
} else {
// Ignore notifications that aren't from a BrowserOrApp
if (!frameLoader.ownerIsBrowserOrAppFrame) {
return;
}
this.initFormsFrameScript(mm);
}
},

View File

@ -13,7 +13,7 @@
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, builtinclass, uuid(afb2e57b-2822-4969-b2a9-0cada6859534)]
[scriptable, builtinclass, uuid(df068636-9a5b-11e3-b71f-2c27d728e7f9)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
readonly attribute long screenX;
@ -30,7 +30,7 @@ interface nsIDOMMouseEvent : nsIDOMUIEvent
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute nsIDOMEventTarget relatedTarget;

View File

@ -600,7 +600,7 @@ ParticularProcessPriorityManager::Init()
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (os) {
os->AddObserver(this, "audio-channel-process-changed", /* ownsWeak */ true);
os->AddObserver(this, "remote-browser-frame-shown", /* ownsWeak */ true);
os->AddObserver(this, "remote-browser-shown", /* ownsWeak */ true);
os->AddObserver(this, "ipc:browser-destroyed", /* ownsWeak */ true);
os->AddObserver(this, "frameloader-visible-changed", /* ownsWeak */ true);
}
@ -672,7 +672,7 @@ ParticularProcessPriorityManager::Observe(nsISupports* aSubject,
if (topic.EqualsLiteral("audio-channel-process-changed")) {
OnAudioChannelProcessChanged(aSubject);
} else if (topic.EqualsLiteral("remote-browser-frame-shown")) {
} else if (topic.EqualsLiteral("remote-browser-shown")) {
OnRemoteBrowserFrameShown(aSubject);
} else if (topic.EqualsLiteral("ipc:browser-destroyed")) {
OnTabParentDestroyed(aSubject);
@ -745,6 +745,13 @@ ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(nsISupports* aSubjec
nsCOMPtr<nsIFrameLoader> fl = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(fl);
// Ignore notifications that aren't from a BrowserOrApp
bool isBrowserOrApp;
fl->GetOwnerIsBrowserOrAppFrame(&isBrowserOrApp);
if (!isBrowserOrApp) {
return;
}
nsCOMPtr<nsITabParent> tp;
fl->GetTabParent(getter_AddRefs(tp));
NS_ENSURE_TRUE_VOID(tp);

View File

@ -70,7 +70,8 @@ namespace mozilla {
namespace plugins {
namespace parent {
JS_STATIC_ASSERT(sizeof(NPIdentifier) == sizeof(jsid));
static_assert(sizeof(NPIdentifier) == sizeof(jsid),
"NPIdentifier must be binary compatible with jsid.");
inline jsid
NPIdentifierToJSId(NPIdentifier id)

View File

@ -4,19 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef MOZ_WIDGET_QT
#include <QWidget>
#include <QKeyEvent>
#if defined(MOZ_X11)
#if defined(Q_WS_X11)
#include <QX11Info>
#else
#include "gfxQtPlatform.h"
#endif
#endif
#undef slots
#endif
#ifdef MOZ_X11
#include <cairo-xlib.h>
#include "gfxXlibSurface.h"
@ -2150,46 +2137,6 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
}
#endif
#ifdef MOZ_WIDGET_QT
const WidgetKeyboardEvent& keyEvent = *anEvent.AsKeyboardEvent();
memset( &event, 0, sizeof(event) );
event.time = anEvent.time;
QWidget* qWidget = static_cast<QWidget*>(widget->GetNativeData(NS_NATIVE_WINDOW));
if (qWidget)
#if defined(Q_WS_X11)
event.root = qWidget->x11Info().appRootWindow();
#else
event.root = RootWindowOfScreen(DefaultScreenOfDisplay(gfxQtPlatform::GetXDisplay(qWidget)));
#endif
// deduce keycode from the information in the attached QKeyEvent
const QKeyEvent* qtEvent = static_cast<const QKeyEvent*>(anEvent.pluginEvent);
if (qtEvent) {
if (qtEvent->nativeModifiers())
event.state = qtEvent->nativeModifiers();
else // fallback
event.state = XInputEventState(keyEvent);
if (qtEvent->nativeScanCode())
event.keycode = qtEvent->nativeScanCode();
else // fallback
event.keycode = XKeysymToKeycode( (widget ? static_cast<Display*>(widget->GetNativeData(NS_NATIVE_DISPLAY)) : nullptr), qtEvent->key());
}
switch (anEvent.message)
{
case NS_KEY_DOWN:
event.type = XKeyPress;
break;
case NS_KEY_UP:
event.type = KeyRelease;
break;
}
#endif
// Information that could be obtained from pluginEvent but we may not
// want to promise to provide:
event.subwindow = None;

View File

@ -30,20 +30,10 @@
* Josh Aas <josh@mozilla.com>
*
* ***** END LICENSE BLOCK ***** */
#include <QWidget>
#include <QPainter>
#include "nptest_platform.h"
#include "npapi.h"
struct _PlatformData {
#ifdef MOZ_X11
Display* display;
Visual* visual;
Colormap colormap;
#endif
};
using namespace std;
using namespace std;
bool
pluginSupportsWindowMode()
@ -66,24 +56,8 @@ pluginSupportsAsyncBitmapDrawing()
NPError
pluginInstanceInit(InstanceData* instanceData)
{
#ifdef MOZ_X11
instanceData->platformData = static_cast<PlatformData*>
(NPN_MemAlloc(sizeof(PlatformData)));
if (!instanceData->platformData){
//printf("NPERR_OUT_OF_MEMORY_ERROR\n");
return NPERR_OUT_OF_MEMORY_ERROR;
}
instanceData->platformData->display = nullptr;
instanceData->platformData->visual = nullptr;
instanceData->platformData->colormap = None;
return NPERR_NO_ERROR;
#else
printf("NPERR_INCOMPATIBLE_VERSION_ERROR\n");
return NPERR_INCOMPATIBLE_VERSION_ERROR;
#endif
return NPERR_NO_ERROR;
}
void
@ -105,102 +79,9 @@ pluginWidgetInit(InstanceData* instanceData, void* oldWindow)
// XXX nothing here yet since we don't support windowed plugins
}
static void
pluginDrawWindow(InstanceData* instanceData, void* event)
{
NPWindow& window = instanceData->window;
// When we have a widget, window.x/y are meaningless since our
// widget is always positioned correctly and we just draw into it at 0,0
int x = instanceData->hasWidget ? 0 : window.x;
int y = instanceData->hasWidget ? 0 : window.y;
int width = window.width;
int height = window.height;
#ifdef MOZ_X11
XEvent* nsEvent = (XEvent*)event;
const XGraphicsExposeEvent& expose = nsEvent->xgraphicsexpose;
QColor drawColor((QColor)instanceData->scriptableObject->drawColor);//QRgb qRgba ( int r, int g, int b, int a )
#ifdef Q_WS_X11
QPixmap pixmap = QPixmap::fromX11Pixmap(expose.drawable, QPixmap::ExplicitlyShared);
QRect exposeRect(expose.x, expose.y, expose.width, expose.height);
if (instanceData->scriptableObject->drawMode == DM_SOLID_COLOR) {
//printf("Drawing Solid\n");
// drawing a solid color for reftests
QPainter painter(&pixmap);
painter.fillRect(exposeRect, drawColor);
notifyDidPaint(instanceData);
return;
}
#endif
#endif
NPP npp = instanceData->npp;
if (!npp)
return;
QString text (NPN_UserAgent(npp));
if (text.isEmpty())
return;
#ifdef MOZ_X11
#ifdef Q_WS_X11
//printf("Drawing Default\n");
// drawing a solid color for reftests
QColor color;
QPainter painter(&pixmap);
QRect theRect(x, y, width, height);
QRect clipRect(QPoint(window.clipRect.left, window.clipRect.top),
QPoint(window.clipRect.right, window.clipRect.bottom));
painter.setClipRect(clipRect);
painter.fillRect(theRect, QColor(128,128,128,255));
painter.drawRect(theRect);
painter.drawText(QRect(theRect), Qt::AlignCenter, text);
notifyDidPaint(instanceData);
#endif
#endif
return;
}
int16_t
pluginHandleEvent(InstanceData* instanceData, void* event)
{
#ifdef MOZ_X11
XEvent* nsEvent = (XEvent*)event;
//printf("\nEvent Type %d\n", nsEvent->type);
switch (nsEvent->type) {
case GraphicsExpose: {
//printf("GraphicsExpose\n");
pluginDrawWindow(instanceData, event);
break;
}
case MotionNotify: {
//printf("MotionNotify\n");
XMotionEvent* motion = &nsEvent->xmotion;
instanceData->lastMouseX = motion->x;
instanceData->lastMouseY = motion->y;
break;
}
case ButtonPress:{
////printf("ButtonPress\n");
break;
}
case ButtonRelease: {
//printf("ButtonRelease\n");
XButtonEvent* button = &nsEvent->xbutton;
instanceData->lastMouseX = button->x;
instanceData->lastMouseY = button->y;
instanceData->mouseUpEventCount++;
break;
}
default:
break;
}
#endif
return 0;
}

View File

@ -4,6 +4,6 @@
include $(topsrcdir)/config/rules.mk
ifdef MOZ_ENABLE_QTMOBILITY
ifdef MOZ_ENABLE_QT5GEOPOSITION
CXXFLAGS += $(MOZ_QT_CFLAGS)
endif

View File

@ -26,7 +26,7 @@ LOCAL_INCLUDES += [
'/dom/ipc',
]
if CONFIG['MOZ_ENABLE_QTMOBILITY']:
if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']:
LOCAL_INCLUDES += [
'/dom/system/unix',
]

View File

@ -28,7 +28,7 @@
class nsIPrincipal;
#ifdef MOZ_ENABLE_QTMOBILITY
#ifdef MOZ_ENABLE_QT5GEOPOSITION
#include "QTMLocationProvider.h"
#endif
@ -667,7 +667,7 @@ nsresult nsGeolocationService::Init()
obs->AddObserver(this, "quit-application", false);
obs->AddObserver(this, "mozsettings-changed", false);
#ifdef MOZ_ENABLE_QTMOBILITY
#ifdef MOZ_ENABLE_QT5GEOPOSITION
mProvider = new QTMLocationProvider();
#endif

View File

@ -6,8 +6,8 @@
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
if toolkit in ('qt', 'gtk2', 'gtk3'):
DIRS += ['unix']
if toolkit in ('qt'):
DIRS += ['qt']
elif toolkit == 'windows':
DIRS += ['windows']
elif toolkit == 'cocoa':

View File

@ -4,6 +4,6 @@
include $(topsrcdir)/config/rules.mk
ifdef MOZ_ENABLE_QTMOBILITY
ifdef MOZ_ENABLE_QT5GEOPOSITION
CXXFLAGS += $(MOZ_QT_CFLAGS)
endif

View File

@ -12,6 +12,9 @@ NS_IMPL_ISUPPORTS1(QTMLocationProvider, nsIGeolocationProvider)
QTMLocationProvider::QTMLocationProvider()
{
if (QMetaType::type("QGeoPositionInfo") == QMetaType::UnknownType) {
qRegisterMetaType<QGeoPositionInfo>("QGeoPositionInfo");
}
mLocation = QGeoPositionInfoSource::createDefaultSource(this);
if (mLocation)
connect(mLocation, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo)));
@ -57,6 +60,9 @@ QTMLocationProvider::Startup()
if (!mLocation)
return NS_ERROR_NOT_IMPLEMENTED;
// Not all versions of qt5positioning set default prefered method
// thus this workaround initializing QGeoPositionSource explicitly
SetHighAccuracy(false);
mLocation->startUpdates();
return NS_OK;
@ -83,7 +89,13 @@ QTMLocationProvider::Shutdown()
}
NS_IMETHODIMP
QTMLocationProvider::SetHighAccuracy(bool)
QTMLocationProvider::SetHighAccuracy(bool aHigh)
{
return NS_OK;
if (!mLocation)
return NS_ERROR_NOT_IMPLEMENTED;
mLocation->setPreferredPositioningMethods(aHigh ?
QGeoPositionInfoSource::SatellitePositioningMethods :
QGeoPositionInfoSource::AllPositioningMethods);
return NS_OK;
}

View File

@ -10,9 +10,6 @@
#include "nsIGeolocationProvider.h"
#include "nsCOMPtr.h"
using namespace QtMobility;
class QTMLocationProvider : public QObject,
public nsIGeolocationProvider
{

View File

@ -0,0 +1,20 @@
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* 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 <QFeedbackEffect>
#include "QtHapticFeedback.h"
NS_IMPL_ISUPPORTS1(QtHapticFeedback, nsIHapticFeedback)
NS_IMETHODIMP
QtHapticFeedback::PerformSimpleAction(int32_t aType)
{
if (aType == ShortPress)
QFeedbackEffect::playThemeEffect(QFeedbackEffect::PressWeak);
if (aType == LongPress)
QFeedbackEffect::playThemeEffect(QFeedbackEffect::PressStrong);
return NS_OK;
}

View File

@ -5,7 +5,7 @@
#include "nsIHapticFeedback.h"
class nsHapticFeedback : public nsIHapticFeedback
class QtHapticFeedback : public nsIHapticFeedback
{
public:
NS_DECL_ISUPPORTS

View File

@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_ENABLE_QTMOBILITY']:
if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']:
GENERATED_SOURCES += [
'moc_QTMLocationProvider.cpp',
]
@ -16,6 +16,11 @@ if CONFIG['MOZ_ENABLE_QTMOBILITY']:
'/dom/src/geolocation',
]
if CONFIG['MOZ_ENABLE_QT5FEEDBACK']:
SOURCES += [
'QtHapticFeedback.cpp',
]
FAIL_ON_WARNINGS = True
include('/ipc/chromium/chromium-config.mozbuild')

View File

@ -1,68 +0,0 @@
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if (MOZ_PLATFORM_MAEMO == 5)
#include <dbus/dbus.h>
#include <mce/dbus-names.h>
#endif
#if defined(MOZ_ENABLE_QTMOBILITY)
#include <QFeedbackEffect>
using namespace QtMobility;
#endif
#include "nsHapticFeedback.h"
NS_IMPL_ISUPPORTS1(nsHapticFeedback, nsIHapticFeedback)
NS_IMETHODIMP
nsHapticFeedback::PerformSimpleAction(int32_t aType)
{
#if (MOZ_PLATFORM_MAEMO == 5)
DBusError err;
dbus_error_init(&err);
DBusConnection *connection;
connection = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if (dbus_error_is_set(&err)) {
dbus_error_free(&err);
return NS_ERROR_FAILURE;
}
if (nullptr == connection) {
return NS_ERROR_FAILURE;
}
dbus_connection_set_exit_on_disconnect(connection,false);
DBusMessage* msg =
dbus_message_new_method_call(MCE_SERVICE, MCE_REQUEST_PATH,
MCE_REQUEST_IF, MCE_ACTIVATE_VIBRATOR_PATTERN);
if (!msg) {
return NS_ERROR_FAILURE;
}
dbus_message_set_no_reply(msg, true);
DBusMessageIter iter;
dbus_message_iter_init_append(msg, &iter);
const char* pattern = "PatternTouchscreen";
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &pattern);
if (dbus_connection_send(connection, msg, nullptr)) {
dbus_connection_flush(connection);
dbus_message_unref(msg);
} else {
dbus_message_unref(msg);
return NS_ERROR_FAILURE;
}
#elif defined(MOZ_ENABLE_QTMOBILITY)
if (aType == ShortPress)
QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeBasicButton);
if (aType == LongPress)
QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeLongPress);
#endif
return NS_OK;
}

View File

@ -19,7 +19,7 @@ interface MouseEvent : UIEvent {
readonly attribute boolean shiftKey;
readonly attribute boolean altKey;
readonly attribute boolean metaKey;
readonly attribute unsigned short button;
readonly attribute short button;
readonly attribute unsigned short buttons;
readonly attribute EventTarget? relatedTarget;
// Deprecated in DOM Level 3:
@ -37,7 +37,7 @@ interface MouseEvent : UIEvent {
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
short buttonArg,
EventTarget? relatedTargetArg);
// Introduced in DOM Level 3:
boolean getModifierState(DOMString keyArg);
@ -69,7 +69,7 @@ dictionary MouseEventInit {
boolean shiftKey = false;
boolean altKey = false;
boolean metaKey = false;
unsigned short button = 0;
short button = 0;
// Note: "buttons" was not previously initializable through initMouseEvent!
unsigned short buttons = 0;
EventTarget? relatedTarget = null;
@ -109,7 +109,7 @@ partial interface MouseEvent
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
short buttonArg,
EventTarget? relatedTargetArg,
float pressure,
unsigned short inputSourceArg);

View File

@ -1554,6 +1554,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(XMLHttpRequest,
nsXHREventTarget)
tmp->ReleaseProxy(XHRIsGoingAway);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mUpload)
tmp->mStateData.mResponse.setUndefined();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(XMLHttpRequest,

View File

@ -223,22 +223,20 @@ nsXBLDocGlobalObject::GetPrincipal()
/* Implementation file */
static bool
TraverseProtos(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
TraverseProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
nsCycleCollectionTraversalCallback *cb =
nsCycleCollectionTraversalCallback *cb =
static_cast<nsCycleCollectionTraversalCallback*>(aClosure);
nsXBLPrototypeBinding *proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->Traverse(*cb);
return kHashEnumerateNext;
aProto->Traverse(*cb);
return PL_DHASH_NEXT;
}
static bool
UnlinkProtoJSObjects(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
UnlinkProtoJSObjects(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
nsXBLPrototypeBinding *proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->UnlinkJSObjects();
return kHashEnumerateNext;
aProto->UnlinkJSObjects();
return PL_DHASH_NEXT;
}
struct ProtoTracer
@ -247,20 +245,19 @@ struct ProtoTracer
void *mClosure;
};
static bool
TraceProtos(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
TraceProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
ProtoTracer* closure = static_cast<ProtoTracer*>(aClosure);
nsXBLPrototypeBinding *proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->Trace(closure->mCallbacks, closure->mClosure);
return kHashEnumerateNext;
aProto->Trace(closure->mCallbacks, closure->mClosure);
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLDocumentInfo)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLDocumentInfo)
if (tmp->mBindingTable) {
tmp->mBindingTable->Enumerate(UnlinkProtoJSObjects, nullptr);
tmp->mBindingTable->EnumerateRead(UnlinkProtoJSObjects, nullptr);
}
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mGlobalObject)
@ -273,7 +270,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXBLDocumentInfo)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument)
if (tmp->mBindingTable) {
tmp->mBindingTable->Enumerate(TraverseProtos, &cb);
tmp->mBindingTable->EnumerateRead(TraverseProtos, &cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGlobalObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
@ -281,7 +278,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXBLDocumentInfo)
if (tmp->mBindingTable) {
ProtoTracer closure = { aCallbacks, aClosure };
tmp->mBindingTable->Enumerate(TraceProtos, &closure);
tmp->mBindingTable->EnumerateRead(TraceProtos, &closure);
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END
@ -291,12 +288,11 @@ UnmarkXBLJSObject(void* aP, const char* aName, void* aClosure)
JS::ExposeObjectToActiveJS(static_cast<JSObject*>(aP));
}
static bool
UnmarkProtos(nsHashKey* aKey, void* aData, void* aClosure)
static PLDHashOperator
UnmarkProtos(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
nsXBLPrototypeBinding* proto = static_cast<nsXBLPrototypeBinding*>(aData);
proto->Trace(TraceCallbackFunc(UnmarkXBLJSObject), nullptr);
return kHashEnumerateNext;
aProto->Trace(TraceCallbackFunc(UnmarkXBLJSObject), nullptr);
return PL_DHASH_NEXT;
}
void
@ -307,7 +303,7 @@ nsXBLDocumentInfo::MarkInCCGeneration(uint32_t aGeneration)
}
// Unmark any JS we hold
if (mBindingTable) {
mBindingTable->Enumerate(UnmarkProtos, nullptr);
mBindingTable->EnumerateRead(UnmarkProtos, nullptr);
}
if (mGlobalObject) {
mGlobalObject->UnmarkCompilationGlobal();
@ -326,7 +322,6 @@ nsXBLDocumentInfo::nsXBLDocumentInfo(nsIDocument* aDocument)
: mDocument(aDocument),
mScriptAccess(true),
mIsChrome(false),
mBindingTable(nullptr),
mFirstBinding(nullptr)
{
nsIURI* uri = aDocument->GetDocumentURI();
@ -367,11 +362,7 @@ nsXBLDocumentInfo::~nsXBLDocumentInfo()
if (mGlobalObject) {
mGlobalObject->ClearGlobalObjectOwner(); // just in case
}
if (mBindingTable) {
delete mBindingTable;
mBindingTable = nullptr;
mozilla::DropJSObjects(this);
}
mozilla::DropJSObjects(this);
}
nsXBLPrototypeBinding*
@ -385,32 +376,19 @@ nsXBLDocumentInfo::GetPrototypeBinding(const nsACString& aRef)
return mFirstBinding;
}
const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
nsCStringKey key(flat.get());
return static_cast<nsXBLPrototypeBinding*>(mBindingTable->Get(&key));
}
static bool
DeletePrototypeBinding(nsHashKey* aKey, void* aData, void* aClosure)
{
nsXBLPrototypeBinding* binding = static_cast<nsXBLPrototypeBinding*>(aData);
delete binding;
return true;
return mBindingTable->Get(aRef);
}
nsresult
nsXBLDocumentInfo::SetPrototypeBinding(const nsACString& aRef, nsXBLPrototypeBinding* aBinding)
{
if (!mBindingTable) {
mBindingTable = new nsObjectHashtable(nullptr, nullptr, DeletePrototypeBinding, nullptr);
mBindingTable = new nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>();
mozilla::HoldJSObjects(this);
}
const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
nsCStringKey key(flat.get());
NS_ENSURE_STATE(!mBindingTable->Get(&key));
mBindingTable->Put(&key, aBinding);
NS_ENSURE_STATE(!mBindingTable->Get(aRef));
mBindingTable->Put(aRef, aBinding);
return NS_OK;
}
@ -419,22 +397,18 @@ void
nsXBLDocumentInfo::RemovePrototypeBinding(const nsACString& aRef)
{
if (mBindingTable) {
// Use a flat string to avoid making a copy.
const nsPromiseFlatCString& flat = PromiseFlatCString(aRef);
nsCStringKey key(flat);
mBindingTable->Remove(&key);
mBindingTable->Remove(aRef);
}
}
// Callback to enumerate over the bindings from this document and write them
// out to the cache.
bool
WriteBinding(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
WriteBinding(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
nsXBLPrototypeBinding* binding = static_cast<nsXBLPrototypeBinding *>(aData);
binding->Write((nsIObjectOutputStream*)aClosure);
aProto->Write((nsIObjectOutputStream*)aClosure);
return kHashEnumerateNext;
return PL_DHASH_NEXT;
}
// static
@ -530,8 +504,9 @@ nsXBLDocumentInfo::WritePrototypeBindings()
rv = stream->Write32(XBLBinding_Serialize_Version);
NS_ENSURE_SUCCESS(rv, rv);
if (mBindingTable)
mBindingTable->Enumerate(WriteBinding, stream);
if (mBindingTable) {
mBindingTable->EnumerateRead(WriteBinding, stream);
}
// write a end marker at the end
rv = stream->Write8(XBLBinding_Serialize_NoMoreBindings);
@ -554,18 +529,19 @@ nsXBLDocumentInfo::SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding)
mFirstBinding = aBinding;
}
bool FlushScopedSkinSheets(nsHashKey* aKey, void* aData, void* aClosure)
static PLDHashOperator
FlushScopedSkinSheets(const nsACString &aKey, nsXBLPrototypeBinding *aProto, void* aClosure)
{
nsXBLPrototypeBinding* proto = (nsXBLPrototypeBinding*)aData;
proto->FlushSkinSheets();
return true;
aProto->FlushSkinSheets();
return PL_DHASH_NEXT;
}
void
nsXBLDocumentInfo::FlushSkinStylesheets()
{
if (mBindingTable)
mBindingTable->Enumerate(FlushScopedSkinSheets);
if (mBindingTable) {
mBindingTable->EnumerateRead(FlushScopedSkinSheets, nullptr);
}
}
JSObject*

View File

@ -13,7 +13,6 @@
#include "nsCycleCollectionParticipant.h"
class nsXBLPrototypeBinding;
class nsObjectHashtable;
class nsXBLDocGlobalObject;
class nsXBLDocumentInfo : public nsSupportsWeakReference
@ -41,7 +40,7 @@ public:
nsresult WritePrototypeBindings();
void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
void FlushSkinStylesheets();
bool IsChrome() { return mIsChrome; }
@ -60,7 +59,8 @@ private:
bool mScriptAccess;
bool mIsChrome;
// the binding table owns each nsXBLPrototypeBinding
nsObjectHashtable* mBindingTable;
nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
// non-owning pointer to the first binding in the table
nsXBLPrototypeBinding* mFirstBinding;

View File

@ -100,7 +100,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding()
mKeyHandlersRegistered(false),
mChromeOnlyContent(false),
mResources(nullptr),
mAttributeTable(nullptr),
mBaseNameSpaceID(kNameSpaceID_None)
{
MOZ_COUNT_CTOR(nsXBLPrototypeBinding);
@ -181,7 +180,6 @@ nsXBLPrototypeBinding::Initialize()
nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
{
delete mResources;
delete mAttributeTable;
delete mImplementation;
MOZ_COUNT_DTOR(nsXBLPrototypeBinding);
}
@ -325,14 +323,12 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute,
{
if (!mAttributeTable)
return;
nsPRUint32Key nskey(aNameSpaceID);
nsObjectHashtable *attributesNS = static_cast<nsObjectHashtable*>(mAttributeTable->Get(&nskey));
InnerAttributeTable *attributesNS = mAttributeTable->Get(aNameSpaceID);
if (!attributesNS)
return;
nsISupportsKey key(aAttribute);
nsXBLAttributeEntry* xblAttr = static_cast<nsXBLAttributeEntry*>
(attributesNS->Get(&key));
nsXBLAttributeEntry* xblAttr = attributesNS->Get(aAttribute);
if (!xblAttr)
return;
@ -500,12 +496,12 @@ struct nsXBLAttrChangeData
};
// XXXbz this duplicates lots of AttributeChanged
bool SetAttrs(nsHashKey* aKey, void* aData, void* aClosure)
static PLDHashOperator
SetAttrs(nsISupports* aKey, nsXBLAttributeEntry* aEntry, void* aClosure)
{
nsXBLAttributeEntry* entry = static_cast<nsXBLAttributeEntry*>(aData);
nsXBLAttrChangeData* changeData = static_cast<nsXBLAttrChangeData*>(aClosure);
nsIAtom* src = entry->GetSrcAttribute();
nsIAtom* src = aEntry->GetSrcAttribute();
int32_t srcNs = changeData->mSrcNamespace;
nsAutoString value;
bool attrPresent = true;
@ -529,7 +525,7 @@ bool SetAttrs(nsHashKey* aKey, void* aData, void* aClosure)
nsIContent* content =
changeData->mProto->GetImmediateChild(nsGkAtoms::content);
nsXBLAttributeEntry* curr = entry;
nsXBLAttributeEntry* curr = aEntry;
while (curr) {
nsIAtom* dst = curr->GetDstAttribute();
int32_t dstNs = curr->GetDstNameSpace();
@ -560,21 +556,20 @@ bool SetAttrs(nsHashKey* aKey, void* aData, void* aClosure)
}
}
return true;
return PL_DHASH_NEXT;
}
bool SetAttrsNS(nsHashKey* aKey, void* aData, void* aClosure)
static PLDHashOperator
SetAttrsNS(const uint32_t &aNamespace,
nsXBLPrototypeBinding::InnerAttributeTable* aXBLAttributes,
void* aClosure)
{
if (aData && aClosure) {
nsPRUint32Key * key = static_cast<nsPRUint32Key*>(aKey);
nsObjectHashtable* xblAttributes =
static_cast<nsObjectHashtable*>(aData);
nsXBLAttrChangeData * changeData = static_cast<nsXBLAttrChangeData *>
(aClosure);
changeData->mSrcNamespace = key->GetValue();
xblAttributes->Enumerate(SetAttrs, (void*)changeData);
if (aXBLAttributes && aClosure) {
nsXBLAttrChangeData* changeData = static_cast<nsXBLAttrChangeData*>(aClosure);
changeData->mSrcNamespace = aNamespace;
aXBLAttributes->EnumerateRead(SetAttrs, aClosure);
}
return true;
return PL_DHASH_NEXT;
}
void
@ -582,7 +577,7 @@ nsXBLPrototypeBinding::SetInitialAttributes(nsIContent* aBoundElement, nsIConten
{
if (mAttributeTable) {
nsXBLAttrChangeData data(this, aBoundElement, aAnonymousContent);
mAttributeTable->Enumerate(SetAttrsNS, (void*)&data);
mAttributeTable->EnumerateRead(SetAttrsNS, &data);
}
}
@ -616,27 +611,11 @@ nsXBLPrototypeBinding::GetStyleSheets()
return nullptr;
}
static bool
DeleteAttributeEntry(nsHashKey* aKey, void* aData, void* aClosure)
{
delete static_cast<nsXBLAttributeEntry*>(aData);
return true;
}
static bool
DeleteAttributeTable(nsHashKey* aKey, void* aData, void* aClosure)
{
delete static_cast<nsObjectHashtable*>(aData);
return true;
}
void
nsXBLPrototypeBinding::EnsureAttributeTable()
{
if (!mAttributeTable) {
mAttributeTable = new nsObjectHashtable(nullptr, nullptr,
DeleteAttributeTable,
nullptr, 4);
mAttributeTable = new nsClassHashtable<nsUint32HashKey, InnerAttributeTable>(4);
}
}
@ -645,24 +624,18 @@ nsXBLPrototypeBinding::AddToAttributeTable(int32_t aSourceNamespaceID, nsIAtom*
int32_t aDestNamespaceID, nsIAtom* aDestTag,
nsIContent* aContent)
{
nsPRUint32Key nskey(aSourceNamespaceID);
nsObjectHashtable* attributesNS =
static_cast<nsObjectHashtable*>(mAttributeTable->Get(&nskey));
InnerAttributeTable* attributesNS = mAttributeTable->Get(aSourceNamespaceID);
if (!attributesNS) {
attributesNS = new nsObjectHashtable(nullptr, nullptr,
DeleteAttributeEntry,
nullptr, 4);
mAttributeTable->Put(&nskey, attributesNS);
attributesNS = new InnerAttributeTable(4);
mAttributeTable->Put(aSourceNamespaceID, attributesNS);
}
nsXBLAttributeEntry* xblAttr =
new nsXBLAttributeEntry(aSourceTag, aDestTag, aDestNamespaceID, aContent);
nsISupportsKey key(aSourceTag);
nsXBLAttributeEntry* entry = static_cast<nsXBLAttributeEntry*>
(attributesNS->Get(&key));
nsXBLAttributeEntry* entry = attributesNS->Get(aSourceTag);
if (!entry) {
attributesNS->Put(&key, xblAttr);
attributesNS->Put(aSourceTag, xblAttr);
} else {
while (entry->GetNext())
entry = entry->GetNext();
@ -1421,44 +1394,41 @@ struct WriteAttributeData
{ }
};
static
bool
WriteAttribute(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
WriteAttribute(nsISupports* aKey, nsXBLAttributeEntry* aEntry, void* aClosure)
{
WriteAttributeData* data = static_cast<WriteAttributeData *>(aClosure);
nsIObjectOutputStream* stream = data->stream;
const int32_t srcNamespace = data->srcNamespace;
nsXBLAttributeEntry* entry = static_cast<nsXBLAttributeEntry *>(aData);
do {
if (entry->GetElement() == data->content) {
if (aEntry->GetElement() == data->content) {
data->binding->WriteNamespace(stream, srcNamespace);
stream->WriteWStringZ(nsDependentAtomString(entry->GetSrcAttribute()).get());
data->binding->WriteNamespace(stream, entry->GetDstNameSpace());
stream->WriteWStringZ(nsDependentAtomString(entry->GetDstAttribute()).get());
stream->WriteWStringZ(nsDependentAtomString(aEntry->GetSrcAttribute()).get());
data->binding->WriteNamespace(stream, aEntry->GetDstNameSpace());
stream->WriteWStringZ(nsDependentAtomString(aEntry->GetDstAttribute()).get());
}
entry = entry->GetNext();
} while (entry);
aEntry = aEntry->GetNext();
} while (aEntry);
return kHashEnumerateNext;
return PL_DHASH_NEXT;
}
// WriteAttributeNS is the callback to enumerate over the attribute
// forwarding entries. Since these are stored in a hash of hashes,
// we need to iterate over the inner hashes, calling WriteAttribute
// to do the actual work.
static
bool
WriteAttributeNS(nsHashKey *aKey, void *aData, void* aClosure)
static PLDHashOperator
WriteAttributeNS(const uint32_t &aNamespace,
nsXBLPrototypeBinding::InnerAttributeTable* aXBLAttributes,
void* aClosure)
{
WriteAttributeData* data = static_cast<WriteAttributeData *>(aClosure);
data->srcNamespace = static_cast<nsPRUint32Key *>(aKey)->GetValue();
data->srcNamespace = aNamespace;
aXBLAttributes->EnumerateRead(WriteAttribute, data);
nsObjectHashtable* attributes = static_cast<nsObjectHashtable*>(aData);
attributes->Enumerate(WriteAttribute, data);
return kHashEnumerateNext;
return PL_DHASH_NEXT;
}
nsresult
@ -1542,7 +1512,7 @@ nsXBLPrototypeBinding::WriteContentNode(nsIObjectOutputStream* aStream,
// Write out the attribute fowarding information
if (mAttributeTable) {
WriteAttributeData data(this, aStream, aNode);
mAttributeTable->Enumerate(WriteAttributeNS, &data);
mAttributeTable->EnumerateRead(WriteAttributeNS, &data);
}
rv = aStream->Write8(XBLBinding_Serialize_NoMoreAttributes);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -9,7 +9,6 @@
#include "nsClassHashtable.h"
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsHashtable.h"
#include "nsICSSLoaderObserver.h"
#include "nsInterfaceHashtable.h"
#include "nsWeakReference.h"
@ -22,8 +21,9 @@
class nsIAtom;
class nsIContent;
class nsIDocument;
class nsXBLProtoImplField;
class nsXBLAttributeEntry;
class nsXBLBinding;
class nsXBLProtoImplField;
// *********************************************************************/
// The XBLPrototypeBinding class
@ -245,6 +245,9 @@ public:
nsIContent* aTemplChild);
bool ChromeOnlyContent() { return mChromeOnlyContent; }
typedef nsClassHashtable<nsISupportsHashKey, nsXBLAttributeEntry> InnerAttributeTable;
protected:
// Ensure that mAttributeTable has been created.
void EnsureAttributeTable();
@ -278,9 +281,10 @@ protected:
nsXBLDocumentInfo* mXBLDocInfoWeak; // A pointer back to our doc info. Weak, since it owns us.
nsObjectHashtable* mAttributeTable; // A table for attribute containers. Namespace IDs are used as
// keys in the table. Containers are nsObjectHashtables.
// This table is used to efficiently handle attribute changes.
// A table for attribute containers. Namespace IDs are used as
// keys in the table. Containers are InnerAttributeTables.
// This table is used to efficiently handle attribute changes.
nsAutoPtr<nsClassHashtable<nsUint32HashKey, InnerAttributeTable>> mAttributeTable;
class IIDHashKey : public PLDHashEntryHdr
{

View File

@ -644,7 +644,7 @@ nsXBLPrototypeHandler::MouseEventMatched(nsIDOMMouseEvent* aMouseEvent)
if (mDetail == -1 && mMisc == 0 && (mKeyMask & cAllModifiers) == 0)
return true; // No filters set up. It's generic.
uint16_t button;
int16_t button;
aMouseEvent->GetButton(&button);
if (mDetail != -1 && (button != mDetail))
return false;

View File

@ -587,7 +587,7 @@ nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
// IME to commit before we change the cursor position
mEditor->ForceCompositionEnd();
uint16_t button = (uint16_t)-1;
int16_t button = -1;
mouseEvent->GetButton(&button);
// middle-mouse click (paste);
if (button == 1)

View File

@ -91,7 +91,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
// Detect only "context menu" click
//XXX This should be easier to do!
// But eDOMEvents_contextmenu and NS_CONTEXTMENU is not exposed in any event interface :-(
uint16_t buttonNumber;
int16_t buttonNumber;
nsresult res = mouseEvent->GetButton(&buttonNumber);
NS_ENSURE_SUCCESS(res, res);

View File

@ -1947,7 +1947,7 @@ nsresult mozInlineSpellChecker::MouseClick(nsIDOMEvent *aMouseEvent)
// ignore any errors from HandleNavigationEvent as we don't want to prevent
// anyone else from seeing this event.
uint16_t button;
int16_t button;
mouseEvent->GetButton(&button);
HandleNavigationEvent(button != 0);
return NS_OK;

View File

@ -164,6 +164,7 @@ struct DrawSurfaceOptions {
class GradientStops : public RefCounted<GradientStops>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GradientStops)
virtual ~GradientStops() {}
virtual BackendType GetBackendType() const = 0;
@ -316,6 +317,7 @@ public:
class SourceSurface : public RefCounted<SourceSurface>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(SourceSurface)
virtual ~SourceSurface() {}
virtual SurfaceType GetType() const = 0;
@ -396,6 +398,7 @@ public:
class PathSink : public RefCounted<PathSink>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(PathSink)
virtual ~PathSink() {}
/* Move the current point in the path, any figure currently being drawn will
@ -434,6 +437,7 @@ class FlattenedPath;
class Path : public RefCounted<Path>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Path)
virtual ~Path();
virtual BackendType GetBackendType() const = 0;
@ -533,6 +537,7 @@ struct GlyphBuffer
class ScaledFont : public RefCounted<ScaledFont>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(ScaledFont)
virtual ~ScaledFont() {}
typedef void (*FontFileDataOutput)(const uint8_t *aData, uint32_t aLength, uint32_t aIndex, Float aGlyphSize, void *aBaton);
@ -591,6 +596,7 @@ struct FontOptions
class GlyphRenderingOptions : public RefCounted<GlyphRenderingOptions>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(GlyphRenderingOptions)
virtual ~GlyphRenderingOptions() {}
virtual FontType GetType() const = 0;
@ -607,6 +613,7 @@ protected:
class DrawTarget : public RefCounted<DrawTarget>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DrawTarget)
DrawTarget() : mTransformDirty(false), mPermitSubpixelAA(false) {}
virtual ~DrawTarget() {}
@ -989,6 +996,7 @@ protected:
class DrawEventRecorder : public RefCounted<DrawEventRecorder>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DrawEventRecorder)
virtual ~DrawEventRecorder() { }
};

View File

@ -466,6 +466,7 @@ enum UnpremultiplyInputs
class FilterNode : public RefCounted<FilterNode>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(FilterMode)
virtual ~FilterNode() {}
virtual FilterBackend GetBackendType() = 0;

View File

@ -62,6 +62,7 @@ CGContextType GetContextType(CGContextRef ref);
class MacIOSurface : public mozilla::RefCounted<MacIOSurface> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(MacIOSurface)
typedef mozilla::gfx::SourceSurface SourceSurface;
static mozilla::TemporaryRef<MacIOSurface> CreateIOSurface(int aWidth, int aHeight,

View File

@ -27,6 +27,7 @@ enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERE
class nsCARenderer : public mozilla::RefCounted<nsCARenderer> {
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(nsCARenderer)
nsCARenderer() : mCARenderer(nullptr), mWrapperCALayer(nullptr), mFBOTexture(0),
mOpenGLContext(nullptr), mCGImage(nullptr), mCGData(nullptr),
mIOSurface(nullptr), mFBO(0), mIOTexture(0),

View File

@ -56,7 +56,6 @@
#include <QtGui/QPixmap>
#include <QtGui/QBrush>
#include <QtGui/QPen>
#include <QWidget>
#include <QtCore/QVarLengthArray>
#include <sys/time.h>
@ -589,8 +588,6 @@ _cairo_qt_surface_acquire_dest_image (void *abstract_surface,
qimg = new QImage(((QImage*) pd)->copy());
} else if (pd->devType() == QInternal::Pixmap) {
qimg = new QImage(((QPixmap*) pd)->toImage());
} else if (pd->devType() == QInternal::Widget) {
qimg = new QImage(QPixmap::grabWindow(((QWidget*)pd)->winId()).toImage());
}
}

View File

@ -13,6 +13,8 @@
#include <gdk/gdkx.h>
// we're using default display for now
#define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
#elif defined(MOZ_WIDGET_QT)
#define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)(aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW))
#elif defined(MOZ_WIDGET_GONK)
#define GET_NATIVE_WINDOW(aWidget) ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
#include "HwcComposer2D.h"

View File

@ -8,8 +8,7 @@
#include <gdk/gdkx.h>
#define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
#elif defined(MOZ_WIDGET_QT)
#include <QWidget>
#define GET_NATIVE_WINDOW(aWidget) static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->winId()
#define GET_NATIVE_WINDOW(aWidget) (Window)(aWidget->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW))
#endif
#include <X11/Xlib.h>

0
gfx/gl/GLContextSkia.cpp Normal file → Executable file
View File

0
gfx/gl/GLScreenBuffer.cpp Normal file → Executable file
View File

View File

@ -21,7 +21,7 @@ SurfaceStream::ChooseGLStreamType(SurfaceStream::OMTC omtc,
if (preserveBuffer)
return SurfaceStreamType::TripleBuffer_Copy;
else
return SurfaceStreamType::TripleBuffer_Async;
return SurfaceStreamType::TripleBuffer;
} else {
if (preserveBuffer)
return SurfaceStreamType::SingleBuffer;
@ -42,9 +42,6 @@ SurfaceStream::CreateForType(SurfaceStreamType type, mozilla::gl::GLContext* glC
case SurfaceStreamType::TripleBuffer_Copy:
result = new SurfaceStream_TripleBuffer_Copy(prevStream);
break;
case SurfaceStreamType::TripleBuffer_Async:
result = new SurfaceStream_TripleBuffer_Async(prevStream);
break;
case SurfaceStreamType::TripleBuffer:
result = new SurfaceStream_TripleBuffer(prevStream);
break;
@ -415,9 +412,7 @@ SurfaceStream_TripleBuffer::SwapProducer(SurfaceFactory* factory,
if (mProducer) {
RecycleScraps(factory);
// If WaitForCompositor succeeds, mStaging has moved to mConsumer.
// If it failed, we might have to scrap it.
if (mStaging && !WaitForCompositor())
if (mStaging)
Scrap(mStaging);
MOZ_ASSERT(!mStaging);
@ -444,26 +439,5 @@ SurfaceStream_TripleBuffer::SwapConsumer_NoWait()
return mConsumer;
}
SurfaceStream_TripleBuffer_Async::SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream)
: SurfaceStream_TripleBuffer(SurfaceStreamType::TripleBuffer_Async, prevStream)
{
}
SurfaceStream_TripleBuffer_Async::~SurfaceStream_TripleBuffer_Async()
{
}
bool
SurfaceStream_TripleBuffer_Async::WaitForCompositor()
{
PROFILER_LABEL("SurfaceStream_TripleBuffer_Async", "WaitForCompositor");
// We are assumed to be locked
while (mStaging)
mMonitor.Wait();
return true;
}
} /* namespace gfx */
} /* namespace mozilla */

View File

@ -183,9 +183,6 @@ protected:
SharedSurface* mStaging;
SharedSurface* mConsumer;
// Returns true if we were able to wait, false if not
virtual bool WaitForCompositor() { return false; }
// To support subclasses initializing the mType.
SurfaceStream_TripleBuffer(SurfaceStreamType type, SurfaceStream* prevStream);
@ -207,18 +204,6 @@ public:
virtual void SurrenderSurfaces(SharedSurface*& producer, SharedSurface*& consumer);
};
class SurfaceStream_TripleBuffer_Async
: public SurfaceStream_TripleBuffer
{
protected:
virtual bool WaitForCompositor();
public:
SurfaceStream_TripleBuffer_Async(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer_Async();
};
} /* namespace gfx */
} /* namespace mozilla */

View File

@ -87,7 +87,6 @@ MOZ_END_ENUM_CLASS(SharedSurfaceType)
MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t)
SingleBuffer,
TripleBuffer_Copy,
TripleBuffer_Async,
TripleBuffer,
Max
MOZ_END_ENUM_CLASS(SurfaceStreamType)

View File

@ -179,6 +179,7 @@ enum SurfaceInitMode
class Compositor : public RefCounted<Compositor>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(Compositor)
Compositor(PCompositorParent* aParent = nullptr)
: mCompositorID(0)
, mDiagnosticTypes(DIAGNOSTIC_NONE)

View File

@ -39,6 +39,7 @@ namespace layers {
struct Effect : public RefCounted<Effect>
{
MOZ_DECLARE_REFCOUNTED_TYPENAME(Effect)
Effect(EffectTypes aType) : mType(aType) {}
EffectTypes mType;

View File

@ -48,20 +48,23 @@ struct SurfaceBufferInfo
} // anonymous namespace
static SurfaceBufferInfo*
GetBufferInfo(uint8_t* aBuffer)
GetBufferInfo(uint8_t* aData, size_t aDataSize)
{
return reinterpret_cast<SurfaceBufferInfo*>(aBuffer);
return aDataSize >= sizeof(SurfaceBufferInfo)
? reinterpret_cast<SurfaceBufferInfo*>(aData)
: nullptr;
}
void
ImageDataSerializer::InitializeBufferInfo(IntSize aSize,
SurfaceFormat aFormat)
{
SurfaceBufferInfo* info = GetBufferInfo(mData);
SurfaceBufferInfo* info = GetBufferInfo(mData, mDataSize);
MOZ_ASSERT(info); // OK to assert here, this method is client-side-only
info->width = aSize.width;
info->height = aSize.height;
info->format = aFormat;
Validate();
}
static inline uint32_t
@ -71,7 +74,7 @@ ComputeStride(SurfaceFormat aFormat, uint32_t aWidth)
}
uint32_t
ImageDataSerializer::ComputeMinBufferSize(IntSize aSize,
ImageDataSerializerBase::ComputeMinBufferSize(IntSize aSize,
SurfaceFormat aFormat)
{
uint32_t bufsize = aSize.height * ComputeStride(aFormat, aSize.width);
@ -79,11 +82,20 @@ ImageDataSerializer::ComputeMinBufferSize(IntSize aSize,
+ GetAlignedStride<16>(bufsize);
}
bool
ImageDataSerializerBase::IsValid() const
void
ImageDataSerializerBase::Validate()
{
// XXX - We could use some sanity checks here.
return !!mData;
mIsValid = false;
if (!mData) {
return;
}
SurfaceBufferInfo* info = GetBufferInfo(mData, mDataSize);
if (!info) {
return;
}
size_t requiredSize =
ComputeMinBufferSize(IntSize(info->width, info->height), info->format);
mIsValid = requiredSize <= mDataSize;
}
uint8_t*
@ -97,7 +109,7 @@ uint32_t
ImageDataSerializerBase::GetStride() const
{
MOZ_ASSERT(IsValid());
SurfaceBufferInfo* info = GetBufferInfo(mData);
SurfaceBufferInfo* info = GetBufferInfo(mData, mDataSize);
return ComputeStride(GetFormat(), info->width);
}
@ -105,7 +117,7 @@ IntSize
ImageDataSerializerBase::GetSize() const
{
MOZ_ASSERT(IsValid());
SurfaceBufferInfo* info = GetBufferInfo(mData);
SurfaceBufferInfo* info = GetBufferInfo(mData, mDataSize);
return IntSize(info->width, info->height);
}
@ -113,7 +125,7 @@ SurfaceFormat
ImageDataSerializerBase::GetFormat() const
{
MOZ_ASSERT(IsValid());
return GetBufferInfo(mData)->format;
return GetBufferInfo(mData, mDataSize)->format;
}
TemporaryRef<gfxImageSurface>

View File

@ -29,7 +29,7 @@ namespace layers {
class ImageDataSerializerBase
{
public:
bool IsValid() const;
bool IsValid() const { return mIsValid; }
uint8_t* GetData();
uint32_t GetStride() const;
@ -39,11 +39,22 @@ public:
TemporaryRef<gfxImageSurface> GetAsThebesSurface();
TemporaryRef<gfx::DrawTarget> GetAsDrawTarget();
static uint32_t ComputeMinBufferSize(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat);
protected:
ImageDataSerializerBase(uint8_t* aData)
: mData(aData) {}
ImageDataSerializerBase(uint8_t* aData, size_t aDataSize)
: mData(aData)
, mDataSize(aDataSize)
, mIsValid(false)
{}
void Validate();
uint8_t* mData;
size_t mDataSize;
bool mIsValid;
};
/**
@ -56,11 +67,14 @@ protected:
class MOZ_STACK_CLASS ImageDataSerializer : public ImageDataSerializerBase
{
public:
ImageDataSerializer(uint8_t* aData) : ImageDataSerializerBase(aData) {}
ImageDataSerializer(uint8_t* aData, size_t aDataSize)
: ImageDataSerializerBase(aData, aDataSize)
{
// a serializer needs to be usable before correct buffer info has been written to it
mIsValid = !!mData;
}
void InitializeBufferInfo(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat);
static uint32_t ComputeMinBufferSize(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat);
};
/**
@ -70,7 +84,11 @@ public:
class MOZ_STACK_CLASS ImageDataDeserializer : public ImageDataSerializerBase
{
public:
ImageDataDeserializer(uint8_t* aData) : ImageDataSerializerBase(aData) {}
ImageDataDeserializer(uint8_t* aData, size_t aDataSize)
: ImageDataSerializerBase(aData, aDataSize)
{
Validate();
}
};
} // namespace layers

View File

@ -51,70 +51,83 @@ struct YCbCrBufferInfo
StereoMode mStereoMode;
};
static YCbCrBufferInfo* GetYCbCrBufferInfo(uint8_t* aData)
static YCbCrBufferInfo* GetYCbCrBufferInfo(uint8_t* aData, size_t aDataSize)
{
return reinterpret_cast<YCbCrBufferInfo*>(aData);
return aDataSize >= sizeof(YCbCrBufferInfo)
? reinterpret_cast<YCbCrBufferInfo*>(aData)
: nullptr;
}
bool YCbCrImageDataDeserializerBase::IsValid()
void YCbCrImageDataDeserializerBase::Validate()
{
if (mData == nullptr) {
return false;
mIsValid = false;
if (!mData) {
return;
}
return true;
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
if (!info) {
return;
}
size_t requiredSize = ComputeMinBufferSize(
IntSize(info->mYWidth, info->mYHeight),
info->mYStride,
IntSize(info->mCbCrWidth, info->mCbCrHeight),
info->mCbCrStride);
mIsValid = requiredSize <= mDataSize;
}
uint8_t* YCbCrImageDataDeserializerBase::GetYData()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return reinterpret_cast<uint8_t*>(info) + info->mYOffset;
}
uint8_t* YCbCrImageDataDeserializerBase::GetCbData()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return reinterpret_cast<uint8_t*>(info) + info->mCbOffset;
}
uint8_t* YCbCrImageDataDeserializerBase::GetCrData()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return reinterpret_cast<uint8_t*>(info) + info->mCrOffset;
}
uint8_t* YCbCrImageDataDeserializerBase::GetData()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return (reinterpret_cast<uint8_t*>(info)) + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
uint32_t YCbCrImageDataDeserializerBase::GetYStride()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return info->mYStride;
}
uint32_t YCbCrImageDataDeserializerBase::GetCbCrStride()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return info->mCbCrStride;
}
gfx::IntSize YCbCrImageDataDeserializerBase::GetYSize()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return gfx::IntSize(info->mYWidth, info->mYHeight);
}
gfx::IntSize YCbCrImageDataDeserializerBase::GetCbCrSize()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return gfx::IntSize(info->mCbCrWidth, info->mCbCrHeight);
}
StereoMode YCbCrImageDataDeserializerBase::GetStereoMode()
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
return info->mStereoMode;
}
@ -126,17 +139,24 @@ static size_t ComputeOffset(uint32_t aHeight, uint32_t aStride)
// Minimum required shmem size in bytes
size_t
YCbCrImageDataSerializer::ComputeMinBufferSize(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize)
YCbCrImageDataDeserializerBase::ComputeMinBufferSize(const gfx::IntSize& aYSize,
uint32_t aYStride,
const gfx::IntSize& aCbCrSize,
uint32_t aCbCrStride)
{
uint32_t yStride = aYSize.width;
uint32_t CbCrStride = aCbCrSize.width;
return ComputeOffset(aYSize.height, yStride)
+ 2 * ComputeOffset(aCbCrSize.height, CbCrStride)
return ComputeOffset(aYSize.height, aYStride)
+ 2 * ComputeOffset(aCbCrSize.height, aCbCrStride)
+ MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
// Minimum required shmem size in bytes
size_t
YCbCrImageDataDeserializerBase::ComputeMinBufferSize(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize)
{
return ComputeMinBufferSize(aYSize, aYSize.width, aCbCrSize, aCbCrSize.width);
}
// Offset in bytes
static size_t ComputeOffset(uint32_t aSize)
{
@ -145,7 +165,7 @@ static size_t ComputeOffset(uint32_t aSize)
// Minimum required shmem size in bytes
size_t
YCbCrImageDataSerializer::ComputeMinBufferSize(uint32_t aSize)
YCbCrImageDataDeserializerBase::ComputeMinBufferSize(uint32_t aSize)
{
return ComputeOffset(aSize) + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
@ -160,7 +180,8 @@ YCbCrImageDataSerializer::InitializeBufferInfo(uint32_t aYOffset,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode)
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData, mDataSize);
MOZ_ASSERT(info); // OK to assert here, this method is client-side-only
uint32_t info_size = MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
info->mYOffset = info_size + aYOffset;
info->mCbOffset = info_size + aCbOffset;
@ -172,6 +193,7 @@ YCbCrImageDataSerializer::InitializeBufferInfo(uint32_t aYOffset,
info->mCbCrWidth = aCbCrSize.width;
info->mCbCrHeight = aCbCrSize.height;
info->mStereoMode = aStereoMode;
Validate();
}
void

View File

@ -30,7 +30,7 @@ class Image;
class YCbCrImageDataDeserializerBase
{
public:
bool IsValid();
bool IsValid() const { return mIsValid; }
/**
* Returns the Y channel data pointer.
@ -73,11 +73,32 @@ public:
* Return a pointer to the begining of the data buffer.
*/
uint8_t* GetData();
/**
* This function is meant as a helper to know how much shared memory we need
* to allocate in a shmem in order to place a shared YCbCr image blob of
* given dimensions.
*/
static size_t ComputeMinBufferSize(const gfx::IntSize& aYSize,
uint32_t aYStride,
const gfx::IntSize& aCbCrSize,
uint32_t aCbCrStride);
static size_t ComputeMinBufferSize(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize);
static size_t ComputeMinBufferSize(uint32_t aSize);
protected:
YCbCrImageDataDeserializerBase(uint8_t* aData)
: mData (aData) {}
YCbCrImageDataDeserializerBase(uint8_t* aData, size_t aDataSize)
: mData (aData)
, mDataSize(aDataSize)
, mIsValid(false)
{}
void Validate();
uint8_t* mData;
size_t mDataSize;
bool mIsValid;
};
/**
@ -95,16 +116,12 @@ protected:
class MOZ_STACK_CLASS YCbCrImageDataSerializer : public YCbCrImageDataDeserializerBase
{
public:
YCbCrImageDataSerializer(uint8_t* aData) : YCbCrImageDataDeserializerBase(aData) {}
/**
* This function is meant as a helper to know how much shared memory we need
* to allocate in a shmem in order to place a shared YCbCr image blob of
* given dimensions.
*/
static size_t ComputeMinBufferSize(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize);
static size_t ComputeMinBufferSize(uint32_t aSize);
YCbCrImageDataSerializer(uint8_t* aData, size_t aDataSize)
: YCbCrImageDataDeserializerBase(aData, aDataSize)
{
// a serializer needs to be usable before correct buffer info has been written to it
mIsValid = !!mData;
}
/**
* Write the image informations in the buffer for given dimensions.
@ -149,7 +166,11 @@ public:
class MOZ_STACK_CLASS YCbCrImageDataDeserializer : public YCbCrImageDataDeserializerBase
{
public:
YCbCrImageDataDeserializer(uint8_t* aData) : YCbCrImageDataDeserializerBase(aData) {}
YCbCrImageDataDeserializer(uint8_t* aData, size_t aDataSize)
: YCbCrImageDataDeserializerBase(aData, aDataSize)
{
Validate();
}
/**
* Convert the YCbCr data into RGB and return a DataSourceSurface.

View File

@ -180,7 +180,8 @@ public:
bool ConvertImageToRGB(const SurfaceDescriptor& aImage)
{
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>());
YCbCrImageDataDeserializer deserializer(aImage.get_YCbCrImage().data().get<uint8_t>(),
aImage.get_YCbCrImage().data().Size<uint8_t>());
PlanarYCbCrData data;
DeserializerToPlanarYCbCrImageData(deserializer, data);

View File

@ -72,6 +72,7 @@ class TextureClientData;
class CompositableClient : public AtomicRefCounted<CompositableClient>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(CompositableClient)
CompositableClient(CompositableForwarder* aForwarder);
virtual ~CompositableClient();

View File

@ -55,6 +55,7 @@ class TextureChild : public PTextureChild
, public AtomicRefCounted<TextureChild>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(TextureChild)
TextureChild()
: mForwarder(nullptr)
, mTextureData(nullptr)
@ -450,7 +451,7 @@ BufferTextureClient::UpdateSurface(gfxASurface* aSurface)
MOZ_ASSERT(!IsImmutable());
MOZ_ASSERT(IsValid());
ImageDataSerializer serializer(GetBuffer());
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
if (!serializer.IsValid()) {
return false;
}
@ -488,7 +489,7 @@ BufferTextureClient::GetAsSurface()
{
MOZ_ASSERT(IsValid());
ImageDataSerializer serializer(GetBuffer());
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
if (!serializer.IsValid()) {
return nullptr;
}
@ -515,7 +516,7 @@ BufferTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFla
memset(GetBuffer(), 0, bufSize);
}
ImageDataSerializer serializer(GetBuffer());
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
serializer.InitializeBufferInfo(aSize, mFormat);
mSize = aSize;
return true;
@ -532,7 +533,7 @@ BufferTextureClient::GetAsDrawTarget()
return mDrawTarget;
}
ImageDataSerializer serializer(GetBuffer());
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
if (!serializer.IsValid()) {
return nullptr;
}
@ -589,7 +590,7 @@ BufferTextureClient::Unlock()
// memory.
RefPtr<SourceSurface> snapshot = mDrawTarget->Snapshot();
RefPtr<DataSourceSurface> surface = snapshot->GetDataSurface();
ImageDataSerializer serializer(GetBuffer());
ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
if (!serializer.IsValid() || serializer.GetSize() != surface->GetSize()) {
NS_WARNING("Could not write the data back into the texture.");
mDrawTarget = nullptr;
@ -617,7 +618,7 @@ BufferTextureClient::UpdateYCbCr(const PlanarYCbCrData& aData)
MOZ_ASSERT(IsValid());
MOZ_ASSERT(aData.mCbSkip == aData.mCrSkip);
YCbCrImageDataSerializer serializer(GetBuffer());
YCbCrImageDataSerializer serializer(GetBuffer(), GetBufferSize());
MOZ_ASSERT(serializer.IsValid());
if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
aData.mYSize, aData.mYStride,
@ -647,7 +648,7 @@ BufferTextureClient::AllocateForYCbCr(gfx::IntSize aYSize,
if (!Allocate(bufSize)) {
return false;
}
YCbCrImageDataSerializer serializer(GetBuffer());
YCbCrImageDataSerializer serializer(GetBuffer(), GetBufferSize());
serializer.InitializeBufferInfo(aYSize,
aCbCrSize,
aStereoMode);
@ -970,7 +971,7 @@ AutoLockYCbCrClient::Update(PlanarYCbCrImage* aImage)
ipc::Shmem& shmem = mDescriptor->get_YCbCrImage().data();
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>(), shmem.Size<uint8_t>());
if (!serializer.CopyData(data->mYChannel, data->mCbChannel, data->mCrChannel,
data->mYSize, data->mYStride,
data->mCbCrSize, data->mCbCrStride,
@ -999,7 +1000,7 @@ bool AutoLockYCbCrClient::EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage
needsAllocation = true;
} else {
ipc::Shmem& shmem = mDescriptor->get_YCbCrImage().data();
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>(), shmem.Size<uint8_t>());
if (serializer.GetYSize() != data->mYSize ||
serializer.GetCbCrSize() != data->mCbCrSize) {
needsAllocation = true;
@ -1020,7 +1021,7 @@ bool AutoLockYCbCrClient::EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage
return false;
}
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
YCbCrImageDataSerializer serializer(shmem.get<uint8_t>(), shmem.Size<uint8_t>());
serializer.InitializeBufferInfo(data->mYSize,
data->mCbCrSize,
data->mStereoMode);

View File

@ -510,6 +510,7 @@ struct TextureClientAutoUnlock
class DeprecatedTextureClient : public RefCounted<DeprecatedTextureClient>
{
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(DeprecatedTextureClient)
typedef gl::SharedTextureHandle SharedTextureHandle;
typedef gl::GLContext GLContext;
typedef gl::TextureImage TextureImage;

View File

@ -66,6 +66,7 @@ class AsyncCompositionManager MOZ_FINAL : public RefCounted<AsyncCompositionMana
{
friend class AutoResolveRefLayers;
public:
MOZ_DECLARE_REFCOUNTED_TYPENAME(AsyncCompositionManager)
AsyncCompositionManager(LayerManagerComposite* aManager)
: mLayerManager(aManager)
, mIsFirstPaint(false)

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