Bug 1288909, part 3 - XPCWrappedNative:: and XPCWrappedNativeProto::Mark() don't do anything any more. r=billm
Also clean up some random comments for code that was deleted earlier.
MozReview-Commit-ID: 8JQx0FAH8wA
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -779,29 +779,16 @@ XPCJSContext::FinalizeCallback(JSFreeOp*
break;
}
case JSFINALIZE_COLLECTION_END:
{
MOZ_ASSERT(!self->mGCIsRunning, "bad state");
self->mGCIsRunning = true;
- // We use this occasion to mark and sweep NativeInterfaces,
- // NativeSets, and the WrappedNativeJSClasses...
-
- // Do the marking...
- XPCWrappedNativeScope::MarkAllWrappedNativesAndProtos();
-
- // Mark the sets used in the call contexts. There is a small
- // chance that a wrapper's set will change *while* a call is
- // happening which uses that wrapper's old interfface set. So,
- // we need to do this marking to avoid collecting those sets
- // that might no longer be otherwise reachable from the wrappers
- // or the wrapperprotos.
-
// Skip this part if XPConnect is shutting down. We get into
// bad locking problems with the thread iteration otherwise.
if (!nsXPConnect::XPConnect()->IsShuttingDown()) {
// Mark those AutoMarkingPtr lists!
if (AutoMarkingPtr* roots = Get()->mAutoRoots)
roots->MarkAfterJSFinalizeAll();
}
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -571,34 +571,16 @@ XPCWrappedNativeScope::UpdateWeakPointer
if (cur)
prev = cur;
cur = next;
}
}
// static
void
-XPCWrappedNativeScope::MarkAllWrappedNativesAndProtos()
-{
- for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
- for (auto i = cur->mWrappedNativeMap->Iter(); !i.Done(); i.Next()) {
- auto entry = static_cast<Native2WrappedNativeMap::Entry*>(i.Get());
- entry->value->Mark();
- }
- // We need to explicitly mark all the protos too because some protos may be
- // alive in the hashtable but not currently in use by any wrapper
- for (auto i = cur->mWrappedNativeProtoMap->Iter(); !i.Done(); i.Next()) {
- auto entry = static_cast<ClassInfo2WrappedNativeProtoMap::Entry*>(i.Get());
- entry->value->Mark();
- }
- }
-}
-
-// static
-void
XPCWrappedNativeScope::SweepAllWrappedNativeTearOffs()
{
for (XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext) {
for (auto i = cur->mWrappedNativeMap->Iter(); !i.Done(); i.Next()) {
auto entry = static_cast<Native2WrappedNativeMap::Entry*>(i.Get());
entry->value->SweepTearOffs();
}
}
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -924,19 +924,16 @@ public:
if (mXrayExpandos.initialized())
mXrayExpandos.trace(trc);
}
static void
SuspectAllWrappers(XPCJSContext* cx, nsCycleCollectionNoteRootCallback& cb);
static void
- MarkAllWrappedNativesAndProtos();
-
- static void
SweepAllWrappedNativeTearOffs();
static void
UpdateWeakPointersAfterGC(XPCJSContext* cx);
static void
KillDyingScopes();
@@ -1890,20 +1887,17 @@ public:
inline bool HasInterfaceNoQI(const nsIID& iid);
XPCWrappedNativeTearOff* FindTearOff(XPCNativeInterface* aInterface,
bool needJSObject = false,
nsresult* pError = nullptr);
XPCWrappedNativeTearOff* FindTearOff(const nsIID& iid);
- void Mark() const
- {
- if (HasProto()) GetProto()->Mark();
- }
+ void Mark() const {}
inline void TraceInside(JSTracer* trc) {
if (HasProto())
GetProto()->TraceSelf(trc);
else
GetScope()->TraceSelf(trc);
if (mFlatJSObject && JS_IsGlobalObject(mFlatJSObject))
{