Bug 1480971 - add AccessibleNode::mRelationProperties to NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE r=surkov

change the type of AccessibleNode::mRelationProperties to nsRefPtrHashtable and add it to NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE
This commit is contained in:
Tokio Kajitsuka 2018-08-04 19:47:50 +09:00
parent 0357c6d134
commit 0b25579f2d
2 changed files with 5 additions and 7 deletions

View file

@ -32,7 +32,8 @@ AccessibleNode::IsAOMEnabled(JSContext* aCx, JSObject* /*unused*/)
return nsContentUtils::IsSystemCaller(aCx) || sPrefCacheValue;
}
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AccessibleNode, mIntl, mDOMNode, mStates)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AccessibleNode, mRelationProperties,
mIntl, mDOMNode, mStates)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AccessibleNode)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY

View file

@ -8,6 +8,7 @@
#define A11Y_AOM_ACCESSIBLENODE_H
#include "nsDataHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
@ -238,11 +239,7 @@ protected:
already_AddRefed<AccessibleNode> GetProperty(AOMRelationProperty aProperty)
{
RefPtr<AccessibleNode> data;
if (mRelationProperties.Get(static_cast<int>(aProperty), &data)) {
return data.forget();
}
return nullptr;
return mRelationProperties.Get(static_cast<int>(aProperty));
}
void SetProperty(AOMRelationProperty aProperty,
@ -258,7 +255,7 @@ protected:
// The 2k'th bit indicates whether the k'th boolean property is used(1) or not(0)
// and 2k+1'th bit contains the property's value(1:true, 0:false)
uint32_t mBooleanProperties;
nsDataHashtable<nsUint32HashKey, RefPtr<AccessibleNode> > mRelationProperties;
nsRefPtrHashtable<nsUint32HashKey, AccessibleNode> mRelationProperties;
nsDataHashtable<nsUint32HashKey, nsString> mStringProperties;
RefPtr<a11y::Accessible> mIntl;