mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1116622 - Give TemporaryRef a take() method semantically equivalent to already_AddRefed::take(); r=froydnj
This is in preparation of removing TemporaryRef. It should help make already_AddRefed a drop-in replacement for it.
This commit is contained in:
parent
213d9b2833
commit
38ae0bc54f
@ -28,7 +28,7 @@ public:
|
||||
NS_IMETHOD Run() {
|
||||
// It guarantees the reference will be released on main thread.
|
||||
nsCountedRef<nsMainThreadSourceSurfaceRef> surface;
|
||||
surface.own(mImage->GetAsSourceSurface().drop());
|
||||
surface.own(mImage->GetAsSourceSurface().take());
|
||||
|
||||
if (surface->GetFormat() == gfx::SurfaceFormat::B8G8R8A8) {
|
||||
mDataSourceSurface = surface->GetDataSurface();
|
||||
|
@ -394,7 +394,7 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface,
|
||||
|
||||
cairo_surface_set_user_data(surf,
|
||||
&surfaceDataKey,
|
||||
data.forget().drop(),
|
||||
data.forget().take(),
|
||||
ReleaseData);
|
||||
return surf;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ ImageContainer::ImageContainer(int flag)
|
||||
if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
|
||||
// the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
|
||||
// of this class must be done on the ImageBridge thread.
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE).drop();
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE).take();
|
||||
MOZ_ASSERT(mImageClient);
|
||||
}
|
||||
}
|
||||
@ -169,7 +169,7 @@ ImageContainer::CreateImage(ImageFormat aFormat)
|
||||
// If this ImageContainer is async but the image type mismatch, fix it here
|
||||
if (ImageBridgeChild::IsCreated()) {
|
||||
ImageBridgeChild::DispatchReleaseImageClient(mImageClient);
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE_OVERLAY).drop();
|
||||
mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::IMAGE_OVERLAY).take();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ SharedPlanarYCbCrImage::~SharedPlanarYCbCrImage() {
|
||||
|
||||
if (mCompositable->GetAsyncID() != 0 &&
|
||||
!InImageBridgeChildThread()) {
|
||||
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient.forget().drop());
|
||||
ImageBridgeChild::DispatchReleaseImageClient(mCompositable.forget().drop());
|
||||
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient.forget().take());
|
||||
ImageBridgeChild::DispatchReleaseImageClient(mCompositable.forget().take());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ SharedRGBImage::~SharedRGBImage()
|
||||
|
||||
if (mCompositable->GetAsyncID() != 0 &&
|
||||
!InImageBridgeChildThread()) {
|
||||
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient.forget().drop());
|
||||
ImageBridgeChild::DispatchReleaseImageClient(mCompositable.forget().drop());
|
||||
ImageBridgeChild::DispatchReleaseTextureClient(mTextureClient.forget().take());
|
||||
ImageBridgeChild::DispatchReleaseImageClient(mCompositable.forget().take());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
if (dt) {
|
||||
BlitSurface(dest->GetDrawTarget(), destRect, dt);
|
||||
frame->Properties().Set(nsIFrame::CachedBackgroundImageDT(), dt.forget().drop());
|
||||
frame->Properties().Set(nsIFrame::CachedBackgroundImageDT(), dt.forget().take());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -783,7 +783,7 @@ class TransportConduitTest : public ::testing::Test
|
||||
|
||||
mozilla::SyncRunnable::DispatchToThread(gMainThread,
|
||||
WrapRunnable(
|
||||
videoSession.forget().drop(),
|
||||
videoSession.forget().take(),
|
||||
&mozilla::VideoSessionConduit::Release));
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ class RefPtr
|
||||
public:
|
||||
RefPtr() : mPtr(0) {}
|
||||
RefPtr(const RefPtr& aOther) : mPtr(ref(aOther.mPtr)) {}
|
||||
MOZ_IMPLICIT RefPtr(const TemporaryRef<T>& aOther) : mPtr(aOther.drop()) {}
|
||||
MOZ_IMPLICIT RefPtr(const TemporaryRef<T>& aOther) : mPtr(aOther.take()) {}
|
||||
MOZ_IMPLICIT RefPtr(T* aVal) : mPtr(ref(aVal)) {}
|
||||
|
||||
template<typename U>
|
||||
@ -250,7 +250,7 @@ public:
|
||||
}
|
||||
RefPtr& operator=(const TemporaryRef<T>& aOther)
|
||||
{
|
||||
assign(aOther.drop());
|
||||
assign(aOther.take());
|
||||
return *this;
|
||||
}
|
||||
RefPtr& operator=(T* aVal)
|
||||
@ -321,14 +321,14 @@ class TemporaryRef
|
||||
|
||||
public:
|
||||
MOZ_IMPLICIT TemporaryRef(T* aVal) : mPtr(RefPtr<T>::ref(aVal)) {}
|
||||
TemporaryRef(const TemporaryRef& aOther) : mPtr(aOther.drop()) {}
|
||||
TemporaryRef(const TemporaryRef& aOther) : mPtr(aOther.take()) {}
|
||||
|
||||
template<typename U>
|
||||
TemporaryRef(const TemporaryRef<U>& aOther) : mPtr(aOther.drop()) {}
|
||||
TemporaryRef(const TemporaryRef<U>& aOther) : mPtr(aOther.take()) {}
|
||||
|
||||
~TemporaryRef() { RefPtr<T>::unref(mPtr); }
|
||||
|
||||
T* drop() const
|
||||
MOZ_WARN_UNUSED_RESULT T* take() const
|
||||
{
|
||||
T* tmp = mPtr;
|
||||
mPtr = nullptr;
|
||||
|
@ -396,7 +396,7 @@ nsresult nsCocoaUtils::CreateCGImageFromSurface(SourceSurface* aSurface,
|
||||
// Create a CGImageRef with the bits from the image, taking into account
|
||||
// the alpha ordering and endianness of the machine so we don't have to
|
||||
// touch the bits ourselves.
|
||||
CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(dataSurface.forget().drop(),
|
||||
CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(dataSurface.forget().take(),
|
||||
map.mData,
|
||||
map.mStride * height,
|
||||
data_ss_release_callback);
|
||||
|
Loading…
Reference in New Issue
Block a user