Bug 931285, part 2 - Implement a cycle collected version of nsHashPropertyBag and use it from JS. r=froydnj

This commit is contained in:
Andrew McCreight 2014-09-08 09:41:32 -07:00
parent 623aaaa7d9
commit 01d312c5b8
4 changed files with 34 additions and 2 deletions

View File

@ -63,7 +63,7 @@
COMPONENT(VARIANT, nsVariantConstructor)
COMPONENT(INTERFACEINFOMANAGER_SERVICE, nsXPTIInterfaceInfoManagerGetSingleton)
COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagConstructor)
COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagCCConstructor)
COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor)

View File

@ -215,7 +215,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(VisualEventTracer)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariant)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBag)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBagCC)
NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsProperties)

View File

@ -271,3 +271,21 @@ NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
NS_INTERFACE_MAP_END
/*
* nsHashPropertyBagCC implementation.
*/
NS_IMPL_CYCLE_COLLECTION(nsHashPropertyBagCC, mPropertyHash)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsHashPropertyBagCC)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHashPropertyBagCC)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHashPropertyBagCC)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
NS_INTERFACE_MAP_END

View File

@ -10,6 +10,8 @@
#include "nsIVariant.h"
#include "nsIWritablePropertyBag.h"
#include "nsIWritablePropertyBag2.h"
#include "nsCycleCollectionParticipant.h"
#include "nsInterfaceHashtable.h"
class nsHashPropertyBagBase
@ -40,4 +42,16 @@ protected:
virtual ~nsHashPropertyBag() {}
};
/* A cycle collected nsHashPropertyBag for main-thread-only use. */
class nsHashPropertyBagCC MOZ_FINAL : public nsHashPropertyBagBase
{
public:
nsHashPropertyBagCC() {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHashPropertyBagCC,
nsIWritablePropertyBag)
protected:
virtual ~nsHashPropertyBagCC() {}
};
#endif /* nsHashPropertyBag_h___ */