Bug 1119753 - Fix CPOW GC crash (r=jonco)

This commit is contained in:
Bill McCloskey 2015-01-16 09:56:30 -08:00
parent d0d97ad7ef
commit 5c867be0e8
4 changed files with 35 additions and 6 deletions

View File

@ -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 *

View File

@ -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()
{

View File

@ -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();

View File

@ -877,6 +877,10 @@ void
WrapperOwner::ActorDestroy(ActorDestroyReason why)
{
inactive_ = true;
objects_.clear();
unwaivedObjectIds_.clear();
waivedObjectIds_.clear();
}
bool