mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 2864e2610800 (bug 877584) for causing bug 881266
This commit is contained in:
parent
39abfabce6
commit
dbe9ed7b72
@ -54,7 +54,6 @@
|
||||
#include "nsCPrefetchService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDOMCID.h"
|
||||
@ -4326,22 +4325,27 @@ void
|
||||
nsContentUtils::HoldJSObjects(void* aScriptObjectHolder,
|
||||
nsScriptObjectTracer* aTracer)
|
||||
{
|
||||
cyclecollector::AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
MOZ_ASSERT(sXPConnect, "Tried to HoldJSObjects when there was no XPConnect");
|
||||
if (sXPConnect) {
|
||||
sXPConnect->AddJSHolder(aScriptObjectHolder, aTracer);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsContentUtils::DropJSObjects(void* aScriptObjectHolder)
|
||||
{
|
||||
cyclecollector::RemoveJSHolder(aScriptObjectHolder);
|
||||
if (sXPConnect) {
|
||||
sXPConnect->RemoveJSHolder(aScriptObjectHolder);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */
|
||||
bool
|
||||
nsContentUtils::AreJSObjectsHeld(void* aScriptObjectHolder)
|
||||
nsContentUtils::AreJSObjectsHeld(void* aScriptHolder)
|
||||
{
|
||||
return cyclecollector::TestJSHolder(aScriptObjectHolder);
|
||||
return sXPConnect->TestJSHolder(aScriptHolder);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports
|
||||
{ 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
%}
|
||||
|
||||
[uuid(4498aa26-62df-4a4f-8a45-7ddfd7f84834)]
|
||||
[uuid(2950bc62-ba03-4465-9685-a0eec9e188c2)]
|
||||
interface nsIXPConnect : nsISupports
|
||||
{
|
||||
%{ C++
|
||||
@ -560,6 +560,27 @@ interface nsIXPConnect : nsISupports
|
||||
in JSObjectPtr sandbox,
|
||||
in boolean returnStringOnly);
|
||||
|
||||
/**
|
||||
* Root JS objects held by aHolder.
|
||||
* @param aHolder The object that hold the JS objects that should be rooted.
|
||||
* @param aTrace The tracer for aHolder.
|
||||
*/
|
||||
[noscript,notxpcom] void addJSHolder(in voidPtr aHolder,
|
||||
in nsScriptObjectTracerPtr aTracer);
|
||||
|
||||
/**
|
||||
* Stop rooting the JS objects held by aHolder.
|
||||
* @param aHolder The object that hold the rooted JS objects.
|
||||
*/
|
||||
[noscript,notxpcom] void removeJSHolder(in voidPtr aHolder);
|
||||
|
||||
/**
|
||||
* Test to see if a JS holder is in our hashtable.
|
||||
* Only available in debug builds.
|
||||
* @param aHolder The object to test for.
|
||||
*/
|
||||
[noscript,notxpcom] bool testJSHolder(in voidPtr aHolder);
|
||||
|
||||
/**
|
||||
* Note aJSContext as a child to the cycle collector.
|
||||
* @param aJSContext The JSContext to note.
|
||||
|
@ -1788,13 +1788,15 @@ nsXPConnect::RemoveJSHolder(void* aHolder)
|
||||
mRuntime->RemoveJSHolder(aHolder);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
nsXPConnect::TestJSHolder(void* aHolder)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
return mRuntime->TestJSHolder(aHolder);
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::SetReportAllJSExceptions(bool newval)
|
||||
|
@ -491,11 +491,7 @@ public:
|
||||
static XPCJSRuntime* GetRuntimeInstance();
|
||||
XPCJSRuntime* GetRuntime() {return mRuntime;}
|
||||
|
||||
void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) MOZ_OVERRIDE;
|
||||
void RemoveJSHolder(void* aHolder) MOZ_OVERRIDE;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool TestJSHolder(void* aHolder) MOZ_OVERRIDE;
|
||||
void SetObjectToUnlink(void* aObject);
|
||||
void AssertNoObjectsToTrace(void* aPossibleJSHolder);
|
||||
#endif
|
||||
@ -800,8 +796,8 @@ public:
|
||||
|
||||
void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer);
|
||||
void RemoveJSHolder(void* aHolder);
|
||||
#ifdef DEBUG
|
||||
bool TestJSHolder(void* aHolder);
|
||||
#ifdef DEBUG
|
||||
void SetObjectToUnlink(void* aObject) { mObjectToUnlink = aObject; }
|
||||
void AssertNoObjectsToTrace(void* aPossibleJSHolder);
|
||||
#endif
|
||||
|
@ -2946,21 +2946,6 @@ nsCycleCollector::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
|
||||
// - mParams: because it only contains scalars.
|
||||
}
|
||||
|
||||
// This is our special sentinel value that tells us that we've shut
|
||||
// down this thread's CC.
|
||||
static nsCycleCollector* const kSentinelCollector = (nsCycleCollector*)1;
|
||||
|
||||
inline bool
|
||||
CollectorIsShutDown(nsCycleCollector* aCollector)
|
||||
{
|
||||
return aCollector == kSentinelCollector;
|
||||
}
|
||||
|
||||
inline bool
|
||||
HaveCollector(nsCycleCollector* aCollector)
|
||||
{
|
||||
return aCollector && !CollectorIsShutDown(aCollector);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Module public API (exported in nsCycleCollector.h)
|
||||
@ -2981,7 +2966,9 @@ nsCycleCollector_forgetJSRuntime()
|
||||
{
|
||||
nsCycleCollector *collector = sCollector.get();
|
||||
|
||||
if (CollectorIsShutDown(collector)) {
|
||||
if (collector == (nsCycleCollector*)1) {
|
||||
// This is our special sentinel value that tells us that we've shut
|
||||
// down this thread's CC.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2989,38 +2976,6 @@ nsCycleCollector_forgetJSRuntime()
|
||||
collector->ForgetJSRuntime();
|
||||
}
|
||||
|
||||
void
|
||||
cyclecollector::AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer)
|
||||
{
|
||||
nsCycleCollector *collector = sCollector.get();
|
||||
|
||||
MOZ_ASSERT(HaveCollector(collector));
|
||||
|
||||
collector->JSRuntime()->AddJSHolder(aHolder, aTracer);
|
||||
}
|
||||
|
||||
void
|
||||
cyclecollector::RemoveJSHolder(void* aHolder)
|
||||
{
|
||||
nsCycleCollector *collector = sCollector.get();
|
||||
|
||||
MOZ_ASSERT(HaveCollector(collector));
|
||||
|
||||
collector->JSRuntime()->RemoveJSHolder(aHolder);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
cyclecollector::TestJSHolder(void* aHolder)
|
||||
{
|
||||
nsCycleCollector *collector = sCollector.get();
|
||||
|
||||
MOZ_ASSERT(HaveCollector(collector));
|
||||
|
||||
return collector->JSRuntime()->TestJSHolder(aHolder);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsPurpleBufferEntry*
|
||||
NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp)
|
||||
{
|
||||
@ -3030,7 +2985,9 @@ NS_CycleCollectorSuspect2(void *n, nsCycleCollectionParticipant *cp)
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
if (CollectorIsShutDown(collector)) {
|
||||
if (collector == (nsCycleCollector*)1) {
|
||||
// This is our special sentinel value that tells us that we've shut
|
||||
// down this thread's CC.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -3042,7 +2999,9 @@ nsCycleCollector_suspectedCount()
|
||||
{
|
||||
nsCycleCollector *collector = sCollector.get();
|
||||
|
||||
if (CollectorIsShutDown(collector)) {
|
||||
if (collector == (nsCycleCollector*)1) {
|
||||
// This is our special sentinel value that tells us that we've shut
|
||||
// down this thread's CC.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3158,6 +3117,6 @@ nsCycleCollector_shutdown()
|
||||
delete collector;
|
||||
// We want to be able to distinguish never having a collector from
|
||||
// having a shutdown collector.
|
||||
sCollector.set(kSentinelCollector);
|
||||
sCollector.set(reinterpret_cast<nsCycleCollector*>(1));
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
class nsCycleCollectionJSRuntime;
|
||||
class nsICycleCollectorListener;
|
||||
class nsISupports;
|
||||
class nsScriptObjectTracer;
|
||||
|
||||
// Contains various stats about the cycle collection.
|
||||
class nsCycleCollectorResults
|
||||
@ -64,16 +63,4 @@ nsCycleCollectorLoggerConstructor(nsISupports* outer,
|
||||
const nsIID& aIID,
|
||||
void* *aInstancePtr);
|
||||
|
||||
namespace mozilla {
|
||||
namespace cyclecollector {
|
||||
|
||||
void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer);
|
||||
void RemoveJSHolder(void* aHolder);
|
||||
#ifdef DEBUG
|
||||
bool TestJSHolder(void* aHolder);
|
||||
#endif
|
||||
|
||||
} // namespace cyclecollector
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // nsCycleCollector_h__
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
class nsCycleCollectionParticipant;
|
||||
class nsCycleCollectionNoteRootCallback;
|
||||
class nsScriptObjectTracer;
|
||||
|
||||
// Various methods the cycle collector needs to deal with Javascript.
|
||||
struct nsCycleCollectionJSRuntime
|
||||
@ -52,12 +51,7 @@ struct nsCycleCollectionJSRuntime
|
||||
*/
|
||||
virtual nsCycleCollectionParticipant *GetParticipant() = 0;
|
||||
|
||||
virtual void AddJSHolder(void* aHolder, nsScriptObjectTracer* aTracer) = 0;
|
||||
virtual void RemoveJSHolder(void* aHolder) = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual bool TestJSHolder(void* aHolder) = 0;
|
||||
|
||||
virtual void SetObjectToUnlink(void* aObject) = 0;
|
||||
virtual void AssertNoObjectsToTrace(void* aPossibleJSHolder) = 0;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user