Backing out Jonas' last changes due to tinderbox orange, per Jonas' request.

This commit is contained in:
jst@mozilla.org 2007-05-09 17:42:33 -07:00
parent b49bc40279
commit bdfbc4a316
13 changed files with 6 additions and 99 deletions

View File

@ -855,24 +855,6 @@ public:
*/
virtual PRBool MutationEventBeingDispatched() = 0;
/**
* Marks as not-going-to-be-collected for the given generation of
* cycle collection.
*/
void MarkUncollectableForCCGeneration(PRUint32 aGeneration)
{
mMarkedCCGeneration = aGeneration;
}
/**
* Gets the cycle collector generation this document is marked for.
*/
PRUint32 GetMarkedCCGeneration()
{
return mMarkedCCGeneration;
}
protected:
~nsIDocument()
{
@ -945,10 +927,6 @@ protected:
// if this document is part of a multipart document,
// the ID can be used to distinguish it from the other parts.
PRUint32 mPartID;
// Cycle collector generation in which we're certain that this document
// won't be collected
PRUint32 mMarkedCCGeneration;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)

View File

@ -82,16 +82,11 @@ class nsNodeSupportsWeakRefTearoff;
// NOTE: Should only be used on nsIContent nodes
#define NODE_MAY_HAVE_FRAME 0x00000020U
// Whether the 'in doc' flag is faked to true for
// this node. This should only ever be set on XUL
// elements.
#define NODE_HAS_FAKED_INDOC 0x00000040U
// Four bits for the script-type ID
#define NODE_SCRIPT_TYPE_OFFSET 7
#define NODE_SCRIPT_TYPE_OFFSET 6
// Remaining bits are node type specific.
#define NODE_TYPE_SPECIFIC_BITS_OFFSET 0x0b
#define NODE_TYPE_SPECIFIC_BITS_OFFSET 0x0a
// Useful macro for getting a node given an nsIContent and an nsIDocument
// Returns the first argument cast to nsINode if it is non-null, otherwise

View File

@ -76,9 +76,7 @@ REQUIRES = xpcom \
uriloader \
rdf \
xultmpl \
util \
appshell \
shistory \
util \
$(NULL)
EXPORTS = \
@ -102,7 +100,6 @@ CPPSRCS = \
nsAtomListUtils.cpp \
nsAttrAndChildArray.cpp \
nsAttrValue.cpp \
nsCCUncollectableMarker.cpp \
nsCommentNode.cpp \
nsContentAreaDragDrop.cpp \
nsContentIterator.cpp \

View File

@ -73,9 +73,6 @@ nsCCUncollectableMarker::Init()
NS_ENSURE_SUCCESS(rv, rv);
// This makes the observer service hold an owning reference to the marker
rv = obs->AddObserver(marker, "xpcom-shutdown", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
rv = obs->AddObserver(marker, "cycle-collector-begin", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
@ -186,30 +183,11 @@ nsresult
nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData)
{
nsresult rv;
if (!strcmp(aTopic, "xpcom-shutdown")) {
nsCOMPtr<nsIObserverService> obs =
do_GetService("@mozilla.org/observer-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
// No need for kungFuDeathGrip here, yay observerservice!
obs->RemoveObserver(this, "xpcom-shutdown");
obs->RemoveObserver(this, "cycle-collector-begin");
sGeneration = 0;
return NS_OK;
}
NS_ASSERTION(!strcmp(aTopic, "cycle-collector-begin"), "wrong topic");
// Increase generation to effectivly unmark all current objects
if (!++sGeneration) {
++sGeneration;
}
++sGeneration;
// Iterate all toplevel windows
nsresult rv;
nsCOMPtr<nsISimpleEnumerator> windowList;
nsCOMPtr<nsIWindowMediator> med =
do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
@ -228,7 +206,5 @@ nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
MarkWindowList(windowList);
}
return NS_OK;
}

View File

@ -51,7 +51,7 @@ class nsCCUncollectableMarker : public nsIObserver
* Checks if we're collecting during a given generation
*/
static PRBool InGeneration(PRUint32 aGeneration) {
return aGeneration && aGeneration == sGeneration;
return aGeneration == sGeneration;
}
static PRUint32 sGeneration;

View File

@ -153,7 +153,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
#include "nsIJSContextStack.h"
#include "nsIXPConnect.h"
#include "nsCycleCollector.h"
#include "nsCCUncollectableMarker.h"
#ifdef MOZ_LOGGING
// so we can get logging even in release builds
@ -1011,10 +1010,6 @@ LinkMapTraverser(nsUint32ToContentHashEntry* aEntry, void* userArg)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
if (nsCCUncollectableMarker::InGeneration(tmp->GetMarkedCCGeneration())) {
return NS_OK;
}
// Traverse the mChildren nsAttrAndChildArray.
for (PRInt32 indx = PRInt32(tmp->mChildren.ChildCount()); indx > 0; --indx) {
cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1));

View File

@ -117,7 +117,6 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCCUncollectableMarker.h"
#ifdef MOZ_SVG
PRBool NS_SVG_TestFeature(const nsAString &fstr);
@ -3008,13 +3007,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGenericElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGenericElement)
nsIDocument* currentDoc = tmp->GetCurrentDoc();
if (currentDoc && !tmp->HasFlag(NODE_HAS_FAKED_INDOC) &&
nsCCUncollectableMarker::InGeneration(
currentDoc->GetMarkedCCGeneration())) {
return NS_OK;
}
nsIDocument* ownerDoc = tmp->GetOwnerDoc();
if (ownerDoc) {
ownerDoc->BindingManager()->Traverse(tmp, cb);

View File

@ -547,7 +547,6 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, PRBool aClone, PRBool aDeep,
nsXULElement *xulElem = NS_STATIC_CAST(nsXULElement*, elem);
if (!xulElem->mPrototype || xulElem->IsInDoc()) {
clone->mParentPtrBits |= nsINode::PARENT_BIT_INDOCUMENT;
clone->SetFlags(NODE_HAS_FAKED_INDOC);
}
}
#endif

View File

@ -867,9 +867,6 @@ nsXULElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// Being added to a document.
mParentPtrBits |= PARENT_BIT_INDOCUMENT;
// Unset this flag since we now really are in a document.
UnsetFlags(NODE_HAS_FAKED_INDOC);
}
// Now recurse into our kids

View File

@ -123,7 +123,6 @@ LOCAL_INCLUDES = \
-I$(topsrcdir)/content/xbl/src \
-I$(topsrcdir)/content/xul/document/src \
-I$(topsrcdir)/content/events/src \
-I$(topsrcdir)/content/base/src \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

View File

@ -75,7 +75,6 @@
#include "nsContentCID.h"
#include "nsLayoutStatics.h"
#include "nsCycleCollector.h"
#include "nsCCUncollectableMarker.h"
// Interfaces Needed
#include "nsIWidget.h"
@ -719,11 +718,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsGlobalWindow,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
if (tmp->mDoc && nsCCUncollectableMarker::InGeneration(
tmp->mDoc->GetMarkedCCGeneration())) {
return NS_OK;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOpener)

View File

@ -78,7 +78,6 @@
#include "txMozillaXSLTProcessor.h"
#include "nsDOMStorage.h"
#include "nsCellMap.h"
#include "nsCCUncollectableMarker.h"
#include "nsTextFrameTextRunCache.h"
#ifdef MOZ_XUL
@ -217,12 +216,6 @@ nsLayoutStatics::Initialize()
return rv;
}
rv = nsCCUncollectableMarker::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsCCUncollectableMarker");
return rv;
}
return NS_OK;
}

View File

@ -138,8 +138,6 @@
#include "prtime.h"
#include "nsPrintfCString.h"
#include "nsTArray.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include <stdio.h>
#ifdef WIN32
@ -1919,12 +1917,6 @@ nsCycleCollector::Collect(PRUint32 aTryCollections)
PRTime start = PR_Now(), now;
#endif
nsCOMPtr<nsIObserverService> obs =
do_GetService("@mozilla.org/observer-service;1");
if (obs) {
obs->NotifyObservers(nsnull, "cycle-collector-begin", nsnull);
}
while (aTryCollections > 0) {
// This triggers a JS GC. Our caller assumes we always trigger at
// least one JS GC -- they rely on this fact to avoid redundant JS