зеркало из https://github.com/mozilla/pjs.git
Fix but 249923
- Remove hashtable from nsViewManager. It is now created on the stack when it is needed. - Remove DestroyZTreeNode(). It only removes things from the above hashtable and that is going to be destroyed shortly after the call.
This commit is contained in:
Родитель
4e52fac5a7
Коммит
ce5d0d510e
|
@ -61,6 +61,7 @@
|
||||||
#include "nsRegion.h"
|
#include "nsRegion.h"
|
||||||
#include "nsInt64.h"
|
#include "nsInt64.h"
|
||||||
#include "nsScrollPortView.h"
|
#include "nsScrollPortView.h"
|
||||||
|
#include "nsHashtable.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID);
|
static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID);
|
||||||
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
static NS_DEFINE_IID(kRegionCID, NS_REGION_CID);
|
||||||
|
@ -233,25 +234,6 @@ private: // Prevent new/delete of these elements
|
||||||
~DisplayZTreeNode();
|
~DisplayZTreeNode();
|
||||||
};
|
};
|
||||||
|
|
||||||
void nsViewManager::DestroyZTreeNode(DisplayZTreeNode* aNode)
|
|
||||||
{
|
|
||||||
if (aNode) {
|
|
||||||
if (mMapPlaceholderViewToZTreeNode.Count() > 0) {
|
|
||||||
nsVoidKey key(aNode->mView);
|
|
||||||
mMapPlaceholderViewToZTreeNode.Remove(&key);
|
|
||||||
}
|
|
||||||
|
|
||||||
DestroyZTreeNode(aNode->mZChild);
|
|
||||||
DestroyZTreeNode(aNode->mZSibling);
|
|
||||||
// We no longer need to delete the node & element. They are now allocated
|
|
||||||
// from an Arena, and the entire Arena is freed after the elements are
|
|
||||||
// used. This function is only called to remove unused elements from
|
|
||||||
// the Placeholder hash.
|
|
||||||
// delete aNode->mDisplayElement;
|
|
||||||
// delete aNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static PRInt32 PrintDisplayListElement(DisplayListElement2* element,
|
static PRInt32 PrintDisplayListElement(DisplayListElement2* element,
|
||||||
PRInt32 aNestCount) {
|
PRInt32 aNestCount) {
|
||||||
|
@ -2062,15 +2044,13 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewManager::ReparentViews(DisplayZTreeNode* aNode) {
|
void nsViewManager::ReparentViews(DisplayZTreeNode* aNode,
|
||||||
if (aNode == nsnull) {
|
nsHashtable &aMapPlaceholderViewToZTreeNode)
|
||||||
return;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
DisplayZTreeNode* child;
|
DisplayZTreeNode* child;
|
||||||
DisplayZTreeNode** prev = &aNode->mZChild;
|
DisplayZTreeNode** prev = &aNode->mZChild;
|
||||||
for (child = aNode->mZChild; nsnull != child; child = *prev) {
|
for (child = aNode->mZChild; nsnull != child; child = *prev) {
|
||||||
ReparentViews(child);
|
ReparentViews(child, aMapPlaceholderViewToZTreeNode);
|
||||||
|
|
||||||
nsZPlaceholderView *zParent = nsnull;
|
nsZPlaceholderView *zParent = nsnull;
|
||||||
if (nsnull != child->mView) {
|
if (nsnull != child->mView) {
|
||||||
|
@ -2078,7 +2058,7 @@ void nsViewManager::ReparentViews(DisplayZTreeNode* aNode) {
|
||||||
}
|
}
|
||||||
if (nsnull != zParent) {
|
if (nsnull != zParent) {
|
||||||
nsVoidKey key(zParent);
|
nsVoidKey key(zParent);
|
||||||
DisplayZTreeNode* placeholder = (DisplayZTreeNode *)mMapPlaceholderViewToZTreeNode.Get(&key);
|
DisplayZTreeNode* placeholder = (DisplayZTreeNode *)aMapPlaceholderViewToZTreeNode.Get(&key);
|
||||||
|
|
||||||
if (placeholder == child) {
|
if (placeholder == child) {
|
||||||
// don't do anything if we already reparented this node;
|
// don't do anything if we already reparented this node;
|
||||||
|
@ -2100,7 +2080,14 @@ void nsViewManager::ReparentViews(DisplayZTreeNode* aNode) {
|
||||||
} else {
|
} else {
|
||||||
// the placeholder was not added to the display list
|
// the placeholder was not added to the display list
|
||||||
// we don't need the real view then, either
|
// we don't need the real view then, either
|
||||||
DestroyZTreeNode(child);
|
|
||||||
|
// We used to call DestroyZTreeNode which would delete the child
|
||||||
|
// and its children/siblings and remove them from the Placeholder
|
||||||
|
// hash. However, we now use an Arena to build the tree. This
|
||||||
|
// means that we will never reuse a node (because it is never
|
||||||
|
// freed), thus we can just leave it in the hash. It will never
|
||||||
|
// be looked up again.
|
||||||
|
// DestroyZTreeNode(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2179,13 +2166,20 @@ void nsViewManager::BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool
|
||||||
} else {
|
} else {
|
||||||
paintFloats = displayRoot->GetFloating();
|
paintFloats = displayRoot->GetFloating();
|
||||||
}
|
}
|
||||||
CreateDisplayList(displayRoot, zTree, origin.x, origin.y,
|
|
||||||
aView, &aRect, displayRoot, displayRootOrigin.x, displayRootOrigin.y,
|
|
||||||
paintFloats, aEventProcessing, aPool);
|
|
||||||
|
|
||||||
// Reparent any views that need reparenting in the Z-order tree
|
{
|
||||||
ReparentViews(zTree);
|
nsHashtable PlaceholderHash;
|
||||||
mMapPlaceholderViewToZTreeNode.Reset();
|
|
||||||
|
CreateDisplayList(displayRoot, zTree, origin.x, origin.y,
|
||||||
|
aView, &aRect, displayRoot,
|
||||||
|
displayRootOrigin.x, displayRootOrigin.y,
|
||||||
|
paintFloats, aEventProcessing, PlaceholderHash, aPool);
|
||||||
|
|
||||||
|
// Reparent any views that need reparenting in the Z-order tree
|
||||||
|
if(zTree) {
|
||||||
|
ReparentViews(zTree, PlaceholderHash);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (nsnull != zTree) {
|
if (nsnull != zTree) {
|
||||||
// Apply proper Z-order handling
|
// Apply proper Z-order handling
|
||||||
|
@ -2193,8 +2187,6 @@ void nsViewManager::BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool
|
||||||
|
|
||||||
SortByZOrder(zTree, *aDisplayList, mergeTmp, PR_TRUE, aPool);
|
SortByZOrder(zTree, *aDisplayList, mergeTmp, PR_TRUE, aPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
mMapPlaceholderViewToZTreeNode.Reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsGUIEvent* aEvent,
|
void nsViewManager::BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsGUIEvent* aEvent,
|
||||||
|
@ -3361,7 +3353,9 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView,
|
||||||
nscoord aOriginX, nscoord aOriginY, nsView *aRealView,
|
nscoord aOriginX, nscoord aOriginY, nsView *aRealView,
|
||||||
const nsRect *aDamageRect, nsView *aTopView,
|
const nsRect *aDamageRect, nsView *aTopView,
|
||||||
nscoord aX, nscoord aY, PRBool aPaintFloats,
|
nscoord aX, nscoord aY, PRBool aPaintFloats,
|
||||||
PRBool aEventProcessing, PLArenaPool &aPool)
|
PRBool aEventProcessing,
|
||||||
|
nsHashtable &aMapPlaceholderViewToZTreeNode,
|
||||||
|
PLArenaPool &aPool)
|
||||||
{
|
{
|
||||||
PRBool retval = PR_FALSE;
|
PRBool retval = PR_FALSE;
|
||||||
|
|
||||||
|
@ -3486,7 +3480,8 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView,
|
||||||
DisplayZTreeNode* createdNode;
|
DisplayZTreeNode* createdNode;
|
||||||
retval = CreateDisplayList(childView, createdNode,
|
retval = CreateDisplayList(childView, createdNode,
|
||||||
aOriginX, aOriginY, aRealView, aDamageRect, aTopView,
|
aOriginX, aOriginY, aRealView, aDamageRect, aTopView,
|
||||||
pos.x, pos.y, aPaintFloats, aEventProcessing, aPool);
|
pos.x, pos.y, aPaintFloats, aEventProcessing,
|
||||||
|
aMapPlaceholderViewToZTreeNode, aPool);
|
||||||
if (createdNode != nsnull) {
|
if (createdNode != nsnull) {
|
||||||
EnsureZTreeNodeCreated(aView, aResult, aPool);
|
EnsureZTreeNodeCreated(aView, aResult, aPool);
|
||||||
createdNode->mZSibling = aResult->mZChild;
|
createdNode->mZSibling = aResult->mZChild;
|
||||||
|
@ -3524,7 +3519,7 @@ PRBool nsViewManager::CreateDisplayList(nsView *aView,
|
||||||
if (aView->IsZPlaceholderView()) {
|
if (aView->IsZPlaceholderView()) {
|
||||||
EnsureZTreeNodeCreated(aView, aResult, aPool);
|
EnsureZTreeNodeCreated(aView, aResult, aPool);
|
||||||
nsVoidKey key(aView);
|
nsVoidKey key(aView);
|
||||||
mMapPlaceholderViewToZTreeNode.Put(&key, aResult);
|
aMapPlaceholderViewToZTreeNode.Put(&key, aResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include "prtime.h"
|
#include "prtime.h"
|
||||||
#include "prinrval.h"
|
#include "prinrval.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsHashtable.h"
|
|
||||||
#include "nsIScrollableView.h"
|
#include "nsIScrollableView.h"
|
||||||
#include "nsIRegion.h"
|
#include "nsIRegion.h"
|
||||||
#include "nsIBlender.h"
|
#include "nsIBlender.h"
|
||||||
|
@ -61,6 +60,8 @@ class nsISupportsArray;
|
||||||
struct DisplayListElement2;
|
struct DisplayListElement2;
|
||||||
struct DisplayZTreeNode;
|
struct DisplayZTreeNode;
|
||||||
class BlendingBuffers;
|
class BlendingBuffers;
|
||||||
|
struct PLArenaPool;
|
||||||
|
class nsHashtable;
|
||||||
|
|
||||||
//Uncomment the following line to enable generation of viewmanager performance data.
|
//Uncomment the following line to enable generation of viewmanager performance data.
|
||||||
#ifdef MOZ_PERF_METRICS
|
#ifdef MOZ_PERF_METRICS
|
||||||
|
@ -115,8 +116,6 @@ protected:
|
||||||
nsView *mReparentedView;
|
nsView *mReparentedView;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PLArenaPool;
|
|
||||||
|
|
||||||
class nsViewManager : public nsIViewManager {
|
class nsViewManager : public nsIViewManager {
|
||||||
public:
|
public:
|
||||||
nsViewManager();
|
nsViewManager();
|
||||||
|
@ -273,7 +272,7 @@ private:
|
||||||
nsDrawingSurface aBorrowSurface, PRBool aNeedAlpha,
|
nsDrawingSurface aBorrowSurface, PRBool aNeedAlpha,
|
||||||
const nsRect& aArea);
|
const nsRect& aArea);
|
||||||
|
|
||||||
void ReparentViews(DisplayZTreeNode* aNode);
|
void ReparentViews(DisplayZTreeNode* aNode, nsHashtable &);
|
||||||
void BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool aEventProcessing,
|
void BuildDisplayList(nsView* aView, const nsRect& aRect, PRBool aEventProcessing,
|
||||||
PRBool aCaptured, nsVoidArray* aDisplayList, PLArenaPool &aPool);
|
PRBool aCaptured, nsVoidArray* aDisplayList, PLArenaPool &aPool);
|
||||||
void BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured, PLArenaPool &aPool);
|
void BuildEventTargetList(nsVoidArray &aTargets, nsView* aView, nsGUIEvent* aEvent, PRBool aCaptured, PLArenaPool &aPool);
|
||||||
|
@ -283,7 +282,8 @@ private:
|
||||||
nscoord aOriginX, nscoord aOriginY,
|
nscoord aOriginX, nscoord aOriginY,
|
||||||
nsView *aRealView, const nsRect *aDamageRect,
|
nsView *aRealView, const nsRect *aDamageRect,
|
||||||
nsView *aTopView, nscoord aX, nscoord aY,
|
nsView *aTopView, nscoord aX, nscoord aY,
|
||||||
PRBool aPaintFloats, PRBool aEventProcessing, PLArenaPool &aPool);
|
PRBool aPaintFloats, PRBool aEventProcessing,
|
||||||
|
nsHashtable&, PLArenaPool &aPool);
|
||||||
PRBool AddToDisplayList(nsView *aView,
|
PRBool AddToDisplayList(nsView *aView,
|
||||||
DisplayZTreeNode* &aParent, nsRect &aClipRect,
|
DisplayZTreeNode* &aParent, nsRect &aClipRect,
|
||||||
nsRect& aDirtyRect, PRUint32 aFlags, nscoord aAbsX, nscoord aAbsY,
|
nsRect& aDirtyRect, PRUint32 aFlags, nscoord aAbsX, nscoord aAbsY,
|
||||||
|
@ -395,7 +395,6 @@ private:
|
||||||
PRInt32 mCachingWidgetChanges;
|
PRInt32 mCachingWidgetChanges;
|
||||||
nscolor mDefaultBackgroundColor;
|
nscolor mDefaultBackgroundColor;
|
||||||
nsPoint mMouseLocation; // device units, relative to mRootView
|
nsPoint mMouseLocation; // device units, relative to mRootView
|
||||||
nsHashtable mMapPlaceholderViewToZTreeNode;
|
|
||||||
nsCOMPtr<nsIBlender> mBlender;
|
nsCOMPtr<nsIBlender> mBlender;
|
||||||
nsISupportsArray *mCompositeListeners;
|
nsISupportsArray *mCompositeListeners;
|
||||||
nsCOMPtr<nsIFactory> mRegionFactory;
|
nsCOMPtr<nsIFactory> mRegionFactory;
|
||||||
|
@ -418,7 +417,6 @@ private:
|
||||||
//list of view managers
|
//list of view managers
|
||||||
static nsVoidArray *gViewManagers;
|
static nsVoidArray *gViewManagers;
|
||||||
|
|
||||||
void DestroyZTreeNode(DisplayZTreeNode* aNode);
|
|
||||||
void PostInvalidateEvent();
|
void PostInvalidateEvent();
|
||||||
|
|
||||||
#ifdef NS_VM_PERF_METRICS
|
#ifdef NS_VM_PERF_METRICS
|
||||||
|
|
Загрузка…
Ссылка в новой задаче