mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-12 23:12:21 +00:00
Bug 1119753 - Fix CPOW GC crash (r=jonco)
This commit is contained in:
parent
d0d97ad7ef
commit
5c867be0e8
@ -51,11 +51,9 @@ JavaScriptParent::init()
|
||||
void
|
||||
JavaScriptParent::trace(JSTracer *trc)
|
||||
{
|
||||
if (active()) {
|
||||
objects_.trace(trc);
|
||||
unwaivedObjectIds_.trace(trc);
|
||||
waivedObjectIds_.trace(trc);
|
||||
}
|
||||
objects_.trace(trc);
|
||||
unwaivedObjectIds_.trace(trc);
|
||||
waivedObjectIds_.trace(trc);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
|
@ -73,6 +73,18 @@ IdToObjectMap::remove(ObjectId id)
|
||||
table_.remove(id);
|
||||
}
|
||||
|
||||
void
|
||||
IdToObjectMap::clear()
|
||||
{
|
||||
table_.clear();
|
||||
}
|
||||
|
||||
bool
|
||||
IdToObjectMap::empty() const
|
||||
{
|
||||
return table_.empty();
|
||||
}
|
||||
|
||||
ObjectToIdMap::ObjectToIdMap()
|
||||
: table_(nullptr)
|
||||
{
|
||||
@ -157,6 +169,12 @@ ObjectToIdMap::remove(JSObject *obj)
|
||||
table_->remove(obj);
|
||||
}
|
||||
|
||||
void
|
||||
ObjectToIdMap::clear()
|
||||
{
|
||||
table_->clear();
|
||||
}
|
||||
|
||||
bool JavaScriptShared::sLoggingInitialized;
|
||||
bool JavaScriptShared::sLoggingEnabled;
|
||||
bool JavaScriptShared::sStackLoggingEnabled;
|
||||
@ -181,6 +199,11 @@ JavaScriptShared::JavaScriptShared(JSRuntime *rt)
|
||||
}
|
||||
}
|
||||
|
||||
JavaScriptShared::~JavaScriptShared()
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(cpows_.empty());
|
||||
}
|
||||
|
||||
bool
|
||||
JavaScriptShared::init()
|
||||
{
|
||||
|
@ -110,6 +110,9 @@ class IdToObjectMap
|
||||
JSObject *find(ObjectId id);
|
||||
void remove(ObjectId id);
|
||||
|
||||
void clear();
|
||||
bool empty() const;
|
||||
|
||||
private:
|
||||
Table table_;
|
||||
};
|
||||
@ -131,6 +134,7 @@ class ObjectToIdMap
|
||||
bool add(JSContext *cx, JSObject *obj, ObjectId id);
|
||||
ObjectId find(JSObject *obj);
|
||||
void remove(JSObject *obj);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
static void keyMarkCallback(JSTracer *trc, JSObject *key, void *data);
|
||||
@ -144,7 +148,7 @@ class JavaScriptShared
|
||||
{
|
||||
public:
|
||||
explicit JavaScriptShared(JSRuntime *rt);
|
||||
virtual ~JavaScriptShared() {}
|
||||
virtual ~JavaScriptShared();
|
||||
|
||||
bool init();
|
||||
|
||||
|
@ -877,6 +877,10 @@ void
|
||||
WrapperOwner::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
inactive_ = true;
|
||||
|
||||
objects_.clear();
|
||||
unwaivedObjectIds_.clear();
|
||||
waivedObjectIds_.clear();
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user