Bug 778036 - Add Has function to gfx::UserData and use it in Layers to correctly check for existance of user data. r=roc

This commit is contained in:
Matt Woodrow 2012-08-03 17:38:44 -07:00
parent bd240c97f8
commit 452cca761a
2 changed files with 12 additions and 2 deletions

View File

@ -82,6 +82,16 @@ public:
return NULL;
}
bool Has(UserDataKey *key)
{
for (int i=0; i<count; i++) {
if (key == entries[i].key) {
return true;
}
}
return false;
}
void Destroy()
{
for (int i=0; i<count; i++) {

View File

@ -393,7 +393,7 @@ public:
*/
bool HasUserData(void* aKey)
{
return GetUserData(aKey);
return mUserData.Has(static_cast<gfx::UserDataKey*>(aKey));
}
/**
* This getter can be used anytime. Ownership is retained by the layer
@ -756,7 +756,7 @@ public:
*/
bool HasUserData(void* aKey)
{
return GetUserData(aKey);
return mUserData.Has(static_cast<gfx::UserDataKey*>(aKey));
}
/**
* This getter can be used anytime. Ownership is retained by the layer