Bug 1217662 - part 4 - move {LayerManager,Layer}::RemoveUserData out-of-line; r=mattwoodrow

Having these out-of-line means that we don't have to have
LayerUserData's destructor in scope for the destruction of the local
nsAutoPtr.  This change will enable us to forward-declare LayerUserData
in Layers.h and thereby encourage people to use the correct header for
LayerUserData.
This commit is contained in:
Nathan Froyd 2015-10-22 16:57:29 -04:00
parent e826816d24
commit 6ce5981d38
2 changed files with 17 additions and 10 deletions

View File

@ -211,6 +211,13 @@ LayerManager::LayerUserDataDestroy(void* data)
delete static_cast<LayerUserData*>(data);
}
nsAutoPtr<LayerUserData>
LayerManager::RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}
//--------------------------------------------------
// Layer
@ -2064,6 +2071,13 @@ Layer::IsBackfaceHidden()
return false;
}
nsAutoPtr<LayerUserData>
Layer::RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}
void
PaintedLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
{

View File

@ -502,11 +502,8 @@ public:
/**
* This can be used anytime. Ownership passes to the caller!
*/
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey);
/**
* This getter can be used anytime.
*/
@ -1384,11 +1381,7 @@ public:
/**
* This can be used anytime. Ownership passes to the caller!
*/
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey);
/**
* This getter can be used anytime.
*/