Bug 1272398 - use UniquePtr instead of nsAutoPtr for {Layer,LayerData}::RemoveUserData return type; r=jrmuizel

This commit is contained in:
Nathan Froyd 2016-05-24 18:17:27 -04:00
Родитель 636ad8d0dc
Коммит ff4717e53a
3 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -219,10 +219,10 @@ LayerManager::LayerUserDataDestroy(void* data)
delete static_cast<LayerUserData*>(data);
}
nsAutoPtr<LayerUserData>
UniquePtr<LayerUserData>
LayerManager::RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
UniquePtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}
@ -2148,10 +2148,10 @@ Layer::IsBackfaceHidden()
return false;
}
nsAutoPtr<LayerUserData>
UniquePtr<LayerUserData>
Layer::RemoveUserData(void* aKey)
{
nsAutoPtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
UniquePtr<LayerUserData> d(static_cast<LayerUserData*>(mUserData.Remove(static_cast<gfx::UserDataKey*>(aKey))));
return d;
}

Просмотреть файл

@ -505,7 +505,7 @@ public:
/**
* This can be used anytime. Ownership passes to the caller!
*/
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey);
UniquePtr<LayerUserData> RemoveUserData(void* aKey);
/**
* This getter can be used anytime.
@ -1462,7 +1462,7 @@ public:
/**
* This can be used anytime. Ownership passes to the caller!
*/
nsAutoPtr<LayerUserData> RemoveUserData(void* aKey);
UniquePtr<LayerUserData> RemoveUserData(void* aKey);
/**
* This getter can be used anytime.
*/

Просмотреть файл

@ -150,9 +150,9 @@ TEST(Layers, UserData) {
layer.SetUserData(key3, data3);
// Also checking that the user data is returned but not free'd
UniquePtr<LayerUserData> d1(layer.RemoveUserData(key1).forget());
UniquePtr<LayerUserData> d2(layer.RemoveUserData(key2).forget());
UniquePtr<LayerUserData> d3(layer.RemoveUserData(key3).forget());
UniquePtr<LayerUserData> d1(layer.RemoveUserData(key1));
UniquePtr<LayerUserData> d2(layer.RemoveUserData(key2));
UniquePtr<LayerUserData> d3(layer.RemoveUserData(key3));
ASSERT_EQ(data1, d1.get());
ASSERT_EQ(data2, d2.get());
ASSERT_EQ(data3, d3.get());