Bug 1230034 part 2 - Constify aFrame parameters of frame property functions. r=dbaron

--HG--
extra : source : c77565f815bd055a551679290da8cb985d2d2bb0
This commit is contained in:
Xidorn Quan 2016-01-28 14:23:59 +11:00
parent 5832852fe0
commit c0de0d582b
4 changed files with 23 additions and 22 deletions

View File

@ -234,7 +234,7 @@ FrameLayerBuilder::DisplayItemData::BeginUpdate(Layer* aLayer, LayerState aState
}
}
static nsIFrame* sDestroyedFrame = nullptr;
static const nsIFrame* sDestroyedFrame = nullptr;
FrameLayerBuilder::DisplayItemData::~DisplayItemData()
{
MOZ_COUNT_DTOR(FrameLayerBuilder::DisplayItemData);
@ -1709,7 +1709,7 @@ GetTranslationForPaintedLayer(PaintedLayer* aLayer)
*/
/* static */ void
FrameLayerBuilder::RemoveFrameFromLayerManager(nsIFrame* aFrame,
FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
void* aPropertyValue)
{
MOZ_RELEASE_ASSERT(!sDestroyedFrame);

View File

@ -514,7 +514,7 @@ protected:
friend class LayerManagerData;
static void RemoveFrameFromLayerManager(nsIFrame* aFrame, void* aPropertyValue);
static void RemoveFrameFromLayerManager(const nsIFrame* aFrame, void* aPropertyValue);
/**
* Given a frame and a display item key that uniquely identifies a

View File

@ -10,7 +10,8 @@
namespace mozilla {
void
FramePropertyTable::Set(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
FramePropertyTable::Set(const nsIFrame* aFrame,
const FramePropertyDescriptor* aProperty,
void* aValue)
{
NS_ASSERTION(aFrame, "Null frame?");
@ -71,7 +72,7 @@ FramePropertyTable::Get(const nsIFrame* aFrame,
}
if (mLastFrame != aFrame) {
mLastFrame = const_cast<nsIFrame*>(aFrame);
mLastFrame = aFrame;
mLastEntry = mEntries.GetEntry(mLastFrame);
}
Entry* entry = mLastEntry;
@ -103,7 +104,8 @@ FramePropertyTable::Get(const nsIFrame* aFrame,
}
void*
FramePropertyTable::Remove(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
FramePropertyTable::Remove(const nsIFrame* aFrame,
const FramePropertyDescriptor* aProperty,
bool* aFoundResult)
{
NS_ASSERTION(aFrame, "Null frame?");
@ -164,7 +166,8 @@ FramePropertyTable::Remove(nsIFrame* aFrame, const FramePropertyDescriptor* aPro
}
void
FramePropertyTable::Delete(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty)
FramePropertyTable::Delete(const nsIFrame* aFrame,
const FramePropertyDescriptor* aProperty)
{
NS_ASSERTION(aFrame, "Null frame?");
NS_ASSERTION(aProperty, "Null property?");
@ -193,7 +196,7 @@ FramePropertyTable::DeleteAllForEntry(Entry* aEntry)
}
void
FramePropertyTable::DeleteAllFor(nsIFrame* aFrame)
FramePropertyTable::DeleteAllFor(const nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "Null frame?");

View File

@ -18,7 +18,7 @@ namespace mozilla {
struct FramePropertyDescriptor;
typedef void (*FramePropertyDestructor)(void* aPropertyValue);
typedef void (*FramePropertyDestructorWithFrame)(nsIFrame* aFrame,
typedef void (*FramePropertyDestructorWithFrame)(const nsIFrame* aFrame,
void* aPropertyValue);
/**
@ -79,7 +79,7 @@ public:
* the properties of that frame. Any existing value for the property
* is destroyed.
*/
void Set(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
void Set(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
void* aValue);
/**
* Get a property value for a frame. This requires one hashtable
@ -104,7 +104,7 @@ public:
* disambiguate a null result, which can mean 'no such property' or
* 'property value is null'.
*/
void* Remove(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
void* Remove(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty,
bool* aFoundResult = nullptr);
/**
* Remove and destroy a property value for a frame. This requires one
@ -112,12 +112,12 @@ public:
* through the properties of that frame. If the frame has no such
* property, nothing happens.
*/
void Delete(nsIFrame* aFrame, const FramePropertyDescriptor* aProperty);
void Delete(const nsIFrame* aFrame, const FramePropertyDescriptor* aProperty);
/**
* Remove and destroy all property values for a frame. This requires one
* hashtable lookup (using the frame as the key).
*/
void DeleteAllFor(nsIFrame* aFrame);
void DeleteAllFor(const nsIFrame* aFrame);
/**
* Remove and destroy all property values for all frames.
*/
@ -142,7 +142,7 @@ protected:
return reinterpret_cast<nsTArray<PropertyValue>*>(&mValue);
}
void DestroyValueFor(nsIFrame* aFrame) {
void DestroyValueFor(const nsIFrame* aFrame) {
if (mProperty->mDestructor) {
mProperty->mDestructor(mValue);
} else if (mProperty->mDestructorWithFrame) {
@ -189,12 +189,12 @@ protected:
* Our hashtable entry. The key is an nsIFrame*, the value is a
* PropertyValue representing one or more property/value pairs.
*/
class Entry : public nsPtrHashKey<nsIFrame>
class Entry : public nsPtrHashKey<const nsIFrame>
{
public:
explicit Entry(KeyTypePointer aKey) : nsPtrHashKey<nsIFrame>(aKey) {}
explicit Entry(KeyTypePointer aKey) : nsPtrHashKey<const nsIFrame>(aKey) {}
Entry(const Entry &toCopy) :
nsPtrHashKey<nsIFrame>(toCopy), mProp(toCopy.mProp) {}
nsPtrHashKey<const nsIFrame>(toCopy), mProp(toCopy.mProp) {}
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
return mProp.SizeOfExcludingThis(aMallocSizeOf);
@ -206,7 +206,7 @@ protected:
static void DeleteAllForEntry(Entry* aEntry);
nsTHashtable<Entry> mEntries;
nsIFrame* mLastFrame;
const nsIFrame* mLastFrame;
Entry* mLastEntry;
};
@ -215,10 +215,8 @@ protected:
*/
class FrameProperties {
public:
FrameProperties(FramePropertyTable* aTable, nsIFrame* aFrame)
: mTable(aTable), mFrame(aFrame) {}
FrameProperties(FramePropertyTable* aTable, const nsIFrame* aFrame)
: mTable(aTable), mFrame(const_cast<nsIFrame*>(aFrame)) {}
: mTable(aTable), mFrame(aFrame) {}
void Set(const FramePropertyDescriptor* aProperty, void* aValue) const
{
@ -241,7 +239,7 @@ public:
private:
FramePropertyTable* mTable;
nsIFrame* mFrame;
const nsIFrame* mFrame;
};
} // namespace mozilla