Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2014-03-06 13:38:06 +01:00
Родитель 70bb44df53 3e4f189d9b
Коммит 6e65028ef4
131 изменённых файлов: 8577 добавлений и 6846 удалений

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

@ -7,11 +7,9 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "DocAccessible-inl.h"
#include "HTMLImageMapAccessible.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsEventShell.h"
#include "nsImageFrame.h"
#include "Role.h"
#include "nsEventStateManager.h"
@ -39,7 +37,7 @@ FocusManager::FocusedAccessible() const
if (focusedNode) {
DocAccessible* doc =
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
return doc ? GetFocusableAccessibleFor(focusedNode, doc) : nullptr;
return doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr;
}
return nullptr;
@ -63,7 +61,7 @@ FocusManager::IsFocused(const Accessible* aAccessible) const
DocAccessible* doc =
GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
return aAccessible ==
(doc ? GetFocusableAccessibleFor(focusedNode, doc) : nullptr);
(doc ? doc->GetAccessibleEvenIfNotInMapOrContainer(focusedNode) : nullptr);
}
}
return false;
@ -243,7 +241,7 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
DocAccessible* document =
GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
Accessible* target = GetFocusableAccessibleFor(aTarget, document);
Accessible* target = document->GetAccessibleEvenIfNotInMapOrContainer(aTarget);
if (target && document) {
// Check if still focused. Otherwise we can end up with storing the active
// item for control that isn't focused anymore.
@ -251,7 +249,8 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
if (!focusedNode)
return;
Accessible* DOMFocus = GetFocusableAccessibleFor(focusedNode, document);
Accessible* DOMFocus =
document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode);
if (target != DOMFocus)
return;
@ -283,7 +282,8 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
if (!focusedNode)
return;
Accessible* DOMFocus = GetFocusableAccessibleFor(focusedNode, document);
Accessible* DOMFocus =
document->GetAccessibleEvenIfNotInMapOrContainer(focusedNode);
if (target != DOMFocus)
return;
@ -408,28 +408,3 @@ FocusManager::FocusedDOMDocument() const
nsINode* focusedNode = FocusedDOMNode();
return focusedNode ? focusedNode->OwnerDoc() : nullptr;
}
Accessible*
FocusManager::GetFocusableAccessibleFor(nsINode* aNode,
DocAccessible* aDoc) const
{
if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
return aDoc->GetAccessibleOrContainer(aNode);
// XXX Bug 135040, incorrect when multiple images use the same map.
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
nsImageFrame* imageFrame = do_QueryFrame(frame);
if (imageFrame) {
Accessible* parent = aDoc->GetAccessible(imageFrame->GetContent());
if (parent) {
Accessible* area =
parent->AsImageMap()->GetChildAccessibleFor(aNode);
if (area)
return area;
return nullptr;
}
}
return aDoc->GetAccessibleOrContainer(aNode);
}

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

@ -123,12 +123,6 @@ private:
*/
nsIDocument* FocusedDOMDocument() const;
/**
* Return accessible for a focusable node.
*/
Accessible* GetFocusableAccessibleFor(nsINode* aNode,
DocAccessible* aDoc) const;
private:
nsRefPtr<Accessible> mActiveItem;
nsRefPtr<Accessible> mActiveARIAMenubar;

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

@ -116,6 +116,13 @@ DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
}
inline Accessible*
DocAccessible::GetAccessibleEvenIfNotInMapOrContainer(nsINode* aNode) const
{
Accessible* acc = GetAccessibleEvenIfNotInMap(aNode);
return acc ? acc : GetContainerAccessible(aNode);
}
} // namespace a11y
} // namespace mozilla

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

@ -6,6 +6,7 @@
#include "Accessible-inl.h"
#include "AccIterator.h"
#include "DocAccessible-inl.h"
#include "HTMLImageMapAccessible.h"
#include "nsAccCache.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
@ -30,6 +31,7 @@
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsImageFrame.h"
#include "nsIPersistentProperties2.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
@ -1435,6 +1437,30 @@ DocAccessible::ProcessInvalidationList()
mInvalidationList.Clear();
}
Accessible*
DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const
{
if (!aNode->IsContent() || !aNode->AsContent()->IsHTML(nsGkAtoms::area))
return GetAccessible(aNode);
// XXX Bug 135040, incorrect when multiple images use the same map.
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
nsImageFrame* imageFrame = do_QueryFrame(frame);
if (imageFrame) {
Accessible* parent = GetAccessible(imageFrame->GetContent());
if (parent) {
Accessible* area =
parent->AsImageMap()->GetChildAccessibleFor(aNode);
if (area)
return area;
return nullptr;
}
}
return GetAccessible(aNode);
}
////////////////////////////////////////////////////////////////////////////////
// Accessible protected

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

@ -211,6 +211,15 @@ public:
*/
Accessible* GetAccessible(nsINode* aNode) const;
/**
* Return an accessible for the given node even if the node is not in
* document's node map cache (like HTML area element).
*
* XXX: it should be really merged with GetAccessible().
*/
Accessible* GetAccessibleEvenIfNotInMap(nsINode* aNode) const;
Accessible* GetAccessibleEvenIfNotInMapOrContainer(nsINode* aNode) const;
/**
* Return whether the given DOM node has an accessible or not.
*/

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

@ -40,6 +40,7 @@ if CONFIG['MOZ_ENABLE_GTK']:
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'../windows/ia2',
'../windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':

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

@ -25,7 +25,7 @@ inline Accessible*
sdnAccessible::GetAccessible() const
{
DocAccessible* document = GetDocument();
return document ? document->GetAccessible(mNode) : nullptr;
return document ? document->GetAccessibleEvenIfNotInMap(mNode) : nullptr;
}
} // namespace a11y

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
@ -97,7 +97,7 @@
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
<!-- Emulator specific things -->
<project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
<project name="android-development" path="development" remote="b2g" revision="9abf0ab68376afae3e1c7beefa3e9cbee2fde202"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="e7e8734fdd8bf41e48a56c1c85e0f7dac60aaa9f"/>
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
<project name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="d2685281e2e54ca14d1df304867aa82c37b27162"/>

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

@ -17,12 +17,12 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
@ -97,7 +97,7 @@
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
<!-- Emulator specific things -->
<project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
<project name="android-development" path="development" remote="b2g" revision="9abf0ab68376afae3e1c7beefa3e9cbee2fde202"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="e7e8734fdd8bf41e48a56c1c85e0f7dac60aaa9f"/>
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
<project name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="d2685281e2e54ca14d1df304867aa82c37b27162"/>

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

@ -4,6 +4,6 @@
"branch": "",
"revision": ""
},
"revision": "5d470e57a89125a55663058050b2cd147630a948",
"revision": "67e75b4310bc04e26b0e065aa16b71a21b456705",
"repo_path": "/integration/gaia-central"
}

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

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

@ -17,12 +17,12 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b2f773d8320d30648b89767dfe5b25ef94bc7e62"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>

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

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9cb35e701df44766d9b3560b0defe0a401a0ecdd"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d68074a17d9510623ae4dd3b9f50902af2b36dab"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="15e8982284c4560f9c74c2b9fe8bb361ebfe0cb6"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

54
build/docs/cppeclipse.rst Normal file
Просмотреть файл

@ -0,0 +1,54 @@
.. _build_cppeclipse:
=====================
Cpp Eclipse Projects
=====================
For additional information on using Eclipse CDT see
`the MDN page
<https://developer.mozilla.org/en-US/docs/Eclipse_CDT>`_.
The build system contains alpha support for generating C++ Eclipse
project files to aid with development.
Please report bugs to bugzilla and make them depend on bug 973770.
To generate a C++ Eclipse project files, you'll need to have a fully
built tree::
mach build
Then, simply generate the Android Eclipse build backend::
mach build-backend -b CppEclipse
If all goes well, the path to the generated workspace should be
printed (currently, ``$OBJDIR/android_eclipse``).
To use the generated Android Eclipse project files, you'll need to
have a Eclipse CDT 8.3 (We plan to follow the latest Eclipse release)
`Eclipse CDT plugin
<https://www.eclipse.org/cdt/>`_
installed. You can then import all the projects into Eclipse using
*File > Import ... > General > Existing Projects into Workspace*
-only- if you have not ran the background indexer.
Updating Project Files
======================
As you pull and update the source tree, your C++ Eclipse files may
fall out of sync with the build configuration. The tree should still
build fine from within Eclipse, but source files may be missing and in
rare circumstances Eclipse's index may not have the proper build
configuration.
To account for this, you'll want to periodically regenerate the
Android Eclipse project files. You can do this by running ``mach build
&& mach build-backend -b CppEclipse`` from the
command line.
Currently, regeneration rewrites the original project files. **If
you've made any customizations to the projects, they will likely get
overwritten.** We would like to improve this user experience in the
future.

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

@ -22,8 +22,15 @@ Important Concepts
mozinfo
preprocessor
jar-manifests
visualstudio
integrated development environment (IDE)
========================================
.. toctree::
:maxdepth: 1
androideclipse
cppeclipse
visualstudio
mozbuild
========

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

@ -94,14 +94,14 @@
#include "GLContext.h"
#include "GLContextProvider.h"
#ifdef USE_SKIA_GPU
#undef free // apparently defined by some windows header, clashing with a free()
// method in SkTypes.h
#include "GLContextSkia.h"
#include "SkiaGLGlue.h"
#include "SurfaceStream.h"
#include "SurfaceTypes.h"
#include "nsIGfxInfo.h"
#endif
using mozilla::gl::GLContext;
using mozilla::gl::SkiaGLGlue;
using mozilla::gl::GLContextProvider;
#ifdef XP_WIN
@ -430,28 +430,18 @@ public:
}
}
#ifdef USE_SKIA_GPU
static void PreTransactionCallback(void* aData)
{
CanvasRenderingContext2DUserData* self =
static_cast<CanvasRenderingContext2DUserData*>(aData);
CanvasRenderingContext2D* context = self->mContext;
if (!context)
if (!context || !context->mStream || !context->mTarget)
return;
GLContext* glContext = static_cast<GLContext*>(context->mTarget->GetGLContext());
if (!glContext)
return;
if (context->mTarget) {
// Since SkiaGL default to store drawing command until flush
// We will have to flush it before present.
context->mTarget->Flush();
}
glContext->MakeCurrent();
glContext->PublishFrame();
// Since SkiaGL default to store drawing command until flush
// We will have to flush it before present.
context->mTarget->Flush();
}
#endif
static void DidTransactionCallback(void* aData)
{
@ -542,18 +532,15 @@ DrawTarget* CanvasRenderingContext2D::sErrorTarget = nullptr;
CanvasRenderingContext2D::CanvasRenderingContext2D()
: mZero(false), mOpaque(false), mResetLayer(true)
: mForceSoftware(false), mZero(false), mOpaque(false), mResetLayer(true)
, mIPC(false)
, mStream(nullptr)
, mIsEntireFrameInvalid(false)
, mPredictManyRedrawCalls(false), mPathTransformWillUpdate(false)
, mInvalidateCount(0)
{
sNumLivingContexts++;
SetIsDOMBinding();
#ifdef USE_SKIA_GPU
mForceSoftware = false;
#endif
}
CanvasRenderingContext2D::~CanvasRenderingContext2D()
@ -568,9 +555,7 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
NS_IF_RELEASE(sErrorTarget);
}
#ifdef USE_SKIA_GPU
RemoveDemotableContext(this);
#endif
}
JSObject*
@ -638,6 +623,7 @@ CanvasRenderingContext2D::Reset()
}
mTarget = nullptr;
mStream = nullptr;
// reset hit regions
#ifdef ACCESSIBILITY
@ -765,8 +751,7 @@ CanvasRenderingContext2D::RedrawUser(const gfxRect& r)
void CanvasRenderingContext2D::Demote()
{
#ifdef USE_SKIA_GPU
if (!IsTargetValid() || mForceSoftware || !mTarget->GetGLContext())
if (!IsTargetValid() || mForceSoftware || !mStream)
return;
RemoveDemotableContext(this);
@ -774,6 +759,7 @@ void CanvasRenderingContext2D::Demote()
RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
RefPtr<DrawTarget> oldTarget = mTarget;
mTarget = nullptr;
mStream = nullptr;
mResetLayer = true;
mForceSoftware = true;
@ -792,11 +778,8 @@ void CanvasRenderingContext2D::Demote()
}
mTarget->SetTransform(oldTarget->GetTransform());
#endif
}
#ifdef USE_SKIA_GPU
std::vector<CanvasRenderingContext2D*>&
CanvasRenderingContext2D::DemotableContexts()
{
@ -807,11 +790,7 @@ CanvasRenderingContext2D::DemotableContexts()
void
CanvasRenderingContext2D::DemoteOldestContextIfNecessary()
{
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
const size_t kMaxContexts = 2;
#else
const size_t kMaxContexts = 16;
#endif
const size_t kMaxContexts = 64;
std::vector<CanvasRenderingContext2D*>& contexts = DemotableContexts();
if (contexts.size() < kMaxContexts)
@ -845,8 +824,6 @@ CheckSizeForSkiaGL(IntSize size) {
return size.width >= minsize && size.height >= minsize;
}
#endif
void
CanvasRenderingContext2D::EnsureTarget()
{
@ -872,42 +849,29 @@ CanvasRenderingContext2D::EnsureTarget()
}
if (layerManager) {
#ifdef USE_SKIA_GPU
if (gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas()) {
SurfaceCaps caps = SurfaceCaps::ForRGBA();
caps.preserve = true;
#ifdef MOZ_WIDGET_GONK
layers::ShadowLayerForwarder *forwarder = layerManager->AsShadowForwarder();
if (forwarder) {
caps.surfaceAllocator = static_cast<layers::ISurfaceAllocator*>(forwarder);
}
#endif
if (gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas() &&
!mForceSoftware &&
CheckSizeForSkiaGL(size)) {
DemoteOldestContextIfNecessary();
nsRefPtr<GLContext> glContext;
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
nsString vendor;
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (!mForceSoftware && CheckSizeForSkiaGL(size))
{
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
caps);
if (glue) {
mTarget = Factory::CreateDrawTargetSkiaWithGrContext(glue->GetGrContext(), size, format);
if (mTarget) {
mStream = gfx::SurfaceStream::CreateForType(SurfaceStreamType::TripleBuffer, glue->GetGLContext());
AddDemotableContext(this);
} else {
printf_stderr("Failed to create a SkiaGL DrawTarget, falling back to software\n");
}
}
if (glContext) {
SkAutoTUnref<GrGLInterface> i(CreateGrGLInterfaceFromGLContext(glContext));
mTarget = Factory::CreateDrawTargetSkiaWithGLContextAndGrGLInterface(glContext, i, size, format);
AddDemotableContext(this);
} else {
if (!mTarget) {
mTarget = layerManager->CreateDrawTarget(size, format);
}
} else
#endif
mTarget = layerManager->CreateDrawTarget(size, format);
mTarget = layerManager->CreateDrawTarget(size, format);
} else {
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format);
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format);
}
}
@ -1092,12 +1056,10 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value
ContextAttributes2D attributes;
NS_ENSURE_TRUE(attributes.Init(aCx, aOptions), NS_ERROR_UNEXPECTED);
#ifdef USE_SKIA_GPU
if (Preferences::GetBool("gfx.canvas.willReadFrequently.enable", false)) {
// Use software when there is going to be a lot of readback
mForceSoftware = attributes.mWillReadFrequently;
}
#endif
return NS_OK;
}
@ -3340,7 +3302,6 @@ CanvasRenderingContext2D::DrawDirectlyToCanvas(
NS_ENSURE_SUCCESS_VOID(rv);
}
#ifdef USE_SKIA_GPU
static bool
IsStandardCompositeOp(CompositionOp op)
{
@ -3356,7 +3317,6 @@ IsStandardCompositeOp(CompositionOp op)
op == CompositionOp::OP_ADD ||
op == CompositionOp::OP_XOR);
}
#endif
void
CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
@ -3397,11 +3357,9 @@ CanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op,
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
else return;
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
CurrentState().op = comp_op;
@ -3447,11 +3405,9 @@ CanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op,
error.Throw(NS_ERROR_FAILURE);
}
#ifdef USE_SKIA_GPU
if (!IsStandardCompositeOp(comp_op)) {
Demote();
}
#endif
#undef CANVAS_OP_TO_GFX_OP
}
@ -4151,7 +4107,17 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
aOldLayer->GetUserData(&g2DContextLayerUserData));
CanvasLayer::Data data;
data.mGLContext = static_cast<GLContext*>(mTarget->GetGLContext());
if (mStream) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (glue) {
data.mGLContext = glue->GetGLContext();
data.mStream = mStream.get();
}
} else {
data.mDrawTarget = mTarget;
}
if (userData && userData->IsForContext(this) && aOldLayer->IsDataValid(data)) {
nsRefPtr<CanvasLayer> ret = aOldLayer;
return ret.forget();
@ -4184,15 +4150,17 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
canvasLayer->SetUserData(&g2DContextLayerUserData, userData);
CanvasLayer::Data data;
#ifdef USE_SKIA_GPU
GLContext* glContext = static_cast<GLContext*>(mTarget->GetGLContext());
if (glContext) {
canvasLayer->SetPreTransactionCallback(
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
data.mGLContext = glContext;
} else
#endif
{
if (mStream) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
if (glue) {
canvasLayer->SetPreTransactionCallback(
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
data.mGLContext = glue->GetGLContext();
data.mStream = mStream.get();
data.mTexID = (uint32_t)((uintptr_t)mTarget->GetNativeSurface(NativeSurfaceType::OPENGL_TEXTURE));
}
} else {
data.mDrawTarget = mTarget;
}

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

@ -31,6 +31,7 @@ class nsXULElement;
namespace mozilla {
namespace gfx {
class SourceSurface;
class SurfaceStream;
}
namespace dom {
@ -596,7 +597,6 @@ protected:
return CurrentState().font;
}
#if USE_SKIA_GPU
static std::vector<CanvasRenderingContext2D*>& DemotableContexts();
static void DemoteOldestContextIfNecessary();
@ -605,7 +605,6 @@ protected:
// Do not use GL
bool mForceSoftware;
#endif
// Member vars
int32_t mWidth, mHeight;
@ -632,6 +631,8 @@ protected:
// sErrorTarget.
mozilla::RefPtr<mozilla::gfx::DrawTarget> mTarget;
RefPtr<gfx::SurfaceStream> mStream;
/**
* Flag to avoid duplicate calls to InvalidateFrame. Set to true whenever
* Redraw is called, reset to false when Render is called.

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

@ -1343,6 +1343,11 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
return JS::NullValue();
}
if (!mBoundFramebuffer) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0");
return JS::NullValue();
}
if (attachment != LOCAL_GL_DEPTH_ATTACHMENT &&
attachment != LOCAL_GL_STENCIL_ATTACHMENT &&
attachment != LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
@ -1365,11 +1370,6 @@ WebGLContext::GetFramebufferAttachmentParameter(JSContext* cx,
}
}
if (!mBoundFramebuffer) {
ErrorInvalidOperation("getFramebufferAttachmentParameter: cannot query framebuffer 0");
return JS::NullValue();
}
MakeContextCurrent();
const WebGLFramebuffer::Attachment& fba = mBoundFramebuffer->GetAttachment(attachment);

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

@ -4,6 +4,8 @@ support-files =
webgl-util.js
[test_depth_readpixels.html]
[test_fb_param.html]
[test_fb_param_crash.html]
[test_highp_fs.html]
[test_no_arr_points.html]
[test_privileged_exts.html]

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

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<title>WebGL test: bug 958491</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="driver-info.js"></script>
<script src="webgl-util.js"></script>
<body>
<canvas id="c"></canvas>
<script>
// Give ourselves a scope to return early from:
(function() {
var gl = WebGLUtil.getWebGL('c');
if (!gl) {
todo(false, 'WebGL is unavailable.');
return;
}
// Catch actual WebGLUtil errors, not GL errors.
function errorFunc(str) {
ok(false, 'Error: ' + str);
}
WebGLUtil.setErrorFunc(errorFunc);
function checkGLError(func, info, reference) {
var error = gl.getError();
var prefix = info ? ('[' + info + '] ') : '';
var text = 'gl.getError should be 0x' + reference.toString(16) +
', was 0x' + error.toString(16) + '.';
func(error == reference, prefix + text);
}
// Begin test:
var rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 4, 4);
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0,
gl.RENDERBUFFER, rb);
checkGLError(ok, 'before bad param query', 0);
var GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER,
gl.COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING);
checkGLError(ok, 'after bad param query', gl.INVALID_ENUM);
})();
</script>

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

@ -0,0 +1,49 @@
<!DOCTYPE HTML>
<title>WebGL test: bug 958723</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="driver-info.js"></script>
<script src="webgl-util.js"></script>
<body>
<canvas id="c"></canvas>
<script>
// Give ourselves a scope to return early from:
(function() {
var gl = WebGLUtil.getWebGL('c');
if (!gl) {
todo(false, 'WebGL is unavailable.');
return;
}
// Catch actual WebGLUtil errors, not GL errors.
function errorFunc(str) {
ok(false, 'Error: ' + str);
}
WebGLUtil.setErrorFunc(errorFunc);
function checkGLError(func, info, reference) {
var error = gl.getError();
var prefix = info ? ('[' + info + '] ') : '';
var text = 'gl.getError should be 0x' + reference.toString(16) +
', was 0x' + error.toString(16) + '.';
func(error == reference, prefix + text);
}
// Begin test:
if (!gl.getExtension('WEBGL_draw_buffers')) {
todo(false, 'Not having this extension is fine.');
return;
}
checkGLError(ok, 'before bad param query', 0);
var result = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER,
gl.COLOR_ATTACHMENT0,
gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);
checkGLError(ok, 'after bad param query', gl.INVALID_OPERATION);
})();
</script>

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

@ -6117,7 +6117,7 @@ HTMLInputElement::GetValueMode() const
bool
HTMLInputElement::IsMutable() const
{
return !IsDisabled() && GetCurrentDoc() &&
return !IsDisabled() &&
!(DoesReadOnlyApply() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::readonly));
}

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

@ -73,3 +73,4 @@ skip-if = os == "android" || appname == "b2g"
[test_valueAsDate_pref.html]
[test_valueasdate_attribute.html]
[test_valueasnumber_attribute.html]
[test_validation_not_in_doc.html]

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

@ -185,8 +185,10 @@ function checkInputRequiredValidity(type)
element.required = true;
SpecialPowers.wrap(element).value = ''; // To make :-moz-ui-valid apply.
checkSufferingFromBeingMissing(element, true);
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
// Removing the child changes nothing about whether it's valid
checkSufferingFromBeingMissing(element, true);
}
function checkInputRequiredValidityForCheckbox()
@ -221,7 +223,7 @@ function checkInputRequiredValidityForCheckbox()
element.required = true;
element.checked = false;
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
checkSufferingFromBeingMissing(element, true);
}
function checkInputRequiredValidityForRadio()
@ -297,7 +299,7 @@ function checkInputRequiredValidityForRadio()
element2.required = true;
element2.checked = false;
document.forms[0].removeChild(element2);
checkNotSufferingFromBeingMissing(element2);
checkSufferingFromBeingMissing(element2, true);
}
function checkInputRequiredValidityForFile()
@ -350,7 +352,7 @@ function checkInputRequiredValidityForFile()
SpecialPowers.wrap(element).value = '';
file.remove(false);
document.forms[0].removeChild(element);
checkNotSufferingFromBeingMissing(element);
checkSufferingFromBeingMissing(element, true);
}
checkTextareaRequiredValidity();

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

@ -0,0 +1,19 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for constraint validation of form controls not in documents</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var input = document.createElement('input');
input.required = true;
assert_false(input.checkValidity());
}, "Should validate input not in document");
test(function() {
var textarea = document.createElement('textarea');
textarea.required = true;
assert_false(textarea.checkValidity());
}, "Should validate textarea not in document");
</script>

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

@ -129,7 +129,7 @@ function checkRadios(r1, r2, r3, form)
var p = r2.parentNode;
p.removeChild(r2);
checkPseudoClasses(r1, true, true, false);
checkPseudoClasses(r2, true, true, false);
checkPseudoClasses(r2, false, false, true);
p.appendChild(r2);
checkPseudoClasses(r1, false, false, true);

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

@ -63,7 +63,6 @@ support-files =
[test_bug875221.html]
[test_bug875402.html]
[test_bug894150.html]
[test_bug938022.html]
[test_bug956489.html]
[test_bug964376.html]
[test_bug972678.html]
@ -108,6 +107,7 @@ support-files =
[test_pannerNode.html]
[test_pannerNodeAbove.html]
[test_pannerNodeChannelCount.html]
[test_pannerNodeHRTFSymmetry.html]
[test_pannerNodeTail.html]
[test_pannerNode_equalPower.html]
[test_periodicWave.html]

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

@ -1,28 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test audio element currentTime is correct when used as media source</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var context = new AudioContext();
var audio = new Audio("small-shot.ogg");
audio.load();
audio.addEventListener("loadeddata", function (e) {
is(this.currentTime, 0, "currentTime must be 0");
SimpleTest.finish();
});
audio.play();
var source = context.createMediaElementSource(audio);
source.connect(context.destination);
});
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,104 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test left/right symmetry and block-offset invariance of HRTF panner</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="webaudio.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
const blockSize = 128;
const bufferSize = 4096; // > HRTF panner latency
var ctx = new AudioContext();
function isChannelSilent(channel) {
for (var i = 0; i < channel.length; ++i) {
if (channel[i] != 0.0) {
return false;
}
}
return true;
}
function startTest() {
var leftPanner = ctx.createPanner();
var rightPanner = ctx.createPanner();
leftPanner.setPosition(-1,0,0);
rightPanner.setPosition(1,0,0);
// Test that PannerNode processes the signal consistently irrespective of
// the offset in the processing block. This is done by inserting a delay of
// less than a block size before one panner.
const delayTime = 0.7 * blockSize / ctx.sampleRate;
var leftDelay = ctx.createDelay(delayTime);
leftDelay.delayTime.value = delayTime;
leftDelay.connect(leftPanner);
// and compensating for the delay after the other.
var rightDelay = ctx.createDelay(delayTime);
rightDelay.delayTime.value = delayTime;
rightPanner.connect(rightDelay);
// Feed the panners with a signal having some harmonics to fill the spectrum.
var oscillator = ctx.createOscillator();
oscillator.frequency.value = 110;
oscillator.type = "sawtooth";
oscillator.connect(leftDelay);
oscillator.connect(rightPanner);
oscillator.start(0);
// Switch the channels on one panner output, and it should match the other.
var splitter = ctx.createChannelSplitter();
leftPanner.connect(splitter);
var merger = ctx.createChannelMerger();
splitter.connect(merger, 0, 1);
splitter.connect(merger, 1, 0);
// Invert one signal so that mixing with the other will find the difference.
var gain = ctx.createGain();
gain.gain.value = -1.0;
merger.connect(gain);
var processor = ctx.createScriptProcessor(bufferSize, 2, 0);
gain.connect(processor);
rightDelay.connect(processor);
processor.onaudioprocess =
function(e) {
compareBuffers(e.inputBuffer,
ctx.createBuffer(2, bufferSize, ctx.sampleRate));
e.target.onaudioprocess = null;
SimpleTest.finish();
}
}
function prepareTest() {
// A PannerNode will produce no output until it has loaded its HRIR
// database. Wait for this to load before starting the test.
var processor = ctx.createScriptProcessor(bufferSize, 2, 0);
var panner = ctx.createPanner();
panner.connect(processor);
var oscillator = ctx.createOscillator();
oscillator.connect(panner);
oscillator.start(0);
processor.onaudioprocess =
function(e) {
if (isChannelSilent(e.inputBuffer.getChannelData(0)))
return;
oscillator.stop(0);
panner.disconnect();
e.target.onaudioprocess = null;
startTest();
};
}
prepareTest();
</script>
</pre>
</body>
</html>

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

@ -9,6 +9,7 @@
#include "prtime.h"
#include "prinrval.h"
#include "prsystem.h"
#include "prprf.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -214,9 +215,9 @@ nsresult LoadInfo::UpdateSystemLoad()
uint64_t nice;
uint64_t system;
uint64_t idle;
if (sscanf(buffer.get(), "cpu %Lu %Lu %Lu %Lu",
&user, &nice,
&system, &idle) != 4) {
if (PR_sscanf(buffer.get(), "cpu %llu %llu %llu %llu",
&user, &nice,
&system, &idle) != 4) {
LOG(("Error parsing /proc/stat"));
return NS_ERROR_FAILURE;
}

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

@ -270,16 +270,25 @@ class CGDOMProxyJSClass(CGThing):
def declare(self):
return ""
def define(self):
flags = ["JSCLASS_IS_DOMJSCLASS"]
# We don't use an IDL annotation for JSCLASS_EMULATES_UNDEFINED because
# we don't want people ever adding that to any interface other than
# HTMLAllCollection. So just hardcode it here.
if self.descriptor.interface.identifier.name == "HTMLAllCollection":
flags.append("JSCLASS_EMULATES_UNDEFINED")
callHook = LEGACYCALLER_HOOK_NAME if self.descriptor.operations["LegacyCaller"] else 'nullptr'
return """
static const DOMJSClass Class = {
PROXY_CLASS_DEF("%s",
0, /* extra slots */
JSCLASS_IS_DOMJSCLASS,
nullptr, /* call */
%s,
%s, /* call */
nullptr /* construct */),
%s
};
""" % (self.descriptor.interface.identifier.name,
" | ".join(flags),
callHook,
CGIndenter(CGGeneric(DOMClass(self.descriptor))).define())
def PrototypeIDAndDepth(descriptor):

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

@ -353,10 +353,6 @@ class Descriptor(DescriptorProvider):
raise SyntaxError("%s supports named properties but does "
"not have a named getter.\n%s" %
(self.interface, self.interface.location))
if operations['LegacyCaller']:
raise SyntaxError("%s has a legacy caller but is a proxy; "
"we don't support that yet.\n%s" %
(self.interface, self.interface.location))
iface = self.interface
while iface:
iface.setUserData('hasProxyDescendant', True)

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

@ -967,6 +967,7 @@ public:
uint32_t Item(uint32_t&);
uint32_t Item(uint32_t, bool&) MOZ_DELETE;
uint32_t Length();
void LegacyCall(JS::Handle<JS::Value>);
};
class TestNamedGetterInterface : public nsISupports,

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

@ -876,6 +876,7 @@ dictionary DictForConstructor {
interface TestIndexedGetterInterface {
getter long item(unsigned long idx);
readonly attribute unsigned long length;
legacycaller void();
};
interface TestNamedGetterInterface {

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

@ -1,3 +1,5 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -225,23 +227,22 @@ class DeviceSuccessCallbackRunnable: public nsRunnable
public:
DeviceSuccessCallbackRunnable(
uint64_t aWindowID,
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback>& aSuccess,
nsCOMPtr<nsIDOMGetUserMediaErrorCallback>& aError,
nsTArray<nsCOMPtr<nsIMediaDevice> >* aDevices)
: mSuccess(aSuccess)
, mError(aError)
, mDevices(aDevices)
: mDevices(aDevices)
, mWindowID(aWindowID)
, mManager(MediaManager::GetInstance()) {}
, mManager(MediaManager::GetInstance())
{
mSuccess.swap(aSuccess);
mError.swap(aError);
}
NS_IMETHOD
Run()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> success(mSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
// Only run if window is still on our active list.
if (!mManager->IsWindowStillActive(mWindowID)) {
return NS_OK;
@ -256,7 +257,7 @@ public:
// We should in the future return an empty array, and dynamically add
// devices to the dropdowns if things are hotplugged while the
// requester is up.
error->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
mError->OnError(NS_LITERAL_STRING("NO_DEVICES_FOUND"));
return NS_OK;
}
@ -272,13 +273,13 @@ public:
static_cast<const void*>(tmp.Elements())
));
success->OnSuccess(devices);
mSuccess->OnSuccess(devices);
return NS_OK;
}
private:
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
nsAutoPtr<nsTArray<nsCOMPtr<nsIMediaDevice> > > mDevices;
uint64_t mWindowID;
nsRefPtr<MediaManager> mManager;
@ -1099,13 +1100,15 @@ public:
NS_DispatchToMainThread(new DeviceSuccessCallbackRunnable(mWindowId,
mSuccess, mError,
final.forget()));
// DeviceSuccessCallbackRunnable should have taken these.
MOZ_ASSERT(!mSuccess && !mError);
return NS_OK;
}
private:
MediaStreamConstraintsInternal mConstraints;
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mError;
nsRefPtr<MediaManager> mManager;
uint64_t mWindowId;
const nsString mCallId;

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

@ -2142,7 +2142,15 @@ WorkerPrivateParent<Derived>::WrapObject(JSContext* aCx,
AssertIsOnParentThread();
return WorkerBinding::Wrap(aCx, aScope, ParentAsWorkerPrivate());
// XXXkhuey this should not need to be rooted, the analysis is dumb.
// See bug 980181.
JS::Rooted<JSObject*> wrapper(aCx,
WorkerBinding::Wrap(aCx, aScope, ParentAsWorkerPrivate()));
if (wrapper) {
MOZ_ALWAYS_TRUE(TryPreserveWrapper(wrapper));
}
return wrapper;
}
template <class Derived>

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

@ -971,15 +971,10 @@ public:
return mPermitSubpixelAA;
}
virtual GenericRefCountedBase* GetGLContext() const {
return nullptr;
}
#ifdef USE_SKIA_GPU
virtual void InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
virtual void InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
MOZ_CRASH();
}
@ -1085,13 +1080,9 @@ public:
#ifdef USE_SKIA_GPU
static TemporaryRef<DrawTarget>
CreateDrawTargetSkiaWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat);
static void
SetGlobalSkiaCacheLimits(int aCount, int aSizeInBytes);
CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat);
#endif
static void PurgeAllCaches();

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

@ -79,80 +79,6 @@ public:
ExtendMode mExtendMode;
};
#ifdef USE_SKIA_GPU
int DrawTargetSkia::sTextureCacheCount = 256;
int DrawTargetSkia::sTextureCacheSizeInBytes = 96*1024*1024;
static std::vector<DrawTargetSkia*>&
GLDrawTargets()
{
static std::vector<DrawTargetSkia*> targets;
return targets;
}
void
DrawTargetSkia::RebalanceCacheLimits()
{
// Divide the global cache limits equally between all currently active GL-backed
// Skia DrawTargets.
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
uint32_t targetCount = targets.size();
if (targetCount == 0)
return;
int individualCacheSize = sTextureCacheSizeInBytes / targetCount;
for (uint32_t i = 0; i < targetCount; i++) {
targets[i]->SetCacheLimits(sTextureCacheCount, individualCacheSize);
}
}
static void
AddGLDrawTarget(DrawTargetSkia* target)
{
GLDrawTargets().push_back(target);
DrawTargetSkia::RebalanceCacheLimits();
}
static void
RemoveGLDrawTarget(DrawTargetSkia* target)
{
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
std::vector<DrawTargetSkia*>::iterator it = std::find(targets.begin(), targets.end(), target);
if (it != targets.end()) {
targets.erase(it);
DrawTargetSkia::RebalanceCacheLimits();
}
}
void
DrawTargetSkia::SetGlobalCacheLimits(int aCount, int aSizeInBytes)
{
sTextureCacheCount = aCount;
sTextureCacheSizeInBytes = aSizeInBytes;
DrawTargetSkia::RebalanceCacheLimits();
}
void
DrawTargetSkia::PurgeCaches()
{
if (mGrContext) {
mGrContext->freeGpuResources();
}
}
/* static */ void
DrawTargetSkia::PurgeAllCaches()
{
std::vector<DrawTargetSkia*>& targets = GLDrawTargets();
uint32_t targetCount = targets.size();
for (uint32_t i = 0; i < targetCount; i++) {
targets[i]->PurgeCaches();
}
}
#endif
/**
* When constructing a temporary SkBitmap via GetBitmapForSurface, we may also
* have to construct a temporary DataSourceSurface, which must live as long as
@ -189,15 +115,12 @@ GetBitmapForSurface(SourceSurface* aSurface)
}
DrawTargetSkia::DrawTargetSkia()
: mSnapshot(nullptr)
: mTexture(0), mSnapshot(nullptr)
{
}
DrawTargetSkia::~DrawTargetSkia()
{
#ifdef USE_SKIA_GPU
RemoveGLDrawTarget(this);
#endif
}
TemporaryRef<SourceSurface>
@ -770,45 +693,33 @@ DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat)
#ifdef USE_SKIA_GPU
void
DrawTargetSkia::InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
mGLContext = aGLContext;
mGrContext = aGrContext;
mSize = aSize;
mFormat = aFormat;
mGrGLInterface = aGrGLInterface;
mGrGLInterface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
GrBackendContext backendContext = reinterpret_cast<GrBackendContext>(aGrGLInterface);
SkAutoTUnref<GrContext> gr(GrContext::Create(kOpenGL_GrBackend, backendContext));
mGrContext = gr.get();
GrBackendRenderTargetDesc targetDescriptor;
GrTextureDesc targetDescriptor;
targetDescriptor.fFlags = kRenderTarget_GrTextureFlagBit;
targetDescriptor.fWidth = mSize.width;
targetDescriptor.fHeight = mSize.height;
targetDescriptor.fConfig = GfxFormatToGrConfig(mFormat);
targetDescriptor.fOrigin = kBottomLeft_GrSurfaceOrigin;
targetDescriptor.fSampleCnt = 0;
targetDescriptor.fRenderTargetHandle = 0; // GLContext always exposes the right framebuffer as id 0
SkAutoTUnref<GrRenderTarget> target(mGrContext->wrapBackendRenderTarget(targetDescriptor));
SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(mGrContext.get(), target.get()));
SkAutoTUnref<GrTexture> skiaTexture(mGrContext->createUncachedTexture(targetDescriptor, NULL, 0));
mTexture = (uint32_t)skiaTexture->getTextureHandle();
SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(mGrContext.get(), skiaTexture->asRenderTarget()));
SkAutoTUnref<SkCanvas> canvas(new SkCanvas(device.get()));
mCanvas = canvas.get();
AddGLDrawTarget(this);
}
void
DrawTargetSkia::SetCacheLimits(int aCount, int aSizeInBytes)
{
MOZ_ASSERT(mGrContext, "No GrContext!");
mGrContext->setTextureCacheLimits(aCount, aSizeInBytes);
}
#endif
void
@ -840,6 +751,17 @@ DrawTargetSkia::SetTransform(const Matrix& aTransform)
mTransform = aTransform;
}
void*
DrawTargetSkia::GetNativeSurface(NativeSurfaceType aType)
{
if (aType == NativeSurfaceType::OPENGL_TEXTURE) {
return (void*)((uintptr_t)mTexture);
}
return nullptr;
}
TemporaryRef<PathBuilder>
DrawTargetSkia::CreatePathBuilder(FillRule aFillRule) const
{

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

@ -100,23 +100,15 @@ public:
virtual TemporaryRef<GradientStops> CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode = ExtendMode::CLAMP) const;
virtual TemporaryRef<FilterNode> CreateFilter(FilterType aType);
virtual void SetTransform(const Matrix &aTransform);
virtual void *GetNativeSurface(NativeSurfaceType aType);
bool Init(const IntSize &aSize, SurfaceFormat aFormat);
void Init(unsigned char* aData, const IntSize &aSize, int32_t aStride, SurfaceFormat aFormat);
#ifdef USE_SKIA_GPU
virtual GenericRefCountedBase* GetGLContext() const MOZ_OVERRIDE { return mGLContext; }
void InitWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat) MOZ_OVERRIDE;
void SetCacheLimits(int aCount, int aSizeInBytes);
void PurgeCaches();
static void SetGlobalCacheLimits(int aCount, int aSizeInBytes);
static void RebalanceCacheLimits();
static void PurgeAllCaches();
void InitWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat) MOZ_OVERRIDE;
#endif
operator std::string() const {
@ -134,18 +126,8 @@ private:
SkRect SkRectCoveringWholeSurface() const;
#ifdef USE_SKIA_GPU
/*
* These members have inter-dependencies, but do not keep each other alive, so
* destruction order is very important here: mGrContext uses mGrGLInterface, and
* through it, uses mGLContext, so it is important that they be declared in the
* present order.
*/
RefPtr<GenericRefCountedBase> mGLContext;
SkRefPtr<GrGLInterface> mGrGLInterface;
SkRefPtr<GrContext> mGrContext;
static int sTextureCacheCount;
static int sTextureCacheSizeInBytes;
uint32_t mTexture;
#endif
IntSize mSize;

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

@ -586,30 +586,21 @@ Factory::D2DCleanup()
#ifdef USE_SKIA_GPU
TemporaryRef<DrawTarget>
Factory::CreateDrawTargetSkiaWithGLContextAndGrGLInterface(GenericRefCountedBase* aGLContext,
GrGLInterface* aGrGLInterface,
const IntSize &aSize,
SurfaceFormat aFormat)
Factory::CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext,
const IntSize &aSize,
SurfaceFormat aFormat)
{
DrawTargetSkia* newDrawTargetSkia = new DrawTargetSkia();
newDrawTargetSkia->InitWithGLContextAndGrGLInterface(aGLContext, aGrGLInterface, aSize, aFormat);
newDrawTargetSkia->InitWithGrContext(aGrContext, aSize, aFormat);
RefPtr<DrawTarget> newTarget = newDrawTargetSkia;
return newTarget;
}
void
Factory::SetGlobalSkiaCacheLimits(int aCount, int aSizeInBytes)
{
DrawTargetSkia::SetGlobalCacheLimits(aCount, aSizeInBytes);
}
#endif // USE_SKIA_GPU
void
Factory::PurgeAllCaches()
{
#ifdef USE_SKIA_GPU
DrawTargetSkia::PurgeAllCaches();
#endif
}
#ifdef USE_SKIA_FREETYPE

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

@ -96,7 +96,8 @@ MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType, int8_t)
CAIRO_SURFACE,
CAIRO_CONTEXT,
CGCONTEXT,
CGCONTEXT_ACCELERATED
CGCONTEXT_ACCELERATED,
OPENGL_TEXTURE
MOZ_END_ENUM_CLASS(NativeSurfaceType)
MOZ_BEGIN_ENUM_CLASS(NativeFontType, int8_t)

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

@ -628,6 +628,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
MarkUnsupported(GLFeature::standard_derivatives);
}
if (Vendor() == GLVendor::Imagination &&
Renderer() == GLRenderer::SGX540) {
// Bug 980048
MarkExtensionUnsupported(OES_EGL_sync);
}
#ifdef XP_MACOSX
// The Mac Nvidia driver, for versions up to and including 10.8, don't seem
// to properly support this. See 814839

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

@ -1938,39 +1938,39 @@ public:
private:
GLuint GLAPIENTRY raw_fCreateProgram() {
GLuint raw_fCreateProgram() {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateProgram();
AFTER_GL_CALL;
return ret;
}
GLuint GLAPIENTRY raw_fCreateShader(GLenum t) {
GLuint raw_fCreateShader(GLenum t) {
BEFORE_GL_CALL;
GLuint ret = mSymbols.fCreateShader(t);
AFTER_GL_CALL;
return ret;
}
void GLAPIENTRY raw_fGenBuffers(GLsizei n, GLuint* names) {
void raw_fGenBuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenFramebuffers(GLsizei n, GLuint* names) {
void raw_fGenFramebuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
void raw_fGenRenderbuffers(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fGenTextures(GLsizei n, GLuint* names) {
void raw_fGenTextures(GLsizei n, GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fGenTextures(n, names);
AFTER_GL_CALL;
@ -2010,37 +2010,37 @@ public:
}
private:
void GLAPIENTRY raw_fDeleteProgram(GLuint program) {
void raw_fDeleteProgram(GLuint program) {
BEFORE_GL_CALL;
mSymbols.fDeleteProgram(program);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteShader(GLuint shader) {
void raw_fDeleteShader(GLuint shader) {
BEFORE_GL_CALL;
mSymbols.fDeleteShader(shader);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteBuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteBuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteBuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteFramebuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteFramebuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteFramebuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
void raw_fDeleteRenderbuffers(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteRenderbuffers(n, names);
AFTER_GL_CALL;
}
void GLAPIENTRY raw_fDeleteTextures(GLsizei n, const GLuint* names) {
void raw_fDeleteTextures(GLsizei n, const GLuint* names) {
BEFORE_GL_CALL;
mSymbols.fDeleteTextures(n, names);
AFTER_GL_CALL;
@ -2090,7 +2090,7 @@ public:
TRACKING_CONTEXT(DeletedTextures(this, n, names));
}
GLenum GLAPIENTRY fGetGraphicsResetStatus() {
GLenum fGetGraphicsResetStatus() {
MOZ_ASSERT(mHasRobustness);
BEFORE_GL_CALL;
@ -2104,7 +2104,7 @@ public:
// -----------------------------------------------------------------------------
// Extension ARB_sync (GL)
public:
GLsync GLAPIENTRY fFenceSync(GLenum condition, GLbitfield flags) {
GLsync fFenceSync(GLenum condition, GLbitfield flags) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fFenceSync);
GLsync ret = mSymbols.fFenceSync(condition, flags);
@ -2112,7 +2112,7 @@ public:
return ret;
}
realGLboolean GLAPIENTRY fIsSync(GLsync sync) {
realGLboolean fIsSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsSync);
realGLboolean ret = mSymbols.fIsSync(sync);
@ -2120,14 +2120,14 @@ public:
return ret;
}
void GLAPIENTRY fDeleteSync(GLsync sync) {
void fDeleteSync(GLsync sync) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteSync);
mSymbols.fDeleteSync(sync);
AFTER_GL_CALL;
}
GLenum GLAPIENTRY fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
GLenum fClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClientWaitSync);
GLenum ret = mSymbols.fClientWaitSync(sync, flags, timeout);
@ -2135,21 +2135,21 @@ public:
return ret;
}
void GLAPIENTRY fWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
void fWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fWaitSync);
mSymbols.fWaitSync(sync, flags, timeout);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetInteger64v(GLenum pname, GLint64 *params) {
void fGetInteger64v(GLenum pname, GLint64 *params) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetInteger64v);
mSymbols.fGetInteger64v(pname, params);
AFTER_GL_CALL;
}
void GLAPIENTRY fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
void fGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) {
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetSynciv);
mSymbols.fGetSynciv(sync, pname, bufSize, length, values);
@ -2404,7 +2404,7 @@ public:
// -----------------------------------------------------------------------------
// Package XXX_vertex_array_object
public:
void GLAPIENTRY fBindVertexArray(GLuint array)
void fBindVertexArray(GLuint array)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fBindVertexArray);
@ -2412,7 +2412,7 @@ public:
AFTER_GL_CALL;
}
void GLAPIENTRY fDeleteVertexArrays(GLsizei n, const GLuint *arrays)
void fDeleteVertexArrays(GLsizei n, const GLuint *arrays)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDeleteVertexArrays);
@ -2420,7 +2420,7 @@ public:
AFTER_GL_CALL;
}
void GLAPIENTRY fGenVertexArrays(GLsizei n, GLuint *arrays)
void fGenVertexArrays(GLsizei n, GLuint *arrays)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGenVertexArrays);
@ -2428,7 +2428,7 @@ public:
AFTER_GL_CALL;
}
realGLboolean GLAPIENTRY fIsVertexArray(GLuint array)
realGLboolean fIsVertexArray(GLuint array)
{
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fIsVertexArray);

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

@ -1,8 +0,0 @@
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "skia/GrGLInterface.h"
GrGLInterface* CreateGrGLInterfaceFromGLContext(mozilla::gl::GLContext* context);

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

@ -43,6 +43,7 @@ GLScreenBuffer::Create(GLContext* gl,
#ifdef MOZ_WIDGET_GONK
/* On B2G, we want a Gralloc factory, and we want one right at the start */
if (!factory &&
caps.surfaceAllocator &&
XRE_GetProcessType() != GeckoProcessType_Default)
{
factory = new SurfaceFactory_Gralloc(gl, caps);
@ -70,7 +71,6 @@ GLScreenBuffer::Create(GLContext* gl,
GLScreenBuffer::~GLScreenBuffer()
{
delete mStream;
delete mDraw;
delete mRead;
@ -378,7 +378,6 @@ GLScreenBuffer::Morph(SurfaceFactory_GL* newFactory, SurfaceStreamType streamTyp
SurfaceStream* newStream = SurfaceStream::CreateForType(streamType, mGL, mStream);
MOZ_ASSERT(newStream);
delete mStream;
mStream = newStream;
}

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

@ -16,6 +16,7 @@
#define SCREEN_BUFFER_H_
#include "SurfaceTypes.h"
#include "SurfaceStream.h"
#include "GLContextTypes.h"
#include "GLDefs.h"
#include "mozilla/gfx/2D.h"
@ -156,7 +157,7 @@ protected:
GLContext* const mGL; // Owns us.
SurfaceCaps mCaps;
SurfaceFactory_GL* mFactory; // Owned by us.
SurfaceStream* mStream; // Owned by us.
RefPtr<SurfaceStream> mStream;
DrawBuffer* mDraw; // Owned by us.
ReadBuffer* mRead; // Owned by us.

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

@ -124,6 +124,7 @@ ScopedBindTexture::Init(GLenum aTarget)
GLenum bindingTarget = (aTarget == LOCAL_GL_TEXTURE_2D) ? LOCAL_GL_TEXTURE_BINDING_2D
: (aTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB) ? LOCAL_GL_TEXTURE_BINDING_RECTANGLE_ARB
: (aTarget == LOCAL_GL_TEXTURE_CUBE_MAP) ? LOCAL_GL_TEXTURE_BINDING_CUBE_MAP
: (aTarget == LOCAL_GL_TEXTURE_EXTERNAL) ? LOCAL_GL_TEXTURE_EXTERNAL
: LOCAL_GL_NONE;
MOZ_ASSERT(bindingTarget != LOCAL_GL_NONE);
mGL->GetUIntegerv(bindingTarget, &mOldTex);

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

@ -27,18 +27,30 @@ SharedSurface_EGLImage::Create(GLContext* prodGL,
{
GLLibraryEGL* egl = &sEGLLibrary;
MOZ_ASSERT(egl);
MOZ_ASSERT(context);
if (!HasExtensions(egl, prodGL))
if (!HasExtensions(egl, prodGL)) {
return nullptr;
}
MOZ_ALWAYS_TRUE(prodGL->MakeCurrent());
GLuint prodTex = CreateTextureForOffscreen(prodGL, formats, size);
if (!prodTex)
if (!prodTex) {
return nullptr;
}
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(prodTex);
EGLImage image = egl->fCreateImage(egl->Display(), context,
LOCAL_EGL_GL_TEXTURE_2D, buffer,
nullptr);
if (!image) {
prodGL->fDeleteTextures(1, &prodTex);
return nullptr;
}
return new SharedSurface_EGLImage(prodGL, egl,
size, hasAlpha,
formats, prodTex);
formats, prodTex, image);
}
@ -47,7 +59,7 @@ SharedSurface_EGLImage::HasExtensions(GLLibraryEGL* egl, GLContext* gl)
{
return egl->HasKHRImageBase() &&
egl->IsExtensionSupported(GLLibraryEGL::KHR_gl_texture_2D_image) &&
gl->IsExtensionSupported(GLContext::OES_EGL_image);
gl->IsExtensionSupported(GLContext::OES_EGL_image_external);
}
SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
@ -55,7 +67,8 @@ SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
const gfx::IntSize& size,
bool hasAlpha,
const GLFormats& formats,
GLuint prodTex)
GLuint prodTex,
EGLImage image)
: SharedSurface_GL(SharedSurfaceType::EGLImageShare,
AttachmentType::GLTexture,
gl,
@ -65,14 +78,10 @@ SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
, mEGL(egl)
, mFormats(formats)
, mProdTex(prodTex)
, mProdTexForPipe(0)
, mImage(0)
, mImage(image)
, mCurConsGL(nullptr)
, mConsTex(0)
, mSync(0)
, mPipeFailed(false)
, mPipeComplete(false)
, mPipeActive(false)
{}
SharedSurface_EGLImage::~SharedSurface_EGLImage()
@ -84,11 +93,6 @@ SharedSurface_EGLImage::~SharedSurface_EGLImage()
mGL->fDeleteTextures(1, &mProdTex);
mProdTex = 0;
if (mProdTexForPipe) {
mGL->fDeleteTextures(1, &mProdTexForPipe);
mProdTexForPipe = 0;
}
if (mConsTex) {
MOZ_ASSERT(mGarbageBin);
mGarbageBin->Trash(mConsTex);
@ -103,94 +107,12 @@ SharedSurface_EGLImage::~SharedSurface_EGLImage()
}
}
void
SharedSurface_EGLImage::LockProdImpl()
{
MutexAutoLock lock(mMutex);
if (!mPipeComplete)
return;
if (mPipeActive)
return;
mGL->BlitHelper()->BlitTextureToTexture(mProdTex, mProdTexForPipe, Size(), Size());
mGL->fDeleteTextures(1, &mProdTex);
mProdTex = mProdTexForPipe;
mProdTexForPipe = 0;
mPipeActive = true;
}
static bool
CreateTexturePipe(GLLibraryEGL* const egl, GLContext* const gl,
const GLFormats& formats, const gfx::IntSize& size,
GLuint* const out_tex, EGLImage* const out_image)
{
MOZ_ASSERT(out_tex && out_image);
*out_tex = 0;
*out_image = 0;
GLuint tex = CreateTextureForOffscreen(gl, formats, size);
if (!tex)
return false;
EGLContext context = GLContextEGL::Cast(gl)->GetEGLContext();
MOZ_ASSERT(context);
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(tex);
EGLImage image = egl->fCreateImage(egl->Display(), context,
LOCAL_EGL_GL_TEXTURE_2D, buffer,
nullptr);
if (!image) {
gl->fDeleteTextures(1, &tex);
return false;
}
// Success.
*out_tex = tex;
*out_image = image;
return true;
}
void
SharedSurface_EGLImage::Fence()
{
MutexAutoLock lock(mMutex);
mGL->MakeCurrent();
if (!mPipeActive) {
MOZ_ASSERT(!mSync);
MOZ_ASSERT(!mPipeComplete);
if (!mPipeFailed) {
if (!CreateTexturePipe(mEGL, mGL, mFormats, Size(),
&mProdTexForPipe, &mImage))
{
mPipeFailed = true;
}
}
if (!mPixels) {
SurfaceFormat format =
HasAlpha() ? SurfaceFormat::B8G8R8A8
: SurfaceFormat::B8G8R8X8;
mPixels = Factory::CreateDataSourceSurface(Size(), format);
}
DataSourceSurface::MappedSurface map;
mPixels->Map(DataSourceSurface::MapType::WRITE, &map);
nsRefPtr<gfxImageSurface> wrappedData =
new gfxImageSurface(map.mData,
ThebesIntSize(mPixels->GetSize()),
map.mStride,
SurfaceFormatToImageFormat(mPixels->GetFormat()));
ReadScreenIntoImageSurface(mGL, wrappedData);
mPixels->Unmap();
return;
}
MOZ_ASSERT(mPipeActive);
MOZ_ASSERT(mCurConsGL);
if (mEGL->IsExtensionSupported(GLLibraryEGL::KHR_fence_sync) &&
mGL->IsExtensionSupported(GLContext::OES_EGL_sync))
{
@ -249,42 +171,28 @@ SharedSurface_EGLImage::Display() const
return mEGL->Display();
}
GLuint
SharedSurface_EGLImage::AcquireConsumerTexture(GLContext* consGL)
void
SharedSurface_EGLImage::AcquireConsumerTexture(GLContext* consGL, GLuint* out_texture, GLuint* out_target)
{
MutexAutoLock lock(mMutex);
MOZ_ASSERT(!mCurConsGL || consGL == mCurConsGL);
if (mPipeFailed)
return 0;
if (mPipeActive) {
MOZ_ASSERT(mConsTex);
return mConsTex;
}
if (!mConsTex) {
consGL->fGenTextures(1, &mConsTex);
ScopedBindTexture autoTex(consGL, mConsTex);
consGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_2D, mImage);
MOZ_ASSERT(mConsTex);
ScopedBindTexture autoTex(consGL, mConsTex, LOCAL_GL_TEXTURE_EXTERNAL);
consGL->fEGLImageTargetTexture2D(LOCAL_GL_TEXTURE_EXTERNAL, mImage);
mPipeComplete = true;
mCurConsGL = consGL;
mGarbageBin = consGL->TexGarbageBin();
}
MOZ_ASSERT(consGL == mCurConsGL);
return 0;
*out_texture = mConsTex;
*out_target = LOCAL_GL_TEXTURE_EXTERNAL;
}
DataSourceSurface*
SharedSurface_EGLImage::GetPixels() const
{
MutexAutoLock lock(mMutex);
return mPixels;
}
SurfaceFactory_EGLImage*
SurfaceFactory_EGLImage::Create(GLContext* prodGL,
@ -292,6 +200,11 @@ SurfaceFactory_EGLImage::Create(GLContext* prodGL,
{
EGLContext context = GLContextEGL::Cast(prodGL)->GetEGLContext();
GLLibraryEGL* egl = &sEGLLibrary;
if (!SharedSurface_EGLImage::HasExtensions(egl, prodGL)) {
return nullptr;
}
return new SurfaceFactory_EGLImage(prodGL, context, caps);
}

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

@ -35,37 +35,34 @@ public:
return (SharedSurface_EGLImage*)surf;
}
static bool HasExtensions(GLLibraryEGL* egl, GLContext* gl);
protected:
mutable Mutex mMutex;
GLLibraryEGL* const mEGL;
const GLFormats mFormats;
GLuint mProdTex;
RefPtr<gfx::DataSourceSurface> mPixels;
GLuint mProdTexForPipe; // Moves to mProdTex when mPipeActive becomes true.
EGLImage mImage;
GLContext* mCurConsGL;
GLuint mConsTex;
nsRefPtr<TextureGarbageBin> mGarbageBin;
EGLSync mSync;
bool mPipeFailed; // Pipe creation failed, and has been abandoned.
bool mPipeComplete; // Pipe connects (mPipeActive ? mProdTex : mProdTexForPipe) to mConsTex.
bool mPipeActive; // Pipe is complete and in use for production.
SharedSurface_EGLImage(GLContext* gl,
GLLibraryEGL* egl,
const gfx::IntSize& size,
bool hasAlpha,
const GLFormats& formats,
GLuint prodTex);
GLuint prodTex,
EGLImage image);
EGLDisplay Display() const;
static bool HasExtensions(GLLibraryEGL* egl, GLContext* gl);
public:
virtual ~SharedSurface_EGLImage();
virtual void LockProdImpl();
virtual void LockProdImpl() {}
virtual void UnlockProdImpl() {}
@ -78,11 +75,8 @@ public:
}
// Implementation-specific functions below:
// Returns 0 if the pipe isn't ready. If 0, use GetPixels below.
GLuint AcquireConsumerTexture(GLContext* consGL);
// Will be void if AcquireConsumerTexture returns non-zero.
gfx::DataSourceSurface* GetPixels() const;
// Returns texture and target
void AcquireConsumerTexture(GLContext* consGL, GLuint* out_texture, GLuint* out_target);
};
@ -91,7 +85,7 @@ class SurfaceFactory_EGLImage
: public SurfaceFactory_GL
{
public:
// Infallible:
// Fallible:
static SurfaceFactory_EGLImage* Create(GLContext* prodGL,
const SurfaceCaps& caps);

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

@ -283,8 +283,24 @@ SharedSurface_Basic::SharedSurface_Basic(GLContext* gl,
gl,
size,
hasAlpha)
, mTex(tex)
, mTex(tex), mFB(0)
{
mGL->MakeCurrent();
mGL->fGenFramebuffers(1, &mFB);
ScopedBindFramebuffer autoFB(mGL, mFB);
mGL->fFramebufferTexture2D(LOCAL_GL_FRAMEBUFFER,
LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_TEXTURE_2D,
mTex,
0);
GLenum status = mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
mGL->fDeleteFramebuffers(1, &mFB);
mFB = 0;
}
mData = Factory::CreateDataSourceSurfaceWithStride(size, format,
GetAlignedStride<4>(size.width * BytesPerPixel(format)));
}
@ -294,16 +310,19 @@ SharedSurface_Basic::~SharedSurface_Basic()
if (!mGL->MakeCurrent())
return;
if (mFB)
mGL->fDeleteFramebuffers(1, &mFB);
mGL->fDeleteTextures(1, &mTex);
}
void
SharedSurface_Basic::Fence()
{
MOZ_ASSERT(mData->GetSize() == mGL->OffscreenSize());
mGL->MakeCurrent();
ScopedBindFramebuffer autoFB(mGL, mFB);
DataSourceSurface::MappedSurface map;
mData->Map(DataSourceSurface::MapType::WRITE, &map);
nsRefPtr<gfxImageSurface> wrappedData =
@ -311,7 +330,7 @@ SharedSurface_Basic::Fence()
ThebesIntSize(mData->GetSize()),
map.mStride,
SurfaceFormatToImageFormat(mData->GetFormat()));
ReadScreenIntoImageSurface(mGL, wrappedData);
ReadPixelsIntoImageSurface(mGL, wrappedData);
mData->Unmap();
}
@ -322,15 +341,24 @@ SharedSurface_GLTexture::Create(GLContext* prodGL,
GLContext* consGL,
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha)
bool hasAlpha,
GLuint texture)
{
MOZ_ASSERT(prodGL);
MOZ_ASSERT(!consGL || prodGL->SharesWith(consGL));
prodGL->MakeCurrent();
GLuint tex = CreateTextureForOffscreen(prodGL, formats, size);
return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex);
GLuint tex = texture;
bool ownsTex = false;
if (!tex) {
tex = CreateTextureForOffscreen(prodGL, formats, size);
ownsTex = true;
}
return new SharedSurface_GLTexture(prodGL, consGL, size, hasAlpha, tex, ownsTex);
}
SharedSurface_GLTexture::~SharedSurface_GLTexture()
@ -338,7 +366,9 @@ SharedSurface_GLTexture::~SharedSurface_GLTexture()
if (!mGL->MakeCurrent())
return;
mGL->fDeleteTextures(1, &mTex);
if (mOwnsTex) {
mGL->fDeleteTextures(1, &mTex);
}
if (mSync) {
mGL->fDeleteSync(mSync);

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

@ -6,6 +6,7 @@
#ifndef SHARED_SURFACE_GL_H_
#define SHARED_SURFACE_GL_H_
#include "ScopedGLHelpers.h"
#include "SharedSurface.h"
#include "SurfaceFactory.h"
#include "SurfaceTypes.h"
@ -135,6 +136,8 @@ public:
protected:
const GLuint mTex;
GLuint mFB;
RefPtr<gfx::DataSourceSurface> mData;
SharedSurface_Basic(GLContext* gl,
@ -192,7 +195,8 @@ public:
GLContext* consGL,
const GLFormats& formats,
const gfx::IntSize& size,
bool hasAlpha);
bool hasAlpha,
GLuint texture = 0);
static SharedSurface_GLTexture* Cast(SharedSurface* surf) {
MOZ_ASSERT(surf->Type() == SharedSurfaceType::GLTextureShare);
@ -203,6 +207,7 @@ public:
protected:
GLContext* mConsGL;
const GLuint mTex;
const bool mOwnsTex;
GLsync mSync;
mutable Mutex mMutex;
@ -210,7 +215,8 @@ protected:
GLContext* consGL,
const gfx::IntSize& size,
bool hasAlpha,
GLuint tex)
GLuint tex,
bool ownsTex)
: SharedSurface_GL(SharedSurfaceType::GLTextureShare,
AttachmentType::GLTexture,
prodGL,
@ -218,6 +224,7 @@ protected:
hasAlpha)
, mConsGL(consGL)
, mTex(tex)
, mOwnsTex(ownsTex)
, mSync(0)
, mMutex("SharedSurface_GLTexture mutex")
{

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

@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "skia/GrContext.h"
#include "skia/GrGLInterface.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/ThreadLocal.h"
@ -16,9 +17,11 @@
#endif
#include "GLContext.h"
#include "SkiaGLGlue.h"
using mozilla::gl::GLContext;
using mozilla::gl::GLFeature;
using mozilla::gl::SkiaGLGlue;
using mozilla::gfx::DrawTarget;
static mozilla::ThreadLocal<GLContext*> sGLContext;
@ -27,8 +30,8 @@ extern "C" {
void EnsureGLContext(const GrGLInterface* i)
{
const DrawTarget* drawTarget = reinterpret_cast<const DrawTarget*>(i->fCallbackData);
GLContext* gl = static_cast<GLContext*>(drawTarget->GetGLContext());
const SkiaGLGlue* contextSkia = reinterpret_cast<const SkiaGLGlue*>(i->fCallbackData);
GLContext* gl = contextSkia->GetGLContext();
gl->MakeCurrent();
if (!sGLContext.initialized()) {
@ -775,7 +778,7 @@ GrGLvoid glVertexPointer_mozilla(GrGLint size, GrGLenum type, GrGLsizei stride,
} // extern "C"
GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
static GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
{
GrGLInterface* i = new GrGLInterface();
i->fCallback = EnsureGLContext;
@ -934,3 +937,14 @@ GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
return i;
}
SkiaGLGlue::SkiaGLGlue(GLContext* context)
: mGLContext(context)
{
SkAutoTUnref<GrGLInterface> i(CreateGrGLInterfaceFromGLContext(mGLContext));
i->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
mGrGLInterface = i;
SkAutoTUnref<GrContext> gr(GrContext::Create(kOpenGL_GrBackend, (GrBackendContext)mGrGLInterface.get()));
mGrContext = gr;
}

64
gfx/gl/SkiaGLGlue.h Executable file
Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/RefPtr.h"
#ifdef USE_SKIA_GPU
#include "GLContext.h"
#include "skia/GrGLInterface.h"
#include "skia/GrContext.h"
namespace mozilla {
namespace gl {
class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
SkiaGLGlue(GLContext* context);
GLContext* GetGLContext() const { return mGLContext.get(); }
GrContext* GetGrContext() const { return mGrContext.get(); }
protected:
virtual ~SkiaGLGlue() {
/*
* These members have inter-dependencies, but do not keep each other alive, so
* destruction order is very important here: mGrContext uses mGrGLInterface, and
* through it, uses mGLContext
*/
mGrContext = nullptr;
mGrGLInterface = nullptr;
mGLContext = nullptr;
}
private:
RefPtr<GLContext> mGLContext;
SkRefPtr<GrGLInterface> mGrGLInterface;
SkRefPtr<GrContext> mGrContext;
};
}
}
#else
class GrContext;
namespace mozilla {
namespace gl {
class GLContext;
class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
SkiaGLGlue(GLContext* context);
GLContext* GetGLContext() const { return nullptr; }
GrContext* GetGrContext() const { return nullptr; }
};
}
}
#endif

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

@ -7,6 +7,7 @@
#include "gfxPoint.h"
#include "SharedSurface.h"
#include "SharedSurfaceGL.h"
#include "SurfaceFactory.h"
#include "GeckoProfiler.h"
@ -53,6 +54,22 @@ SurfaceStream::CreateForType(SurfaceStreamType type, mozilla::gl::GLContext* glC
return result;
}
bool
SurfaceStream_TripleBuffer::CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory)
{
if (!mProducer) {
New(factory, src->Size(), mProducer);
if (!mProducer) {
return false;
}
}
MOZ_ASSERT(src->Size() == mProducer->Size(), "Size mismatch");
SharedSurface::Copy(src, mProducer, factory);
return true;
}
void
SurfaceStream::New(SurfaceFactory* factory, const gfx::IntSize& size,
SharedSurface*& surf)

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

@ -11,6 +11,7 @@
#include "mozilla/Monitor.h"
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/GenericRefCounted.h"
#include "SurfaceTypes.h"
namespace mozilla {
@ -24,7 +25,7 @@ class SharedSurface;
class SurfaceFactory;
// Owned by: ScreenBuffer
class SurfaceStream
class SurfaceStream : public GenericAtomicRefCounted
{
public:
typedef enum {
@ -50,6 +51,8 @@ public:
const SurfaceStreamType mType;
mozilla::gl::GLContext* GLContext() const { return mGLContext; }
protected:
// |mProd| is owned by us, but can be ripped away when
// creating a new GLStream from this one.
@ -121,6 +124,8 @@ public:
virtual SharedSurface* Resize(SurfaceFactory* factory, const gfx::IntSize& size);
virtual bool CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory) { MOZ_ASSERT(0); return false; }
protected:
// SwapCons will return the same surface more than once,
// if nothing new has been published.
@ -189,6 +194,7 @@ protected:
public:
SurfaceStream_TripleBuffer(SurfaceStream* prevStream);
virtual ~SurfaceStream_TripleBuffer();
virtual bool CopySurfaceToProducer(SharedSurface* src, SurfaceFactory* factory);
private:
// Common constructor code.

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

@ -75,9 +75,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'SharedSurfaceANGLE.cpp',
]
if CONFIG['MOZ_ENABLE_SKIA_GPU']:
EXPORTS += ['GLContextSkia.h']
EXPORTS += ['SkiaGLGlue.h']
UNIFIED_SOURCES += [
'GLContextSkia.cpp',
'SkiaGLGlue.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':

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

@ -32,6 +32,7 @@ namespace layers {
CopyableCanvasLayer::CopyableCanvasLayer(LayerManager* aLayerManager, void *aImplData) :
CanvasLayer(aLayerManager, aImplData)
, mStream(nullptr)
{
MOZ_COUNT_CTOR(CopyableCanvasLayer);
}
@ -48,6 +49,7 @@ CopyableCanvasLayer::Initialize(const Data& aData)
if (aData.mGLContext) {
mGLContext = aData.mGLContext;
mStream = aData.mStream;
mIsGLAlphaPremult = aData.mIsGLAlphaPremult;
mNeedsYFlip = true;
MOZ_ASSERT(mGLContext->IsOffscreen(), "canvas gl context isn't offscreen");
@ -70,7 +72,7 @@ CopyableCanvasLayer::Initialize(const Data& aData)
bool
CopyableCanvasLayer::IsDataValid(const Data& aData)
{
return mGLContext == aData.mGLContext;
return mGLContext == aData.mGLContext && mStream == aData.mStream;
}
void

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

@ -22,6 +22,13 @@
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
namespace mozilla {
namespace gfx {
class SurfaceStream;
class SharedSurface;
class SurfaceFactory;
}
namespace layers {
class CanvasClientWebGL;
@ -54,6 +61,8 @@ protected:
nsRefPtr<mozilla::gl::GLContext> mGLContext;
mozilla::RefPtr<mozilla::gfx::DrawTarget> mDrawTarget;
RefPtr<gfx::SurfaceStream> mStream;
uint32_t mCanvasFramebuffer;
bool mIsGLAlphaPremult;

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

@ -63,6 +63,7 @@ class GLContext;
namespace gfx {
class DrawTarget;
class SurfaceStream;
}
namespace css {
@ -595,12 +596,19 @@ public:
bool IsInTransaction() const { return mInTransaction; }
virtual void AddRegionToClear(const nsIntRegion& aRegion)
{
mRegionToClear.Or(mRegionToClear, aRegion);
}
protected:
nsRefPtr<Layer> mRoot;
gfx::UserData mUserData;
bool mDestroyed;
bool mSnapEffectiveTransforms;
nsIntRegion mRegionToClear;
// Print interesting information about this into aTo. Internally
// used to implement Dump*() and Log*().
virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix);
@ -1334,6 +1342,7 @@ public:
virtual LayerRenderState GetRenderState() { return LayerRenderState(); }
void Mutated()
{
mManager->Mutated(this);
@ -1796,6 +1805,8 @@ public:
Data()
: mDrawTarget(nullptr)
, mGLContext(nullptr)
, mStream(nullptr)
, mTexID(0)
, mSize(0,0)
, mIsGLAlphaPremult(false)
{ }
@ -1804,6 +1815,12 @@ public:
mozilla::gfx::DrawTarget *mDrawTarget; // a DrawTarget for the canvas contents
mozilla::gl::GLContext* mGLContext; // or this, for GL.
// Canvas/SkiaGL uses this
mozilla::gfx::SurfaceStream* mStream;
// ID of the texture backing the canvas layer (defaults to 0)
uint32_t mTexID;
// The size of the canvas content
nsIntSize mSize;

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

@ -625,6 +625,16 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
}
PaintLayer(mTarget, mRoot, aCallback, aCallbackData, nullptr);
if (!mRegionToClear.IsEmpty()) {
AutoSetOperator op(mTarget, gfxContext::OPERATOR_CLEAR);
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
while ((r = iter.Next())) {
mTarget->NewPath();
mTarget->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
mTarget->Fill();
}
}
if (mWidget) {
FlashWidgetUpdateArea(mTarget);
}

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

@ -116,7 +116,18 @@ void
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
SurfaceStream* stream = screen->Stream();
SurfaceStream* stream = nullptr;
if (aLayer->mStream) {
stream = aLayer->mStream;
// Copy our current surface to the current producer surface in our stream, then
// call SwapProducer to make a new buffer ready.
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
} else {
stream = screen->Stream();
}
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
bool bufferCreated = false;
@ -255,7 +266,15 @@ DeprecatedCanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLaye
mDeprecatedTextureClient->EnsureAllocated(aSize, gfxContentType::COLOR);
GLScreenBuffer* screen = aLayer->mGLContext->Screen();
SurfaceStream* stream = screen->Stream();
SurfaceStream* stream = nullptr;
if (aLayer->mStream) {
stream = aLayer->mStream;
stream->CopySurfaceToProducer(aLayer->mTextureSurface, aLayer->mFactory);
stream->SwapProducer(aLayer->mFactory, gfx::IntSize(aSize.width, aSize.height));
} else {
stream = screen->Stream();
}
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
if (isCrossProcess) {

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

@ -33,15 +33,34 @@ using namespace mozilla::gl;
namespace mozilla {
namespace layers {
ClientCanvasLayer::~ClientCanvasLayer()
{
MOZ_COUNT_DTOR(ClientCanvasLayer);
if (mCanvasClient) {
mCanvasClient->OnDetach();
mCanvasClient = nullptr;
}
if (mTextureSurface) {
delete mTextureSurface;
}
}
void
ClientCanvasLayer::Initialize(const Data& aData)
{
CopyableCanvasLayer::Initialize(aData);
mCanvasClient = nullptr;
if (mGLContext) {
GLScreenBuffer* screen = mGLContext->Screen();
SurfaceCaps caps = screen->Caps();
if (mStream) {
// The screen caps are irrelevant if we're using a separate stream
caps = GetContentFlags() & CONTENT_OPAQUE ? SurfaceCaps::ForRGB() : SurfaceCaps::ForRGBA();
}
SurfaceStreamType streamType =
SurfaceStream::ChooseGLStreamType(SurfaceStream::OffMainThread,
screen->PreserveBuffer());
@ -53,11 +72,11 @@ ClientCanvasLayer::Initialize(const Data& aData)
if (!isCrossProcess) {
// [Basic/OGL Layers, OMTC] WebGL layer init.
factory = SurfaceFactory_EGLImage::Create(mGLContext, screen->Caps());
factory = SurfaceFactory_EGLImage::Create(mGLContext, caps);
} else {
// [Basic/OGL Layers, OOPC] WebGL layer init. (Out Of Process Compositing)
#ifdef MOZ_WIDGET_GONK
factory = new SurfaceFactory_Gralloc(mGLContext, screen->Caps(), ClientManager()->AsShadowForwarder());
factory = new SurfaceFactory_Gralloc(mGLContext, caps, ClientManager()->AsShadowForwarder());
#else
// we could do readback here maybe
NS_NOTREACHED("isCrossProcess but not on native B2G!");
@ -67,15 +86,35 @@ ClientCanvasLayer::Initialize(const Data& aData)
// [Basic Layers, OMTC] WebGL layer init.
// Well, this *should* work...
#ifdef XP_MACOSX
factory = new SurfaceFactory_IOSurface(mGLContext, screen->Caps());
factory = new SurfaceFactory_IOSurface(mGLContext, caps);
#else
factory = new SurfaceFactory_GLTexture(mGLContext, nullptr, screen->Caps());
factory = new SurfaceFactory_GLTexture(mGLContext, nullptr, caps);
#endif
}
}
}
if (factory) {
if (mStream) {
// We're using a stream other than the one in the default screen
mFactory = factory;
if (!mFactory) {
// Absolutely must have a factory here, so create a basic one
mFactory = new SurfaceFactory_Basic(mGLContext, caps);
}
gfx::IntSize size = gfx::IntSize(aData.mSize.width, aData.mSize.height);
mTextureSurface = SharedSurface_GLTexture::Create(mGLContext, mGLContext,
mGLContext->GetGLFormats(),
size, caps.alpha, aData.mTexID);
SharedSurface* producer = mStream->SwapProducer(mFactory, size);
if (!producer) {
// Fallback to basic factory
delete mFactory;
mFactory = new SurfaceFactory_Basic(mGLContext, caps);
producer = mStream->SwapProducer(mFactory, size);
MOZ_ASSERT(producer, "Failed to create initial canvas surface with basic factory");
}
} else if (factory) {
screen->Morph(factory, streamType);
}
}

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

@ -33,17 +33,12 @@ public:
ClientCanvasLayer(ClientLayerManager* aLayerManager) :
CopyableCanvasLayer(aLayerManager,
static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
, mTextureSurface(nullptr)
, mFactory(nullptr)
{
MOZ_COUNT_CTOR(ClientCanvasLayer);
}
virtual ~ClientCanvasLayer()
{
MOZ_COUNT_DTOR(ClientCanvasLayer);
if (mCanvasClient) {
mCanvasClient->OnDetach();
mCanvasClient = nullptr;
}
}
virtual ~ClientCanvasLayer();
virtual void SetVisibleRegion(const nsIntRegion& aRegion)
{
@ -97,6 +92,9 @@ protected:
RefPtr<CanvasClient> mCanvasClient;
gfx::SharedSurface* mTextureSurface;
gfx::SurfaceFactory* mFactory;
friend class DeprecatedCanvasClient2D;
friend class CanvasClient2D;
friend class DeprecatedCanvasClientSurfaceStream;

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

@ -709,6 +709,30 @@ LayerManagerD3D10::Render(EndTransactionFlags aFlags)
static_cast<LayerD3D10*>(mRoot->ImplData())->RenderLayer();
if (!mRegionToClear.IsEmpty()) {
float color[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
gfx::Matrix4x4 transform;
effect()->GetVariableByName("mLayerTransform")->SetRawValue(&transform, 0, 64);
effect()->GetVariableByName("fLayerColor")->AsVector()->SetFloatVector(color);
ID3D10EffectTechnique *technique = effect()->GetTechniqueByName("RenderClearLayer");
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
while ((r = iter.Next())) {
effect()->GetVariableByName("vLayerQuad")->AsVector()->SetFloatVector(
ShaderConstantRectD3D10(
(float)r->x,
(float)r->y,
(float)r->width,
(float)r->height)
);
technique->GetPassByIndex(0)->Apply(0);
device()->Draw(4, 0);
}
}
// See bug 630197 - we have some reasons to believe if an earlier call
// returned an error, the upcoming present call may raise an exception.
// This will check if any of the calls done recently has returned an error

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

@ -448,6 +448,18 @@ technique10 RenderSolidColorLayer
}
}
technique10 RenderClearLayer
{
pass P0
{
SetRasterizerState( LayerRast );
SetBlendState( NoBlendDual, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
SetVertexShader( CompileShader( vs_4_0_level_9_3, LayerQuadVS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0_level_9_3, SolidColorShader() ) );
}
}
technique10 PrepareAlphaExtractionTextures
{
pass P0

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -261,6 +261,25 @@ LayerManagerD3D9::Render()
static_cast<LayerD3D9*>(mRoot->ImplData())->RenderLayer();
if (!mRegionToClear.IsEmpty()) {
D3DRECT* rects = new D3DRECT[mRegionToClear.GetNumRects()];
nsIntRegionRectIterator iter(mRegionToClear);
const nsIntRect *r;
size_t i = 0;
while ((r = iter.Next())) {
rects[i].x1 = r->x;
rects[i].y1 = r->y;
rects[i].x2 = r->x + r->width;
rects[i].y2 = r->y + r->height;
i++;
}
device()->Clear(i, rects, D3DCLEAR_TARGET,
0x00000000, 0, 0);
delete [] rects;
}
device()->EndScene();
if (!mTarget) {

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

@ -86,7 +86,6 @@ SharedTextureClientOGL::IsAllocated() const
StreamTextureClientOGL::StreamTextureClientOGL(TextureFlags aFlags)
: TextureClient(aFlags)
, mStream(0)
, mIsLocked(false)
{
}
@ -131,6 +130,7 @@ StreamTextureClientOGL::InitWith(gfx::SurfaceStream* aStream)
{
MOZ_ASSERT(!IsAllocated());
mStream = aStream;
mGL = mStream->GLContext();
}
bool

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

@ -97,8 +97,9 @@ public:
virtual gfx::IntSize GetSize() const { return gfx::IntSize(); }
protected:
gfx::SurfaceStream* mStream;
bool mIsLocked;
RefPtr<gfx::SurfaceStream> mStream;
RefPtr<gl::GLContext> mGL;
};
} // namespace

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

@ -515,15 +515,10 @@ StreamTextureSourceOGL::RetrieveTextureFromStream()
SharedSurface_EGLImage* eglImageSurf =
SharedSurface_EGLImage::Cast(sharedSurf);
mTextureHandle = eglImageSurf->AcquireConsumerTexture(gl());
mTextureTarget = eglImageSurf->TextureTarget();
if (!mTextureHandle) {
toUpload = eglImageSurf->GetPixels();
MOZ_ASSERT(toUpload);
} else {
mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
: SurfaceFormat::R8G8B8X8;
}
eglImageSurf->AcquireConsumerTexture(gl(), &mTextureHandle, &mTextureTarget);
MOZ_ASSERT(mTextureHandle);
mFormat = sharedSurf->HasAlpha() ? SurfaceFormat::R8G8B8A8
: SurfaceFormat::R8G8B8X8;
break;
}
#ifdef XP_MACOSX

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

@ -1,54 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
ifeq (86,$(findstring 86,$(OS_TEST)))
CSRCS += transform-sse2.c
ifdef _MSC_VER
ifneq ($(OS_ARCH)_$(OS_TEST),WINNT_x86_64)
CSRCS += transform-sse1.c
endif
else
CSRCS += transform-sse1.c
ifdef GNU_CC
SSE1_FLAGS=-msse
SSE2_FLAGS=-msse2
else
ifeq ($(SOLARIS_SUNPRO_CC),1)
ifneq (64,$(findstring 64,$(OS_TEST)))
SSE1_FLAGS=-xarch=sse
SSE2_FLAGS=-xarch=sse2
else
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SSE1_FLAGS= -xO4
SSE2_FLAGS= -xO4
endif
else
SSE1_FLAGS=
SSE2_FLAGS=
endif
endif
endif
else
ifeq (ppc,$(findstring ppc,$(CPU_ARCH)))
ifdef GNU_CC
CSRCS += transform-altivec.c
ALTIVEC_FLAGS=-maltivec
endif
endif
endif
include $(topsrcdir)/config/rules.mk
# Disable spammy "missing initializer" GCC warning
ifdef GNU_CC
CFLAGS += -Wno-missing-field-initializers
endif # GNU_CC
# special rules for transform-sse*.c to get the right cflags. (taken from pixman/src/Makefile.in)
transform-sse1.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(SSE1_FLAGS)
transform-sse2.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(SSE2_FLAGS)
transform-altivec.$(OBJ_SUFFIX): COMPILE_CFLAGS += $(ALTIVEC_FLAGS)

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

@ -20,3 +20,48 @@ SOURCES += [
MSVC_ENABLE_PGO = True
FINAL_LIBRARY = 'gkmedias'
if CONFIG['GNU_CC']:
CFLAGS += ['-Wno-missing-field-initializers']
use_sse1 = False
use_sse2 = False
use_altivec = False
if '86' in CONFIG['OS_TEST']:
use_sse2 = True
if CONFIG['_MSC_VER']:
if CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['OS_TEST'] != 'x86_64':
use_sse1 = True
else:
use_sse1 = True
elif 'ppc' in CONFIG['CPU_ARCH']:
if CONFIG['GNU_CC']:
use_altivec = True
if use_sse1:
SOURCES += ['transform-sse1.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse1.c'].flags += ['-msse']
elif CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SOURCES['transform-sse1.c'].flags += ['-xO4']
else:
SOURCES['transform-sse1.c'].flags += ['-xarch=sse']
if use_sse2:
SOURCES += ['transform-sse2.c']
if CONFIG['GNU_CC']:
SOURCES['transform-sse2.c'].flags += ['-msse2']
elif CONFIG['SOLARIS_SUNPRO_CC']:
if '64' in CONFIG['OS_TEST']:
# Sun Studio doesn't work correctly for x86 intristics
# with -m64 and without optimization.
SOURCES['transform-sse2.c'].flags += ['-xO4']
else:
SOURCES['transform-sse2.c'].flags += ['-xarch=sse2']
if use_altivec:
SOURCES += ['transform-altivec.c']
SOURCES['transform-altivec.c'].flags += ['-maltivec']

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

@ -17,19 +17,6 @@ endif
include $(topsrcdir)/config/rules.mk
ifneq (,$(INTEL_ARCHITECTURE))
ifdef GNU_CC
SkBitmapFilter_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBitmapProcState_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBitmapProcState_opts_SSSE3.$(OBJ_SUFFIX): CXXFLAGS+=-mssse3
SkBlitRect_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBlitRow_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkBlurImage_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkMorphology_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
SkUtils_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
endif
endif
ifeq ($(CPU_ARCH)_$(GNU_CC),arm_1)
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
# ARM), the compiler doesn't like that.

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

@ -67,6 +67,16 @@ if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or \
CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
DEFINES['GR_DLL'] = 1

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

@ -847,9 +847,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'qt', 'gonk', 'co
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
DEFINES['SK_BUILD_SSSE3'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or CONFIG['MOZ_WIDGET_GTK'] or CONFIG['MOZ_WIDGET_QT']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
@ -857,5 +854,15 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
DEFINES['SKIA_DLL'] = 1
DEFINES['GR_DLL'] = 1
if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['GNU_CC']:
SOURCES['trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp'].flags += ['-mssse3']
SOURCES['trunk/src/opts/SkBlitRect_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlitRow_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkBlurImage_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkMorphology_opts_SSE2.cpp'].flags += ['-msse2']
SOURCES['trunk/src/opts/SkUtils_opts_SSE2.cpp'].flags += ['-msse2']
DEFINES['SKIA_IMPLEMENTATION'] = 1
DEFINES['GR_IMPLEMENTATION'] = 1

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

@ -16,6 +16,7 @@
struct nsRect;
struct nsIntRect;
struct nsIntSize;
class nsIntRegion;
struct nsFont;
struct nsIntMargin;
class nsPresContext;
@ -29,8 +30,8 @@ class nsIWidget;
// IID for the nsITheme interface
// {b0f3efe9-0bd4-4f6b-8daa-0ec7f6006822}
#define NS_ITHEME_IID \
{ 0x3ca584e6, 0xdcd6, 0x485b, \
{ 0x88, 0x8c, 0xe3, 0x47, 0x3d, 0xe4, 0xd9, 0x58 } }
{ 0x2e49c679, 0x2130, 0x432c, \
{ 0x92, 0xcb, 0xd4, 0x8e, 0x9a, 0xe2, 0x34, 0x75 } }
// {D930E29B-6909-44e5-AB4B-AF10D6923705}
#define NS_THEMERENDERER_CID \
{ 0x9020805b, 0x14a3, 0x4125, \
@ -62,7 +63,8 @@ public:
nsIFrame* aFrame,
uint8_t aWidgetType,
const nsRect& aRect,
const nsRect& aDirtyRect) = 0;
const nsRect& aDirtyRect,
nsIntRegion* aRegionToClear = nullptr) = 0;
/**
* Get the computed CSS border for the widget, in pixels.

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

@ -22,6 +22,10 @@
#include "gfxPrefs.h"
#include "cairo.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidBridge.h"
#endif
#include "ft2build.h"
#include FT_FREETYPE_H
#include FT_MODULE_H
@ -418,3 +422,16 @@ gfxAndroidPlatform::GetScreenDepth() const
{
return mScreenDepth;
}
bool
gfxAndroidPlatform::UseAcceleratedSkiaCanvas()
{
#ifdef MOZ_WIDGET_ANDROID
if (AndroidBridge::Bridge()->GetAPIVersion() < 11) {
// It's slower than software due to not having a compositing fast path
return false;
}
#endif
return gfxPlatform::UseAcceleratedSkiaCanvas();
}

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

@ -81,6 +81,8 @@ public:
virtual int GetScreenDepth() const;
virtual bool UseAcceleratedSkiaCanvas() MOZ_OVERRIDE;
private:
int mScreenDepth;
gfxImageFormat mOffscreenFormat;

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

@ -76,6 +76,9 @@
#ifdef USE_SKIA
#include "mozilla/Hal.h"
#include "skia/SkGraphics.h"
#include "SkiaGLGlue.h"
#endif
#include "mozilla/Preferences.h"
@ -104,7 +107,10 @@ static qcms_transform *gCMSRGBATransform = nullptr;
static bool gCMSInitialized = false;
static eCMSMode gCMSMode = eCMSMode_Off;
static int gCMSIntent = -2;
static bool gCMSIntentInitialized = false;
static int gCMSIntent = QCMS_INTENT_DEFAULT;
static void ShutdownCMS();
@ -138,12 +144,7 @@ NS_IMPL_ISUPPORTS2(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference)
#define BIDI_NUMERAL_PREF "bidi.numeral"
#define GFX_PREF_CMS_RENDERING_INTENT "gfx.color_management.rendering_intent"
#define GFX_PREF_CMS_DISPLAY_PROFILE "gfx.color_management.display_profile"
#define GFX_PREF_CMS_ENABLED_OBSOLETE "gfx.color_management.enabled"
#define GFX_PREF_CMS_FORCE_SRGB "gfx.color_management.force_srgb"
#define GFX_PREF_CMS_ENABLEV4 "gfx.color_management.enablev4"
#define GFX_PREF_CMS_MODE "gfx.color_management.mode"
NS_IMETHODIMP
SRGBOverrideObserver::Observe(nsISupports *aSubject,
@ -204,6 +205,8 @@ MemoryPressureObserver::Observe(nsISupports *aSubject,
{
NS_ASSERTION(strcmp(aTopic, "memory-pressure") == 0, "unexpected event topic");
Factory::PurgeAllCaches();
gfxPlatform::GetPlatform()->PurgeSkiaCache();
return NS_OK;
}
@ -268,6 +271,8 @@ gfxPlatform::gfxPlatform()
mLayersUseDeprecated = false;
#endif
mSkiaGlue = nullptr;
uint32_t canvasMask = BackendTypeBit(BackendType::CAIRO) | BackendTypeBit(BackendType::SKIA);
uint32_t contentMask = BackendTypeBit(BackendType::CAIRO);
InitBackendPrefs(canvasMask, BackendType::CAIRO,
@ -424,10 +429,6 @@ gfxPlatform::Init()
CreateCMSOutputProfile();
#ifdef USE_SKIA
gPlatform->InitializeSkiaCaches();
#endif
// Listen to memory pressure event so we can purge DrawTarget caches
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
@ -827,9 +828,8 @@ gfxPlatform::UseAcceleratedSkiaCanvas()
}
void
gfxPlatform::InitializeSkiaCaches()
gfxPlatform::InitializeSkiaCacheLimits()
{
#ifdef USE_SKIA_GPU
if (UseAcceleratedSkiaCanvas()) {
bool usingDynamicCache = gfxPrefs::CanvasSkiaGLDynamicCache();
int cacheItemLimit = gfxPrefs::CanvasSkiaGLCacheItems();
@ -849,12 +849,47 @@ gfxPlatform::InitializeSkiaCaches()
}
}
#ifdef DEBUG
#ifdef DEBUG
printf_stderr("Determined SkiaGL cache limits: Size %i, Items: %i\n", cacheSizeLimit, cacheItemLimit);
#endif
mSkiaGlue->GetGrContext()->setTextureCacheLimits(cacheItemLimit, cacheSizeLimit);
}
}
mozilla::gl::SkiaGLGlue*
gfxPlatform::GetSkiaGLGlue()
{
#ifdef USE_SKIA_GPU
if (!mSkiaGlue) {
/* Dummy context. We always draw into a FBO.
*
* FIXME: This should be stored in TLS or something, since there needs to be one for each thread using it. As it
* stands, this only works on the main thread.
*/
mozilla::gfx::SurfaceCaps caps = mozilla::gfx::SurfaceCaps::ForRGBA();
nsRefPtr<mozilla::gl::GLContext> glContext = mozilla::gl::GLContextProvider::CreateOffscreen(gfxIntSize(16, 16), caps);
if (!glContext) {
printf_stderr("Failed to create GLContext for SkiaGL!\n");
return nullptr;
}
mSkiaGlue = new mozilla::gl::SkiaGLGlue(glContext);
MOZ_ASSERT(mSkiaGlue->GetGrContext(), "No GrContext");
InitializeSkiaCacheLimits();
}
#endif
Factory::SetGlobalSkiaCacheLimits(cacheItemLimit, cacheSizeLimit);
}
return mSkiaGlue;
}
void
gfxPlatform::PurgeSkiaCache()
{
#ifdef USE_SKIA_GPU
if (!mSkiaGlue)
return;
mSkiaGlue->GetGrContext()->freeGpuResources();
#endif
}
@ -1500,17 +1535,14 @@ gfxPlatform::GetCMSMode()
{
if (gCMSInitialized == false) {
gCMSInitialized = true;
nsresult rv;
int32_t mode;
rv = Preferences::GetInt(GFX_PREF_CMS_MODE, &mode);
if (NS_SUCCEEDED(rv) && (mode >= 0) && (mode < eCMSMode_AllCount)) {
int32_t mode = gfxPrefs::CMSMode();
if (mode >= 0 && mode < eCMSMode_AllCount) {
gCMSMode = static_cast<eCMSMode>(mode);
}
bool enableV4;
rv = Preferences::GetBool(GFX_PREF_CMS_ENABLEV4, &enableV4);
if (NS_SUCCEEDED(rv) && enableV4) {
bool enableV4 = gfxPrefs::CMSEnableV4();
if (enableV4) {
qcms_enable_iccv4();
}
}
@ -1520,23 +1552,22 @@ gfxPlatform::GetCMSMode()
int
gfxPlatform::GetRenderingIntent()
{
if (gCMSIntent == -2) {
if (!gCMSIntentInitialized) {
gCMSIntentInitialized = true;
// gfxPrefs.h is using 0 as the default for the rendering
// intent preference, based on that being the value for
// QCMS_INTENT_DEFAULT. Assert here to catch if that ever
// changes and we can then figure out what to do about it.
MOZ_ASSERT(QCMS_INTENT_DEFAULT == 0);
/* Try to query the pref system for a rendering intent. */
int32_t pIntent;
if (NS_SUCCEEDED(Preferences::GetInt(GFX_PREF_CMS_RENDERING_INTENT, &pIntent))) {
/* If the pref is within range, use it as an override. */
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
}
int32_t pIntent = gfxPrefs::CMSRenderingIntent();
if ((pIntent >= QCMS_INTENT_MIN) && (pIntent <= QCMS_INTENT_MAX)) {
gCMSIntent = pIntent;
} else {
/* If the pref is out of range, use embedded profile. */
else {
gCMSIntent = -1;
}
}
/* If we didn't get a valid intent from prefs, use the default. */
else {
gCMSIntent = QCMS_INTENT_DEFAULT;
gCMSIntent = -1;
}
}
return gCMSIntent;

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

@ -40,6 +40,7 @@ struct gfxRGBA;
namespace mozilla {
namespace gl {
class GLContext;
class SkiaGLGlue;
}
namespace gfx {
class DrawTarget;
@ -283,8 +284,7 @@ public:
}
virtual bool UseAcceleratedSkiaCanvas();
virtual void InitializeSkiaCaches();
virtual void InitializeSkiaCacheLimits();
void GetAzureBackendInfo(mozilla::widget::InfoObject &aObj) {
aObj.DefineProperty("AzureCanvasBackend", GetBackendName(mPreferredCanvasBackend));
@ -598,6 +598,9 @@ public:
bool PreferMemoryOverShmem() const;
bool UseDeprecatedTextures() const { return mLayersUseDeprecated; }
mozilla::gl::SkiaGLGlue* GetSkiaGLGlue();
void PurgeSkiaCache();
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -711,6 +714,7 @@ private:
mozilla::RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
bool mLayersPreferMemoryOverShmem;
bool mLayersUseDeprecated;
mozilla::RefPtr<mozilla::gl::SkiaGLGlue> mSkiaGlue;
};
#endif /* GFX_PLATFORM_H */

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

@ -118,6 +118,11 @@ private:
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);
DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
// The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
DECL_GFX_PREF(Live, "gfx.color_management.rendering_intent", CMSRenderingIntent, int32_t, 0);
DECL_GFX_PREF(Once, "gfx.direct2d.disabled", Direct2DDisabled, bool, false);
DECL_GFX_PREF(Once, "gfx.direct2d.force-enabled", Direct2DForceEnabled, bool, false);
DECL_GFX_PREF(Live, "gfx.gralloc.fence-with-readpixels", GrallocFenceWithReadPixels, bool, false);

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

@ -23,6 +23,7 @@
#include "nsIScriptSecurityManager.h"
#include "ImageFactory.h"
#include "gfxPrefs.h"
namespace mozilla {
namespace image {
@ -38,6 +39,8 @@ ImageFactory::Initialize()
{
MOZ_ASSERT(NS_IsMainThread());
if (!gInitializedPrefCaches) {
// Initialize the graphics preferences
gfxPrefs::GetSingleton();
Preferences::AddBoolVarCache(&gDiscardable, "image.mem.discardable");
Preferences::AddBoolVarCache(&gDecodeOnDraw, "image.mem.decodeondraw");
Preferences::AddBoolVarCache(&gEnableMozSampleSize, "image.mozsamplesize.enabled");

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

@ -14,6 +14,8 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsIDOMEvent.h"
#include "nsIPresShell.h"
#include "nsIStreamListener.h"
@ -680,7 +682,16 @@ VectorImage::GetFrame(uint32_t aWhichFrame,
nsRefPtr<gfxImageSurface> surface =
new gfxImageSurface(surfaceSize, gfxImageFormat::ARGB32);
nsRefPtr<gfxContext> context = new gfxContext(surface);
RefPtr<DrawTarget> drawTarget =
Factory::CreateDrawTargetForData(BackendType::CAIRO,
surface->Data(),
IntSize(imageIntSize.width,
imageIntSize.height),
surface->Stride(),
SurfaceFormat::B8G8R8A8);
nsRefPtr<gfxContext> context = new gfxContext(drawTarget);
// Draw to our surface!
// --------------------

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

@ -115,44 +115,30 @@ enum {
namespace JS {
struct ClassInfo
// Data for tracking memory usage of things hanging off objects.
struct ObjectsExtraSizes
{
#define FOR_EACH_SIZE(macro) \
macro(Objects, IsLiveGCThing, objectsGCHeap) \
macro(Objects, NotLiveGCThing, objectsMallocHeapSlots) \
macro(Objects, NotLiveGCThing, objectsMallocHeapElementsNonAsmJS) \
macro(Objects, NotLiveGCThing, objectsMallocHeapElementsAsmJS) \
macro(Objects, NotLiveGCThing, objectsNonHeapElementsAsmJS) \
macro(Objects, NotLiveGCThing, objectsNonHeapCodeAsmJS) \
macro(Objects, NotLiveGCThing, objectsMallocHeapMisc) \
\
macro(Other, IsLiveGCThing, shapesGCHeapTree) \
macro(Other, IsLiveGCThing, shapesGCHeapDict) \
macro(Other, IsLiveGCThing, shapesGCHeapBase) \
macro(Other, NotLiveGCThing, shapesMallocHeapTreeTables) \
macro(Other, NotLiveGCThing, shapesMallocHeapDictTables) \
macro(Other, NotLiveGCThing, shapesMallocHeapTreeKids) \
macro(Objects, NotLiveGCThing, mallocHeapSlots) \
macro(Objects, NotLiveGCThing, mallocHeapElementsNonAsmJS) \
macro(Objects, NotLiveGCThing, mallocHeapElementsAsmJS) \
macro(Objects, NotLiveGCThing, nonHeapElementsAsmJS) \
macro(Objects, NotLiveGCThing, nonHeapCodeAsmJS) \
macro(Objects, NotLiveGCThing, mallocHeapAsmJSModuleData) \
macro(Objects, NotLiveGCThing, mallocHeapArgumentsData) \
macro(Objects, NotLiveGCThing, mallocHeapRegExpStatics) \
macro(Objects, NotLiveGCThing, mallocHeapPropertyIteratorData) \
macro(Objects, NotLiveGCThing, mallocHeapCtypesData)
ClassInfo()
ObjectsExtraSizes()
: FOR_EACH_SIZE(ZERO_SIZE)
dummy()
{}
void add(const ClassInfo &other) {
void add(const ObjectsExtraSizes &other) {
FOR_EACH_SIZE(ADD_OTHER_SIZE)
}
void subtract(const ClassInfo &other) {
FOR_EACH_SIZE(SUB_OTHER_SIZE)
}
bool isNotable() const {
static const size_t NotabilityThreshold = 16 * 1024;
size_t n = 0;
FOR_EACH_SIZE(ADD_SIZE_TO_N)
return n >= NotabilityThreshold;
}
size_t sizeOfLiveGCThings() const {
size_t n = 0;
FOR_EACH_SIZE(ADD_SIZE_TO_N_IF_LIVE_GC_THING)
@ -169,29 +155,6 @@ struct ClassInfo
#undef FOR_EACH_SIZE
};
// Holds data about a notable class (one whose combined object and shape
// instances use more than a certain amount of memory) so we can report it
// individually.
//
// The only difference between this class and ClassInfo is that this class
// holds a copy of the filename.
struct NotableClassInfo : public ClassInfo
{
NotableClassInfo();
NotableClassInfo(const char *className, const ClassInfo &info);
NotableClassInfo(NotableClassInfo &&info);
NotableClassInfo &operator=(NotableClassInfo &&info);
~NotableClassInfo() {
js_free(className_);
}
char *className_;
private:
NotableClassInfo(const NotableClassInfo& info) MOZ_DELETE;
};
// Data for tracking JIT-code memory usage.
struct CodeSizes
{
@ -519,7 +482,20 @@ struct ZoneStats
struct CompartmentStats
{
#define FOR_EACH_SIZE(macro) \
macro(Objects, IsLiveGCThing, objectsGCHeapOrdinary) \
macro(Objects, IsLiveGCThing, objectsGCHeapFunction) \
macro(Objects, IsLiveGCThing, objectsGCHeapDenseArray) \
macro(Objects, IsLiveGCThing, objectsGCHeapSlowArray) \
macro(Objects, IsLiveGCThing, objectsGCHeapCrossCompartmentWrapper) \
macro(Private, NotLiveGCThing, objectsPrivate) \
macro(Other, IsLiveGCThing, shapesGCHeapTreeGlobalParented) \
macro(Other, IsLiveGCThing, shapesGCHeapTreeNonGlobalParented) \
macro(Other, IsLiveGCThing, shapesGCHeapDict) \
macro(Other, IsLiveGCThing, shapesGCHeapBase) \
macro(Other, NotLiveGCThing, shapesMallocHeapTreeTables) \
macro(Other, NotLiveGCThing, shapesMallocHeapDictTables) \
macro(Other, NotLiveGCThing, shapesMallocHeapTreeShapeKids) \
macro(Other, NotLiveGCThing, shapesMallocHeapCompartmentTables) \
macro(Other, IsLiveGCThing, scriptsGCHeap) \
macro(Other, NotLiveGCThing, scriptsMallocHeapData) \
macro(Other, NotLiveGCThing, baselineData) \
@ -531,76 +507,45 @@ struct CompartmentStats
macro(Other, NotLiveGCThing, typeInferenceArrayTypeTables) \
macro(Other, NotLiveGCThing, typeInferenceObjectTypeTables) \
macro(Other, NotLiveGCThing, compartmentObject) \
macro(Other, NotLiveGCThing, compartmentTables) \
macro(Other, NotLiveGCThing, crossCompartmentWrappersTable) \
macro(Other, NotLiveGCThing, regexpCompartment) \
macro(Other, NotLiveGCThing, debuggeesSet)
CompartmentStats()
: FOR_EACH_SIZE(ZERO_SIZE)
classInfo(),
extra(),
allClasses(nullptr),
notableClasses(),
isTotals(true)
objectsExtra(),
extra()
{}
CompartmentStats(CompartmentStats &&other)
CompartmentStats(const CompartmentStats &other)
: FOR_EACH_SIZE(COPY_OTHER_SIZE)
classInfo(mozilla::Move(other.classInfo)),
extra(other.extra),
allClasses(other.allClasses),
notableClasses(mozilla::Move(other.notableClasses)),
isTotals(other.isTotals)
{
other.allClasses = nullptr;
MOZ_ASSERT(!other.isTotals);
}
objectsExtra(other.objectsExtra),
extra(other.extra)
{}
~CompartmentStats() {
// |allClasses| is usually deleted and set to nullptr before this
// destructor runs. But there are failure cases due to OOMs that may
// prevent that, so it doesn't hurt to try again here.
js_delete(allClasses);
}
bool initClasses(JSRuntime *rt);
void addSizes(const CompartmentStats &other) {
MOZ_ASSERT(isTotals);
void add(const CompartmentStats &other) {
FOR_EACH_SIZE(ADD_OTHER_SIZE)
classInfo.add(other.classInfo);
objectsExtra.add(other.objectsExtra);
// Do nothing with |extra|.
}
size_t sizeOfLiveGCThings() const {
MOZ_ASSERT(isTotals);
size_t n = 0;
FOR_EACH_SIZE(ADD_SIZE_TO_N_IF_LIVE_GC_THING)
n += classInfo.sizeOfLiveGCThings();
n += objectsExtra.sizeOfLiveGCThings();
// Do nothing with |extra|.
return n;
}
void addToTabSizes(TabSizes *sizes) const {
MOZ_ASSERT(isTotals);
FOR_EACH_SIZE(ADD_TO_TAB_SIZES);
classInfo.addToTabSizes(sizes);
objectsExtra.addToTabSizes(sizes);
// Do nothing with |extra|.
}
// The class measurements in |classInfo| are initially for all classes. At
// the end, if the measurement granularity is FineGrained, we subtract the
// measurements of the notable classes and move them into |notableClasses|.
FOR_EACH_SIZE(DECL_SIZE)
ClassInfo classInfo;
void *extra; // This field can be used by embedders.
typedef js::HashMap<const char*, ClassInfo,
js::CStringHashPolicy,
js::SystemAllocPolicy> ClassesHashMap;
// These are similar to |allStrings| and |notableStrings| in ZoneStats.
ClassesHashMap *allClasses;
js::Vector<NotableClassInfo, 0, js::SystemAllocPolicy> notableClasses;
bool isTotals;
ObjectsExtraSizes objectsExtra;
void *extra; // This field can be used by embedders.
#undef FOR_EACH_SIZE
};

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

@ -912,7 +912,7 @@ JSCompartment::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
size_t *tiArrayTypeTables,
size_t *tiObjectTypeTables,
size_t *compartmentObject,
size_t *compartmentTables,
size_t *shapesCompartmentTables,
size_t *crossCompartmentWrappersArg,
size_t *regexpCompartment,
size_t *debuggeesSet,
@ -921,10 +921,10 @@ JSCompartment::addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
*compartmentObject += mallocSizeOf(this);
types.addSizeOfExcludingThis(mallocSizeOf, tiAllocationSiteTables,
tiArrayTypeTables, tiObjectTypeTables);
*compartmentTables += baseShapes.sizeOfExcludingThis(mallocSizeOf)
+ initialShapes.sizeOfExcludingThis(mallocSizeOf)
+ newTypeObjects.sizeOfExcludingThis(mallocSizeOf)
+ lazyTypeObjects.sizeOfExcludingThis(mallocSizeOf);
*shapesCompartmentTables += baseShapes.sizeOfExcludingThis(mallocSizeOf)
+ initialShapes.sizeOfExcludingThis(mallocSizeOf)
+ newTypeObjects.sizeOfExcludingThis(mallocSizeOf)
+ lazyTypeObjects.sizeOfExcludingThis(mallocSizeOf);
*crossCompartmentWrappersArg += crossCompartmentWrappers.sizeOfExcludingThis(mallocSizeOf);
*regexpCompartment += regExps.sizeOfExcludingThis(mallocSizeOf);
*debuggeesSet += debuggees.sizeOfExcludingThis(mallocSizeOf);

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

@ -226,7 +226,7 @@ struct JSCompartment
size_t *tiArrayTypeTables,
size_t *tiObjectTypeTables,
size_t *compartmentObject,
size_t *compartmentTables,
size_t *shapesCompartmentTables,
size_t *crossCompartmentWrappers,
size_t *regexpCompartment,
size_t *debuggeesSet,

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

@ -5931,10 +5931,10 @@ js_DumpBacktrace(JSContext *cx)
fprintf(stdout, "%s", sprinter.string());
}
void
JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ClassInfo *info)
JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ObjectsExtraSizes *sizes)
{
if (hasDynamicSlots())
info->objectsMallocHeapSlots += mallocSizeOf(slots);
sizes->mallocHeapSlots += mallocSizeOf(slots);
if (hasDynamicElements()) {
js::ObjectElements *elements = getElementsHeader();
@ -5942,12 +5942,12 @@ JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ClassIn
#if defined (JS_CPU_X64)
// On x64, ArrayBufferObject::prepareForAsmJS switches the
// ArrayBufferObject to use mmap'd storage.
info->objectsNonHeapElementsAsmJS += as<ArrayBufferObject>().byteLength();
sizes->nonHeapElementsAsmJS += as<ArrayBufferObject>().byteLength();
#else
info->objectsMallocHeapElementsAsmJS += mallocSizeOf(elements);
sizes->mallocHeapElementsAsmJS += mallocSizeOf(elements);
#endif
} else {
info->objectsMallocHeapElementsNonAsmJS += mallocSizeOf(elements);
sizes->mallocHeapElementsNonAsmJS += mallocSizeOf(elements);
}
}
@ -5970,20 +5970,20 @@ JSObject::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ClassIn
// - ( 1.0%, 96.4%): Proxy
} else if (is<ArgumentsObject>()) {
info->objectsMallocHeapMisc += as<ArgumentsObject>().sizeOfMisc(mallocSizeOf);
sizes->mallocHeapArgumentsData += as<ArgumentsObject>().sizeOfMisc(mallocSizeOf);
} else if (is<RegExpStaticsObject>()) {
info->objectsMallocHeapMisc += as<RegExpStaticsObject>().sizeOfData(mallocSizeOf);
sizes->mallocHeapRegExpStatics += as<RegExpStaticsObject>().sizeOfData(mallocSizeOf);
} else if (is<PropertyIteratorObject>()) {
info->objectsMallocHeapMisc += as<PropertyIteratorObject>().sizeOfMisc(mallocSizeOf);
sizes->mallocHeapPropertyIteratorData += as<PropertyIteratorObject>().sizeOfMisc(mallocSizeOf);
#ifdef JS_ION
} else if (is<AsmJSModuleObject>()) {
as<AsmJSModuleObject>().addSizeOfMisc(mallocSizeOf, &info->objectsNonHeapCodeAsmJS,
&info->objectsMallocHeapMisc);
as<AsmJSModuleObject>().addSizeOfMisc(mallocSizeOf, &sizes->nonHeapCodeAsmJS,
&sizes->mallocHeapAsmJSModuleData);
#endif
#ifdef JS_HAS_CTYPES
} else {
// This must be the last case.
info->objectsMallocHeapMisc +=
sizes->mallocHeapCtypesData +=
js::SizeOfDataIfCDataObject(mallocSizeOf, const_cast<JSObject *>(this));
#endif
}

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

@ -25,7 +25,7 @@
#include "vm/Xdr.h"
namespace JS {
struct ClassInfo;
struct ObjectsExtraSizes;
}
namespace js {
@ -354,7 +354,7 @@ class JSObject : public js::ObjectImpl
return lastProperty()->hasTable();
}
void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ClassInfo *info);
void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::ObjectsExtraSizes *sizes);
bool hasIdempotentProtoChain() const;

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

@ -35,6 +35,7 @@
#include "gc/Marking.h"
#include "jit/BaselineJIT.h"
#include "jit/IonCode.h"
#include "js/MemoryMetrics.h"
#include "js/OldDebugAPI.h"
#include "js/Utility.h"
#include "vm/ArgumentsObject.h"

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

@ -155,37 +155,6 @@ NotableStringInfo &NotableStringInfo::operator=(NotableStringInfo &&info)
return *this;
}
NotableClassInfo::NotableClassInfo()
: ClassInfo(),
className_(nullptr)
{
}
NotableClassInfo::NotableClassInfo(const char *className, const ClassInfo &info)
: ClassInfo(info)
{
size_t bytes = strlen(className) + 1;
className_ = js_pod_malloc<char>(bytes);
if (!className_)
MOZ_CRASH("oom");
PodCopy(className_, className, bytes);
}
NotableClassInfo::NotableClassInfo(NotableClassInfo &&info)
: ClassInfo(Move(info))
{
className_ = info.className_;
info.className_ = nullptr;
}
NotableClassInfo &NotableClassInfo::operator=(NotableClassInfo &&info)
{
MOZ_ASSERT(this != &info, "self-move assignment is prohibited");
this->~NotableClassInfo();
new (this) NotableClassInfo(Move(info));
return *this;
}
NotableScriptSourceInfo::NotableScriptSourceInfo()
: ScriptSourceInfo(),
filename_(nullptr)
@ -275,8 +244,6 @@ StatsCompartmentCallback(JSRuntime *rt, void *data, JSCompartment *compartment)
// CollectRuntimeStats reserves enough space.
MOZ_ALWAYS_TRUE(rtStats->compartmentStatsVector.growBy(1));
CompartmentStats &cStats = rtStats->compartmentStatsVector.back();
if (!cStats.initClasses(rt))
MOZ_CRASH("oom");
rtStats->initExtraCompartmentStats(compartment, &cStats);
compartment->compartmentStats = &cStats;
@ -287,7 +254,7 @@ StatsCompartmentCallback(JSRuntime *rt, void *data, JSCompartment *compartment)
&cStats.typeInferenceArrayTypeTables,
&cStats.typeInferenceObjectTypeTables,
&cStats.compartmentObject,
&cStats.compartmentTables,
&cStats.shapesMallocHeapCompartmentTables,
&cStats.crossCompartmentWrappersTable,
&cStats.regexpCompartment,
&cStats.debuggeesSet,
@ -323,25 +290,6 @@ enum Granularity {
CoarseGrained // Corresponds to AddSizeOfTab()
};
static void
AddClassInfo(Granularity granularity, CompartmentStats *cStats, const char *className,
JS::ClassInfo &info)
{
if (granularity == FineGrained) {
if (!className)
className = "<no class name>";
CompartmentStats::ClassesHashMap::AddPtr p =
cStats->allClasses->lookupForAdd(className);
if (!p) {
// Ignore failure -- we just won't record the
// object/shape/base-shape as notable.
(void)cStats->allClasses->add(p, className, info);
} else {
p->value().add(info);
}
}
}
// The various kinds of hashing are expensive, and the results are unused when
// doing coarse-grained measurements. Skipping them more than doubles the
// profile speed for complex pages such as gmail.com.
@ -357,15 +305,16 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
case JSTRACE_OBJECT: {
JSObject *obj = static_cast<JSObject *>(thing);
CompartmentStats *cStats = GetCompartmentStats(obj->compartment());
if (obj->is<JSFunction>())
cStats->objectsGCHeapFunction += thingSize;
else if (obj->is<ArrayObject>())
cStats->objectsGCHeapDenseArray += thingSize;
else if (obj->is<CrossCompartmentWrapperObject>())
cStats->objectsGCHeapCrossCompartmentWrapper += thingSize;
else
cStats->objectsGCHeapOrdinary += thingSize;
JS::ClassInfo info; // This zeroes all the sizes.
info.objectsGCHeap += thingSize;
obj->addSizeOfExcludingThis(rtStats->mallocSizeOf_, &info);
cStats->classInfo.add(info);
const char* className = obj->getClass()->name;
AddClassInfo(granularity, cStats, className, info);
obj->addSizeOfExcludingThis(rtStats->mallocSizeOf_, &cStats->objectsExtra);
if (ObjectPrivateVisitor *opv = closure->opv) {
nsISupports *iface;
@ -400,33 +349,30 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
case JSTRACE_SHAPE: {
Shape *shape = static_cast<Shape *>(thing);
CompartmentStats *cStats = GetCompartmentStats(shape->compartment());
if (shape->inDictionary()) {
cStats->shapesGCHeapDict += thingSize;
JS::ClassInfo info; // This zeroes all the sizes.
if (shape->inDictionary())
info.shapesGCHeapDict += thingSize;
else
info.shapesGCHeapTree += thingSize;
shape->addSizeOfExcludingThis(rtStats->mallocSizeOf_, &info);
// nullptr because kidsSize shouldn't be incremented in this case.
shape->addSizeOfExcludingThis(rtStats->mallocSizeOf_,
&cStats->shapesMallocHeapDictTables, nullptr);
} else {
JSObject *parent = shape->base()->getObjectParent();
if (parent && parent->is<GlobalObject>())
cStats->shapesGCHeapTreeGlobalParented += thingSize;
else
cStats->shapesGCHeapTreeNonGlobalParented += thingSize;
cStats->classInfo.add(info);
const char* className = shape->base()->clasp()->name;
AddClassInfo(granularity, cStats, className, info);
shape->addSizeOfExcludingThis(rtStats->mallocSizeOf_,
&cStats->shapesMallocHeapTreeTables,
&cStats->shapesMallocHeapTreeShapeKids);
}
break;
}
case JSTRACE_BASE_SHAPE: {
BaseShape *base = static_cast<BaseShape *>(thing);
CompartmentStats *cStats = GetCompartmentStats(base->compartment());
JS::ClassInfo info; // This zeroes all the sizes.
info.shapesGCHeapBase += thingSize;
// No malloc-heap measurements.
cStats->classInfo.add(info);
const char* className = base->clasp()->name;
AddClassInfo(granularity, cStats, className, info);
cStats->shapesGCHeapBase += thingSize;
break;
}
@ -502,32 +448,6 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
zStats->unusedGCThings -= thingSize;
}
bool
ZoneStats::initStrings(JSRuntime *rt)
{
isTotals = false;
allStrings = rt->new_<StringsHashMap>();
if (!allStrings || !allStrings->init()) {
js_delete(allStrings);
allStrings = nullptr;
return false;
}
return true;
}
bool
CompartmentStats::initClasses(JSRuntime *rt)
{
isTotals = false;
allClasses = rt->new_<ClassesHashMap>();
if (!allClasses || !allClasses->init()) {
js_delete(allClasses);
allClasses = nullptr;
return false;
}
return true;
}
static bool
FindNotableStrings(ZoneStats &zStats)
{
@ -560,39 +480,18 @@ FindNotableStrings(ZoneStats &zStats)
return true;
}
static bool
FindNotableClasses(CompartmentStats &cStats)
bool
ZoneStats::initStrings(JSRuntime *rt)
{
using namespace JS;
// We should only run FindNotableClasses once per ZoneStats object.
MOZ_ASSERT(cStats.notableClasses.empty());
for (CompartmentStats::ClassesHashMap::Range r = cStats.allClasses->all();
!r.empty();
r.popFront())
{
const char *className = r.front().key();
ClassInfo &info = r.front().value();
// If this class isn't notable, or if we can't grow the notableStrings
// vector, skip this string.
if (!info.isNotable())
continue;
if (!cStats.notableClasses.growBy(1))
return false;
cStats.notableClasses.back() = NotableClassInfo(className, info);
// We're moving this class from a non-notable to a notable bucket, so
// subtract it out of the non-notable tallies.
cStats.classInfo.subtract(info);
isTotals = false;
allStrings = rt->new_<StringsHashMap>();
if (!allStrings)
return false;
if (!allStrings->init()) {
js_delete(allStrings);
allStrings = nullptr;
return false;
}
// Delete |allClasses| now, rather than waiting for zStats's destruction,
// to reduce peak memory consumption during reporting.
js_delete(cStats.allClasses);
cStats.allClasses = nullptr;
return true;
}
@ -676,21 +575,11 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit
MOZ_ASSERT(!zTotals.allStrings);
CompartmentStatsVector &cs = rtStats->compartmentStatsVector;
CompartmentStats &cTotals = rtStats->cTotals;
// As with the zones, we sum all compartments first, and then get the
// notable classes within each zone.
for (size_t i = 0; i < cs.length(); i++)
cTotals.addSizes(cs[i]);
for (size_t i = 0; i < cs.length(); i++) {
if (!FindNotableClasses(cs[i]))
return false;
for (size_t i = 0; i < rtStats->compartmentStatsVector.length(); i++) {
CompartmentStats &cStats = rtStats->compartmentStatsVector[i];
rtStats->cTotals.add(cStats);
}
MOZ_ASSERT(!cTotals.allClasses);
rtStats->gcHeapGCThings = rtStats->zTotals.sizeOfLiveGCThings() +
rtStats->cTotals.sizeOfLiveGCThings();
@ -794,8 +683,10 @@ AddSizeOfTab(JSRuntime *rt, HandleObject obj, MallocSizeOf mallocSizeOf, ObjectP
JS_ASSERT(rtStats.zoneStatsVector.length() == 1);
rtStats.zTotals.addSizes(rtStats.zoneStatsVector[0]);
for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++)
rtStats.cTotals.addSizes(rtStats.compartmentStatsVector[i]);
for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++) {
CompartmentStats &cStats = rtStats.compartmentStatsVector[i];
rtStats.cTotals.add(cStats);
}
for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
comp->compartmentStats = nullptr;

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

@ -939,7 +939,10 @@ JS::DescribeStack(JSContext *cx, unsigned maxFrames)
{
Vector<FrameDescription> frames(cx);
for (NonBuiltinScriptFrameIter i(cx); !i.done(); ++i) {
NonBuiltinScriptFrameIter i(cx, ScriptFrameIter::ALL_CONTEXTS,
ScriptFrameIter::GO_THROUGH_SAVED,
cx->compartment()->principals);
for ( ; !i.done(); ++i) {
if (!frames.append(i))
return nullptr;
if (frames.length() == maxFrames)

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

@ -26,7 +26,6 @@
#include "gc/Marking.h"
#include "gc/Rooting.h"
#include "js/HashTable.h"
#include "js/MemoryMetrics.h"
#include "js/RootingAPI.h"
#ifdef _MSC_VER
@ -985,17 +984,12 @@ class Shape : public gc::BarrieredCell<Shape>
ShapeTable &table() const { return base()->table(); }
void addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf,
JS::ClassInfo *info) const
{
if (hasTable()) {
if (inDictionary())
info->shapesMallocHeapDictTables += table().sizeOfIncludingThis(mallocSizeOf);
else
info->shapesMallocHeapTreeTables += table().sizeOfIncludingThis(mallocSizeOf);
}
size_t *propTableSize, size_t *kidsSize) const {
if (hasTable())
*propTableSize += table().sizeOfIncludingThis(mallocSizeOf);
if (!inDictionary() && kids.isHash())
info->shapesMallocHeapTreeKids += kids.toHash()->sizeOfIncludingThis(mallocSizeOf);
*kidsSize += kids.toHash()->sizeOfIncludingThis(mallocSizeOf);
}
bool isNative() const {

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

@ -1911,103 +1911,6 @@ ReportZoneStats(const JS::ZoneStats &zStats,
# undef STRING_LENGTH
}
static nsresult
ReportClassStats(const ClassInfo &classInfo, const nsACString &path,
nsIHandleReportCallback *cb, nsISupports *closure,
size_t &gcTotal)
{
// We deliberately don't use ZCREPORT_BYTES, so that these per-class values
// don't go into sundries.
if (classInfo.objectsGCHeap > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("objects/gc-heap"),
classInfo.objectsGCHeap,
"Objects, including fixed slots.");
}
if (classInfo.objectsMallocHeapSlots > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/malloc-heap/slots"),
KIND_HEAP, classInfo.objectsMallocHeapSlots,
"Non-fixed object slots.");
}
if (classInfo.objectsMallocHeapElementsNonAsmJS > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/malloc-heap/elements/non-asm.js"),
KIND_HEAP, classInfo.objectsMallocHeapElementsNonAsmJS,
"Non-asm.js indexed elements.");
}
// asm.js arrays are heap-allocated on some platforms and
// non-heap-allocated on others. We never put them under sundries,
// because (a) in practice they're almost always larger than the sundries
// threshold, and (b) we'd need a third category of sundries ("non-heap"),
// which would be a pain.
size_t mallocHeapElementsAsmJS = classInfo.objectsMallocHeapElementsAsmJS;
size_t nonHeapElementsAsmJS = classInfo.objectsNonHeapElementsAsmJS;
MOZ_ASSERT(mallocHeapElementsAsmJS == 0 || nonHeapElementsAsmJS == 0);
if (mallocHeapElementsAsmJS > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/malloc-heap/elements/asm.js"),
KIND_HEAP, mallocHeapElementsAsmJS,
"asm.js array buffer elements on the malloc heap.");
}
if (nonHeapElementsAsmJS > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/non-heap/elements/asm.js"),
KIND_NONHEAP, nonHeapElementsAsmJS,
"asm.js array buffer elements outside both the malloc heap and "
"the GC heap.");
}
if (classInfo.objectsNonHeapCodeAsmJS > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/non-heap/code/asm.js"),
KIND_NONHEAP, classInfo.objectsNonHeapCodeAsmJS,
"AOT-compiled asm.js code.");
}
if (classInfo.objectsMallocHeapMisc > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("objects/malloc-heap/misc"),
KIND_HEAP, classInfo.objectsMallocHeapMisc,
"Miscellaneous object data.");
}
if (classInfo.shapesGCHeapTree > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("shapes/gc-heap/tree"),
classInfo.shapesGCHeapTree,
"Shapes in a property tree.");
}
if (classInfo.shapesGCHeapDict > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("shapes/gc-heap/dict"),
classInfo.shapesGCHeapDict,
"Shapes in dictionary mode.");
}
if (classInfo.shapesGCHeapBase > 0) {
REPORT_GC_BYTES(path + NS_LITERAL_CSTRING("shapes/gc-heap/base"),
classInfo.shapesGCHeapBase,
"Base shapes, which collate data common to many shapes.");
}
if (classInfo.shapesMallocHeapTreeTables > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("shapes/malloc-heap/tree-tables"),
KIND_HEAP, classInfo.shapesMallocHeapTreeTables,
"Property tables of shapes in a property tree.");
}
if (classInfo.shapesMallocHeapDictTables > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("shapes/malloc-heap/dict-tables"),
KIND_HEAP, classInfo.shapesMallocHeapDictTables,
"Property tables of shapes in dictionary mode.");
}
if (classInfo.shapesMallocHeapTreeKids > 0) {
REPORT_BYTES(path + NS_LITERAL_CSTRING("shapes/malloc-heap/tree-kids"),
KIND_HEAP, classInfo.shapesMallocHeapTreeKids,
"Kid hashes of shapes in a property tree.");
}
return NS_OK;
}
static nsresult
ReportCompartmentStats(const JS::CompartmentStats &cStats,
const xpc::CompartmentStatsExtras &extras,
@ -2020,9 +1923,6 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
size_t gcTotal = 0, sundriesGCHeap = 0, sundriesMallocHeap = 0;
nsAutoCString cJSPathPrefix = extras.jsPathPrefix;
nsAutoCString cDOMPathPrefix = extras.domPathPrefix;
nsresult rv;
MOZ_ASSERT(!gcTotalOut == cStats.isTotals);
// Only attempt to prefix if we got a location and the path wasn't already
// prefixed.
@ -2043,25 +1943,26 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
}
}
nsCString nonNotablePath = cJSPathPrefix;
nonNotablePath += cStats.isTotals
? NS_LITERAL_CSTRING("classes/")
: NS_LITERAL_CSTRING("classes/class(<non-notable classes>)/");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/gc-heap/ordinary"),
cStats.objectsGCHeapOrdinary,
"Ordinary objects, i.e. not otherwise distinguished by memory "
"reporters.");
rv = ReportClassStats(cStats.classInfo, nonNotablePath, cb, closure,
gcTotal);
NS_ENSURE_SUCCESS(rv, rv);
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/gc-heap/function"),
cStats.objectsGCHeapFunction,
"Function objects.");
for (size_t i = 0; i < cStats.notableClasses.length(); i++) {
MOZ_ASSERT(!cStats.isTotals);
const JS::NotableClassInfo& classInfo = cStats.notableClasses[i];
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/gc-heap/dense-array"),
cStats.objectsGCHeapDenseArray,
"Dense array objects.");
nsCString classPath = cJSPathPrefix +
nsPrintfCString("classes/class(%s)/", classInfo.className_);
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/gc-heap/slow-array"),
cStats.objectsGCHeapSlowArray,
"Slow array objects.");
rv = ReportClassStats(classInfo, classPath, cb, closure, gcTotal);
NS_ENSURE_SUCCESS(rv, rv);
}
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/gc-heap/cross-compartment-wrapper"),
cStats.objectsGCHeapCrossCompartmentWrapper,
"Cross-compartment wrapper objects.");
// Note that we use cDOMPathPrefix here. This is because we measure orphan
// DOM nodes in the JS reporter, but we want to report them in a "dom"
@ -2071,6 +1972,41 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
"Orphan DOM nodes, i.e. those that are only reachable from JavaScript "
"objects.");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/gc-heap/tree/global-parented"),
cStats.shapesGCHeapTreeGlobalParented,
"Shapes that (a) are in a property tree, and (b) represent an object "
"whose parent is the global object.");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/gc-heap/tree/non-global-parented"),
cStats.shapesGCHeapTreeNonGlobalParented,
"Shapes that (a) are in a property tree, and (b) represent an object "
"whose parent is not the global object.");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/gc-heap/dict"),
cStats.shapesGCHeapDict,
"Shapes that are in dictionary mode.");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/gc-heap/base"),
cStats.shapesGCHeapBase,
"Base shapes, which collate data common to many shapes.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/malloc-heap/tree-tables"),
cStats.shapesMallocHeapTreeTables,
"Property tables belonging to shapes that are in a property tree.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/malloc-heap/dict-tables"),
cStats.shapesMallocHeapDictTables,
"Property tables that belong to shapes that are in dictionary mode.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/malloc-heap/tree-shape-kids"),
cStats.shapesMallocHeapTreeShapeKids,
"Kid hashes that belong to shapes that are in a property tree.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("shapes/malloc-heap/compartment-tables"),
cStats.shapesMallocHeapCompartmentTables,
"Compartment-wide tables storing shape information used during object "
"construction.");
ZCREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("scripts/gc-heap"),
cStats.scriptsGCHeap,
"JSScript instances. There is one per user-defined function in a "
@ -2116,10 +2052,6 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
cStats.compartmentObject,
"The JSCompartment object itself.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("compartment-tables"),
cStats.compartmentTables,
"Compartment-wide tables storing shape and type object information.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("cross-compartment-wrapper-table"),
cStats.crossCompartmentWrappersTable,
"The cross-compartment wrapper table.");
@ -2132,6 +2064,58 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
cStats.debuggeesSet,
"The debuggees set.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/slots"),
cStats.objectsExtra.mallocHeapSlots,
"Non-fixed object slot arrays, which represent object properties.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/elements/non-asm.js"),
cStats.objectsExtra.mallocHeapElementsNonAsmJS,
"Non-asm.js indexed elements.");
// asm.js arrays are heap-allocated on some platforms and
// non-heap-allocated on others. We never put them under sundries,
// because (a) in practice they're almost always larger than the sundries
// threshold, and (b) we'd need a third category of sundries ("non-heap"),
// which would be a pain.
size_t mallocHeapElementsAsmJS = cStats.objectsExtra.mallocHeapElementsAsmJS;
size_t nonHeapElementsAsmJS = cStats.objectsExtra.nonHeapElementsAsmJS;
MOZ_ASSERT(mallocHeapElementsAsmJS == 0 || nonHeapElementsAsmJS == 0);
if (mallocHeapElementsAsmJS > 0) {
REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/elements/asm.js"),
KIND_HEAP, mallocHeapElementsAsmJS,
"asm.js array buffer elements on the malloc heap.");
}
if (nonHeapElementsAsmJS > 0) {
REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/non-heap/elements/asm.js"),
KIND_NONHEAP, nonHeapElementsAsmJS,
"asm.js array buffer elements outside both the malloc heap and "
"the GC heap.");
}
REPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/non-heap/code/asm.js"),
KIND_NONHEAP, cStats.objectsExtra.nonHeapCodeAsmJS,
"AOT-compiled asm.js code.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/asm.js-module-data"),
cStats.objectsExtra.mallocHeapAsmJSModuleData,
"asm.js module data.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/arguments-data"),
cStats.objectsExtra.mallocHeapArgumentsData,
"Data belonging to Arguments objects.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/regexp-statics"),
cStats.objectsExtra.mallocHeapRegExpStatics,
"Data belonging to the RegExpStatics object.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/property-iterator-data"),
cStats.objectsExtra.mallocHeapPropertyIteratorData,
"Data belonging to property iterator objects.");
ZCREPORT_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("objects/malloc-heap/ctypes-data"),
cStats.objectsExtra.mallocHeapCtypesData,
"Data belonging to ctypes objects.");
if (sundriesGCHeap > 0) {
// We deliberately don't use ZCREPORT_GC_BYTES here.
REPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("sundries/gc-heap"),
@ -2201,10 +2185,9 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats,
}
for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++) {
const JS::CompartmentStats &cStats = rtStats.compartmentStatsVector[i];
JS::CompartmentStats cStats = rtStats.compartmentStatsVector[i];
const xpc::CompartmentStatsExtras *extras =
static_cast<const xpc::CompartmentStatsExtras*>(cStats.extra);
rv = ReportCompartmentStats(cStats, *extras, addonManager, cb, closure,
&gcTotal);
NS_ENSURE_SUCCESS(rv, rv);

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

@ -26,6 +26,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=960820
ok(/clickCallback/.test(stack), "clickCallback should be in the stack");
ok(!/clickHandler/.test(stack), "clickHandler should not be in the stack");
ok(/dispatchClick/.test(stack), "dispatchClick should be in the stack");
// Check Components.stack, but first filter through the SpecialPowers junk.
var stack = SpecialPowers.wrap(SpecialPowers.Components).stack;
while (/specialpowers/.test(stack)) {
stack = stack.caller;
}
ok(/clickCallback/.test(stack), "clickCallback should be reachable via Components.stack");
ok(/clickHandler/.test(stack.caller), "clickHandler should be reachable via Components.stack");
ok(/dispatchClick/.test(stack.caller.caller), "dispatchClick hould be reachable via Components.stack");
}
function dispatchClick() {
document.dispatchEvent(new MouseEvent('click'));

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

@ -3756,6 +3756,9 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
rc->Init(presContext->DeviceContext(), aContext);
nsIntRegion temp = builder->GetRegionToClear();
builder->ResetRegionToClear();
if (shouldDrawRectsSeparately) {
nsIntRegionRectIterator it(aRegionToDraw);
while (const nsIntRect* iterRect = it.Next()) {
@ -3797,6 +3800,10 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
if (!aRegionToInvalidate.IsEmpty()) {
aLayer->AddInvalidRect(aRegionToInvalidate.GetBounds());
}
aLayer->Manager()->AddRegionToClear(builder->GetRegionToClear());
builder->ResetRegionToClear();
builder->AddRegionToClear(temp);
}
bool

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

@ -2430,6 +2430,7 @@ nsDisplayThemedBackground::Paint(nsDisplayListBuilder* aBuilder,
PaintInternal(aBuilder, aCtx, mVisibleRect, nullptr);
}
void
nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx, const nsRect& aBounds,
@ -2443,7 +2444,11 @@ nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder,
theme->GetWidgetOverflow(presContext->DeviceContext(), mFrame, mAppearance,
&drawing);
drawing.IntersectRect(drawing, aBounds);
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, borderArea, drawing);
nsIntRegion clear;
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, borderArea, drawing, &clear);
MOZ_ASSERT(clear.IsEmpty() || ReferenceFrame() == aBuilder->RootReferenceFrame(),
"Can't add to clear region if we're transformed!");
aBuilder->AddRegionToClear(clear);
}
bool nsDisplayThemedBackground::IsWindowActive()
@ -3535,7 +3540,7 @@ nsDisplaySubDocument::BuildLayer(nsDisplayListBuilder* aBuilder,
mFrame->GetOffsetToCrossDoc(ReferenceFrame());
RecordFrameMetrics(mFrame, rootScrollFrame, ReferenceFrame(),
container, mVisibleRect, viewport,
container, mList.GetVisibleRect(), viewport,
(usingDisplayport ? &displayport : nullptr),
(usingCriticalDisplayport ? &criticalDisplayport : nullptr),
scrollId, isRootContentDocument, aContainerParameters);

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