mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:37:11 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1198124 - Enable -Wshadow in directories that have no -Wshadow warnings. r=glandium (d03cfc1bb6) - Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8 (3247b5b146) - Bug 1140120 - Remove a couple of unused test functions on ServiceWorkerContainer; r=baku (efe1119749) - Bug 1180148 - Clear service workers registered for a site when clearing the cookies and stored data is not working in b2g. r=baku (7fb1d522ff) - Bug 1162333 - Add stronger assertions to PromiseWorkerProxy in debug builds. r=catalinb (0005a76252) - Bug 1190672 - Fix use of AutoReleasePromiseWorkerProxy in PushManager. r=catalinb (18f7358163) - Bug 1191495 - Relax PushManager callback assertions. r=kitcambridge (8a3822969f) - Bug 1189543 - pushManager.getSubscription() should return null for nonexistent push subscriptions in workers. r=nsm (b990083262) - spacing (44b87017a7) - Bug 1180295 - Rip out the Fennec code to set the screen render offset. r=rbarker (67183ae8bf) - Bug 1187804 - Un-adjust fixed layers by the async transform of the scroll frame that they're fixed with respect to, not of the nearest ancestor scroll frame. r=kats (7c5e7ac29c) - Bug 1131359 - Fix an include-what-you-use error in AsyncCompositionManager.cpp. r=kats (fe04815939) - Bug 1187804 - When a layer is scrolled by multiple scroll frames, do an AlignFixedAndStickyLayers pass on its subtree for each of the scroll frames. r=kats (031a5686f1) - Bug 1180295 - Stop clipping the content while the toolbar is in the process of sliding off. r=rbarker (9d806870e4) - Bug 1186968 - Fix Compositor::SetScreenRotation() call r=nical (e554c4b4a2) - Bug 1180295 - Implement seamless snapping to the stable state. r=rbarker (d1e7978eb7) - Bug 1131470 - Part 1: Rename existing use of ScreenOrientation to ScreenOrientationInternal. r=baku (63f0cb994b) - Bug 1131470 - Part 2: Update screen configuration HAL to report orientation angle. r=snorp,mwu (39b537f008) - Bug 1167597 - Mark PromiseReportRejectFeature::mPromise as MOZ_NON_OWNING_REF. r=ehsan (3ad520790a) - Bug 1086627 - Rename Promise constructs to more closely match the specification. r=nsm,jst (cea1d71cb1) - Bug 1086627 - Rename ThenableResolverTask to PromiseResolveThenableJob to more closely match Promise spec. r=nsm (e7102fe506) - Bug 1164725 - Convert flags in nsIDocument into bit fields. r=smaug (9f5d5f352d) - Bug 1192467 - Formalize precondition that SetDisplayDocument must not be called with null. - r=peterv (1aa8e91d14) - Bug 1153841 - Remove the 'it must be 2D' restriction for transforms on fixed-pos layers. r=BenWa,mattwoodrow (5bab86ec6a) - Bug 1173521 - Properly handle unapplying 3D projective transforms to rectangles in APZ code. r=botond (45c9850d5c) - Bug 1166301 - When applying an async adjustment to a fixed layer, only adjust its mask layer under the same circumstances as its clip rect. r=mattwoodrow (2801c48fe9) - Bug 1166301 - Update an old comment in AsyncCompositionManager::AlignFixedAndStickyLayers. r=kats (7e1d5c97d0) - Bug 1166301 - Allow async scrolling to move the clip rects of fixed background layers. r=mattwoodrow (edd889ec2b) - Bug 1200399 - Only send the RCD's metrics to Java-land for fennec-apz. r=rbarker (3b36a52f3a) - Bug 1201625 - Special-case B2GDroid since it doesn't have a root content document. r=rbarker (4fcdda1b0a) - Bug 1201529 - Fall back to rootmost metrics if there is no root content document metrics. r=botond (615c2ee727) - Bug 1201581 - Extract a helper method. r=rbarker (f2cccb8666) - Bug 1201581 - Hook up the syncFrameMetrics call to sync metrics info from the compositor to Java-land on each composite. r=rbarker (48e15bbde8) - Bug 1203760 P1 Allow pipe to wake up multiple streams at the same time. r=froydnj (5baed00637) - Bug 1203760 P2 Add gtests for nsPipeInputStream AsyncRead(). r=froydnj (52e5129dc8) - Bug 1201889 - When adjusting fixed and sticky layers in AsyncCompsitionManager, unapply all async transforms on the path from the fixed layer to the layer it's fixed with respect to. r=kats (dbb203178e) - Bug 1165536. Don't include resolution compensation when adjusting the cliprect of ancestors of scrollbars. r=botond (3bef5f2c18) - Fix async transforms on scrollbars not including any existing shadow transform. (bug 1128740 part 2, r=botond) (af12d76775) - missing of Bug 943728 - Replace double quotes with single quotes in Makefiles (e11470540f) - Bug 1188766 - Avoid exporting UPLOAD_EXTRA_FILES from mozconfig. r=mshal (4241b9e80b) - Fixup for bug 1188766 for valgrind bustage on a CLOSED TREE. r=me (4401dedf06) - Bug 1077622 - Fixes cp missing operand message if no .mozconfig found r=glandium (6eca1e5214) - Bug 1200523 - Remove leftover debugging code from js/src/Makefile.in; r=ted (414b72c74e) - spacing (99cda3f8a7)
This commit is contained in:
@@ -47,6 +47,9 @@ LOCAL_INCLUDES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
# The midl generated code include Windows headers which defines min and max
|
||||
# macros which conflicts with std::min/max. Suppress the macros:
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
|
||||
@@ -60,3 +60,6 @@ LOCAL_INCLUDES += [
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -24,3 +24,6 @@ LOCAL_INCLUDES += [
|
||||
DEFINES['NOMINMAX'] = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -75,6 +75,9 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
'version',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
JS_PREFERENCE_FILES += [
|
||||
'b2g.js',
|
||||
]
|
||||
|
||||
@@ -91,3 +91,6 @@ if CONFIG['HAVE_CLOCK_MONOTONIC']:
|
||||
OS_LIBS += CONFIG['REALTIME_LIBS']
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
NS_IMPL_ISUPPORTS(DirectoryProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
NS_IMETHODIMP
|
||||
DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
|
||||
|
||||
+20
-20
@@ -43,7 +43,7 @@ ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
|
||||
MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
|
||||
MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
|
||||
MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
|
||||
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
|
||||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
@@ -54,10 +54,10 @@ UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(STAGEDIST)/uninstall; \
|
||||
cp ../installer/windows/l10ngen/setup.exe $(_ABS_DIST)/l10n-stage; \
|
||||
$(NULL)
|
||||
|
||||
STUB_HOOK = $(NSINSTALL) -D "$(_ABS_DIST)/$(PKG_INST_PATH)"; \
|
||||
$(RM) "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
cp ../installer/windows/l10ngen/stub.exe "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
chmod 0755 "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
STUB_HOOK = $(NSINSTALL) -D '$(_ABS_DIST)/$(PKG_INST_PATH)'; \
|
||||
$(RM) '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
cp ../installer/windows/l10ngen/stub.exe '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
chmod 0755 '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
@@ -138,20 +138,20 @@ libs-%:
|
||||
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
|
||||
repackage-win32-installer: $(call ESCAPE_WILDCARD,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
|
||||
@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
|
||||
@echo 'Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT).'
|
||||
$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
|
||||
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
|
||||
$(MAKE) repackage-zip \
|
||||
AB_CD=$(AB_CD) \
|
||||
MOZ_PKG_FORMAT=SFX7Z \
|
||||
ZIP_IN="$(WIN32_INSTALLER_IN)" \
|
||||
ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
|
||||
SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag"
|
||||
ZIP_IN='$(WIN32_INSTALLER_IN)' \
|
||||
ZIP_OUT='$(WIN32_INSTALLER_OUT)' \
|
||||
SFX_HEADER='$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag'
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
repackage-win32-installer-%: $(STAGEDIST)
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)'
|
||||
|
||||
repackage-zip-%: repackage-win32-installer-%
|
||||
else
|
||||
@@ -179,7 +179,7 @@ langpack: langpack-$(AB_CD)
|
||||
# tinderbox scripts. Alter it with caution.
|
||||
|
||||
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
|
||||
@echo "repackaging done"
|
||||
@echo 'repackaging done'
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
# Note that we want updater.ini to be in the top directory, not the browser/
|
||||
@@ -187,22 +187,22 @@ ifdef MOZ_UPDATER
|
||||
libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
|
||||
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
else
|
||||
cat $< | \
|
||||
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
|
||||
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
endif
|
||||
endif
|
||||
|
||||
ident:
|
||||
@printf "fx_revision "
|
||||
@printf 'fx_revision '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
|
||||
$(STAGEDIST)/application.ini App SourceStamp
|
||||
@printf "buildid "
|
||||
@printf 'buildid '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
|
||||
$(STAGEDIST)/application.ini App BuildID
|
||||
|
||||
@@ -219,7 +219,7 @@ l10n-check:: INNER_UNMAKE_PACKAGE=true
|
||||
l10n-check::
|
||||
$(RM) -rf x-test
|
||||
$(NSINSTALL) -D x-test/toolkit
|
||||
echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
|
||||
echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir'
|
||||
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)
|
||||
cd $(DIST)/l10n-stage && test $$(cat $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/update.locale) = x-test
|
||||
|
||||
@@ -60,7 +60,7 @@ else
|
||||
ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
|
||||
mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
|
||||
mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
|
||||
mk_add_options "export UPLOAD_EXTRA_FILES+=sccache.log.gz"
|
||||
mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
|
||||
case "$platform" in
|
||||
win*)
|
||||
# sccache supports a special flag to create depfiles.
|
||||
|
||||
@@ -190,9 +190,10 @@ WANT_MOZCONFIG_MK = 1
|
||||
endif
|
||||
|
||||
ifdef WANT_MOZCONFIG_MK
|
||||
# For now, only output "export" lines from mach environment --format=client.mk output.
|
||||
MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
|
||||
$(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
|
||||
# For now, only output "export" lines and lines containing UPLOAD_EXTRA_FILES
|
||||
# from mach environment --format=client.mk output.
|
||||
MOZCONFIG_MK_LINES := $(filter export||% UPLOAD_EXTRA_FILES% %UPLOAD_EXTRA_FILES%,$(MOZCONFIG_OUT_LINES))
|
||||
$(OBJDIR)/.mozconfig.mk: $(TOPSRCDIR)/client.mk $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER
|
||||
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
|
||||
|
||||
# Include that makefile so that it is created. This should not actually change
|
||||
@@ -201,12 +202,6 @@ $(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDI
|
||||
include $(OBJDIR)/.mozconfig.mk
|
||||
endif
|
||||
|
||||
# UPLOAD_EXTRA_FILES is appended to and exported from mozconfig, which makes
|
||||
# submakes as well as configure add even more to that, so just unexport it
|
||||
# for submakes to pick it from .mozconfig.mk and for configure to pick it
|
||||
# from mach environment.
|
||||
unexport UPLOAD_EXTRA_FILES
|
||||
|
||||
# Print out any options loaded from mozconfig.
|
||||
all realbuild clean distclean export libs install realclean::
|
||||
ifneq (,$(strip $(MOZCONFIG_OUT_FILTERED)))
|
||||
@@ -356,7 +351,9 @@ endif
|
||||
$(OBJDIR)/.mozconfig.json: $(call mkdir_deps,$(OBJDIR)) ;
|
||||
|
||||
save-mozconfig: $(FOUND_MOZCONFIG)
|
||||
ifdef FOUND_MOZCONFIG
|
||||
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
|
||||
endif
|
||||
|
||||
configure:: $(configure-preqs)
|
||||
@echo cd $(OBJDIR);
|
||||
|
||||
@@ -24,3 +24,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
||||
LOCAL_INCLUDES += ['/uriloader/exthandler/mac']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -51,6 +51,9 @@ EXTRA_PP_JS_MODULES += [
|
||||
'Webapps.jsm',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
||||
@@ -21,6 +21,9 @@ UNIFIED_SOURCES += [
|
||||
'ArchiveZipFile.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
]
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// Make sure that any change here is also made in
|
||||
// * mobile/android/base/GeckoScreenOrientationListener.java
|
||||
typedef uint32_t ScreenOrientation;
|
||||
// Make sure that any change to ScreenOrientationInternal values are
|
||||
// also made in mobile/android/base/GeckoScreenOrientation.java
|
||||
typedef uint32_t ScreenOrientationInternal;
|
||||
|
||||
static const ScreenOrientation eScreenOrientation_None = 0;
|
||||
static const ScreenOrientation eScreenOrientation_PortraitPrimary = 1u << 0;
|
||||
static const ScreenOrientation eScreenOrientation_PortraitSecondary = 1u << 1;
|
||||
static const ScreenOrientation eScreenOrientation_LandscapePrimary = 1u << 2;
|
||||
static const ScreenOrientation eScreenOrientation_LandscapeSecondary = 1u << 3;
|
||||
static const ScreenOrientationInternal eScreenOrientation_None = 0;
|
||||
static const ScreenOrientationInternal eScreenOrientation_PortraitPrimary = 1u << 0;
|
||||
static const ScreenOrientationInternal eScreenOrientation_PortraitSecondary = 1u << 1;
|
||||
static const ScreenOrientationInternal eScreenOrientation_LandscapePrimary = 1u << 2;
|
||||
static const ScreenOrientationInternal eScreenOrientation_LandscapeSecondary = 1u << 3;
|
||||
//eScreenOrientation_Default will use the natural orientation for the deivce,
|
||||
//it could be PortraitPrimary or LandscapePrimary depends on display resolution
|
||||
static const ScreenOrientation eScreenOrientation_Default = 1u << 4;
|
||||
static const ScreenOrientationInternal eScreenOrientation_Default = 1u << 4;
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -3893,6 +3893,21 @@ nsDOMWindowUtils::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
||||
aRetVal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetNextPaintSyncId(int32_t aSyncId)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
|
||||
if (nsIWidget* widget = GetWidget()) {
|
||||
nsRefPtr<LayerManager> lm = widget->GetLayerManager();
|
||||
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
||||
ClientLayerManager* clm = static_cast<ClientLayerManager*>(lm.get());
|
||||
clm->SetNextPaintSyncId(aSyncId);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)
|
||||
|
||||
+59
-58
@@ -1775,14 +1775,15 @@ public:
|
||||
*/
|
||||
void SetDisplayDocument(nsIDocument* aDisplayDocument)
|
||||
{
|
||||
NS_PRECONDITION(!GetShell() &&
|
||||
!GetContainer() &&
|
||||
!GetWindow(),
|
||||
"Shouldn't set mDisplayDocument on documents that already "
|
||||
"have a presentation or a docshell or a window");
|
||||
NS_PRECONDITION(aDisplayDocument != this, "Should be different document");
|
||||
NS_PRECONDITION(!aDisplayDocument->GetDisplayDocument(),
|
||||
"Display documents should not nest");
|
||||
MOZ_ASSERT(!GetShell() &&
|
||||
!GetContainer() &&
|
||||
!GetWindow(),
|
||||
"Shouldn't set mDisplayDocument on documents that already "
|
||||
"have a presentation or a docshell or a window");
|
||||
MOZ_ASSERT(aDisplayDocument, "Must not be null");
|
||||
MOZ_ASSERT(aDisplayDocument != this, "Should be different document");
|
||||
MOZ_ASSERT(!aDisplayDocument->GetDisplayDocument(),
|
||||
"Display documents should not nest");
|
||||
mDisplayDocument = aDisplayDocument;
|
||||
mHasDisplayDocument = !!aDisplayDocument;
|
||||
}
|
||||
@@ -1803,7 +1804,7 @@ public:
|
||||
virtual ~ExternalResourceLoad() {}
|
||||
|
||||
void AddObserver(nsIObserver* aObserver) {
|
||||
NS_PRECONDITION(aObserver, "Must have observer");
|
||||
MOZ_ASSERT(aObserver, "Must have observer");
|
||||
mObservers.AppendElement(aObserver);
|
||||
}
|
||||
|
||||
@@ -2794,127 +2795,119 @@ protected:
|
||||
mozilla::dom::VisibilityState mVisibilityState;
|
||||
|
||||
// True if BIDI is enabled.
|
||||
bool mBidiEnabled;
|
||||
bool mBidiEnabled : 1;
|
||||
// True if a MathML element has ever been owned by this document.
|
||||
bool mMathMLEnabled;
|
||||
bool mMathMLEnabled : 1;
|
||||
|
||||
// True if this document is the initial document for a window. This should
|
||||
// basically be true only for documents that exist in newly-opened windows or
|
||||
// documents created to satisfy a GetDocument() on a window when there's no
|
||||
// document in it.
|
||||
bool mIsInitialDocumentInWindow;
|
||||
bool mIsInitialDocumentInWindow : 1;
|
||||
|
||||
// True if we're loaded as data and therefor has any dangerous stuff, such
|
||||
// as scripts and plugins, disabled.
|
||||
bool mLoadedAsData;
|
||||
bool mLoadedAsData : 1;
|
||||
|
||||
// This flag is only set in XMLDocument, for e.g. documents used in XBL. We
|
||||
// don't want animations to play in such documents, so we need to store the
|
||||
// flag here so that we can check it in nsDocument::GetAnimationController.
|
||||
bool mLoadedAsInteractiveData;
|
||||
bool mLoadedAsInteractiveData : 1;
|
||||
|
||||
// If true, whoever is creating the document has gotten it to the
|
||||
// point where it's safe to start layout on it.
|
||||
bool mMayStartLayout;
|
||||
bool mMayStartLayout : 1;
|
||||
|
||||
// True iff we've ever fired a DOMTitleChanged event for this document
|
||||
bool mHaveFiredTitleChange;
|
||||
bool mHaveFiredTitleChange : 1;
|
||||
|
||||
// True iff IsShowing() should be returning true
|
||||
bool mIsShowing;
|
||||
bool mIsShowing : 1;
|
||||
|
||||
// True iff the document "page" is not hidden (i.e. currently in the
|
||||
// bfcache)
|
||||
bool mVisible;
|
||||
bool mVisible : 1;
|
||||
|
||||
// True if our content viewer has been removed from the docshell
|
||||
// (it may still be displayed, but in zombie state). Form control data
|
||||
// has been saved.
|
||||
bool mRemovedFromDocShell;
|
||||
bool mRemovedFromDocShell : 1;
|
||||
|
||||
// True iff DNS prefetch is allowed for this document. Note that if the
|
||||
// document has no window, DNS prefetch won't be performed no matter what.
|
||||
bool mAllowDNSPrefetch;
|
||||
bool mAllowDNSPrefetch : 1;
|
||||
|
||||
// True when this document is a static clone of a normal document
|
||||
bool mIsStaticDocument;
|
||||
bool mIsStaticDocument : 1;
|
||||
|
||||
// True while this document is being cloned to a static document.
|
||||
bool mCreatingStaticClone;
|
||||
bool mCreatingStaticClone : 1;
|
||||
|
||||
// True iff the document is being unlinked or deleted.
|
||||
bool mInUnlinkOrDeletion;
|
||||
bool mInUnlinkOrDeletion : 1;
|
||||
|
||||
// True if document has ever had script handling object.
|
||||
bool mHasHadScriptHandlingObject;
|
||||
bool mHasHadScriptHandlingObject : 1;
|
||||
|
||||
// True if we're an SVG document being used as an image.
|
||||
bool mIsBeingUsedAsImage;
|
||||
bool mIsBeingUsedAsImage : 1;
|
||||
|
||||
// True is this document is synthetic : stand alone image, video, audio
|
||||
// file, etc.
|
||||
bool mIsSyntheticDocument;
|
||||
bool mIsSyntheticDocument : 1;
|
||||
|
||||
// True if this document has links whose state needs updating
|
||||
bool mHasLinksToUpdate;
|
||||
bool mHasLinksToUpdate : 1;
|
||||
|
||||
// True if a layout flush might not be a no-op
|
||||
bool mNeedLayoutFlush;
|
||||
bool mNeedLayoutFlush : 1;
|
||||
|
||||
// True if a style flush might not be a no-op
|
||||
bool mNeedStyleFlush;
|
||||
bool mNeedStyleFlush : 1;
|
||||
|
||||
// True if a DOMMutationObserver is perhaps attached to a node in the document.
|
||||
bool mMayHaveDOMMutationObservers;
|
||||
bool mMayHaveDOMMutationObservers : 1;
|
||||
|
||||
// True if an nsIAnimationObserver is perhaps attached to a node in the document.
|
||||
bool mMayHaveAnimationObservers;
|
||||
bool mMayHaveAnimationObservers : 1;
|
||||
|
||||
// True if a document has loaded Mixed Active Script (see nsMixedContentBlocker.cpp)
|
||||
bool mHasMixedActiveContentLoaded;
|
||||
bool mHasMixedActiveContentLoaded : 1;
|
||||
|
||||
// True if a document has blocked Mixed Active Script (see nsMixedContentBlocker.cpp)
|
||||
bool mHasMixedActiveContentBlocked;
|
||||
bool mHasMixedActiveContentBlocked : 1;
|
||||
|
||||
// True if a document has loaded Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
|
||||
bool mHasMixedDisplayContentLoaded;
|
||||
bool mHasMixedDisplayContentLoaded : 1;
|
||||
|
||||
// True if a document has blocked Mixed Display/Passive Content (see nsMixedContentBlocker.cpp)
|
||||
bool mHasMixedDisplayContentBlocked;
|
||||
bool mHasMixedDisplayContentBlocked : 1;
|
||||
|
||||
// True if a document has blocked Tracking Content
|
||||
bool mHasTrackingContentBlocked;
|
||||
bool mHasTrackingContentBlocked : 1;
|
||||
|
||||
// True if a document has loaded Tracking Content
|
||||
bool mHasTrackingContentLoaded;
|
||||
bool mHasTrackingContentLoaded : 1;
|
||||
|
||||
// True if DisallowBFCaching has been called on this document.
|
||||
bool mBFCacheDisallowed;
|
||||
bool mBFCacheDisallowed : 1;
|
||||
|
||||
// If true, we have an input encoding. If this is false, then the
|
||||
// document was created entirely in memory
|
||||
bool mHaveInputEncoding;
|
||||
bool mHaveInputEncoding : 1;
|
||||
|
||||
bool mHasHadDefaultView;
|
||||
bool mHasHadDefaultView : 1;
|
||||
|
||||
// Whether style sheet change events will be dispatched for this document
|
||||
bool mStyleSheetChangeEventsEnabled;
|
||||
bool mStyleSheetChangeEventsEnabled : 1;
|
||||
|
||||
// Whether the document was created by a srcdoc iframe.
|
||||
bool mIsSrcdocDocument;
|
||||
bool mIsSrcdocDocument : 1;
|
||||
|
||||
// Records whether we've done a document.open. If this is true, it's possible
|
||||
// for nodes from this document to have outdated wrappers in their wrapper
|
||||
// caches.
|
||||
bool mDidDocumentOpen;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* This is true while FlushPendingLinkUpdates executes. Calls to
|
||||
* [Un]RegisterPendingLinkUpdate will assert when this is true.
|
||||
*/
|
||||
bool mIsLinkUpdateRegistrationsForbidden;
|
||||
#endif
|
||||
bool mDidDocumentOpen : 1;
|
||||
|
||||
// Whether this document has a display document and thus is considered to
|
||||
// be a resource document. Normally this is the same as !!mDisplayDocument,
|
||||
@@ -2923,13 +2916,13 @@ protected:
|
||||
bool mHasDisplayDocument : 1;
|
||||
|
||||
// Is the current mFontFaceSet valid?
|
||||
bool mFontFaceSetDirty;
|
||||
bool mFontFaceSetDirty : 1;
|
||||
|
||||
// Has GetUserFontSet() been called?
|
||||
bool mGetUserFontSetCalled;
|
||||
bool mGetUserFontSetCalled : 1;
|
||||
|
||||
// Do we currently have an event posted to call FlushUserFontSet?
|
||||
bool mPostedFlushUserFontSet;
|
||||
bool mPostedFlushUserFontSet : 1;
|
||||
|
||||
enum Type {
|
||||
eUnknown, // should never be used
|
||||
@@ -2940,17 +2933,25 @@ protected:
|
||||
eXUL
|
||||
};
|
||||
|
||||
uint8_t mType;
|
||||
Type mType;
|
||||
|
||||
uint8_t mDefaultElementType;
|
||||
|
||||
enum {
|
||||
enum Tri {
|
||||
eTriUnset = 0,
|
||||
eTriFalse,
|
||||
eTriTrue
|
||||
};
|
||||
|
||||
uint8_t mAllowXULXBL;
|
||||
Tri mAllowXULXBL;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* This is true while FlushPendingLinkUpdates executes. Calls to
|
||||
* [Un]RegisterPendingLinkUpdate will assert when this is true.
|
||||
*/
|
||||
bool mIsLinkUpdateRegistrationsForbidden;
|
||||
#endif
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
@@ -3030,7 +3031,7 @@ protected:
|
||||
nsTArray<nsWeakPtr> mBlockedTrackingNodes;
|
||||
|
||||
// Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow,
|
||||
// updated on every set of mSecriptGlobalObject.
|
||||
// updated on every set of mScriptGlobalObject.
|
||||
nsPIDOMWindow *mWindow;
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
|
||||
|
||||
+11
-11
@@ -40,7 +40,7 @@ nsScreen::Create(nsPIDOMWindow* aWindow)
|
||||
hal::RegisterScreenConfigurationObserver(screen);
|
||||
hal::ScreenConfiguration config;
|
||||
hal::GetCurrentScreenConfiguration(&config);
|
||||
screen->mOrientation = config.orientation();
|
||||
screen->mOrientationInternal = config.orientation();
|
||||
|
||||
return screen.forget();
|
||||
}
|
||||
@@ -165,16 +165,16 @@ nsScreen::GetAvailRect(nsRect& aRect)
|
||||
void
|
||||
nsScreen::Notify(const hal::ScreenConfiguration& aConfiguration)
|
||||
{
|
||||
ScreenOrientation previousOrientation = mOrientation;
|
||||
mOrientation = aConfiguration.orientation();
|
||||
ScreenOrientationInternal previousOrientation = mOrientationInternal;
|
||||
mOrientationInternal = aConfiguration.orientation();
|
||||
|
||||
NS_ASSERTION(mOrientation == eScreenOrientation_PortraitPrimary ||
|
||||
mOrientation == eScreenOrientation_PortraitSecondary ||
|
||||
mOrientation == eScreenOrientation_LandscapePrimary ||
|
||||
mOrientation == eScreenOrientation_LandscapeSecondary,
|
||||
NS_ASSERTION(mOrientationInternal == eScreenOrientation_PortraitPrimary ||
|
||||
mOrientationInternal == eScreenOrientation_PortraitSecondary ||
|
||||
mOrientationInternal == eScreenOrientation_LandscapePrimary ||
|
||||
mOrientationInternal == eScreenOrientation_LandscapeSecondary,
|
||||
"Invalid orientation value passed to notify method!");
|
||||
|
||||
if (mOrientation != previousOrientation) {
|
||||
if (mOrientationInternal != previousOrientation) {
|
||||
DispatchTrustedEvent(NS_LITERAL_STRING("mozorientationchange"));
|
||||
}
|
||||
}
|
||||
@@ -185,7 +185,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
|
||||
if (ShouldResistFingerprinting()) {
|
||||
aOrientation.AssignLiteral("landscape-primary");
|
||||
} else {
|
||||
switch (mOrientation) {
|
||||
switch (mOrientationInternal) {
|
||||
case eScreenOrientation_PortraitPrimary:
|
||||
aOrientation.AssignLiteral("portrait-primary");
|
||||
break;
|
||||
@@ -200,7 +200,7 @@ nsScreen::GetMozOrientation(nsString& aOrientation)
|
||||
break;
|
||||
case eScreenOrientation_None:
|
||||
default:
|
||||
MOZ_CRASH("Unacceptable mOrientation value");
|
||||
MOZ_CRASH("Unacceptable mOrientationInternal value");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ bool
|
||||
nsScreen::MozLockOrientation(const Sequence<nsString>& aOrientations,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
ScreenOrientation orientation = eScreenOrientation_None;
|
||||
ScreenOrientationInternal orientation = eScreenOrientation_None;
|
||||
|
||||
for (uint32_t i = 0; i < aOrientations.Length(); ++i) {
|
||||
const nsString& item = aOrientations[i];
|
||||
|
||||
+1
-1
@@ -133,7 +133,7 @@ protected:
|
||||
nsresult GetAvailRect(nsRect& aRect);
|
||||
nsresult GetWindowInnerRect(nsRect& aRect);
|
||||
|
||||
mozilla::dom::ScreenOrientation mOrientation;
|
||||
mozilla::dom::ScreenOrientationInternal mOrientationInternal;
|
||||
|
||||
private:
|
||||
class FullScreenEventListener final : public nsIDOMEventListener
|
||||
|
||||
@@ -11,6 +11,9 @@ GeckoCppUnitTests([
|
||||
'TestWebGLElementArrayCache',
|
||||
])
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../',
|
||||
]
|
||||
|
||||
@@ -49,7 +49,7 @@ interface nsIJSRAIIHelper;
|
||||
interface nsIContentPermissionRequest;
|
||||
interface nsIObserver;
|
||||
|
||||
[scriptable, uuid(6af09215-d909-4d4a-866e-bdaed8fdcb96)]
|
||||
[scriptable, uuid(6ddc9a79-18cd-4dbc-9975-68928e6c9857)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@@ -1836,6 +1836,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
* running tests.
|
||||
*/
|
||||
void forceUseCounterFlush(in nsIDOMNode aNode);
|
||||
|
||||
void setNextPaintSyncId(in long aSyncId);
|
||||
};
|
||||
|
||||
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
|
||||
|
||||
@@ -52,7 +52,7 @@ using struct nsRect from "nsRect.h";
|
||||
using class mozilla::WidgetSelectionEvent from "ipc/nsGUIEventIPC.h";
|
||||
using class mozilla::WidgetTouchEvent from "ipc/nsGUIEventIPC.h";
|
||||
using struct mozilla::dom::RemoteDOMEvent from "mozilla/dom/TabMessageUtils.h";
|
||||
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
|
||||
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
|
||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::CSSPoint from "Units.h";
|
||||
using mozilla::CSSToScreenScale from "Units.h";
|
||||
@@ -566,7 +566,8 @@ child:
|
||||
|
||||
CacheFileDescriptor(nsString path, FileDescriptor fd);
|
||||
|
||||
UpdateDimensions(CSSRect rect, CSSSize size, ScreenOrientation orientation,
|
||||
UpdateDimensions(CSSRect rect, CSSSize size,
|
||||
ScreenOrientationInternal orientation,
|
||||
LayoutDeviceIntPoint chromeDisp) compressall;
|
||||
|
||||
UpdateFrame(FrameMetrics frame);
|
||||
|
||||
@@ -1692,7 +1692,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
|
||||
|
||||
bool
|
||||
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
|
||||
const ScreenOrientation& orientation,
|
||||
const ScreenOrientationInternal& orientation,
|
||||
const LayoutDeviceIntPoint& chromeDisp)
|
||||
{
|
||||
if (!mRemoteFrame) {
|
||||
|
||||
+3
-3
@@ -302,7 +302,7 @@ public:
|
||||
const bool& aParentIsActive) override;
|
||||
virtual bool RecvUpdateDimensions(const CSSRect& rect,
|
||||
const CSSSize& size,
|
||||
const ScreenOrientation& orientation,
|
||||
const ScreenOrientationInternal& orientation,
|
||||
const LayoutDeviceIntPoint& chromeDisp) override;
|
||||
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;
|
||||
virtual bool RecvRequestFlingSnap(const ViewID& aScrollId,
|
||||
@@ -418,7 +418,7 @@ public:
|
||||
|
||||
void GetMaxTouchPoints(uint32_t* aTouchPoints);
|
||||
|
||||
ScreenOrientation GetOrientation() { return mOrientation; }
|
||||
ScreenOrientationInternal GetOrientation() const { return mOrientation; }
|
||||
|
||||
void SetBackgroundColor(const nscolor& aColor);
|
||||
|
||||
@@ -622,7 +622,7 @@ private:
|
||||
bool mDidFakeShow;
|
||||
bool mNotified;
|
||||
bool mTriedBrowserInit;
|
||||
ScreenOrientation mOrientation;
|
||||
ScreenOrientationInternal mOrientation;
|
||||
bool mUpdateHitRegion;
|
||||
|
||||
bool mIgnoreKeyPressEvent;
|
||||
|
||||
@@ -1038,7 +1038,7 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
|
||||
}
|
||||
hal::ScreenConfiguration config;
|
||||
hal::GetCurrentScreenConfiguration(&config);
|
||||
ScreenOrientation orientation = config.orientation();
|
||||
ScreenOrientationInternal orientation = config.orientation();
|
||||
LayoutDeviceIntPoint chromeOffset = -GetChildProcessOffset();
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
||||
+1
-1
@@ -474,7 +474,7 @@ protected:
|
||||
|
||||
nsIntRect mRect;
|
||||
ScreenIntSize mDimensions;
|
||||
ScreenOrientation mOrientation;
|
||||
ScreenOrientationInternal mOrientation;
|
||||
float mDPI;
|
||||
CSSToLayoutDeviceScale mDefaultScale;
|
||||
bool mUpdatedDimensions;
|
||||
|
||||
@@ -406,7 +406,7 @@ MediaEngineGonkVideoSource::DeallocImpl() {
|
||||
|
||||
// The same algorithm from bug 840244
|
||||
static int
|
||||
GetRotateAmount(ScreenOrientation aScreen, int aCameraMountAngle, bool aBackCamera) {
|
||||
GetRotateAmount(ScreenOrientationInternal aScreen, int aCameraMountAngle, bool aBackCamera) {
|
||||
int screenAngle = 0;
|
||||
switch (aScreen) {
|
||||
case eScreenOrientation_PortraitPrimary:
|
||||
|
||||
+65
-52
@@ -47,33 +47,33 @@ Atomic<uintptr_t> gIDGenerator(0);
|
||||
using namespace workers;
|
||||
|
||||
// This class processes the promise's callbacks with promise's result.
|
||||
class PromiseCallbackTask final : public nsRunnable
|
||||
class PromiseReactionJob final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
PromiseCallbackTask(Promise* aPromise,
|
||||
PromiseCallback* aCallback,
|
||||
const JS::Value& aValue)
|
||||
PromiseReactionJob(Promise* aPromise,
|
||||
PromiseCallback* aCallback,
|
||||
const JS::Value& aValue)
|
||||
: mPromise(aPromise)
|
||||
, mCallback(aCallback)
|
||||
, mValue(CycleCollectedJSRuntime::Get()->Runtime(), aValue)
|
||||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_ASSERT(aCallback);
|
||||
MOZ_COUNT_CTOR(PromiseCallbackTask);
|
||||
MOZ_COUNT_CTOR(PromiseReactionJob);
|
||||
}
|
||||
|
||||
virtual
|
||||
~PromiseCallbackTask()
|
||||
~PromiseReactionJob()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseCallbackTask);
|
||||
MOZ_COUNT_DTOR(PromiseCallbackTask);
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseReactionJob);
|
||||
MOZ_COUNT_DTOR(PromiseReactionJob);
|
||||
}
|
||||
|
||||
protected:
|
||||
NS_IMETHOD
|
||||
Run() override
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseCallbackTask);
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseReactionJob);
|
||||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSObject*> wrapper(cx, mPromise->GetWrapper());
|
||||
MOZ_ASSERT(wrapper); // It was preserved!
|
||||
@@ -174,32 +174,32 @@ GetPromise(JSContext* aCx, JS::Handle<JSObject*> aFunc)
|
||||
|
||||
// Runnable to resolve thenables.
|
||||
// Equivalent to the specification's ResolvePromiseViaThenableTask.
|
||||
class ThenableResolverTask final : public nsRunnable
|
||||
class PromiseResolveThenableJob final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
ThenableResolverTask(Promise* aPromise,
|
||||
JS::Handle<JSObject*> aThenable,
|
||||
PromiseInit* aThen)
|
||||
PromiseResolveThenableJob(Promise* aPromise,
|
||||
JS::Handle<JSObject*> aThenable,
|
||||
PromiseInit* aThen)
|
||||
: mPromise(aPromise)
|
||||
, mThenable(CycleCollectedJSRuntime::Get()->Runtime(), aThenable)
|
||||
, mThen(aThen)
|
||||
{
|
||||
MOZ_ASSERT(aPromise);
|
||||
MOZ_COUNT_CTOR(ThenableResolverTask);
|
||||
MOZ_COUNT_CTOR(PromiseResolveThenableJob);
|
||||
}
|
||||
|
||||
virtual
|
||||
~ThenableResolverTask()
|
||||
~PromiseResolveThenableJob()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(ThenableResolverTask);
|
||||
MOZ_COUNT_DTOR(ThenableResolverTask);
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseResolveThenableJob);
|
||||
MOZ_COUNT_DTOR(PromiseResolveThenableJob);
|
||||
}
|
||||
|
||||
protected:
|
||||
NS_IMETHOD
|
||||
Run() override
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(ThenableResolverTask);
|
||||
NS_ASSERT_OWNINGTHREAD(PromiseResolveThenableJob);
|
||||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSObject*> wrapper(cx, mPromise->GetWrapper());
|
||||
MOZ_ASSERT(wrapper); // It was preserved!
|
||||
@@ -275,16 +275,16 @@ private:
|
||||
NS_DECL_OWNINGTHREAD;
|
||||
};
|
||||
|
||||
// Fast version of ThenableResolverTask for use in the cases when we know we're
|
||||
// Fast version of PromiseResolveThenableJob for use in the cases when we know we're
|
||||
// calling the canonical Promise.prototype.then on an actual DOM Promise. In
|
||||
// that case we can just bypass the jumping into and out of JS and call
|
||||
// AppendCallbacks on that promise directly.
|
||||
class FastThenableResolverTask final : public nsRunnable
|
||||
class FastPromiseResolveThenableJob final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
FastThenableResolverTask(PromiseCallback* aResolveCallback,
|
||||
PromiseCallback* aRejectCallback,
|
||||
Promise* aNextPromise)
|
||||
FastPromiseResolveThenableJob(PromiseCallback* aResolveCallback,
|
||||
PromiseCallback* aRejectCallback,
|
||||
Promise* aNextPromise)
|
||||
: mResolveCallback(aResolveCallback)
|
||||
, mRejectCallback(aRejectCallback)
|
||||
, mNextPromise(aNextPromise)
|
||||
@@ -292,21 +292,21 @@ public:
|
||||
MOZ_ASSERT(aResolveCallback);
|
||||
MOZ_ASSERT(aRejectCallback);
|
||||
MOZ_ASSERT(aNextPromise);
|
||||
MOZ_COUNT_CTOR(FastThenableResolverTask);
|
||||
MOZ_COUNT_CTOR(FastPromiseResolveThenableJob);
|
||||
}
|
||||
|
||||
virtual
|
||||
~FastThenableResolverTask()
|
||||
~FastPromiseResolveThenableJob()
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(FastThenableResolverTask);
|
||||
MOZ_COUNT_DTOR(FastThenableResolverTask);
|
||||
NS_ASSERT_OWNINGTHREAD(FastPromiseResolveThenableJob);
|
||||
MOZ_COUNT_DTOR(FastPromiseResolveThenableJob);
|
||||
}
|
||||
|
||||
protected:
|
||||
NS_IMETHOD
|
||||
Run() override
|
||||
{
|
||||
NS_ASSERT_OWNINGTHREAD(FastThenableResolverTask);
|
||||
NS_ASSERT_OWNINGTHREAD(FastPromiseResolveThenableJob);
|
||||
mNextPromise->AppendCallbacks(mResolveCallback, mRejectCallback);
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -822,7 +822,7 @@ Promise::Catch(JSContext* aCx, AnyCallback* aRejectCallback, ErrorResult& aRv)
|
||||
/**
|
||||
* The CountdownHolder class encapsulates Promise.all countdown functions and
|
||||
* the countdown holder parts of the Promises spec. It maintains the result
|
||||
* array and AllResolveHandlers use SetValue() to set the array indices.
|
||||
* array and AllResolveElementFunctions use SetValue() to set the array indices.
|
||||
*/
|
||||
class CountdownHolder final : public nsISupports
|
||||
{
|
||||
@@ -910,17 +910,18 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CountdownHolder)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
/**
|
||||
* An AllResolveHandler is the per-promise part of the Promise.all() algorithm.
|
||||
* An AllResolveElementFunction is the per-promise
|
||||
* part of the Promise.all() algorithm.
|
||||
* Every Promise in the handler is handed an instance of this as a resolution
|
||||
* handler and it sets the relevant index in the CountdownHolder.
|
||||
*/
|
||||
class AllResolveHandler final : public PromiseNativeHandler
|
||||
class AllResolveElementFunction final : public PromiseNativeHandler
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(AllResolveHandler)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(AllResolveElementFunction)
|
||||
|
||||
AllResolveHandler(CountdownHolder* aHolder, uint32_t aIndex)
|
||||
AllResolveElementFunction(CountdownHolder* aHolder, uint32_t aIndex)
|
||||
: mCountdownHolder(aHolder), mIndex(aIndex)
|
||||
{
|
||||
MOZ_ASSERT(aHolder);
|
||||
@@ -936,11 +937,11 @@ public:
|
||||
RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override
|
||||
{
|
||||
// Should never be attached to Promise as a reject handler.
|
||||
MOZ_ASSERT(false, "AllResolveHandler should never be attached to a Promise's reject handler!");
|
||||
MOZ_CRASH("AllResolveElementFunction should never be attached to a Promise's reject handler!");
|
||||
}
|
||||
|
||||
private:
|
||||
~AllResolveHandler()
|
||||
~AllResolveElementFunction()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -948,14 +949,14 @@ private:
|
||||
uint32_t mIndex;
|
||||
};
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(AllResolveHandler)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(AllResolveHandler)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(AllResolveElementFunction)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(AllResolveElementFunction)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AllResolveHandler)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AllResolveElementFunction)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(AllResolveHandler, mCountdownHolder)
|
||||
NS_IMPL_CYCLE_COLLECTION(AllResolveElementFunction, mCountdownHolder)
|
||||
|
||||
/* static */ already_AddRefed<Promise>
|
||||
Promise::All(const GlobalObject& aGlobal,
|
||||
@@ -1019,7 +1020,7 @@ Promise::All(const GlobalObject& aGlobal,
|
||||
|
||||
for (uint32_t i = 0; i < aPromiseList.Length(); ++i) {
|
||||
nsRefPtr<PromiseNativeHandler> resolveHandler =
|
||||
new AllResolveHandler(holder, i);
|
||||
new AllResolveElementFunction(holder, i);
|
||||
|
||||
nsRefPtr<PromiseCallback> resolveCb =
|
||||
new NativePromiseCallback(resolveHandler, Resolved);
|
||||
@@ -1132,7 +1133,7 @@ Promise::AppendCallbacks(PromiseCallback* aResolveCallback,
|
||||
// callbacks with promise's result. If promise's state is rejected, queue a
|
||||
// task to process our reject callbacks with promise's result.
|
||||
if (mState != Pending) {
|
||||
EnqueueCallbackTasks();
|
||||
TriggerPromiseReactions();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1299,8 +1300,8 @@ Promise::ResolveInternal(JSContext* aCx,
|
||||
Promise* nextPromise;
|
||||
if (PromiseBinding::IsThenMethod(thenObj) &&
|
||||
NS_SUCCEEDED(UNWRAP_OBJECT(Promise, valueObj, nextPromise))) {
|
||||
// If we were taking the codepath that involves ThenableResolverTask and
|
||||
// PromiseInit below, then eventually, in ThenableResolverTask::Run, we
|
||||
// If we were taking the codepath that involves PromiseResolveThenableJob and
|
||||
// PromiseInit below, then eventually, in PromiseResolveThenableJob::Run, we
|
||||
// would create some JSFunctions in the compartment of
|
||||
// this->GetWrapper() and pass them to the PromiseInit. So by the time
|
||||
// we'd see the resolution value it would be wrapped into the
|
||||
@@ -1310,16 +1311,16 @@ Promise::ResolveInternal(JSContext* aCx,
|
||||
JS::Rooted<JSObject*> glob(aCx, GlobalJSObject());
|
||||
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this, glob);
|
||||
nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(this, glob);
|
||||
nsRefPtr<FastThenableResolverTask> task =
|
||||
new FastThenableResolverTask(resolveCb, rejectCb, nextPromise);
|
||||
nsRefPtr<FastPromiseResolveThenableJob> task =
|
||||
new FastPromiseResolveThenableJob(resolveCb, rejectCb, nextPromise);
|
||||
DispatchToMicroTask(task);
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<PromiseInit> thenCallback =
|
||||
new PromiseInit(nullptr, thenObj, mozilla::dom::GetIncumbentGlobal());
|
||||
nsRefPtr<ThenableResolverTask> task =
|
||||
new ThenableResolverTask(this, valueObj, thenCallback);
|
||||
nsRefPtr<PromiseResolveThenableJob> task =
|
||||
new PromiseResolveThenableJob(this, valueObj, thenCallback);
|
||||
DispatchToMicroTask(task);
|
||||
return;
|
||||
}
|
||||
@@ -1387,7 +1388,7 @@ Promise::Settle(JS::Handle<JS::Value> aValue, PromiseState aState)
|
||||
}
|
||||
#endif // defined(DOM_PROMISE_DEPRECATED_REPORTING)
|
||||
|
||||
EnqueueCallbackTasks();
|
||||
TriggerPromiseReactions();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1405,7 +1406,7 @@ Promise::MaybeSettle(JS::Handle<JS::Value> aValue,
|
||||
}
|
||||
|
||||
void
|
||||
Promise::EnqueueCallbackTasks()
|
||||
Promise::TriggerPromiseReactions()
|
||||
{
|
||||
nsTArray<nsRefPtr<PromiseCallback>> callbacks;
|
||||
callbacks.SwapElements(mState == Resolved ? mResolveCallbacks
|
||||
@@ -1414,8 +1415,8 @@ Promise::EnqueueCallbackTasks()
|
||||
mRejectCallbacks.Clear();
|
||||
|
||||
for (uint32_t i = 0; i < callbacks.Length(); ++i) {
|
||||
nsRefPtr<PromiseCallbackTask> task =
|
||||
new PromiseCallbackTask(this, callbacks[i], mResult);
|
||||
nsRefPtr<PromiseReactionJob> task =
|
||||
new PromiseReactionJob(this, callbacks[i], mResult);
|
||||
DispatchToMicroTask(task);
|
||||
}
|
||||
}
|
||||
@@ -1480,7 +1481,7 @@ Promise::GetDependentPromises(nsTArray<nsRefPtr<Promise>>& aPromises)
|
||||
}
|
||||
|
||||
// A WorkerRunnable to resolve/reject the Promise on the worker thread.
|
||||
|
||||
// Calling thread MUST hold PromiseWorkerProxy's mutex before creating this.
|
||||
class PromiseWorkerProxyRunnable : public workers::WorkerRunnable
|
||||
{
|
||||
public:
|
||||
@@ -1588,12 +1589,24 @@ PromiseWorkerProxy::GetWorkerPrivate() const
|
||||
// the assertion when we should not.
|
||||
MOZ_ASSERT(!mCleanedUp);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (NS_IsMainThread()) {
|
||||
mCleanUpLock.AssertCurrentThreadOwns();
|
||||
}
|
||||
#endif
|
||||
|
||||
return mWorkerPrivate;
|
||||
}
|
||||
|
||||
Promise*
|
||||
PromiseWorkerProxy::GetWorkerPromise() const
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
worker->AssertIsOnWorkerThread();
|
||||
#endif
|
||||
return mWorkerPromise;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,9 @@ class Promise;
|
||||
#if defined(DOM_PROMISE_DEPRECATED_REPORTING)
|
||||
class PromiseReportRejectFeature : public workers::WorkerFeature
|
||||
{
|
||||
// The Promise that owns this feature.
|
||||
Promise* mPromise;
|
||||
// PromiseReportRejectFeature is held by an nsAutoPtr on the Promise which
|
||||
// means that this object will be destroyed before the Promise is destroyed.
|
||||
Promise* MOZ_NON_OWNING_REF mPromise;
|
||||
|
||||
public:
|
||||
explicit PromiseReportRejectFeature(Promise* aPromise)
|
||||
@@ -74,7 +75,7 @@ class Promise : public nsISupports,
|
||||
public SupportsWeakPtr<Promise>
|
||||
{
|
||||
friend class NativePromiseCallback;
|
||||
friend class PromiseCallbackTask;
|
||||
friend class PromiseReactionJob;
|
||||
friend class PromiseResolverTask;
|
||||
friend class PromiseTask;
|
||||
#if defined(DOM_PROMISE_DEPRECATED_REPORTING)
|
||||
@@ -84,8 +85,8 @@ class Promise : public nsISupports,
|
||||
friend class PromiseWorkerProxyRunnable;
|
||||
friend class RejectPromiseCallback;
|
||||
friend class ResolvePromiseCallback;
|
||||
friend class ThenableResolverTask;
|
||||
friend class FastThenableResolverTask;
|
||||
friend class PromiseResolveThenableJob;
|
||||
friend class FastPromiseResolveThenableJob;
|
||||
friend class WrapperPromiseCallback;
|
||||
|
||||
public:
|
||||
@@ -273,8 +274,8 @@ private:
|
||||
// This method enqueues promise's resolve/reject callbacks with promise's
|
||||
// result. It's executed when the resolver.resolve() or resolver.reject() is
|
||||
// called or when the promise already has a result and new callbacks are
|
||||
// appended by then(), catch() or done().
|
||||
void EnqueueCallbackTasks();
|
||||
// appended by then() or catch().
|
||||
void TriggerPromiseReactions();
|
||||
|
||||
void Settle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);
|
||||
void MaybeSettle(JS::Handle<JS::Value> aValue, Promise::PromiseState aState);
|
||||
|
||||
+111
-141
@@ -215,38 +215,29 @@ WorkerPushSubscription::Constructor(GlobalObject& aGlobal, const nsAString& aEnd
|
||||
return sub.forget();
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoReleasePromiseWorkerProxy final
|
||||
namespace {
|
||||
// The caller MUST take ownership of the proxy's lock before it calls this.
|
||||
void
|
||||
ReleasePromiseWorkerProxy(already_AddRefed<PromiseWorkerProxy> aProxy)
|
||||
{
|
||||
public:
|
||||
explicit AutoReleasePromiseWorkerProxy(PromiseWorkerProxy* aProxy)
|
||||
: mProxy(aProxy)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aProxy);
|
||||
aProxy->GetCleanUpLock().AssertCurrentThreadOwns();
|
||||
if (aProxy->IsClean()) {
|
||||
mProxy = nullptr;
|
||||
}
|
||||
AssertIsOnMainThread();
|
||||
nsRefPtr<PromiseWorkerProxy> proxy = aProxy;
|
||||
MOZ_ASSERT(proxy);
|
||||
proxy->GetCleanUpLock().AssertCurrentThreadOwns();
|
||||
if (proxy->IsClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
~AutoReleasePromiseWorkerProxy()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
|
||||
new PromiseWorkerProxyControlRunnable(mProxy->GetWorkerPrivate(),
|
||||
mProxy);
|
||||
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
|
||||
new PromiseWorkerProxyControlRunnable(proxy->GetWorkerPrivate(),
|
||||
proxy);
|
||||
|
||||
DebugOnly<bool> ok = cr->Dispatch(jsapi.cx());
|
||||
MOZ_ASSERT(ok);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
private:
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
};
|
||||
MOZ_ALWAYS_TRUE(cr->Dispatch(jsapi.cx()));
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
class UnsubscribeResultRunnable final : public WorkerRunnable
|
||||
{
|
||||
@@ -281,12 +272,7 @@ public:
|
||||
}
|
||||
private:
|
||||
~UnsubscribeResultRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
nsresult mStatus;
|
||||
@@ -322,18 +308,27 @@ public:
|
||||
|
||||
nsRefPtr<UnsubscribeResultRunnable> r =
|
||||
new UnsubscribeResultRunnable(mProxy, aStatus, aSuccess);
|
||||
mProxy = nullptr;
|
||||
if (!r->Dispatch(jsapi.cx())) {
|
||||
ReleasePromiseWorkerProxy(mProxy.forget());
|
||||
}
|
||||
|
||||
r->Dispatch(jsapi.cx());
|
||||
mProxy = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~WorkerUnsubscribeResultCallback()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
MutexAutoLock lock(mProxy->GetCleanUpLock());
|
||||
if (!mProxy->IsClean()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
|
||||
new PromiseWorkerProxyControlRunnable(mProxy->GetWorkerPrivate(), mProxy);
|
||||
cr->Dispatch(jsapi.cx());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,36 +358,27 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<WorkerUnsubscribeResultCallback> callback =
|
||||
new WorkerUnsubscribeResultCallback(mProxy);
|
||||
|
||||
nsCOMPtr<nsIPushClient> client =
|
||||
do_CreateInstance("@mozilla.org/push/PushClient;1");
|
||||
if (!client) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
nsRefPtr<UnsubscribeResultRunnable> r =
|
||||
new UnsubscribeResultRunnable(mProxy, NS_ERROR_FAILURE, false);
|
||||
mProxy = nullptr;
|
||||
|
||||
r->Dispatch(jsapi.cx());
|
||||
return NS_OK;
|
||||
callback->OnUnsubscribe(NS_ERROR_FAILURE, false);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = mProxy->GetWorkerPrivate()->GetPrincipal();
|
||||
nsRefPtr<WorkerUnsubscribeResultCallback> callback =
|
||||
new WorkerUnsubscribeResultCallback(mProxy);
|
||||
mProxy = nullptr;
|
||||
client->Unsubscribe(mScope, principal, callback);
|
||||
if (NS_WARN_IF(NS_FAILED(client->Unsubscribe(mScope, principal, callback)))) {
|
||||
callback->OnUnsubscribe(NS_ERROR_FAILURE, false);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~UnsubscribeRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
nsString mScope;
|
||||
};
|
||||
@@ -418,7 +404,7 @@ WorkerPushSubscription::Unsubscribe(ErrorResult &aRv)
|
||||
|
||||
nsRefPtr<UnsubscribeRunnable> r =
|
||||
new UnsubscribeRunnable(proxy, mScope);
|
||||
NS_DispatchToMainThread(r);
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
|
||||
|
||||
return p.forget();
|
||||
}
|
||||
@@ -464,9 +450,13 @@ public:
|
||||
nsRefPtr<PromiseWorkerProxy> proxy = mProxy.forget();
|
||||
nsRefPtr<Promise> promise = proxy->GetWorkerPromise();
|
||||
if (NS_SUCCEEDED(mStatus)) {
|
||||
nsRefPtr<WorkerPushSubscription> sub =
|
||||
new WorkerPushSubscription(mEndpoint, mScope);
|
||||
promise->MaybeResolve(sub);
|
||||
if (mEndpoint.IsEmpty()) {
|
||||
promise->MaybeResolve(JS::NullHandleValue);
|
||||
} else {
|
||||
nsRefPtr<WorkerPushSubscription> sub =
|
||||
new WorkerPushSubscription(mEndpoint, mScope);
|
||||
promise->MaybeResolve(sub);
|
||||
}
|
||||
} else {
|
||||
promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
|
||||
}
|
||||
@@ -476,12 +466,7 @@ public:
|
||||
}
|
||||
private:
|
||||
~GetSubscriptionResultRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
nsresult mStatus;
|
||||
@@ -504,6 +489,7 @@ public:
|
||||
OnPushEndpoint(nsresult aStatus, const nsAString& aEndpoint) override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
if (!mProxy) {
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -518,18 +504,27 @@ public:
|
||||
|
||||
nsRefPtr<GetSubscriptionResultRunnable> r =
|
||||
new GetSubscriptionResultRunnable(mProxy, aStatus, aEndpoint, mScope);
|
||||
mProxy = nullptr;
|
||||
if (!r->Dispatch(jsapi.cx())) {
|
||||
ReleasePromiseWorkerProxy(mProxy.forget());
|
||||
}
|
||||
|
||||
r->Dispatch(jsapi.cx());
|
||||
mProxy = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
protected:
|
||||
~GetSubscriptionCallback()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
MutexAutoLock lock(mProxy->GetCleanUpLock());
|
||||
if (!mProxy->IsClean()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
nsRefPtr<PromiseWorkerProxyControlRunnable> cr =
|
||||
new PromiseWorkerProxyControlRunnable(mProxy->GetWorkerPrivate(), mProxy);
|
||||
cr->Dispatch(jsapi.cx());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,14 +554,12 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<GetSubscriptionCallback> callback = new GetSubscriptionCallback(mProxy, mScope);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permManager =
|
||||
mozilla::services::GetPermissionManager();
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
if (!permManager) {
|
||||
Fail(jsapi.cx());
|
||||
callback->OnPushEndpoint(NS_ERROR_FAILURE, EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -577,47 +570,38 @@ public:
|
||||
&permission);
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || permission != nsIPermissionManager::ALLOW_ACTION) {
|
||||
Fail(jsapi.cx());
|
||||
callback->OnPushEndpoint(NS_ERROR_FAILURE, EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPushClient> client =
|
||||
do_CreateInstance("@mozilla.org/push/PushClient;1");
|
||||
if (!client) {
|
||||
Fail(jsapi.cx());
|
||||
callback->OnPushEndpoint(NS_ERROR_FAILURE, EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = mProxy->GetWorkerPrivate()->GetPrincipal();
|
||||
nsRefPtr<GetSubscriptionCallback> callback = new GetSubscriptionCallback(mProxy, mScope);
|
||||
mProxy = nullptr;
|
||||
|
||||
if (mAction == WorkerPushManager::SubscribeAction) {
|
||||
return client->Subscribe(mScope, principal, callback);
|
||||
rv = client->Subscribe(mScope, principal, callback);
|
||||
} else {
|
||||
MOZ_ASSERT(mAction == WorkerPushManager::GetSubscriptionAction);
|
||||
return client->GetSubscription(mScope, principal, callback);
|
||||
rv = client->GetSubscription(mScope, principal, callback);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
callback->OnPushEndpoint(NS_ERROR_FAILURE, EmptyString());
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
void
|
||||
Fail(JSContext* aCx)
|
||||
{
|
||||
nsRefPtr<GetSubscriptionResultRunnable> r =
|
||||
new GetSubscriptionResultRunnable(mProxy, NS_ERROR_FAILURE, EmptyString(), mScope);
|
||||
mProxy = nullptr;
|
||||
|
||||
r->Dispatch(aCx);
|
||||
}
|
||||
|
||||
~GetSubscriptionRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
nsString mScope;
|
||||
@@ -645,7 +629,7 @@ WorkerPushManager::PerformSubscriptionAction(SubscriptionAction aAction, ErrorRe
|
||||
|
||||
nsRefPtr<GetSubscriptionRunnable> r =
|
||||
new GetSubscriptionRunnable(proxy, mScope, aAction);
|
||||
NS_DispatchToMainThread(r);
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(r)));
|
||||
|
||||
return p.forget();
|
||||
}
|
||||
@@ -698,12 +682,7 @@ public:
|
||||
|
||||
private:
|
||||
~PermissionResultRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
nsresult mStatus;
|
||||
@@ -729,55 +708,46 @@ public:
|
||||
nsCOMPtr<nsIPermissionManager> permManager =
|
||||
mozilla::services::GetPermissionManager();
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
PushPermissionState state = PushPermissionState::Denied;
|
||||
|
||||
if (permManager) {
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
rv = permManager->TestExactPermissionFromPrincipal(
|
||||
mProxy->GetWorkerPrivate()->GetPrincipal(),
|
||||
"push",
|
||||
&permission);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
switch (permission) {
|
||||
case nsIPermissionManager::ALLOW_ACTION:
|
||||
state = PushPermissionState::Granted;
|
||||
break;
|
||||
case nsIPermissionManager::DENY_ACTION:
|
||||
state = PushPermissionState::Denied;
|
||||
break;
|
||||
case nsIPermissionManager::PROMPT_ACTION:
|
||||
state = PushPermissionState::Prompt;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected case!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
if (!permManager) {
|
||||
nsRefPtr<PermissionResultRunnable> r =
|
||||
new PermissionResultRunnable(mProxy, NS_ERROR_FAILURE, state);
|
||||
mProxy = nullptr;
|
||||
|
||||
r->Dispatch(jsapi.cx());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
||||
nsresult rv = permManager->TestExactPermissionFromPrincipal(
|
||||
mProxy->GetWorkerPrivate()->GetPrincipal(),
|
||||
"push",
|
||||
&permission);
|
||||
|
||||
switch (permission) {
|
||||
case nsIPermissionManager::ALLOW_ACTION:
|
||||
state = PushPermissionState::Granted;
|
||||
break;
|
||||
case nsIPermissionManager::DENY_ACTION:
|
||||
state = PushPermissionState::Denied;
|
||||
break;
|
||||
case nsIPermissionManager::PROMPT_ACTION:
|
||||
state = PushPermissionState::Prompt;
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unexpected case!");
|
||||
}
|
||||
|
||||
nsRefPtr<PermissionResultRunnable> r =
|
||||
new PermissionResultRunnable(mProxy, rv, state);
|
||||
mProxy = nullptr;
|
||||
r->Dispatch(jsapi.cx());
|
||||
if (!r->Dispatch(jsapi.cx())) {
|
||||
ReleasePromiseWorkerProxy(mProxy.forget());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~PermissionStateRunnable()
|
||||
{
|
||||
if (mProxy) {
|
||||
AutoReleasePromiseWorkerProxy autoRelease(mProxy);
|
||||
mProxy = nullptr;
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
nsRefPtr<PromiseWorkerProxy> mProxy;
|
||||
};
|
||||
|
||||
@@ -37,6 +37,9 @@ UNIFIED_SOURCES += [
|
||||
'PushManager.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../workers',
|
||||
]
|
||||
|
||||
@@ -20,8 +20,6 @@ callback AnyCallback = any (any value);
|
||||
Exposed=(Window,Worker,System)]
|
||||
// Need to escape "Promise" so it's treated as an identifier.
|
||||
interface _Promise {
|
||||
// TODO bug 875289 - static Promise fulfill(any value);
|
||||
|
||||
// Disable the static methods when the interface object is supposed to be
|
||||
// disabled, just in case some code decides to walk over to .constructor from
|
||||
// the proto of a promise object or someone screws up and manages to create a
|
||||
|
||||
@@ -37,14 +37,8 @@ interface ServiceWorkerContainer : EventTarget {
|
||||
|
||||
// Testing only.
|
||||
partial interface ServiceWorkerContainer {
|
||||
[Throws,Pref="dom.serviceWorkers.testing.enabled"]
|
||||
Promise<any> clearAllServiceWorkerData();
|
||||
|
||||
[Throws,Pref="dom.serviceWorkers.testing.enabled"]
|
||||
DOMString getScopeForUrl(DOMString url);
|
||||
|
||||
[Throws,Pref="dom.serviceWorkers.testing.enabled"]
|
||||
DOMString getControllingWorkerScriptURLForPath(DOMString path);
|
||||
};
|
||||
|
||||
dictionary RegistrationOptions {
|
||||
|
||||
@@ -317,14 +317,6 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
|
||||
return mReadyPromise;
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
ServiceWorkerContainer::ClearAllServiceWorkerData(ErrorResult& aRv)
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
void
|
||||
ServiceWorkerContainer::GetScopeForUrl(const nsAString& aUrl,
|
||||
@@ -341,14 +333,5 @@ ServiceWorkerContainer::GetScopeForUrl(const nsAString& aUrl,
|
||||
aUrl, aScope);
|
||||
}
|
||||
|
||||
// Testing only.
|
||||
void
|
||||
ServiceWorkerContainer::GetControllingWorkerScriptURLForPath(
|
||||
const nsAString& aPath,
|
||||
nsString& aScriptURL,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
}
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -58,20 +58,10 @@ public:
|
||||
Promise*
|
||||
GetReady(ErrorResult& aRv);
|
||||
|
||||
// Testing only.
|
||||
already_AddRefed<Promise>
|
||||
ClearAllServiceWorkerData(ErrorResult& aRv);
|
||||
|
||||
// Testing only.
|
||||
void
|
||||
GetScopeForUrl(const nsAString& aUrl, nsString& aScope, ErrorResult& aRv);
|
||||
|
||||
// Testing only.
|
||||
void
|
||||
GetControllingWorkerScriptURLForPath(const nsAString& aPath,
|
||||
nsString& aScriptURL,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// DOMEventTargetHelper
|
||||
void DisconnectFromOwner() override;
|
||||
|
||||
|
||||
@@ -4589,9 +4589,9 @@ HasRootDomain(nsIURI* aURI, const nsACString& aDomain)
|
||||
return prevChar == '.';
|
||||
}
|
||||
|
||||
struct UnregisterIfMatchesHostOrPrincipalData
|
||||
struct UnregisterIfMatchesUserData final
|
||||
{
|
||||
UnregisterIfMatchesHostOrPrincipalData(
|
||||
UnregisterIfMatchesUserData(
|
||||
ServiceWorkerManager::RegistrationDataPerPrincipal* aRegistrationData,
|
||||
void* aUserData)
|
||||
: mRegistrationData(aRegistrationData)
|
||||
@@ -4608,8 +4608,8 @@ UnregisterIfMatchesHost(const nsACString& aScope,
|
||||
ServiceWorkerRegistrationInfo* aReg,
|
||||
void* aPtr)
|
||||
{
|
||||
UnregisterIfMatchesHostOrPrincipalData* data =
|
||||
static_cast<UnregisterIfMatchesHostOrPrincipalData*>(aPtr);
|
||||
UnregisterIfMatchesUserData* data =
|
||||
static_cast<UnregisterIfMatchesUserData*>(aPtr);
|
||||
|
||||
// We avoid setting toRemove = aReg by default since there is a possibility
|
||||
// of failure when data->mUserData is passed, in which case we don't want to
|
||||
@@ -4641,25 +4641,76 @@ UnregisterIfMatchesHostPerPrincipal(const nsACString& aKey,
|
||||
ServiceWorkerManager::RegistrationDataPerPrincipal* aData,
|
||||
void* aUserData)
|
||||
{
|
||||
UnregisterIfMatchesHostOrPrincipalData data(aData, aUserData);
|
||||
UnregisterIfMatchesUserData data(aData, aUserData);
|
||||
aData->mInfos.EnumerateRead(UnregisterIfMatchesHost, &data);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
UnregisterIfMatchesPrincipal(const nsACString& aScope,
|
||||
ServiceWorkerRegistrationInfo* aReg,
|
||||
void* aPtr)
|
||||
UnregisterIfMatchesClearPrivateDataParams(const nsACString& aScope,
|
||||
ServiceWorkerRegistrationInfo* aReg,
|
||||
void* aPtr)
|
||||
{
|
||||
UnregisterIfMatchesHostOrPrincipalData* data =
|
||||
static_cast<UnregisterIfMatchesHostOrPrincipalData*>(aPtr);
|
||||
UnregisterIfMatchesUserData* data =
|
||||
static_cast<UnregisterIfMatchesUserData*>(aPtr);
|
||||
|
||||
if (data->mUserData) {
|
||||
nsIPrincipal *principal = static_cast<nsIPrincipal*>(data->mUserData);
|
||||
MOZ_ASSERT(principal);
|
||||
mozIApplicationClearPrivateDataParams *params =
|
||||
static_cast<mozIApplicationClearPrivateDataParams*>(data->mUserData);
|
||||
MOZ_ASSERT(params);
|
||||
MOZ_ASSERT(aReg->mPrincipal);
|
||||
bool equals;
|
||||
aReg->mPrincipal->Equals(principal, &equals);
|
||||
|
||||
uint32_t appId;
|
||||
nsresult rv = params->GetAppId(&appId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
bool browserOnly;
|
||||
rv = params->GetBrowserOnly(&browserOnly);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
bool equals = false;
|
||||
|
||||
if (browserOnly) {
|
||||
// When we do a system wide "clear cookies and stored data" on B2G we get
|
||||
// the "webapps-clear-data" notification with the System app appID and
|
||||
// the browserOnly flag set to true.
|
||||
// Web sites registering a service worker on B2G have a principal with the
|
||||
// following information: web site origin + System app appId + inBrowser=1
|
||||
// So we need to check if the service worker registration info contains
|
||||
// the System app appID and the enabled inBrowser flag and in that case
|
||||
// remove it from the registry.
|
||||
equals = (appId == aReg->mPrincipal->GetAppId()) &&
|
||||
aReg->mPrincipal->GetIsInBrowserElement();
|
||||
} else {
|
||||
// If we get the "webapps-clear-data" notification because of an app
|
||||
// uninstallation, we need to check the full principal to get the match
|
||||
// in the service workers registry. If we find a match, we unregister the
|
||||
// worker.
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (NS_WARN_IF(!appsService)) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
|
||||
if (NS_WARN_IF(!app)) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
app->GetPrincipal(getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(!principal)) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
aReg->mPrincipal->Equals(principal, &equals);
|
||||
}
|
||||
|
||||
if (equals) {
|
||||
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
swm->ForceUnregister(data->mRegistrationData, aReg);
|
||||
@@ -4670,15 +4721,16 @@ UnregisterIfMatchesPrincipal(const nsACString& aScope,
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
UnregisterIfMatchesPrincipal(const nsACString& aKey,
|
||||
UnregisterIfMatchesClearPrivateDataParams(const nsACString& aKey,
|
||||
ServiceWorkerManager::RegistrationDataPerPrincipal* aData,
|
||||
void* aUserData)
|
||||
{
|
||||
UnregisterIfMatchesHostOrPrincipalData data(aData, aUserData);
|
||||
UnregisterIfMatchesUserData data(aData, aUserData);
|
||||
// We can use EnumerateRead because ForceUnregister (and Unregister) are async.
|
||||
// Otherwise doing some R/W operations on an hashtable during an EnumerateRead
|
||||
// will crash.
|
||||
aData->mInfos.EnumerateRead(UnregisterIfMatchesPrincipal, &data);
|
||||
aData->mInfos.EnumerateRead(UnregisterIfMatchesClearPrivateDataParams,
|
||||
&data);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
@@ -4895,14 +4947,15 @@ UpdateEachRegistration(const nsACString& aKey,
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerManager::RemoveAllRegistrations(nsIPrincipal* aPrincipal)
|
||||
ServiceWorkerManager::RemoveAllRegistrations(
|
||||
mozIApplicationClearPrivateDataParams* aParams)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
MOZ_ASSERT(aParams);
|
||||
|
||||
mRegistrationInfos.EnumerateRead(UnregisterIfMatchesPrincipal,
|
||||
aPrincipal);
|
||||
mRegistrationInfos.EnumerateRead(UnregisterIfMatchesClearPrivateDataParams,
|
||||
aParams);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
@@ -4950,29 +5003,7 @@ ServiceWorkerManager::Observe(nsISupports* aSubject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t appId;
|
||||
nsresult rv = params->GetAppId(&appId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAppsService> appsService =
|
||||
do_GetService(APPS_SERVICE_CONTRACTID);
|
||||
if (NS_WARN_IF(!appsService)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
|
||||
if (NS_WARN_IF(!app)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
app->GetPrincipal(getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(!principal)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
RemoveAllRegistrations(principal);
|
||||
RemoveAllRegistrations(params);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsTObserverArray.h"
|
||||
|
||||
class mozIApplicationClearPrivateDataParams;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class OriginAttributes;
|
||||
@@ -576,9 +578,10 @@ private:
|
||||
void
|
||||
RemoveRegistrationInternal(ServiceWorkerRegistrationInfo* aRegistration);
|
||||
|
||||
// Removes all service worker registrations for a given principal.
|
||||
// Removes all service worker registrations that matches the given
|
||||
// mozIApplicationClearPrivateDataParams.
|
||||
void
|
||||
RemoveAllRegistrations(nsIPrincipal* aPrincipal);
|
||||
RemoveAllRegistrations(mozIApplicationClearPrivateDataParams* aParams);
|
||||
|
||||
nsRefPtr<ServiceWorkerManagerChild> mActor;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "ServiceWorkerWindowClient.h"
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/dom/ClientBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||
@@ -103,6 +104,12 @@ private:
|
||||
void
|
||||
DispatchResult(UniquePtr<ServiceWorkerClientInfo>&& aClientInfo)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MutexAutoLock lock(mPromiseProxy->GetCleanUpLock());
|
||||
if (mPromiseProxy->IsClean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = mPromiseProxy->GetWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ UNIFIED_SOURCES += [
|
||||
'XMLStylesheetProcessingInstruction.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
||||
@@ -9,6 +9,9 @@ UNIFIED_SOURCES += [
|
||||
'txXMLUtils.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
'../xpath',
|
||||
|
||||
@@ -194,7 +194,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
// If the last transaction was incomplete (a failed DoEmptyTransaction),
|
||||
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding
|
||||
// to the previous transaction.
|
||||
dom::ScreenOrientation orientation;
|
||||
dom::ScreenOrientationInternal orientation;
|
||||
if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
|
||||
orientation = window->GetOrientation();
|
||||
} else {
|
||||
@@ -802,6 +802,12 @@ ClientLayerManager::AsyncPanZoomEnabled() const
|
||||
return mWidget && mWidget->AsyncPanZoomEnabled();
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::SetNextPaintSyncId(int32_t aSyncId)
|
||||
{
|
||||
mForwarder->SetPaintSyncId(aSyncId);
|
||||
}
|
||||
|
||||
ClientLayer::~ClientLayer()
|
||||
{
|
||||
if (HasShadow()) {
|
||||
|
||||
@@ -253,6 +253,8 @@ public:
|
||||
|
||||
bool AsyncPanZoomEnabled() const override;
|
||||
|
||||
void SetNextPaintSyncId(int32_t aSyncId);
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
|
||||
@@ -59,10 +59,10 @@ ClientTiledPaintedLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
|
||||
aAttrs = PaintedLayerAttributes(GetValidRegion());
|
||||
}
|
||||
|
||||
static LayerRect
|
||||
ApplyParentLayerToLayerTransform(const gfx::Matrix4x4& aTransform, const ParentLayerRect& aParentLayerRect)
|
||||
static Maybe<LayerRect>
|
||||
ApplyParentLayerToLayerTransform(const gfx::Matrix4x4& aTransform, const ParentLayerRect& aParentLayerRect, const LayerRect& aClip)
|
||||
{
|
||||
return TransformTo<LayerPixel>(aTransform, aParentLayerRect);
|
||||
return UntransformTo<LayerPixel>(aTransform, aParentLayerRect, aClip);
|
||||
}
|
||||
|
||||
static gfx::Matrix4x4
|
||||
@@ -128,10 +128,7 @@ ClientTiledPaintedLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncest
|
||||
void
|
||||
ClientTiledPaintedLayer::BeginPaint()
|
||||
{
|
||||
mPaintData.mLowPrecisionPaintCount = 0;
|
||||
mPaintData.mPaintFinished = false;
|
||||
mPaintData.mCompositionBounds.SetEmpty();
|
||||
mPaintData.mCriticalDisplayPort.SetEmpty();
|
||||
mPaintData.ResetPaintData();
|
||||
|
||||
if (!GetBaseTransform().Is2D()) {
|
||||
// Give up if there is a complex CSS transform on the layer. We might
|
||||
@@ -169,6 +166,8 @@ ClientTiledPaintedLayer::BeginPaint()
|
||||
GetTransformToAncestorsParentLayer(this, displayPortAncestor);
|
||||
transformDisplayPortToLayer.Invert();
|
||||
|
||||
LayerRect layerBounds = ViewAs<LayerPixel>(Rect(GetLayerBounds()));
|
||||
|
||||
// Compute the critical display port that applies to this layer in the
|
||||
// LayoutDevice space of this layer, but only if there is no OMT animation
|
||||
// on this layer. If there is an OMT animation then we need to draw the whole
|
||||
@@ -179,8 +178,13 @@ ClientTiledPaintedLayer::BeginPaint()
|
||||
ParentLayerRect criticalDisplayPort =
|
||||
(displayportMetrics.GetCriticalDisplayPort() * displayportMetrics.GetZoom())
|
||||
+ displayportMetrics.GetCompositionBounds().TopLeft();
|
||||
mPaintData.mCriticalDisplayPort = RoundedToInt(
|
||||
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort));
|
||||
Maybe<LayerRect> criticalDisplayPortTransformed =
|
||||
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort, layerBounds);
|
||||
if (!criticalDisplayPortTransformed) {
|
||||
mPaintData.ResetPaintData();
|
||||
return;
|
||||
}
|
||||
mPaintData.mCriticalDisplayPort = RoundedToInt(*criticalDisplayPortTransformed);
|
||||
}
|
||||
TILING_LOG("TILING %p: Critical displayport %s\n", this, Stringify(mPaintData.mCriticalDisplayPort).c_str());
|
||||
|
||||
@@ -194,8 +198,13 @@ ClientTiledPaintedLayer::BeginPaint()
|
||||
GetTransformToAncestorsParentLayer(this, scrollAncestor);
|
||||
gfx::Matrix4x4 transformToBounds = mPaintData.mTransformToCompBounds;
|
||||
transformToBounds.Invert();
|
||||
mPaintData.mCompositionBounds = ApplyParentLayerToLayerTransform(
|
||||
transformToBounds, scrollMetrics.GetCompositionBounds());
|
||||
Maybe<LayerRect> compositionBoundsTransformed = ApplyParentLayerToLayerTransform(
|
||||
transformToBounds, scrollMetrics.GetCompositionBounds(), layerBounds);
|
||||
if (!compositionBoundsTransformed) {
|
||||
mPaintData.ResetPaintData();
|
||||
return;
|
||||
}
|
||||
mPaintData.mCompositionBounds = *compositionBoundsTransformed;
|
||||
TILING_LOG("TILING %p: Composition bounds %s\n", this, Stringify(mPaintData.mCompositionBounds).c_str());
|
||||
|
||||
// Calculate the scroll offset since the last transaction
|
||||
|
||||
@@ -1398,14 +1398,16 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
|
||||
* transformed into the painted layer's LayerPixel coordinates, accounting
|
||||
* for the compositor state.
|
||||
*/
|
||||
static LayerRect
|
||||
static Maybe<LayerRect>
|
||||
GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
|
||||
const Matrix4x4& aTransformToCompBounds,
|
||||
const ViewTransform& aAPZTransform)
|
||||
const ViewTransform& aAPZTransform,
|
||||
const LayerRect& aClip)
|
||||
{
|
||||
Matrix4x4 transform = aTransformToCompBounds * Matrix4x4(aAPZTransform);
|
||||
return TransformTo<LayerPixel>(transform.Inverse(),
|
||||
aScrollAncestor.Metrics().GetCompositionBounds());
|
||||
|
||||
return UntransformTo<LayerPixel>(transform.Inverse(),
|
||||
aScrollAncestor.Metrics().GetCompositionBounds(), aClip);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -1484,12 +1486,18 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
||||
}
|
||||
}
|
||||
|
||||
LayerRect transformedCompositionBounds =
|
||||
Maybe<LayerRect> transformedCompositionBounds =
|
||||
GetCompositorSideCompositionBounds(scrollAncestor,
|
||||
aPaintData->mTransformToCompBounds,
|
||||
viewTransform);
|
||||
viewTransform,
|
||||
ViewAs<LayerPixel>(Rect(mPaintedLayer->GetLayerBounds())));
|
||||
|
||||
TILING_LOG("TILING %p: Progressive update transformed compositor bounds %s\n", mPaintedLayer, Stringify(transformedCompositionBounds).c_str());
|
||||
if (!transformedCompositionBounds) {
|
||||
aPaintData->mPaintFinished = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
TILING_LOG("TILING %p: Progressive update transformed compositor bounds %s\n", mPaintedLayer, Stringify(*transformedCompositionBounds).c_str());
|
||||
|
||||
// Compute a "coherent update rect" that we should paint all at once in a
|
||||
// single transaction. This is to avoid rendering glitches on animated
|
||||
@@ -1502,9 +1510,9 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
|
||||
// the browser, so we always use the entire user-visible area.
|
||||
IntRect coherentUpdateRect(LayerIntRect::ToUntyped(RoundedOut(
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds)
|
||||
transformedCompositionBounds->Intersect(aPaintData->mCompositionBounds)
|
||||
#else
|
||||
transformedCompositionBounds
|
||||
*transformedCompositionBounds
|
||||
#endif
|
||||
)));
|
||||
|
||||
@@ -1679,5 +1687,14 @@ TiledContentClient::Dump(std::stringstream& aStream,
|
||||
GetTiledBuffer()->Dump(aStream, aPrefix, aDumpHtml);
|
||||
}
|
||||
|
||||
void
|
||||
BasicTiledLayerPaintData::ResetPaintData()
|
||||
{
|
||||
mLowPrecisionPaintCount = 0;
|
||||
mPaintFinished = false;
|
||||
mCompositionBounds.SetEmpty();
|
||||
mCriticalDisplayPort.SetEmpty();
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -352,6 +352,11 @@ struct BasicTiledLayerPaintData {
|
||||
* progressively.
|
||||
*/
|
||||
bool mPaintFinished : 1;
|
||||
|
||||
/*
|
||||
* Initializes/clears data to prepare for paint action.
|
||||
*/
|
||||
void ResetPaintData();
|
||||
};
|
||||
|
||||
class SharedFrameMetricsHelper
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "LayerManagerComposite.h" // for LayerManagerComposite, etc
|
||||
#include "Layers.h" // for Layer, ContainerLayer, etc
|
||||
#include "gfxPoint.h" // for gfxPoint, gfxSize
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "mozilla/StyleAnimationValue.h" // for StyleAnimationValue, etc
|
||||
#include "mozilla/WidgetUtils.h" // for ComputeTransformForRotation
|
||||
#include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadOnly
|
||||
@@ -50,7 +51,7 @@ using namespace mozilla::gfx;
|
||||
enum Op { Resolve, Detach };
|
||||
|
||||
static bool
|
||||
IsSameDimension(dom::ScreenOrientation o1, dom::ScreenOrientation o2)
|
||||
IsSameDimension(dom::ScreenOrientationInternal o1, dom::ScreenOrientationInternal o2)
|
||||
{
|
||||
bool isO1portrait = (o1 == dom::eScreenOrientation_PortraitPrimary || o1 == dom::eScreenOrientation_PortraitSecondary);
|
||||
bool isO2portrait = (o2 == dom::eScreenOrientation_PortraitPrimary || o2 == dom::eScreenOrientation_PortraitSecondary);
|
||||
@@ -73,8 +74,8 @@ WalkTheTree(Layer* aLayer,
|
||||
if (const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(ref->GetReferentId())) {
|
||||
if (Layer* referent = state->mRoot) {
|
||||
if (!ref->GetVisibleRegion().IsEmpty()) {
|
||||
dom::ScreenOrientation chromeOrientation = aTargetConfig.orientation();
|
||||
dom::ScreenOrientation contentOrientation = state->mTargetConfig.orientation();
|
||||
dom::ScreenOrientationInternal chromeOrientation = aTargetConfig.orientation();
|
||||
dom::ScreenOrientationInternal contentOrientation = state->mTargetConfig.orientation();
|
||||
if (!IsSameDimension(chromeOrientation, contentOrientation) &&
|
||||
ContentMightReflowOnOrientationChange(aTargetConfig.naturalBounds())) {
|
||||
aReady = false;
|
||||
@@ -100,6 +101,7 @@ AsyncCompositionManager::AsyncCompositionManager(LayerManagerComposite* aManager
|
||||
: mLayerManager(aManager)
|
||||
, mIsFirstPaint(true)
|
||||
, mLayersUpdated(false)
|
||||
, mPaintSyncId(0)
|
||||
, mReadyForCompose(true)
|
||||
{
|
||||
}
|
||||
@@ -142,18 +144,21 @@ AsyncCompositionManager::ComputeRotation()
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
GetBaseTransform2D(Layer* aLayer, Matrix* aTransform)
|
||||
static void
|
||||
GetBaseTransform(Layer* aLayer, Matrix4x4* aTransform)
|
||||
{
|
||||
// Start with the animated transform if there is one
|
||||
return (aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation() ?
|
||||
aLayer->GetLocalTransform() : aLayer->GetTransform()).Is2D(aTransform);
|
||||
*aTransform =
|
||||
(aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation()
|
||||
? aLayer->GetLocalTransform()
|
||||
: aLayer->GetTransform());
|
||||
}
|
||||
|
||||
static void
|
||||
TransformClipRect(Layer* aLayer,
|
||||
const Matrix4x4& aTransform)
|
||||
{
|
||||
MOZ_ASSERT(aTransform.Is2D());
|
||||
const Maybe<ParentLayerIntRect>& clipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
|
||||
if (clipRect) {
|
||||
ParentLayerIntRect transformed = TransformTo<ParentLayerPixel>(aTransform, *clipRect);
|
||||
@@ -184,9 +189,9 @@ SetShadowTransform(Layer* aLayer, Matrix4x4 aTransform)
|
||||
}
|
||||
|
||||
static void
|
||||
TranslateShadowLayer2D(Layer* aLayer,
|
||||
const gfxPoint& aTranslation,
|
||||
bool aAdjustClipRect)
|
||||
TranslateShadowLayer(Layer* aLayer,
|
||||
const gfxPoint& aTranslation,
|
||||
bool aAdjustClipRect)
|
||||
{
|
||||
// This layer might also be a scrollable layer and have an async transform.
|
||||
// To make sure we don't clobber that, we start with the shadow transform.
|
||||
@@ -194,49 +199,41 @@ TranslateShadowLayer2D(Layer* aLayer,
|
||||
// Note that the shadow transform is reset on every frame of composition so
|
||||
// we don't have to worry about the adjustments compounding over successive
|
||||
// frames.
|
||||
Matrix layerTransform;
|
||||
if (!aLayer->GetLocalTransform().Is2D(&layerTransform)) {
|
||||
return;
|
||||
}
|
||||
Matrix4x4 layerTransform = aLayer->GetLocalTransform();
|
||||
|
||||
// Apply the 2D translation to the layer transform.
|
||||
layerTransform._31 += aTranslation.x;
|
||||
layerTransform._32 += aTranslation.y;
|
||||
// Apply the translation to the layer transform.
|
||||
layerTransform.PostTranslate(aTranslation.x, aTranslation.y, 0);
|
||||
|
||||
SetShadowTransform(aLayer, Matrix4x4::From2D(layerTransform));
|
||||
SetShadowTransform(aLayer, layerTransform);
|
||||
aLayer->AsLayerComposite()->SetShadowTransformSetByAnimation(false);
|
||||
|
||||
if (aAdjustClipRect) {
|
||||
TransformClipRect(aLayer, Matrix4x4::Translation(aTranslation.x, aTranslation.y, 0));
|
||||
}
|
||||
|
||||
// If a fixed- or sticky-position layer has a mask layer, that mask should
|
||||
// move along with the layer, so apply the translation to the mask layer too.
|
||||
if (Layer* maskLayer = aLayer->GetMaskLayer()) {
|
||||
TranslateShadowLayer2D(maskLayer, aTranslation, false);
|
||||
// If a fixed- or sticky-position layer has a mask layer, that mask should
|
||||
// move along with the layer, so apply the translation to the mask layer too.
|
||||
if (Layer* maskLayer = aLayer->GetMaskLayer()) {
|
||||
TranslateShadowLayer(maskLayer, aTranslation, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
AccumulateLayerTransforms2D(Layer* aLayer,
|
||||
Layer* aAncestor,
|
||||
Matrix& aMatrix)
|
||||
static void
|
||||
AccumulateLayerTransforms(Layer* aLayer,
|
||||
Layer* aAncestor,
|
||||
Matrix4x4& aMatrix)
|
||||
{
|
||||
// Accumulate the transforms between this layer and the subtree root layer.
|
||||
for (Layer* l = aLayer; l && l != aAncestor; l = l->GetParent()) {
|
||||
Matrix l2D;
|
||||
if (!GetBaseTransform2D(l, &l2D)) {
|
||||
return false;
|
||||
}
|
||||
aMatrix *= l2D;
|
||||
Matrix4x4 transform;
|
||||
GetBaseTransform(l, &transform);
|
||||
aMatrix *= transform;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static LayerPoint
|
||||
GetLayerFixedMarginsOffset(Layer* aLayer,
|
||||
const LayerMargin& aFixedLayerMargins)
|
||||
const ScreenMargin& aFixedLayerMargins)
|
||||
{
|
||||
// Work out the necessary translation, in root scrollable layer space.
|
||||
// Because fixed layer margins are stored relative to the root scrollable
|
||||
@@ -271,74 +268,124 @@ IntervalOverlap(gfxFloat aTranslation, gfxFloat aMin, gfxFloat aMax)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the metrics on |aLayer| with scroll id |aScrollId|, and returns a
|
||||
* LayerMetricsWrapper representing the (layer, metrics) pair, or the null
|
||||
* LayerMetricsWrapper if no matching metrics could be found.
|
||||
*/
|
||||
static LayerMetricsWrapper
|
||||
FindMetricsWithScrollId(Layer* aLayer, FrameMetrics::ViewID aScrollId)
|
||||
{
|
||||
for (uint64_t i = 0; i < aLayer->GetFrameMetricsCount(); ++i) {
|
||||
if (aLayer->GetFrameMetrics(i).GetScrollId() == aScrollId) {
|
||||
return LayerMetricsWrapper(aLayer, i);
|
||||
}
|
||||
}
|
||||
return LayerMetricsWrapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the (layer, metrics) pair (aTransformedLayer, aTransformedMetrics)
|
||||
* is on the path from |aFixedLayer| to the metrics with scroll id
|
||||
* |aFixedWithRespectTo|, inclusive.
|
||||
*/
|
||||
static bool
|
||||
AsyncTransformShouldBeUnapplied(Layer* aFixedLayer,
|
||||
FrameMetrics::ViewID aFixedWithRespectTo,
|
||||
Layer* aTransformedLayer,
|
||||
FrameMetrics::ViewID aTransformedMetrics)
|
||||
{
|
||||
LayerMetricsWrapper transformed = FindMetricsWithScrollId(aTransformedLayer, aTransformedMetrics);
|
||||
if (!transformed.IsValid()) {
|
||||
return false;
|
||||
}
|
||||
// It's important to start at the bottom, because the fixed layer itself
|
||||
// could have the transformed metrics, and they can be at the bottom.
|
||||
LayerMetricsWrapper current(aFixedLayer, LayerMetricsWrapper::StartAt::BOTTOM);
|
||||
bool encounteredTransformedLayer = false;
|
||||
// The transformed layer is on the path from |aFixedLayer| to the fixed-to
|
||||
// layer if as we walk up the (layer, metrics) tree starting from
|
||||
// |aFixedLayer|, we *first* encounter the transformed layer, and *then* (or
|
||||
// at the same time) the fixed-to layer.
|
||||
while (current) {
|
||||
if (!encounteredTransformedLayer && current == transformed) {
|
||||
encounteredTransformedLayer = true;
|
||||
}
|
||||
if (current.Metrics().GetScrollId() == aFixedWithRespectTo) {
|
||||
return encounteredTransformedLayer;
|
||||
}
|
||||
current = current.GetParent();
|
||||
// It's possible that we reach a layers id boundary before we reach an
|
||||
// ancestor with the scroll id |aFixedWithRespectTo| (this could happen
|
||||
// e.g. if the scroll frame with that scroll id uses containerless
|
||||
// scrolling). In such a case, stop the walk, as a new layers id could
|
||||
// have a different layer with scroll id |aFixedWithRespectTo| which we
|
||||
// don't intend to match.
|
||||
if (current && current.AsRefLayer() != nullptr) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
|
||||
Layer* aTransformedSubtreeRoot,
|
||||
FrameMetrics::ViewID aTransformScrollId,
|
||||
const Matrix4x4& aPreviousTransformForRoot,
|
||||
const Matrix4x4& aCurrentTransformForRoot,
|
||||
const LayerMargin& aFixedLayerMargins)
|
||||
const ScreenMargin& aFixedLayerMargins)
|
||||
{
|
||||
// If aLayer == aTransformedSubtreeRoot, then treat aLayer as fixed relative
|
||||
// to the ancestor scrollable layer rather than relative to itself.
|
||||
bool isRootFixed = aLayer->GetIsFixedPosition() &&
|
||||
aLayer != aTransformedSubtreeRoot &&
|
||||
FrameMetrics::ViewID fixedTo; // the scroll id of the scroll frame we are fixed/sticky to
|
||||
bool isRootOfFixedSubtree = aLayer->GetIsFixedPosition() &&
|
||||
!aLayer->GetParent()->GetIsFixedPosition();
|
||||
bool isStickyForSubtree = aLayer->GetIsStickyPosition() &&
|
||||
aLayer->GetStickyScrollContainerId() == aTransformScrollId;
|
||||
bool isFixedOrSticky = (isRootFixed || isStickyForSubtree);
|
||||
if (isRootOfFixedSubtree) {
|
||||
fixedTo = aLayer->GetFixedPositionScrollContainerId();
|
||||
}
|
||||
bool isSticky = aLayer->GetIsStickyPosition();
|
||||
if (isSticky) {
|
||||
fixedTo = aLayer->GetStickyScrollContainerId();
|
||||
}
|
||||
bool needsAsyncTransformUnapplied = false;
|
||||
if (isRootOfFixedSubtree || isSticky) {
|
||||
needsAsyncTransformUnapplied = AsyncTransformShouldBeUnapplied(aLayer,
|
||||
fixedTo, aTransformedSubtreeRoot, aTransformScrollId);
|
||||
}
|
||||
|
||||
// We want to process all the fixed and sticky children of
|
||||
// aTransformedSubtreeRoot. Also, once we do encounter such a child, we don't
|
||||
// need to recurse any deeper because the fixed layers are relative to their
|
||||
// nearest scrollable layer.
|
||||
if (!isFixedOrSticky) {
|
||||
// ApplyAsyncContentTransformToTree will call this function again for
|
||||
// nested scrollable layers, so we don't need to recurse if the layer is
|
||||
// scrollable.
|
||||
if (aLayer == aTransformedSubtreeRoot || !aLayer->HasScrollableFrameMetrics()) {
|
||||
for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) {
|
||||
AlignFixedAndStickyLayers(child, aTransformedSubtreeRoot, aTransformScrollId,
|
||||
aPreviousTransformForRoot,
|
||||
aCurrentTransformForRoot, aFixedLayerMargins);
|
||||
}
|
||||
// We want to process all the fixed and sticky descendants of
|
||||
// aTransformedSubtreeRoot. Once we do encounter such a descendant, we don't
|
||||
// need to recurse any deeper because the adjustment to the fixed or sticky
|
||||
// layer will apply to its subtree.
|
||||
if (!needsAsyncTransformUnapplied) {
|
||||
for (Layer* child = aLayer->GetFirstChild(); child; child = child->GetNextSibling()) {
|
||||
AlignFixedAndStickyLayers(child, aTransformedSubtreeRoot, aTransformScrollId,
|
||||
aPreviousTransformForRoot,
|
||||
aCurrentTransformForRoot, aFixedLayerMargins);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert a translation so that the position of the anchor point is the same
|
||||
// before and after the change to the transform of aTransformedSubtreeRoot.
|
||||
// This currently only works for fixed layers with 2D transforms.
|
||||
|
||||
// Accumulate the transforms between this layer and the subtree root layer.
|
||||
Matrix ancestorTransform;
|
||||
if (!AccumulateLayerTransforms2D(aLayer->GetParent(), aTransformedSubtreeRoot,
|
||||
ancestorTransform)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Matrix oldRootTransform;
|
||||
Matrix newRootTransform;
|
||||
if (!aPreviousTransformForRoot.Is2D(&oldRootTransform) ||
|
||||
!aCurrentTransformForRoot.Is2D(&newRootTransform)) {
|
||||
return;
|
||||
}
|
||||
Matrix4x4 ancestorTransform;
|
||||
AccumulateLayerTransforms(aLayer->GetParent(), aTransformedSubtreeRoot,
|
||||
ancestorTransform);
|
||||
|
||||
// Calculate the cumulative transforms between the subtree root with the
|
||||
// old transform and the current transform.
|
||||
Matrix oldCumulativeTransform = ancestorTransform * oldRootTransform;
|
||||
Matrix newCumulativeTransform = ancestorTransform * newRootTransform;
|
||||
Matrix4x4 oldCumulativeTransform = ancestorTransform * aPreviousTransformForRoot;
|
||||
Matrix4x4 newCumulativeTransform = ancestorTransform * aCurrentTransformForRoot;
|
||||
if (newCumulativeTransform.IsSingular()) {
|
||||
return;
|
||||
}
|
||||
Matrix newCumulativeTransformInverse = newCumulativeTransform.Inverse();
|
||||
Matrix4x4 newCumulativeTransformInverse = newCumulativeTransform.Inverse();
|
||||
|
||||
// Now work out the translation necessary to make sure the layer doesn't
|
||||
// move given the new sub-tree root transform.
|
||||
Matrix layerTransform;
|
||||
if (!GetBaseTransform2D(aLayer, &layerTransform)) {
|
||||
return;
|
||||
}
|
||||
Matrix4x4 layerTransform;
|
||||
GetBaseTransform(aLayer, &layerTransform);
|
||||
|
||||
// Calculate any offset necessary, in previous transform sub-tree root
|
||||
// space. This is used to make sure fixed position content respects
|
||||
@@ -383,15 +430,19 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
|
||||
IntervalOverlap(translation.x, stickyInner.x, stickyInner.XMost());
|
||||
}
|
||||
|
||||
// Finally, apply the 2D translation to the layer transform. Note that in
|
||||
// Finally, apply the translation to the layer transform. Note that in
|
||||
// general we need to apply the same translation to the layer's clip rect, so
|
||||
// that the effective transform on the clip rect takes it back to where it was
|
||||
// originally, had there been no async scroll. In the case where the
|
||||
// fixed/sticky layer is the same as aTransformedSubtreeRoot, then the clip
|
||||
// rect is not affected by the scroll-induced async scroll transform anyway
|
||||
// (since the clip is applied post-transform) so we don't need to make the
|
||||
// adjustment.
|
||||
TranslateShadowLayer2D(aLayer, ThebesPoint(translation), aLayer != aTransformedSubtreeRoot);
|
||||
// adjustment. Also, some layers want async scrolling to move their clip rect
|
||||
// (IsClipFixed() = false), so we don't make a compensating adjustment for
|
||||
// those.
|
||||
bool adjustClipRect = aLayer != aTransformedSubtreeRoot &&
|
||||
aLayer->IsClipFixed();
|
||||
TranslateShadowLayer(aLayer, ThebesPoint(translation), adjustClipRect);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -604,22 +655,45 @@ AdjustForClip(const Matrix4x4& asyncTransform, Layer* aLayer)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
ExpandRootClipRect(Layer* aLayer, const ScreenMargin& aFixedLayerMargins)
|
||||
{
|
||||
// For Fennec we want to expand the root scrollable layer clip rect based on
|
||||
// the fixed position margins. In particular, we want this while the dynamic
|
||||
// toolbar is in the process of sliding offscreen and the area of the
|
||||
// LayerView visible to the user is larger than the viewport size that Gecko
|
||||
// knows about (and therefore larger than the clip rect). We could also just
|
||||
// clear the clip rect on aLayer entirely but this seems more precise.
|
||||
Maybe<ParentLayerIntRect> rootClipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
|
||||
if (rootClipRect && aFixedLayerMargins != ScreenMargin()) {
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
// We should never enter here on anything other than Fennec, since
|
||||
// aFixedLayerMargins should be empty everywhere else.
|
||||
MOZ_ASSERT(false);
|
||||
#endif
|
||||
ParentLayerRect rect(rootClipRect.value());
|
||||
rect.Deflate(ViewAs<ParentLayerPixel>(aFixedLayerMargins,
|
||||
PixelCastJustification::ScreenIsParentLayerForRoot));
|
||||
aLayer->AsLayerComposite()->SetShadowClipRect(Some(RoundedOut(rect)));
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
|
||||
bool* aOutFoundRoot)
|
||||
{
|
||||
bool appliedTransform = false;
|
||||
for (Layer* child = aLayer->GetFirstChild();
|
||||
child; child = child->GetNextSibling()) {
|
||||
appliedTransform |=
|
||||
ApplyAsyncContentTransformToTree(child);
|
||||
ApplyAsyncContentTransformToTree(child, aOutFoundRoot);
|
||||
}
|
||||
|
||||
Matrix4x4 oldTransform = aLayer->GetTransform();
|
||||
|
||||
Matrix4x4 combinedAsyncTransformWithoutOverscroll;
|
||||
Matrix4x4 combinedAsyncTransform;
|
||||
bool hasAsyncTransform = false;
|
||||
LayerMargin fixedLayerMargins(0, 0, 0, 0);
|
||||
ScreenMargin fixedLayerMargins;
|
||||
|
||||
// Each layer has multiple clips. Its local clip, which must move with async
|
||||
// transforms, and its scrollframe clips, which are the clips between each
|
||||
@@ -662,32 +736,49 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
}
|
||||
|
||||
const FrameMetrics& metrics = aLayer->GetFrameMetrics(i);
|
||||
ScreenPoint offset(0, 0);
|
||||
// TODO: When we enable APZ on Fennec, we'll need to call SyncFrameMetrics here.
|
||||
// When doing so, it might be useful to look at how it was called here before
|
||||
// bug 1036967 removed the (dead) call.
|
||||
|
||||
#if defined(MOZ_ANDROID_APZ)
|
||||
if (mIsFirstPaint) {
|
||||
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
|
||||
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
|
||||
mContentRect = metrics.GetScrollableRect();
|
||||
SetFirstPaintViewport(scrollOffsetLayerPixels,
|
||||
geckoZoom,
|
||||
mContentRect);
|
||||
// If we find a metrics which is the root content doc, use that. If not, use
|
||||
// the root layer. Since this function recurses on children first we should
|
||||
// only end up using the root layer if the entire tree was devoid of a
|
||||
// root content metrics. This is a temporary solution; in the long term we
|
||||
// should not need the root content metrics at all. See bug 1201529 comment
|
||||
// 6 for details.
|
||||
if (!(*aOutFoundRoot)) {
|
||||
*aOutFoundRoot = metrics.IsRootContent() || /* RCD */
|
||||
(aLayer->GetParent() == nullptr && /* rootmost metrics */
|
||||
i + 1 >= aLayer->GetFrameMetricsCount());
|
||||
if (*aOutFoundRoot) {
|
||||
CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
|
||||
if (mIsFirstPaint) {
|
||||
LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
|
||||
mContentRect = metrics.GetScrollableRect();
|
||||
SetFirstPaintViewport(scrollOffsetLayerPixels,
|
||||
geckoZoom,
|
||||
mContentRect);
|
||||
} else {
|
||||
// Compute the painted displayport in document-relative CSS pixels.
|
||||
CSSRect displayPort(metrics.GetCriticalDisplayPort().IsEmpty() ?
|
||||
metrics.GetDisplayPort() :
|
||||
metrics.GetCriticalDisplayPort());
|
||||
displayPort += metrics.GetScrollOffset();
|
||||
SyncFrameMetrics(scrollOffset,
|
||||
geckoZoom * asyncTransformWithoutOverscroll.mScale,
|
||||
metrics.GetScrollableRect(), displayPort, geckoZoom, mLayersUpdated,
|
||||
mPaintSyncId, fixedLayerMargins);
|
||||
}
|
||||
mIsFirstPaint = false;
|
||||
mLayersUpdated = false;
|
||||
mPaintSyncId = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mIsFirstPaint = false;
|
||||
mLayersUpdated = false;
|
||||
|
||||
// Apply the render offset
|
||||
mLayerManager->GetCompositor()->SetScreenRenderOffset(offset);
|
||||
|
||||
// Transform the current local clip by this APZC's async transform. If we're
|
||||
// using containerful scrolling, then the clip is not part of the scrolled
|
||||
// frame and should not be transformed.
|
||||
if (asyncClip && !metrics.UsesContainerScrolling()) {
|
||||
MOZ_ASSERT(asyncTransform.Is2D());
|
||||
asyncClip = Some(TransformTo<ParentLayerPixel>(asyncTransform, *asyncClip));
|
||||
}
|
||||
|
||||
@@ -718,8 +809,22 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
ancestorMaskLayers.AppendElement(ancestorMaskLayer);
|
||||
}
|
||||
|
||||
combinedAsyncTransformWithoutOverscroll *= asyncTransformWithoutOverscroll;
|
||||
combinedAsyncTransform *= asyncTransform;
|
||||
|
||||
// For the purpose of aligning fixed and sticky layers, we disregard
|
||||
// the overscroll transform as well as any OMTA transform when computing the
|
||||
// 'aCurrentTransformForRoot' parameter. This ensures that the overscroll
|
||||
// and OMTA transforms are not unapplied, and therefore that the visual
|
||||
// effects apply to fixed and sticky layers. We do this by using
|
||||
// GetTransform() as the base transform rather than GetLocalTransform(),
|
||||
// which would include those factors.
|
||||
Matrix4x4 transformWithoutOverscrollOrOmta = aLayer->GetTransform() *
|
||||
AdjustForClip(asyncTransformWithoutOverscroll, aLayer);
|
||||
|
||||
// Since fixed/sticky layers are relative to their nearest scrolling ancestor,
|
||||
// we use the ViewID from the bottommost scrollable metrics here.
|
||||
AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
|
||||
transformWithoutOverscrollOrOmta, fixedLayerMargins);
|
||||
}
|
||||
|
||||
if (hasAsyncTransform) {
|
||||
@@ -740,26 +845,11 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
maskLayer->GetLocalTransform() * combinedAsyncTransform);
|
||||
}
|
||||
|
||||
const FrameMetrics& bottom = LayerMetricsWrapper::BottommostScrollableMetrics(aLayer);
|
||||
MOZ_ASSERT(bottom.IsScrollable()); // must be true because hasAsyncTransform is true
|
||||
|
||||
// For the purpose of aligning fixed and sticky layers, we disregard
|
||||
// the overscroll transform as well as any OMTA transform when computing the
|
||||
// 'aCurrentTransformForRoot' parameter. This ensures that the overscroll
|
||||
// and OMTA transforms are not unapplied, and therefore that the visual
|
||||
// effects apply to fixed and sticky layers. We do this by using
|
||||
// GetTransform() as the base transform rather than GetLocalTransform(),
|
||||
// which would include those factors.
|
||||
Matrix4x4 transformWithoutOverscrollOrOmta = aLayer->GetTransform() *
|
||||
AdjustForClip(combinedAsyncTransformWithoutOverscroll, aLayer);
|
||||
// Since fixed/sticky layers are relative to their nearest scrolling ancestor,
|
||||
// we use the ViewID from the bottommost scrollable metrics here.
|
||||
AlignFixedAndStickyLayers(aLayer, aLayer, bottom.GetScrollId(), oldTransform,
|
||||
transformWithoutOverscrollOrOmta, fixedLayerMargins);
|
||||
|
||||
appliedTransform = true;
|
||||
}
|
||||
|
||||
ExpandRootClipRect(aLayer, fixedLayerMargins);
|
||||
|
||||
if (aLayer->GetScrollbarDirection() != Layer::NONE) {
|
||||
ApplyAsyncTransformToScrollbar(aLayer);
|
||||
}
|
||||
@@ -884,7 +974,7 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
scrollbarTransform.PostTranslate(xTranslation, 0, 0);
|
||||
}
|
||||
|
||||
Matrix4x4 transform = scrollbarTransform * aScrollbar->GetTransform();
|
||||
Matrix4x4 transform = aScrollbar->GetLocalTransform() * scrollbarTransform;
|
||||
|
||||
Matrix4x4 compensation;
|
||||
// If the scrollbar layer is for the root then the content's resolution
|
||||
@@ -914,17 +1004,18 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
|
||||
Matrix4x4 contentTransform = aContent.GetTransform();
|
||||
Matrix4x4 contentUntransform = contentTransform.Inverse();
|
||||
|
||||
compensation = compensation
|
||||
* contentTransform
|
||||
* asyncUntransform
|
||||
* contentUntransform;
|
||||
Matrix4x4 asyncCompensation = contentTransform
|
||||
* asyncUntransform
|
||||
* contentUntransform;
|
||||
|
||||
compensation = compensation * asyncCompensation;
|
||||
|
||||
// We also need to make a corresponding change on the clip rect of all the
|
||||
// layers on the ancestor chain from the scrollbar layer up to but not
|
||||
// including the layer with the async transform. Otherwise the scrollbar
|
||||
// shifts but gets clipped and so appears to flicker.
|
||||
for (Layer* ancestor = aScrollbar; ancestor != aContent.GetLayer(); ancestor = ancestor->GetParent()) {
|
||||
TransformClipRect(ancestor, compensation);
|
||||
TransformClipRect(ancestor, asyncCompensation);
|
||||
}
|
||||
}
|
||||
transform = transform * compensation;
|
||||
@@ -1040,8 +1131,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
) * geckoZoom);
|
||||
displayPort += scrollOffsetLayerPixels;
|
||||
|
||||
LayerMargin fixedLayerMargins(0, 0, 0, 0);
|
||||
ScreenPoint offset(0, 0);
|
||||
ScreenMargin fixedLayerMargins(0, 0, 0, 0);
|
||||
|
||||
// Ideally we would initialize userZoom to AsyncPanZoomController::CalculateResolution(metrics)
|
||||
// but this causes a reftest-ipc test to fail (see bug 883646 comment 27). The reason for this
|
||||
@@ -1053,14 +1143,12 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
// for which we can assume that x and y scales are equal.
|
||||
* metrics.GetCumulativeResolution().ToScaleFactor()
|
||||
* LayerToParentLayerScale(1));
|
||||
ParentLayerPoint userScroll = metrics.GetScrollOffset() * userZoom;
|
||||
SyncViewportInfo(displayPort, geckoZoom, mLayersUpdated,
|
||||
userScroll, userZoom, fixedLayerMargins,
|
||||
offset);
|
||||
ParentLayerRect userRect(metrics.GetScrollOffset() * userZoom,
|
||||
metrics.GetCompositionBounds().Size());
|
||||
SyncViewportInfo(displayPort, geckoZoom, mLayersUpdated, mPaintSyncId,
|
||||
userRect, userZoom, fixedLayerMargins);
|
||||
mLayersUpdated = false;
|
||||
|
||||
// Apply the render offset
|
||||
mLayerManager->GetCompositor()->SetScreenRenderOffset(offset);
|
||||
mPaintSyncId = 0;
|
||||
|
||||
// Handle transformations for asynchronous panning and zooming. We determine the
|
||||
// zoom used by Gecko from the transformation set on the root layer, and we
|
||||
@@ -1074,7 +1162,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
}
|
||||
|
||||
LayerToParentLayerScale asyncZoom = userZoom / metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
|
||||
ParentLayerPoint translation = userScroll - geckoScroll;
|
||||
ParentLayerPoint translation = userRect.TopLeft() - geckoScroll;
|
||||
Matrix4x4 treeTransform = ViewTransform(asyncZoom, -translation);
|
||||
|
||||
// Apply the tree transform on top of GetLocalTransform() here (rather than
|
||||
@@ -1090,17 +1178,15 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
// AlignFixedAndStickyLayers.
|
||||
ParentLayerRect contentScreenRect = mContentRect * userZoom;
|
||||
Point3D overscrollTranslation;
|
||||
if (userScroll.x < contentScreenRect.x) {
|
||||
overscrollTranslation.x = contentScreenRect.x - userScroll.x;
|
||||
} else if (userScroll.x + metrics.GetCompositionBounds().width > contentScreenRect.XMost()) {
|
||||
overscrollTranslation.x = contentScreenRect.XMost() -
|
||||
(userScroll.x + metrics.GetCompositionBounds().width);
|
||||
if (userRect.x < contentScreenRect.x) {
|
||||
overscrollTranslation.x = contentScreenRect.x - userRect.x;
|
||||
} else if (userRect.XMost() > contentScreenRect.XMost()) {
|
||||
overscrollTranslation.x = contentScreenRect.XMost() - userRect.XMost();
|
||||
}
|
||||
if (userScroll.y < contentScreenRect.y) {
|
||||
overscrollTranslation.y = contentScreenRect.y - userScroll.y;
|
||||
} else if (userScroll.y + metrics.GetCompositionBounds().height > contentScreenRect.YMost()) {
|
||||
overscrollTranslation.y = contentScreenRect.YMost() -
|
||||
(userScroll.y + metrics.GetCompositionBounds().height);
|
||||
if (userRect.y < contentScreenRect.y) {
|
||||
overscrollTranslation.y = contentScreenRect.y - userRect.y;
|
||||
} else if (userRect.YMost() > contentScreenRect.YMost()) {
|
||||
overscrollTranslation.y = contentScreenRect.YMost() - userRect.YMost();
|
||||
}
|
||||
oldTransform.PreTranslate(overscrollTranslation.x,
|
||||
overscrollTranslation.y,
|
||||
@@ -1121,6 +1207,8 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
// when we're asynchronously panning or zooming
|
||||
AlignFixedAndStickyLayers(aLayer, aLayer, metrics.GetScrollId(), oldTransform,
|
||||
aLayer->GetLocalTransform(), fixedLayerMargins);
|
||||
|
||||
ExpandRootClipRect(aLayer, fixedLayerMargins);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1160,7 +1248,12 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame,
|
||||
// its own platform-specific async rendering that is done partially
|
||||
// in Gecko and partially in Java.
|
||||
wantNextFrame |= SampleAPZAnimations(LayerMetricsWrapper(root), aCurrentFrame);
|
||||
if (!ApplyAsyncContentTransformToTree(root)) {
|
||||
bool foundRoot = false;
|
||||
if (ApplyAsyncContentTransformToTree(root, &foundRoot)) {
|
||||
#if defined(MOZ_ANDROID_APZ)
|
||||
MOZ_ASSERT(foundRoot);
|
||||
#endif
|
||||
} else {
|
||||
nsAutoTArray<Layer*,1> scrollableLayers;
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mLayerManager->GetRootScrollableLayers(scrollableLayers);
|
||||
@@ -1211,38 +1304,37 @@ void
|
||||
AsyncCompositionManager::SyncViewportInfo(const LayerIntRect& aDisplayPort,
|
||||
const CSSToLayerScale& aDisplayResolution,
|
||||
bool aLayersUpdated,
|
||||
ParentLayerPoint& aScrollOffset,
|
||||
int32_t aPaintSyncId,
|
||||
ParentLayerRect& aScrollRect,
|
||||
CSSToParentLayerScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins,
|
||||
ScreenPoint& aOffset)
|
||||
ScreenMargin& aFixedLayerMargins)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
AndroidBridge::Bridge()->SyncViewportInfo(aDisplayPort,
|
||||
aDisplayResolution,
|
||||
aLayersUpdated,
|
||||
aScrollOffset,
|
||||
aPaintSyncId,
|
||||
aScrollRect,
|
||||
aScale,
|
||||
aFixedLayerMargins,
|
||||
aOffset);
|
||||
aFixedLayerMargins);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AsyncCompositionManager::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
|
||||
float aZoom,
|
||||
const CSSToParentLayerScale& aZoom,
|
||||
const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated,
|
||||
const CSSRect& aDisplayPort,
|
||||
const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint,
|
||||
LayerMargin& aFixedLayerMargins,
|
||||
ScreenPoint& aOffset)
|
||||
const CSSToLayerScale& aPaintedResolution,
|
||||
bool aLayersUpdated,
|
||||
int32_t aPaintSyncId,
|
||||
ScreenMargin& aFixedLayerMargins)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
AndroidBridge::Bridge()->SyncFrameMetrics(aScrollOffset, aZoom, aCssPageRect,
|
||||
aLayersUpdated, aDisplayPort,
|
||||
aDisplayResolution, aIsFirstPaint,
|
||||
aFixedLayerMargins, aOffset);
|
||||
aDisplayPort, aPaintedResolution,
|
||||
aLayersUpdated, aPaintSyncId,
|
||||
aFixedLayerMargins);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/layers/FrameUniformityData.h" // For FrameUniformityData
|
||||
#include "mozilla/layers/LayersMessages.h" // for TargetConfig
|
||||
#include "mozilla/nsRefPtr.h" // for nsRefPtr
|
||||
#include "mozilla/nsRefPtr.h" // for nsRefPtr
|
||||
#include "nsISupportsImpl.h" // for LayerManager::AddRef, etc
|
||||
|
||||
namespace mozilla {
|
||||
@@ -98,14 +98,18 @@ public:
|
||||
void ComputeRotation();
|
||||
|
||||
// Call after updating our layer tree.
|
||||
void Updated(bool isFirstPaint, const TargetConfig& aTargetConfig)
|
||||
void Updated(bool isFirstPaint, const TargetConfig& aTargetConfig,
|
||||
int32_t aPaintSyncId)
|
||||
{
|
||||
mIsFirstPaint |= isFirstPaint;
|
||||
mLayersUpdated = true;
|
||||
mTargetConfig = aTargetConfig;
|
||||
if (aPaintSyncId) {
|
||||
mPaintSyncId = aPaintSyncId;
|
||||
}
|
||||
}
|
||||
|
||||
bool RequiresReorientation(mozilla::dom::ScreenOrientation aOrientation)
|
||||
bool RequiresReorientation(mozilla::dom::ScreenOrientationInternal aOrientation) const
|
||||
{
|
||||
return mTargetConfig.orientation() != aOrientation;
|
||||
}
|
||||
@@ -124,8 +128,11 @@ public:
|
||||
private:
|
||||
void TransformScrollableLayer(Layer* aLayer);
|
||||
// Return true if an AsyncPanZoomController content transform was
|
||||
// applied for |aLayer|.
|
||||
bool ApplyAsyncContentTransformToTree(Layer* aLayer);
|
||||
// applied for |aLayer|. |*aOutFoundRoot| is set to true on Android only, if
|
||||
// one of the metrics on one of the layers was determined to be the "root"
|
||||
// and its state was synced to the Java front-end. |aOutFoundRoot| must be
|
||||
// non-null.
|
||||
bool ApplyAsyncContentTransformToTree(Layer* aLayer, bool* aOutFoundRoot);
|
||||
/**
|
||||
* Update the shadow transform for aLayer assuming that is a scrollbar,
|
||||
* so that it stays in sync with the content that is being scrolled by APZ.
|
||||
@@ -139,19 +146,18 @@ private:
|
||||
void SyncViewportInfo(const LayerIntRect& aDisplayPort,
|
||||
const CSSToLayerScale& aDisplayResolution,
|
||||
bool aLayersUpdated,
|
||||
ParentLayerPoint& aScrollOffset,
|
||||
int32_t aPaintSyncId,
|
||||
ParentLayerRect& aScrollRect,
|
||||
CSSToParentLayerScale& aScale,
|
||||
LayerMargin& aFixedLayerMargins,
|
||||
ScreenPoint& aOffset);
|
||||
ScreenMargin& aFixedLayerMargins);
|
||||
void SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
|
||||
float aZoom,
|
||||
const CSSToParentLayerScale& aZoom,
|
||||
const CSSRect& aCssPageRect,
|
||||
bool aLayersUpdated,
|
||||
const CSSRect& aDisplayPort,
|
||||
const CSSToLayerScale& aDisplayResolution,
|
||||
bool aIsFirstPaint,
|
||||
LayerMargin& aFixedLayerMargins,
|
||||
ScreenPoint& aOffset);
|
||||
const CSSToLayerScale& aPaintedResolution,
|
||||
bool aLayersUpdated,
|
||||
int32_t aPaintSyncId,
|
||||
ScreenMargin& aFixedLayerMargins);
|
||||
|
||||
/**
|
||||
* Adds a translation to the transform of any fixed position (whose parent
|
||||
@@ -172,7 +178,7 @@ private:
|
||||
FrameMetrics::ViewID aTransformScrollId,
|
||||
const gfx::Matrix4x4& aPreviousTransformForRoot,
|
||||
const gfx::Matrix4x4& aCurrentTransformForRoot,
|
||||
const LayerMargin& aFixedLayerMargins);
|
||||
const ScreenMargin& aFixedLayerMargins);
|
||||
|
||||
/**
|
||||
* DRAWING PHASE ONLY
|
||||
@@ -206,6 +212,8 @@ private:
|
||||
// after a layers update has it set. It is cleared after that first composition.
|
||||
bool mLayersUpdated;
|
||||
|
||||
int32_t mPaintSyncId;
|
||||
|
||||
bool mReadyForCompose;
|
||||
|
||||
gfx::Matrix mWorldTransform;
|
||||
|
||||
@@ -1257,7 +1257,8 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction)
|
||||
bool aIsRepeatTransaction,
|
||||
int32_t aPaintSyncId)
|
||||
{
|
||||
ScheduleRotationOnCompositorThread(aTargetConfig, aIsFirstPaint);
|
||||
|
||||
@@ -1266,8 +1267,9 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
// race condition.
|
||||
mLayerManager->UpdateRenderBounds(aTargetConfig.naturalBounds());
|
||||
mLayerManager->SetRegionToClear(aTargetConfig.clearRegion());
|
||||
mLayerManager->GetCompositor()->SetScreenRotation(aTargetConfig.rotation());
|
||||
|
||||
mCompositionManager->Updated(aIsFirstPaint, aTargetConfig);
|
||||
mCompositionManager->Updated(aIsFirstPaint, aTargetConfig, aPaintSyncId);
|
||||
Layer* root = aLayerTree->GetRoot();
|
||||
mLayerManager->SetRoot(root);
|
||||
|
||||
@@ -1790,7 +1792,8 @@ public:
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction) override;
|
||||
bool aIsRepeatTransaction,
|
||||
int32_t /*aPaintSyncId: unused*/) override;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) override;
|
||||
virtual void NotifyClearCachedResources(LayerTransactionParent* aLayerTree) override;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
@@ -2019,7 +2022,8 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction)
|
||||
bool aIsRepeatTransaction,
|
||||
int32_t /*aPaintSyncId: unused*/)
|
||||
{
|
||||
uint64_t id = aLayerTree->GetId();
|
||||
|
||||
|
||||
@@ -263,7 +263,8 @@ public:
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction) override;
|
||||
bool aIsRepeatTransaction,
|
||||
int32_t aPaintSyncId) override;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) override;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) override;
|
||||
|
||||
@@ -197,11 +197,12 @@ LayerTransactionParent::RecvUpdateNoSwap(InfallibleTArray<Edit>&& cset,
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber,
|
||||
const bool& isRepeatTransaction,
|
||||
const mozilla::TimeStamp& aTransactionStart)
|
||||
const mozilla::TimeStamp& aTransactionStart,
|
||||
const int32_t& aPaintSyncId)
|
||||
{
|
||||
return RecvUpdate(Move(cset), aTransactionId, targetConfig, Move(aPlugins), isFirstPaint,
|
||||
scheduleComposite, paintSequenceNumber, isRepeatTransaction,
|
||||
aTransactionStart, nullptr);
|
||||
aTransactionStart, aPaintSyncId, nullptr);
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS AutoLayerTransactionParentAsyncMessageSender
|
||||
@@ -229,6 +230,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
||||
const uint32_t& paintSequenceNumber,
|
||||
const bool& isRepeatTransaction,
|
||||
const mozilla::TimeStamp& aTransactionStart,
|
||||
const int32_t& aPaintSyncId,
|
||||
InfallibleTArray<EditReply>* reply)
|
||||
{
|
||||
profiler_tracing("Paint", "LayerTransaction", TRACING_INTERVAL_START);
|
||||
@@ -245,11 +247,6 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mLayerManager && mLayerManager->GetCompositor() &&
|
||||
!targetConfig.naturalBounds().IsEmpty()) {
|
||||
mLayerManager->GetCompositor()->SetScreenRotation(targetConfig.rotation());
|
||||
}
|
||||
|
||||
EditReplyVector replyv;
|
||||
AutoLayerTransactionParentAsyncMessageSender autoAsyncMessageSender(this);
|
||||
|
||||
@@ -596,7 +593,8 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
|
||||
|
||||
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
|
||||
aPlugins, isFirstPaint, scheduleComposite,
|
||||
paintSequenceNumber, isRepeatTransaction);
|
||||
paintSequenceNumber, isRepeatTransaction,
|
||||
aPaintSyncId);
|
||||
|
||||
{
|
||||
AutoResolveRefLayers resolve(mShadowLayersManager->GetCompositionManager(this));
|
||||
|
||||
@@ -110,6 +110,7 @@ protected:
|
||||
const uint32_t& paintSequenceNumber,
|
||||
const bool& isRepeatTransaction,
|
||||
const mozilla::TimeStamp& aTransactionStart,
|
||||
const int32_t& aPaintSyncId,
|
||||
EditReplyArray* reply) override;
|
||||
|
||||
virtual bool RecvUpdateNoSwap(EditArray&& cset,
|
||||
@@ -120,7 +121,8 @@ protected:
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber,
|
||||
const bool& isRepeatTransaction,
|
||||
const mozilla::TimeStamp& aTransactionStart) override;
|
||||
const mozilla::TimeStamp& aTransactionStart,
|
||||
const int32_t& aPaintSyncId) override;
|
||||
|
||||
virtual bool RecvClearCachedResources() override;
|
||||
virtual bool RecvForceComposite() override;
|
||||
|
||||
@@ -29,7 +29,7 @@ using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
|
||||
using nsCSSProperty from "nsCSSProperty.h";
|
||||
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
|
||||
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
|
||||
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
|
||||
using mozilla::LayerMargin from "Units.h";
|
||||
using mozilla::LayerPoint from "Units.h";
|
||||
@@ -49,7 +49,7 @@ namespace layers {
|
||||
struct TargetConfig {
|
||||
IntRect naturalBounds;
|
||||
ScreenRotation rotation;
|
||||
ScreenOrientation orientation;
|
||||
ScreenOrientationInternal orientation;
|
||||
nsIntRegion clearRegion;
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ parent:
|
||||
sync Update(Edit[] cset, uint64_t id, TargetConfig targetConfig,
|
||||
PluginWindowData[] plugins, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber,
|
||||
bool isRepeatTransaction, TimeStamp transactionStart)
|
||||
bool isRepeatTransaction, TimeStamp transactionStart,
|
||||
int32_t paintSyncId)
|
||||
returns (EditReply[] reply);
|
||||
|
||||
// We don't need to send a sync transaction if
|
||||
@@ -65,7 +66,8 @@ parent:
|
||||
async UpdateNoSwap(Edit[] cset, uint64_t id, TargetConfig targetConfig,
|
||||
PluginWindowData[] plugins, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber,
|
||||
bool isRepeatTransaction, TimeStamp transactionStart);
|
||||
bool isRepeatTransaction, TimeStamp transactionStart,
|
||||
int32_t paintSyncId);
|
||||
|
||||
// Testing APIs
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
{}
|
||||
|
||||
void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation,
|
||||
dom::ScreenOrientation aOrientation)
|
||||
dom::ScreenOrientationInternal aOrientation)
|
||||
{
|
||||
mOpen = true;
|
||||
mTargetBounds = aTargetBounds;
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
ShadowableLayerSet mMutants;
|
||||
gfx::IntRect mTargetBounds;
|
||||
ScreenRotation mTargetRotation;
|
||||
dom::ScreenOrientation mTargetOrientation;
|
||||
dom::ScreenOrientationInternal mTargetOrientation;
|
||||
bool mSwapRequired;
|
||||
|
||||
private:
|
||||
@@ -167,6 +167,7 @@ ShadowLayerForwarder::ShadowLayerForwarder()
|
||||
: mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
|
||||
, mIsFirstPaint(false)
|
||||
, mWindowOverlayChanged(false)
|
||||
, mPaintSyncId(0)
|
||||
{
|
||||
mTxn = new Transaction();
|
||||
}
|
||||
@@ -184,7 +185,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder()
|
||||
void
|
||||
ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds,
|
||||
ScreenRotation aRotation,
|
||||
dom::ScreenOrientation aOrientation)
|
||||
dom::ScreenOrientationInternal aOrientation)
|
||||
{
|
||||
MOZ_ASSERT(HasShadowManager(), "no manager to forward to");
|
||||
MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?");
|
||||
@@ -663,7 +664,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
!mShadowManager->SendUpdate(cset, aId, targetConfig, mPluginWindowData,
|
||||
mIsFirstPaint, aScheduleComposite,
|
||||
aPaintSequenceNumber, aIsRepeatTransaction,
|
||||
aTransactionStart, aReplies)) {
|
||||
aTransactionStart, mPaintSyncId, aReplies)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
return false;
|
||||
}
|
||||
@@ -677,7 +678,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
!mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mPluginWindowData,
|
||||
mIsFirstPaint, aScheduleComposite,
|
||||
aPaintSequenceNumber, aIsRepeatTransaction,
|
||||
aTransactionStart)) {
|
||||
aTransactionStart, mPaintSyncId)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
return false;
|
||||
}
|
||||
@@ -685,6 +686,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
|
||||
*aSent = true;
|
||||
mIsFirstPaint = false;
|
||||
mPaintSyncId = 0;
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
*/
|
||||
void BeginTransaction(const gfx::IntRect& aTargetBounds,
|
||||
ScreenRotation aRotation,
|
||||
mozilla::dom::ScreenOrientation aOrientation);
|
||||
mozilla::dom::ScreenOrientationInternal aOrientation);
|
||||
|
||||
/**
|
||||
* The following methods may only be called after BeginTransaction()
|
||||
@@ -344,6 +344,8 @@ public:
|
||||
*/
|
||||
void SetIsFirstPaint() { mIsFirstPaint = true; }
|
||||
|
||||
void SetPaintSyncId(int32_t aSyncId) { mPaintSyncId = aSyncId; }
|
||||
|
||||
static void PlatformSyncBeforeUpdate();
|
||||
|
||||
protected:
|
||||
@@ -366,6 +368,7 @@ private:
|
||||
DiagnosticTypes mDiagnosticTypes;
|
||||
bool mIsFirstPaint;
|
||||
bool mWindowOverlayChanged;
|
||||
int32_t mPaintSyncId;
|
||||
InfallibleTArray<PluginWindowData> mPluginWindowData;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ public:
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction) = 0;
|
||||
bool aIsRepeatTransaction,
|
||||
int32_t aPaintSyncId) = 0;
|
||||
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; }
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace {
|
||||
// screen orientation. Similar to what Android SensorManager.remapCoordinateSystem
|
||||
// does, except only for a fixed number of transforms that we need.
|
||||
Matrix4x4
|
||||
RemapMatrixForOrientation(ScreenOrientation screenConfig, const Matrix4x4& aMatrix)
|
||||
RemapMatrixForOrientation(ScreenOrientationInternal screenConfig, const Matrix4x4& aMatrix)
|
||||
{
|
||||
Matrix4x4 out;
|
||||
const float *in = &aMatrix._11;
|
||||
|
||||
+1
-1
@@ -712,7 +712,7 @@ NotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration)
|
||||
}
|
||||
|
||||
bool
|
||||
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
|
||||
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
|
||||
{
|
||||
AssertMainThread();
|
||||
RETURN_PROXY_IF_SANDBOXED(LockScreenOrientation(aOrientation), false);
|
||||
|
||||
@@ -394,7 +394,7 @@ void NotifyScreenConfigurationChange(const hal::ScreenConfiguration& aScreenConf
|
||||
* Lock the screen orientation to the specific orientation.
|
||||
* @return Whether the lock has been accepted.
|
||||
*/
|
||||
bool LockScreenOrientation(const dom::ScreenOrientation& aOrientation);
|
||||
bool LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation);
|
||||
|
||||
/**
|
||||
* Unlock the screen orientation.
|
||||
|
||||
@@ -123,21 +123,23 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
||||
|
||||
nsIntRect rect;
|
||||
int32_t colorDepth, pixelDepth;
|
||||
ScreenOrientation orientation;
|
||||
int16_t angle;
|
||||
ScreenOrientationInternal orientation;
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
|
||||
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
|
||||
screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
|
||||
screen->GetColorDepth(&colorDepth);
|
||||
screen->GetPixelDepth(&pixelDepth);
|
||||
orientation = static_cast<ScreenOrientation>(bridge->GetScreenOrientation());
|
||||
orientation = static_cast<ScreenOrientationInternal>(bridge->GetScreenOrientation());
|
||||
angle = bridge->GetScreenAngle();
|
||||
|
||||
*aScreenConfiguration =
|
||||
hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
|
||||
hal::ScreenConfiguration(rect, orientation, angle, colorDepth, pixelDepth);
|
||||
}
|
||||
|
||||
bool
|
||||
LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||
LockScreenOrientation(const ScreenOrientationInternal& aOrientation)
|
||||
{
|
||||
switch (aOrientation) {
|
||||
// The Android backend only supports these orientations.
|
||||
|
||||
@@ -33,7 +33,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
|
||||
|
||||
nsIntRect rect;
|
||||
int32_t colorDepth, pixelDepth;
|
||||
dom::ScreenOrientation orientation;
|
||||
dom::ScreenOrientationInternal orientation;
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
|
||||
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
|
||||
@@ -45,11 +45,11 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
|
||||
: dom::eScreenOrientation_PortraitPrimary;
|
||||
|
||||
*aScreenConfiguration =
|
||||
hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
|
||||
hal::ScreenConfiguration(rect, orientation, 0, colorDepth, pixelDepth);
|
||||
}
|
||||
|
||||
bool
|
||||
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
|
||||
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -941,7 +941,7 @@ GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
|
||||
}
|
||||
|
||||
bool
|
||||
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
|
||||
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
|
||||
{
|
||||
return OrientationObserver::GetInstance()->LockScreenOrientation(aOrientation);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ include protocol PBrowser;
|
||||
|
||||
include "mozilla/GfxMessageUtils.h";
|
||||
|
||||
using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
|
||||
using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientation.h";
|
||||
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
|
||||
@@ -58,7 +58,8 @@ struct WakeLockInformation {
|
||||
|
||||
struct ScreenConfiguration {
|
||||
nsIntRect rect;
|
||||
ScreenOrientation orientation;
|
||||
ScreenOrientationInternal orientation;
|
||||
uint16_t angle;
|
||||
uint32_t colorDepth;
|
||||
uint32_t pixelDepth;
|
||||
};
|
||||
@@ -157,7 +158,7 @@ parent:
|
||||
DisableScreenConfigurationNotifications();
|
||||
prio(urgent) sync GetCurrentScreenConfiguration()
|
||||
returns (ScreenConfiguration aScreenConfiguration);
|
||||
sync LockScreenOrientation(ScreenOrientation aOrientation)
|
||||
sync LockScreenOrientation(ScreenOrientationInternal aOrientation)
|
||||
returns (bool allowed);
|
||||
UnlockScreenOrientation();
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
||||
}
|
||||
|
||||
bool
|
||||
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
|
||||
LockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation)
|
||||
{
|
||||
bool allowed;
|
||||
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
|
||||
@@ -592,7 +592,7 @@ public:
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvLockScreenOrientation(const dom::ScreenOrientation& aOrientation, bool* aAllowed) override
|
||||
RecvLockScreenOrientation(const dom::ScreenOrientationInternal& aOrientation, bool* aAllowed) override
|
||||
{
|
||||
// FIXME/bug 777980: unprivileged content may only lock
|
||||
// orientation while fullscreen. We should check whether the
|
||||
|
||||
@@ -12,8 +12,6 @@ ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
|
||||
$(error GNU Make $(make_min_ver) or higher is required)
|
||||
endif
|
||||
|
||||
run_for_side_effects := $(shell echo 'MAKE: $(MAKE)')
|
||||
|
||||
ifdef JS_HAS_CTYPES
|
||||
ifdef MOZ_NATIVE_FFI
|
||||
LOCAL_INCLUDES = $(MOZ_FFI_CFLAGS)
|
||||
|
||||
@@ -69,6 +69,14 @@ template <class TargetUnits, class SourceUnits>
|
||||
gfx::IntRectTyped<TargetUnits> ViewAs(const gfx::IntRectTyped<SourceUnits>& aRect, PixelCastJustification) {
|
||||
return gfx::IntRectTyped<TargetUnits>(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
template <class TargetUnits, class SourceUnits>
|
||||
gfx::MarginTyped<TargetUnits> ViewAs(const gfx::MarginTyped<SourceUnits>& aMargin, PixelCastJustification) {
|
||||
return gfx::MarginTyped<TargetUnits>(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left);
|
||||
}
|
||||
template <class TargetUnits, class SourceUnits>
|
||||
gfx::IntMarginTyped<TargetUnits> ViewAs(const gfx::IntMarginTyped<SourceUnits>& aMargin, PixelCastJustification) {
|
||||
return gfx::IntMarginTyped<TargetUnits>(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left);
|
||||
}
|
||||
template <class NewTargetUnits, class OldTargetUnits, class SourceUnits>
|
||||
gfx::ScaleFactor<SourceUnits, NewTargetUnits> ViewTargetAs(
|
||||
const gfx::ScaleFactor<SourceUnits, OldTargetUnits>& aScaleFactor,
|
||||
@@ -172,6 +180,34 @@ static Maybe<gfx::IntPointTyped<TargetUnits>> UntransformTo(const gfx::Matrix4x4
|
||||
}
|
||||
return Some(RoundedToInt(ViewAs<TargetUnits>(point.As2DPoint())));
|
||||
}
|
||||
|
||||
// The versions of UntransformTo() that take a rectangle also take a clip,
|
||||
// which represents the bounds within which the target must fall. The
|
||||
// result of the transform is intersected with this clip, and is considered
|
||||
// meaningful if the intersection is not empty.
|
||||
template <typename TargetUnits, typename SourceUnits>
|
||||
static Maybe<gfx::RectTyped<TargetUnits>> UntransformTo(const gfx::Matrix4x4& aTransform,
|
||||
const gfx::RectTyped<SourceUnits>& aRect,
|
||||
const gfx::RectTyped<TargetUnits>& aClip)
|
||||
{
|
||||
gfx::Rect rect = aTransform.ProjectRectBounds(aRect.ToUnknownRect(), aClip.ToUnknownRect());
|
||||
if (rect.IsEmpty()) {
|
||||
return Nothing();
|
||||
}
|
||||
return Some(ViewAs<TargetUnits>(rect));
|
||||
}
|
||||
template <typename TargetUnits, typename SourceUnits>
|
||||
static Maybe<gfx::IntRectTyped<TargetUnits>> UntransformTo(const gfx::Matrix4x4& aTransform,
|
||||
const gfx::IntRectTyped<SourceUnits>& aRect,
|
||||
const gfx::IntRectTyped<TargetUnits>& aClip)
|
||||
{
|
||||
gfx::Rect rect = aTransform.ProjectRectBounds(aRect.ToUnknownRect(), aClip.ToUnknownRect());
|
||||
if (rect.IsEmpty()) {
|
||||
return Nothing();
|
||||
}
|
||||
return Some(RoundedToInt(ViewAs<TargetUnits>(rect)));
|
||||
}
|
||||
|
||||
template <typename TargetUnits, typename SourceUnits>
|
||||
static Maybe<gfx::PointTyped<TargetUnits>> UntransformVector(const gfx::Matrix4x4& aTransform,
|
||||
const gfx::PointTyped<SourceUnits>& aVector,
|
||||
|
||||
@@ -15,6 +15,9 @@ LOCAL_INCLUDES += [
|
||||
'/layout/base'
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
# Workaround bug 1142396. Suppress the warning from gmock library for clang.
|
||||
if CONFIG['CLANG_CXX']:
|
||||
CXXFLAGS += ['-Wno-null-dereference']
|
||||
|
||||
@@ -41,6 +41,9 @@ if CONFIG['MOZ_XUL']:
|
||||
'inDOMView.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'../style',
|
||||
|
||||
@@ -62,3 +62,6 @@ if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android
|
||||
if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin':
|
||||
# The zone allocator for OSX needs some jemalloc internal functions
|
||||
LOCAL_INCLUDES += ['/memory/jemalloc/src/include']
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -45,5 +45,8 @@ LOCAL_INCLUDES += [
|
||||
# XXX: We should fix these warnings.
|
||||
ALLOW_COMPILER_WARNINGS = True
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
if CONFIG['_MSC_VER']:
|
||||
CFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163)
|
||||
|
||||
@@ -12,3 +12,6 @@ SOURCES += [
|
||||
SharedLibrary('replace_malloc')
|
||||
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -33,3 +33,6 @@ if CONFIG['_MSC_VER']:
|
||||
LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']
|
||||
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -8,6 +8,9 @@ SOURCES += [
|
||||
'AppProtocolHandler.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'/caps',
|
||||
|
||||
@@ -18,6 +18,9 @@ UNIFIED_SOURCES += [
|
||||
'nsDeviceProtocolHandler.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
@@ -15,6 +15,9 @@ UNIFIED_SOURCES += [
|
||||
'nsViewSourceHandler.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
LOCAL_INCLUDES += [
|
||||
'/netwerk/base',
|
||||
|
||||
@@ -21,4 +21,7 @@ UNIFIED_SOURCES += [
|
||||
'nsUDPSocketProvider.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
@@ -34,3 +34,6 @@ SOURCES += [
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -12,6 +12,9 @@ SOURCES += [
|
||||
'mozStorageModule.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
|
||||
@@ -18,5 +18,9 @@ UNIFIED_SOURCES += [
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Core', 'Video/Audio')
|
||||
|
||||
@@ -15,6 +15,9 @@ SOURCES += [
|
||||
'nsViewManager.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace {
|
||||
|
||||
struct OrientationMapping {
|
||||
uint32_t mScreenRotation;
|
||||
ScreenOrientation mDomOrientation;
|
||||
ScreenOrientationInternal mDomOrientation;
|
||||
};
|
||||
|
||||
static OrientationMapping sOrientationMappings[] = {
|
||||
@@ -106,7 +106,7 @@ DetectDefaultOrientation()
|
||||
* @return NS_OK on success. NS_ILLEGAL_VALUE on failure.
|
||||
*/
|
||||
static nsresult
|
||||
ConvertToScreenRotation(ScreenOrientation aOrientation, uint32_t *aResult)
|
||||
ConvertToScreenRotation(ScreenOrientationInternal aOrientation, uint32_t *aResult)
|
||||
{
|
||||
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
if (aOrientation & sOrientationMappings[i].mDomOrientation) {
|
||||
@@ -132,7 +132,7 @@ ConvertToScreenRotation(ScreenOrientation aOrientation, uint32_t *aResult)
|
||||
* @return NS_OK on success. NS_ILLEGAL_VALUE on failure.
|
||||
*/
|
||||
nsresult
|
||||
ConvertToDomOrientation(uint32_t aRotation, ScreenOrientation *aResult)
|
||||
ConvertToDomOrientation(uint32_t aRotation, ScreenOrientationInternal *aResult)
|
||||
{
|
||||
for (int i = 0; i < ArrayLength(sOrientationMappings); i++) {
|
||||
if (aRotation == sOrientationMappings[i].mScreenRotation) {
|
||||
@@ -217,7 +217,7 @@ OrientationObserver::Notify(const hal::SensorData& aSensorData)
|
||||
return;
|
||||
}
|
||||
|
||||
ScreenOrientation orientation;
|
||||
ScreenOrientationInternal orientation;
|
||||
if (NS_FAILED(ConvertToDomOrientation(rotation, &orientation))) {
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ OrientationObserver::DisableAutoOrientation()
|
||||
}
|
||||
|
||||
bool
|
||||
OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
|
||||
OrientationObserver::LockScreenOrientation(ScreenOrientationInternal aOrientation)
|
||||
{
|
||||
MOZ_ASSERT(aOrientation | (eScreenOrientation_PortraitPrimary |
|
||||
eScreenOrientation_PortraitSecondary |
|
||||
@@ -295,7 +295,7 @@ OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
|
||||
nsresult rv = screen->GetRotation(&currRotation);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
ScreenOrientation currOrientation = eScreenOrientation_None;
|
||||
ScreenOrientationInternal currOrientation = eScreenOrientation_None;
|
||||
rv = ConvertToDomOrientation(currRotation, &currOrientation);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
@@ -314,7 +314,7 @@ OrientationObserver::LockScreenOrientation(ScreenOrientation aOrientation)
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
// This conversion will disambiguate aOrientation.
|
||||
ScreenOrientation orientation;
|
||||
ScreenOrientationInternal orientation;
|
||||
rv = ConvertToDomOrientation(rotation, &orientation);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef mozilla::Observer<SensorData> ISensorObserver;
|
||||
|
||||
using mozilla::hal::ISensorObserver;
|
||||
using mozilla::hal::SensorData;
|
||||
using mozilla::dom::ScreenOrientation;
|
||||
using mozilla::dom::ScreenOrientationInternal;
|
||||
|
||||
class OrientationObserver : public ISensorObserver {
|
||||
public:
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
void DisableAutoOrientation();
|
||||
|
||||
// Methods called by methods in hal_impl namespace.
|
||||
bool LockScreenOrientation(ScreenOrientation aOrientation);
|
||||
bool LockScreenOrientation(ScreenOrientationInternal aOrientation);
|
||||
void UnlockScreenOrientation();
|
||||
|
||||
static OrientationObserver* GetInstance();
|
||||
|
||||
@@ -293,7 +293,7 @@ nsScreenGonk::EffectiveScreenRotation()
|
||||
|
||||
// NB: This isn't gonk-specific, but gonk is the only widget backend
|
||||
// that does this calculation itself, currently.
|
||||
static ScreenOrientation
|
||||
static ScreenOrientationInternal
|
||||
ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
|
||||
{
|
||||
bool naturallyPortrait = (aScreenSize.height > aScreenSize.width);
|
||||
@@ -317,15 +317,24 @@ ComputeOrientation(uint32_t aRotation, const nsIntSize& aScreenSize)
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
RotationToAngle(uint32_t aRotation)
|
||||
{
|
||||
uint16_t angle = 90 * aRotation;
|
||||
MOZ_ASSERT(angle == 0 || angle == 90 || angle == 180 || angle == 270);
|
||||
return angle;
|
||||
}
|
||||
|
||||
ScreenConfiguration
|
||||
nsScreenGonk::GetConfiguration()
|
||||
{
|
||||
ScreenOrientation orientation = ComputeOrientation(mScreenRotation,
|
||||
mNaturalBounds.Size());
|
||||
ScreenOrientationInternal orientation = ComputeOrientation(mScreenRotation,
|
||||
mNaturalBounds.Size());
|
||||
|
||||
// NB: perpetuating colorDepth == pixelDepth illusion here, for
|
||||
// consistency.
|
||||
return ScreenConfiguration(mVirtualBounds, orientation,
|
||||
RotationToAngle(mScreenRotation),
|
||||
mColorDepth, mColorDepth);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,3 +17,6 @@ FINAL_LIBRARY = 'xul'
|
||||
DEFINES['_IMPL_GTKXTBIN_API'] = True
|
||||
|
||||
CFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -12,5 +12,8 @@ FINAL_LIBRARY = 'xul'
|
||||
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
|
||||
if CONFIG['MOZ_X11']:
|
||||
CFLAGS += CONFIG['XCFLAGS']
|
||||
|
||||
@@ -144,13 +144,13 @@ public:
|
||||
do { \
|
||||
size_t amount = _amount; /* evaluate _amount only once */ \
|
||||
if (amount > 0) { \
|
||||
nsresult rv; \
|
||||
rv = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path, \
|
||||
nsresult rvReport; \
|
||||
rvReport = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path, \
|
||||
KIND_NONHEAP, _units, amount, _desc, \
|
||||
aData); \
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { \
|
||||
if (NS_WARN_IF(NS_FAILED(rvReport))) { \
|
||||
_cleanup; \
|
||||
return rv; \
|
||||
return rvReport; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -373,14 +373,15 @@ private:
|
||||
char devMinor[17];
|
||||
unsigned int inode;
|
||||
char line[1025];
|
||||
|
||||
// This variable holds the path of the current entry, or is void
|
||||
// if we're scanning for the start of a new entry.
|
||||
nsAutoCString path;
|
||||
nsAutoCString currentPath;
|
||||
int pathOffset;
|
||||
|
||||
path.SetIsVoid(true);
|
||||
currentPath.SetIsVoid(true);
|
||||
while (fgets(line, sizeof(line), aFile)) {
|
||||
if (path.IsVoid()) {
|
||||
if (currentPath.IsVoid()) {
|
||||
int n = sscanf(line,
|
||||
"%llx-%llx %4s %llx "
|
||||
"%16[0-9a-fA-F]:%16[0-9a-fA-F] %u %n",
|
||||
@@ -388,8 +389,8 @@ private:
|
||||
devMinor, &inode, &pathOffset);
|
||||
|
||||
if (n >= argCount - 1) {
|
||||
path.Assign(line + pathOffset);
|
||||
path.StripChars("\n");
|
||||
currentPath.Assign(line + pathOffset);
|
||||
currentPath.StripChars("\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -404,14 +405,14 @@ private:
|
||||
size_t pss = pss_kb * 1024;
|
||||
if (pss > 0) {
|
||||
nsAutoCString name, description, tag;
|
||||
GetReporterNameAndDescription(path.get(), perms, name, description, tag);
|
||||
GetReporterNameAndDescription(currentPath.get(), perms, name, description, tag);
|
||||
|
||||
nsAutoCString path("mem/processes/");
|
||||
path.Append(aProcessName);
|
||||
path.Append('/');
|
||||
path.Append(name);
|
||||
nsAutoCString processMemPath("mem/processes/");
|
||||
processMemPath.Append(aProcessName);
|
||||
processMemPath.Append('/');
|
||||
processMemPath.Append(name);
|
||||
|
||||
REPORT(path, pss, description);
|
||||
REPORT(processMemPath, pss, description);
|
||||
|
||||
// Increment the appropriate aProcessSizes values, and the total.
|
||||
aProcessSizes->Add(tag, pss);
|
||||
@@ -419,7 +420,7 @@ private:
|
||||
}
|
||||
|
||||
// Now that we've seen the PSS, we're done with this entry.
|
||||
path.SetIsVoid(true);
|
||||
currentPath.SetIsVoid(true);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -153,3 +153,6 @@ LOCAL_INCLUDES += [
|
||||
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['TK_CFLAGS']
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -78,9 +78,9 @@ NS_STATUS_REPORTER_IMPLEMENT(StatusReporter, "StatusReporter State", getStatus)
|
||||
do { \
|
||||
const char* s2 = (s); \
|
||||
uint32_t dummy; \
|
||||
nsresult rv = (o)->Write((s2), strlen(s2), &dummy); \
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) \
|
||||
return rv; \
|
||||
nsresult rvDump = (o)->Write((s2), strlen(s2), &dummy); \
|
||||
if (NS_WARN_IF(NS_FAILED(rvDump))) \
|
||||
return rvDump; \
|
||||
} while (0)
|
||||
|
||||
static nsresult
|
||||
|
||||
@@ -68,6 +68,10 @@ SOURCES += [
|
||||
'Omnijar.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
@@ -39,6 +39,9 @@ UNIFIED_SOURCES += [
|
||||
'nsNativeModuleLoader.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
GENERATED_INCLUDES += ['..']
|
||||
|
||||
@@ -100,3 +100,6 @@ LOCAL_INCLUDES += [
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -1016,9 +1016,9 @@ nsDiscriminatedUnion::ConvertToStringWithSize(uint32_t* aSize, char** aStr) cons
|
||||
// *aSize = *mUTF8StringValue->Length();
|
||||
// *aStr = ToNewCString(*mUTF8StringValue);
|
||||
// But this will have to do for now.
|
||||
NS_ConvertUTF8toUTF16 tempString(*u.mUTF8StringValue);
|
||||
*aSize = tempString.Length();
|
||||
*aStr = ToNewCString(tempString);
|
||||
const NS_ConvertUTF8toUTF16 tempString16(*u.mUTF8StringValue);
|
||||
*aSize = tempString16.Length();
|
||||
*aStr = ToNewCString(tempString16);
|
||||
break;
|
||||
}
|
||||
case nsIDataType::VTYPE_CHAR_STR: {
|
||||
|
||||
@@ -50,17 +50,17 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
|
||||
const char* aLoaderStr,
|
||||
const char* aType)
|
||||
{
|
||||
nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(aCompMgr);
|
||||
for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
|
||||
r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
|
||||
aLoaderStr, aType);
|
||||
registrar->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
|
||||
aLoaderStr, aType);
|
||||
}
|
||||
|
||||
for (const Module::ContractIDEntry* e = mData->mContractIDs;
|
||||
e && e->contractid;
|
||||
++e) {
|
||||
r->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
|
||||
aLoaderStr, aType);
|
||||
registrar->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
|
||||
aLoaderStr, aType);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsICategoryManager> catman;
|
||||
@@ -71,9 +71,9 @@ GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
|
||||
catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
|
||||
}
|
||||
|
||||
nsAutoCString r;
|
||||
nsAutoCString prevValue;
|
||||
catman->AddCategoryEntry(e->category, e->entry, e->value, true, true,
|
||||
getter_Copies(r));
|
||||
getter_Copies(prevValue));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -120,3 +120,6 @@ USE_LIBS += [
|
||||
NO_EXPAND_LIBS = True
|
||||
|
||||
DIST_INSTALL = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
@@ -278,19 +278,19 @@ NS_IsAsciiDigit(char16_t aChar)
|
||||
return aChar >= '0' && aChar <= '9';
|
||||
}
|
||||
|
||||
|
||||
#ifndef XPCOM_GLUE_AVOID_NSPR
|
||||
#define TABLE_SIZE 36
|
||||
static const char table[] = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9'
|
||||
};
|
||||
|
||||
void
|
||||
NS_MakeRandomString(char* aBuf, int32_t aBufLen)
|
||||
{
|
||||
#define TABLE_SIZE 36
|
||||
static const char table[] = {
|
||||
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9'
|
||||
};
|
||||
|
||||
// turn PR_Now() into milliseconds since epoch
|
||||
// and salt rand with that.
|
||||
static unsigned int seed = 0;
|
||||
@@ -435,5 +435,3 @@ fprintf_stderr(FILE* aFile, const char* aFmt, ...)
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -284,8 +284,8 @@ nsTArray_base<Alloc, Copy>::ShiftData(index_type aStart,
|
||||
aStart *= aElemSize;
|
||||
aNewLen *= aElemSize;
|
||||
aOldLen *= aElemSize;
|
||||
char* base = reinterpret_cast<char*>(mHdr + 1) + aStart;
|
||||
Copy::MoveElements(base + aNewLen, base + aOldLen, num, aElemSize);
|
||||
char* baseAddr = reinterpret_cast<char*>(mHdr + 1) + aStart;
|
||||
Copy::MoveElements(baseAddr + aNewLen, baseAddr + aOldLen, num, aElemSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ LOCAL_INCLUDES += [
|
||||
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
# Include fallible for third party code using the xpcom glue
|
||||
USE_LIBS += [
|
||||
'fallible',
|
||||
|
||||
@@ -38,6 +38,9 @@ USE_STATIC_LIBS = True
|
||||
# Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
|
||||
DISABLE_STL_WRAPPING = True
|
||||
|
||||
if CONFIG['GNU_CXX']:
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
# Include fallible for third party code using the xpcom glue
|
||||
USE_LIBS += [
|
||||
'fallible',
|
||||
|
||||
@@ -289,20 +289,20 @@ TEST(ThreadUtils, main)
|
||||
|
||||
// Test legacy functions.
|
||||
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
nsCOMPtr<nsIRunnable> r1 =
|
||||
NS_NewRunnableMethod(rpt, &ThreadUtilsObject::Test0);
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 1, rpt->mCount);
|
||||
|
||||
r = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(11, rpt->mA0);
|
||||
|
||||
// Test variadic function with simple POD arguments.
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 1, rpt->mCount);
|
||||
|
||||
static_assert(
|
||||
@@ -314,29 +314,29 @@ TEST(ThreadUtils, main)
|
||||
StoreCopyPassByValue<int>>::value,
|
||||
"detail::ParameterStorage<StoreCopyPassByValue<int>>::Type should be StoreCopyPassByValue<int>");
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(12, rpt->mA0);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int>(
|
||||
rpt, &ThreadUtilsObject::Test2i, 21, 22);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int>(
|
||||
rpt, &ThreadUtilsObject::Test2i, 21, 22);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 3, rpt->mCount);
|
||||
EXPECT_EQ(21, rpt->mA0);
|
||||
EXPECT_EQ(22, rpt->mA1);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 4, rpt->mCount);
|
||||
EXPECT_EQ(31, rpt->mA0);
|
||||
EXPECT_EQ(32, rpt->mA1);
|
||||
EXPECT_EQ(33, rpt->mA2);
|
||||
|
||||
r = NS_NewRunnableMethodWithArgs<int, int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int, int, int, int>(
|
||||
rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 5, rpt->mCount);
|
||||
EXPECT_EQ(41, rpt->mA0);
|
||||
EXPECT_EQ(42, rpt->mA1);
|
||||
@@ -347,8 +347,8 @@ TEST(ThreadUtils, main)
|
||||
|
||||
// Passing a short to make sure forwarding works with an inexact type match.
|
||||
short int si = 11;
|
||||
r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(si, rpt->mA0);
|
||||
|
||||
@@ -373,8 +373,8 @@ TEST(ThreadUtils, main)
|
||||
"detail::ParameterStorage<int*>::Type::passed_type should be int*");
|
||||
{
|
||||
int i = 12;
|
||||
r = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
@@ -400,8 +400,8 @@ TEST(ThreadUtils, main)
|
||||
"detail::ParameterStorage<const int*>::Type::passed_type should be const int*");
|
||||
{
|
||||
int i = 1201;
|
||||
r = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
@@ -415,9 +415,9 @@ TEST(ThreadUtils, main)
|
||||
"StoreCopyPassByPtr<int>::passed_type should be int*");
|
||||
{
|
||||
int i = 1202;
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pi, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pi, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
@@ -431,9 +431,9 @@ TEST(ThreadUtils, main)
|
||||
"StoreCopyPassByConstPtr<int>::passed_type should be const int*");
|
||||
{
|
||||
int i = 1203;
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pci, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
|
||||
rpt, &ThreadUtilsObject::Test1pci, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
@@ -491,8 +491,8 @@ TEST(ThreadUtils, main)
|
||||
"ParameterStorage<int&>::Type::passed_type should be int&");
|
||||
{
|
||||
int i = 13;
|
||||
r = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(i, rpt->mA0);
|
||||
}
|
||||
@@ -512,10 +512,10 @@ TEST(ThreadUtils, main)
|
||||
"ParameterStorage<int&&>::Type::passed_type should be int&&");
|
||||
{
|
||||
int i = 14;
|
||||
r = NS_NewRunnableMethodWithArgs<int&&>(
|
||||
r1 = NS_NewRunnableMethodWithArgs<int&&>(
|
||||
rpt, &ThreadUtilsObject::Test1rri, mozilla::Move(i));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(14, rpt->mA0);
|
||||
|
||||
@@ -534,10 +534,10 @@ TEST(ThreadUtils, main)
|
||||
"ParameterStorage<UniquePtr<int>&&>::Type::passed_type should be UniquePtr<int>&&");
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
rpt->mA0 = 0;
|
||||
@@ -557,48 +557,48 @@ TEST(ThreadUtils, main)
|
||||
"ParameterStorage<StoreCopyPassByRRef<UniquePtr<int>>>::Type::passed_type should be UniquePtr<int>&&");
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
|
||||
// Unique pointer as xvalue.
|
||||
{
|
||||
mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(1, rpt->mA0);
|
||||
|
||||
{
|
||||
mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
|
||||
r = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
|
||||
(rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
r1 = NS_NewRunnableMethodWithArgs
|
||||
<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
|
||||
(rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
|
||||
}
|
||||
r->Run();
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(1, rpt->mA0);
|
||||
|
||||
// Unique pointer as prvalue.
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
|
||||
r->Run();
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
|
||||
rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
|
||||
r1->Run();
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(2, rpt->mA0);
|
||||
|
||||
// Unique pointer as lvalue to lref.
|
||||
{
|
||||
mozilla::UniquePtr<int> upi;
|
||||
r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
|
||||
rpt, &ThreadUtilsObject::Test1rupi, upi);
|
||||
r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
|
||||
rpt, &ThreadUtilsObject::Test1rupi, upi);
|
||||
// Passed as lref, so Run() must be called while local upi is still alive!
|
||||
r->Run();
|
||||
r1->Run();
|
||||
}
|
||||
EXPECT_EQ(count += 2, rpt->mCount);
|
||||
EXPECT_EQ(-1, rpt->mA0);
|
||||
@@ -608,15 +608,15 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by value\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r2;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(10)\n", __LINE__); }
|
||||
Spy s(10);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, s);
|
||||
if (gDebug) { printf("%d - r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
|
||||
r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
@@ -626,7 +626,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r2->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(10, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
@@ -641,8 +641,8 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by value\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r3 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r3 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, Spy(11));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
@@ -650,7 +650,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r3->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(11, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
@@ -664,13 +664,13 @@ TEST(ThreadUtils, main)
|
||||
|
||||
Spy::ClearAll();
|
||||
{ // Store copy from xvalue, pass by value.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r4;
|
||||
{
|
||||
Spy s(12);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
r4 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByValue, mozilla::Move(s));
|
||||
EXPECT_LE(1, gMoveConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
@@ -681,7 +681,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
EXPECT_EQ(0, gZombies);
|
||||
Spy::ClearActions();
|
||||
r->Run();
|
||||
r4->Run();
|
||||
EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
|
||||
EXPECT_EQ(12, rpt->mSpy.mID);
|
||||
EXPECT_LE(1, gDestructions);
|
||||
@@ -695,15 +695,15 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by const lvalue ref\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r5;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(20)\n", __LINE__); }
|
||||
Spy s(20);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, s);
|
||||
if (gDebug) { printf("%d - r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
|
||||
r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
@@ -713,7 +713,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r5->Run();
|
||||
EXPECT_EQ(0, gCopyConstructions); // No copies in call.
|
||||
EXPECT_EQ(20, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
@@ -728,8 +728,8 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by const lvalue ref\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r6 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r6 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByConstLRef, Spy(21));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
@@ -737,7 +737,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r6->Run();
|
||||
EXPECT_EQ(0, gCopyConstructions); // No copies in call.
|
||||
EXPECT_EQ(21, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
@@ -752,15 +752,15 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by rvalue ref\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r7;
|
||||
{ // Block around Spy lifetime.
|
||||
if (gDebug) { printf("%d - Spy s(30)\n", __LINE__); }
|
||||
Spy s(30);
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, s);
|
||||
if (gDebug) { printf("%d - r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
|
||||
r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, s);
|
||||
EXPECT_EQ(2, gAlive);
|
||||
EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
|
||||
Spy::ClearActions();
|
||||
@@ -770,7 +770,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r7->Run();
|
||||
EXPECT_LE(1, gMoves); // Move in call.
|
||||
EXPECT_EQ(30, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
@@ -786,8 +786,8 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by rvalue ref\n", __LINE__); }
|
||||
{
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r8 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r8 =
|
||||
NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
|
||||
rpt, &ThreadUtilsObject::TestByRRef, Spy(31));
|
||||
EXPECT_EQ(1, gAlive);
|
||||
@@ -795,7 +795,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_LE(1, gMoveConstructions);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r8->Run();
|
||||
EXPECT_LE(1, gMoves); // Move in call.
|
||||
EXPECT_EQ(31, rpt->mSpy.mID);
|
||||
EXPECT_EQ(0, gDestructions);
|
||||
@@ -816,8 +816,8 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r9 = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r9 =
|
||||
NS_NewRunnableMethodWithArgs<Spy&>(
|
||||
rpt, &ThreadUtilsObject::TestByLRef, s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
@@ -825,7 +825,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r9->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from reference in call.
|
||||
EXPECT_EQ(40, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
@@ -841,7 +841,7 @@ TEST(ThreadUtils, main)
|
||||
Spy::ClearAll();
|
||||
if (gDebug) { printf("%d - Test: Store nsRefPtr, pass by pointer\n", __LINE__); }
|
||||
{ // Block around nsCOMPtr lifetime.
|
||||
nsCOMPtr<nsIRunnable> r;
|
||||
nsCOMPtr<nsIRunnable> r10;
|
||||
SpyWithISupports* ptr = 0;
|
||||
{ // Block around nsRefPtr<Spy> lifetime.
|
||||
if (gDebug) { printf("%d - nsRefPtr<SpyWithISupports> s(new SpyWithISupports(45))\n", __LINE__); }
|
||||
@@ -849,9 +849,9 @@ TEST(ThreadUtils, main)
|
||||
ptr = s.get();
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
|
||||
r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, s.get());
|
||||
if (gDebug) { printf("%d - r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
|
||||
r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, s.get());
|
||||
EXPECT_LE(0, gAllConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
@@ -861,7 +861,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r10->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(45, rpt->mSpy.mID);
|
||||
EXPECT_EQ(ptr, rpt->mSpyPtr);
|
||||
@@ -882,8 +882,8 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r11 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r11 =
|
||||
NS_NewRunnableMethodWithArgs<Spy*>(
|
||||
rpt, &ThreadUtilsObject::TestByPointer, &s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
@@ -891,7 +891,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r11->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(55, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
@@ -912,8 +912,8 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gConstructions);
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
if (gDebug) { printf("%d - r12 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
|
||||
nsCOMPtr<nsIRunnable> r12 =
|
||||
NS_NewRunnableMethodWithArgs<const Spy*>(
|
||||
rpt, &ThreadUtilsObject::TestByPointerToConst, &s);
|
||||
EXPECT_EQ(0, gAllConstructions);
|
||||
@@ -921,7 +921,7 @@ TEST(ThreadUtils, main)
|
||||
EXPECT_EQ(1, gAlive);
|
||||
Spy::ClearActions();
|
||||
if (gDebug) { printf("%d - Run()\n", __LINE__); }
|
||||
r->Run();
|
||||
r12->Run();
|
||||
EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
|
||||
EXPECT_EQ(60, rpt->mSpy.mID);
|
||||
EXPECT_EQ(&s, rpt->mSpyPtr);
|
||||
|
||||
@@ -123,6 +123,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
'CocoaFileUtils.mm',
|
||||
]
|
||||
|
||||
if CONFIG['GNU_CC']:
|
||||
CFLAGS += ['-Wshadow']
|
||||
CXXFLAGS += ['-Wshadow']
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
+20
-22
@@ -12,7 +12,8 @@
|
||||
#include "nsCRT.h"
|
||||
#include "plstr.h"
|
||||
|
||||
static const char hexChars[] = "0123456789ABCDEF";
|
||||
static const char hexCharsUpper[] = "0123456789ABCDEF";
|
||||
static const char hexCharsUpperLower[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
static const int netCharType[256] =
|
||||
/* Bit 0 xalpha -- the alphas
|
||||
@@ -51,8 +52,8 @@ AppendPercentHex(char* aBuffer, unsigned char aChar)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
aBuffer[i++] = '%';
|
||||
aBuffer[i++] = hexChars[aChar >> 4]; // high nibble
|
||||
aBuffer[i++] = hexChars[aChar & 0xF]; // low nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar >> 4]; // high nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low nibble
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -63,11 +64,11 @@ AppendPercentHex(char16_t* aBuffer, char16_t aChar)
|
||||
aBuffer[i++] = '%';
|
||||
if (aChar & 0xff00) {
|
||||
aBuffer[i++] = 'u';
|
||||
aBuffer[i++] = hexChars[aChar >> 12]; // high-byte high nibble
|
||||
aBuffer[i++] = hexChars[(aChar >> 8) & 0xF]; // high-byte low nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar >> 12]; // high-byte high nibble
|
||||
aBuffer[i++] = hexCharsUpper[(aChar >> 8) & 0xF]; // high-byte low nibble
|
||||
}
|
||||
aBuffer[i++] = hexChars[(aChar >> 4) & 0xF]; // low-byte high nibble
|
||||
aBuffer[i++] = hexChars[aChar & 0xF]; // low-byte low nibble
|
||||
aBuffer[i++] = hexCharsUpper[(aChar >> 4) & 0xF]; // low-byte high nibble
|
||||
aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low-byte low nibble
|
||||
return i;
|
||||
}
|
||||
|
||||
@@ -127,8 +128,8 @@ nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
|
||||
*dst++ = '+'; /* convert spaces to pluses */
|
||||
} else {
|
||||
*dst++ = HEX_ESCAPE;
|
||||
*dst++ = hexChars[c >> 4]; /* high nibble */
|
||||
*dst++ = hexChars[c & 0x0f]; /* low nibble */
|
||||
*dst++ = hexCharsUpper[c >> 4]; /* high nibble */
|
||||
*dst++ = hexCharsUpper[c & 0x0f]; /* low nibble */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -138,8 +139,8 @@ nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
|
||||
*dst++ = c;
|
||||
} else {
|
||||
*dst++ = HEX_ESCAPE;
|
||||
*dst++ = hexChars[c >> 4]; /* high nibble */
|
||||
*dst++ = hexChars[c & 0x0f]; /* low nibble */
|
||||
*dst++ = hexCharsUpper[c >> 4]; /* high nibble */
|
||||
*dst++ = hexCharsUpper[c & 0x0f]; /* low nibble */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +179,6 @@ nsUnescapeCount(char* aStr)
|
||||
{
|
||||
char* src = aStr;
|
||||
char* dst = aStr;
|
||||
static const char hexChars[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
char c1[] = " ";
|
||||
char c2[] = " ";
|
||||
@@ -200,8 +200,8 @@ nsUnescapeCount(char* aStr)
|
||||
c2[0] = *(src + 2);
|
||||
}
|
||||
|
||||
if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexChars) == 0 ||
|
||||
PL_strpbrk(pc2, hexChars) == 0) {
|
||||
if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexCharsUpperLower) == 0 ||
|
||||
PL_strpbrk(pc2, hexCharsUpperLower) == 0) {
|
||||
*dst++ = *src++;
|
||||
} else {
|
||||
src++; /* walk over escape */
|
||||
@@ -501,7 +501,7 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
||||
nsSubstring& aResult)
|
||||
{
|
||||
bool didEscape = false;
|
||||
for (size_t i = 0, len = aStr.Length(); i < len; ) {
|
||||
for (size_t i = 0, strLen = aStr.Length(); i < strLen; ) {
|
||||
size_t j;
|
||||
if (MOZ_UNLIKELY(FindFirstMatchFrom(aStr, i, aForbidden, &j))) {
|
||||
if (i == 0) {
|
||||
@@ -514,14 +514,14 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
||||
aResult.Append(nsDependentSubstring(aStr, i, j - i));
|
||||
}
|
||||
char16_t buffer[ENCODE_MAX_LEN];
|
||||
uint32_t len = ::AppendPercentHex(buffer, aStr[j]);
|
||||
MOZ_ASSERT(len <= ENCODE_MAX_LEN, "buffer overflow");
|
||||
aResult.Append(buffer, len);
|
||||
uint32_t bufferLen = ::AppendPercentHex(buffer, aStr[j]);
|
||||
MOZ_ASSERT(bufferLen <= ENCODE_MAX_LEN, "buffer overflow");
|
||||
aResult.Append(buffer, bufferLen);
|
||||
i = j + 1;
|
||||
} else {
|
||||
if (MOZ_UNLIKELY(didEscape)) {
|
||||
// The tail of the string that needs no escaping.
|
||||
aResult.Append(nsDependentSubstring(aStr, i, len - i));
|
||||
aResult.Append(nsDependentSubstring(aStr, i, strLen - i));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -532,7 +532,7 @@ NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
|
||||
return aStr;
|
||||
}
|
||||
|
||||
#define ISHEX(c) memchr(hexChars, c, sizeof(hexChars)-1)
|
||||
#define ISHEX(c) memchr(hexCharsUpperLower, c, sizeof(hexCharsUpperLower)-1)
|
||||
|
||||
bool
|
||||
NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
|
||||
@@ -552,8 +552,6 @@ NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
|
||||
bool writing = !!(aFlags & esc_AlwaysCopy);
|
||||
bool skipControl = !!(aFlags & esc_SkipControl);
|
||||
|
||||
static const char hexChars[] = "0123456789ABCDEFabcdef";
|
||||
|
||||
const char* last = aStr;
|
||||
const char* p = aStr;
|
||||
|
||||
|
||||
@@ -138,9 +138,9 @@ nsLocalFile::CreateUnique(uint32_t aType, uint32_t aAttributes)
|
||||
rootName.SetLength(maxRootLength);
|
||||
SetNativeLeafName(rootName + suffix);
|
||||
#endif
|
||||
nsresult rv = Create(aType, aAttributes);
|
||||
if (rv != NS_ERROR_FILE_ALREADY_EXISTS) {
|
||||
return rv;
|
||||
nsresult rvCreate = Create(aType, aAttributes);
|
||||
if (rvCreate != NS_ERROR_FILE_ALREADY_EXISTS) {
|
||||
return rvCreate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user