From 5254890206baee7acca4716b2a4213a329e99576 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Sun, 18 Oct 2015 00:40:10 -0400 Subject: [PATCH] Bug 1207245 - part 3 - switch all uses of mozilla::RefPtr to nsRefPtr; r=ehsan This commit was generated using the following script, executed at the top level of a typical source code checkout. # Don't modify select files in mfbt/ because it's not worth trying to # tease out the dependencies currently. # # Don't modify anything in media/gmp-clearkey/0.1/ because those files # use their own RefPtr, defined in their own RefCounted.h. find . -name '*.cpp' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ grep -v 'mfbt/RefPtr.h' | \ grep -v 'mfbt/nsRefPtr.h' | \ grep -v 'mfbt/RefCounted.h' | \ grep -v 'media/gmp-clearkey/0.1/' | \ xargs perl -p -i -e ' s/mozilla::RefPtr/nsRefPtr/g; # handle declarations in headers s/\bRefPtr surface = + nsRefPtr surface = aImage->GetFrame(imgIContainer::FRAME_FIRST, imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE); @@ -1087,7 +1087,7 @@ WriteBitmap(nsIFile* aFile, imgIContainer* aImage) MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 || surface->GetFormat() == SurfaceFormat::B8G8R8X8); - RefPtr dataSurface = surface->GetDataSurface(); + nsRefPtr dataSurface = surface->GetDataSurface(); NS_ENSURE_TRUE(dataSurface, NS_ERROR_FAILURE); int32_t width = dataSurface->GetSize().width; diff --git a/devtools/shared/heapsnapshot/HeapSnapshot.h b/devtools/shared/heapsnapshot/HeapSnapshot.h index b4c9593cd71..e809ea63462 100644 --- a/devtools/shared/heapsnapshot/HeapSnapshot.h +++ b/devtools/shared/heapsnapshot/HeapSnapshot.h @@ -13,7 +13,7 @@ #include "mozilla/HashFunctions.h" #include "mozilla/Maybe.h" #include "mozilla/RefCounted.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" diff --git a/devtools/shared/security/LocalCertService.cpp b/devtools/shared/security/LocalCertService.cpp index eb580577d99..0dbfdbf4497 100644 --- a/devtools/shared/security/LocalCertService.cpp +++ b/devtools/shared/security/LocalCertService.cpp @@ -5,7 +5,7 @@ #include "LocalCertService.h" #include "mozilla/ModuleUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "cert.h" #include "CryptoTask.h" #include "nsIPK11Token.h" @@ -419,7 +419,7 @@ LocalCertService::GetOrCreateCert(const nsACString& aNickname, return NS_OK; } - RefPtr task(new LocalCertGetTask(aNickname, aCallback)); + nsRefPtr task(new LocalCertGetTask(aNickname, aCallback)); return task->Dispatch("LocalCertGet"); } @@ -441,7 +441,7 @@ LocalCertService::RemoveCert(const nsACString& aNickname, return NS_OK; } - RefPtr task( + nsRefPtr task( new LocalCertRemoveTask(aNickname, aCallback)); return task->Dispatch("LocalCertRm"); } diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp index 74dff8734e4..036d4cc2d32 100644 --- a/dom/base/ImageEncoder.cpp +++ b/dom/base/ImageEncoder.cpp @@ -9,7 +9,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/layers/AsyncCanvasRenderer.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/SyncRunnable.h" #include "mozilla/unused.h" #include "gfxUtils.h" @@ -53,8 +53,8 @@ public: } private: - RefPtr mImage; - RefPtr mDataSourceSurface; + nsRefPtr mImage; + nsRefPtr mDataSourceSurface; }; // This function returns a DataSourceSurface in B8G8R8A8 format. @@ -402,8 +402,8 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType, imgIEncoder::INPUT_FORMAT_HOSTARGB, aOptions); } else { - RefPtr dataSurface; - RefPtr image(aImage); + nsRefPtr dataSurface; + nsRefPtr image(aImage); dataSurface = GetBRGADataSourceSurfaceSync(image.forget()); DataSourceSurface::MappedSurface map; @@ -428,7 +428,7 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType, // note that if we didn't have a current context, the spec says we're // supposed to just return transparent black pixels of the canvas // dimensions. - RefPtr emptyCanvas = + nsRefPtr emptyCanvas = Factory::CreateDataSourceSurfaceWithStride(IntSize(aSize.width, aSize.height), SurfaceFormat::B8G8R8A8, 4 * aSize.width, true); diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 9943ca8f80a..6b788947778 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -7497,11 +7497,11 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable, // Images to be placed on the clipboard are imgIContainers. nsCOMPtr image(do_QueryInterface(data)); if (image) { - RefPtr surface = + nsRefPtr surface = image->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (surface) { - mozilla::RefPtr dataSurface = + nsRefPtr dataSurface = surface->GetDataSurface(); size_t length; int32_t stride; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index e877252bca1..66c19d9fc99 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1425,8 +1425,8 @@ nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement *aCanvas1, retVal == nullptr) return NS_ERROR_FAILURE; - RefPtr img1 = CanvasToDataSourceSurface(aCanvas1); - RefPtr img2 = CanvasToDataSourceSurface(aCanvas2); + nsRefPtr img1 = CanvasToDataSourceSurface(aCanvas1); + nsRefPtr img2 = CanvasToDataSourceSurface(aCanvas2); DataSourceSurface::ScopedMap map1(img1, DataSourceSurface::READ); DataSourceSurface::ScopedMap map2(img2, DataSourceSurface::READ); @@ -2268,7 +2268,7 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds) nsRefreshDriver* driver = presContext->RefreshDriver(); driver->AdvanceTimeAndRefresh(aMilliseconds); - RefPtr transaction = GetLayerTransaction(); + nsRefPtr transaction = GetLayerTransaction(); if (transaction && transaction->IPCOpen()) { transaction->SendSetTestSampleTime(driver->MostRecentRefresh()); } @@ -2283,7 +2283,7 @@ nsDOMWindowUtils::RestoreNormalRefresh() // Kick the compositor out of test mode before the refresh driver, so that // the refresh driver doesn't send an update that gets ignored by the // compositor. - RefPtr transaction = GetLayerTransaction(); + nsRefPtr transaction = GetLayerTransaction(); if (transaction && transaction->IPCOpen()) { transaction->SendLeaveTestMode(); } diff --git a/dom/bluetooth/bluedroid/BluetoothMapSmsManager.cpp b/dom/bluetooth/bluedroid/BluetoothMapSmsManager.cpp index 25e26a31824..c0b8756dbdf 100644 --- a/dom/bluetooth/bluedroid/BluetoothMapSmsManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothMapSmsManager.cpp @@ -17,7 +17,7 @@ #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/File.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 7b56a251d0f..459798eb4b6 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -16,7 +16,7 @@ #include "mozilla/dom/bluetooth/BluetoothTypes.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/File.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" diff --git a/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp b/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp index 8069b99bc8f..7792021905c 100644 --- a/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothPbapManager.cpp @@ -15,7 +15,7 @@ #include "mozilla/dom/BluetoothPbapParametersBinding.h" #include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" diff --git a/dom/bluetooth/bluedroid/BluetoothSocket.cpp b/dom/bluetooth/bluedroid/BluetoothSocket.cpp index f4593ff84c8..12e316b3d2c 100644 --- a/dom/bluetooth/bluedroid/BluetoothSocket.cpp +++ b/dom/bluetooth/bluedroid/BluetoothSocket.cpp @@ -12,7 +12,7 @@ #include "BluetoothUtils.h" #include "mozilla/ipc/UnixSocketWatcher.h" #include "mozilla/FileUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR #include "nsXULAppAPI.h" diff --git a/dom/bluetooth/bluez/BluetoothOppManager.cpp b/dom/bluetooth/bluez/BluetoothOppManager.cpp index ed459314b96..b16700dc491 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluez/BluetoothOppManager.cpp @@ -16,7 +16,7 @@ #include "mozilla/dom/bluetooth/BluetoothTypes.h" #include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" diff --git a/dom/bluetooth/bluez/BluetoothSocket.cpp b/dom/bluetooth/bluez/BluetoothSocket.cpp index 57e5a40dd3e..b6464a69124 100644 --- a/dom/bluetooth/bluez/BluetoothSocket.cpp +++ b/dom/bluetooth/bluez/BluetoothSocket.cpp @@ -8,7 +8,7 @@ #include #include "BluetoothSocketObserver.h" #include "BluetoothUnixSocketConnector.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR #include "nsXULAppAPI.h" diff --git a/dom/camera/GonkCameraHwMgr.cpp b/dom/camera/GonkCameraHwMgr.cpp index abe492527c1..23719ad84c0 100644 --- a/dom/camera/GonkCameraHwMgr.cpp +++ b/dom/camera/GonkCameraHwMgr.cpp @@ -27,7 +27,7 @@ #include "nsDebug.h" #include "mozilla/layers/TextureClient.h" #include "CameraPreferences.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21 #include "GonkBufferQueueProducer.h" #endif @@ -71,7 +71,7 @@ GonkCameraHardware::OnNewFrame() if (mClosing) { return; } - RefPtr buffer = mNativeWindow->getCurrentBuffer(); + nsRefPtr buffer = mNativeWindow->getCurrentBuffer(); if (!buffer) { DOM_CAMERA_LOGE("received null frame"); return; diff --git a/dom/camera/GonkRecorder.h b/dom/camera/GonkRecorder.h index 27b61967fb8..3092e057131 100644 --- a/dom/camera/GonkRecorder.h +++ b/dom/camera/GonkRecorder.h @@ -29,7 +29,7 @@ #include #endif -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "GonkCameraHwMgr.h" namespace android { diff --git a/dom/canvas/CanvasGradient.h b/dom/canvas/CanvasGradient.h index edf219a8d27..74411b7930d 100644 --- a/dom/canvas/CanvasGradient.h +++ b/dom/canvas/CanvasGradient.h @@ -7,7 +7,7 @@ #include "mozilla/Attributes.h" #include "nsTArray.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/CanvasRenderingContext2D.h" #include "mozilla/gfx/2D.h" @@ -70,7 +70,7 @@ protected: nsRefPtr mContext; nsTArray mRawStops; - mozilla::RefPtr mStops; + nsRefPtr mStops; Type mType; virtual ~CanvasGradient() {} }; diff --git a/dom/canvas/CanvasImageCache.cpp b/dom/canvas/CanvasImageCache.cpp index a4f66bda106..0ce68997905 100644 --- a/dom/canvas/CanvasImageCache.cpp +++ b/dom/canvas/CanvasImageCache.cpp @@ -52,7 +52,7 @@ struct ImageCacheEntryData { nsRefPtr mCanvas; // Value nsCOMPtr mRequest; - RefPtr mSourceSurface; + nsRefPtr mSourceSurface; IntSize mSize; nsExpirationState mState; }; @@ -110,7 +110,7 @@ public: enum { ALLOW_MEMMOVE = true }; nsCOMPtr mRequest; - RefPtr mSourceSurface; + nsRefPtr mSourceSurface; }; static bool sPrefsInitialized = false; diff --git a/dom/canvas/CanvasPath.h b/dom/canvas/CanvasPath.h index 64ceb73d104..5c66b100a59 100644 --- a/dom/canvas/CanvasPath.h +++ b/dom/canvas/CanvasPath.h @@ -6,7 +6,7 @@ #define CanvasPath_h #include "mozilla/Attributes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsWrapperCache.h" #include "mozilla/gfx/2D.h" #include "mozilla/dom/BindingDeclarations.h" @@ -75,8 +75,8 @@ private: nsCOMPtr mParent; static gfx::Float ToFloat(double aValue) { return gfx::Float(aValue); } - mutable RefPtr mPath; - mutable RefPtr mPathBuilder; + mutable nsRefPtr mPath; + mutable nsRefPtr mPathBuilder; void EnsurePathBuilder() const; }; diff --git a/dom/canvas/CanvasPattern.h b/dom/canvas/CanvasPattern.h index 3744c367968..ea4825e62a7 100644 --- a/dom/canvas/CanvasPattern.h +++ b/dom/canvas/CanvasPattern.h @@ -8,7 +8,7 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/CanvasRenderingContext2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupports.h" #include "nsWrapperCache.h" @@ -66,7 +66,7 @@ public: void SetTransform(SVGMatrix& matrix); nsRefPtr mContext; - RefPtr mSurface; + nsRefPtr mSurface; nsCOMPtr mPrincipal; mozilla::gfx::Matrix mTransform; const bool mForceWriteOnly; diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 8f14a959065..a8fb499ebbf 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -350,7 +350,7 @@ public: return nullptr; } - RefPtr dt = + nsRefPtr dt = mFinalTarget->CreateSimilarDrawTarget(aRect.Size(), SurfaceFormat::B8G8R8A8); if (!dt) { aRect.SetEmpty(); @@ -376,11 +376,11 @@ public: return; } - RefPtr snapshot = mTarget->Snapshot(); + nsRefPtr snapshot = mTarget->Snapshot(); - RefPtr fillPaint = + nsRefPtr fillPaint = DoSourcePaint(mFillPaintRect, CanvasRenderingContext2D::Style::FILL); - RefPtr strokePaint = + nsRefPtr strokePaint = DoSourcePaint(mStrokePaintRect, CanvasRenderingContext2D::Style::STROKE); AutoRestoreTransform autoRestoreTransform(mFinalTarget); @@ -403,8 +403,8 @@ public: } private: - RefPtr mTarget; - RefPtr mFinalTarget; + nsRefPtr mTarget; + nsRefPtr mFinalTarget; CanvasRenderingContext2D *mCtx; gfx::IntRect mSourceGraphicRect; gfx::IntRect mFillPaintRect; @@ -471,7 +471,7 @@ public: return; } - RefPtr snapshot = mTarget->Snapshot(); + nsRefPtr snapshot = mTarget->Snapshot(); mFinalTarget->DrawSurfaceWithShadow(snapshot, mTempRect.TopLeft(), Color::FromABGR(mCtx->CurrentState().shadowColor), @@ -490,8 +490,8 @@ public: } private: - RefPtr mTarget; - RefPtr mFinalTarget; + nsRefPtr mTarget; + nsRefPtr mFinalTarget; CanvasRenderingContext2D *mCtx; Float mSigma; gfx::IntRect mTempRect; @@ -645,7 +645,7 @@ private: return gfx::Rect(extents.GetBounds()); } - RefPtr mTarget; + nsRefPtr mTarget; UniquePtr mShadowTarget; UniquePtr mFilterTarget; }; @@ -1205,7 +1205,7 @@ bool CanvasRenderingContext2D::SwitchRenderingMode(RenderingMode aRenderingMode) } #endif - RefPtr snapshot; + nsRefPtr snapshot; Matrix transform; if (mTarget) { @@ -1644,12 +1644,12 @@ CanvasRenderingContext2D::GetImageBuffer(uint8_t** aImageBuffer, *aFormat = 0; EnsureTarget(); - RefPtr snapshot = mTarget->Snapshot(); + nsRefPtr snapshot = mTarget->Snapshot(); if (!snapshot) { return; } - RefPtr data = snapshot->GetDataSurface(); + nsRefPtr data = snapshot->GetDataSurface(); if (!data || data->GetSize() != IntSize(mWidth, mHeight)) { return; } @@ -2057,7 +2057,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& source, nsICanvasRenderingContextInternal *srcCanvas = canvas->GetContextAtIndex(0); if (srcCanvas) { // This might not be an Azure canvas! - RefPtr srcSurf = srcCanvas->GetSurfaceSnapshot(); + nsRefPtr srcSurf = srcCanvas->GetSurfaceSnapshot(); nsRefPtr pat = new CanvasPattern(this, srcSurf, repeatMode, htmlElement->NodePrincipal(), canvas->IsWriteOnly(), false); @@ -2078,7 +2078,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& source, // Special case for ImageBitmap ImageBitmap& imgBitmap = source.GetAsImageBitmap(); EnsureTarget(); - RefPtr srcSurf = imgBitmap.PrepareForDrawTarget(mTarget); + nsRefPtr srcSurf = imgBitmap.PrepareForDrawTarget(mTarget); // An ImageBitmap never taints others so we set principalForSecurityCheck to // nullptr and set CORSUsed to true for passing the security check in @@ -2700,7 +2700,7 @@ void CanvasRenderingContext2D::Fill(const CanvasPath& path, const CanvasWindingR { EnsureTarget(); - RefPtr gfxpath = path.GetPath(winding, mTarget); + nsRefPtr gfxpath = path.GetPath(winding, mTarget); if (!gfxpath) { return; @@ -2753,7 +2753,7 @@ CanvasRenderingContext2D::Stroke(const CanvasPath& path) { EnsureTarget(); - RefPtr gfxpath = path.GetPath(CanvasWindingRule::Nonzero, mTarget); + nsRefPtr gfxpath = path.GetPath(CanvasWindingRule::Nonzero, mTarget); if (!gfxpath) { return; @@ -2872,7 +2872,7 @@ CanvasRenderingContext2D::Clip(const CanvasPath& path, const CanvasWindingRule& { EnsureTarget(); - RefPtr gfxpath = path.GetPath(winding, mTarget); + nsRefPtr gfxpath = path.GetPath(winding, mTarget); if (!gfxpath) { return; @@ -3058,7 +3058,7 @@ CanvasRenderingContext2D::EnsureUserSpacePath(const CanvasWindingRule& winding) } if (mDSPathBuilder) { - RefPtr dsPath; + nsRefPtr dsPath; dsPath = mDSPathBuilder->Finish(); mDSPathBuilder = nullptr; @@ -3314,7 +3314,7 @@ CanvasRenderingContext2D::MeasureText(const nsAString& rawText, void CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorResult& error) { - RefPtr path; + nsRefPtr path; if (options.mPath) { EnsureTarget(); path = options.mPath->GetPath(CanvasWindingRule::Nonzero, mTarget); @@ -3361,7 +3361,7 @@ CanvasRenderingContext2D::AddHitRegion(const HitRegionOptions& options, ErrorRes RegionInfo info; info.mId = options.mId; info.mElement = options.mControl; - RefPtr pathBuilder = path->TransformedCopyToBuilder(mTarget->GetTransform()); + nsRefPtr pathBuilder = path->TransformedCopyToBuilder(mTarget->GetTransform()); info.mPath = pathBuilder->Finish(); mHitRegionsOptions.InsertElementAt(0, info); @@ -3530,7 +3530,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess const gfxTextRun::CompressedGlyph *glyphs = mTextRun->GetCharacterGlyphs(); - RefPtr scaledFont = + nsRefPtr scaledFont = gfxPlatform::GetPlatform()->GetScaledFontForFont(mCtx->mTarget, font); if (!scaledFont) { @@ -3565,7 +3565,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess mCtx->mTarget->SetTransform(mat); } - RefPtr renderingOptions = font->GetGlyphRenderingOptions(); + nsRefPtr renderingOptions = font->GetGlyphRenderingOptions(); GlyphBuffer buffer; @@ -3678,7 +3678,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess const DrawOptions drawOpts(state.globalAlpha, mCtx->UsedOperation()); for (unsigned i = glyphBuf.size(); i > 0; --i) { - RefPtr path = scaledFont->GetPathForGlyphs(buffer, mCtx->mTarget); + nsRefPtr path = scaledFont->GetPathForGlyphs(buffer, mCtx->mTarget); target->Stroke(path, patForStyle, strokeOpts, drawOpts); buffer.mGlyphs++; } @@ -4189,7 +4189,7 @@ bool CanvasRenderingContext2D::IsPointInPath(const CanvasPath& mPath, double x, } EnsureTarget(); - RefPtr tempPath = mPath.GetPath(mWinding, mTarget); + nsRefPtr tempPath = mPath.GetPath(mWinding, mTarget); return tempPath->ContainsPoint(Point(x, y), mTarget->GetTransform()); } @@ -4229,7 +4229,7 @@ bool CanvasRenderingContext2D::IsPointInStroke(const CanvasPath& mPath, double x } EnsureTarget(); - RefPtr tempPath = mPath.GetPath(CanvasWindingRule::Nonzero, mTarget); + nsRefPtr tempPath = mPath.GetPath(CanvasWindingRule::Nonzero, mTarget); const ContextState &state = CurrentState(); @@ -4254,15 +4254,15 @@ ExtractSubrect(SourceSurface* aSurface, gfx::Rect* aSourceRect, DrawTarget* aTar roundedOutSourceRect.RoundOut(); gfx::IntRect roundedOutSourceRectInt; if (!roundedOutSourceRect.ToIntRect(&roundedOutSourceRectInt)) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } - RefPtr subrectDT = + nsRefPtr subrectDT = aTargetDT->CreateSimilarDrawTarget(roundedOutSourceRectInt.Size(), SurfaceFormat::B8G8R8A8); if (!subrectDT) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } @@ -4376,7 +4376,7 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& image, NormalizeRect(dx, dy, dw, dh); } - RefPtr srcSurf; + nsRefPtr srcSurf; gfx::IntSize imgSize; Element* element = nullptr; @@ -4857,7 +4857,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x, } nsRefPtr thebes; - RefPtr drawDT; + nsRefPtr drawDT; // Rendering directly is faster and can be done if mTarget supports Azure // and does not need alpha blending. if (gfxPlatform::GetPlatform()->SupportsAzureContentForDrawTarget(mTarget) && @@ -4882,15 +4882,15 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x, nsCOMPtr shell = presContext->PresShell(); unused << shell->RenderDocument(r, renderDocFlags, backgroundColor, thebes); if (drawDT) { - RefPtr snapshot = drawDT->Snapshot(); - RefPtr data = snapshot->GetDataSurface(); + nsRefPtr snapshot = drawDT->Snapshot(); + nsRefPtr data = snapshot->GetDataSurface(); DataSourceSurface::MappedSurface rawData; if (NS_WARN_IF(!data->Map(DataSourceSurface::READ, &rawData))) { error.Throw(NS_ERROR_FAILURE); return; } - RefPtr source = + nsRefPtr source = mTarget->CreateSourceSurfaceFromData(rawData.mData, data->GetSize(), rawData.mStride, @@ -5037,7 +5037,7 @@ CanvasRenderingContext2D::DrawWidgetAsOnScreen(nsGlobalWindow& aWindow, error.Throw(NS_ERROR_FAILURE); return; } - RefPtr snapshot = widget->SnapshotWidgetOnScreen(); + nsRefPtr snapshot = widget->SnapshotWidgetOnScreen(); if (!snapshot) { error.Throw(NS_ERROR_FAILURE); return; @@ -5179,10 +5179,10 @@ CanvasRenderingContext2D::GetImageDataArray(JSContext* aCx, IntRect srcRect(0, 0, mWidth, mHeight); IntRect destRect(aX, aY, aWidth, aHeight); IntRect srcReadRect = srcRect.Intersect(destRect); - RefPtr readback; + nsRefPtr readback; DataSourceSurface::MappedSurface rawData; if (!srcReadRect.IsEmpty()) { - RefPtr snapshot = mTarget->Snapshot(); + nsRefPtr snapshot = mTarget->Snapshot(); if (snapshot) { readback = snapshot->GetDataSurface(); } @@ -5274,7 +5274,7 @@ CanvasRenderingContext2D::EnsureErrorTarget() return; } - RefPtr errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8); + nsRefPtr errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8); MOZ_ASSERT(errorTarget, "Failed to allocate the error target!"); sErrorTarget = errorTarget; @@ -5444,7 +5444,7 @@ CanvasRenderingContext2D::PutImageData_explicit(int32_t x, int32_t y, uint32_t w return NS_ERROR_FAILURE; } - RefPtr sourceSurface = + nsRefPtr sourceSurface = mTarget->CreateSourceSurfaceFromData(imgsurf->Data(), IntSize(copyWidth, copyHeight), imgsurf->Stride(), SurfaceFormat::B8G8R8A8); // In certain scenarios, requesting larger than 8k image fails. Bug 803568 @@ -5721,7 +5721,7 @@ CanvasPath::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) already_AddRefed CanvasPath::Constructor(const GlobalObject& aGlobal, CanvasPath& aCanvasPath, ErrorResult& aRv) { - RefPtr tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero, + nsRefPtr tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero, gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); nsRefPtr path = new CanvasPath(aGlobal.GetAsSupports(), tempPath->CopyToBuilder()); @@ -5731,7 +5731,7 @@ CanvasPath::Constructor(const GlobalObject& aGlobal, CanvasPath& aCanvasPath, Er already_AddRefed CanvasPath::Constructor(const GlobalObject& aGlobal, const nsAString& aPathString, ErrorResult& aRv) { - RefPtr tempPath = SVGContentUtils::GetPath(aPathString); + nsRefPtr tempPath = SVGContentUtils::GetPath(aPathString); if (!tempPath) { return Constructor(aGlobal, aRv); } @@ -5895,7 +5895,7 @@ CanvasPath::BezierTo(const gfx::Point& aCP1, void CanvasPath::AddPath(CanvasPath& aCanvasPath, const Optional>& aMatrix) { - RefPtr tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero, + nsRefPtr tempPath = aCanvasPath.GetPath(CanvasWindingRule::Nonzero, gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()); if (aMatrix.WasPassed()) { @@ -5903,7 +5903,7 @@ CanvasPath::AddPath(CanvasPath& aCanvasPath, const Optional>& Matrix transform(m.A(), m.B(), m.C(), m.D(), m.E(), m.F()); if (!transform.IsIdentity()) { - RefPtr tempBuilder = tempPath->TransformedCopyToBuilder(transform, FillRule::FILL_WINDING); + nsRefPtr tempBuilder = tempPath->TransformedCopyToBuilder(transform, FillRule::FILL_WINDING); tempPath = tempBuilder->Finish(); } } @@ -5923,7 +5923,7 @@ CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget) if (mPath && (mPath->GetBackendType() == aTarget->GetBackendType()) && (mPath->GetFillRule() == fillRule)) { - RefPtr path(mPath); + nsRefPtr path(mPath); return path.forget(); } @@ -5932,7 +5932,7 @@ CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget) MOZ_ASSERT(mPathBuilder); mPath = mPathBuilder->Finish(); if (!mPath) { - RefPtr path(mPath); + nsRefPtr path(mPath); return path.forget(); } @@ -5941,15 +5941,15 @@ CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget) // retarget our backend if we're used with a different backend if (mPath->GetBackendType() != aTarget->GetBackendType()) { - RefPtr tmpPathBuilder = aTarget->CreatePathBuilder(fillRule); + nsRefPtr tmpPathBuilder = aTarget->CreatePathBuilder(fillRule); mPath->StreamToSink(tmpPathBuilder); mPath = tmpPathBuilder->Finish(); } else if (mPath->GetFillRule() != fillRule) { - RefPtr tmpPathBuilder = mPath->CopyToBuilder(fillRule); + nsRefPtr tmpPathBuilder = mPath->CopyToBuilder(fillRule); mPath = tmpPathBuilder->Finish(); } - RefPtr path(mPath); + nsRefPtr path(mPath); return path.forget(); } diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h index 0d73a6ca512..b79a000ee71 100644 --- a/dom/canvas/CanvasRenderingContext2D.h +++ b/dom/canvas/CanvasRenderingContext2D.h @@ -9,7 +9,7 @@ #include #include "nsIDOMCanvasRenderingContext2D.h" #include "nsICanvasRenderingContextInternal.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsColor.h" #include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/dom/HTMLVideoElement.h" @@ -729,9 +729,9 @@ protected: // This is created lazily so it is necessary to call EnsureTarget before // accessing it. In the event of an error it will be equal to // sErrorTarget. - mozilla::RefPtr mTarget; + nsRefPtr mTarget; - mozilla::RefPtr mBufferProvider; + nsRefPtr mBufferProvider; uint32_t SkiaGLTex() const; @@ -788,9 +788,9 @@ protected: * * mPath is always in user-space. */ - mozilla::RefPtr mPath; - mozilla::RefPtr mDSPathBuilder; - mozilla::RefPtr mPathBuilder; + nsRefPtr mPath; + nsRefPtr mDSPathBuilder; + nsRefPtr mPathBuilder; bool mPathTransformWillUpdate; mozilla::gfx::Matrix mPathToDS; @@ -809,7 +809,7 @@ protected: // fallback element for a11y nsRefPtr mElement; // Path of the hit region in the 2d context coordinate space (not user space) - RefPtr mPath; + nsRefPtr mPath; }; nsTArray mHitRegionsOptions; @@ -984,7 +984,7 @@ protected: return std::min(SIGMA_MAX, shadowBlur / 2.0f); } - nsTArray > clipsPushed; + nsTArray > clipsPushed; nsRefPtr fontGroup; nsCOMPtr fontLanguage; @@ -1018,7 +1018,7 @@ protected: nsTArray filterChain; nsRefPtr filterChainObserver; mozilla::gfx::FilterDescription filter; - nsTArray> filterAdditionalImages; + nsTArray> filterAdditionalImages; bool imageSmoothingEnabled; bool fontExplicitLanguage; diff --git a/dom/canvas/DocumentRendererChild.cpp b/dom/canvas/DocumentRendererChild.cpp index e176578bab9..8de81d0b1f2 100644 --- a/dom/canvas/DocumentRendererChild.cpp +++ b/dom/canvas/DocumentRendererChild.cpp @@ -9,7 +9,7 @@ #include "gfx2DGlue.h" #include "gfxPattern.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsPIDOMWindow.h" #include "nsIDOMWindow.h" #include "nsIDocShell.h" @@ -74,7 +74,7 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window, // Draw directly into the output array. data.SetLength(renderSize.width * renderSize.height * 4); - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, reinterpret_cast(data.BeginWriting()), IntSize(renderSize.width, renderSize.height), diff --git a/dom/canvas/DocumentRendererParent.cpp b/dom/canvas/DocumentRendererParent.cpp index d9578ac4ee3..730f577f6ca 100644 --- a/dom/canvas/DocumentRendererParent.cpp +++ b/dom/canvas/DocumentRendererParent.cpp @@ -7,7 +7,7 @@ #include "gfx2DGlue.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsICanvasRenderingContextInternal.h" using namespace mozilla; @@ -36,7 +36,7 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize, DrawTarget* drawTarget = mCanvasContext->GetDrawTarget(); Rect rect(0, 0, aSize.width, aSize.height); MaybeSnapToDevicePixels(rect, *drawTarget, true); - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateWrappingDataSourceSurface(reinterpret_cast(const_cast(aData).BeginWriting()), aSize.width * 4, IntSize(aSize.width, aSize.height), diff --git a/dom/canvas/ImageBitmap.cpp b/dom/canvas/ImageBitmap.cpp index 6b8c74a8a4f..e4e9fef376b 100644 --- a/dom/canvas/ImageBitmap.cpp +++ b/dom/canvas/ImageBitmap.cpp @@ -105,7 +105,7 @@ CropAndCopyDataSourceSurface(DataSourceSurface* aSurface, const IntRect& aCropRe const uint32_t dstStride = dstSize.width * bytesPerPixel; // Create a new SourceSurface. - RefPtr dstDataSurface = + nsRefPtr dstDataSurface = Factory::CreateDataSourceSurfaceWithStride(dstSize, format, dstStride, true); if (NS_WARN_IF(!dstDataSurface)) { @@ -181,7 +181,7 @@ CreateSurfaceFromRawData(const gfx::IntSize& aSize, MOZ_ASSERT(aBuffer); // Wrap the source buffer into a SourceSurface. - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateWrappingDataSourceSurface(aBuffer, aStride, aSize, aFormat); if (NS_WARN_IF(!dataSurface)) { @@ -194,7 +194,7 @@ CreateSurfaceFromRawData(const gfx::IntSize& aSize, const IntRect cropRect = aCropRect.valueOr(IntRect(0, 0, aSize.width, aSize.height)); // Copy the source buffer in the _cropRect_ area into a new SourceSurface. - RefPtr result = CropAndCopyDataSourceSurface(dataSurface, cropRect); + nsRefPtr result = CropAndCopyDataSourceSurface(dataSurface, cropRect); if (NS_WARN_IF(!result)) { aRv.Throw(NS_ERROR_NOT_AVAILABLE); @@ -216,7 +216,7 @@ CreateImageFromRawData(const gfx::IntSize& aSize, MOZ_ASSERT(NS_IsMainThread()); // Copy and crop the source buffer into a SourceSurface. - RefPtr rgbaSurface = + nsRefPtr rgbaSurface = CreateSurfaceFromRawData(aSize, aStride, aFormat, aBuffer, aBufferLength, aCropRect, aRv); @@ -226,8 +226,8 @@ CreateImageFromRawData(const gfx::IntSize& aSize, } // Convert RGBA to BGRA - RefPtr rgbaDataSurface = rgbaSurface->GetDataSurface(); - RefPtr bgraDataSurface = + nsRefPtr rgbaDataSurface = rgbaSurface->GetDataSurface(); + nsRefPtr bgraDataSurface = Factory::CreateDataSourceSurfaceWithStride(rgbaDataSurface->GetSize(), SurfaceFormat::B8G8R8A8, rgbaDataSurface->Stride()); @@ -368,7 +368,7 @@ GetSurfaceFromElement(nsIGlobalObject* aGlobal, HTMLElementType& aElement, Error return nullptr; } - RefPtr surface(res.mSourceSurface); + nsRefPtr surface(res.mSourceSurface); return surface.forget(); } @@ -435,7 +435,7 @@ ImageBitmap::PrepareForDrawTarget(gfx::DrawTarget* aTarget) return nullptr; } - RefPtr target = aTarget; + nsRefPtr target = aTarget; IntRect surfRect(0, 0, mSurface->GetSize().width, mSurface->GetSize().height); // Check if we still need to crop our surface @@ -446,7 +446,7 @@ ImageBitmap::PrepareForDrawTarget(gfx::DrawTarget* aTarget) // the crop lies entirely outside the surface area, nothing to draw if (surfPortion.IsEmpty()) { mSurface = nullptr; - RefPtr surface(mSurface); + nsRefPtr surface(mSurface); return surface.forget(); } @@ -461,7 +461,7 @@ ImageBitmap::PrepareForDrawTarget(gfx::DrawTarget* aTarget) if (!target) { mSurface = nullptr; - RefPtr surface(mSurface); + nsRefPtr surface(mSurface); return surface.forget(); } @@ -475,10 +475,10 @@ ImageBitmap::PrepareForDrawTarget(gfx::DrawTarget* aTarget) // if the mPictureRect is not starts from the upper-left point. if (target->GetBackendType() == BackendType::DIRECT2D1_1 && mSurface->GetType() != SurfaceType::D2D1_1_IMAGE) { - RefPtr dataSurface = mSurface->GetDataSurface(); + nsRefPtr dataSurface = mSurface->GetDataSurface(); if (NS_WARN_IF(!dataSurface)) { mSurface = nullptr; - RefPtr surface(mSurface); + nsRefPtr surface(mSurface); return surface.forget(); } @@ -497,7 +497,7 @@ ImageBitmap::PrepareForDrawTarget(gfx::DrawTarget* aTarget) // This call should be a no-op for already-optimized surfaces mSurface = target->OptimizeSourceSurface(mSurface); - RefPtr surface(mSurface); + nsRefPtr surface(mSurface); return surface.forget(); } @@ -519,7 +519,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLImageElement& aImageEl // Get the SourceSurface out from the image element and then do security // checking. - RefPtr surface = GetSurfaceFromElement(aGlobal, aImageEl, aRv); + nsRefPtr surface = GetSurfaceFromElement(aGlobal, aImageEl, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; @@ -596,14 +596,14 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLCanvasElement& aCanvas return nullptr; } - RefPtr surface = GetSurfaceFromElement(aGlobal, aCanvasEl, aRv); + nsRefPtr surface = GetSurfaceFromElement(aGlobal, aCanvasEl, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } // Crop the source surface if needed. - RefPtr croppedSurface; + nsRefPtr croppedSurface; IntRect cropRect = aCropRect.valueOr(IntRect()); // If the HTMLCanvasElement's rendering context is WebGL, then the snapshot @@ -616,7 +616,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, HTMLCanvasElement& aCanvas MOZ_ASSERT(surface->GetType() == SurfaceType::DATA, "The snapshot SourceSurface from WebGL rendering contest is not \ DataSourceSurface."); - RefPtr dataSurface = surface->GetDataSurface(); + nsRefPtr dataSurface = surface->GetDataSurface(); croppedSurface = CropAndCopyDataSourceSurface(dataSurface, cropRect); cropRect.MoveTo(0, 0); } @@ -713,7 +713,7 @@ ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, CanvasRenderingContext2D& return nullptr; } - RefPtr surface = aCanvasCtx.GetSurfaceSnapshot(); + nsRefPtr surface = aCanvasCtx.GetSurfaceSnapshot(); if (NS_WARN_IF(!surface)) { aRv.Throw(NS_ERROR_NOT_AVAILABLE); @@ -863,7 +863,7 @@ DecodeBlob(Blob& aBlob, ErrorResult& aRv) // Get the surface out. uint32_t frameFlags = imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_WANT_DATA_SURFACE; uint32_t whichFrame = imgIContainer::FRAME_FIRST; - RefPtr surface = imgContainer->GetFrame(whichFrame, frameFlags); + nsRefPtr surface = imgContainer->GetFrame(whichFrame, frameFlags); if (NS_WARN_IF(!surface)) { aRv.Throw(NS_ERROR_NOT_AVAILABLE); @@ -877,14 +877,14 @@ static already_AddRefed DecodeAndCropBlob(Blob& aBlob, Maybe& aCropRect, ErrorResult& aRv) { // Decode the blob into a SourceSurface. - RefPtr surface = DecodeBlob(aBlob, aRv); + nsRefPtr surface = DecodeBlob(aBlob, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } // Crop the source surface if needed. - RefPtr croppedSurface = surface; + nsRefPtr croppedSurface = surface; if (aCropRect.isSome()) { // The blob is just decoded into a RasterImage and not optimized yet, so the @@ -899,7 +899,7 @@ DecodeAndCropBlob(Blob& aBlob, Maybe& aCropRect, ErrorResult& aRv) // TODO: Bug1189632 is going to refactor this create-from-blob part to // decode the blob off the main thread. Re-check if we should do // cropping at this moment again there. - RefPtr dataSurface = surface->GetDataSurface(); + nsRefPtr dataSurface = surface->GetDataSurface(); croppedSurface = CropAndCopyDataSourceSurface(dataSurface, aCropRect.ref()); aCropRect->MoveTo(0, 0); } @@ -964,7 +964,7 @@ protected: nsRefPtr mPromise; nsCOMPtr mGlobalObject; - RefPtr mBlob; + nsRefPtr mBlob; Maybe mCropRect; }; diff --git a/dom/canvas/ImageBitmap.h b/dom/canvas/ImageBitmap.h index f80f3ce4524..3bef7a2b7cd 100644 --- a/dom/canvas/ImageBitmap.h +++ b/dom/canvas/ImageBitmap.h @@ -159,7 +159,7 @@ protected: * buffer. */ nsRefPtr mData; - RefPtr mSurface; + nsRefPtr mSurface; /* * The mPictureRect is the size of the source image in default, however, if diff --git a/dom/canvas/OffscreenCanvas.h b/dom/canvas/OffscreenCanvas.h index cdad6bcce8e..0a95c885abc 100644 --- a/dom/canvas/OffscreenCanvas.h +++ b/dom/canvas/OffscreenCanvas.h @@ -9,7 +9,7 @@ #include "mozilla/DOMEventTargetHelper.h" #include "mozilla/layers/LayersTypes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "CanvasRenderingContextHelper.h" #include "nsCycleCollectionParticipant.h" @@ -38,7 +38,7 @@ struct OffscreenCanvasCloneData final bool aNeutered); ~OffscreenCanvasCloneData(); - RefPtr mRenderer; + nsRefPtr mRenderer; uint32_t mWidth; uint32_t mHeight; layers::LayersBackend mCompositorBackendType; @@ -170,7 +170,7 @@ private: layers::LayersBackend mCompositorBackendType; layers::CanvasClient* mCanvasClient; - RefPtr mCanvasRenderer; + nsRefPtr mCanvasRenderer; }; } // namespace dom diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 777d1f6787c..91d25f97e0f 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -561,7 +561,7 @@ static already_AddRefed CreateGLWithEGL(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags, WebGLContext* webgl) { - RefPtr gl; + nsRefPtr gl; #ifndef XP_MACOSX // Mac doesn't have GLContextProviderEGL. gfx::IntSize dummySize(16, 16); gl = gl::GLContextProviderEGL::CreateOffscreen(dummySize, caps, @@ -581,7 +581,7 @@ static already_AddRefed CreateGLWithANGLE(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags, WebGLContext* webgl) { - RefPtr gl; + nsRefPtr gl; #ifdef XP_WIN gfx::IntSize dummySize(16, 16); @@ -613,7 +613,7 @@ CreateGLWithDefault(const gl::SurfaceCaps& caps, gl::CreateContextFlags flags, } gfx::IntSize dummySize(16, 16); - RefPtr gl = gl::GLContextProvider::CreateOffscreen(dummySize, caps, flags); + nsRefPtr gl = gl::GLContextProvider::CreateOffscreen(dummySize, caps, flags); if (!gl) { webgl->GenerateWarning("Error during native OpenGL init."); return nullptr; @@ -1055,14 +1055,14 @@ WebGLContext::GetImageBuffer(uint8_t** out_imageBuffer, int32_t* out_format) // Use GetSurfaceSnapshot() to make sure that appropriate y-flip gets applied bool premult; - RefPtr snapshot = + nsRefPtr snapshot = GetSurfaceSnapshot(mOptions.premultipliedAlpha ? nullptr : &premult); if (!snapshot) return; MOZ_ASSERT(mOptions.premultipliedAlpha || !premult, "We must get unpremult when we ask for it!"); - RefPtr dataSurface = snapshot->GetDataSurface(); + nsRefPtr dataSurface = snapshot->GetDataSurface(); return gfxUtils::GetImageBuffer(dataSurface, mOptions.premultipliedAlpha, out_imageBuffer, out_format); @@ -1079,14 +1079,14 @@ WebGLContext::GetInputStream(const char* mimeType, // Use GetSurfaceSnapshot() to make sure that appropriate y-flip gets applied bool premult; - RefPtr snapshot = + nsRefPtr snapshot = GetSurfaceSnapshot(mOptions.premultipliedAlpha ? nullptr : &premult); if (!snapshot) return NS_ERROR_FAILURE; MOZ_ASSERT(mOptions.premultipliedAlpha || !premult, "We must get unpremult when we ask for it!"); - RefPtr dataSurface = snapshot->GetDataSurface(); + nsRefPtr dataSurface = snapshot->GetDataSurface(); return gfxUtils::GetInputStream(dataSurface, mOptions.premultipliedAlpha, mimeType, encoderOptions, out_stream); } @@ -1752,7 +1752,7 @@ WebGLContext::GetSurfaceSnapshot(bool* out_premultAlpha) bool hasAlpha = mOptions.alpha; SurfaceFormat surfFormat = hasAlpha ? SurfaceFormat::B8G8R8A8 : SurfaceFormat::B8G8R8X8; - RefPtr surf; + nsRefPtr surf; surf = Factory::CreateDataSourceSurfaceWithStride(IntSize(mWidth, mHeight), surfFormat, mWidth * 4); @@ -1780,7 +1780,7 @@ WebGLContext::GetSurfaceSnapshot(bool* out_premultAlpha) } } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(mWidth, mHeight), SurfaceFormat::B8G8R8A8); diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index 7badc1320f3..347be4dc56d 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -1290,7 +1290,7 @@ protected: nsresult SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res, - RefPtr& imageOut, + nsRefPtr& imageOut, WebGLTexelFormat* format); // Returns false if `object` is null or not valid. @@ -1360,7 +1360,7 @@ protected: void ResolveTexturesForDraw() const; WebGLRefPtr mCurrentProgram; - RefPtr mActiveProgramLinkInfo; + nsRefPtr mActiveProgramLinkInfo; GLenum LastColorAttachment() const { return LOCAL_GL_COLOR_ATTACHMENT0 + mGLMaxColorAttachments - 1; @@ -1453,7 +1453,7 @@ protected: GLsizei mViewportHeight; bool mAlreadyWarnedAboutViewportLargerThanDest; - RefPtr mContextLossHandler; + nsRefPtr mContextLossHandler; bool mAllowContextRestore; bool mLastLossWasSimulated; ContextStatus mContextStatus; diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 4b70290cff7..54fd154b7b8 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1885,14 +1885,14 @@ WebGLContext::StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum nsresult WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res, - RefPtr& imageOut, + nsRefPtr& imageOut, WebGLTexelFormat* format) { *format = WebGLTexelFormat::None; if (!res.mSourceSurface) return NS_OK; - RefPtr data = res.mSourceSurface->GetDataSurface(); + nsRefPtr data = res.mSourceSurface->GetDataSurface(); if (!data) { // SurfaceFromElement lied! return NS_OK; diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp index 6295baadfe1..0fa8312c99c 100644 --- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -71,10 +71,10 @@ ParseName(const nsCString& name, nsCString* const out_baseName, static void AddActiveInfo(WebGLContext* webgl, GLint elemCount, GLenum elemType, bool isArray, const nsACString& baseUserName, const nsACString& baseMappedName, - std::vector>* activeInfoList, + std::vector>* activeInfoList, std::map* infoLocMap) { - RefPtr info = new WebGLActiveInfo(webgl, elemCount, elemType, + nsRefPtr info = new WebGLActiveInfo(webgl, elemCount, elemType, isArray, baseUserName, baseMappedName); activeInfoList->push_back(info); @@ -85,9 +85,9 @@ AddActiveInfo(WebGLContext* webgl, GLint elemCount, GLenum elemType, bool isArra static void AddActiveBlockInfo(const nsACString& baseUserName, const nsACString& baseMappedName, - std::vector>* activeInfoList) + std::vector>* activeInfoList) { - RefPtr info = new webgl::UniformBlockInfo(baseUserName, baseMappedName); + nsRefPtr info = new webgl::UniformBlockInfo(baseUserName, baseMappedName); activeInfoList->push_back(info); } @@ -97,7 +97,7 @@ AddActiveBlockInfo(const nsACString& baseUserName, static already_AddRefed QueryProgramInfo(WebGLProgram* prog, gl::GLContext* gl) { - RefPtr info(new webgl::LinkedProgramInfo(prog)); + nsRefPtr info(new webgl::LinkedProgramInfo(prog)); GLuint maxAttribLenWithNull = 0; gl->fGetProgramiv(prog->mGLName, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, @@ -437,7 +437,7 @@ WebGLProgram::GetActiveAttrib(GLuint index) const return nullptr; } - RefPtr ret = activeList[index]; + nsRefPtr ret = activeList[index]; return ret.forget(); } @@ -458,7 +458,7 @@ WebGLProgram::GetActiveUniform(GLuint index) const return nullptr; } - RefPtr ret = activeList[index]; + nsRefPtr ret = activeList[index]; return ret.forget(); } @@ -598,7 +598,7 @@ WebGLProgram::GetUniformBlockIndex(const nsAString& userName_wide) const if (!ParseName(userName, &baseUserName, &isArray, &arrayIndex)) return LOCAL_GL_INVALID_INDEX; - RefPtr info; + nsRefPtr info; if (!LinkInfo()->FindUniformBlock(baseUserName, &info)) { return LOCAL_GL_INVALID_INDEX; } @@ -1025,7 +1025,7 @@ WebGLProgram::GetTransformFeedbackVarying(GLuint index) LinkInfo()->FindAttrib(varyingUserName, (const WebGLActiveInfo**) &info); MOZ_ASSERT(info); - RefPtr ret(info); + nsRefPtr ret(info); return ret.forget(); } diff --git a/dom/canvas/WebGLProgram.h b/dom/canvas/WebGLProgram.h index 030bd84f8db..e126795fae2 100644 --- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -11,7 +11,7 @@ #include #include "mozilla/LinkedList.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/WeakPtr.h" #include "nsString.h" #include "nsWrapperCache.h" @@ -59,8 +59,8 @@ struct LinkedProgramInfo final MOZ_DECLARE_WEAKREFERENCE_TYPENAME(LinkedProgramInfo) WebGLProgram* const prog; - std::vector> activeAttribs; - std::vector> activeUniforms; + std::vector> activeAttribs; + std::vector> activeUniforms; // Needed for Get{Attrib,Uniform}Location. The keys for these are non-mapped // user-facing `GLActiveInfo::name`s, without any final "[0]". @@ -68,7 +68,7 @@ struct LinkedProgramInfo final std::map uniformMap; std::map* fragDataMap; - std::vector> uniformBlocks; + std::vector> uniformBlocks; // Needed for draw call validation. std::set activeAttribLocs; @@ -98,7 +98,7 @@ struct LinkedProgramInfo final } bool FindUniformBlock(const nsCString& baseUserName, - RefPtr* const out_info) const + nsRefPtr* const out_info) const { const size_t count = uniformBlocks.size(); for (size_t i = 0; i < count; i++) { @@ -211,7 +211,7 @@ private: std::vector mTransformFeedbackVaryings; GLenum mTransformFeedbackBufferMode; nsCString mLinkLog; - RefPtr mMostRecentLinkInfo; + nsRefPtr mMostRecentLinkInfo; // Storage for transform feedback varyings before link. // (Work around for bug seen on nVidia drivers.) std::vector mTempMappedVaryings; diff --git a/dom/canvas/WebGLTextureUpload.cpp b/dom/canvas/WebGLTextureUpload.cpp index 6a6b3f047c8..d7fc53c156c 100644 --- a/dom/canvas/WebGLTextureUpload.cpp +++ b/dom/canvas/WebGLTextureUpload.cpp @@ -696,7 +696,7 @@ WebGLTexture::TexImage2D(TexImageTarget texImageTarget, GLint level, return; } - RefPtr data; + nsRefPtr data; WebGLTexelFormat srcFormat; nsLayoutUtils::SurfaceFromElementResult res = mContext->SurfaceFromElement(elem); *out_rv = mContext->SurfaceFromElementResultToImageSurface(res, data, &srcFormat); @@ -1014,7 +1014,7 @@ WebGLTexture::TexSubImage2D(TexImageTarget texImageTarget, GLint level, GLint xO return; } - RefPtr data; + nsRefPtr data; WebGLTexelFormat srcFormat; nsLayoutUtils::SurfaceFromElementResult res = mContext->SurfaceFromElement(elem); *out_rv = mContext->SurfaceFromElementResultToImageSurface(res, data, &srcFormat); diff --git a/dom/canvas/nsICanvasRenderingContextInternal.h b/dom/canvas/nsICanvasRenderingContextInternal.h index 8b46f427ef7..7cb058dd263 100644 --- a/dom/canvas/nsICanvasRenderingContextInternal.h +++ b/dom/canvas/nsICanvasRenderingContextInternal.h @@ -13,7 +13,7 @@ #include "nsRefreshDriver.h" #include "mozilla/dom/HTMLCanvasElement.h" #include "mozilla/dom/OffscreenCanvas.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #define NS_ICANVASRENDERINGCONTEXTINTERNAL_IID \ { 0xb84f2fed, 0x9d4b, 0x430b, \ diff --git a/dom/devicestorage/DeviceStorage.h b/dom/devicestorage/DeviceStorage.h index d41840cb402..2ee7199d713 100644 --- a/dom/devicestorage/DeviceStorage.h +++ b/dom/devicestorage/DeviceStorage.h @@ -10,7 +10,7 @@ #include "nsIFile.h" #include "nsIPrincipal.h" #include "mozilla/DOMEventTargetHelper.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/StaticPtr.h" #include "mozilla/dom/DOMRequest.h" #include "nsWeakReference.h" diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp index fcaa822906f..13b1494086d 100644 --- a/dom/html/HTMLCanvasElement.cpp +++ b/dom/html/HTMLCanvasElement.cpp @@ -67,9 +67,9 @@ public: } static already_AddRefed - CopySurface(const RefPtr& aSurface) + CopySurface(const nsRefPtr& aSurface) { - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { return nullptr; } @@ -79,7 +79,7 @@ public: return nullptr; } - RefPtr copy = + nsRefPtr copy = Factory::CreateDataSourceSurfaceWithStride(data->GetSize(), data->GetFormat(), read.GetStride()); @@ -122,12 +122,12 @@ public: return; } - RefPtr snapshot = mOwningElement->GetSurfaceSnapshot(nullptr); + nsRefPtr snapshot = mOwningElement->GetSurfaceSnapshot(nullptr); if (!snapshot) { return; } - RefPtr copy = CopySurface(snapshot); + nsRefPtr copy = CopySurface(snapshot); mOwningElement->SetFrameCapture(copy.forget()); mOwningElement->MarkContextCleanForFrameCapture(); @@ -177,7 +177,7 @@ private: bool mRegistered; HTMLCanvasElement* const mOwningElement; - RefPtr mRefreshDriver; + nsRefPtr mRefreshDriver; }; // --------------------------------------------------------------------------- @@ -1169,7 +1169,7 @@ HTMLCanvasElement::IsFrameCaptureRequested() const void HTMLCanvasElement::SetFrameCapture(already_AddRefed aSurface) { - RefPtr surface = aSurface; + nsRefPtr surface = aSurface; CairoImage::Data imageData; imageData.mSize = surface->GetSize(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index a52b73e13ce..cbb29658cb6 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2765,7 +2765,7 @@ ContentParent::RecvSetClipboard(const IPCDataTransfer& aDataTransfer, } nsCString text = item.data().get_nsCString(); - mozilla::RefPtr image = + nsRefPtr image = new mozilla::gfx::SourceSurfaceRawData(); mozilla::gfx::SourceSurfaceRawData* raw = static_cast(image.get()); diff --git a/dom/ipc/StructuredCloneData.h b/dom/ipc/StructuredCloneData.h index 4e7f842d3c8..0641cbc5d0b 100644 --- a/dom/ipc/StructuredCloneData.h +++ b/dom/ipc/StructuredCloneData.h @@ -8,7 +8,7 @@ #define mozilla_dom_ipc_StructuredCloneData_h #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/dom/StructuredCloneHolder.h" #include "nsISupportsImpl.h" @@ -138,7 +138,7 @@ private: uint64_t* MOZ_NON_OWNING_REF mExternalData; size_t mExternalDataLength; - RefPtr mSharedData; + nsRefPtr mSharedData; }; } // namespace ipc diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index ffae8041a14..7aa4467ce52 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2114,7 +2114,7 @@ TabParent::RecvSetCustomCursor(const nsCString& aCursorData, if (mTabSetsCursor) { const gfx::IntSize size(aWidth, aHeight); - mozilla::RefPtr customCursor = new mozilla::gfx::SourceSurfaceRawData(); + nsRefPtr customCursor = new mozilla::gfx::SourceSurfaceRawData(); mozilla::gfx::SourceSurfaceRawData* raw = static_cast(customCursor.get()); raw->InitWrappingData( reinterpret_cast(const_cast(aCursorData).BeginWriting()), @@ -3601,7 +3601,7 @@ TabParent::AddInitialDnDDataTo(DataTransfer* aDataTransfer) } void -TabParent::TakeDragVisualization(RefPtr& aSurface, +TabParent::TakeDragVisualization(nsRefPtr& aSurface, int32_t& aDragAreaX, int32_t& aDragAreaY) { aSurface = mDnDVisualization.forget(); diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index b7644ed6e85..80e1993c157 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -15,7 +15,7 @@ #include "mozilla/dom/TabContext.h" #include "mozilla/EventForwards.h" #include "mozilla/dom/File.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsIAuthPromptProvider.h" #include "nsIBrowserDOMWindow.h" @@ -450,7 +450,7 @@ public: void AddInitialDnDDataTo(DataTransfer* aDataTransfer); - void TakeDragVisualization(RefPtr& aSurface, + void TakeDragVisualization(nsRefPtr& aSurface, int32_t& aDragAreaX, int32_t& aDragAreaY); layout::RenderFrameParent* GetRenderFrame(); @@ -566,7 +566,7 @@ private: }; nsTArray> mInitialDataTransferItems; - mozilla::RefPtr mDnDVisualization; + nsRefPtr mDnDVisualization; int32_t mDragAreaX; int32_t mDragAreaY; diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index e444540ff9a..21396e926f4 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -12,7 +12,7 @@ #include "nsThreadUtils.h" #include "mozilla/dom/AudioChannelBinding.h" #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "mozilla/UniquePtr.h" #include "CubebUtils.h" diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 8ee37e2886c..a50552b3c3b 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -538,7 +538,7 @@ DOMMediaStream::AddTrack(MediaStreamTrack& aTrack) { MOZ_RELEASE_ASSERT(mPlaybackStream); - RefPtr dest = mPlaybackStream->AsProcessedStream(); + nsRefPtr dest = mPlaybackStream->AsProcessedStream(); MOZ_ASSERT(dest); if (!dest) { return; @@ -573,10 +573,10 @@ DOMMediaStream::AddTrack(MediaStreamTrack& aTrack) return; } - RefPtr addedDOMStream = aTrack.GetStream(); + nsRefPtr addedDOMStream = aTrack.GetStream(); MOZ_RELEASE_ASSERT(addedDOMStream); - RefPtr owningStream = addedDOMStream->GetOwnedStream(); + nsRefPtr owningStream = addedDOMStream->GetOwnedStream(); MOZ_RELEASE_ASSERT(owningStream); CombineWithPrincipal(addedDOMStream->mPrincipal); diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index 32abffa3293..4d6dda1da5c 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -338,7 +338,7 @@ MediaDecoderReader::RequestVideoData(bool aSkipToNextKeyframe, // keyframe. Post another task to the decode task queue to decode // again. We don't just decode straight in a loop here, as that // would hog the decode task queue. - RefPtr task(new ReRequestVideoWithSkipTask(this, aTimeThreshold)); + nsRefPtr task(new ReRequestVideoWithSkipTask(this, aTimeThreshold)); mTaskQueue->Dispatch(task.forget()); return p; } @@ -374,7 +374,7 @@ MediaDecoderReader::RequestAudioData() // coming in gstreamer 1.x when there is still video buffer waiting to be // consumed. (|mVideoSinkBufferCount| > 0) if (AudioQueue().GetSize() == 0) { - RefPtr task(new ReRequestAudioTask(this)); + nsRefPtr task(new ReRequestAudioTask(this)); mTaskQueue->Dispatch(task.forget()); return p; } diff --git a/dom/media/MediaDecoderReader.h b/dom/media/MediaDecoderReader.h index 73e6b166a27..fdcb4a35aa9 100644 --- a/dom/media/MediaDecoderReader.h +++ b/dom/media/MediaDecoderReader.h @@ -293,7 +293,7 @@ public: // trigger-happy with notifications anyway. void DispatchNotifyDataArrived(uint32_t aLength, int64_t aOffset, bool aThrottleUpdates) { - RefPtr r = + nsRefPtr r = NS_NewRunnableMethodWithArg>(this, aThrottleUpdates ? &MediaDecoderReader::ThrottledNotifyDataArrived : &MediaDecoderReader::NotifyDataArrived, media::Interval(aOffset, aOffset + aLength)); diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 730528220ba..0b5ff65d88d 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -2230,7 +2230,7 @@ MediaDecoderStateMachine::FinishShutdown() // dispatch an event to the main thread to release the decoder and // state machine. DECODER_LOG("Shutting down state machine task queue"); - RefPtr disposer = new DecoderDisposer(mDecoder, this); + nsRefPtr disposer = new DecoderDisposer(mDecoder, this); OwnerThread()->BeginShutdown()->Then(AbstractThread::MainThread(), __func__, disposer.get(), &DecoderDisposer::OnTaskQueueShutdown, diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 66cf6b79cb4..c887817ee76 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -828,7 +828,7 @@ MediaFormatReader::ScheduleUpdate(TrackType aTrack) } LOGV("SchedulingUpdate(%s)", TrackTypeToStr(aTrack)); decoder.mUpdateScheduled = true; - RefPtr task( + nsRefPtr task( NS_NewRunnableMethodWithArg(this, &MediaFormatReader::Update, aTrack)); OwnerThread()->Dispatch(task.forget()); } @@ -1262,7 +1262,7 @@ MediaFormatReader::Output(TrackType aTrack, MediaData* aSample) return; } - RefPtr task = + nsRefPtr task = NS_NewRunnableMethodWithArgs( this, &MediaFormatReader::NotifyNewOutput, aTrack, aSample); OwnerThread()->Dispatch(task.forget()); @@ -1271,7 +1271,7 @@ MediaFormatReader::Output(TrackType aTrack, MediaData* aSample) void MediaFormatReader::DrainComplete(TrackType aTrack) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethodWithArg( this, &MediaFormatReader::NotifyDrainComplete, aTrack); OwnerThread()->Dispatch(task.forget()); @@ -1280,7 +1280,7 @@ MediaFormatReader::DrainComplete(TrackType aTrack) void MediaFormatReader::InputExhausted(TrackType aTrack) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethodWithArg( this, &MediaFormatReader::NotifyInputExhausted, aTrack); OwnerThread()->Dispatch(task.forget()); @@ -1289,7 +1289,7 @@ MediaFormatReader::InputExhausted(TrackType aTrack) void MediaFormatReader::Error(TrackType aTrack) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethodWithArg( this, &MediaFormatReader::NotifyError, aTrack); OwnerThread()->Dispatch(task.forget()); @@ -1407,7 +1407,7 @@ MediaFormatReader::Seek(int64_t aTime, int64_t aUnused) nsRefPtr p = mSeekPromise.Ensure(__func__); - RefPtr task( + nsRefPtr task( NS_NewRunnableMethod(this, &MediaFormatReader::AttemptSeek)); OwnerThread()->Dispatch(task.forget()); diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index d0e8c9ede0f..55c38204190 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -2602,7 +2602,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic, } } nsRefPtr mReply; - RefPtr mBackend; + nsRefPtr mBackend; }; // Post ShutdownTask to execute on mMediaThread and pass in a lambda @@ -2615,7 +2615,7 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic, // note that this == sSingleton nsRefPtr that(sSingleton); // Release the backend (and call Shutdown()) from within the MediaManager thread - RefPtr temp; + nsRefPtr temp; { MutexAutoLock lock(mMutex); temp = mBackend.forget(); diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index d4f259bd7db..a6c61145b65 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -533,7 +533,7 @@ private: Mutex mMutex; // protected with mMutex: - RefPtr mBackend; + nsRefPtr mBackend; static StaticRefPtr sSingleton; diff --git a/dom/media/MediaResource.cpp b/dom/media/MediaResource.cpp index 57ddaf53765..25d75c101f0 100644 --- a/dom/media/MediaResource.cpp +++ b/dom/media/MediaResource.cpp @@ -1679,7 +1679,7 @@ public: return NS_OK; } - RefPtr mDecoder; + nsRefPtr mDecoder; int64_t mNumBytes; int64_t mOffset; }; @@ -1689,7 +1689,7 @@ void BaseMediaResource::DispatchBytesConsumed(int64_t aNumBytes, int64_t aOffset if (aNumBytes <= 0) { return; } - RefPtr event(new DispatchBytesConsumedEvent(mDecoder, aNumBytes, aOffset)); + nsRefPtr event(new DispatchBytesConsumedEvent(mDecoder, aNumBytes, aOffset)); NS_DispatchToMainThread(event); } diff --git a/dom/media/MediaShutdownManager.h b/dom/media/MediaShutdownManager.h index aa2e2ff1f05..c93bf8c942d 100644 --- a/dom/media/MediaShutdownManager.h +++ b/dom/media/MediaShutdownManager.h @@ -9,7 +9,7 @@ #include "nsIObserver.h" #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/StaticPtr.h" #include "nsIThread.h" #include "nsCOMPtr.h" diff --git a/dom/media/MediaTimer.cpp b/dom/media/MediaTimer.cpp index e563861f2a5..0aad34efa0b 100644 --- a/dom/media/MediaTimer.cpp +++ b/dom/media/MediaTimer.cpp @@ -11,7 +11,7 @@ #include "nsComponentManagerUtils.h" #include "nsThreadUtils.h" #include "mozilla/DebugOnly.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/SharedThreadPool.h" namespace mozilla { @@ -29,7 +29,7 @@ MediaTimer::MediaTimer() // Use the SharedThreadPool to create an nsIThreadPool with a maximum of one // thread, which is equivalent to an nsIThread for our purposes. - RefPtr threadPool( + nsRefPtr threadPool( SharedThreadPool::Get(NS_LITERAL_CSTRING("MediaTimer"), 1)); mThread = threadPool.get(); mTimer->SetTarget(mThread); diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index baeb15ddfdd..bac8633f1a1 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -12,7 +12,7 @@ #include "mozilla/CheckedInt.h" #include "mozilla/MozPromise.h" #include "mozilla/ReentrantMonitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsIThread.h" #include "nsSize.h" diff --git a/dom/media/directshow/AudioSinkFilter.cpp b/dom/media/directshow/AudioSinkFilter.cpp index 3d2b93b46bc..bde01563ec1 100644 --- a/dom/media/directshow/AudioSinkFilter.cpp +++ b/dom/media/directshow/AudioSinkFilter.cpp @@ -143,7 +143,7 @@ AudioSinkFilter::GetSampleSink() if (!mInputPin) { \ return E_NOTIMPL; \ } \ - RefPtr pinSeeking = mInputPin->GetConnectedPinSeeking(); \ + nsRefPtr pinSeeking = mInputPin->GetConnectedPinSeeking(); \ if (!pinSeeking) { \ return E_NOTIMPL; \ } diff --git a/dom/media/directshow/AudioSinkFilter.h b/dom/media/directshow/AudioSinkFilter.h index 85abdfccf7b..451cd2e36e5 100644 --- a/dom/media/directshow/AudioSinkFilter.h +++ b/dom/media/directshow/AudioSinkFilter.h @@ -10,7 +10,7 @@ #include "BaseFilter.h" #include "DirectShowUtils.h" #include "nsAutoPtr.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { diff --git a/dom/media/directshow/AudioSinkInputPin.cpp b/dom/media/directshow/AudioSinkInputPin.cpp index 76d9d227962..38941448395 100644 --- a/dom/media/directshow/AudioSinkInputPin.cpp +++ b/dom/media/directshow/AudioSinkInputPin.cpp @@ -134,11 +134,11 @@ AudioSinkInputPin::Receive(IMediaSample* aSample ) already_AddRefed AudioSinkInputPin::GetConnectedPinSeeking() { - RefPtr peer = GetConnected(); + nsRefPtr peer = GetConnected(); if (!peer) return nullptr; - RefPtr seeking; - peer->QueryInterface(static_cast(byRef(seeking))); + nsRefPtr seeking; + peer->QueryInterface(static_cast(getter_AddRefs(seeking))); return seeking.forget(); } diff --git a/dom/media/directshow/AudioSinkInputPin.h b/dom/media/directshow/AudioSinkInputPin.h index 80503c641ee..aa5694a3322 100644 --- a/dom/media/directshow/AudioSinkInputPin.h +++ b/dom/media/directshow/AudioSinkInputPin.h @@ -9,7 +9,7 @@ #include "BaseInputPin.h" #include "DirectShowUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsAutoPtr.h" namespace mozilla { diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index 9756460183b..0410d42e891 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -6,7 +6,7 @@ #include "DirectShowReader.h" #include "MediaDecoderReader.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "DirectShowUtils.h" #include "AudioSinkFilter.h" #include "SourceFilter.h" @@ -103,7 +103,7 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo, nullptr, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, - reinterpret_cast(static_cast(byRef(mGraph)))); + reinterpret_cast(static_cast(getter_AddRefs(mGraph)))); NS_ENSURE_TRUE(SUCCEEDED(hr) && mGraph, NS_ERROR_FAILURE); rv = ParseMP3Headers(&mMP3FrameParser, mDecoder->GetResource()); @@ -119,10 +119,10 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo, #endif // Extract the interface pointers we'll need from the filter graph. - hr = mGraph->QueryInterface(static_cast(byRef(mControl))); + hr = mGraph->QueryInterface(static_cast(getter_AddRefs(mControl))); NS_ENSURE_TRUE(SUCCEEDED(hr) && mControl, NS_ERROR_FAILURE); - hr = mGraph->QueryInterface(static_cast(byRef(mMediaSeeking))); + hr = mGraph->QueryInterface(static_cast(getter_AddRefs(mMediaSeeking))); NS_ENSURE_TRUE(SUCCEEDED(hr) && mMediaSeeking, NS_ERROR_FAILURE); // Build the graph. Create the filters we need, and connect them. We @@ -140,26 +140,26 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo, NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE); // The MPEG demuxer. - RefPtr demuxer; + nsRefPtr demuxer; hr = CreateAndAddFilter(mGraph, CLSID_MPEG1Splitter, L"MPEG1Splitter", - byRef(demuxer)); + getter_AddRefs(demuxer)); NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE); // Platform MP3 decoder. - RefPtr decoder; + nsRefPtr decoder; // Firstly try to create the MP3 decoder filter that ships with WinXP // directly. This filter doesn't normally exist on later versions of // Windows. hr = CreateAndAddFilter(mGraph, CLSID_MPEG_LAYER_3_DECODER_FILTER, L"MPEG Layer 3 Decoder", - byRef(decoder)); + getter_AddRefs(decoder)); if (FAILED(hr)) { // Failed to create MP3 decoder filter. Try to instantiate // the MP3 decoder DMO. - hr = AddMP3DMOWrapperFilter(mGraph, byRef(decoder)); + hr = AddMP3DMOWrapperFilter(mGraph, getter_AddRefs(decoder)); NS_ENSURE_TRUE(SUCCEEDED(hr), NS_ERROR_FAILURE); } @@ -237,8 +237,8 @@ DirectShowReader::Finish(HRESULT aStatus) LOG("DirectShowReader::Finish(0x%x)", aStatus); // Notify the filter graph of end of stream. - RefPtr eventSink; - HRESULT hr = mGraph->QueryInterface(static_cast(byRef(eventSink))); + nsRefPtr eventSink; + HRESULT hr = mGraph->QueryInterface(static_cast(getter_AddRefs(eventSink))); if (SUCCEEDED(hr) && eventSink) { eventSink->Notify(EC_COMPLETE, aStatus, 0); } @@ -301,7 +301,7 @@ DirectShowReader::DecodeAudioData() // Get the next chunk of audio samples. This blocks until the sample // arrives, or an error occurs (like the stream is shutdown). - RefPtr sample; + nsRefPtr sample; hr = sink->Extract(sample); if (FAILED(hr) || hr == S_FALSE) { return Finish(hr); diff --git a/dom/media/directshow/DirectShowReader.h b/dom/media/directshow/DirectShowReader.h index c9423f5856f..cef26d5eb09 100644 --- a/dom/media/directshow/DirectShowReader.h +++ b/dom/media/directshow/DirectShowReader.h @@ -9,7 +9,7 @@ #include "windows.h" // HRESULT, DWORD #include "MediaDecoderReader.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "MP3FrameParser.h" struct IGraphBuilder; @@ -74,16 +74,16 @@ private: // DirectShow filter graph, and associated playback and seeking // control interfaces. - RefPtr mGraph; - RefPtr mControl; - RefPtr mMediaSeeking; + nsRefPtr mGraph; + nsRefPtr mControl; + nsRefPtr mMediaSeeking; // Wraps the MediaResource, and feeds undecoded data into the filter graph. - RefPtr mSourceFilter; + nsRefPtr mSourceFilter; // Sits at the end of the graph, removing decoded samples from the graph. // The graph will block while this is blocked, i.e. it will pause decoding. - RefPtr mAudioSinkFilter; + nsRefPtr mAudioSinkFilter; // Some MP3s are variable bitrate, so DirectShow's duration estimation // can make its duration estimation based on the wrong bitrate. So we parse diff --git a/dom/media/directshow/DirectShowUtils.cpp b/dom/media/directshow/DirectShowUtils.cpp index c7c02ec5a2d..93732336fbb 100644 --- a/dom/media/directshow/DirectShowUtils.cpp +++ b/dom/media/directshow/DirectShowUtils.cpp @@ -9,7 +9,7 @@ #include "dmoreg.h" #include "nsAutoPtr.h" #include "mozilla/ArrayUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsPrintfCString.h" #define WARN(...) NS_WARNING(nsPrintfCString(__VA_ARGS__).get()) @@ -312,8 +312,8 @@ MatchUnconnectedPin(IPin* aPin, NS_ENSURE_TRUE(aOutMatches, E_POINTER); // Ensure the pin is unconnected. - RefPtr peer; - HRESULT hr = aPin->ConnectedTo(byRef(peer)); + nsRefPtr peer; + HRESULT hr = aPin->ConnectedTo(getter_AddRefs(peer)); if (hr != VFW_E_NOT_CONNECTED) { *aOutMatches = false; return hr; @@ -332,14 +332,14 @@ MatchUnconnectedPin(IPin* aPin, already_AddRefed GetUnconnectedPin(IBaseFilter* aFilter, PIN_DIRECTION aPinDir) { - RefPtr enumPins; + nsRefPtr enumPins; - HRESULT hr = aFilter->EnumPins(byRef(enumPins)); + HRESULT hr = aFilter->EnumPins(getter_AddRefs(enumPins)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); // Test each pin to see if it matches the direction we're looking for. - RefPtr pin; - while (S_OK == enumPins->Next(1, byRef(pin), nullptr)) { + nsRefPtr pin; + while (S_OK == enumPins->Next(1, getter_AddRefs(pin), nullptr)) { bool matches = FALSE; if (SUCCEEDED(MatchUnconnectedPin(pin, aPinDir, &matches)) && matches) { @@ -355,10 +355,10 @@ ConnectFilters(IGraphBuilder* aGraph, IBaseFilter* aOutputFilter, IBaseFilter* aInputFilter) { - RefPtr output = GetUnconnectedPin(aOutputFilter, PINDIR_OUTPUT); + nsRefPtr output = GetUnconnectedPin(aOutputFilter, PINDIR_OUTPUT); NS_ENSURE_TRUE(output, E_FAIL); - RefPtr input = GetUnconnectedPin(aInputFilter, PINDIR_INPUT); + nsRefPtr input = GetUnconnectedPin(aInputFilter, PINDIR_INPUT); NS_ENSURE_TRUE(output, E_FAIL); return aGraph->Connect(output, input); diff --git a/dom/media/directshow/SampleSink.cpp b/dom/media/directshow/SampleSink.cpp index 54b62508d26..be4f2a7efb5 100644 --- a/dom/media/directshow/SampleSink.cpp +++ b/dom/media/directshow/SampleSink.cpp @@ -81,7 +81,7 @@ SampleSink::Receive(IMediaSample* aSample) } HRESULT -SampleSink::Extract(RefPtr& aOutSample) +SampleSink::Extract(nsRefPtr& aOutSample) { ReentrantMonitorAutoEnter mon(mMonitor); // Loop until we have a sample, or we should abort. diff --git a/dom/media/directshow/SampleSink.h b/dom/media/directshow/SampleSink.h index ccb6a8a4ce7..258a2837197 100644 --- a/dom/media/directshow/SampleSink.h +++ b/dom/media/directshow/SampleSink.h @@ -10,7 +10,7 @@ #include "BaseFilter.h" #include "DirectShowUtils.h" #include "nsAutoPtr.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/ReentrantMonitor.h" namespace mozilla { @@ -35,7 +35,7 @@ public: // Retrieves a sample from the sample queue, blocking until one becomes // available, or until an error occurs. Returns S_FALSE on EOS. - HRESULT Extract(RefPtr& aOutSample); + HRESULT Extract(nsRefPtr& aOutSample); // Unblocks any threads waiting in GetSample(). // Clears mSample, which unblocks upstream stream. @@ -54,7 +54,7 @@ public: private: // All data in this class is syncronized by mMonitor. ReentrantMonitor mMonitor; - RefPtr mSample; + nsRefPtr mSample; // Format of the audio stream we're receiving. WAVEFORMATEX mAudioFormat; diff --git a/dom/media/directshow/SourceFilter.cpp b/dom/media/directshow/SourceFilter.cpp index c7e74b29b08..680223dde07 100644 --- a/dom/media/directshow/SourceFilter.cpp +++ b/dom/media/directshow/SourceFilter.cpp @@ -6,7 +6,7 @@ #include "SourceFilter.h" #include "MediaResource.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "DirectShowUtils.h" #include "MP3FrameParser.h" #include "mozilla/Logging.h" @@ -56,7 +56,7 @@ public: MOZ_COUNT_DTOR(ReadRequest); } - RefPtr mSample; + nsRefPtr mSample; DWORD_PTR mDwUser; uint32_t mOffset; uint32_t mCount; diff --git a/dom/media/directshow/SourceFilter.h b/dom/media/directshow/SourceFilter.h index d5ce2770e9a..d6b1add9303 100644 --- a/dom/media/directshow/SourceFilter.h +++ b/dom/media/directshow/SourceFilter.h @@ -14,7 +14,7 @@ #include "nsDeque.h" #include "nsAutoPtr.h" #include "DirectShowUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { diff --git a/dom/media/eme/MediaKeySession.cpp b/dom/media/eme/MediaKeySession.cpp index d3a10737ddd..dd9528ff782 100644 --- a/dom/media/eme/MediaKeySession.cpp +++ b/dom/media/eme/MediaKeySession.cpp @@ -399,7 +399,7 @@ MediaKeySession::DispatchKeyError(uint32_t aSystemCode) EME_LOG("MediaKeySession[%p,'%s'] DispatchKeyError() systemCode=%u.", this, NS_ConvertUTF16toUTF8(mSessionId).get(), aSystemCode); - RefPtr event(new MediaKeyError(this, aSystemCode)); + nsRefPtr event(new MediaKeyError(this, aSystemCode)); nsRefPtr asyncDispatcher = new AsyncEventDispatcher(this, event); asyncDispatcher->PostDOMEvent(); diff --git a/dom/media/eme/MediaKeys.h b/dom/media/eme/MediaKeys.h index 7ef72eafa66..b44affcee9c 100644 --- a/dom/media/eme/MediaKeys.h +++ b/dom/media/eme/MediaKeys.h @@ -11,7 +11,7 @@ #include "nsWrapperCache.h" #include "nsISupports.h" #include "mozilla/Attributes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsRefPtrHashtable.h" diff --git a/dom/media/encoder/VP8TrackEncoder.cpp b/dom/media/encoder/VP8TrackEncoder.cpp index 5efa4840e92..f3aa932d688 100644 --- a/dom/media/encoder/VP8TrackEncoder.cpp +++ b/dom/media/encoder/VP8TrackEncoder.cpp @@ -370,13 +370,13 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk) } else { // Not YCbCr at all. Try to get access to the raw data and convert. - RefPtr surf = img->GetAsSourceSurface(); + nsRefPtr surf = img->GetAsSourceSurface(); if (!surf) { VP8LOG("Getting surface from %s image failed\n", Stringify(format).c_str()); return NS_ERROR_FAILURE; } - RefPtr data = surf->GetDataSurface(); + nsRefPtr data = surf->GetDataSurface(); if (!data) { VP8LOG("Getting data surface from %s image with %s (%s) surface failed\n", Stringify(format).c_str(), Stringify(surf->GetType()).c_str(), diff --git a/dom/media/gmp/GMPAudioDecoderParent.h b/dom/media/gmp/GMPAudioDecoderParent.h index cb19021f5d7..422db706cff 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.h +++ b/dom/media/gmp/GMPAudioDecoderParent.h @@ -6,7 +6,7 @@ #ifndef GMPAudioDecoderParent_h_ #define GMPAudioDecoderParent_h_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gmp-audio-decode.h" #include "gmp-audio-codec.h" #include "mozilla/gmp/PGMPAudioDecoderParent.h" diff --git a/dom/media/gmp/GMPDecryptorParent.h b/dom/media/gmp/GMPDecryptorParent.h index dfee56d5e86..b973a2fdd0f 100644 --- a/dom/media/gmp/GMPDecryptorParent.h +++ b/dom/media/gmp/GMPDecryptorParent.h @@ -7,7 +7,7 @@ #define GMPDecryptorParent_h_ #include "mozilla/gmp/PGMPDecryptorParent.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gmp-decryption.h" #include "GMPDecryptorProxy.h" diff --git a/dom/media/gmp/GMPVideoDecoderParent.h b/dom/media/gmp/GMPVideoDecoderParent.h index b6b6ad32561..74adb5ffbac 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.h +++ b/dom/media/gmp/GMPVideoDecoderParent.h @@ -6,7 +6,7 @@ #ifndef GMPVideoDecoderParent_h_ #define GMPVideoDecoderParent_h_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gmp-video-decode.h" #include "mozilla/gmp/PGMPVideoDecoderParent.h" #include "GMPMessageUtils.h" diff --git a/dom/media/gmp/GMPVideoEncoderParent.h b/dom/media/gmp/GMPVideoEncoderParent.h index 602daa23424..ed13d73d0a0 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.h +++ b/dom/media/gmp/GMPVideoEncoderParent.h @@ -6,7 +6,7 @@ #ifndef GMPVideoEncoderParent_h_ #define GMPVideoEncoderParent_h_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gmp-video-encode.h" #include "mozilla/gmp/PGMPVideoEncoderParent.h" #include "GMPMessageUtils.h" diff --git a/dom/media/mediasink/DecodedAudioDataSink.cpp b/dom/media/mediasink/DecodedAudioDataSink.cpp index fc0be88d994..54d4e33ab4d 100644 --- a/dom/media/mediasink/DecodedAudioDataSink.cpp +++ b/dom/media/mediasink/DecodedAudioDataSink.cpp @@ -262,7 +262,7 @@ DecodedAudioDataSink::InitializeAudioStream() // AudioStream initialization can block for extended periods in unusual // circumstances, so we take care to drop the decoder monitor while // initializing. - RefPtr audioStream(new AudioStream()); + nsRefPtr audioStream(new AudioStream()); nsresult rv = audioStream->Init(mInfo.mChannels, mInfo.mRate, mChannel); if (NS_FAILED(rv)) { audioStream->Shutdown(); diff --git a/dom/media/mediasource/MediaSourceDemuxer.h b/dom/media/mediasource/MediaSourceDemuxer.h index 3efa07c0ee6..09e77773670 100644 --- a/dom/media/mediasource/MediaSourceDemuxer.h +++ b/dom/media/mediasource/MediaSourceDemuxer.h @@ -70,7 +70,7 @@ private: return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn(); } - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; nsTArray> mDemuxers; nsTArray> mSourceBuffers; diff --git a/dom/media/mediasource/TrackBuffersManager.h b/dom/media/mediasource/TrackBuffersManager.h index d1332f99809..ede4dbccabe 100644 --- a/dom/media/mediasource/TrackBuffersManager.h +++ b/dom/media/mediasource/TrackBuffersManager.h @@ -335,7 +335,7 @@ private: { return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn(); } - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; media::TimeInterval mAppendWindow; media::TimeUnit mTimestampOffset; diff --git a/dom/media/omx/MPAPI.h b/dom/media/omx/MPAPI.h index b300b39f140..d7d04b115f2 100644 --- a/dom/media/omx/MPAPI.h +++ b/dom/media/omx/MPAPI.h @@ -41,7 +41,7 @@ struct VideoFrame { VideoPlane Y; VideoPlane Cb; VideoPlane Cr; - mozilla::RefPtr mGraphicBuffer; + nsRefPtr mGraphicBuffer; VideoFrame() : mTimeUs(0), diff --git a/dom/media/omx/MediaCodecReader.cpp b/dom/media/omx/MediaCodecReader.cpp index ef0eea9bb2e..8aaa75b20b7 100644 --- a/dom/media/omx/MediaCodecReader.cpp +++ b/dom/media/omx/MediaCodecReader.cpp @@ -314,7 +314,7 @@ void MediaCodecReader::DispatchAudioTask() { if (mAudioTrack.mTaskQueue) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethod(this, &MediaCodecReader::DecodeAudioDataTask); mAudioTrack.mTaskQueue->Dispatch(task.forget()); @@ -325,7 +325,7 @@ void MediaCodecReader::DispatchVideoTask(int64_t aTimeThreshold) { if (mVideoTrack.mTaskQueue) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethodWithArg(this, &MediaCodecReader::DecodeVideoFrameTask, aTimeThreshold); @@ -813,7 +813,7 @@ MediaCodecReader::TextureClientRecycleCallback(TextureClient* aClient) } if (mVideoTrack.mReleaseBufferTaskQueue->IsEmpty()) { - RefPtr task = + nsRefPtr task = NS_NewRunnableMethod(this, &MediaCodecReader::WaitFenceAndReleaseOutputBuffer); mVideoTrack.mReleaseBufferTaskQueue->Dispatch(task.forget()); @@ -916,7 +916,7 @@ MediaCodecReader::DecodeVideoFrameSync(int64_t aTimeThreshold) } nsRefPtr v; - RefPtr textureClient; + nsRefPtr textureClient; sp graphicBuffer; if (bufferInfo.mBuffer != nullptr) { MOZ_ASSERT(mStreamSource); diff --git a/dom/media/omx/OMXCodecWrapper.cpp b/dom/media/omx/OMXCodecWrapper.cpp index 3afb51a75c7..2646aa39775 100644 --- a/dom/media/omx/OMXCodecWrapper.cpp +++ b/dom/media/omx/OMXCodecWrapper.cpp @@ -402,7 +402,7 @@ ConvertSourceSurfaceToNV12(const nsRefPtr& aSurface, uint8_t* aDe return NS_ERROR_FAILURE; } - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { CODEC_ERROR("Getting data surface from %s image with %s (%s) surface failed", Stringify(format).c_str(), Stringify(aSurface->GetType()).c_str(), diff --git a/dom/media/omx/OmxDecoder.cpp b/dom/media/omx/OmxDecoder.cpp index f3f4805fd9b..ac8e163067b 100644 --- a/dom/media/omx/OmxDecoder.cpp +++ b/dom/media/omx/OmxDecoder.cpp @@ -631,7 +631,7 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs, unreadable = 0; } - RefPtr textureClient; + nsRefPtr textureClient; if ((mVideoBuffer->graphicBuffer().get())) { textureClient = mNativeWindow->getTextureClientFromBuffer(mVideoBuffer->graphicBuffer().get()); } diff --git a/dom/media/platforms/PlatformDecoderModule.h b/dom/media/platforms/PlatformDecoderModule.h index d3d3f6491af..0ff8e019cb9 100644 --- a/dom/media/platforms/PlatformDecoderModule.h +++ b/dom/media/platforms/PlatformDecoderModule.h @@ -12,7 +12,7 @@ #include "mozilla/MozPromise.h" #include "mozilla/layers/LayersTypes.h" #include "nsTArray.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include namespace mozilla { diff --git a/dom/media/platforms/agnostic/BlankDecoderModule.cpp b/dom/media/platforms/agnostic/BlankDecoderModule.cpp index 5b6e788f296..fdea8d5deee 100644 --- a/dom/media/platforms/agnostic/BlankDecoderModule.cpp +++ b/dom/media/platforms/agnostic/BlankDecoderModule.cpp @@ -7,7 +7,7 @@ #include "MediaDecoderReader.h" #include "PlatformDecoderModule.h" #include "nsRect.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/CheckedInt.h" #include "VideoUtils.h" #include "ImageContainer.h" @@ -72,7 +72,7 @@ public: // The MediaDataDecoder must delete the sample when we're finished // with it, so the OutputEvent stores it in an nsAutoPtr and deletes // it once it's run. - RefPtr r(new OutputEvent(aSample, mCallback, mCreator)); + nsRefPtr r(new OutputEvent(aSample, mCallback, mCreator)); mTaskQueue->Dispatch(r.forget()); return NS_OK; } @@ -89,7 +89,7 @@ public: private: nsAutoPtr mCreator; - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; TrackInfo::TrackType mType; }; @@ -158,7 +158,7 @@ private: gfx::IntRect mPicture; uint32_t mFrameWidth; uint32_t mFrameHeight; - RefPtr mImageContainer; + nsRefPtr mImageContainer; }; diff --git a/dom/media/platforms/agnostic/OpusDecoder.cpp b/dom/media/platforms/agnostic/OpusDecoder.cpp index 4ca4cc28538..e9b55c38c74 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.cpp +++ b/dom/media/platforms/agnostic/OpusDecoder.cpp @@ -280,7 +280,7 @@ OpusDataDecoder::DoDrain() nsresult OpusDataDecoder::Drain() { - RefPtr runnable( + nsRefPtr runnable( NS_NewRunnableMethod(this, &OpusDataDecoder::DoDrain)); mTaskQueue->Dispatch(runnable.forget()); return NS_OK; diff --git a/dom/media/platforms/agnostic/OpusDecoder.h b/dom/media/platforms/agnostic/OpusDecoder.h index 679102dd3be..1a6913b791f 100644 --- a/dom/media/platforms/agnostic/OpusDecoder.h +++ b/dom/media/platforms/agnostic/OpusDecoder.h @@ -38,7 +38,7 @@ private: void DoDrain (); const AudioInfo& mInfo; - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; // Opus decoder state diff --git a/dom/media/platforms/agnostic/VPXDecoder.h b/dom/media/platforms/agnostic/VPXDecoder.h index a0688f4c0d2..edf2381fd49 100644 --- a/dom/media/platforms/agnostic/VPXDecoder.h +++ b/dom/media/platforms/agnostic/VPXDecoder.h @@ -49,7 +49,7 @@ private: void OutputDelayedFrames (); nsRefPtr mImageContainer; - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; // VPx decoder state diff --git a/dom/media/platforms/agnostic/VorbisDecoder.h b/dom/media/platforms/agnostic/VorbisDecoder.h index e9594367c9f..f5b35e6d634 100644 --- a/dom/media/platforms/agnostic/VorbisDecoder.h +++ b/dom/media/platforms/agnostic/VorbisDecoder.h @@ -41,7 +41,7 @@ private: void DoDrain (); const AudioInfo& mInfo; - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; // Vorbis decoder state diff --git a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp index bf65286597f..2df8b9ed9d0 100644 --- a/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp +++ b/dom/media/platforms/agnostic/eme/SamplesWaitingForKey.cpp @@ -51,7 +51,7 @@ SamplesWaitingForKey::NotifyUsable(const CencKeyId& aKeyId) size_t i = 0; while (i < mSamples.Length()) { if (aKeyId == mSamples[i]->mCrypto.mKeyId) { - RefPtr task; + nsRefPtr task; task = NS_NewRunnableMethodWithArg>(mDecoder, &MediaDataDecoder::Input, nsRefPtr(mSamples[i])); diff --git a/dom/media/platforms/android/AndroidDecoderModule.cpp b/dom/media/platforms/android/AndroidDecoderModule.cpp index fc9cc6c4da0..739d58a03bd 100644 --- a/dom/media/platforms/android/AndroidDecoderModule.cpp +++ b/dom/media/platforms/android/AndroidDecoderModule.cpp @@ -208,7 +208,7 @@ protected: layers::ImageContainer* mImageContainer; const VideoInfo& mConfig; - RefPtr mSurfaceTexture; + nsRefPtr mSurfaceTexture; nsRefPtr mGLContext; }; diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.h b/dom/media/platforms/gonk/GonkAudioDecoderManager.h index 473b03c3105..d6acb36c66c 100644 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.h +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.h @@ -7,7 +7,7 @@ #if !defined(GonkAudioDecoderManager_h_) #define GonkAudioDecoderManager_h_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "GonkMediaDataDecoder.h" using namespace android; diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.h b/dom/media/platforms/gonk/GonkMediaDataDecoder.h index 06232f2b99c..ed075e5a6dc 100644 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.h +++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.h @@ -145,7 +145,7 @@ public: nsresult Shutdown() override; private: - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; android::sp mManager; }; diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp index 9c348892c65..7d6a4a05d46 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp @@ -185,7 +185,7 @@ GonkVideoDecoderManager::CreateVideoData(int64_t aStreamOffset, VideoData **v) picture.height = (mFrameInfo.mHeight * mPicture.height) / mInitialFrame.height; } - RefPtr textureClient; + nsRefPtr textureClient; if ((mVideoBuffer->graphicBuffer().get())) { textureClient = mNativeWindow->getTextureClientFromBuffer(mVideoBuffer->graphicBuffer().get()); diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.h b/dom/media/platforms/gonk/GonkVideoDecoderManager.h index 6b8c40c9e10..b51cc4ba020 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.h +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.h @@ -9,7 +9,7 @@ #include "nsRect.h" #include "GonkMediaDataDecoder.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "I420ColorConverterHelper.h" #include "MediaCodecProxy.h" #include "GonkNativeWindow.h" diff --git a/dom/media/platforms/wmf/DXVA2Manager.cpp b/dom/media/platforms/wmf/DXVA2Manager.cpp index 2684d38d1d8..16f8a793a13 100644 --- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -98,7 +98,7 @@ private: nsRefPtr mD3D9; nsRefPtr mDevice; nsRefPtr mDeviceManager; - RefPtr mTextureClientAllocator; + nsRefPtr mTextureClientAllocator; nsRefPtr mDecoderService; GUID mDecoderGUID; UINT32 mResetToken; @@ -490,14 +490,14 @@ public: private: HRESULT CreateFormatConverter(); - HRESULT CreateOutputSample(RefPtr& aSample, + HRESULT CreateOutputSample(nsRefPtr& aSample, ID3D11Texture2D* aTexture); - RefPtr mDevice; - RefPtr mContext; - RefPtr mDXGIDeviceManager; - RefPtr mTransform; - RefPtr mTextureClientAllocator; + nsRefPtr mDevice; + nsRefPtr mContext; + nsRefPtr mDXGIDeviceManager; + nsRefPtr mTransform; + nsRefPtr mTextureClientAllocator; GUID mDecoderGUID; uint32_t mWidth; uint32_t mHeight; @@ -508,8 +508,8 @@ private: bool D3D11DXVA2Manager::SupportsConfig(IMFMediaType* aType, float aFramerate) { - RefPtr videoDevice; - HRESULT hr = mDevice->QueryInterface(static_cast(byRef(videoDevice))); + nsRefPtr videoDevice; + HRESULT hr = mDevice->QueryInterface(static_cast(getter_AddRefs(videoDevice))); NS_ENSURE_TRUE(SUCCEEDED(hr), false); D3D11_VIDEO_DECODER_DESC desc; @@ -581,13 +581,13 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason) return E_FAIL; } - mDevice->GetImmediateContext(byRef(mContext)); + mDevice->GetImmediateContext(getter_AddRefs(mContext)); if (!mContext) { aFailureReason.AssignLiteral("Failed to get immediate context for d3d11 device"); return E_FAIL; } - hr = wmf::MFCreateDXGIDeviceManager(&mDeviceManagerToken, byRef(mDXGIDeviceManager)); + hr = wmf::MFCreateDXGIDeviceManager(&mDeviceManagerToken, getter_AddRefs(mDXGIDeviceManager)); if (!SUCCEEDED(hr)) { aFailureReason = nsPrintfCString("MFCreateDXGIDeviceManager failed with code %X", hr); return hr; @@ -612,8 +612,8 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason) return hr; } - RefPtr videoDevice; - hr = mDevice->QueryInterface(static_cast(byRef(videoDevice))); + nsRefPtr videoDevice; + hr = mDevice->QueryInterface(static_cast(getter_AddRefs(videoDevice))); if (!SUCCEEDED(hr)) { aFailureReason = nsPrintfCString("QI to ID3D11VideoDevice failed with code %X", hr); return hr; @@ -646,8 +646,8 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason) return E_FAIL; } - RefPtr dxgiDevice; - hr = mDevice->QueryInterface(static_cast(byRef(dxgiDevice))); + nsRefPtr dxgiDevice; + hr = mDevice->QueryInterface(static_cast(getter_AddRefs(dxgiDevice))); if (!SUCCEEDED(hr)) { aFailureReason = nsPrintfCString("QI to IDXGIDevice failed with code %X", hr); return hr; @@ -684,14 +684,14 @@ D3D11DXVA2Manager::Init(nsACString& aFailureReason) } HRESULT -D3D11DXVA2Manager::CreateOutputSample(RefPtr& aSample, ID3D11Texture2D* aTexture) +D3D11DXVA2Manager::CreateOutputSample(nsRefPtr& aSample, ID3D11Texture2D* aTexture) { - RefPtr sample; - HRESULT hr = wmf::MFCreateSample(byRef(sample)); + nsRefPtr sample; + HRESULT hr = wmf::MFCreateSample(getter_AddRefs(sample)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr buffer; - hr = wmf::MFCreateDXGISurfaceBuffer(__uuidof(ID3D11Texture2D), aTexture, 0, FALSE, byRef(buffer)); + nsRefPtr buffer; + hr = wmf::MFCreateDXGISurfaceBuffer(__uuidof(ID3D11Texture2D), aTexture, 0, FALSE, getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); sample->AddBuffer(buffer); @@ -729,13 +729,13 @@ D3D11DXVA2Manager::CopyToImage(IMFSample* aVideoSample, hr = mTransform->Input(aVideoSample); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr sample; - RefPtr texture = videoImage->GetTexture(); + nsRefPtr sample; + nsRefPtr texture = videoImage->GetTexture(); hr = CreateOutputSample(sample, texture); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr keyedMutex; - hr = texture->QueryInterface(static_cast(byRef(keyedMutex))); + nsRefPtr keyedMutex; + hr = texture->QueryInterface(static_cast(getter_AddRefs(keyedMutex))); NS_ENSURE_TRUE(SUCCEEDED(hr) && keyedMutex, hr); hr = keyedMutex->AcquireSync(0, INFINITE); @@ -772,8 +772,8 @@ D3D11DXVA2Manager::ConfigureForSize(uint32_t aWidth, uint32_t aHeight) mWidth = aWidth; mHeight = aHeight; - RefPtr inputType; - HRESULT hr = wmf::MFCreateMediaType(byRef(inputType)); + nsRefPtr inputType; + HRESULT hr = wmf::MFCreateMediaType(getter_AddRefs(inputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = inputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); @@ -788,7 +788,7 @@ D3D11DXVA2Manager::ConfigureForSize(uint32_t aWidth, uint32_t aHeight) hr = inputType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr attr = mTransform->GetAttributes(); + nsRefPtr attr = mTransform->GetAttributes(); hr = attr->SetUINT32(MF_XVP_PLAYBACK_MODE, TRUE); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); @@ -799,8 +799,8 @@ D3D11DXVA2Manager::ConfigureForSize(uint32_t aWidth, uint32_t aHeight) hr = MFSetAttributeSize(inputType, MF_MT_FRAME_SIZE, aWidth, aHeight); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr outputType; - hr = wmf::MFCreateMediaType(byRef(outputType)); + nsRefPtr outputType; + hr = wmf::MFCreateMediaType(getter_AddRefs(outputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); diff --git a/dom/media/platforms/wmf/MFTDecoder.cpp b/dom/media/platforms/wmf/MFTDecoder.cpp index 77ac5369e1c..6813a66c208 100644 --- a/dom/media/platforms/wmf/MFTDecoder.cpp +++ b/dom/media/platforms/wmf/MFTDecoder.cpp @@ -35,7 +35,7 @@ MFTDecoder::Create(const GUID& aMFTClsID) nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, - reinterpret_cast(static_cast(byRef(mDecoder)))); + reinterpret_cast(static_cast(getter_AddRefs(mDecoder)))); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); return S_OK; @@ -71,8 +71,8 @@ MFTDecoder::SetMediaTypes(IMFMediaType* aInputType, already_AddRefed MFTDecoder::GetAttributes() { - RefPtr attr; - HRESULT hr = mDecoder->GetAttributes(byRef(attr)); + nsRefPtr attr; + HRESULT hr = mDecoder->GetAttributes(getter_AddRefs(attr)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); return attr.forget(); } @@ -85,9 +85,9 @@ MFTDecoder::SetDecoderOutputType(ConfigureOutputCallback aCallback, void* aData) // Iterate the enumerate the output types, until we find one compatible // with what we need. HRESULT hr; - RefPtr outputType; + nsRefPtr outputType; UINT32 typeIndex = 0; - while (SUCCEEDED(mDecoder->GetOutputAvailableType(0, typeIndex++, byRef(outputType)))) { + while (SUCCEEDED(mDecoder->GetOutputAvailableType(0, typeIndex++, getter_AddRefs(outputType)))) { BOOL resultMatch; hr = mOutputType->Compare(outputType, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &resultMatch); if (SUCCEEDED(hr) && resultMatch == TRUE) { @@ -123,19 +123,19 @@ HRESULT MFTDecoder::CreateInputSample(const uint8_t* aData, uint32_t aDataSize, int64_t aTimestamp, - RefPtr* aOutSample) + nsRefPtr* aOutSample) { NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER); HRESULT hr; - RefPtr sample; - hr = wmf::MFCreateSample(byRef(sample)); + nsRefPtr sample; + hr = wmf::MFCreateSample(getter_AddRefs(sample)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr buffer; + nsRefPtr buffer; int32_t bufferSize = std::max(uint32_t(mInputStreamInfo.cbSize), aDataSize); UINT32 alignment = (mInputStreamInfo.cbAlignment > 1) ? mInputStreamInfo.cbAlignment - 1 : 0; - hr = wmf::MFCreateAlignedMemoryBuffer(bufferSize, alignment, byRef(buffer)); + hr = wmf::MFCreateAlignedMemoryBuffer(bufferSize, alignment, getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); DWORD maxLength = 0; @@ -165,19 +165,19 @@ MFTDecoder::CreateInputSample(const uint8_t* aData, } HRESULT -MFTDecoder::CreateOutputSample(RefPtr* aOutSample) +MFTDecoder::CreateOutputSample(nsRefPtr* aOutSample) { NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER); HRESULT hr; - RefPtr sample; - hr = wmf::MFCreateSample(byRef(sample)); + nsRefPtr sample; + hr = wmf::MFCreateSample(getter_AddRefs(sample)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr buffer; + nsRefPtr buffer; int32_t bufferSize = mOutputStreamInfo.cbSize; UINT32 alignment = (mOutputStreamInfo.cbAlignment > 1) ? mOutputStreamInfo.cbAlignment - 1 : 0; - hr = wmf::MFCreateAlignedMemoryBuffer(bufferSize, alignment, byRef(buffer)); + hr = wmf::MFCreateAlignedMemoryBuffer(bufferSize, alignment, getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = sample->AddBuffer(buffer); @@ -189,7 +189,7 @@ MFTDecoder::CreateOutputSample(RefPtr* aOutSample) } HRESULT -MFTDecoder::Output(RefPtr* aOutput) +MFTDecoder::Output(nsRefPtr* aOutput) { NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER); @@ -198,7 +198,7 @@ MFTDecoder::Output(RefPtr* aOutput) MFT_OUTPUT_DATA_BUFFER output = {0}; bool providedSample = false; - RefPtr sample; + nsRefPtr sample; if (*aOutput) { output.pSample = *aOutput; providedSample = true; @@ -263,7 +263,7 @@ MFTDecoder::Input(const uint8_t* aData, { NS_ENSURE_TRUE(mDecoder != nullptr, E_POINTER); - RefPtr input; + nsRefPtr input; HRESULT hr = CreateInputSample(aData, aDataSize, aTimestamp, &input); NS_ENSURE_TRUE(SUCCEEDED(hr) && input != nullptr, hr); @@ -295,10 +295,10 @@ MFTDecoder::Flush() } HRESULT -MFTDecoder::GetOutputMediaType(RefPtr& aMediaType) +MFTDecoder::GetOutputMediaType(nsRefPtr& aMediaType) { NS_ENSURE_TRUE(mDecoder, E_POINTER); - return mDecoder->GetOutputCurrentType(0, byRef(aMediaType)); + return mDecoder->GetOutputCurrentType(0, getter_AddRefs(aMediaType)); } } // namespace mozilla diff --git a/dom/media/platforms/wmf/MFTDecoder.h b/dom/media/platforms/wmf/MFTDecoder.h index 91c18f18c0b..ad7c6cf4989 100644 --- a/dom/media/platforms/wmf/MFTDecoder.h +++ b/dom/media/platforms/wmf/MFTDecoder.h @@ -8,7 +8,7 @@ #define MFTDecoder_h_ #include "WMF.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/ReentrantMonitor.h" #include "nsIThread.h" @@ -47,7 +47,7 @@ public: // Retrieves the media type being output. This may not be valid until // the first sample is decoded. - HRESULT GetOutputMediaType(RefPtr& aMediaType); + HRESULT GetOutputMediaType(nsRefPtr& aMediaType); // Submits data into the MFT for processing. // @@ -62,7 +62,7 @@ public: HRESULT CreateInputSample(const uint8_t* aData, uint32_t aDataSize, int64_t aTimestampUsecs, - RefPtr* aOutSample); + nsRefPtr* aOutSample); // Retrieves output from the MFT. Call this once Input() returns // MF_E_NOTACCEPTING. Some MFTs with hardware acceleration (the H.264 @@ -76,7 +76,7 @@ public: // - MF_E_TRANSFORM_NEED_MORE_INPUT if no output can be produced // due to lack of input. // - S_OK if an output frame is produced. - HRESULT Output(RefPtr* aOutput); + HRESULT Output(nsRefPtr* aOutput); // Sends a flush message to the MFT. This causes it to discard all // input data. Use before seeking. @@ -90,14 +90,14 @@ public: private: - HRESULT CreateOutputSample(RefPtr* aOutSample); + HRESULT CreateOutputSample(nsRefPtr* aOutSample); MFT_INPUT_STREAM_INFO mInputStreamInfo; MFT_OUTPUT_STREAM_INFO mOutputStreamInfo; - RefPtr mDecoder; + nsRefPtr mDecoder; - RefPtr mOutputType; + nsRefPtr mOutputType; // True if the IMFTransform allocates the samples that it returns. bool mMFTProvidesOutputSamples; diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp index 8d42d254004..804700d2d75 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp @@ -118,15 +118,15 @@ WMFAudioMFTManager::Init() { NS_ENSURE_TRUE(mStreamType != Unknown, false); - RefPtr decoder(new MFTDecoder()); + nsRefPtr decoder(new MFTDecoder()); HRESULT hr = decoder->Create(GetMFTGUID()); NS_ENSURE_TRUE(SUCCEEDED(hr), false); // Setup input/output media types - RefPtr inputType; + nsRefPtr inputType; - hr = wmf::MFCreateMediaType(byRef(inputType)); + hr = wmf::MFCreateMediaType(getter_AddRefs(inputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), false); hr = inputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio); @@ -151,8 +151,8 @@ WMFAudioMFTManager::Init() NS_ENSURE_TRUE(SUCCEEDED(hr), false); } - RefPtr outputType; - hr = wmf::MFCreateMediaType(byRef(outputType)); + nsRefPtr outputType; + hr = wmf::MFCreateMediaType(getter_AddRefs(outputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), false); hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio); @@ -185,7 +185,7 @@ WMFAudioMFTManager::UpdateOutputType() { HRESULT hr; - RefPtr type; + nsRefPtr type; hr = mDecoder->GetOutputMediaType(type); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); @@ -203,7 +203,7 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset, nsRefPtr& aOutData) { aOutData = nullptr; - RefPtr sample; + nsRefPtr sample; HRESULT hr; int typeChangeCount = 0; while (true) { @@ -226,8 +226,8 @@ WMFAudioMFTManager::Output(int64_t aStreamOffset, NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr buffer; - hr = sample->ConvertToContiguousBuffer(byRef(buffer)); + nsRefPtr buffer; + hr = sample->ConvertToContiguousBuffer(getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); BYTE* data = nullptr; // Note: *data will be owned by the IMFMediaBuffer, we don't need to free it. diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.h b/dom/media/platforms/wmf/WMFAudioMFTManager.h index c5738b5f431..4af5d2847c6 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.h +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.h @@ -9,7 +9,7 @@ #include "WMF.h" #include "MFTDecoder.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "WMFMediaDataDecoder.h" extern const GUID CLSID_WebmMfVp8Dec; diff --git a/dom/media/platforms/wmf/WMFDecoderModule.cpp b/dom/media/platforms/wmf/WMFDecoderModule.cpp index a1befe80ce5..79894633172 100644 --- a/dom/media/platforms/wmf/WMFDecoderModule.cpp +++ b/dom/media/platforms/wmf/WMFDecoderModule.cpp @@ -130,7 +130,7 @@ CanCreateMFTDecoder(const GUID& aGuid) if (FAILED(wmf::MFStartup())) { return false; } - RefPtr decoder(new MFTDecoder()); + nsRefPtr decoder(new MFTDecoder()); bool hasH264 = SUCCEEDED(decoder->Create(aGuid)); wmf::MFShutdown(); return hasH264; diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.h b/dom/media/platforms/wmf/WMFMediaDataDecoder.h index aa581efd496..d7c6ccb1d2f 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.h +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.h @@ -10,7 +10,7 @@ #include "WMF.h" #include "MFTDecoder.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "PlatformDecoderModule.h" namespace mozilla { @@ -54,7 +54,7 @@ public: protected: // IMFTransform wrapper that performs the decoding. - RefPtr mDecoder; + nsRefPtr mDecoder; }; // Decodes audio and video using Windows Media Foundation. Samples are decoded @@ -101,7 +101,7 @@ private: void ProcessShutdown(); - RefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; nsAutoPtr mMFTManager; diff --git a/dom/media/platforms/wmf/WMFUtils.cpp b/dom/media/platforms/wmf/WMFUtils.cpp index 1844bd4fdd3..31736a78fec 100644 --- a/dom/media/platforms/wmf/WMFUtils.cpp +++ b/dom/media/platforms/wmf/WMFUtils.cpp @@ -7,7 +7,7 @@ #include "WMFUtils.h" #include #include "mozilla/ArrayUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/WindowsVersion.h" #include "mozilla/Logging.h" #include "nsThreadUtils.h" diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 3ddf10b26d2..6f5e664956d 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -205,12 +205,12 @@ WMFVideoMFTManager::InitInternal(bool aForceD3D9) mUseHwAccel = false; // default value; changed if D3D setup succeeds. bool useDxva = InitializeDXVA(aForceD3D9); - RefPtr decoder(new MFTDecoder()); + nsRefPtr decoder(new MFTDecoder()); HRESULT hr = decoder->Create(GetMFTGUID()); NS_ENSURE_TRUE(SUCCEEDED(hr), false); - RefPtr attr(decoder->GetAttributes()); + nsRefPtr attr(decoder->GetAttributes()); UINT32 aware = 0; if (attr) { attr->GetUINT32(MF_SA_D3D_AWARE, &aware); @@ -265,8 +265,8 @@ HRESULT WMFVideoMFTManager::SetDecoderMediaTypes() { // Setup the input/output media types. - RefPtr inputType; - HRESULT hr = wmf::MFCreateMediaType(byRef(inputType)); + nsRefPtr inputType; + HRESULT hr = wmf::MFCreateMediaType(getter_AddRefs(inputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = inputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); @@ -278,8 +278,8 @@ WMFVideoMFTManager::SetDecoderMediaTypes() hr = inputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); - RefPtr outputType; - hr = wmf::MFCreateMediaType(byRef(outputType)); + nsRefPtr outputType; + hr = wmf::MFCreateMediaType(getter_AddRefs(outputType)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); @@ -342,7 +342,7 @@ WMFVideoMFTManager::CanUseDXVA(IMFMediaType* aType) HRESULT WMFVideoMFTManager::ConfigureVideoFrameGeometry() { - RefPtr mediaType; + nsRefPtr mediaType; HRESULT hr = mDecoder->GetOutputMediaType(mediaType); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); @@ -429,10 +429,10 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample, *aOutVideoData = nullptr; HRESULT hr; - RefPtr buffer; + nsRefPtr buffer; // Must convert to contiguous buffer to use IMD2DBuffer interface. - hr = aSample->ConvertToContiguousBuffer(byRef(buffer)); + hr = aSample->ConvertToContiguousBuffer(getter_AddRefs(buffer)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); // Try and use the IMF2DBuffer interface if available, otherwise fallback @@ -440,8 +440,8 @@ WMFVideoMFTManager::CreateBasicVideoFrame(IMFSample* aSample, // but only some systems (Windows 8?) support it. BYTE* data = nullptr; LONG stride = 0; - RefPtr twoDBuffer; - hr = buffer->QueryInterface(static_cast(byRef(twoDBuffer))); + nsRefPtr twoDBuffer; + hr = buffer->QueryInterface(static_cast(getter_AddRefs(twoDBuffer))); if (SUCCEEDED(hr)) { hr = twoDBuffer->Lock2D(&data, &stride); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); @@ -566,7 +566,7 @@ HRESULT WMFVideoMFTManager::Output(int64_t aStreamOffset, nsRefPtr& aOutData) { - RefPtr sample; + nsRefPtr sample; HRESULT hr; aOutData = nullptr; int typeChangeCount = 0; diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.h b/dom/media/platforms/wmf/WMFVideoMFTManager.h index 04d1b689632..b5a0b726d99 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.h +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.h @@ -11,7 +11,7 @@ #include "MFTDecoder.h" #include "nsRect.h" #include "WMFMediaDataDecoder.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { @@ -66,10 +66,10 @@ private: uint32_t mVideoHeight; nsIntRect mPictureRegion; - RefPtr mImageContainer; + nsRefPtr mImageContainer; nsAutoPtr mDXVA2Manager; - RefPtr mLastInput; + nsRefPtr mLastInput; float mLastDuration; bool mDXVAEnabled; diff --git a/dom/media/systemservices/LoadMonitor.cpp b/dom/media/systemservices/LoadMonitor.cpp index f18cdf91539..a3df22836c3 100644 --- a/dom/media/systemservices/LoadMonitor.cpp +++ b/dom/media/systemservices/LoadMonitor.cpp @@ -536,7 +536,7 @@ class LoadInfoCollectRunner : public nsRunnable { public: LoadInfoCollectRunner(nsRefPtr loadMonitor, - RefPtr loadInfo, + nsRefPtr loadInfo, nsIThread *loadInfoThread) : mThread(loadInfoThread), mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval), @@ -585,7 +585,7 @@ public: private: nsCOMPtr mThread; - RefPtr mLoadInfo; + nsRefPtr mLoadInfo; nsRefPtr mLoadMonitor; int mLoadUpdateInterval; int mLoadNoiseCounter; @@ -629,7 +629,7 @@ LoadMonitor::Init(nsRefPtr &self) { LOG(("Initializing LoadMonitor")); - RefPtr load_info = new RTCLoadInfo(); + nsRefPtr load_info = new RTCLoadInfo(); nsresult rv = load_info->Init(mLoadUpdateInterval); if (NS_FAILED(rv)) { diff --git a/dom/media/systemservices/LoadMonitor.h b/dom/media/systemservices/LoadMonitor.h index 2b496157e53..9798caa0ff2 100644 --- a/dom/media/systemservices/LoadMonitor.h +++ b/dom/media/systemservices/LoadMonitor.h @@ -8,7 +8,7 @@ #include "mozilla/Mutex.h" #include "mozilla/CondVar.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Atomics.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" diff --git a/dom/media/webaudio/MediaBufferDecoder.cpp b/dom/media/webaudio/MediaBufferDecoder.cpp index a00437bed62..97e60bc8a0a 100644 --- a/dom/media/webaudio/MediaBufferDecoder.cpp +++ b/dom/media/webaudio/MediaBufferDecoder.cpp @@ -480,7 +480,7 @@ AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer, return; } - RefPtr task = + nsRefPtr task = new MediaDecodeTask(aContentType, aBuffer, aLength, aDecodeJob); if (!task->CreateReader()) { nsCOMPtr event = diff --git a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp index 2fb5cfb92f0..f89df3ea39d 100644 --- a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp @@ -46,7 +46,7 @@ already_AddRefed HRTFDatabaseLoader::createAndLoadAsynchrono { MOZ_ASSERT(NS_IsMainThread()); - RefPtr loader; + nsRefPtr loader; if (!s_loaderMap) { s_loaderMap = new nsTHashtable(); diff --git a/dom/media/webaudio/blink/HRTFDatabaseLoader.h b/dom/media/webaudio/blink/HRTFDatabaseLoader.h index 50a875b1833..324dc1467d0 100644 --- a/dom/media/webaudio/blink/HRTFDatabaseLoader.h +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.h @@ -30,7 +30,7 @@ #define HRTFDatabaseLoader_h #include "nsHashKeys.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Mutex.h" #include "HRTFDatabase.h" diff --git a/dom/media/webaudio/blink/HRTFPanner.h b/dom/media/webaudio/blink/HRTFPanner.h index bf048623002..6963badaa00 100644 --- a/dom/media/webaudio/blink/HRTFPanner.h +++ b/dom/media/webaudio/blink/HRTFPanner.h @@ -63,7 +63,7 @@ private: // and azimuthBlend which is an interpolation value from 0 -> 1. int calculateDesiredAzimuthIndexAndBlend(double azimuth, double& azimuthBlend); - mozilla::RefPtr m_databaseLoader; + nsRefPtr m_databaseLoader; float m_sampleRate; diff --git a/dom/media/webrtc/MediaEngine.h b/dom/media/webrtc/MediaEngine.h index 6b09bac0af1..9701b53dfcc 100644 --- a/dom/media/webrtc/MediaEngine.h +++ b/dom/media/webrtc/MediaEngine.h @@ -5,7 +5,7 @@ #ifndef MEDIAENGINE_H_ #define MEDIAENGINE_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "DOMMediaStream.h" #include "MediaStreamGraph.h" #include "mozilla/dom/MediaStreamTrackBinding.h" diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 5639aa41dd8..f74bf1759c9 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -757,14 +757,14 @@ MediaEngineGonkVideoSource::RotateImage(layers::Image* aImage, uint32_t aWidth, layers::GrallocImage* videoImage = static_cast(image.get()); MOZ_ASSERT(mTextureClientAllocator); - RefPtr textureClient + nsRefPtr textureClient = mTextureClientAllocator->CreateOrRecycle(gfx::SurfaceFormat::YUV, gfx::IntSize(dstWidth, dstHeight), layers::BackendSelector::Content, layers::TextureFlags::DEFAULT, layers::ALLOC_DISALLOW_BUFFERTEXTURECLIENT); if (textureClient) { - RefPtr grallocTextureClient = + nsRefPtr grallocTextureClient = static_cast(textureClient.get()); android::sp destBuffer = grallocTextureClient->GetGraphicBuffer(); diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.h b/dom/media/webrtc/MediaEngineGonkVideoSource.h index faf362da729..6b5d47b3e6c 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.h +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.h @@ -130,7 +130,7 @@ protected: bool mBackCamera; bool mOrientationChanged; // True when screen rotates. - RefPtr mTextureClientAllocator; + nsRefPtr mTextureClientAllocator; }; } // namespace mozilla diff --git a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp index f80bd588e14..702c6b19df6 100644 --- a/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineRemoteVideoSource.cpp @@ -5,7 +5,7 @@ #include "MediaEngineRemoteVideoSource.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "VideoUtils.h" #include "nsIPrefService.h" #include "MediaTrackConstraints.h" diff --git a/dom/media/webrtc/MediaEngineTabVideoSource.cpp b/dom/media/webrtc/MediaEngineTabVideoSource.cpp index 7d5ff9a5a8f..19f45fb3089 100644 --- a/dom/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineTabVideoSource.cpp @@ -6,7 +6,7 @@ #include "MediaEngineTabVideoSource.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsGlobalWindow.h" #include "nsIDOMClientRect.h" #include "nsIDocShell.h" @@ -249,7 +249,7 @@ MediaEngineTabVideoSource::Draw() { nsPresContext::CSSPixelsToAppUnits((float)innerHeight)); nsRefPtr container = layers::LayerManager::CreateImageContainer(); - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, mData.rwget(), size, @@ -264,7 +264,7 @@ MediaEngineTabVideoSource::Draw() { NS_ENSURE_SUCCESS_VOID(presShell->RenderDocument(r, renderDocFlags, bgColor, context)); - RefPtr surface = dt->Snapshot(); + nsRefPtr surface = dt->Snapshot(); if (!surface) { return; } diff --git a/dom/media/webrtc/RTCCertificate.cpp b/dom/media/webrtc/RTCCertificate.cpp index 06bed94f8c7..825af12dbc7 100644 --- a/dom/media/webrtc/RTCCertificate.cpp +++ b/dom/media/webrtc/RTCCertificate.cpp @@ -311,7 +311,7 @@ RTCCertificate::~RTCCertificate() // RTCPeerConnection provides this guarantee by holding a strong reference to // the RTCCertificate. It will cleanup any DtlsIdentity instances that it // creates before the RTCCertificate reference is released. -RefPtr +nsRefPtr RTCCertificate::CreateDtlsIdentity() const { nsNSSShutDownPreventionLock locker; @@ -320,7 +320,7 @@ RTCCertificate::CreateDtlsIdentity() const } SECKEYPrivateKey* key = SECKEY_CopyPrivateKey(mPrivateKey); CERTCertificate* cert = CERT_DupCertificate(mCertificate); - RefPtr id = new DtlsIdentity(key, cert, mAuthType); + nsRefPtr id = new DtlsIdentity(key, cert, mAuthType); return id; } diff --git a/dom/media/webrtc/RTCCertificate.h b/dom/media/webrtc/RTCCertificate.h index 558f02beb80..76144c3cd7e 100644 --- a/dom/media/webrtc/RTCCertificate.h +++ b/dom/media/webrtc/RTCCertificate.h @@ -17,7 +17,7 @@ #include "mozilla/ErrorResult.h" #include "mozilla/UniquePtr.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/dom/Date.h" #include "mozilla/dom/CryptoKey.h" #include "mtransport/dtlsidentity.h" @@ -61,7 +61,7 @@ public: } // Accessors for use by PeerConnectionImpl. - RefPtr CreateDtlsIdentity() const; + nsRefPtr CreateDtlsIdentity() const; CERTCertificate* Certificate() const { return mCertificate; } // For nsNSSShutDownObject diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index ed85f0797ac..09170f07c82 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -965,7 +965,7 @@ already_AddRefed nsNPAPIPluginInstance::CreateSurfaceText if (!texture) return nullptr; - RefPtr surface = AndroidSurfaceTexture::Create(TexturePoolOGL::GetGLContext(), + nsRefPtr surface = AndroidSurfaceTexture::Create(TexturePoolOGL::GetGLContext(), texture); if (!surface) { return nullptr; @@ -1014,7 +1014,7 @@ nsNPAPIPluginInstance::AsSurfaceTexture() void* nsNPAPIPluginInstance::AcquireVideoWindow() { - RefPtr surface = CreateSurfaceTexture(); + nsRefPtr surface = CreateSurfaceTexture(); if (!surface) { return nullptr; } diff --git a/dom/plugins/base/nsNPAPIPluginInstance.h b/dom/plugins/base/nsNPAPIPluginInstance.h index 157f71b53f0..b9aa92400dc 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -221,7 +221,7 @@ public: mSurfaceTexture = nullptr; } - mozilla::RefPtr mSurfaceTexture; + nsRefPtr mSurfaceTexture; gfxRect mDimensions; }; @@ -345,8 +345,8 @@ protected: bool mFullScreen; mozilla::gl::OriginPos mOriginPos; - mozilla::RefPtr mContentTexture; - mozilla::RefPtr mContentSurface; + nsRefPtr mContentTexture; + nsRefPtr mContentSurface; #endif enum { diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 61b45352f05..2d855b435c5 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1233,7 +1233,7 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext, // If the renderer is backed by an IOSurface, resize it as required. mIOSurface = MacIOSurface::CreateIOSurface(aWidth, aHeight, scaleFactor); if (mIOSurface) { - RefPtr attachSurface = MacIOSurface::LookupSurface( + nsRefPtr attachSurface = MacIOSurface::LookupSurface( mIOSurface->GetIOSurfaceID(), scaleFactor); if (attachSurface) { diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 885ba0cd5a3..0a2cadf1038 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -295,8 +295,8 @@ private: #ifdef XP_MACOSX NP_CGContext mCGPluginPortCopy; int32_t mInCGPaintLevel; - mozilla::RefPtr mIOSurface; - mozilla::RefPtr mCARenderer; + nsRefPtr mIOSurface; + nsRefPtr mCARenderer; CGColorSpaceRef mColorProfile; static nsCOMPtr *sCATimer; static nsTArray *sCARefreshListeners; diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 69a97144023..cd14e3b8b0f 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -101,11 +101,11 @@ struct RunnableMethodTraits * allowed from processes other than the main process. So we have our own * version here. */ -static RefPtr +static nsRefPtr CreateDrawTargetForSurface(gfxASurface *aSurface) { SurfaceFormat format = aSurface->GetSurfaceFormat(); - RefPtr drawTarget = + nsRefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSurface->GetSize(), &format); @@ -995,7 +995,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, NPCocoaEvent evcopy = event.event; mContentsScaleFactor = event.contentsScaleFactor; - RefPtr surf = MacIOSurface::LookupSurface(surfaceid, + nsRefPtr surf = MacIOSurface::LookupSurface(surfaceid, mContentsScaleFactor); if (!surf) { NS_ERROR("Invalid IOSurface."); @@ -3236,7 +3236,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, #endif if (mIsTransparent && !CanPaintOnBackground()) { - RefPtr dt = CreateDrawTargetForSurface(renderSurface); + nsRefPtr dt = CreateDrawTargetForSurface(renderSurface); gfx::Rect rect(plPaintRect.x, plPaintRect.y, plPaintRect.width, plPaintRect.height); // Moz2D treats OP_SOURCE operations as unbounded, so we need to @@ -3251,7 +3251,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, PaintRectToPlatformSurface(plPaintRect, renderSurface); if (renderSurface != aSurface) { - RefPtr dt; + nsRefPtr dt; if (aSurface == mCurrentSurface && aSurface->GetType() == gfxSurfaceType::Image && aSurface->GetSurfaceFormat() == SurfaceFormat::B8G8R8X8) { @@ -3270,7 +3270,7 @@ PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect, // Copy helper surface content to target dt = CreateDrawTargetForSurface(aSurface); } - RefPtr surface = + nsRefPtr surface = gfxPlatform::GetSourceSurfaceForSurface(dt, renderSurface); dt->CopySurface(surface, aRect, aRect.TopLeft()); } @@ -3327,8 +3327,8 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect, // background and copy the result PaintRectToSurface(rect, aSurface, Color(1.f, 1.f, 1.f)); { - RefPtr dt = CreateDrawTargetForSurface(whiteImage); - RefPtr surface = + nsRefPtr dt = CreateDrawTargetForSurface(whiteImage); + nsRefPtr surface = gfxPlatform::GetSourceSurfaceForSurface(dt, aSurface); dt->CopySurface(surface, rect, IntPoint()); } @@ -3371,8 +3371,8 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect, // If we had to use a temporary black surface, copy the pixels // with alpha back to the target if (!useSurfaceSubimageForBlack) { - RefPtr dt = CreateDrawTargetForSurface(aSurface); - RefPtr surface = + nsRefPtr dt = CreateDrawTargetForSurface(aSurface); + nsRefPtr surface = gfxPlatform::GetSourceSurfaceForSurface(dt, blackImage); dt->CopySurface(surface, IntRect(0, 0, rect.width, rect.height), @@ -3510,8 +3510,8 @@ PluginInstanceChild::ShowPluginFrame() { nsRefPtr surface = mHelperSurface ? mHelperSurface : mCurrentSurface; - RefPtr dt = CreateDrawTargetForSurface(surface); - RefPtr backgroundSurface = + nsRefPtr dt = CreateDrawTargetForSurface(surface); + nsRefPtr backgroundSurface = gfxPlatform::GetSourceSurfaceForSurface(dt, mBackground); dt->CopySurface(backgroundSurface, rect, rect.TopLeft()); } @@ -3636,8 +3636,8 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect) mSurfaceDifferenceRect.width, mSurfaceDifferenceRect.height)); // Read back previous content - RefPtr dt = CreateDrawTargetForSurface(mCurrentSurface); - RefPtr source = + nsRefPtr dt = CreateDrawTargetForSurface(mCurrentSurface); + nsRefPtr source = gfxPlatform::GetSourceSurfaceForSurface(dt, mBackSurface); // Subtract from mSurfaceDifferenceRect area which is overlapping with rect nsIntRegion result; diff --git a/dom/plugins/ipc/PluginInstanceChild.h b/dom/plugins/ipc/PluginInstanceChild.h index 396f33f1127..4a11b538e47 100644 --- a/dom/plugins/ipc/PluginInstanceChild.h +++ b/dom/plugins/ipc/PluginInstanceChild.h @@ -457,7 +457,7 @@ private: #endif CGColorSpaceRef mShColorSpace; CGContextRef mShContext; - mozilla::RefPtr mCARenderer; + nsRefPtr mCARenderer; void *mCGLayer; // Core Animation drawing model requires a refresh timer. diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index bf90b483f7c..9a00b996756 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -547,7 +547,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect, else if (newSurface.type() == SurfaceDescriptor::TIOSurfaceDescriptor) { IOSurfaceDescriptor iodesc = newSurface.get_IOSurfaceDescriptor(); - RefPtr newIOSurface = + nsRefPtr newIOSurface = MacIOSurface::LookupSurface(iodesc.surfaceId(), iodesc.contentsScaleFactor()); @@ -800,7 +800,7 @@ PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect, "Update outside of background area"); #endif - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateDrawTargetForSurface(mBackground, gfx::IntSize(sz.width, sz.height)); nsRefPtr ctx = new gfxContext(dt); ctx.forget(aCtx); diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index 01b9c8c2f21..e1faae60d2d 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -388,8 +388,8 @@ private: uint16_t mShWidth; uint16_t mShHeight; CGColorSpaceRef mShColorSpace; - RefPtr mIOSurface; - RefPtr mFrontIOSurface; + nsRefPtr mIOSurface; + nsRefPtr mFrontIOSurface; #endif // definied(MOZ_WIDGET_COCOA) // ObjectFrame layer wrapper diff --git a/dom/plugins/ipc/PluginUtilsOSX.h b/dom/plugins/ipc/PluginUtilsOSX.h index 7abab1efdbf..4aeea30e7d6 100644 --- a/dom/plugins/ipc/PluginUtilsOSX.h +++ b/dom/plugins/ipc/PluginUtilsOSX.h @@ -80,9 +80,9 @@ public: private: void *mCALayer; - RefPtr mCARenderer; - RefPtr mFrontSurface; - RefPtr mBackSurface; + nsRefPtr mCARenderer; + nsRefPtr mFrontSurface; + nsRefPtr mBackSurface; double mContentsScaleFactor; }; diff --git a/dom/plugins/ipc/PluginUtilsOSX.mm b/dom/plugins/ipc/PluginUtilsOSX.mm index 7a5947f300b..9d00ade1626 100644 --- a/dom/plugins/ipc/PluginUtilsOSX.mm +++ b/dom/plugins/ipc/PluginUtilsOSX.mm @@ -488,7 +488,7 @@ void nsDoubleBufferCARenderer::Render() { } void nsDoubleBufferCARenderer::SwapSurfaces() { - RefPtr prevFrontSurface = mFrontSurface; + nsRefPtr prevFrontSurface = mFrontSurface; mFrontSurface = mBackSurface; mBackSurface = prevFrontSurface; diff --git a/dom/svg/SVGContentUtils.cpp b/dom/svg/SVGContentUtils.cpp index b29bedb66e8..b07c01423f9 100644 --- a/dom/svg/SVGContentUtils.cpp +++ b/dom/svg/SVGContentUtils.cpp @@ -15,7 +15,7 @@ #include "gfxSVGGlyphs.h" #include "mozilla/gfx/2D.h" #include "mozilla/dom/SVGSVGElement.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsComputedDOMStyle.h" #include "nsFontMetrics.h" #include "nsIFrame.h" @@ -845,9 +845,9 @@ SVGContentUtils::GetPath(const nsAString& aPathString) return NULL; } - RefPtr drawTarget = + nsRefPtr drawTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); - RefPtr builder = + nsRefPtr builder = drawTarget->CreatePathBuilder(FillRule::FILL_WINDING); return pathData.BuildPath(builder, NS_STYLE_STROKE_LINECAP_BUTT, 1); diff --git a/dom/svg/SVGEllipseElement.cpp b/dom/svg/SVGEllipseElement.cpp index 47adbf15777..aa56ffbf192 100644 --- a/dom/svg/SVGEllipseElement.cpp +++ b/dom/svg/SVGEllipseElement.cpp @@ -8,7 +8,7 @@ #include "mozilla/dom/SVGEllipseElementBinding.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Ellipse) diff --git a/dom/svg/SVGFEBlendElement.cpp b/dom/svg/SVGFEBlendElement.cpp index 7fea66b6118..94ac562e579 100644 --- a/dom/svg/SVGFEBlendElement.cpp +++ b/dom/svg/SVGFEBlendElement.cpp @@ -86,7 +86,7 @@ FilterPrimitiveDescription SVGFEBlendElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { uint32_t mode = mEnumAttributes[MODE].GetAnimValue(); FilterPrimitiveDescription descr(PrimitiveType::Blend); diff --git a/dom/svg/SVGFEBlendElement.h b/dom/svg/SVGFEBlendElement.h index 180cafc750a..b5721be9b21 100644 --- a/dom/svg/SVGFEBlendElement.h +++ b/dom/svg/SVGFEBlendElement.h @@ -33,7 +33,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEColorMatrixElement.cpp b/dom/svg/SVGFEColorMatrixElement.cpp index 0402a6dea22..e3b0c11d87a 100644 --- a/dom/svg/SVGFEColorMatrixElement.cpp +++ b/dom/svg/SVGFEColorMatrixElement.cpp @@ -89,7 +89,7 @@ FilterPrimitiveDescription SVGFEColorMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { uint32_t type = mEnumAttributes[TYPE].GetAnimValue(); const SVGNumberList &values = mNumberListAttributes[VALUES].GetAnimValue(); diff --git a/dom/svg/SVGFEColorMatrixElement.h b/dom/svg/SVGFEColorMatrixElement.h index 19ace41cae0..64aa2d25439 100644 --- a/dom/svg/SVGFEColorMatrixElement.h +++ b/dom/svg/SVGFEColorMatrixElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEComponentTransferElement.cpp b/dom/svg/SVGFEComponentTransferElement.cpp index 668d5534cb5..e70f00f6242 100644 --- a/dom/svg/SVGFEComponentTransferElement.cpp +++ b/dom/svg/SVGFEComponentTransferElement.cpp @@ -56,7 +56,7 @@ FilterPrimitiveDescription SVGFEComponentTransferElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { nsRefPtr childForChannel[4]; diff --git a/dom/svg/SVGFEComponentTransferElement.h b/dom/svg/SVGFEComponentTransferElement.h index b3d0177a540..61c29421987 100644 --- a/dom/svg/SVGFEComponentTransferElement.h +++ b/dom/svg/SVGFEComponentTransferElement.h @@ -33,7 +33,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFECompositeElement.cpp b/dom/svg/SVGFECompositeElement.cpp index 07a1e2934c2..0fd643b566a 100644 --- a/dom/svg/SVGFECompositeElement.cpp +++ b/dom/svg/SVGFECompositeElement.cpp @@ -113,7 +113,7 @@ FilterPrimitiveDescription SVGFECompositeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { FilterPrimitiveDescription descr(PrimitiveType::Composite); uint32_t op = mEnumAttributes[OPERATOR].GetAnimValue(); diff --git a/dom/svg/SVGFECompositeElement.h b/dom/svg/SVGFECompositeElement.h index 4bcdfe8dbc5..7e188e99a16 100644 --- a/dom/svg/SVGFECompositeElement.h +++ b/dom/svg/SVGFECompositeElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEConvolveMatrixElement.cpp b/dom/svg/SVGFEConvolveMatrixElement.cpp index 45faf68c645..cb0352046fb 100644 --- a/dom/svg/SVGFEConvolveMatrixElement.cpp +++ b/dom/svg/SVGFEConvolveMatrixElement.cpp @@ -168,7 +168,7 @@ FilterPrimitiveDescription SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { const FilterPrimitiveDescription failureDescription(PrimitiveType::Empty); diff --git a/dom/svg/SVGFEConvolveMatrixElement.h b/dom/svg/SVGFEConvolveMatrixElement.h index 845273058ba..6924cedcf04 100644 --- a/dom/svg/SVGFEConvolveMatrixElement.h +++ b/dom/svg/SVGFEConvolveMatrixElement.h @@ -43,7 +43,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEDiffuseLightingElement.cpp b/dom/svg/SVGFEDiffuseLightingElement.cpp index 010cf605f7a..30c0e22ff08 100644 --- a/dom/svg/SVGFEDiffuseLightingElement.cpp +++ b/dom/svg/SVGFEDiffuseLightingElement.cpp @@ -65,7 +65,7 @@ FilterPrimitiveDescription SVGFEDiffuseLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { float diffuseConstant = mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue(); diff --git a/dom/svg/SVGFEDiffuseLightingElement.h b/dom/svg/SVGFEDiffuseLightingElement.h index c68757956ac..122a5f5a81d 100644 --- a/dom/svg/SVGFEDiffuseLightingElement.h +++ b/dom/svg/SVGFEDiffuseLightingElement.h @@ -33,7 +33,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; diff --git a/dom/svg/SVGFEDisplacementMapElement.cpp b/dom/svg/SVGFEDisplacementMapElement.cpp index 84e59d75df0..44ac9bc2c69 100644 --- a/dom/svg/SVGFEDisplacementMapElement.cpp +++ b/dom/svg/SVGFEDisplacementMapElement.cpp @@ -95,7 +95,7 @@ FilterPrimitiveDescription SVGFEDisplacementMapElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { if (aInputsAreTainted[1]) { // If the map is tainted, refuse to apply the effect and act as a diff --git a/dom/svg/SVGFEDisplacementMapElement.h b/dom/svg/SVGFEDisplacementMapElement.h index 2a415963623..9476b6c0478 100644 --- a/dom/svg/SVGFEDisplacementMapElement.h +++ b/dom/svg/SVGFEDisplacementMapElement.h @@ -34,7 +34,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEDropShadowElement.cpp b/dom/svg/SVGFEDropShadowElement.cpp index f15d43fad2e..d73e69acef8 100644 --- a/dom/svg/SVGFEDropShadowElement.cpp +++ b/dom/svg/SVGFEDropShadowElement.cpp @@ -86,7 +86,7 @@ FilterPrimitiveDescription SVGFEDropShadowElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { float stdX = aInstance->GetPrimitiveNumber(SVGContentUtils::X, &mNumberPairAttributes[STD_DEV], diff --git a/dom/svg/SVGFEDropShadowElement.h b/dom/svg/SVGFEDropShadowElement.h index da805a330fc..9cc55c58810 100644 --- a/dom/svg/SVGFEDropShadowElement.h +++ b/dom/svg/SVGFEDropShadowElement.h @@ -36,7 +36,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEFloodElement.cpp b/dom/svg/SVGFEFloodElement.cpp index 5cacda78e9f..6b8753650c9 100644 --- a/dom/svg/SVGFEFloodElement.cpp +++ b/dom/svg/SVGFEFloodElement.cpp @@ -38,7 +38,7 @@ FilterPrimitiveDescription SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { FilterPrimitiveDescription descr(PrimitiveType::Flood); nsIFrame* frame = GetPrimaryFrame(); diff --git a/dom/svg/SVGFEFloodElement.h b/dom/svg/SVGFEFloodElement.h index efc8e55f789..1316ceb7f78 100644 --- a/dom/svg/SVGFEFloodElement.h +++ b/dom/svg/SVGFEFloodElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } // nsIContent interface diff --git a/dom/svg/SVGFEGaussianBlurElement.cpp b/dom/svg/SVGFEGaussianBlurElement.cpp index 7d9beeec5f8..4ff18d6c5e0 100644 --- a/dom/svg/SVGFEGaussianBlurElement.cpp +++ b/dom/svg/SVGFEGaussianBlurElement.cpp @@ -68,7 +68,7 @@ FilterPrimitiveDescription SVGFEGaussianBlurElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { float stdX = aInstance->GetPrimitiveNumber(SVGContentUtils::X, &mNumberPairAttributes[STD_DEV], diff --git a/dom/svg/SVGFEGaussianBlurElement.h b/dom/svg/SVGFEGaussianBlurElement.h index fbb9f337188..9c662b10682 100644 --- a/dom/svg/SVGFEGaussianBlurElement.h +++ b/dom/svg/SVGFEGaussianBlurElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEImageElement.cpp b/dom/svg/SVGFEImageElement.cpp index dbd0a68b145..f8bf40c83aa 100644 --- a/dom/svg/SVGFEImageElement.cpp +++ b/dom/svg/SVGFEImageElement.cpp @@ -10,7 +10,7 @@ #include "mozilla/dom/SVGFEImageElementBinding.h" #include "mozilla/dom/SVGFilterElement.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsContentUtils.h" #include "nsLayoutUtils.h" #include "nsSVGUtils.h" @@ -198,7 +198,7 @@ FilterPrimitiveDescription SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { nsIFrame* frame = GetPrimaryFrame(); if (!frame) { @@ -214,7 +214,7 @@ SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, currentRequest->GetImage(getter_AddRefs(imageContainer)); } - RefPtr image; + nsRefPtr image; if (imageContainer) { image = imageContainer->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); diff --git a/dom/svg/SVGFEImageElement.h b/dom/svg/SVGFEImageElement.h index b08e3676ea1..4e0b5e2d1df 100644 --- a/dom/svg/SVGFEImageElement.h +++ b/dom/svg/SVGFEImageElement.h @@ -42,7 +42,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEMergeElement.cpp b/dom/svg/SVGFEMergeElement.cpp index 3147648b558..cd5ec29dfcc 100644 --- a/dom/svg/SVGFEMergeElement.cpp +++ b/dom/svg/SVGFEMergeElement.cpp @@ -32,7 +32,7 @@ FilterPrimitiveDescription SVGFEMergeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { return FilterPrimitiveDescription(PrimitiveType::Merge); } diff --git a/dom/svg/SVGFEMergeElement.h b/dom/svg/SVGFEMergeElement.h index f4dfa112d02..8076daaae51 100644 --- a/dom/svg/SVGFEMergeElement.h +++ b/dom/svg/SVGFEMergeElement.h @@ -33,7 +33,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } virtual void GetSourceImageNames(nsTArray& aSources) override; diff --git a/dom/svg/SVGFEMorphologyElement.cpp b/dom/svg/SVGFEMorphologyElement.cpp index 3d2de3a0f58..05e057ebb34 100644 --- a/dom/svg/SVGFEMorphologyElement.cpp +++ b/dom/svg/SVGFEMorphologyElement.cpp @@ -116,7 +116,7 @@ FilterPrimitiveDescription SVGFEMorphologyElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { int32_t rx, ry; GetRXY(&rx, &ry, *aInstance); diff --git a/dom/svg/SVGFEMorphologyElement.h b/dom/svg/SVGFEMorphologyElement.h index 01d7763ce44..2453754697b 100644 --- a/dom/svg/SVGFEMorphologyElement.h +++ b/dom/svg/SVGFEMorphologyElement.h @@ -36,7 +36,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFEOffsetElement.cpp b/dom/svg/SVGFEOffsetElement.cpp index f7d9b9cbe2a..fde6d4f62ce 100644 --- a/dom/svg/SVGFEOffsetElement.cpp +++ b/dom/svg/SVGFEOffsetElement.cpp @@ -64,7 +64,7 @@ FilterPrimitiveDescription SVGFEOffsetElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { FilterPrimitiveDescription descr(PrimitiveType::Offset); IntPoint offset(int32_t(aInstance->GetPrimitiveNumber( diff --git a/dom/svg/SVGFEOffsetElement.h b/dom/svg/SVGFEOffsetElement.h index bd4da6035e9..3c2a6163ab0 100644 --- a/dom/svg/SVGFEOffsetElement.h +++ b/dom/svg/SVGFEOffsetElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFESpecularLightingElement.cpp b/dom/svg/SVGFESpecularLightingElement.cpp index ae583352e1a..674488893f0 100644 --- a/dom/svg/SVGFESpecularLightingElement.cpp +++ b/dom/svg/SVGFESpecularLightingElement.cpp @@ -72,7 +72,7 @@ FilterPrimitiveDescription SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue(); float specularConstant = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue(); diff --git a/dom/svg/SVGFESpecularLightingElement.h b/dom/svg/SVGFESpecularLightingElement.h index 67560bb6ff7..65dc7e77b76 100644 --- a/dom/svg/SVGFESpecularLightingElement.h +++ b/dom/svg/SVGFESpecularLightingElement.h @@ -37,7 +37,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; diff --git a/dom/svg/SVGFETileElement.cpp b/dom/svg/SVGFETileElement.cpp index b649ee6367c..631635327b2 100644 --- a/dom/svg/SVGFETileElement.cpp +++ b/dom/svg/SVGFETileElement.cpp @@ -52,7 +52,7 @@ FilterPrimitiveDescription SVGFETileElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { return FilterPrimitiveDescription(PrimitiveType::Tile); } diff --git a/dom/svg/SVGFETileElement.h b/dom/svg/SVGFETileElement.h index fa2a87d4699..6b3745c4085 100644 --- a/dom/svg/SVGFETileElement.h +++ b/dom/svg/SVGFETileElement.h @@ -35,7 +35,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGFETurbulenceElement.cpp b/dom/svg/SVGFETurbulenceElement.cpp index 91bab0e8f3d..de9d2758cd1 100644 --- a/dom/svg/SVGFETurbulenceElement.cpp +++ b/dom/svg/SVGFETurbulenceElement.cpp @@ -123,7 +123,7 @@ FilterPrimitiveDescription SVGFETurbulenceElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { float fX = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eFirst); float fY = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eSecond); diff --git a/dom/svg/SVGFETurbulenceElement.h b/dom/svg/SVGFETurbulenceElement.h index 8a850dc0727..5ebc115152b 100644 --- a/dom/svg/SVGFETurbulenceElement.h +++ b/dom/svg/SVGFETurbulenceElement.h @@ -39,7 +39,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) override; + nsTArray>& aInputImages) override; virtual bool AttributeAffectsRendering( int32_t aNameSpaceID, nsIAtom* aAttribute) const override; virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; } diff --git a/dom/svg/SVGMotionSMILAnimationFunction.h b/dom/svg/SVGMotionSMILAnimationFunction.h index 75e64a4ef0a..95babced088 100644 --- a/dom/svg/SVGMotionSMILAnimationFunction.h +++ b/dom/svg/SVGMotionSMILAnimationFunction.h @@ -8,7 +8,7 @@ #define MOZILLA_SVGMOTIONSMILANIMATIONFUNCTION_H_ #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsAutoPtr.h" #include "nsSMILAnimationFunction.h" #include "nsTArray.h" @@ -95,7 +95,7 @@ protected: float mRotateAngle; // the angle value, if explicit. PathSourceType mPathSourceType; // source of our Path. - RefPtr mPath; // representation of motion path. + nsRefPtr mPath; // representation of motion path. FallibleTArray mPathVertices; // distances of vertices along path. bool mIsPathStale; diff --git a/dom/svg/SVGMotionSMILPathUtils.h b/dom/svg/SVGMotionSMILPathUtils.h index 8616d1dae65..0daff8b50b3 100644 --- a/dom/svg/SVGMotionSMILPathUtils.h +++ b/dom/svg/SVGMotionSMILPathUtils.h @@ -13,7 +13,7 @@ #include "mozilla/Attributes.h" #include "gfxPlatform.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsDebug.h" #include "nsSMILParserUtils.h" #include "nsTArray.h" @@ -38,7 +38,7 @@ public: : mSVGElement(aSVGElement), mHaveReceivedCommands(false) { - RefPtr drawTarget = + nsRefPtr drawTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); NS_ASSERTION(gfxPlatform::GetPlatform()-> SupportsAzureContentForDrawTarget(drawTarget), @@ -71,7 +71,7 @@ public: // Member data const nsSVGElement* mSVGElement; // context for converting to user units - RefPtr mPathBuilder; + nsRefPtr mPathBuilder; bool mHaveReceivedCommands; }; diff --git a/dom/svg/SVGPathData.cpp b/dom/svg/SVGPathData.cpp index 2020798b4f5..382481b0118 100644 --- a/dom/svg/SVGPathData.cpp +++ b/dom/svg/SVGPathData.cpp @@ -11,7 +11,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Types.h" #include "mozilla/gfx/Point.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsError.h" #include "nsString.h" #include "nsSVGPathDataParser.h" @@ -516,9 +516,9 @@ SVGPathData::BuildPathForMeasuring() const // pass as aStrokeWidth doesn't matter (since it's only used to determine the // length of those extra little lines). - RefPtr drawTarget = + nsRefPtr drawTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); - RefPtr builder = + nsRefPtr builder = drawTarget->CreatePathBuilder(FillRule::FILL_WINDING); return BuildPath(builder, NS_STYLE_STROKE_LINECAP_BUTT, 0); } diff --git a/dom/svg/SVGPathData.h b/dom/svg/SVGPathData.h index 60dffc25333..736163b9cc3 100644 --- a/dom/svg/SVGPathData.h +++ b/dom/svg/SVGPathData.h @@ -15,7 +15,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Types.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsSVGElement.h" #include "nsTArray.h" diff --git a/dom/svg/SVGPathElement.cpp b/dom/svg/SVGPathElement.cpp index 939a61a001c..705f9e0c15c 100644 --- a/dom/svg/SVGPathElement.cpp +++ b/dom/svg/SVGPathElement.cpp @@ -15,7 +15,7 @@ #include "gfxPlatform.h" #include "mozilla/dom/SVGPathElementBinding.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsComputedDOMStyle.h" #include "nsGkAtoms.h" @@ -71,14 +71,14 @@ SVGPathElement::PathLength() float SVGPathElement::GetTotalLength() { - RefPtr flat = GetOrBuildPathForMeasuring(); + nsRefPtr flat = GetOrBuildPathForMeasuring(); return flat ? flat->ComputeLength() : 0.f; } already_AddRefed SVGPathElement::GetPointAtLength(float distance, ErrorResult& rv) { - RefPtr path = GetOrBuildPathForMeasuring(); + nsRefPtr path = GetOrBuildPathForMeasuring(); if (!path) { rv.Throw(NS_ERROR_FAILURE); return nullptr; @@ -341,7 +341,7 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor) if (mPathLength.IsExplicitlySet()) { float authorsPathLengthEstimate = mPathLength.GetAnimValue(); if (authorsPathLengthEstimate > 0) { - RefPtr path = GetOrBuildPathForMeasuring(); + nsRefPtr path = GetOrBuildPathForMeasuring(); if (!path) { // The path is empty or invalid so its length must be zero and // we know that 0 / authorsPathLengthEstimate = 0. @@ -353,7 +353,7 @@ SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor) // we need to take that into account. gfxMatrix matrix = PrependLocalTransformsTo(gfxMatrix()); if (!matrix.IsIdentity()) { - RefPtr builder = + nsRefPtr builder = path->TransformedCopyToBuilder(ToMatrix(matrix)); path = builder->Finish(); } diff --git a/dom/svg/SVGPathElement.h b/dom/svg/SVGPathElement.h index 20af44905f9..36d5ca084d5 100644 --- a/dom/svg/SVGPathElement.h +++ b/dom/svg/SVGPathElement.h @@ -8,7 +8,7 @@ #define mozilla_dom_SVGPathElement_h #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsSVGNumber2.h" #include "nsSVGPathGeometryElement.h" #include "SVGAnimatedPathSegList.h" diff --git a/dom/svg/nsSVGFilters.h b/dom/svg/nsSVGFilters.h index e9673c0c26e..d50b7335779 100644 --- a/dom/svg/nsSVGFilters.h +++ b/dom/svg/nsSVGFilters.h @@ -98,7 +98,7 @@ public: GetPrimitiveDescription(nsSVGFilterInstance* aInstance, const IntRect& aFilterSubregion, const nsTArray& aInputsAreTainted, - nsTArray>& aInputImages) = 0; + nsTArray>& aInputImages) = 0; // returns true if changes to the attribute should cause us to // repaint the filter diff --git a/dom/svg/nsSVGPathGeometryElement.cpp b/dom/svg/nsSVGPathGeometryElement.cpp index 2d2e9b22d55..bbfbb970acf 100644 --- a/dom/svg/nsSVGPathGeometryElement.cpp +++ b/dom/svg/nsSVGPathGeometryElement.cpp @@ -89,12 +89,12 @@ nsSVGPathGeometryElement::GetOrBuildPath(const DrawTarget& aDrawTarget, // looking at the global variable that the pref's stored in. if (cacheable && mCachedPath) { if (aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) { - RefPtr path(mCachedPath); + nsRefPtr path(mCachedPath); return path.forget(); } } - RefPtr builder = aDrawTarget.CreatePathBuilder(aFillRule); - RefPtr path = BuildPath(builder); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(aFillRule); + nsRefPtr path = BuildPath(builder); if (cacheable && NS_SVGPathCachingEnabled()) { mCachedPath = path; } diff --git a/dom/svg/nsSVGPathGeometryElement.h b/dom/svg/nsSVGPathGeometryElement.h index c9b847f1ab2..e6613eb73bd 100644 --- a/dom/svg/nsSVGPathGeometryElement.h +++ b/dom/svg/nsSVGPathGeometryElement.h @@ -192,7 +192,7 @@ public: FillRule GetFillRule(); protected: - mutable mozilla::RefPtr mCachedPath; + mutable nsRefPtr mCachedPath; }; #endif diff --git a/dom/system/gonk/AutoMounter.cpp b/dom/system/gonk/AutoMounter.cpp index 49f27ea7d0b..d87e92aa81b 100644 --- a/dom/system/gonk/AutoMounter.cpp +++ b/dom/system/gonk/AutoMounter.cpp @@ -211,7 +211,7 @@ class AutoMounter public: NS_INLINE_DECL_REFCOUNTING(AutoMounter) - typedef nsTArray> VolumeArray; + typedef nsTArray> VolumeArray; AutoMounter() : mState(STATE_IDLE), @@ -245,7 +245,7 @@ public: VolumeManager::VolumeArray::size_type numVolumes = VolumeManager::NumVolumes(); VolumeManager::VolumeArray::index_type i; for (i = 0; i < numVolumes; i++) { - RefPtr vol = VolumeManager::GetVolume(i); + nsRefPtr vol = VolumeManager::GetVolume(i); if (vol) { // We need to pick up the intial value of the // ums.volume.NAME.enabled setting. @@ -323,7 +323,7 @@ public: void SetSharingMode(const nsACString& aVolumeName, bool aAllowSharing) { - RefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); + nsRefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); if (!vol) { return; } @@ -340,7 +340,7 @@ public: void FormatVolume(const nsACString& aVolumeName) { - RefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); + nsRefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); if (!vol) { return; } @@ -357,7 +357,7 @@ public: void MountVolume(const nsACString& aVolumeName) { - RefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); + nsRefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); if (!vol) { return; } @@ -373,7 +373,7 @@ public: void UnmountVolume(const nsACString& aVolumeName) { - RefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); + nsRefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); if (!vol) { return; } @@ -455,7 +455,7 @@ private: AutoVolumeEventObserver mVolumeEventObserver; AutoVolumeManagerStateObserver mVolumeManagerStateObserver; - RefPtr mResponseCallback; + nsRefPtr mResponseCallback; int32_t mMode; MozMtpStorage::Array mMozMtpStorage; }; @@ -657,7 +657,7 @@ AutoMounter::StartMtpServer() VolumeArray::index_type volIndex; VolumeArray::size_type numVolumes = VolumeManager::NumVolumes(); for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); nsRefPtr storage = new MozMtpStorage(vol, sMozMtpServer); mMozMtpStorage.AppendElement(storage); } @@ -910,7 +910,7 @@ AutoMounter::UpdateState() VolumeArray::index_type volIndex; VolumeArray::size_type numVolumes = VolumeManager::NumVolumes(); for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); Volume::STATE volState = vol->State(); if (vol->State() == nsIVolume::STATE_MOUNTED) { @@ -1247,7 +1247,7 @@ nsresult AutoMounter::Dump(nsACString& desc) VolumeArray::index_type volIndex; VolumeArray::size_type numVolumes = VolumeManager::NumVolumes(); for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); desc += "|"; desc += vol->NameStr(); diff --git a/dom/system/gonk/MozMtpDatabase.cpp b/dom/system/gonk/MozMtpDatabase.cpp index 9453475b368..868e6ceb1cd 100644 --- a/dom/system/gonk/MozMtpDatabase.cpp +++ b/dom/system/gonk/MozMtpDatabase.cpp @@ -102,7 +102,7 @@ MozMtpDatabase::MozMtpDatabase() // We use the index into the array as the handle. Since zero isn't a valid // index, we stick a dummy entry there. - RefPtr dummy; + nsRefPtr dummy; MutexAutoLock lock(mMutex); mDb.AppendElement(dummy); @@ -143,7 +143,7 @@ MozMtpDatabase::DumpEntries(const char* aLabel) MTP_LOG("%s: numEntries = %d", aLabel, numEntries); ProtectedDbArray::index_type entryIndex; for (entryIndex = 1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry) { MTP_LOG("%s: mDb[%d]: mHandle: 0x%08x mParent: 0x%08x StorageID: 0x%08x path: '%s'", aLabel, entryIndex, entry->mHandle, entry->mParent, entry->mStorageID, entry->mPath.get()); @@ -161,7 +161,7 @@ MozMtpDatabase::FindEntryByPath(const nsACString& aPath) ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIndex; for (entryIndex = 1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry && entry->mPath.Equals(aPath)) { return entryIndex; } @@ -174,7 +174,7 @@ MozMtpDatabase::GetEntry(MtpObjectHandle aHandle) { MutexAutoLock lock(mMutex); - RefPtr entry; + nsRefPtr entry; if (aHandle > 0 && aHandle < mDb.Length()) { entry = mDb[aHandle]; @@ -190,7 +190,7 @@ MozMtpDatabase::RemoveEntry(MtpObjectHandle aHandle) return; } - RefPtr removedEntry = mDb[aHandle]; + nsRefPtr removedEntry = mDb[aHandle]; mDb[aHandle] = nullptr; MTP_DBG("0x%08x removed", aHandle); // if the entry is not a folder, just return. @@ -204,7 +204,7 @@ MozMtpDatabase::RemoveEntry(MtpObjectHandle aHandle) ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIndex; for (entryIndex = aHandle+1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry && IsValidHandle(entry->mParent) && !mDb[entry->mParent]) { mDb[entryIndex] = nullptr; MTP_DBG("0x%08x removed", aHandle); @@ -232,7 +232,7 @@ MozMtpDatabase::UpdateEntry(MtpObjectHandle aHandle, DeviceStorageFile* aFile) { MutexAutoLock lock(mMutex); - RefPtr entry = mDb[aHandle]; + nsRefPtr entry = mDb[aHandle]; int64_t fileSize = 0; aFile->mFile->GetFileSize(&fileSize); @@ -304,7 +304,7 @@ MozMtpDatabase::MtpWatcherNotify(DbEntry* aEntry, const char* aEventType) // Tell interested parties that a file was created, deleted, or modified. - RefPtr storageEntry; + nsRefPtr storageEntry; { MutexAutoLock lock(mMutex); @@ -465,7 +465,7 @@ MozMtpDatabase::CreateEntryForFileAndNotify(const nsACString& aPath, // This directory and the file don't exist, create them - RefPtr entry = new DbEntry; + nsRefPtr entry = new DbEntry; entry->mStorageID = storageID; entry->mObjectName = Substring(aPath, offset, slash - offset); @@ -528,7 +528,7 @@ MozMtpDatabase::AddDirectory(MtpStorageID aStorageID, continue; } - RefPtr entry = new DbEntry; + nsRefPtr entry = new DbEntry; entry->mStorageID = aStorageID; entry->mParent = aParent; @@ -565,7 +565,7 @@ MozMtpDatabase::FindStorage(MtpStorageID aStorageID) StorageArray::index_type storageIndex; for (storageIndex = 0; storageIndex < numStorages; storageIndex++) { - RefPtr storage = mStorage[storageIndex]; + nsRefPtr storage = mStorage[storageIndex]; if (storage->mStorageID == aStorageID) { return storageIndex; } @@ -585,7 +585,7 @@ MozMtpDatabase::FindStorageIDFor(const nsACString& aPath, nsCSubstring& aRemaind StorageArray::index_type storageIndex; for (storageIndex = 0; storageIndex < numStorages; storageIndex++) { - RefPtr storage = mStorage[storageIndex]; + nsRefPtr storage = mStorage[storageIndex]; if (StringHead(aPath, storage->mStoragePath.Length()).Equals(storage->mStoragePath)) { if (aPath.Length() == storage->mStoragePath.Length()) { return storage->mStorageID; @@ -648,7 +648,7 @@ MozMtpDatabase::RemoveStorage(MtpStorageID aStorageID) ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIndex; for (entryIndex = 1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry && entry->mStorageID == aStorageID) { mDb[entryIndex] = nullptr; } @@ -678,7 +678,7 @@ MozMtpDatabase::beginSendObject(const char* aPath, aParent = MTP_PARENT_ROOT; } - RefPtr entry = new DbEntry; + nsRefPtr entry = new DbEntry; entry->mStorageID = aStorageID; entry->mParent = aParent; @@ -772,7 +772,7 @@ MozMtpDatabase::endSendObject(const char* aPath, MTP_LOG("Handle: 0x%08x Path: '%s'", aHandle, aPath); if (aSucceeded) { - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (entry) { // The android MTP server only copies the data in, it doesn't set the // modified timestamp, so we do that here. @@ -823,7 +823,7 @@ MozMtpDatabase::getObjectList(MtpStorageID aStorageID, ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIndex; for (entryIndex = 1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry && (aStorageID == 0xFFFFFFFF || entry->mStorageID == aStorageID) && (aFormat == 0 || entry->mObjectFormat == aFormat) && @@ -855,7 +855,7 @@ MozMtpDatabase::getNumObjects(MtpStorageID aStorageID, ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIndex; for (entryIndex = 1; entryIndex < numEntries; entryIndex++) { - RefPtr entry = mDb[entryIndex]; + nsRefPtr entry = mDb[entryIndex]; if (entry && (aStorageID == 0xFFFFFFFF || entry->mStorageID == aStorageID) && (aFormat == 0 || entry->mObjectFormat == aFormat) && @@ -943,7 +943,7 @@ MozMtpDatabase::getObjectPropertyValue(MtpObjectHandle aHandle, MtpObjectProperty aProperty, MtpDataPacket& aPacket) { - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (!entry) { MTP_ERR("Invalid Handle: 0x%08x", aHandle); return MTP_RESPONSE_INVALID_OBJECT_HANDLE; @@ -1030,7 +1030,7 @@ MozMtpDatabase::setObjectPropertyValue(MtpObjectHandle aHandle, return MTP_RESPONSE_GENERAL_ERROR; } - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (!entry) { MTP_ERR("Invalid Handle: 0x%08x", aHandle); return MTP_RESPONSE_INVALID_OBJECT_HANDLE; @@ -1093,7 +1093,7 @@ MozMtpDatabase::QueryEntries(MozMtpDatabase::MatchType aMatchType, ProtectedDbArray::size_type numEntries = mDb.Length(); ProtectedDbArray::index_type entryIdx; - RefPtr entry; + nsRefPtr entry; result.Clear(); @@ -1249,7 +1249,7 @@ MozMtpDatabase::getObjectPropertyList(MtpObjectHandle aHandle, aPacket.putUInt32(numObjectProperties * numEntries); for (entryIdx = 0; entryIdx < numEntries; entryIdx++) { - RefPtr entry = result[entryIdx]; + nsRefPtr entry = result[entryIdx]; for (size_t propertyIdx = 0; propertyIdx < numObjectProperties; propertyIdx++) { aPacket.putUInt32(entry->mHandle); @@ -1330,7 +1330,7 @@ MtpResponseCode MozMtpDatabase::getObjectInfo(MtpObjectHandle aHandle, MtpObjectInfo& aInfo) { - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (!entry) { MTP_ERR("Handle 0x%08x is invalid", aHandle); return MTP_RESPONSE_INVALID_OBJECT_HANDLE; @@ -1392,7 +1392,7 @@ MozMtpDatabase::getObjectFilePath(MtpObjectHandle aHandle, int64_t& aOutFileLength, MtpObjectFormat& aOutFormat) { - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (!entry) { MTP_ERR("Handle 0x%08x is invalid", aHandle); return MTP_RESPONSE_INVALID_OBJECT_HANDLE; @@ -1411,7 +1411,7 @@ MozMtpDatabase::getObjectFilePath(MtpObjectHandle aHandle, MtpResponseCode MozMtpDatabase::deleteFile(MtpObjectHandle aHandle) { - RefPtr entry = GetEntry(aHandle); + nsRefPtr entry = GetEntry(aHandle); if (!entry) { MTP_ERR("Invalid Handle: 0x%08x", aHandle); return MTP_RESPONSE_INVALID_OBJECT_HANDLE; diff --git a/dom/system/gonk/MozMtpDatabase.h b/dom/system/gonk/MozMtpDatabase.h index 6d17ec7444e..fcfea4c6a52 100644 --- a/dom/system/gonk/MozMtpDatabase.h +++ b/dom/system/gonk/MozMtpDatabase.h @@ -10,7 +10,7 @@ #include "MozMtpCommon.h" #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsString.h" #include "nsIThread.h" @@ -210,8 +210,8 @@ private: private: mozilla::Mutex& mMutex; }; - typedef nsTArray > UnprotectedDbArray; - typedef ProtectedTArray > ProtectedDbArray; + typedef nsTArray > UnprotectedDbArray; + typedef ProtectedTArray > ProtectedDbArray; struct StorageEntry final { @@ -224,7 +224,7 @@ private: protected: ~StorageEntry() {} }; - typedef ProtectedTArray > StorageArray; + typedef ProtectedTArray > StorageArray; enum MatchType { diff --git a/dom/system/gonk/MozMtpStorage.h b/dom/system/gonk/MozMtpStorage.h index cbc3438eda5..875883d338d 100644 --- a/dom/system/gonk/MozMtpStorage.h +++ b/dom/system/gonk/MozMtpStorage.h @@ -37,7 +37,7 @@ private: nsRefPtr mMozMtpServer; UniquePtr mMtpStorage; - RefPtr mVolume; + nsRefPtr mVolume; MtpStorageID mStorageID; }; diff --git a/dom/system/gonk/Volume.cpp b/dom/system/gonk/Volume.cpp index 1fd276eee89..0d16a7cd6de 100644 --- a/dom/system/gonk/Volume.cpp +++ b/dom/system/gonk/Volume.cpp @@ -480,7 +480,7 @@ Volume::RegisterVolumeObserver(Volume::EventObserver* aObserver, const char* aNa // Send an initial event to the observer (for each volume) size_t numVolumes = VolumeManager::NumVolumes(); for (size_t volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); aObserver->Notify(vol); } } @@ -507,7 +507,7 @@ Volume::UpdateMountLock(const nsACString& aVolumeName, MOZ_ASSERT(XRE_IsParentProcess()); MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop()); - RefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); + nsRefPtr vol = VolumeManager::FindVolumeByName(aVolumeName); if (!vol || (vol->mMountGeneration != aMountGeneration)) { return; } diff --git a/dom/system/gonk/VolumeCommand.h b/dom/system/gonk/VolumeCommand.h index a2e7c69b82b..a87cdf23344 100644 --- a/dom/system/gonk/VolumeCommand.h +++ b/dom/system/gonk/VolumeCommand.h @@ -7,7 +7,7 @@ #include "nsString.h" #include "nsISupportsImpl.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include #include @@ -179,7 +179,7 @@ private: size_t mBytesConsumed; // How many bytes have been sent // Called when a response to the command is received. - RefPtr mCallback; + nsRefPtr mCallback; }; class VolumeActionCommand : public VolumeCommand @@ -189,7 +189,7 @@ public: const char* aExtraArgs, VolumeResponseCallback* aCallback); private: - RefPtr mVolume; + nsRefPtr mVolume; }; class VolumeListCommand : public VolumeCommand diff --git a/dom/system/gonk/VolumeManager.cpp b/dom/system/gonk/VolumeManager.cpp index 0a73531ff7e..700ee4aba18 100644 --- a/dom/system/gonk/VolumeManager.cpp +++ b/dom/system/gonk/VolumeManager.cpp @@ -55,7 +55,7 @@ VolumeManager::Dump(const char* aLabel) VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = GetVolume(volIndex); + nsRefPtr vol = GetVolume(volIndex); vol->Dump(aLabel); } } @@ -75,7 +75,7 @@ already_AddRefed VolumeManager::GetVolume(size_t aIndex) { MOZ_ASSERT(aIndex < NumVolumes()); - RefPtr vol = sVolumeManager->mVolumeArray[aIndex]; + nsRefPtr vol = sVolumeManager->mVolumeArray[aIndex]; return vol.forget(); } @@ -134,7 +134,7 @@ VolumeManager::FindVolumeByName(const nsCSubstring& aName) VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = GetVolume(volIndex); + nsRefPtr vol = GetVolume(volIndex); if (vol->Name().Equals(aName)) { return vol.forget(); } @@ -146,7 +146,7 @@ VolumeManager::FindVolumeByName(const nsCSubstring& aName) already_AddRefed VolumeManager::FindAddVolumeByName(const nsCSubstring& aName) { - RefPtr vol = FindVolumeByName(aName); + nsRefPtr vol = FindVolumeByName(aName); if (vol) { return vol.forget(); } @@ -166,7 +166,7 @@ VolumeManager::RemoveVolumeByName(const nsCSubstring& aName) VolumeArray::size_type numVolumes = NumVolumes(); VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = GetVolume(volIndex); + nsRefPtr vol = GetVolume(volIndex); if (vol->Name().Equals(aName)) { sVolumeManager->mVolumeArray.RemoveElementAt(volIndex); return true; @@ -227,7 +227,7 @@ void VolumeManager::InitConfig() continue; } nsCString mountPoint(tokenizer.nextToken()); - RefPtr vol = FindAddVolumeByName(volName); + nsRefPtr vol = FindAddVolumeByName(volName); vol->SetFakeVolume(mountPoint); continue; } @@ -249,7 +249,7 @@ void VolumeManager::InitConfig() continue; } nsCString configValue(tokenizer.nextToken()); - RefPtr vol = FindVolumeByName(volName); + nsRefPtr vol = FindVolumeByName(volName); if (vol) { vol->SetConfig(configName, configValue); } else { @@ -287,14 +287,14 @@ VolumeManager::DefaultConfig() // Phones line the nexus-4 which only have an internal // storage area will need to have a volume.cfg file with // removable set to false. - RefPtr vol = VolumeManager::GetVolume(0); + nsRefPtr vol = VolumeManager::GetVolume(0); vol->SetIsRemovable(true); vol->SetIsHotSwappable(true); return; } VolumeManager::VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); if (!vol->Name().EqualsLiteral("sdcard")) { vol->SetIsRemovable(true); vol->SetIsHotSwappable(true); @@ -316,7 +316,7 @@ class VolumeListCallback : public VolumeResponseCallback // we have of the same name, or add new ones if they don't exist. nsCWhitespaceTokenizer tokenizer(ResponseStr()); nsDependentCSubstring volName(tokenizer.nextToken()); - RefPtr vol = VolumeManager::FindAddVolumeByName(volName); + nsRefPtr vol = VolumeManager::FindAddVolumeByName(volName); vol->HandleVoldResponse(ResponseCode(), tokenizer); break; } @@ -494,7 +494,7 @@ VolumeManager::HandleBroadcast(int aResponseCode, nsCString& aResponseLine) tokenizer.nextToken(); // The word "Volume" nsDependentCSubstring volName(tokenizer.nextToken()); - RefPtr vol = FindVolumeByName(volName); + nsRefPtr vol = FindVolumeByName(volName); if (!vol) { return; } diff --git a/dom/system/gonk/VolumeManager.h b/dom/system/gonk/VolumeManager.h index 7c0503389fa..26586bce05d 100644 --- a/dom/system/gonk/VolumeManager.h +++ b/dom/system/gonk/VolumeManager.h @@ -80,7 +80,7 @@ class VolumeManager final : public MessageLoopForIO::LineWatcher public: NS_INLINE_DECL_REFCOUNTING(VolumeManager) - typedef nsTArray> VolumeArray; + typedef nsTArray> VolumeArray; VolumeManager(); @@ -152,7 +152,7 @@ private: void WriteCommandData(); void HandleBroadcast(int aResponseCode, nsCString& aResponseLine); - typedef std::queue > CommandQueue; + typedef std::queue > CommandQueue; static STATE mState; static StateObserverList mStateObserverList; @@ -164,7 +164,7 @@ private: bool mCommandPending; MessageLoopForIO::FileDescriptorWatcher mReadWatcher; MessageLoopForIO::FileDescriptorWatcher mWriteWatcher; - RefPtr mBroadcastCallback; + nsRefPtr mBroadcastCallback; }; /*************************************************************************** diff --git a/dom/system/gonk/VolumeServiceIOThread.cpp b/dom/system/gonk/VolumeServiceIOThread.cpp index 7eda843c00b..119f533f3ac 100644 --- a/dom/system/gonk/VolumeServiceIOThread.cpp +++ b/dom/system/gonk/VolumeServiceIOThread.cpp @@ -57,7 +57,7 @@ VolumeServiceIOThread::UpdateAllVolumes() VolumeManager::VolumeArray::index_type volIndex; for (volIndex = 0; volIndex < numVolumes; volIndex++) { - RefPtr vol = VolumeManager::GetVolume(volIndex); + nsRefPtr vol = VolumeManager::GetVolume(volIndex); mVolumeService->UpdateVolumeIOThread(vol); } } diff --git a/dom/system/gonk/VolumeServiceIOThread.h b/dom/system/gonk/VolumeServiceIOThread.h index 0c2a6a62f24..84acde90fa6 100644 --- a/dom/system/gonk/VolumeServiceIOThread.h +++ b/dom/system/gonk/VolumeServiceIOThread.h @@ -7,7 +7,7 @@ #include "Volume.h" #include "VolumeManager.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { namespace system { @@ -34,7 +34,7 @@ private: virtual void Notify(const VolumeManager::StateChangedEvent& aEvent); virtual void Notify(Volume* const & aVolume); - RefPtr mVolumeService; + nsRefPtr mVolumeService; }; void InitVolumeServiceIOThread(nsVolumeService* const & aVolumeService); diff --git a/dom/system/gonk/nsVolumeService.h b/dom/system/gonk/nsVolumeService.h index 9bddc0b8fe2..1381cdd2ace 100644 --- a/dom/system/gonk/nsVolumeService.h +++ b/dom/system/gonk/nsVolumeService.h @@ -6,7 +6,7 @@ #define mozilla_system_nsvolumeservice_h__ #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/StaticPtr.h" #include "nsCOMPtr.h" #include "nsIDOMWakeLockListener.h" diff --git a/dom/wifi/WifiCertService.cpp b/dom/wifi/WifiCertService.cpp index cc25eea959e..f411d877cd0 100644 --- a/dom/wifi/WifiCertService.cpp +++ b/dom/wifi/WifiCertService.cpp @@ -13,7 +13,7 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/Endian.h" #include "mozilla/ModuleUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/dom/File.h" #include "mozilla/dom/ToJSValue.h" #include "cert.h" @@ -465,7 +465,7 @@ WifiCertService::ImportCert(int32_t aId, nsIDOMBlob* aCertBlob, const nsAString& aCertNickname) { nsRefPtr blob = static_cast(aCertBlob); - RefPtr task = new ImportCertTask(aId, blob, aCertPassword, + nsRefPtr task = new ImportCertTask(aId, blob, aCertPassword, aCertNickname); return task->Dispatch("WifiImportCert"); } @@ -473,7 +473,7 @@ WifiCertService::ImportCert(int32_t aId, nsIDOMBlob* aCertBlob, NS_IMETHODIMP WifiCertService::DeleteCert(int32_t aId, const nsAString& aCertNickname) { - RefPtr task = new DeleteCertTask(aId, aCertNickname); + nsRefPtr task = new DeleteCertTask(aId, aCertNickname); return task->Dispatch("WifiDeleteCert"); } diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index f2433b12d8b..25728fabf31 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -22,7 +22,7 @@ // This RefPtr class isn't ideal for usage in Azure, as it doesn't allow T** // outparams using the &-operator. But it will have to do as there's no easy // solution. -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/DebugOnly.h" @@ -231,7 +231,7 @@ public: Point mEnd; /**< End of the linear gradient - NOTE: In the case of a zero length gradient it will act as the color of the last stop. */ - RefPtr mStops; /**< GradientStops object for this gradient, this + nsRefPtr mStops; /**< GradientStops object for this gradient, this should match the backend type of the draw target this pattern will be used with. */ Matrix mMatrix; /**< A matrix that transforms the pattern into @@ -271,7 +271,7 @@ public: Point mCenter2; //!< Center of the outer circle. Float mRadius1; //!< Radius of the inner (focal) circle. Float mRadius2; //!< Radius of the outer circle. - RefPtr mStops; /**< GradientStops object for this gradient, this + nsRefPtr mStops; /**< GradientStops object for this gradient, this should match the backend type of the draw target this pattern will be used with. */ Matrix mMatrix; //!< A matrix that transforms the pattern into user space @@ -300,7 +300,7 @@ public: return PatternType::SURFACE; } - RefPtr mSurface; //!< Surface to use for drawing + nsRefPtr mSurface; //!< Surface to use for drawing ExtendMode mExtendMode; /**< This determines how the image is extended outside the bounds of the image */ Filter mFilter; //!< Resampling filter for resampling the image. @@ -436,7 +436,7 @@ public: bool IsMapped() { return mIsMapped; } private: - RefPtr mSurface; + nsRefPtr mSurface; MappedSurface mMap; bool mIsMapped; }; @@ -585,7 +585,7 @@ protected: Path(); void EnsureFlattenedPath(); - RefPtr mFlattenedPath; + nsRefPtr mFlattenedPath; }; /** The PathBuilder class allows path creation. Once finish is called on the @@ -810,7 +810,7 @@ public: virtual void CopyRect(const IntRect &aSourceRect, const IntPoint &aDestination) { - RefPtr source = Snapshot(); + nsRefPtr source = Snapshot(); CopySurface(source, aSourceRect, aDestination); } @@ -1118,7 +1118,7 @@ public: struct Tile { - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; IntPoint mTileOrigin; }; diff --git a/gfx/2d/DataSourceSurface.cpp b/gfx/2d/DataSourceSurface.cpp index 75d84350642..0729c775ec9 100644 --- a/gfx/2d/DataSourceSurface.cpp +++ b/gfx/2d/DataSourceSurface.cpp @@ -12,7 +12,7 @@ namespace gfx { already_AddRefed DataSourceSurface::GetDataSurface() { - RefPtr surface = + nsRefPtr surface = (GetType() == SurfaceType::DATA) ? this : new DataSourceSurfaceWrapper(this); return surface.forget(); } diff --git a/gfx/2d/DataSourceSurfaceWrapper.h b/gfx/2d/DataSourceSurfaceWrapper.h index d1112b57c0f..185284e87fd 100644 --- a/gfx/2d/DataSourceSurfaceWrapper.h +++ b/gfx/2d/DataSourceSurfaceWrapper.h @@ -30,7 +30,7 @@ public: virtual bool IsValid() const override { return mSurface->IsValid(); } private: - RefPtr mSurface; + nsRefPtr mSurface; }; } // namespace gfx diff --git a/gfx/2d/DataSurfaceHelpers.cpp b/gfx/2d/DataSurfaceHelpers.cpp index 6776db24397..babb7cbea84 100644 --- a/gfx/2d/DataSurfaceHelpers.cpp +++ b/gfx/2d/DataSurfaceHelpers.cpp @@ -281,7 +281,7 @@ CopyRect(DataSourceSurface* aSrc, DataSourceSurface* aDest, already_AddRefed CreateDataSourceSurfaceByCloning(DataSourceSurface* aSource) { - RefPtr copy = + nsRefPtr copy = Factory::CreateDataSourceSurface(aSource->GetSize(), aSource->GetFormat(), true); if (copy) { CopyRect(aSource, copy, IntRect(IntPoint(), aSource->GetSize()), IntPoint()); diff --git a/gfx/2d/DrawCommand.h b/gfx/2d/DrawCommand.h index 135548b9c6d..2d31cd82901 100644 --- a/gfx/2d/DrawCommand.h +++ b/gfx/2d/DrawCommand.h @@ -143,7 +143,7 @@ public: } private: - RefPtr mSurface; + nsRefPtr mSurface; Rect mDest; Rect mSource; DrawSurfaceOptions mSurfOptions; @@ -167,7 +167,7 @@ public: } private: - RefPtr mFilter; + nsRefPtr mFilter; Rect mSourceRect; Point mDestPoint; DrawOptions mOptions; @@ -215,7 +215,7 @@ public: } private: - RefPtr mSurface; + nsRefPtr mSurface; IntRect mSourceRect; IntPoint mDestination; }; @@ -338,7 +338,7 @@ public: } private: - RefPtr mPath; + nsRefPtr mPath; StoredPattern mPattern; DrawOptions mOptions; }; @@ -410,7 +410,7 @@ public: } private: - RefPtr mPath; + nsRefPtr mPath; StoredPattern mPattern; StrokeOptions mStrokeOptions; DrawOptions mOptions; @@ -444,11 +444,11 @@ public: } private: - RefPtr mFont; + nsRefPtr mFont; std::vector mGlyphs; StoredPattern mPattern; DrawOptions mOptions; - RefPtr mRenderingOptions; + nsRefPtr mRenderingOptions; }; class MaskCommand : public DrawingCommand @@ -497,7 +497,7 @@ public: private: StoredPattern mSource; - RefPtr mMask; + nsRefPtr mMask; Point mOffset; DrawOptions mOptions; }; @@ -517,7 +517,7 @@ public: } private: - RefPtr mPath; + nsRefPtr mPath; }; class PushClipRectCommand : public DrawingCommand diff --git a/gfx/2d/DrawTarget.cpp b/gfx/2d/DrawTarget.cpp index d27d2794407..a957cf8dde8 100644 --- a/gfx/2d/DrawTarget.cpp +++ b/gfx/2d/DrawTarget.cpp @@ -14,7 +14,7 @@ namespace gfx { already_AddRefed DrawTarget::CreateCaptureDT(const IntSize& aSize) { - RefPtr dt = new DrawTargetCaptureImpl(); + nsRefPtr dt = new DrawTargetCaptureImpl(); if (!dt->Init(aSize, this)) { gfxWarning() << "Failed to initialize Capture DrawTarget!"; diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp index d315400107a..d1a1d81e364 100644 --- a/gfx/2d/DrawTargetCG.cpp +++ b/gfx/2d/DrawTargetCG.cpp @@ -197,7 +197,7 @@ DrawTargetCG::Snapshot() mSnapshot = new SourceSurfaceCGBitmapContext(this); } - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } @@ -206,7 +206,7 @@ DrawTargetCG::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aForma { // XXX: in thebes we use CGLayers to do this kind of thing. It probably makes sense // to add that in somehow, but at a higher level - RefPtr newTarget = new DrawTargetCG(); + nsRefPtr newTarget = new DrawTargetCG(); if (newTarget->Init(GetBackendType(), aSize, aFormat)) { return newTarget.forget(); } @@ -219,7 +219,7 @@ DrawTargetCG::CreateSourceSurfaceFromData(unsigned char *aData, int32_t aStride, SurfaceFormat aFormat) const { - RefPtr newSurf = new SourceSurfaceCG(); + nsRefPtr newSurf = new SourceSurfaceCG(); if (!newSurf->InitFromData(aData, aSize, aStride, aFormat)) { return nullptr; @@ -248,7 +248,7 @@ GetRetainedImageFromSourceSurface(SourceSurface *aSurface) default: { - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { MOZ_CRASH("unsupported source surface"); } @@ -263,7 +263,7 @@ GetRetainedImageFromSourceSurface(SourceSurface *aSurface) already_AddRefed DrawTargetCG::OptimizeSourceSurface(SourceSurface *aSurface) const { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } @@ -1718,7 +1718,7 @@ DrawTargetCG::Init(BackendType aType, mSize = aSize; if (aType == BackendType::COREGRAPHICS_ACCELERATED) { - RefPtr ioSurface = MacIOSurface::CreateIOSurface(aSize.width, aSize.height); + nsRefPtr ioSurface = MacIOSurface::CreateIOSurface(aSize.width, aSize.height); mCg = ioSurface->CreateIOSurfaceContext(); // If we don't have the symbol for 'CreateIOSurfaceContext' mCg will be null // and we will fallback to software below diff --git a/gfx/2d/DrawTargetCG.h b/gfx/2d/DrawTargetCG.h index 30e901bd6b6..e26f198e82f 100644 --- a/gfx/2d/DrawTargetCG.h +++ b/gfx/2d/DrawTargetCG.h @@ -208,7 +208,7 @@ private: */ AlignedArray mData; - RefPtr mSnapshot; + nsRefPtr mSnapshot; bool mMayContainInvalidPremultipliedData; }; diff --git a/gfx/2d/DrawTargetCairo.cpp b/gfx/2d/DrawTargetCairo.cpp index 6c39e514a54..345cc11f586 100644 --- a/gfx/2d/DrawTargetCairo.cpp +++ b/gfx/2d/DrawTargetCairo.cpp @@ -362,7 +362,7 @@ GetCairoSurfaceForSourceSurface(SourceSurface *aSurface, return nullptr; } - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { return nullptr; } @@ -679,7 +679,7 @@ already_AddRefed DrawTargetCairo::Snapshot() { if (mSnapshot) { - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } @@ -689,7 +689,7 @@ DrawTargetCairo::Snapshot() size, GfxFormatForCairoSurface(mSurface), this); - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } @@ -1415,7 +1415,7 @@ DrawTargetCairo::CreateSourceSurfaceFromData(unsigned char *aData, return nullptr; } - RefPtr source_surf = new SourceSurfaceCairo(surf, aSize, aFormat); + nsRefPtr source_surf = new SourceSurfaceCairo(surf, aSize, aFormat); cairo_surface_destroy(surf); return source_surf.forget(); @@ -1443,7 +1443,7 @@ DestroyPixmap(void *data) already_AddRefed DrawTargetCairo::OptimizeSourceSurface(SourceSurface *aSurface) const { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); #ifdef CAIRO_HAS_XLIB_SURFACE cairo_surface_type_t ctype = cairo_surface_get_type(mSurface); if (aSurface->GetType() == SurfaceType::CAIRO && @@ -1513,7 +1513,7 @@ DrawTargetCairo::OptimizeSourceSurface(SourceSurface *aSurface) const cairo_surface_set_user_data(csurf, &gDestroyPixmapKey, closure.forget(), DestroyPixmap); - RefPtr dt = new DrawTargetCairo(); + nsRefPtr dt = new DrawTargetCairo(); if (!dt->Init(csurf, size, &format)) { return surface.forget(); } @@ -1553,7 +1553,7 @@ DrawTargetCairo::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFo aSize.width, aSize.height); if (!cairo_surface_status(similar)) { - RefPtr target = new DrawTargetCairo(); + nsRefPtr target = new DrawTargetCairo(); if (target->InitAlreadyReferenced(similar, aSize)) { return target.forget(); } @@ -1612,7 +1612,7 @@ DrawTargetCairo::CreateShadowDrawTarget(const IntSize &aSize, SurfaceFormat aFor // If we don't have a blur then we can use the RGBA mask and keep all the // operations in graphics memory. if (aSigma == 0.0F) { - RefPtr target = new DrawTargetCairo(); + nsRefPtr target = new DrawTargetCairo(); if (target->InitAlreadyReferenced(similar, aSize)) { return target.forget(); } else { @@ -1638,7 +1638,7 @@ DrawTargetCairo::CreateShadowDrawTarget(const IntSize &aSize, SurfaceFormat aFor cairo_tee_surface_add(tee, similar); cairo_surface_destroy(similar); - RefPtr target = new DrawTargetCairo(); + nsRefPtr target = new DrawTargetCairo(); if (target->InitAlreadyReferenced(tee, aSize)) { return target.forget(); } diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h index f6a5dc60054..17298842a2b 100644 --- a/gfx/2d/DrawTargetCairo.h +++ b/gfx/2d/DrawTargetCairo.h @@ -214,7 +214,7 @@ private: // data // The latest snapshot of this surface. This needs to be told when this // target is modified. We keep it alive as a cache. - RefPtr mSnapshot; + nsRefPtr mSnapshot; static cairo_surface_t *mDummySurface; }; diff --git a/gfx/2d/DrawTargetCapture.cpp b/gfx/2d/DrawTargetCapture.cpp index f3dd4d0923e..607167f3214 100644 --- a/gfx/2d/DrawTargetCapture.cpp +++ b/gfx/2d/DrawTargetCapture.cpp @@ -38,7 +38,7 @@ DrawTargetCaptureImpl::Init(const IntSize& aSize, DrawTarget* aRefDT) already_AddRefed DrawTargetCaptureImpl::Snapshot() { - RefPtr dt = mRefDT->CreateSimilarDrawTarget(mSize, mRefDT->GetFormat()); + nsRefPtr dt = mRefDT->CreateSimilarDrawTarget(mSize, mRefDT->GetFormat()); ReplayToDrawTarget(dt, Matrix()); diff --git a/gfx/2d/DrawTargetCapture.h b/gfx/2d/DrawTargetCapture.h index 0e33ff5a6bf..7d2b65e9a61 100644 --- a/gfx/2d/DrawTargetCapture.h +++ b/gfx/2d/DrawTargetCapture.h @@ -150,7 +150,7 @@ private: *(uint32_t*)(nextDrawLocation) = sizeof(T) + sizeof(uint32_t); return reinterpret_cast(nextDrawLocation + sizeof(uint32_t)); } - RefPtr mRefDT; + nsRefPtr mRefDT; IntSize mSize; diff --git a/gfx/2d/DrawTargetD2D.cpp b/gfx/2d/DrawTargetD2D.cpp index ec1cfe27845..0b87dd5ff34 100644 --- a/gfx/2d/DrawTargetD2D.cpp +++ b/gfx/2d/DrawTargetD2D.cpp @@ -63,7 +63,7 @@ public: mDT->Flush(); - RefPtr tmpTexture; + nsRefPtr tmpTexture; IntSize size = mDT->mSize; SurfaceFormat format = mDT->mFormat; @@ -71,7 +71,7 @@ public: 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture)); + HRESULT hr = mDT->mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(tmpTexture)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(size))) << "[D2D] 1 CreateTexture2D failure " << size << " Code: " << hexa(hr) << " format " << (int)format; return; @@ -80,12 +80,12 @@ public: D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(format)); - RefPtr surf; + nsRefPtr surf; - tmpTexture->QueryInterface((IDXGISurface**)byRef(surf)); + tmpTexture->QueryInterface((IDXGISurface**)getter_AddRefs(surf)); hr = mDT->mRT->CreateSharedBitmap(IID_IDXGISurface, surf, - &props, byRef(mOldSurfBitmap)); + &props, getter_AddRefs(mOldSurfBitmap)); if (FAILED(hr)) { gfxCriticalError() << "[D2D] CreateSharedBitmap failure " << size << " Code: " << hexa(hr); @@ -98,12 +98,12 @@ public: if (!clipBounds.IsEqualEdges(IntRect(IntPoint(0, 0), mDT->mSize))) { // We still need to take into account clipBounds if it contains additional // clipping information. - RefPtr rectGeom; + nsRefPtr rectGeom; factory()->CreateRectangleGeometry(D2D1::Rect(Float(clipBounds.x), Float(clipBounds.y), Float(clipBounds.XMost()), Float(clipBounds.YMost())), - byRef(rectGeom)); + getter_AddRefs(rectGeom)); mClippedArea = IntersectGeometry(mClippedArea, rectGeom); } @@ -124,21 +124,21 @@ public: rt->SetTransform(D2D1::IdentityMatrix()); mDT->mTransformDirty = true; - RefPtr rectGeom; + nsRefPtr rectGeom; factory()->CreateRectangleGeometry( D2D1::RectF(0, 0, float(mDT->mSize.width), float(mDT->mSize.height)), - byRef(rectGeom)); + getter_AddRefs(rectGeom)); - RefPtr invClippedArea; - factory()->CreatePathGeometry(byRef(invClippedArea)); - RefPtr sink; - invClippedArea->Open(byRef(sink)); + nsRefPtr invClippedArea; + factory()->CreatePathGeometry(getter_AddRefs(invClippedArea)); + nsRefPtr sink; + invClippedArea->Open(getter_AddRefs(sink)); rectGeom->CombineWithGeometry(mClippedArea, D2D1_COMBINE_MODE_EXCLUDE, nullptr, sink); sink->Close(); - RefPtr brush; - HRESULT hr = rt->CreateBitmapBrush(mOldSurfBitmap, D2D1::BitmapBrushProperties(), D2D1::BrushProperties(), byRef(brush)); + nsRefPtr brush; + HRESULT hr = rt->CreateBitmapBrush(mOldSurfBitmap, D2D1::BitmapBrushProperties(), D2D1::BrushProperties(), getter_AddRefs(brush)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(false)) << "[D2D] CreateBitmapBrush failure " << hexa(hr); return; @@ -153,9 +153,9 @@ private: // If we have an operator unbound by the source, this will contain a bitmap // with the old dest surface data. - RefPtr mOldSurfBitmap; + nsRefPtr mOldSurfBitmap; // This contains the area drawing is clipped to. - RefPtr mClippedArea; + nsRefPtr mClippedArea; }; ID2D1Factory *D2DFactory() @@ -189,7 +189,7 @@ DrawTargetD2D::~DrawTargetD2D() // We may hold the only reference. MarkIndependent will clear mSnapshot; // keep the snapshot object alive so it doesn't get destroyed while // MarkIndependent is running. - RefPtr deathGrip = mSnapshot; + nsRefPtr deathGrip = mSnapshot; // mSnapshot can be treated as independent of this DrawTarget since we know // this DrawTarget won't change again. deathGrip->MarkIndependent(); @@ -227,7 +227,7 @@ DrawTargetD2D::Snapshot() Flush(); } - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } @@ -263,7 +263,7 @@ already_AddRefed DrawTargetD2D::GetBitmapForSurface(SourceSurface *aSurface, Rect &aSource) { - RefPtr bitmap; + nsRefPtr bitmap; switch (aSurface->GetType()) { @@ -282,7 +282,7 @@ DrawTargetD2D::GetBitmapForSurface(SourceSurface *aSurface, break; default: { - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxDebug() << "Not able to deal with non-data source surface."; @@ -319,7 +319,7 @@ DrawTargetD2D::GetBitmapForSurface(SourceSurface *aSurface, D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(srcSurf->GetFormat())); - hr = mRT->CreateBitmap(D2D1::SizeU(UINT32(sourceRect.width), UINT32(sourceRect.height)), data, stride, props, byRef(bitmap)); + hr = mRT->CreateBitmap(D2D1::SizeU(UINT32(sourceRect.width), UINT32(sourceRect.height)), data, stride, props, getter_AddRefs(bitmap)); } if (FAILED(hr)) { IntSize size(sourceRect.width, sourceRect.height); @@ -340,7 +340,7 @@ DrawTargetD2D::GetBitmapForSurface(SourceSurface *aSurface, already_AddRefed DrawTargetD2D::GetImageForSurface(SourceSurface *aSurface) { - RefPtr image; + nsRefPtr image; Rect r(Point(), Size(aSurface->GetSize())); image = GetBitmapForSurface(aSurface, r); @@ -355,7 +355,7 @@ DrawTargetD2D::DrawSurface(SourceSurface *aSurface, const DrawSurfaceOptions &aSurfOptions, const DrawOptions &aOptions) { - RefPtr bitmap; + nsRefPtr bitmap; ID2D1RenderTarget *rt = GetRTForOperation(aOptions.mCompositionOp, ColorPattern(Color())); @@ -381,10 +381,10 @@ DrawTargetD2D::DrawFilter(FilterNode *aNode, const Point &aDestPoint, const DrawOptions &aOptions) { - RefPtr dc; + nsRefPtr dc; HRESULT hr; - hr = mRT->QueryInterface((ID2D1DeviceContext**)byRef(dc)); + hr = mRT->QueryInterface((ID2D1DeviceContext**)getter_AddRefs(dc)); if (SUCCEEDED(hr) && aNode->GetBackendType() == FILTER_BACKEND_DIRECT2D1_1) { ID2D1RenderTarget *rt = GetRTForOperation(aOptions.mCompositionOp, ColorPattern(Color())); @@ -392,7 +392,7 @@ DrawTargetD2D::DrawFilter(FilterNode *aNode, PrepareForDrawing(rt); rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - hr = rt->QueryInterface((ID2D1DeviceContext**)byRef(dc)); + hr = rt->QueryInterface((ID2D1DeviceContext**)getter_AddRefs(dc)); if (SUCCEEDED(hr)) { FilterNodeD2D1* node = static_cast(aNode); @@ -422,7 +422,7 @@ DrawTargetD2D::MaskSurface(const Pattern &aSource, Point aOffset, const DrawOptions &aOptions) { - RefPtr bitmap; + nsRefPtr bitmap; ID2D1RenderTarget *rt = GetRTForOperation(aOptions.mCompositionOp, ColorPattern(Color())); @@ -439,7 +439,7 @@ DrawTargetD2D::MaskSurface(const Pattern &aSource, } Rect dest = Rect(aOffset.x, aOffset.y, size.width, size.height); - RefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); rt->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS, D2DRect(dest), D2DRect(maskRect)); FinalizeRTForOperation(aOptions.mCompositionOp, ColorPattern(Color()), dest); @@ -453,7 +453,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, Float aSigma, CompositionOp aOperator) { - RefPtr srView = nullptr; + nsRefPtr srView = nullptr; if (aSurface->GetType() != SurfaceType::D2D1_DRAWTARGET) { return; } @@ -477,7 +477,7 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, if (!mTempRTView) { // This view is only needed in this path. - HRESULT hr = mDevice->CreateRenderTargetView(mTempTexture, nullptr, byRef(mTempRTView)); + HRESULT hr = mDevice->CreateRenderTargetView(mTempTexture, nullptr, getter_AddRefs(mTempRTView)); if (FAILED(hr)) { gfxWarning() << "Failure to create RenderTargetView. Code: " << hexa(hr); @@ -486,17 +486,17 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, } - RefPtr destRTView = mRTView; - RefPtr destTexture; + nsRefPtr destRTView = mRTView; + nsRefPtr destTexture; HRESULT hr; - RefPtr maskTexture; - RefPtr maskSRView; + nsRefPtr maskTexture; + nsRefPtr maskSRView; IntRect clipBounds; if (mPushedClips.size()) { EnsureClipMaskTexture(&clipBounds); - mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, byRef(maskSRView)); + mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, getter_AddRefs(maskSRView)); } IntSize srcSurfSize; @@ -537,8 +537,8 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; desc.MiscFlags = D3D10_RESOURCE_MISC_GENERATE_MIPS; - RefPtr mipTexture; - hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mipTexture)); + nsRefPtr mipTexture; + hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(mipTexture)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSurface->GetSize()))) << "[D2D] 2 CreateTexture2D failure " << aSurface->GetSize() << " Code: " << hexa(hr); @@ -564,8 +564,8 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, dsSize.width, dsSize.height, 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - RefPtr tmpDSTexture; - hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpDSTexture)); + nsRefPtr tmpDSTexture; + hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(tmpDSTexture)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(dsSize))) << "[D2D] 3 CreateTexture2D failure " << dsSize << " Code: " << hexa(hr); @@ -579,13 +579,13 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, box.bottom = aSurface->GetSize().height; mDevice->CopySubresourceRegion(mipTexture, 0, 0, 0, 0, static_cast(aSurface)->mTexture, 0, &box); - mDevice->CreateShaderResourceView(mipTexture, nullptr, byRef(srView)); + mDevice->CreateShaderResourceView(mipTexture, nullptr, getter_AddRefs(srView)); mDevice->GenerateMips(srView); - RefPtr dsRTView; - RefPtr dsSRView; - mDevice->CreateRenderTargetView(tmpDSTexture, nullptr, byRef(dsRTView)); - mDevice->CreateShaderResourceView(tmpDSTexture, nullptr, byRef(dsSRView)); + nsRefPtr dsRTView; + nsRefPtr dsSRView; + mDevice->CreateRenderTargetView(tmpDSTexture, nullptr, getter_AddRefs(dsRTView)); + mDevice->CreateShaderResourceView(tmpDSTexture, nullptr, getter_AddRefs(dsSRView)); // We're not guaranteed the texture we created will be empty, we've // seen old content at least on NVidia drivers. @@ -656,9 +656,9 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, bool needBiggerTemp = srcSurfSize.width > mSize.width || srcSurfSize.height > mSize.height; - RefPtr tmpRTView; - RefPtr tmpSRView; - RefPtr tmpTexture; + nsRefPtr tmpRTView; + nsRefPtr tmpSRView; + nsRefPtr tmpTexture; IntSize tmpSurfSize = mSize; @@ -676,9 +676,9 @@ DrawTargetD2D::DrawSurfaceWithShadow(SourceSurface *aSurface, 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture)); - mDevice->CreateRenderTargetView(tmpTexture, nullptr, byRef(tmpRTView)); - mDevice->CreateShaderResourceView(tmpTexture, nullptr, byRef(tmpSRView)); + mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(tmpTexture)); + mDevice->CreateRenderTargetView(tmpTexture, nullptr, getter_AddRefs(tmpRTView)); + mDevice->CreateShaderResourceView(tmpTexture, nullptr, getter_AddRefs(tmpSRView)); tmpSurfSize = srcSurfSize; } @@ -842,15 +842,15 @@ DrawTargetD2D::CopySurface(SourceSurface *aSurface, mRT->Clear(D2D1::ColorF(0, 0.0f)); mRT->PopAxisAlignedClip(); - RefPtr bitmap = GetBitmapForSurface(aSurface, srcRect); + nsRefPtr bitmap = GetBitmapForSurface(aSurface, srcRect); if (!bitmap) { return; } if (aSurface->GetFormat() == SurfaceFormat::A8) { - RefPtr brush; + nsRefPtr brush; mRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), - D2D1::BrushProperties(), byRef(brush)); + D2D1::BrushProperties(), getter_AddRefs(brush)); mRT->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); mRT->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS); } else { @@ -871,7 +871,7 @@ DrawTargetD2D::FillRect(const Rect &aRect, rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); if (brush) { rt->FillRectangle(D2DRect(aRect), brush); @@ -892,9 +892,9 @@ DrawTargetD2D::StrokeRect(const Rect &aRect, rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); if (brush && strokeStyle) { rt->DrawRectangle(D2DRect(aRect), brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -916,9 +916,9 @@ DrawTargetD2D::StrokeLine(const Point &aStart, rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); if (brush && strokeStyle) { rt->DrawLine(D2DPoint(aStart), D2DPoint(aEnd), brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -946,9 +946,9 @@ DrawTargetD2D::Stroke(const Path *aPath, rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); if (brush && strokeStyle) { rt->DrawGeometry(d2dPath->mGeometry, brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -975,7 +975,7 @@ DrawTargetD2D::Fill(const Path *aPath, rt->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); if (brush) { rt->FillGeometry(d2dPath->mGeometry, brush); @@ -1065,7 +1065,7 @@ DrawTargetD2D::FillGlyphs(ScaledFont *aFont, } } - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); AutoDWriteGlyphRun autoRun; DWriteGlyphRunFromGlyphs(aBuffer, font, &autoRun); @@ -1086,10 +1086,10 @@ DrawTargetD2D::Mask(const Pattern &aSource, PrepareForDrawing(rt); - RefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); - RefPtr maskBrush = CreateBrushForPattern(aMask, 1.0f); + nsRefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); + nsRefPtr maskBrush = CreateBrushForPattern(aMask, 1.0f); - RefPtr layer; + nsRefPtr layer; layer = GetCachedLayer(); @@ -1120,7 +1120,7 @@ DrawTargetD2D::PushClip(const Path *aPath) mCurrentClipMaskTexture = nullptr; mCurrentClippedGeometry = nullptr; - RefPtr pathD2D = static_cast(const_cast(aPath)); + nsRefPtr pathD2D = static_cast(const_cast(aPath)); PushedClip clip; clip.mTransform = D2DMatrix(mTransform); @@ -1152,13 +1152,13 @@ DrawTargetD2D::PushClipRect(const Rect &aRect) // with this transform the way we want it to. // See remarks: http://msdn.microsoft.com/en-us/library/dd316860%28VS.85%29.aspx - RefPtr pathBuilder = CreatePathBuilder(); + nsRefPtr pathBuilder = CreatePathBuilder(); pathBuilder->MoveTo(aRect.TopLeft()); pathBuilder->LineTo(aRect.TopRight()); pathBuilder->LineTo(aRect.BottomRight()); pathBuilder->LineTo(aRect.BottomLeft()); pathBuilder->Close(); - RefPtr path = pathBuilder->Finish(); + nsRefPtr path = pathBuilder->Finish(); return PushClip(path); } @@ -1201,7 +1201,7 @@ DrawTargetD2D::CreateSourceSurfaceFromData(unsigned char *aData, int32_t aStride, SurfaceFormat aFormat) const { - RefPtr newSurf = new SourceSurfaceD2D(); + nsRefPtr newSurf = new SourceSurfaceD2D(); if (!newSurf->InitFromData(aData, aSize, aStride, aFormat, mRT)) { return nullptr; @@ -1215,18 +1215,18 @@ DrawTargetD2D::OptimizeSourceSurface(SourceSurface *aSurface) const { if (aSurface->GetType() == SurfaceType::D2D1_BITMAP || aSurface->GetType() == SurfaceType::D2D1_DRAWTARGET) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); DataSourceSurface::MappedSurface map; if (!data->Map(DataSourceSurface::MapType::READ, &map)) { return nullptr; } - RefPtr newSurf = new SourceSurfaceD2D(); + nsRefPtr newSurf = new SourceSurfaceD2D(); bool success = newSurf->InitFromData(map.mData, data->GetSize(), map.mStride, data->GetFormat(), mRT); data->Unmap(); @@ -1244,7 +1244,7 @@ DrawTargetD2D::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurfac gfxDebug() << *this << ": Failure to create source surface from non-D3D10 texture native surface."; return nullptr; } - RefPtr newSurf = new SourceSurfaceD2D(); + nsRefPtr newSurf = new SourceSurfaceD2D(); if (!newSurf->InitFromTexture(static_cast(aSurface.mSurface), aSurface.mFormat, @@ -1260,7 +1260,7 @@ DrawTargetD2D::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurfac already_AddRefed DrawTargetD2D::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const { - RefPtr newTarget = + nsRefPtr newTarget = new DrawTargetD2D(); if (!newTarget->Init(aSize, aFormat)) { @@ -1274,16 +1274,16 @@ DrawTargetD2D::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aForm already_AddRefed DrawTargetD2D::CreatePathBuilder(FillRule aFillRule) const { - RefPtr path; - HRESULT hr = factory()->CreatePathGeometry(byRef(path)); + nsRefPtr path; + HRESULT hr = factory()->CreatePathGeometry(getter_AddRefs(path)); if (FAILED(hr)) { gfxWarning() << "Failed to create Direct2D Path Geometry. Code: " << hexa(hr); return nullptr; } - RefPtr sink; - hr = path->Open(byRef(sink)); + nsRefPtr sink; + hr = path->Open(getter_AddRefs(sink)); if (FAILED(hr)) { gfxWarning() << "Failed to access Direct2D Path Geometry. Code: " << hexa(hr); return nullptr; @@ -1306,12 +1306,12 @@ DrawTargetD2D::CreateGradientStops(GradientStop *rawStops, uint32_t aNumStops, E stops[i].color = D2DColor(rawStops[i].color); } - RefPtr stopCollection; + nsRefPtr stopCollection; HRESULT hr = mRT->CreateGradientStopCollection(stops, aNumStops, D2D1_GAMMA_2_2, D2DExtend(aExtendMode), - byRef(stopCollection)); + getter_AddRefs(stopCollection)); delete [] stops; if (FAILED(hr)) { @@ -1325,8 +1325,8 @@ DrawTargetD2D::CreateGradientStops(GradientStop *rawStops, uint32_t aNumStops, E already_AddRefed DrawTargetD2D::CreateFilter(FilterType aType) { - RefPtr dc; - HRESULT hr = mRT->QueryInterface((ID2D1DeviceContext**)byRef(dc)); + nsRefPtr dc; + HRESULT hr = mRT->QueryInterface((ID2D1DeviceContext**)getter_AddRefs(dc)); if (SUCCEEDED(hr)) { return FilterNodeD2D1::Create(dc, aType); @@ -1367,7 +1367,7 @@ DrawTargetD2D::Init(const IntSize &aSize, SurfaceFormat aFormat) 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mTexture)); + hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize))) << "Failed to init Direct2D DrawTarget. Size: " << mSize << " Code: " << hexa(hr); @@ -1395,10 +1395,10 @@ DrawTargetD2D::Init(ID3D10Texture2D *aTexture, SurfaceFormat aFormat) return false; } - RefPtr device; - mTexture->GetDevice(byRef(device)); + nsRefPtr device; + mTexture->GetDevice(getter_AddRefs(device)); - hr = device->QueryInterface((ID3D10Device1**)byRef(mDevice)); + hr = device->QueryInterface((ID3D10Device1**)getter_AddRefs(mDevice)); if (FAILED(hr)) { gfxCriticalError() << "Failed to get D3D10 device from texture." << " format " << (int)aFormat; @@ -1437,7 +1437,7 @@ DrawTargetD2D::InitD3D10Data() createD3DEffect = (decltype(D3D10CreateEffectFromMemory)*) GetProcAddress(d3dModule, "D3D10CreateEffectFromMemory"); - hr = createD3DEffect((void*)d2deffect, sizeof(d2deffect), 0, mDevice, nullptr, byRef(mPrivateData->mEffect)); + hr = createD3DEffect((void*)d2deffect, sizeof(d2deffect), 0, mDevice, nullptr, getter_AddRefs(mPrivateData->mEffect)); if (FAILED(hr)) { gfxWarning() << "Failed to initialize Direct2D required effects. Code: " << hexa(hr); @@ -1459,7 +1459,7 @@ DrawTargetD2D::InitD3D10Data() sizeof(layout) / sizeof(D3D10_INPUT_ELEMENT_DESC), passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, - byRef(mPrivateData->mInputLayout)); + getter_AddRefs(mPrivateData->mInputLayout)); if (FAILED(hr)) { gfxWarning() << "Failed to initialize Direct2D required InputLayout. Code: " << hexa(hr); @@ -1471,7 +1471,7 @@ DrawTargetD2D::InitD3D10Data() data.pSysMem = vertices; CD3D10_BUFFER_DESC bufferDesc(sizeof(vertices), D3D10_BIND_VERTEX_BUFFER); - hr = mDevice->CreateBuffer(&bufferDesc, &data, byRef(mPrivateData->mVB)); + hr = mDevice->CreateBuffer(&bufferDesc, &data, getter_AddRefs(mPrivateData->mVB)); if (FAILED(hr)) { gfxWarning() << "Failed to initialize Direct2D required VertexBuffer. Code: " << hexa(hr); @@ -1493,16 +1493,16 @@ DrawTargetD2D::GetByteSize() const already_AddRefed DrawTargetD2D::GetCachedLayer() { - RefPtr layer; + nsRefPtr layer; if (mCurrentCachedLayer < 5) { if (!mCachedLayers[mCurrentCachedLayer]) { - mRT->CreateLayer(byRef(mCachedLayers[mCurrentCachedLayer])); + mRT->CreateLayer(getter_AddRefs(mCachedLayers[mCurrentCachedLayer])); mVRAMUsageDT += GetByteSize(); } layer = mCachedLayers[mCurrentCachedLayer]; } else { - mRT->CreateLayer(byRef(layer)); + mRT->CreateLayer(getter_AddRefs(layer)); } mCurrentCachedLayer++; @@ -1652,7 +1652,7 @@ DrawTargetD2D::GetBlendStateForOperator(CompositionOp aOperator) desc.DestBlend = desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; } - mDevice->CreateBlendState(&desc, byRef(mPrivateData->mBlendStates[operatorIndex])); + mDevice->CreateBlendState(&desc, getter_AddRefs(mPrivateData->mBlendStates[operatorIndex])); return mPrivateData->mBlendStates[operatorIndex]; } @@ -1751,8 +1751,8 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP viewport.TopLeftX = 0; viewport.TopLeftY = 0; - RefPtr tmpTexture; - RefPtr mBckSRView; + nsRefPtr tmpTexture; + nsRefPtr mBckSRView; mDevice->RSSetViewports(1, &viewport); mPrivateData->mEffect->GetVariableByName("QuadDesc")->AsVector()-> @@ -1771,7 +1771,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP CD3D10_TEXTURE2D_DESC desc(DXGIFormat(format), size.width, size.height, 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(tmpTexture)); + HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(tmpTexture)); if (FAILED(hr)) { gfxWarning() << "Failed to create temporary texture to hold surface data."; return; @@ -1785,7 +1785,7 @@ DrawTargetD2D::FinalizeRTForOperation(CompositionOp aOperator, const Pattern &aP DrawTargetD2D::Flush(); - hr = mDevice->CreateShaderResourceView(tmpTexture, nullptr, byRef(mBckSRView)); + hr = mDevice->CreateShaderResourceView(tmpTexture, nullptr, getter_AddRefs(mBckSRView)); if (FAILED(hr)) { gfxWarning() << *this << "Failed to create shader resource view for temp texture. Code: " << hexa(hr); @@ -1876,14 +1876,14 @@ DrawTargetD2D::GetClippedGeometry(IntRect *aClipBounds) { if (mCurrentClippedGeometry) { *aClipBounds = mCurrentClipBounds; - RefPtr clippedGeometry(mCurrentClippedGeometry); + nsRefPtr clippedGeometry(mCurrentClippedGeometry); return clippedGeometry.forget(); } mCurrentClipBounds = IntRect(IntPoint(0, 0), mSize); // if pathGeom is null then pathRect represents the path. - RefPtr pathGeom; + nsRefPtr pathGeom; D2D1_RECT_F pathRect; bool pathRectIsAxisAligned = false; std::vector::iterator iter = mPushedClips.begin(); @@ -1927,17 +1927,17 @@ DrawTargetD2D::GetClippedGeometry(IntRect *aClipBounds) } } - RefPtr newGeom; - factory()->CreatePathGeometry(byRef(newGeom)); + nsRefPtr newGeom; + factory()->CreatePathGeometry(getter_AddRefs(newGeom)); - RefPtr currentSink; - newGeom->Open(byRef(currentSink)); + nsRefPtr currentSink; + newGeom->Open(getter_AddRefs(currentSink)); if (iter->mPath) { pathGeom->CombineWithGeometry(iter->mPath->GetGeometry(), D2D1_COMBINE_MODE_INTERSECT, iter->mTransform, currentSink); } else { - RefPtr rectGeom = ConvertRectToGeometry(iter->mBounds); + nsRefPtr rectGeom = ConvertRectToGeometry(iter->mBounds); pathGeom->CombineWithGeometry(rectGeom, D2D1_COMBINE_MODE_INTERSECT, D2D1::IdentityMatrix(), currentSink); } @@ -1956,7 +1956,7 @@ DrawTargetD2D::GetClippedGeometry(IntRect *aClipBounds) } mCurrentClippedGeometry = pathGeom.forget(); *aClipBounds = mCurrentClipBounds; - RefPtr clippedGeometry(mCurrentClippedGeometry); + nsRefPtr clippedGeometry(mCurrentClippedGeometry); return clippedGeometry.forget(); } @@ -1965,10 +1965,10 @@ DrawTargetD2D::CreateRTForTexture(ID3D10Texture2D *aTexture, SurfaceFormat aForm { HRESULT hr; - RefPtr surface; - RefPtr rt; + nsRefPtr surface; + nsRefPtr rt; - hr = aTexture->QueryInterface((IDXGISurface**)byRef(surface)); + hr = aTexture->QueryInterface((IDXGISurface**)getter_AddRefs(surface)); if (FAILED(hr)) { gfxCriticalError() << "Failed to QI texture to surface. Code: " << hexa(hr); @@ -1986,7 +1986,7 @@ DrawTargetD2D::CreateRTForTexture(ID3D10Texture2D *aTexture, SurfaceFormat aForm D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(desc.Format, alphaMode)); - hr = factory()->CreateDxgiSurfaceRenderTarget(surface, props, byRef(rt)); + hr = factory()->CreateDxgiSurfaceRenderTarget(surface, props, getter_AddRefs(rt)); if (FAILED(hr)) { gfxCriticalError() << "Failed to create D2D render target for texture. Code: " @@ -2012,7 +2012,7 @@ DrawTargetD2D::EnsureViews() 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mTempTexture)); + hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTempTexture)); if (FAILED(hr)) { gfxWarning() << *this << "Failed to create temporary texture for rendertarget. Size: " @@ -2020,14 +2020,14 @@ DrawTargetD2D::EnsureViews() return; } - hr = mDevice->CreateShaderResourceView(mTempTexture, nullptr, byRef(mSRView)); + hr = mDevice->CreateShaderResourceView(mTempTexture, nullptr, getter_AddRefs(mSRView)); if (FAILED(hr)) { gfxWarning() << *this << "Failed to create shader resource view for temp texture. Code: " << hexa(hr); return; } - hr = mDevice->CreateRenderTargetView(mTexture, nullptr, byRef(mRTView)); + hr = mDevice->CreateRenderTargetView(mTexture, nullptr, getter_AddRefs(mRTView)); if (FAILED(hr)) { gfxWarning() << *this << "Failed to create rendertarget view for temp texture. Code: " << hexa(hr); @@ -2077,7 +2077,7 @@ DrawTargetD2D::EnsureClipMaskTexture(IntRect *aBounds) return; } - RefPtr geometry = GetClippedGeometry(aBounds); + nsRefPtr geometry = GetClippedGeometry(aBounds); CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_A8_UNORM, mSize.width, @@ -2085,22 +2085,22 @@ DrawTargetD2D::EnsureClipMaskTexture(IntRect *aBounds) 1, 1); desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(mCurrentClipMaskTexture)); + HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(mCurrentClipMaskTexture)); if (FAILED(hr)) { gfxWarning() << "Failed to create texture for ClipMask!"; return; } - RefPtr rt = CreateRTForTexture(mCurrentClipMaskTexture, SurfaceFormat::A8); + nsRefPtr rt = CreateRTForTexture(mCurrentClipMaskTexture, SurfaceFormat::A8); if (!rt) { gfxWarning() << "Failed to create RT for ClipMask!"; return; } - RefPtr brush; - rt->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), byRef(brush)); + nsRefPtr brush; + rt->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), getter_AddRefs(brush)); rt->BeginDraw(); rt->Clear(D2D1::ColorF(0, 0)); @@ -2117,12 +2117,12 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, { HRESULT hr; - RefPtr params; + nsRefPtr params; if (aParams) { params = aParams; } else { - mRT->GetTextRenderingParams(byRef(params)); + mRT->GetTextRenderingParams(getter_AddRefs(params)); } DWRITE_RENDERING_MODE renderMode = DWRITE_RENDERING_MODE_DEFAULT; @@ -2170,9 +2170,9 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, AutoDWriteGlyphRun autoRun; DWriteGlyphRunFromGlyphs(aBuffer, aFont, &autoRun); - RefPtr analysis; + nsRefPtr analysis; hr = GetDWriteFactory()->CreateGlyphRunAnalysis(&autoRun, 1.0f, &mat, - renderMode, measureMode, 0, 0, byRef(analysis)); + renderMode, measureMode, 0, 0, getter_AddRefs(analysis)); if (FAILED(hr)) { return false; @@ -2196,14 +2196,14 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, return true; } - RefPtr tex = CreateTextureForAnalysis(analysis, rectBounds); + nsRefPtr tex = CreateTextureForAnalysis(analysis, rectBounds); if (!tex) { return false; } - RefPtr srView; - hr = mDevice->CreateShaderResourceView(tex, nullptr, byRef(srView)); + nsRefPtr srView; + hr = mDevice->CreateShaderResourceView(tex, nullptr, getter_AddRefs(srView)); if (FAILED(hr)) { return false; @@ -2239,14 +2239,14 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, if (!mPushedClips.empty()) { clipBounds = &clipBoundsStorage; - RefPtr geom = GetClippedGeometry(clipBounds); + nsRefPtr geom = GetClippedGeometry(clipBounds); - RefPtr rectGeom; + nsRefPtr rectGeom; factory()->CreateRectangleGeometry(D2D1::RectF(Float(rectBounds.x), Float(rectBounds.y), Float(rectBounds.width + rectBounds.x), Float(rectBounds.height + rectBounds.y)), - byRef(rectGeom)); + getter_AddRefs(rectGeom)); D2D1_GEOMETRY_RELATION relation; if (FAILED(geom->CompareWithGeometry(rectGeom, D2D1::IdentityMatrix(), &relation)) || @@ -2259,8 +2259,8 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, clipBounds = &clipBoundsStorage; EnsureClipMaskTexture(clipBounds); - RefPtr srViewMask; - hr = mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, byRef(srViewMask)); + nsRefPtr srViewMask; + hr = mDevice->CreateShaderResourceView(mCurrentClipMaskTexture, nullptr, getter_AddRefs(srViewMask)); if (FAILED(hr)) { return false; @@ -2277,9 +2277,9 @@ DrawTargetD2D::FillGlyphsManual(ScaledFontDWrite *aFont, technique->GetPassByIndex(0)->Apply(0); } - RefPtr rtView; + nsRefPtr rtView; ID3D10RenderTargetView *rtViews; - mDevice->CreateRenderTargetView(mTexture, nullptr, byRef(rtView)); + mDevice->CreateRenderTargetView(mTexture, nullptr, getter_AddRefs(rtView)); rtViews = rtView; mDevice->OMSetRenderTargets(1, &rtViews, nullptr); @@ -2292,22 +2292,22 @@ already_AddRefed DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) { if (!IsPatternSupportedByD2D(aPattern)) { - RefPtr colBrush; - mRT->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 1.0f, 1.0f), byRef(colBrush)); + nsRefPtr colBrush; + mRT->CreateSolidColorBrush(D2D1::ColorF(1.0f, 1.0f, 1.0f, 1.0f), getter_AddRefs(colBrush)); return colBrush.forget(); } if (aPattern.GetType() == PatternType::COLOR) { - RefPtr colBrush; + nsRefPtr colBrush; Color color = static_cast(&aPattern)->mColor; mRT->CreateSolidColorBrush(D2D1::ColorF(color.r, color.g, color.b, color.a), D2D1::BrushProperties(aAlpha), - byRef(colBrush)); + getter_AddRefs(colBrush)); return colBrush.forget(); } if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) { - RefPtr gradBrush; + nsRefPtr gradBrush; const LinearGradientPattern *pat = static_cast(&aPattern); @@ -2319,13 +2319,13 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) } if (pat->mBegin == pat->mEnd) { - RefPtr colBrush; + nsRefPtr colBrush; uint32_t stopCount = stops->mStopCollection->GetGradientStopCount(); vector d2dStops(stopCount); stops->mStopCollection->GetGradientStops(&d2dStops.front(), stopCount); mRT->CreateSolidColorBrush(d2dStops.back().color, D2D1::BrushProperties(aAlpha), - byRef(colBrush)); + getter_AddRefs(colBrush)); return colBrush.forget(); } @@ -2333,11 +2333,11 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) D2DPoint(pat->mEnd)), D2D1::BrushProperties(aAlpha, D2DMatrix(pat->mMatrix)), stops->mStopCollection, - byRef(gradBrush)); + getter_AddRefs(gradBrush)); return gradBrush.forget(); } if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) { - RefPtr gradBrush; + nsRefPtr gradBrush; const RadialGradientPattern *pat = static_cast(&aPattern); @@ -2355,12 +2355,12 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) pat->mRadius2, pat->mRadius2), D2D1::BrushProperties(aAlpha, D2DMatrix(pat->mMatrix)), stops->mStopCollection, - byRef(gradBrush)); + getter_AddRefs(gradBrush)); return gradBrush.forget(); } if (aPattern.GetType() == PatternType::SURFACE) { - RefPtr bmBrush; + nsRefPtr bmBrush; const SurfacePattern *pat = static_cast(&aPattern); @@ -2369,18 +2369,18 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) return nullptr; } - RefPtr bitmap; + nsRefPtr bitmap; Matrix mat = pat->mMatrix; - RefPtr source = pat->mSurface; + nsRefPtr source = pat->mSurface; if (!pat->mSamplingRect.IsEmpty() && (source->GetType() == SurfaceType::D2D1_BITMAP || source->GetType() == SurfaceType::D2D1_DRAWTARGET)) { IntRect samplingRect = pat->mSamplingRect; - RefPtr dt = new DrawTargetD2D(); + nsRefPtr dt = new DrawTargetD2D(); if (!dt->Init(samplingRect.Size(), source->GetFormat())) { // FIXME: Uncomment assertion, bug 1068195 @@ -2416,7 +2416,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) break; default: { - RefPtr dataSurf = source->GetDataSurface(); + nsRefPtr dataSurf = source->GetDataSurface(); if (!dataSurf) { gfxWarning() << "Invalid surface type."; return nullptr; @@ -2429,8 +2429,8 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) bitmap = CreatePartialBitmapForSurface(dataSurf, mTransform, mSize, pat->mExtendMode, mat, mRT, &sourceRect); if (!bitmap) { - RefPtr colBrush; - mRT->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(colBrush)); + nsRefPtr colBrush; + mRT->CreateSolidColorBrush(D2D1::ColorF(0, 0), getter_AddRefs(colBrush)); return colBrush.forget(); } } @@ -2442,7 +2442,7 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) D2DExtend(pat->mExtendMode), D2DFilter(pat->mFilter)), D2D1::BrushProperties(aAlpha, D2DMatrix(mat)), - byRef(bmBrush)); + getter_AddRefs(bmBrush)); if (FAILED(hr)) { gfxCriticalError() << "[D2D] 1CreateBitmapBrush failure: " << hexa(hr); return nullptr; @@ -2520,8 +2520,8 @@ DrawTargetD2D::CreateGradientTexture(const GradientStopsD2D *aStops) data.pSysMem = &textureData.front(); data.SysMemPitch = 4096 * 4; - RefPtr tex; - mDevice->CreateTexture2D(&desc, &data, byRef(tex)); + nsRefPtr tex; + mDevice->CreateTexture2D(&desc, &data, getter_AddRefs(tex)); return tex.forget(); } @@ -2578,8 +2578,8 @@ DrawTargetD2D::CreateTextureForAnalysis(IDWriteGlyphRunAnalysis *aAnalysis, cons data.SysMemPitch = aBounds.width * 4; data.pSysMem = alignedTextureData; - RefPtr tex; - hr = mDevice->CreateTexture2D(&desc, &data, byRef(tex)); + nsRefPtr tex; + hr = mDevice->CreateTexture2D(&desc, &data, getter_AddRefs(tex)); delete [] alignedTextureData; delete [] texture; @@ -2605,10 +2605,10 @@ DrawTargetD2D::SetupEffectForRadialGradient(const RadialGradientPattern *aPatter const GradientStopsD2D *stops = static_cast(aPattern->mStops.get()); - RefPtr tex = CreateGradientTexture(stops); + nsRefPtr tex = CreateGradientTexture(stops); - RefPtr srView; - mDevice->CreateShaderResourceView(tex, nullptr, byRef(srView)); + nsRefPtr srView; + mDevice->CreateShaderResourceView(tex, nullptr, getter_AddRefs(srView)); mPrivateData->mEffect->GetVariableByName("tex")->AsShaderResource()->SetResource(srView); @@ -2722,8 +2722,8 @@ DrawTargetD2D::factory() gfxWarning() << "Failed to create Direct2D factory."; } - RefPtr factoryD2D1; - hr = mFactory->QueryInterface((ID2D1Factory1**)byRef(factoryD2D1)); + nsRefPtr factoryD2D1; + hr = mFactory->QueryInterface((ID2D1Factory1**)getter_AddRefs(factoryD2D1)); if (SUCCEEDED(hr)) { ExtendInputEffectD2D1::Register(factoryD2D1); } @@ -2735,8 +2735,8 @@ void DrawTargetD2D::CleanupD2D() { if (mFactory) { - RefPtr factoryD2D1; - HRESULT hr = mFactory->QueryInterface((ID2D1Factory1**)byRef(factoryD2D1)); + nsRefPtr factoryD2D1; + HRESULT hr = mFactory->QueryInterface((ID2D1Factory1**)getter_AddRefs(factoryD2D1)); if (SUCCEEDED(hr)) { ExtendInputEffectD2D1::Unregister(factoryD2D1); } @@ -2801,8 +2801,8 @@ DrawTargetD2D::PushD2DLayer(ID2D1RenderTarget *aRT, ID2D1Geometry *aGeometry, ID options1 = D2D1_LAYER_OPTIONS1_IGNORE_ALPHA | D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND; } - RefPtr dc; - HRESULT hr = aRT->QueryInterface(IID_ID2D1DeviceContext, (void**)((ID2D1DeviceContext**)byRef(dc))); + nsRefPtr dc; + HRESULT hr = aRT->QueryInterface(IID_ID2D1DeviceContext, (void**)((ID2D1DeviceContext**)getter_AddRefs(dc))); if (FAILED(hr)) { aRT->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), aGeometry, diff --git a/gfx/2d/DrawTargetD2D.h b/gfx/2d/DrawTargetD2D.h index eae24d73f4d..1dfc69a0d93 100644 --- a/gfx/2d/DrawTargetD2D.h +++ b/gfx/2d/DrawTargetD2D.h @@ -30,10 +30,10 @@ const int32_t kLayerCacheSize = 5; struct PrivateD3D10DataD2D { - RefPtr mEffect; - RefPtr mInputLayout; - RefPtr mVB; - RefPtr mBlendStates[size_t(CompositionOp::OP_COUNT)]; + nsRefPtr mEffect; + nsRefPtr mInputLayout; + nsRefPtr mVB; + nsRefPtr mBlendStates[size_t(CompositionOp::OP_COUNT)]; }; class DrawTargetD2D : public DrawTarget @@ -227,30 +227,30 @@ private: IntSize mSize; - RefPtr mDevice; - RefPtr mTexture; - RefPtr mCurrentClipMaskTexture; - RefPtr mCurrentClippedGeometry; + nsRefPtr mDevice; + nsRefPtr mTexture; + nsRefPtr mCurrentClipMaskTexture; + nsRefPtr mCurrentClippedGeometry; // This is only valid if mCurrentClippedGeometry is non-null. And will // only be the intersection of all pixel-aligned retangular clips. This is in // device space. IntRect mCurrentClipBounds; - mutable RefPtr mRT; + mutable nsRefPtr mRT; // We store this to prevent excessive SetTextRenderingParams calls. - RefPtr mTextRenderingParams; + nsRefPtr mTextRenderingParams; // Temporary texture and render target used for supporting alternative operators. - RefPtr mTempTexture; - RefPtr mRTView; - RefPtr mSRView; - RefPtr mTempRT; - RefPtr mTempRTView; + nsRefPtr mTempTexture; + nsRefPtr mRTView; + nsRefPtr mSRView; + nsRefPtr mTempRT; + nsRefPtr mTempRTView; // List of pushed clips. struct PushedClip { - RefPtr mLayer; + nsRefPtr mLayer; D2D1_RECT_F mBounds; union { // If mPath is non-nullptr, the mTransform member will be used, otherwise @@ -258,7 +258,7 @@ private: D2D1_MATRIX_3X2_F mTransform; bool mIsPixelAligned; }; - RefPtr mPath; + nsRefPtr mPath; }; std::vector mPushedClips; @@ -266,12 +266,12 @@ private: // serve as the temporary surfaces for these operations. As texture creation // is quite expensive this considerably improved performance. // Careful here, RAII will not ensure destruction of the RefPtrs. - RefPtr mCachedLayers[kLayerCacheSize]; + nsRefPtr mCachedLayers[kLayerCacheSize]; uint32_t mCurrentCachedLayer; // The latest snapshot of this surface. This needs to be told when this // target is modified. We keep it alive as a cache. - RefPtr mSnapshot; + nsRefPtr mSnapshot; // A list of targets we need to flush when we're modified. TargetSet mDependentTargets; // A list of targets which have this object in their mDependentTargets set diff --git a/gfx/2d/DrawTargetD2D1.cpp b/gfx/2d/DrawTargetD2D1.cpp index 4b327dda8eb..05f9f5fdecd 100644 --- a/gfx/2d/DrawTargetD2D1.cpp +++ b/gfx/2d/DrawTargetD2D1.cpp @@ -43,7 +43,7 @@ DrawTargetD2D1::~DrawTargetD2D1() // We may hold the only reference. MarkIndependent will clear mSnapshot; // keep the snapshot object alive so it doesn't get destroyed while // MarkIndependent is running. - RefPtr deathGrip = mSnapshot; + nsRefPtr deathGrip = mSnapshot; // mSnapshot can be treated as independent of this DrawTarget since we know // this DrawTarget won't change again. deathGrip->MarkIndependent(); @@ -74,7 +74,7 @@ already_AddRefed DrawTargetD2D1::Snapshot() { if (mSnapshot) { - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } PopAllClips(); @@ -83,7 +83,7 @@ DrawTargetD2D1::Snapshot() mSnapshot = new SourceSurfaceD2D1(mBitmap, mDC, mFormat, mSize, this); - RefPtr snapshot(mSnapshot); + nsRefPtr snapshot(mSnapshot); return snapshot.forget(); } @@ -120,7 +120,7 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface, Float xScale = aDest.width / aSource.width; Float yScale = aDest.height / aSource.height; - RefPtr brush; + nsRefPtr brush; // Here we scale the source pattern up to the size and position where we want // it to be. @@ -128,18 +128,18 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface, transform.PreTranslate(aDest.x - aSource.x * xScale, aDest.y - aSource.y * yScale); transform.PreScale(xScale, yScale); - RefPtr image = GetImageForSurface(aSurface, transform, ExtendMode::CLAMP); + nsRefPtr image = GetImageForSurface(aSurface, transform, ExtendMode::CLAMP); if (!image) { gfxWarning() << *this << ": Unable to get D2D image for surface."; return; } - RefPtr bitmap; + nsRefPtr bitmap; if (aSurface->GetType() == SurfaceType::D2D1_1_IMAGE) { // If this is called with a DataSourceSurface it might do a partial upload // that our DrawBitmap call doesn't support. - image->QueryInterface((ID2D1Bitmap**)byRef(bitmap)); + image->QueryInterface((ID2D1Bitmap**)getter_AddRefs(bitmap)); } if (bitmap && aSurfOptions.mSamplingBounds == SamplingBounds::UNBOUNDED) { @@ -153,7 +153,7 @@ DrawTargetD2D1::DrawSurface(SourceSurface *aSurface, D2D1_EXTEND_MODE_CLAMP, D2DInterpolationMode(aSurfOptions.mFilter)), D2D1::BrushProperties(aOptions.mAlpha, D2DMatrix(transform)), - byRef(brush)); + getter_AddRefs(brush)); mDC->FillRectangle(D2DRect(aDest), brush); } @@ -196,7 +196,7 @@ DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface, mTransformDirty = true; Matrix mat; - RefPtr image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP); + nsRefPtr image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP); if (!image) { gfxWarning() << "Couldn't get image for surface."; @@ -209,8 +209,8 @@ DrawTargetD2D1::DrawSurfaceWithShadow(SourceSurface *aSurface, } // Step 1, create the shadow effect. - RefPtr shadowEffect; - HRESULT hr = mDC->CreateEffect(CLSID_D2D1Shadow, byRef(shadowEffect)); + nsRefPtr shadowEffect; + HRESULT hr = mDC->CreateEffect(CLSID_D2D1Shadow, getter_AddRefs(shadowEffect)); if (FAILED(hr) || !shadowEffect) { gfxWarning() << "Failed to create shadow effect. Code: " << hexa(hr); return; @@ -258,10 +258,10 @@ DrawTargetD2D1::ClearRect(const Rect &aRect) mDC->Clear(); IntRect addClipRect; - RefPtr geom = GetClippedGeometry(&addClipRect); + nsRefPtr geom = GetClippedGeometry(&addClipRect); - RefPtr brush; - mDC->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), byRef(brush)); + nsRefPtr brush; + mDC->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), getter_AddRefs(brush)); mDC->PushAxisAlignedClip(D2D1::RectF(addClipRect.x, addClipRect.y, addClipRect.XMost(), addClipRect.YMost()), D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); mDC->FillGeometry(geom, brush); mDC->PopAxisAlignedClip(); @@ -282,9 +282,9 @@ DrawTargetD2D1::MaskSurface(const Pattern &aSource, { MarkChanged(); - RefPtr bitmap; + nsRefPtr bitmap; - RefPtr image = GetImageForSurface(aMask, ExtendMode::CLAMP); + nsRefPtr image = GetImageForSurface(aMask, ExtendMode::CLAMP); if (!image) { gfxWarning() << "Failed to get image for surface."; @@ -305,7 +305,7 @@ DrawTargetD2D1::MaskSurface(const Pattern &aSource, } Rect dest = Rect(aOffset.x, aOffset.y, Float(size.width), Float(size.height)); - RefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aSource, aOptions.mAlpha); mDC->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS, D2DRect(dest), D2DRect(maskRect)); mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); @@ -326,7 +326,7 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface, mTransformDirty = true; Matrix mat; - RefPtr image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP); + nsRefPtr image = GetImageForSurface(aSurface, mat, ExtendMode::CLAMP); if (!image) { gfxWarning() << "Couldn't get image for surface."; @@ -338,13 +338,13 @@ DrawTargetD2D1::CopySurface(SourceSurface *aSurface, return; } - RefPtr bitmap; - image->QueryInterface((ID2D1Bitmap**)byRef(bitmap)); + nsRefPtr bitmap; + image->QueryInterface((ID2D1Bitmap**)getter_AddRefs(bitmap)); if (bitmap && mFormat == SurfaceFormat::A8) { - RefPtr brush; + nsRefPtr brush; mDC->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), - D2D1::BrushProperties(), byRef(brush)); + D2D1::BrushProperties(), getter_AddRefs(brush)); mDC->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY); mDC->FillOpacityMask(bitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS); @@ -382,7 +382,7 @@ DrawTargetD2D1::FillRect(const Rect &aRect, mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); mDC->FillRectangle(D2DRect(aRect), brush); FinalizeDrawing(aOptions.mCompositionOp, aPattern); @@ -398,8 +398,8 @@ DrawTargetD2D1::StrokeRect(const Rect &aRect, mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); mDC->DrawRectangle(D2DRect(aRect), brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -417,8 +417,8 @@ DrawTargetD2D1::StrokeLine(const Point &aStart, mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); mDC->DrawLine(D2DPoint(aStart), D2DPoint(aEnd), brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -441,8 +441,8 @@ DrawTargetD2D1::Stroke(const Path *aPath, mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); mDC->DrawGeometry(d2dPath->mGeometry, brush, aStrokeOptions.mLineWidth, strokeStyle); @@ -464,7 +464,7 @@ DrawTargetD2D1::Fill(const Path *aPath, mDC->SetAntialiasMode(D2DAAMode(aOptions.mAntialiasMode)); - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); mDC->FillGeometry(d2dPath->mGeometry, brush); @@ -539,7 +539,7 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont, mTextRenderingParams = params; } - RefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); + nsRefPtr brush = CreateBrushForPattern(aPattern, aOptions.mAlpha); AutoDWriteGlyphRun autoRun; DWriteGlyphRunFromGlyphs(aBuffer, font, &autoRun); @@ -573,10 +573,10 @@ DrawTargetD2D1::FillGlyphs(ScaledFont *aFont, mDC->GetGlyphRunWorldBounds(D2D1::Point2F(), &autoRun, DWRITE_MEASURING_MODE_NATURAL, &userRect); - RefPtr path; - D2DFactory()->CreatePathGeometry(byRef(path)); - RefPtr sink; - path->Open(byRef(sink)); + nsRefPtr path; + D2DFactory()->CreatePathGeometry(getter_AddRefs(path)); + nsRefPtr sink; + path->Open(getter_AddRefs(sink)); sink->BeginFigure(D2D1::Point2F(userRect.left, userRect.top), D2D1_FIGURE_BEGIN_FILLED); sink->AddLine(D2D1::Point2F(userRect.right, userRect.top)); sink->AddLine(D2D1::Point2F(userRect.right, userRect.bottom)); @@ -617,8 +617,8 @@ DrawTargetD2D1::Mask(const Pattern &aSource, { PrepareForDrawing(aOptions.mCompositionOp, aSource); - RefPtr source = CreateBrushForPattern(aSource, aOptions.mAlpha); - RefPtr mask = CreateBrushForPattern(aMask, 1.0f); + nsRefPtr source = CreateBrushForPattern(aSource, aOptions.mAlpha); + nsRefPtr mask = CreateBrushForPattern(aMask, 1.0f); mDC->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE, D2D1::IdentityMatrix(), @@ -646,7 +646,7 @@ DrawTargetD2D1::PushClip(const Path *aPath) mCurrentClippedGeometry = nullptr; - RefPtr pathD2D = static_cast(const_cast(aPath)); + nsRefPtr pathD2D = static_cast(const_cast(aPath)); PushedClip clip; clip.mTransform = D2DMatrix(mTransform); @@ -674,13 +674,13 @@ DrawTargetD2D1::PushClipRect(const Rect &aRect) // with this transform the way we want it to. // See remarks: http://msdn.microsoft.com/en-us/library/dd316860%28VS.85%29.aspx - RefPtr pathBuilder = CreatePathBuilder(); + nsRefPtr pathBuilder = CreatePathBuilder(); pathBuilder->MoveTo(aRect.TopLeft()); pathBuilder->LineTo(aRect.TopRight()); pathBuilder->LineTo(aRect.BottomRight()); pathBuilder->LineTo(aRect.BottomLeft()); pathBuilder->Close(); - RefPtr path = pathBuilder->Finish(); + nsRefPtr path = pathBuilder->Finish(); return PushClip(path); } @@ -725,11 +725,11 @@ DrawTargetD2D1::CreateSourceSurfaceFromData(unsigned char *aData, int32_t aStride, SurfaceFormat aFormat) const { - RefPtr bitmap; + nsRefPtr bitmap; HRESULT hr = mDC->CreateBitmap(D2DIntSize(aSize), aData, aStride, D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, D2DPixelFormat(aFormat)), - byRef(bitmap)); + getter_AddRefs(bitmap)); if (FAILED(hr) || !bitmap) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize))) << "[D2D1.1] 1CreateBitmap failure " << aSize << " Code: " << hexa(hr) << " format " << (int)aFormat; @@ -742,7 +742,7 @@ DrawTargetD2D1::CreateSourceSurfaceFromData(unsigned char *aData, already_AddRefed DrawTargetD2D1::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const { - RefPtr dt = new DrawTargetD2D1(); + nsRefPtr dt = new DrawTargetD2D1(); if (!dt->Init(aSize, aFormat)) { return nullptr; @@ -754,16 +754,16 @@ DrawTargetD2D1::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFor already_AddRefed DrawTargetD2D1::CreatePathBuilder(FillRule aFillRule) const { - RefPtr path; - HRESULT hr = factory()->CreatePathGeometry(byRef(path)); + nsRefPtr path; + HRESULT hr = factory()->CreatePathGeometry(getter_AddRefs(path)); if (FAILED(hr)) { gfxWarning() << *this << ": Failed to create Direct2D Path Geometry. Code: " << hexa(hr); return nullptr; } - RefPtr sink; - hr = path->Open(byRef(sink)); + nsRefPtr sink; + hr = path->Open(getter_AddRefs(sink)); if (FAILED(hr)) { gfxWarning() << *this << ": Failed to access Direct2D Path Geometry. Code: " << hexa(hr); return nullptr; @@ -791,12 +791,12 @@ DrawTargetD2D1::CreateGradientStops(GradientStop *rawStops, uint32_t aNumStops, stops[i].color = D2DColor(rawStops[i].color); } - RefPtr stopCollection; + nsRefPtr stopCollection; HRESULT hr = mDC->CreateGradientStopCollection(stops, aNumStops, D2D1_GAMMA_2_2, D2DExtend(aExtendMode), - byRef(stopCollection)); + getter_AddRefs(stopCollection)); delete [] stops; if (FAILED(hr)) { @@ -823,16 +823,16 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat) return false; } - hr = device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, byRef(mDC)); + hr = device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, getter_AddRefs(mDC)); if (FAILED(hr)) { gfxCriticalError() <<"[D2D1.1] 1Failed to create a DeviceContext, code: " << hexa(hr) << " format " << (int)aFormat; return false; } - RefPtr dxgiSurface; + nsRefPtr dxgiSurface; aTexture->QueryInterface(__uuidof(IDXGISurface), - (void**)((IDXGISurface**)byRef(dxgiSurface))); + (void**)((IDXGISurface**)getter_AddRefs(dxgiSurface))); if (!dxgiSurface) { gfxCriticalError() <<"[D2D1.1] Failed to obtain a DXGI surface."; return false; @@ -844,7 +844,7 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat) props.pixelFormat = D2DPixelFormat(aFormat); props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; - hr = mDC->CreateBitmapFromDxgiSurface(dxgiSurface, props, (ID2D1Bitmap1**)byRef(mBitmap)); + hr = mDC->CreateBitmapFromDxgiSurface(dxgiSurface, props, (ID2D1Bitmap1**)getter_AddRefs(mBitmap)); if (FAILED(hr)) { gfxCriticalError() << "[D2D1.1] CreateBitmapFromDxgiSurface failure Code: " << hexa(hr) << " format " << (int)aFormat; @@ -860,7 +860,7 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat) props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; - hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap)); + hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(mTempBitmap)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(mSize))) << "[D2D1.1] 2CreateBitmap failure " << mSize << " Code: " << hexa(hr); @@ -871,7 +871,7 @@ DrawTargetD2D1::Init(ID3D11Texture2D* aTexture, SurfaceFormat aFormat) // issueing multiple drawing commands simultaneously to a single drawtarget // from multiple threads is unexpected since there's no way to guarantee // ordering in that situation anyway. - hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(mSolidColorBrush)); + hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), getter_AddRefs(mSolidColorBrush)); if (FAILED(hr)) { gfxCriticalError() << "[D2D1.1] Failure creating solid color brush."; @@ -895,7 +895,7 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat) return false; } - hr = device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, byRef(mDC)); + hr = device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS, getter_AddRefs(mDC)); if (FAILED(hr)) { gfxCriticalError() <<"[D2D1.1] 2Failed to create a DeviceContext, code: " << hexa(hr) << " format " << (int)aFormat; @@ -915,7 +915,7 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat) props.pixelFormat = D2DPixelFormat(aFormat); props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; - hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mBitmap)); + hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(mBitmap)); if (FAILED(hr)) { gfxCriticalError() << "[D2D1.1] 3CreateBitmap failure " << aSize << " Code: " << hexa(hr) << " format " << (int)aFormat; @@ -925,7 +925,7 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat) props.pixelFormat.alphaMode = D2D1_ALPHA_MODE_PREMULTIPLIED; props.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; - hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mTempBitmap)); + hr = mDC->CreateBitmap(D2DIntSize(aSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(mTempBitmap)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize))) << "[D2D1.1] failed to create new TempBitmap " << aSize << " Code: " << hexa(hr); @@ -934,7 +934,7 @@ DrawTargetD2D1::Init(const IntSize &aSize, SurfaceFormat aFormat) mDC->SetTarget(mBitmap); - hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), byRef(mSolidColorBrush)); + hr = mDC->CreateSolidColorBrush(D2D1::ColorF(0, 0), getter_AddRefs(mSolidColorBrush)); if (FAILED(hr)) { gfxCriticalError() << "[D2D1.1] Failure creating solid color brush."; @@ -1058,8 +1058,8 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) PopAllClips(); - RefPtr image; - mDC->GetTarget(byRef(image)); + nsRefPtr image; + mDC->GetTarget(getter_AddRefs(image)); mDC->SetTarget(mBitmap); @@ -1070,12 +1070,12 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) if (D2DSupportsCompositeMode(aOp)) { D2D1_RECT_F rect; bool isAligned; - RefPtr tmpBitmap; + nsRefPtr tmpBitmap; bool clipIsComplex = mPushedClips.size() && !GetDeviceSpaceClipRect(rect, isAligned); if (clipIsComplex) { if (!IsOperatorBoundByMask(aOp)) { - HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), byRef(tmpBitmap)); + HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), getter_AddRefs(tmpBitmap)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(mSize))) << "[D2D1.1] 6CreateBitmap failure " << mSize << " Code: " << hexa(hr) << " format " << (int)mFormat; // For now, crash in this scenario; this should happen because tmpBitmap is @@ -1092,9 +1092,9 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) mDC->DrawImage(image, D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR, D2DCompositionMode(aOp)); if (tmpBitmap) { - RefPtr brush; - RefPtr inverseGeom = GetInverseClippedGeometry(); - mDC->CreateBitmapBrush(tmpBitmap, byRef(brush)); + nsRefPtr brush; + nsRefPtr inverseGeom = GetInverseClippedGeometry(); + mDC->CreateBitmapBrush(tmpBitmap, getter_AddRefs(brush)); mDC->SetPrimitiveBlend(D2D1_PRIMITIVE_BLEND_COPY); mDC->FillGeometry(inverseGeom, brush); @@ -1104,7 +1104,7 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) } if (!mBlendEffect) { - HRESULT hr = mDC->CreateEffect(CLSID_D2D1Blend, byRef(mBlendEffect)); + HRESULT hr = mDC->CreateEffect(CLSID_D2D1Blend, getter_AddRefs(mBlendEffect)); if (FAILED(hr) || !mBlendEffect) { gfxWarning() << "Failed to create blend effect!"; @@ -1112,8 +1112,8 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) } } - RefPtr tmpBitmap; - HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), byRef(tmpBitmap)); + nsRefPtr tmpBitmap; + HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), getter_AddRefs(tmpBitmap)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(mSize))) << "[D2D1.1] 5CreateBitmap failure " << mSize << " Code: " << hexa(hr) << " format " << (int)mFormat; return; @@ -1145,9 +1145,9 @@ DrawTargetD2D1::FinalizeDrawing(CompositionOp aOp, const Pattern &aPattern) PushAllClips(); - RefPtr radialGradientEffect; + nsRefPtr radialGradientEffect; - HRESULT hr = mDC->CreateEffect(CLSID_RadialGradientEffect, byRef(radialGradientEffect)); + HRESULT hr = mDC->CreateEffect(CLSID_RadialGradientEffect, getter_AddRefs(radialGradientEffect)); if (FAILED(hr) || !radialGradientEffect) { gfxWarning() << "Failed to create radial gradient effect. Code: " << hexa(hr); return; @@ -1215,7 +1215,7 @@ DrawTargetD2D1::GetClippedGeometry(IntRect *aClipBounds) { if (mCurrentClippedGeometry) { *aClipBounds = mCurrentClipBounds; - RefPtr clippedGeometry(mCurrentClippedGeometry); + nsRefPtr clippedGeometry(mCurrentClippedGeometry); return clippedGeometry.forget(); } @@ -1224,7 +1224,7 @@ DrawTargetD2D1::GetClippedGeometry(IntRect *aClipBounds) mCurrentClipBounds = IntRect(IntPoint(0, 0), mSize); // if pathGeom is null then pathRect represents the path. - RefPtr pathGeom; + nsRefPtr pathGeom; D2D1_RECT_F pathRect; bool pathRectIsAxisAligned = false; auto iter = mPushedClips.begin(); @@ -1268,17 +1268,17 @@ DrawTargetD2D1::GetClippedGeometry(IntRect *aClipBounds) } } - RefPtr newGeom; - factory()->CreatePathGeometry(byRef(newGeom)); + nsRefPtr newGeom; + factory()->CreatePathGeometry(getter_AddRefs(newGeom)); - RefPtr currentSink; - newGeom->Open(byRef(currentSink)); + nsRefPtr currentSink; + newGeom->Open(getter_AddRefs(currentSink)); if (iter->mPath) { pathGeom->CombineWithGeometry(iter->mPath->GetGeometry(), D2D1_COMBINE_MODE_INTERSECT, iter->mTransform, currentSink); } else { - RefPtr rectGeom = ConvertRectToGeometry(iter->mBounds); + nsRefPtr rectGeom = ConvertRectToGeometry(iter->mBounds); pathGeom->CombineWithGeometry(rectGeom, D2D1_COMBINE_MODE_INTERSECT, D2D1::IdentityMatrix(), currentSink); } @@ -1297,7 +1297,7 @@ DrawTargetD2D1::GetClippedGeometry(IntRect *aClipBounds) } mCurrentClippedGeometry = pathGeom.forget(); *aClipBounds = mCurrentClipBounds; - RefPtr clippedGeometry(mCurrentClippedGeometry); + nsRefPtr clippedGeometry(mCurrentClippedGeometry); return clippedGeometry.forget(); } @@ -1305,14 +1305,14 @@ already_AddRefed DrawTargetD2D1::GetInverseClippedGeometry() { IntRect bounds; - RefPtr geom = GetClippedGeometry(&bounds); - RefPtr rectGeom; - RefPtr inverseGeom; + nsRefPtr geom = GetClippedGeometry(&bounds); + nsRefPtr rectGeom; + nsRefPtr inverseGeom; - factory()->CreateRectangleGeometry(D2D1::RectF(0, 0, mSize.width, mSize.height), byRef(rectGeom)); - factory()->CreatePathGeometry(byRef(inverseGeom)); - RefPtr sink; - inverseGeom->Open(byRef(sink)); + factory()->CreateRectangleGeometry(D2D1::RectF(0, 0, mSize.width, mSize.height), getter_AddRefs(rectGeom)); + factory()->CreatePathGeometry(getter_AddRefs(inverseGeom)); + nsRefPtr sink; + inverseGeom->Open(getter_AddRefs(sink)); rectGeom->CombineWithGeometry(geom, D2D1_COMBINE_MODE_EXCLUDE, D2D1::IdentityMatrix(), sink); sink->Close(); @@ -1376,7 +1376,7 @@ DrawTargetD2D1::CreateTransparentBlackBrush() already_AddRefed DrawTargetD2D1::GetSolidColorBrush(const D2D_COLOR_F& aColor) { - RefPtr brush = mSolidColorBrush; + nsRefPtr brush = mSolidColorBrush; brush->SetColor(aColor); return brush.forget(); } @@ -1393,7 +1393,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) return GetSolidColorBrush(D2D1::ColorF(color.r, color.g, color.b, color.a * aAlpha)); } if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) { - RefPtr gradBrush; + nsRefPtr gradBrush; const LinearGradientPattern *pat = static_cast(&aPattern); @@ -1416,7 +1416,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) D2DPoint(pat->mEnd)), D2D1::BrushProperties(aAlpha, D2DMatrix(pat->mMatrix)), stops->mStopCollection, - byRef(gradBrush)); + getter_AddRefs(gradBrush)); if (!gradBrush) { gfxWarning() << "Couldn't create gradient brush."; @@ -1426,7 +1426,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) return gradBrush.forget(); } if (aPattern.GetType() == PatternType::RADIAL_GRADIENT) { - RefPtr gradBrush; + nsRefPtr gradBrush; const RadialGradientPattern *pat = static_cast(&aPattern); @@ -1444,7 +1444,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) pat->mRadius2, pat->mRadius2), D2D1::BrushProperties(aAlpha, D2DMatrix(pat->mMatrix)), stops->mStopCollection, - byRef(gradBrush)); + getter_AddRefs(gradBrush)); if (!gradBrush) { gfxWarning() << "Couldn't create gradient brush."; @@ -1467,7 +1467,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) MOZ_ASSERT(pat->mSurface->IsValid()); - RefPtr image = GetImageForSurface(pat->mSurface, mat, pat->mExtendMode, !pat->mSamplingRect.IsEmpty() ? &pat->mSamplingRect : nullptr); + nsRefPtr image = GetImageForSurface(pat->mSurface, mat, pat->mExtendMode, !pat->mSamplingRect.IsEmpty() ? &pat->mSamplingRect : nullptr); if (!image) { return CreateTransparentBlackBrush(); @@ -1475,16 +1475,16 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) bool useSamplingRect = false; if (pat->mSamplingRect.IsEmpty()) { - RefPtr bitmap; - image->QueryInterface((ID2D1Bitmap**)byRef(bitmap)); + nsRefPtr bitmap; + image->QueryInterface((ID2D1Bitmap**)getter_AddRefs(bitmap)); if (bitmap) { - RefPtr bitmapBrush; + nsRefPtr bitmapBrush; mDC->CreateBitmapBrush(bitmap, D2D1::BitmapBrushProperties(D2DExtend(pat->mExtendMode), D2DExtend(pat->mExtendMode), D2DFilter(pat->mFilter)), D2D1::BrushProperties(aAlpha, D2DMatrix(mat)), - byRef(bitmapBrush)); + getter_AddRefs(bitmapBrush)); if (!bitmapBrush) { gfxWarning() << "Couldn't create bitmap brush!"; return CreateTransparentBlackBrush(); @@ -1493,7 +1493,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) } } - RefPtr imageBrush; + nsRefPtr imageBrush; if (pat->mSamplingRect.IsEmpty()) { samplingBounds = D2D1::RectF(0, 0, Float(pat->mSurface->GetSize().width), @@ -1511,7 +1511,7 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) D2DExtend(pat->mExtendMode), D2DInterpolationMode(pat->mFilter)), D2D1::BrushProperties(aAlpha, D2DMatrix(mat)), - byRef(imageBrush)); + getter_AddRefs(imageBrush)); if (!imageBrush) { gfxWarning() << "Couldn't create image brush!"; @@ -1529,7 +1529,7 @@ already_AddRefed DrawTargetD2D1::GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTransform, ExtendMode aExtendMode, const IntRect* aSourceRect) { - RefPtr image; + nsRefPtr image; switch (aSurface->GetType()) { case SurfaceType::D2D1_1_IMAGE: @@ -1541,7 +1541,7 @@ DrawTargetD2D1::GetImageForSurface(SourceSurface *aSurface, Matrix &aSourceTrans break; default: { - RefPtr dataSurf = aSurface->GetDataSurface(); + nsRefPtr dataSurf = aSurface->GetDataSurface(); if (!dataSurf) { gfxWarning() << "Invalid surface type."; return nullptr; @@ -1559,13 +1559,13 @@ already_AddRefed DrawTargetD2D1::OptimizeSourceSurface(SourceSurface* aSurface) const { if (aSurface->GetType() == SurfaceType::D2D1_1_IMAGE) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } - RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); - RefPtr bitmap; + nsRefPtr bitmap; { DataSourceSurface::ScopedMap map(data, DataSourceSurface::READ); if (MOZ2D_WARN_IF(!map.IsMapped())) { @@ -1574,7 +1574,7 @@ DrawTargetD2D1::OptimizeSourceSurface(SourceSurface* aSurface) const HRESULT hr = mDC->CreateBitmap(D2DIntSize(data->GetSize()), map.GetData(), map.GetStride(), D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_NONE, D2DPixelFormat(data->GetFormat())), - byRef(bitmap)); + getter_AddRefs(bitmap)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(data->GetSize()))) << "[D2D1.1] 4CreateBitmap failure " << data->GetSize() << " Code: " << hexa(hr) << " format " << (int)data->GetFormat(); diff --git a/gfx/2d/DrawTargetD2D1.h b/gfx/2d/DrawTargetD2D1.h index f0793c8e02d..43bbf8414ef 100644 --- a/gfx/2d/DrawTargetD2D1.h +++ b/gfx/2d/DrawTargetD2D1.h @@ -191,22 +191,22 @@ private: IntSize mSize; - RefPtr mDevice; - RefPtr mTexture; - RefPtr mCurrentClippedGeometry; + nsRefPtr mDevice; + nsRefPtr mTexture; + nsRefPtr mCurrentClippedGeometry; // This is only valid if mCurrentClippedGeometry is non-null. And will // only be the intersection of all pixel-aligned retangular clips. This is in // device space. IntRect mCurrentClipBounds; - mutable RefPtr mDC; - RefPtr mBitmap; - RefPtr mTempBitmap; - RefPtr mBlendEffect; + mutable nsRefPtr mDC; + nsRefPtr mBitmap; + nsRefPtr mTempBitmap; + nsRefPtr mBlendEffect; - RefPtr mSolidColorBrush; + nsRefPtr mSolidColorBrush; // We store this to prevent excessive SetTextRenderingParams calls. - RefPtr mTextRenderingParams; + nsRefPtr mTextRenderingParams; // List of pushed clips. struct PushedClip @@ -218,13 +218,13 @@ private: D2D1_MATRIX_3X2_F mTransform; bool mIsPixelAligned; }; - RefPtr mPath; + nsRefPtr mPath; }; std::vector mPushedClips; // The latest snapshot of this surface. This needs to be told when this // target is modified. We keep it alive as a cache. - RefPtr mSnapshot; + nsRefPtr mSnapshot; // A list of targets we need to flush when we're modified. TargetSet mDependentTargets; // A list of targets which have this object in their mDependentTargets set diff --git a/gfx/2d/DrawTargetDual.cpp b/gfx/2d/DrawTargetDual.cpp index bdc27897eb8..dbddc7d7359 100644 --- a/gfx/2d/DrawTargetDual.cpp +++ b/gfx/2d/DrawTargetDual.cpp @@ -184,8 +184,8 @@ DrawTargetDual::Mask(const Pattern &aSource, const Pattern &aMask, const DrawOpt already_AddRefed DrawTargetDual::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const { - RefPtr dtA = mA->CreateSimilarDrawTarget(aSize, aFormat); - RefPtr dtB = mB->CreateSimilarDrawTarget(aSize, aFormat); + nsRefPtr dtA = mA->CreateSimilarDrawTarget(aSize, aFormat); + nsRefPtr dtB = mB->CreateSimilarDrawTarget(aSize, aFormat); if (!dtA || !dtB) { gfxWarning() << "Failure to allocate a similar DrawTargetDual. Size: " << aSize; diff --git a/gfx/2d/DrawTargetDual.h b/gfx/2d/DrawTargetDual.h index bcc06be26e3..57b13f9ad40 100644 --- a/gfx/2d/DrawTargetDual.h +++ b/gfx/2d/DrawTargetDual.h @@ -157,8 +157,8 @@ public: } private: - RefPtr mA; - RefPtr mB; + nsRefPtr mA; + nsRefPtr mB; }; } // namespace gfx diff --git a/gfx/2d/DrawTargetRecording.cpp b/gfx/2d/DrawTargetRecording.cpp index f05c49fb7c4..a39e38dd4e9 100644 --- a/gfx/2d/DrawTargetRecording.cpp +++ b/gfx/2d/DrawTargetRecording.cpp @@ -33,8 +33,8 @@ public: virtual SurfaceFormat GetFormat() const { return mFinalSurface->GetFormat(); } virtual already_AddRefed GetDataSurface() { return mFinalSurface->GetDataSurface(); } - RefPtr mFinalSurface; - RefPtr mRecorder; + nsRefPtr mFinalSurface; + nsRefPtr mRecorder; }; class GradientStopsRecording : public GradientStops @@ -53,8 +53,8 @@ public: virtual BackendType GetBackendType() const { return BackendType::RECORDING; } - RefPtr mFinalGradientStops; - RefPtr mRecorder; + nsRefPtr mFinalGradientStops; + nsRefPtr mRecorder; }; static SourceSurface * @@ -140,8 +140,8 @@ public: virtual FilterBackend GetBackendType() override { return FILTER_BACKEND_RECORDING; } - RefPtr mFinalFilterNode; - RefPtr mRecorder; + nsRefPtr mFinalFilterNode; + nsRefPtr mRecorder; }; static FilterNode* @@ -224,7 +224,7 @@ DrawTargetRecording::DrawTargetRecording(DrawEventRecorder *aRecorder, DrawTarge : mRecorder(static_cast(aRecorder)) , mFinalDT(aDT) { - RefPtr snapshot = aHasData ? mFinalDT->Snapshot() : nullptr; + nsRefPtr snapshot = aHasData ? mFinalDT->Snapshot() : nullptr; mRecorder->RecordEvent(RecordedDrawTargetCreation(this, mFinalDT->GetBackendType(), mFinalDT->GetSize(), @@ -292,7 +292,7 @@ DrawTargetRecording::Fill(const Path *aPath, struct RecordingFontUserData { void *refPtr; - RefPtr recorder; + nsRefPtr recorder; }; void RecordingFontUserDataDestroyFunc(void *aUserData) @@ -368,9 +368,9 @@ DrawTargetRecording::Stroke(const Path *aPath, already_AddRefed DrawTargetRecording::Snapshot() { - RefPtr surf = mFinalDT->Snapshot(); + nsRefPtr surf = mFinalDT->Snapshot(); - RefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); + nsRefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); mRecorder->RecordEvent(RecordedSnapshot(retSurf, this)); @@ -413,9 +413,9 @@ DrawTargetRecording::DrawFilter(FilterNode *aNode, already_AddRefed DrawTargetRecording::CreateFilter(FilterType aType) { - RefPtr node = mFinalDT->CreateFilter(aType); + nsRefPtr node = mFinalDT->CreateFilter(aType); - RefPtr retNode = new FilterNodeRecording(node, mRecorder); + nsRefPtr retNode = new FilterNodeRecording(node, mRecorder); mRecorder->RecordEvent(RecordedFilterNodeCreation(retNode, aType)); @@ -467,9 +467,9 @@ DrawTargetRecording::CreateSourceSurfaceFromData(unsigned char *aData, int32_t aStride, SurfaceFormat aFormat) const { - RefPtr surf = mFinalDT->CreateSourceSurfaceFromData(aData, aSize, aStride, aFormat); + nsRefPtr surf = mFinalDT->CreateSourceSurfaceFromData(aData, aSize, aStride, aFormat); - RefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); + nsRefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); mRecorder->RecordEvent(RecordedSourceSurfaceCreation(retSurf, aData, aStride, aSize, aFormat)); @@ -479,11 +479,11 @@ DrawTargetRecording::CreateSourceSurfaceFromData(unsigned char *aData, already_AddRefed DrawTargetRecording::OptimizeSourceSurface(SourceSurface *aSurface) const { - RefPtr surf = mFinalDT->OptimizeSourceSurface(aSurface); + nsRefPtr surf = mFinalDT->OptimizeSourceSurface(aSurface); - RefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); + nsRefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); - RefPtr dataSurf = surf->GetDataSurface(); + nsRefPtr dataSurf = surf->GetDataSurface(); if (!dataSurf) { // Let's try get it off the original surface. @@ -512,11 +512,11 @@ DrawTargetRecording::OptimizeSourceSurface(SourceSurface *aSurface) const already_AddRefed DrawTargetRecording::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurface) const { - RefPtr surf = mFinalDT->CreateSourceSurfaceFromNativeSurface(aSurface); + nsRefPtr surf = mFinalDT->CreateSourceSurfaceFromNativeSurface(aSurface); - RefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); + nsRefPtr retSurf = new SourceSurfaceRecording(surf, mRecorder); - RefPtr dataSurf = surf->GetDataSurface(); + nsRefPtr dataSurf = surf->GetDataSurface(); if (!dataSurf) { gfxWarning() << "Recording failed to record SourceSurface created from OptimizeSourceSurface"; @@ -540,14 +540,14 @@ DrawTargetRecording::CreateSourceSurfaceFromNativeSurface(const NativeSurface &a already_AddRefed DrawTargetRecording::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const { - RefPtr dt = mFinalDT->CreateSimilarDrawTarget(aSize, aFormat); + nsRefPtr dt = mFinalDT->CreateSimilarDrawTarget(aSize, aFormat); return MakeAndAddRef(mRecorder.get(), dt); } already_AddRefed DrawTargetRecording::CreatePathBuilder(FillRule aFillRule) const { - RefPtr builder = mFinalDT->CreatePathBuilder(aFillRule); + nsRefPtr builder = mFinalDT->CreatePathBuilder(aFillRule); return MakeAndAddRef(builder, aFillRule); } @@ -556,9 +556,9 @@ DrawTargetRecording::CreateGradientStops(GradientStop *aStops, uint32_t aNumStops, ExtendMode aExtendMode) const { - RefPtr stops = mFinalDT->CreateGradientStops(aStops, aNumStops, aExtendMode); + nsRefPtr stops = mFinalDT->CreateGradientStops(aStops, aNumStops, aExtendMode); - RefPtr retStops = new GradientStopsRecording(stops, mRecorder); + nsRefPtr retStops = new GradientStopsRecording(stops, mRecorder); mRecorder->RecordEvent(RecordedGradientStopsCreation(retStops, aStops, aNumStops, aExtendMode)); diff --git a/gfx/2d/DrawTargetRecording.h b/gfx/2d/DrawTargetRecording.h index 9bf7b2f7d9f..2ff09a33e6e 100644 --- a/gfx/2d/DrawTargetRecording.h +++ b/gfx/2d/DrawTargetRecording.h @@ -277,8 +277,8 @@ private: Path *GetPathForPathRecording(const Path *aPath) const; void EnsureStored(const Path *aPath); - RefPtr mRecorder; - RefPtr mFinalDT; + nsRefPtr mRecorder; + nsRefPtr mFinalDT; }; } // namespace gfx diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 1554094ace7..51011b72780 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -85,7 +85,7 @@ public: struct TempBitmap { SkBitmap mBitmap; - RefPtr mTmpSurface; + nsRefPtr mTmpSurface; }; static TempBitmap @@ -98,7 +98,7 @@ GetBitmapForSurface(SourceSurface* aSurface) return result; } - RefPtr surf = aSurface->GetDataSurface(); + nsRefPtr surf = aSurface->GetDataSurface(); if (!surf) { MOZ_CRASH("Non-skia SourceSurfaces need to be DataSourceSurfaces"); } @@ -133,7 +133,7 @@ DrawTargetSkia::~DrawTargetSkia() already_AddRefed DrawTargetSkia::Snapshot() { - RefPtr snapshot = mSnapshot; + nsRefPtr snapshot = mSnapshot; if (!snapshot) { snapshot = new SourceSurfaceSkia(); mSnapshot = snapshot; @@ -354,7 +354,7 @@ DrawTargetSkia::DrawSurface(SourceSurface *aSurface, const DrawSurfaceOptions &aSurfOptions, const DrawOptions &aOptions) { - RefPtr dataSurface; + nsRefPtr dataSurface; if (!(aSurface->GetType() == SurfaceType::SKIA || aSurface->GetType() == SurfaceType::DATA)) { dataSurface = aSurface->GetDataSurface(); @@ -682,7 +682,7 @@ DrawTargetSkia::CreateSourceSurfaceFromData(unsigned char *aData, int32_t aStride, SurfaceFormat aFormat) const { - RefPtr newSurf = new SourceSurfaceSkia(); + nsRefPtr newSurf = new SourceSurfaceSkia(); if (!newSurf->InitFromData(aData, aSize, aStride, aFormat)) { gfxDebug() << *this << ": Failure to create source surface from data. Size: " << aSize; @@ -695,7 +695,7 @@ DrawTargetSkia::CreateSourceSurfaceFromData(unsigned char *aData, already_AddRefed DrawTargetSkia::CreateSimilarDrawTarget(const IntSize &aSize, SurfaceFormat aFormat) const { - RefPtr target = new DrawTargetSkia(); + nsRefPtr target = new DrawTargetSkia(); if (!target->Init(aSize, aFormat)) { return nullptr; } @@ -716,7 +716,7 @@ already_AddRefed DrawTargetSkia::OptimizeSourceSurface(SourceSurface *aSurface) const { if (aSurface->GetType() == SurfaceType::SKIA) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } @@ -730,13 +730,13 @@ DrawTargetSkia::OptimizeSourceSurface(SourceSurface *aSurface) const // If we are using skia-gl then we want to copy into a surface that // will cache the uploaded gl texture. - RefPtr dataSurf = aSurface->GetDataSurface(); + nsRefPtr dataSurf = aSurface->GetDataSurface(); DataSourceSurface::MappedSurface map; if (!dataSurf->Map(DataSourceSurface::READ, &map)) { return nullptr; } - RefPtr result = CreateSourceSurfaceFromData(map.mData, + nsRefPtr result = CreateSourceSurfaceFromData(map.mData, dataSurf->GetSize(), map.mStride, dataSurf->GetFormat()); @@ -757,7 +757,7 @@ DrawTargetSkia::CreateSourceSurfaceFromNativeSurface(const NativeSurface &aSurfa return MakeAndAddRef(surf, aSurface.mSize, aSurface.mFormat); #if USE_SKIA_GPU } else if (aSurface.mType == NativeSurfaceType::OPENGL_TEXTURE && UsingSkiaGPU()) { - RefPtr newSurf = new SourceSurfaceSkia(); + nsRefPtr newSurf = new SourceSurfaceSkia(); unsigned int texture = (unsigned int)((uintptr_t)aSurface.mSurface); if (newSurf->InitFromTexture((DrawTargetSkia*)this, texture, aSurface.mSize, aSurface.mFormat)) { return newSurf.forget(); diff --git a/gfx/2d/DrawTargetTiled.h b/gfx/2d/DrawTargetTiled.h index 1e4534e74db..aecf05347bc 100644 --- a/gfx/2d/DrawTargetTiled.h +++ b/gfx/2d/DrawTargetTiled.h @@ -174,7 +174,7 @@ public: virtual already_AddRefed GetDataSurface() { - RefPtr surf = Factory::CreateDataSourceSurface(GetSize(), GetFormat()); + nsRefPtr surf = Factory::CreateDataSourceSurface(GetSize(), GetFormat()); DataSourceSurface::MappedSurface mappedSurf; if (!surf->Map(DataSourceSurface::MapType::WRITE, &mappedSurf)) { @@ -183,7 +183,7 @@ public: } { - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, mappedSurf.mData, GetSize(), mappedSurf.mStride, GetFormat()); @@ -193,7 +193,7 @@ public: return nullptr; } for (size_t i = 0; i < mSnapshots.size(); i++) { - RefPtr dataSurf = mSnapshots[i]->GetDataSurface(); + nsRefPtr dataSurf = mSnapshots[i]->GetDataSurface(); dt->CopySurface(dataSurf, IntRect(IntPoint(0, 0), mSnapshots[i]->GetSize()), mOrigins[i]); } } @@ -202,7 +202,7 @@ public: return surf.forget(); } - std::vector> mSnapshots; + std::vector> mSnapshots; std::vector mOrigins; IntRect mRect; }; diff --git a/gfx/2d/DrawingJob.h b/gfx/2d/DrawingJob.h index a384dabda75..a9ae071eaa0 100644 --- a/gfx/2d/DrawingJob.h +++ b/gfx/2d/DrawingJob.h @@ -8,7 +8,7 @@ #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Assertions.h" #include "mozilla/gfx/Matrix.h" #include "mozilla/gfx/JobScheduler.h" @@ -79,7 +79,7 @@ public: bool HasCommands() const { return !!mCommands; } protected: - RefPtr mCommands; + nsRefPtr mCommands; }; /// Stores multiple commands to be executed sequencially. @@ -100,10 +100,10 @@ protected: void Clear(); std::vector mCommandOffsets; - RefPtr mCommandBuffer; + nsRefPtr mCommandBuffer; uint32_t mCursor; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; IntPoint mOffset; friend class DrawingJobBuilder; @@ -147,9 +147,9 @@ public: protected: std::vector mCommandOffsets; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; IntPoint mOffset; - RefPtr mStart; + nsRefPtr mStart; }; } // namespace diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp index b0533b6bba0..6b19c200098 100644 --- a/gfx/2d/Factory.cpp +++ b/gfx/2d/Factory.cpp @@ -278,12 +278,12 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor return nullptr; } - RefPtr retVal; + nsRefPtr retVal; switch (aBackend) { #ifdef WIN32 case BackendType::DIRECT2D: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetD2D(); if (newTarget->Init(aSize, aFormat)) { retVal = newTarget; @@ -292,7 +292,7 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor } case BackendType::DIRECT2D1_1: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetD2D1(); if (newTarget->Init(aSize, aFormat)) { retVal = newTarget; @@ -303,7 +303,7 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor case BackendType::COREGRAPHICS: case BackendType::COREGRAPHICS_ACCELERATED: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetCG(); if (newTarget->Init(aBackend, aSize, aFormat)) { retVal = newTarget; @@ -314,7 +314,7 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor #ifdef USE_SKIA case BackendType::SKIA: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetSkia(); if (newTarget->Init(aSize, aFormat)) { retVal = newTarget; @@ -325,7 +325,7 @@ Factory::CreateDrawTarget(BackendType aBackend, const IntSize &aSize, SurfaceFor #ifdef USE_CAIRO case BackendType::CAIRO: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetCairo(); if (newTarget->Init(aSize, aFormat)) { retVal = newTarget; @@ -369,13 +369,13 @@ Factory::CreateDrawTargetForData(BackendType aBackend, return nullptr; } - RefPtr retVal; + nsRefPtr retVal; switch (aBackend) { #ifdef USE_SKIA case BackendType::SKIA: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetSkia(); newTarget->Init(aData, aSize, aStride, aFormat); retVal = newTarget; @@ -385,7 +385,7 @@ Factory::CreateDrawTargetForData(BackendType aBackend, #ifdef XP_MACOSX case BackendType::COREGRAPHICS: { - RefPtr newTarget = new DrawTargetCG(); + nsRefPtr newTarget = new DrawTargetCG(); if (newTarget->Init(aBackend, aData, aSize, aStride, aFormat)) return newTarget.forget(); break; @@ -394,7 +394,7 @@ Factory::CreateDrawTargetForData(BackendType aBackend, #ifdef USE_CAIRO case BackendType::CAIRO: { - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetCairo(); if (newTarget->Init(aData, aSize, aStride, aFormat)) { retVal = newTarget.forget(); @@ -421,7 +421,7 @@ Factory::CreateDrawTargetForData(BackendType aBackend, already_AddRefed Factory::CreateTiledDrawTarget(const TileSet& aTileSet) { - RefPtr dt = new DrawTargetTiled(); + nsRefPtr dt = new DrawTargetTiled(); if (!dt->Init(aTileSet)) { return nullptr; @@ -533,7 +533,7 @@ Factory::CreateScaledFontWithCairo(const NativeFont& aNativeFont, Float aSize, c // but that would require a lot of code that would be otherwise repeated in // various backends. // Therefore, we just reuse CreateScaledFontForNativeFont's implementation. - RefPtr font = CreateScaledFontForNativeFont(aNativeFont, aSize); + nsRefPtr font = CreateScaledFontForNativeFont(aNativeFont, aSize); static_cast(font.get())->SetCairoScaledFont(aScaledFont); return font.forget(); #else @@ -546,10 +546,10 @@ Factory::CreateDualDrawTarget(DrawTarget *targetA, DrawTarget *targetB) { MOZ_ASSERT(targetA && targetB); - RefPtr newTarget = + nsRefPtr newTarget = new DrawTargetDual(targetA, targetB); - RefPtr retVal = newTarget; + nsRefPtr retVal = newTarget; if (mRecorder) { retVal = new DrawTargetRecording(mRecorder, retVal); @@ -565,11 +565,11 @@ Factory::CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceForma { MOZ_ASSERT(aTexture); - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetD2D(); if (newTarget->Init(aTexture, aFormat)) { - RefPtr retVal = newTarget; + nsRefPtr retVal = newTarget; if (mRecorder) { retVal = new DrawTargetRecording(mRecorder, retVal, true); @@ -590,8 +590,8 @@ Factory::CreateDualDrawTargetForD3D10Textures(ID3D10Texture2D *aTextureA, SurfaceFormat aFormat) { MOZ_ASSERT(aTextureA && aTextureB); - RefPtr newTargetA; - RefPtr newTargetB; + nsRefPtr newTargetA; + nsRefPtr newTargetB; newTargetA = new DrawTargetD2D(); if (!newTargetA->Init(aTextureA, aFormat)) { @@ -605,10 +605,10 @@ Factory::CreateDualDrawTargetForD3D10Textures(ID3D10Texture2D *aTextureA, return nullptr; } - RefPtr newTarget = + nsRefPtr newTarget = new DrawTargetDual(newTargetA, newTargetB); - RefPtr retVal = newTarget; + nsRefPtr retVal = newTarget; if (mRecorder) { retVal = new DrawTargetRecording(mRecorder, retVal); @@ -646,11 +646,11 @@ Factory::CreateDrawTargetForD3D11Texture(ID3D11Texture2D *aTexture, SurfaceForma { MOZ_ASSERT(aTexture); - RefPtr newTarget; + nsRefPtr newTarget; newTarget = new DrawTargetD2D1(); if (newTarget->Init(aTexture, aFormat)) { - RefPtr retVal = newTarget; + nsRefPtr retVal = newTarget; if (mRecorder) { retVal = new DrawTargetRecording(mRecorder, retVal, true); @@ -679,10 +679,10 @@ Factory::SetDirect3D11Device(ID3D11Device *aDevice) return; } - RefPtr factory = D2DFactory1(); + nsRefPtr factory = D2DFactory1(); - RefPtr device; - aDevice->QueryInterface((IDXGIDevice**)byRef(device)); + nsRefPtr device; + aDevice->QueryInterface((IDXGIDevice**)getter_AddRefs(device)); HRESULT hr = factory->CreateDevice(device, &mD2D1Device); if (FAILED(hr)) { gfxCriticalError() << "[D2D1] Failed to create gfx factory's D2D1 device, code: " << hexa(hr); @@ -744,7 +744,7 @@ Factory::CreateDrawTargetSkiaWithGrContext(GrContext* aGrContext, const IntSize &aSize, SurfaceFormat aFormat) { - RefPtr newTarget = new DrawTargetSkia(); + nsRefPtr newTarget = new DrawTargetSkia(); if (!newTarget->InitWithGrContext(aGrContext, aSize, aFormat)) { return nullptr; } @@ -762,7 +762,7 @@ Factory::PurgeAllCaches() already_AddRefed Factory::CreateCairoGlyphRenderingOptions(FontHinting aHinting, bool aAutoHinting, AntialiasMode aAntialiasMode) { - RefPtr options = + nsRefPtr options = new GlyphRenderingOptionsCairo(); options->SetHinting(aHinting); @@ -775,10 +775,10 @@ Factory::CreateCairoGlyphRenderingOptions(FontHinting aHinting, bool aAutoHintin already_AddRefed Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSize& aSize, SurfaceFormat* aFormat) { - RefPtr retVal; + nsRefPtr retVal; #ifdef USE_CAIRO - RefPtr newTarget = new DrawTargetCairo(); + nsRefPtr newTarget = new DrawTargetCairo(); if (newTarget->Init(aSurface, aSize, aFormat)) { retVal = newTarget; @@ -795,9 +795,9 @@ Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSiz already_AddRefed Factory::CreateDrawTargetForCairoCGContext(CGContextRef cg, const IntSize& aSize) { - RefPtr retVal; + nsRefPtr retVal; - RefPtr newTarget = new DrawTargetCG(); + nsRefPtr newTarget = new DrawTargetCG(); if (newTarget->Init(cg, aSize)) { retVal = newTarget; @@ -826,7 +826,7 @@ Factory::CreateWrappingDataSourceSurface(uint8_t *aData, int32_t aStride, return nullptr; } - RefPtr newSurf = new SourceSurfaceRawData(); + nsRefPtr newSurf = new SourceSurfaceRawData(); if (newSurf->InitWrappingData(aData, aSize, aStride, aFormat, false)) { return newSurf.forget(); @@ -845,7 +845,7 @@ Factory::CreateDataSourceSurface(const IntSize &aSize, return nullptr; } - RefPtr newSurf = new SourceSurfaceAlignedRawData(); + nsRefPtr newSurf = new SourceSurfaceAlignedRawData(); if (newSurf->Init(aSize, aFormat, aZero)) { return newSurf.forget(); } @@ -865,7 +865,7 @@ Factory::CreateDataSourceSurfaceWithStride(const IntSize &aSize, return nullptr; } - RefPtr newSurf = new SourceSurfaceAlignedRawData(); + nsRefPtr newSurf = new SourceSurfaceAlignedRawData(); if (newSurf->InitWithStride(aSize, aFormat, aStride, aZero)) { return newSurf.forget(); } diff --git a/gfx/2d/FilterNodeD2D1.cpp b/gfx/2d/FilterNodeD2D1.cpp index b144c3c7e46..0b0dfd1dc1d 100644 --- a/gfx/2d/FilterNodeD2D1.cpp +++ b/gfx/2d/FilterNodeD2D1.cpp @@ -565,17 +565,17 @@ FilterNodeD2D1::Create(ID2D1DeviceContext *aDC, FilterType aType) return MakeAndAddRef(aDC); } - RefPtr effect; + nsRefPtr effect; HRESULT hr; - hr = aDC->CreateEffect(GetCLDIDForFilterType(aType), byRef(effect)); + hr = aDC->CreateEffect(GetCLDIDForFilterType(aType), getter_AddRefs(effect)); if (FAILED(hr) || !effect) { gfxCriticalErrorOnce() << "Failed to create effect for FilterType: " << hexa(hr); return nullptr; } - RefPtr filter = new FilterNodeD2D1(effect, aType); + nsRefPtr filter = new FilterNodeD2D1(effect, aType); if (HasUnboundedOutputRegion(aType)) { // These filters can produce non-transparent output from transparent @@ -685,13 +685,13 @@ FilterNodeD2D1::WillDraw(DrawTarget *aDT) for (size_t inputIndex = 0; inputIndex < mInputSurfaces.size(); inputIndex++) { if (mInputSurfaces[inputIndex]) { ID2D1Effect* effect = InputEffect(); - RefPtr image = GetImageForSourceSurface(aDT, mInputSurfaces[inputIndex]); + nsRefPtr image = GetImageForSourceSurface(aDT, mInputSurfaces[inputIndex]); effect->SetInput(inputIndex, image); } } // Call WillDraw() on our input filters. - for (std::vector>::iterator it = mInputFilters.begin(); + for (std::vector>::iterator it = mInputFilters.begin(); it != mInputFilters.end(); it++) { if (*it) { (*it)->WillDraw(aDT); @@ -878,7 +878,7 @@ FilterNodeConvolveD2D1::FilterNodeConvolveD2D1(ID2D1DeviceContext *aDC) HRESULT hr; - hr = aDC->CreateEffect(CLSID_D2D1ConvolveMatrix, byRef(mEffect)); + hr = aDC->CreateEffect(CLSID_D2D1ConvolveMatrix, getter_AddRefs(mEffect)); if (FAILED(hr) || !mEffect) { gfxWarning() << "Failed to create ConvolveMatrix filter!"; @@ -887,14 +887,14 @@ FilterNodeConvolveD2D1::FilterNodeConvolveD2D1(ID2D1DeviceContext *aDC) mEffect->SetValue(D2D1_CONVOLVEMATRIX_PROP_BORDER_MODE, D2D1_BORDER_MODE_SOFT); - hr = aDC->CreateEffect(CLSID_ExtendInputEffect, byRef(mExtendInputEffect)); + hr = aDC->CreateEffect(CLSID_ExtendInputEffect, getter_AddRefs(mExtendInputEffect)); if (FAILED(hr) || !mExtendInputEffect) { gfxWarning() << "Failed to create ConvolveMatrix filter!"; return; } - hr = aDC->CreateEffect(CLSID_D2D1Border, byRef(mBorderEffect)); + hr = aDC->CreateEffect(CLSID_D2D1Border, getter_AddRefs(mBorderEffect)); if (FAILED(hr) || !mBorderEffect) { gfxWarning() << "Failed to create ConvolveMatrix filter!"; @@ -950,7 +950,7 @@ FilterNodeConvolveD2D1::UpdateChain() mEffect->SetInputEffect(0, mBorderEffect.get()); } - RefPtr inputEffect; + nsRefPtr inputEffect; if (mInputFilters.size() > 0 && mInputFilters[0]) { inputEffect = mInputFilters[0]->OutputEffect(); } @@ -1037,7 +1037,7 @@ FilterNodeExtendInputAdapterD2D1::FilterNodeExtendInputAdapterD2D1(ID2D1DeviceCo HRESULT hr; - hr = aDC->CreateEffect(CLSID_ExtendInputEffect, byRef(mExtendInputEffect)); + hr = aDC->CreateEffect(CLSID_ExtendInputEffect, getter_AddRefs(mExtendInputEffect)); if (FAILED(hr) || !mExtendInputEffect) { gfxWarning() << "Failed to create extend input effect for filter: " << hexa(hr); @@ -1081,14 +1081,14 @@ FilterNodePremultiplyAdapterD2D1::FilterNodePremultiplyAdapterD2D1(ID2D1DeviceCo // filters is part of the FilterNode API. HRESULT hr; - hr = aDC->CreateEffect(CLSID_D2D1Premultiply, byRef(mPrePremultiplyEffect)); + hr = aDC->CreateEffect(CLSID_D2D1Premultiply, getter_AddRefs(mPrePremultiplyEffect)); if (FAILED(hr) || !mPrePremultiplyEffect) { gfxWarning() << "Failed to create ComponentTransfer filter!"; return; } - hr = aDC->CreateEffect(CLSID_D2D1UnPremultiply, byRef(mPostUnpremultiplyEffect)); + hr = aDC->CreateEffect(CLSID_D2D1UnPremultiply, getter_AddRefs(mPostUnpremultiplyEffect)); if (FAILED(hr) || !mPostUnpremultiplyEffect) { gfxWarning() << "Failed to create ComponentTransfer filter!"; diff --git a/gfx/2d/FilterNodeD2D1.h b/gfx/2d/FilterNodeD2D1.h index 1f06dda6f52..8c5fd8adf1f 100644 --- a/gfx/2d/FilterNodeD2D1.h +++ b/gfx/2d/FilterNodeD2D1.h @@ -65,9 +65,9 @@ protected: void InitUnmappedProperties(); - RefPtr mEffect; - std::vector> mInputFilters; - std::vector> mInputSurfaces; + nsRefPtr mEffect; + std::vector> mInputFilters; + std::vector> mInputSurfaces; FilterType mType; }; @@ -91,8 +91,8 @@ private: void UpdateOffset(); void UpdateSourceRect(); - RefPtr mExtendInputEffect; - RefPtr mBorderEffect; + nsRefPtr mExtendInputEffect; + nsRefPtr mBorderEffect; ConvolveMatrixEdgeMode mEdgeMode; IntPoint mTarget; IntSize mKernelSize; @@ -109,8 +109,8 @@ public: virtual ID2D1Effect* OutputEffect() override { return mWrappedFilterNode->OutputEffect(); } private: - RefPtr mWrappedFilterNode; - RefPtr mExtendInputEffect; + nsRefPtr mWrappedFilterNode; + nsRefPtr mExtendInputEffect; }; class FilterNodePremultiplyAdapterD2D1 : public FilterNodeD2D1 @@ -123,8 +123,8 @@ public: virtual ID2D1Effect* OutputEffect() override { return mPostUnpremultiplyEffect.get(); } private: - RefPtr mPrePremultiplyEffect; - RefPtr mPostUnpremultiplyEffect; + nsRefPtr mPrePremultiplyEffect; + nsRefPtr mPostUnpremultiplyEffect; }; } diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp index 2e16c5dc782..fd4be8a76c7 100644 --- a/gfx/2d/FilterNodeSoftware.cpp +++ b/gfx/2d/FilterNodeSoftware.cpp @@ -418,7 +418,7 @@ GetDataSurfaceInRect(SourceSurface *aSurface, IntRect intersectInDestSpace = intersect - aDestRect.TopLeft(); SurfaceFormat format = aSurface ? aSurface->GetFormat() : SurfaceFormat(SurfaceFormat::B8G8R8A8); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aDestRect.Size(), format, true); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -428,7 +428,7 @@ GetDataSurfaceInRect(SourceSurface *aSurface, return target.forget(); } - RefPtr dataSource = aSurface->GetDataSurface(); + nsRefPtr dataSource = aSurface->GetDataSurface(); MOZ_ASSERT(dataSource); if (aEdgeMode == EDGE_MODE_WRAP) { @@ -449,7 +449,7 @@ GetDataSurfaceInRect(SourceSurface *aSurface, /* static */ already_AddRefed FilterNodeSoftware::Create(FilterType aType) { - RefPtr filter; + nsRefPtr filter; switch (aType) { case FilterType::BLEND: filter = new FilterNodeBlendSoftware(); @@ -563,7 +563,7 @@ FilterNodeSoftware::Draw(DrawTarget* aDrawTarget, return; } - RefPtr result; + nsRefPtr result; if (!outputRect.IsEmpty()) { result = GetOutput(outputRect); } @@ -653,7 +653,7 @@ FilterNodeSoftware::RequestInputRect(uint32_t aInputEnumIndex, const IntRect &aR if (mInputSurfaces[inputIndex]) { return; } - RefPtr filter = mInputFilters[inputIndex]; + nsRefPtr filter = mInputFilters[inputIndex]; MOZ_ASSERT(filter, "missing input"); filter->RequestRect(filter->GetOutputRectInRect(aRect)); } @@ -693,7 +693,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex, return nullptr; } - RefPtr surface; + nsRefPtr surface; IntRect surfaceRect; if (mInputSurfaces[inputIndex]) { @@ -708,7 +708,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex, #ifdef DEBUG_DUMP_SURFACES printf("getting input from input filter %s...\n", mInputFilters[inputIndex]->GetName()); #endif - RefPtr filter = mInputFilters[inputIndex]; + nsRefPtr filter = mInputFilters[inputIndex]; MOZ_ASSERT(filter, "missing input"); IntRect inputFilterOutput = filter->GetOutputRectInRect(aRect); if (!inputFilterOutput.IsEmpty()) { @@ -741,7 +741,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex, surfaceRect = srcRect; } - RefPtr result = + nsRefPtr result = GetDataSurfaceInRect(surface, surfaceRect, aRect, aEdgeMode); if (result) { @@ -803,7 +803,7 @@ FilterNodeSoftware::GetInputRectInRect(uint32_t aInputEnumIndex, return aInRect.Intersect(IntRect(IntPoint(0, 0), mInputSurfaces[inputIndex]->GetSize())); } - RefPtr filter = mInputFilters[inputIndex]; + nsRefPtr filter = mInputFilters[inputIndex]; MOZ_ASSERT(filter, "missing input"); return filter->GetOutputRectInRect(aInRect); } @@ -852,7 +852,7 @@ FilterNodeSoftware::~FilterNodeSoftware() MOZ_ASSERT(!mInvalidationListeners.size(), "All invalidation listeners should have unsubscribed themselves by now!"); - for (std::vector >::iterator it = mInputFilters.begin(); + for (std::vector >::iterator it = mInputFilters.begin(); it != mInputFilters.end(); it++) { if (*it) { (*it)->RemoveInvalidationListener(this); @@ -970,9 +970,9 @@ static CompositionOp ToBlendOp(BlendMode aOp) already_AddRefed FilterNodeBlendSoftware::Render(const IntRect& aRect) { - RefPtr input1 = + nsRefPtr input1 = GetInputDataSourceSurface(IN_BLEND_IN, aRect, NEED_COLOR_CHANNELS); - RefPtr input2 = + nsRefPtr input2 = GetInputDataSourceSurface(IN_BLEND_IN2, aRect, NEED_COLOR_CHANNELS); // Null inputs need to be treated as transparent. @@ -990,7 +990,7 @@ FilterNodeBlendSoftware::Render(const IntRect& aRect) // Third case: both are non-transparent. // Apply normal filtering. - RefPtr target = FilterProcessing::ApplyBlending(input1, input2, mBlendMode); + nsRefPtr target = FilterProcessing::ApplyBlending(input1, input2, mBlendMode); if (target != nullptr) { return target.forget(); } @@ -1010,7 +1010,7 @@ FilterNodeBlendSoftware::Render(const IntRect& aRect) return nullptr; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, targetMap.GetData(), target->GetSize(), @@ -1097,7 +1097,7 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect) { IntRect srcRect = SourceRectForOutputRect(aRect); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_TRANSFORM_IN, srcRect); if (!input) { @@ -1110,7 +1110,7 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect) return input.forget(); } - RefPtr surf = + nsRefPtr surf = Factory::CreateDataSourceSurface(aRect.Size(), input->GetFormat(), true); if (!surf) { @@ -1123,7 +1123,7 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect) return nullptr; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, mapping.mData, surf->GetSize(), @@ -1212,7 +1212,7 @@ ApplyMorphology(const IntRect& aSourceRect, DataSourceSurface* aInput, margin.bottom >= ry && margin.left >= rx, "insufficient margin"); #endif - RefPtr tmp; + nsRefPtr tmp; if (rx == 0) { tmp = aInput; } else { @@ -1235,7 +1235,7 @@ ApplyMorphology(const IntRect& aSourceRect, DataSourceSurface* aInput, sourceData, sourceMap.GetStride(), tmpData, tmpMap.GetStride(), tmpRect, rx, aOperator); } - RefPtr dest; + nsRefPtr dest; if (ry == 0) { dest = tmp; } else { @@ -1268,7 +1268,7 @@ FilterNodeMorphologySoftware::Render(const IntRect& aRect) IntRect srcRect = aRect; srcRect.Inflate(mRadii); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_MORPHOLOGY_IN, srcRect, NEED_COLOR_CHANNELS); if (!input) { return nullptr; @@ -1337,12 +1337,12 @@ static already_AddRefed Premultiply(DataSourceSurface* aSurface) { if (aSurface->GetFormat() == SurfaceFormat::A8) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } IntSize size = aSurface->GetSize(); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -1369,12 +1369,12 @@ static already_AddRefed Unpremultiply(DataSourceSurface* aSurface) { if (aSurface->GetFormat() == SurfaceFormat::A8) { - RefPtr surface(aSurface); + nsRefPtr surface(aSurface); return surface.forget(); } IntSize size = aSurface->GetSize(); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -1400,7 +1400,7 @@ Unpremultiply(DataSourceSurface* aSurface) already_AddRefed FilterNodeColorMatrixSoftware::Render(const IntRect& aRect) { - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_COLOR_MATRIX_IN, aRect, NEED_COLOR_CHANNELS); if (!input) { return nullptr; @@ -1410,7 +1410,7 @@ FilterNodeColorMatrixSoftware::Render(const IntRect& aRect) input = Unpremultiply(input); } - RefPtr result = + nsRefPtr result = FilterProcessing::ApplyColorMatrix(input, mMatrix); if (mAlphaMode == ALPHA_MODE_PREMULTIPLIED) { @@ -1470,7 +1470,7 @@ already_AddRefed FilterNodeFloodSoftware::Render(const IntRect& aRect) { SurfaceFormat format = FormatForColor(mColor); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aRect.Size(), format); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -1574,9 +1574,9 @@ FilterNodeTileSoftware::Render(const IntRect& aRect) return GetInputDataSourceSurface(IN_TILE_IN, aRect); } - RefPtr target; + nsRefPtr target; - typedef std::map, CompareIntRects> InputMap; + typedef std::map, CompareIntRects> InputMap; InputMap inputs; IntPoint startIndex = TileIndex(mSourceRect, aRect.TopLeft()); @@ -1591,7 +1591,7 @@ FilterNodeTileSoftware::Render(const IntRect& aRect) continue; } - RefPtr input; + nsRefPtr input; InputMap::iterator it = inputs.find(srcRect); if (it == inputs.end()) { input = GetInputDataSourceSurface(IN_TILE_IN, srcRect); @@ -1755,7 +1755,7 @@ FilterNodeComponentTransferSoftware::Render(const IntRect& aRect) FormatHint pref = needColorChannels ? NEED_COLOR_CHANNELS : CAN_HANDLE_A8; - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_TRANSFER_IN, aRect, pref); if (!input) { return nullptr; @@ -1777,7 +1777,7 @@ FilterNodeComponentTransferSoftware::Render(const IntRect& aRect) return input.forget(); } - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aRect.Size(), format); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -2434,7 +2434,7 @@ FilterNodeConvolveMatrixSoftware::DoRender(const IntRect& aRect, // ColorComponentAtPoint may want to access the margins. srcRect.Inflate(1); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_CONVOLVE_MATRIX_IN, srcRect, NEED_COLOR_CHANNELS, mEdgeMode, &mSourceRect); if (!input) { @@ -2443,7 +2443,7 @@ FilterNodeConvolveMatrixSoftware::DoRender(const IntRect& aRect, DebugOnlyAutoColorSamplingAccessControl accessControl(input); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aRect.Size(), SurfaceFormat::B8G8R8A8, true); if (MOZ2D_WARN_IF(!target)) { return nullptr; @@ -2591,11 +2591,11 @@ already_AddRefed FilterNodeDisplacementMapSoftware::Render(const IntRect& aRect) { IntRect srcRect = InflatedSourceOrDestRect(aRect); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_DISPLACEMENT_MAP_IN, srcRect, NEED_COLOR_CHANNELS); - RefPtr map = + nsRefPtr map = GetInputDataSourceSurface(IN_DISPLACEMENT_MAP_IN2, aRect, NEED_COLOR_CHANNELS); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aRect.Size(), SurfaceFormat::B8G8R8A8); if (MOZ2D_WARN_IF(!(input && map && target))) { return nullptr; @@ -2784,9 +2784,9 @@ FilterNodeArithmeticCombineSoftware::SetAttribute(uint32_t aIndex, already_AddRefed FilterNodeArithmeticCombineSoftware::Render(const IntRect& aRect) { - RefPtr input1 = + nsRefPtr input1 = GetInputDataSourceSurface(IN_ARITHMETIC_COMBINE_IN, aRect, NEED_COLOR_CHANNELS); - RefPtr input2 = + nsRefPtr input2 = GetInputDataSourceSurface(IN_ARITHMETIC_COMBINE_IN2, aRect, NEED_COLOR_CHANNELS); if (!input1 && !input2) { return nullptr; @@ -2858,9 +2858,9 @@ FilterNodeCompositeSoftware::SetAttribute(uint32_t aIndex, uint32_t aCompositeOp already_AddRefed FilterNodeCompositeSoftware::Render(const IntRect& aRect) { - RefPtr start = + nsRefPtr start = GetInputDataSourceSurface(IN_COMPOSITE_IN_START, aRect, NEED_COLOR_CHANNELS); - RefPtr dest = + nsRefPtr dest = Factory::CreateDataSourceSurface(aRect.Size(), SurfaceFormat::B8G8R8A8, true); if (MOZ2D_WARN_IF(!dest)) { return nullptr; @@ -2871,7 +2871,7 @@ FilterNodeCompositeSoftware::Render(const IntRect& aRect) } for (size_t inputIndex = 1; inputIndex < NumberOfSetInputs(); inputIndex++) { - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_COMPOSITE_IN_START + inputIndex, aRect, NEED_COLOR_CHANNELS); if (input) { FilterProcessing::ApplyComposition(input, dest, mOperator); @@ -2942,13 +2942,13 @@ FilterNodeBlurXYSoftware::Render(const IntRect& aRect) } IntRect srcRect = InflatedSourceOrDestRect(aRect); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_GAUSSIAN_BLUR_IN, srcRect); if (!input) { return nullptr; } - RefPtr target; + nsRefPtr target; Rect r(0, 0, srcRect.width, srcRect.height); if (input->GetFormat() == SurfaceFormat::A8) { @@ -2965,7 +2965,7 @@ FilterNodeBlurXYSoftware::Render(const IntRect& aRect) AlphaBoxBlur blur(r, targetMap.GetStride(), sigmaXY.width, sigmaXY.height); blur.Blur(targetMap.GetData()); } else { - RefPtr channel0, channel1, channel2, channel3; + nsRefPtr channel0, channel1, channel2, channel3; FilterProcessing::SeparateColorChannels(input, channel0, channel1, channel2, channel3); if (MOZ2D_WARN_IF(!(channel0 && channel1 && channel2 && channel3))) { return nullptr; @@ -3139,7 +3139,7 @@ FilterNodePremultiplySoftware::InputIndex(uint32_t aInputEnumIndex) already_AddRefed FilterNodePremultiplySoftware::Render(const IntRect& aRect) { - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_PREMULTIPLY_IN, aRect); return input ? Premultiply(input) : nullptr; } @@ -3168,7 +3168,7 @@ FilterNodeUnpremultiplySoftware::InputIndex(uint32_t aInputEnumIndex) already_AddRefed FilterNodeUnpremultiplySoftware::Render(const IntRect& aRect) { - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_UNPREMULTIPLY_IN, aRect); return input ? Unpremultiply(input) : nullptr; } @@ -3480,7 +3480,7 @@ FilterNodeLightingSoftware::DoRender(const IntRect& aRe // ColorComponentAtPoint may want to access the margins. srcRect.Inflate(1); - RefPtr input = + nsRefPtr input = GetInputDataSourceSurface(IN_LIGHTING_IN, srcRect, CAN_HANDLE_A8, EDGE_MODE_NONE); @@ -3494,7 +3494,7 @@ FilterNodeLightingSoftware::DoRender(const IntRect& aRe DebugOnlyAutoColorSamplingAccessControl accessControl(input); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (MOZ2D_WARN_IF(!target)) { return nullptr; diff --git a/gfx/2d/FilterNodeSoftware.h b/gfx/2d/FilterNodeSoftware.h index 8ae5afd0309..e9fb37964e8 100644 --- a/gfx/2d/FilterNodeSoftware.h +++ b/gfx/2d/FilterNodeSoftware.h @@ -189,8 +189,8 @@ protected: * mInputSurfaces / mInputFilters: For each input index, either a surface or * a filter is set, and the other is null. */ - std::vector > mInputSurfaces; - std::vector > mInputFilters; + std::vector > mInputSurfaces; + std::vector > mInputFilters; /** * Weak pointers to our invalidation listeners, i.e. to those filters who @@ -210,7 +210,7 @@ protected: * Stores our cached output. */ IntRect mCachedRect; - RefPtr mCachedOutput; + nsRefPtr mCachedOutput; }; // Subclasses for specific filters. diff --git a/gfx/2d/FilterProcessing.cpp b/gfx/2d/FilterProcessing.cpp index da734c01a63..dc3edff6d81 100644 --- a/gfx/2d/FilterProcessing.cpp +++ b/gfx/2d/FilterProcessing.cpp @@ -13,7 +13,7 @@ already_AddRefed FilterProcessing::ExtractAlpha(DataSourceSurface* aSource) { IntSize size = aSource->GetSize(); - RefPtr alpha = Factory::CreateDataSourceSurface(size, SurfaceFormat::A8); + nsRefPtr alpha = Factory::CreateDataSourceSurface(size, SurfaceFormat::A8); if (MOZ2D_WARN_IF(!alpha)) { return nullptr; } @@ -123,10 +123,10 @@ FilterProcessing::ApplyComposition(DataSourceSurface* aSource, DataSourceSurface void FilterProcessing::SeparateColorChannels(DataSourceSurface* aSource, - RefPtr& aChannel0, - RefPtr& aChannel1, - RefPtr& aChannel2, - RefPtr& aChannel3) + nsRefPtr& aChannel0, + nsRefPtr& aChannel1, + nsRefPtr& aChannel2, + nsRefPtr& aChannel3) { IntSize size = aSource->GetSize(); aChannel0 = Factory::CreateDataSourceSurface(size, SurfaceFormat::A8); @@ -169,7 +169,7 @@ FilterProcessing::CombineColorChannels(DataSourceSurface* aChannel0, DataSourceS DataSourceSurface* aChannel2, DataSourceSurface* aChannel3) { IntSize size = aChannel0->GetSize(); - RefPtr result = + nsRefPtr result = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (MOZ2D_WARN_IF(!result)) { return nullptr; diff --git a/gfx/2d/FilterProcessing.h b/gfx/2d/FilterProcessing.h index 802d791a07a..189c1bf8442 100644 --- a/gfx/2d/FilterProcessing.h +++ b/gfx/2d/FilterProcessing.h @@ -45,10 +45,10 @@ public: static already_AddRefed ApplyColorMatrix(DataSourceSurface* aInput, const Matrix5x4 &aMatrix); static void ApplyComposition(DataSourceSurface* aSource, DataSourceSurface* aDest, CompositeOperator aOperator); static void SeparateColorChannels(DataSourceSurface* aSource, - RefPtr& aChannel0, - RefPtr& aChannel1, - RefPtr& aChannel2, - RefPtr& aChannel3); + nsRefPtr& aChannel0, + nsRefPtr& aChannel1, + nsRefPtr& aChannel2, + nsRefPtr& aChannel3); static already_AddRefed CombineColorChannels(DataSourceSurface* aChannel0, DataSourceSurface* aChannel1, DataSourceSurface* aChannel2, DataSourceSurface* aChannel3); diff --git a/gfx/2d/FilterProcessingSIMD-inl.h b/gfx/2d/FilterProcessingSIMD-inl.h index 21306a8f203..6027cc75e9a 100644 --- a/gfx/2d/FilterProcessingSIMD-inl.h +++ b/gfx/2d/FilterProcessingSIMD-inl.h @@ -16,8 +16,8 @@ inline already_AddRefed ConvertToB8G8R8A8_SIMD(SourceSurface* aSurface) { IntSize size = aSurface->GetSize(); - RefPtr input = aSurface->GetDataSurface(); - RefPtr output = + nsRefPtr input = aSurface->GetDataSurface(); + nsRefPtr output = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); uint8_t *inputData = input->GetData(); uint8_t *outputData = output->GetData(); @@ -288,7 +288,7 @@ inline already_AddRefed ApplyBlending_SIMD(DataSourceSurface* aInput1, DataSourceSurface* aInput2) { IntSize size = aInput1->GetSize(); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (!target) { return nullptr; @@ -513,7 +513,7 @@ static already_AddRefed ApplyColorMatrix_SIMD(DataSourceSurface* aInput, const Matrix5x4 &aMatrix) { IntSize size = aInput->GetSize(); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (!target) { return nullptr; @@ -1018,7 +1018,7 @@ ApplyArithmeticCombine_SIMD(DataSourceSurface* aInput1, DataSourceSurface* aInpu Float aK1, Float aK2, Float aK3, Float aK4) { IntSize size = aInput1->GetSize(); - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8); if (!target) { return nullptr; diff --git a/gfx/2d/Filters.h b/gfx/2d/Filters.h index 2b6d1622818..e1c09c3bab3 100644 --- a/gfx/2d/Filters.h +++ b/gfx/2d/Filters.h @@ -7,7 +7,7 @@ #define MOZILLA_GFX_FILTERS_H_ #include "Types.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "Point.h" #include "Matrix.h" diff --git a/gfx/2d/GenericRefCounted.h b/gfx/2d/GenericRefCounted.h index bee792b4de7..ca79490e7f9 100644 --- a/gfx/2d/GenericRefCounted.h +++ b/gfx/2d/GenericRefCounted.h @@ -10,7 +10,7 @@ #ifndef MOZILLA_GENERICREFCOUNTED_H_ #define MOZILLA_GENERICREFCOUNTED_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/RefCounted.h" namespace mozilla { diff --git a/gfx/2d/GradientStopsD2D.h b/gfx/2d/GradientStopsD2D.h index de6e448dec6..2b444c18275 100644 --- a/gfx/2d/GradientStopsD2D.h +++ b/gfx/2d/GradientStopsD2D.h @@ -30,8 +30,8 @@ private: friend class DrawTargetD2D; friend class DrawTargetD2D1; - mutable RefPtr mStopCollection; - RefPtr mDevice; + mutable nsRefPtr mStopCollection; + nsRefPtr mDevice; }; } diff --git a/gfx/2d/Helpers.h b/gfx/2d/Helpers.h index 11c7eec5d94..6d4f23e2fbd 100644 --- a/gfx/2d/Helpers.h +++ b/gfx/2d/Helpers.h @@ -41,7 +41,7 @@ class AutoRestoreTransform } private: - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; Matrix mOldTransform; }; @@ -87,7 +87,7 @@ public: } private: - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; int32_t mPushCount; }; diff --git a/gfx/2d/HelpersD2D.h b/gfx/2d/HelpersD2D.h index 45de61aa82d..46d429e70fc 100644 --- a/gfx/2d/HelpersD2D.h +++ b/gfx/2d/HelpersD2D.h @@ -425,18 +425,18 @@ DWriteGlyphRunFromGlyphs(const GlyphBuffer &aGlyphs, ScaledFontDWrite *aFont, Au static inline already_AddRefed ConvertRectToGeometry(const D2D1_RECT_F& aRect) { - RefPtr rectGeom; - D2DFactory()->CreateRectangleGeometry(&aRect, byRef(rectGeom)); + nsRefPtr rectGeom; + D2DFactory()->CreateRectangleGeometry(&aRect, getter_AddRefs(rectGeom)); return rectGeom.forget(); } static inline already_AddRefed GetTransformedGeometry(ID2D1Geometry *aGeometry, const D2D1_MATRIX_3X2_F &aTransform) { - RefPtr tmpGeometry; - D2DFactory()->CreatePathGeometry(byRef(tmpGeometry)); - RefPtr currentSink; - tmpGeometry->Open(byRef(currentSink)); + nsRefPtr tmpGeometry; + D2DFactory()->CreatePathGeometry(getter_AddRefs(tmpGeometry)); + nsRefPtr currentSink; + tmpGeometry->Open(getter_AddRefs(currentSink)); aGeometry->Simplify(D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES, aTransform, currentSink); currentSink->Close(); @@ -446,10 +446,10 @@ GetTransformedGeometry(ID2D1Geometry *aGeometry, const D2D1_MATRIX_3X2_F &aTrans static inline already_AddRefed IntersectGeometry(ID2D1Geometry *aGeometryA, ID2D1Geometry *aGeometryB) { - RefPtr pathGeom; - D2DFactory()->CreatePathGeometry(byRef(pathGeom)); - RefPtr sink; - pathGeom->Open(byRef(sink)); + nsRefPtr pathGeom; + D2DFactory()->CreatePathGeometry(getter_AddRefs(pathGeom)); + nsRefPtr sink; + pathGeom->Open(getter_AddRefs(sink)); aGeometryA->CombineWithGeometry(aGeometryB, D2D1_COMBINE_MODE_INTERSECT, nullptr, sink); sink->Close(); @@ -459,7 +459,7 @@ IntersectGeometry(ID2D1Geometry *aGeometryA, ID2D1Geometry *aGeometryB) static inline already_AddRefed CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions) { - RefPtr style; + nsRefPtr style; D2D1_CAP_STYLE capStyle; D2D1_LINE_JOIN joinStyle; @@ -517,13 +517,13 @@ CreateStrokeStyleForOptions(const StrokeOptions &aStrokeOptions) &dash[0], // data() is not C++98, although it's in recent gcc // and VC10's STL dash.size(), - byRef(style)); + getter_AddRefs(style)); } else { hr = D2DFactory()->CreateStrokeStyle( D2D1::StrokeStyleProperties(capStyle, capStyle, capStyle, joinStyle, aStrokeOptions.mMiterLimit), - nullptr, 0, byRef(style)); + nullptr, 0, getter_AddRefs(style)); } if (FAILED(hr)) { @@ -542,7 +542,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin Matrix &aSourceTransform, ID2D1RenderTarget *aRT, const IntRect* aSourceRect = nullptr) { - RefPtr bitmap; + nsRefPtr bitmap; // This is where things get complicated. The source surface was // created for a surface that was too large to fit in a texture. @@ -616,7 +616,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin mapping.GetData() + int(uploadRect.x) * 4 + int(uploadRect.y) * mapping.GetStride(), mapping.GetStride(), D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())), - byRef(bitmap)); + getter_AddRefs(bitmap)); } aSourceTransform.PreTranslate(uploadRect.x, uploadRect.y); @@ -673,7 +673,7 @@ CreatePartialBitmapForSurface(DataSourceSurface *aSurface, const Matrix &aDestin aRT->CreateBitmap(D2D1::SizeU(newSize.width, newSize.height), scaler.GetScaledData(), scaler.GetStride(), D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())), - byRef(bitmap)); + getter_AddRefs(bitmap)); aSourceTransform.PreScale(Float(size.width) / newSize.width, Float(size.height) / newSize.height); diff --git a/gfx/2d/JobScheduler.cpp b/gfx/2d/JobScheduler.cpp index 2294380d0b2..5ebb72a3de6 100644 --- a/gfx/2d/JobScheduler.cpp +++ b/gfx/2d/JobScheduler.cpp @@ -65,7 +65,7 @@ void JobScheduler::SubmitJob(Job* aJob) { MOZ_ASSERT(aJob); - RefPtr start = aJob->GetStartSync(); + nsRefPtr start = aJob->GetStartSync(); if (start && start->Register(aJob)) { // The Job buffer starts with a non-signaled sync object, it // is now registered in the list of task buffers waiting on the @@ -203,7 +203,7 @@ void SyncObject::SubmitWaitingJobs() // be owned by another thread. We need to make sure the reference count // does not reach 0 on another thread before the end of this method, so // hold a strong ref to prevent that! - RefPtr kungFuDeathGrip(this); + nsRefPtr kungFuDeathGrip(this); // First atomically swap mFirstWaitingJob and waitingJobs... Job* waitingJobs = nullptr; diff --git a/gfx/2d/JobScheduler.h b/gfx/2d/JobScheduler.h index 55dae4e6b70..24102dfbacf 100644 --- a/gfx/2d/JobScheduler.h +++ b/gfx/2d/JobScheduler.h @@ -6,7 +6,7 @@ #ifndef MOZILLA_GFX_TASKSCHEDULER_H_ #define MOZILLA_GFX_TASKSCHEDULER_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/Types.h" #include "mozilla/RefCounted.h" @@ -115,8 +115,8 @@ protected: // should be null. This is only accessed from the thread that owns the task. Job* mNextWaitingJob; - RefPtr mStartSync; - RefPtr mCompletionSync; + nsRefPtr mStartSync; + nsRefPtr mCompletionSync; WorkerThread* mPinToThread; friend class SyncObject; @@ -142,7 +142,7 @@ public: EventObject* GetEvent() { return mEvent; } protected: - RefPtr mEvent; + nsRefPtr mEvent; }; /// A synchronization object that can be used to express dependencies and ordering between diff --git a/gfx/2d/JobScheduler_posix.h b/gfx/2d/JobScheduler_posix.h index fdc554068d1..4620326c5ea 100644 --- a/gfx/2d/JobScheduler_posix.h +++ b/gfx/2d/JobScheduler_posix.h @@ -14,7 +14,7 @@ #include #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/DebugOnly.h" #include "mozilla/gfx/CriticalSection.h" #include "mozilla/RefCounted.h" diff --git a/gfx/2d/JobScheduler_win32.h b/gfx/2d/JobScheduler_win32.h index 73ccbd4edfd..6af01dbeff6 100644 --- a/gfx/2d/JobScheduler_win32.h +++ b/gfx/2d/JobScheduler_win32.h @@ -10,7 +10,7 @@ #include #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/CriticalSection.h" #include "mozilla/RefCounted.h" diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp index 4ac0a505ce6..2d6f6035c59 100644 --- a/gfx/2d/MacIOSurface.cpp +++ b/gfx/2d/MacIOSurface.cpp @@ -8,7 +8,7 @@ #include #include #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Assertions.h" using namespace mozilla; @@ -332,7 +332,7 @@ already_AddRefed MacIOSurface::CreateIOSurface(int aWidth, int aHe if (!surfaceRef) return nullptr; - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); + nsRefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); if (!ioSurface) { ::CFRelease(surfaceRef); return nullptr; @@ -354,7 +354,7 @@ already_AddRefed MacIOSurface::LookupSurface(IOSurfaceID aIOSurfac if (!surfaceRef) return nullptr; - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); + nsRefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); if (!ioSurface) { ::CFRelease(surfaceRef); return nullptr; @@ -464,7 +464,7 @@ MacIOSurface::GetAsSurface() { SurfaceFormat format = HasAlpha() ? mozilla::gfx::SurfaceFormat::B8G8R8A8 : mozilla::gfx::SurfaceFormat::B8G8R8X8; - RefPtr surf = new SourceSurfaceRawData(); + nsRefPtr surf = new SourceSurfaceRawData(); surf->InitWrappingData(dataCpy, IntSize(ioWidth, ioHeight), bytesPerRow, format, true); return surf.forget(); @@ -554,7 +554,7 @@ already_AddRefed MacIOSurface::IOSurfaceContextGetSurface(CGContex if (!surfaceRef) return nullptr; - RefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); + nsRefPtr ioSurface = new MacIOSurface(surfaceRef, aContentsScaleFactor, aHasAlpha); if (!ioSurface) { ::CFRelease(surfaceRef); return nullptr; diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h index dc2d773e508..5b5e30103ff 100644 --- a/gfx/2d/MacIOSurface.h +++ b/gfx/2d/MacIOSurface.h @@ -44,7 +44,7 @@ typedef OSType (*IOSurfacePixelFormatFunc)(IOSurfacePtr io_surface); #import #include "2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/RefCounted.h" struct _CGLContextObject; diff --git a/gfx/2d/PathCairo.cpp b/gfx/2d/PathCairo.cpp index 9c7ba587467..befa208d002 100644 --- a/gfx/2d/PathCairo.cpp +++ b/gfx/2d/PathCairo.cpp @@ -162,7 +162,7 @@ PathCairo::~PathCairo() already_AddRefed PathCairo::CopyToBuilder(FillRule aFillRule) const { - RefPtr builder = new PathBuilderCairo(aFillRule); + nsRefPtr builder = new PathBuilderCairo(aFillRule); builder->mPathData = mPathData; builder->mCurrentPoint = mCurrentPoint; @@ -173,7 +173,7 @@ PathCairo::CopyToBuilder(FillRule aFillRule) const already_AddRefed PathCairo::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const { - RefPtr builder = new PathBuilderCairo(aFillRule); + nsRefPtr builder = new PathBuilderCairo(aFillRule); AppendPathToBuilder(builder, &aTransform); builder->mCurrentPoint = aTransform * mCurrentPoint; diff --git a/gfx/2d/PathD2D.cpp b/gfx/2d/PathD2D.cpp index 2032862dc71..ffca2a4ff2f 100644 --- a/gfx/2d/PathD2D.cpp +++ b/gfx/2d/PathD2D.cpp @@ -356,16 +356,16 @@ PathD2D::CopyToBuilder(FillRule aFillRule) const already_AddRefed PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const { - RefPtr path; - HRESULT hr = DrawTargetD2D::factory()->CreatePathGeometry(byRef(path)); + nsRefPtr path; + HRESULT hr = DrawTargetD2D::factory()->CreatePathGeometry(getter_AddRefs(path)); if (FAILED(hr)) { gfxWarning() << "Failed to create PathGeometry. Code: " << hexa(hr); return nullptr; } - RefPtr sink; - hr = path->Open(byRef(sink)); + nsRefPtr sink; + hr = path->Open(getter_AddRefs(sink)); if (FAILED(hr)) { gfxWarning() << "Failed to open Geometry for writing. Code: " << hexa(hr); return nullptr; @@ -386,7 +386,7 @@ PathD2D::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) sink); } - RefPtr pathBuilder = new PathBuilderD2D(sink, path, aFillRule, mBackendType); + nsRefPtr pathBuilder = new PathBuilderD2D(sink, path, aFillRule, mBackendType); pathBuilder->mCurrentPoint = aTransform * mEndPoint; @@ -435,7 +435,7 @@ PathD2D::StrokeContainsPoint(const StrokeOptions &aStrokeOptions, { BOOL result; - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); HRESULT hr = mGeometry->StrokeContainsPoint(D2DPoint(aPoint), aStrokeOptions.mLineWidth, strokeStyle, @@ -472,7 +472,7 @@ PathD2D::GetStrokedBounds(const StrokeOptions &aStrokeOptions, { D2D1_RECT_F d2dBounds; - RefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); + nsRefPtr strokeStyle = CreateStrokeStyleForOptions(aStrokeOptions); HRESULT hr = mGeometry->GetWidenedBounds(aStrokeOptions.mLineWidth, strokeStyle, D2DMatrix(aTransform), &d2dBounds); diff --git a/gfx/2d/PathD2D.h b/gfx/2d/PathD2D.h index 31977bc50bd..4a6b8bc2868 100644 --- a/gfx/2d/PathD2D.h +++ b/gfx/2d/PathD2D.h @@ -52,8 +52,8 @@ private: void EnsureActive(const Point &aPoint); - RefPtr mSink; - RefPtr mGeometry; + nsRefPtr mSink; + nsRefPtr mGeometry; bool mFigureActive; Point mCurrentPoint; @@ -102,7 +102,7 @@ private: friend class DrawTargetD2D; friend class DrawTargetD2D1; - mutable RefPtr mGeometry; + mutable nsRefPtr mGeometry; bool mEndedActive; Point mEndPoint; FillRule mFillRule; diff --git a/gfx/2d/PathHelpers.h b/gfx/2d/PathHelpers.h index 4dbc0aac8fb..4b051e0a9d3 100644 --- a/gfx/2d/PathHelpers.h +++ b/gfx/2d/PathHelpers.h @@ -184,7 +184,7 @@ inline already_AddRefed MakePathForRect(const DrawTarget& aDrawTarget, const Rect& aRect, bool aDrawClockwise = true) { - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); AppendRectToPath(builder, aRect, aDrawClockwise); return builder->Finish(); } @@ -277,7 +277,7 @@ inline already_AddRefed MakePathForRoundedRect(const DrawTarget& aDrawTarg const RectCornerRadii& aRadii, bool aDrawClockwise = true) { - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); AppendRoundedRectToPath(builder, aRect, aRadii, aDrawClockwise); return builder->Finish(); } @@ -297,7 +297,7 @@ inline already_AddRefed MakePathForEllipse(const DrawTarget& aDrawTarget, const Point& aCenter, const Size& aDimensions) { - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); AppendEllipseToPath(builder, aCenter, aDimensions); return builder->Finish(); } diff --git a/gfx/2d/PathRecording.cpp b/gfx/2d/PathRecording.cpp index 03fd4cb5a55..21318744136 100644 --- a/gfx/2d/PathRecording.cpp +++ b/gfx/2d/PathRecording.cpp @@ -72,7 +72,7 @@ PathBuilderRecording::CurrentPoint() const already_AddRefed PathBuilderRecording::Finish() { - RefPtr path = mPathBuilder->Finish(); + nsRefPtr path = mPathBuilder->Finish(); return MakeAndAddRef(path, mPathOps, mFillRule); } @@ -87,8 +87,8 @@ PathRecording::~PathRecording() already_AddRefed PathRecording::CopyToBuilder(FillRule aFillRule) const { - RefPtr pathBuilder = mPath->CopyToBuilder(aFillRule); - RefPtr recording = new PathBuilderRecording(pathBuilder, aFillRule); + nsRefPtr pathBuilder = mPath->CopyToBuilder(aFillRule); + nsRefPtr recording = new PathBuilderRecording(pathBuilder, aFillRule); recording->mPathOps = mPathOps; return recording.forget(); } @@ -96,8 +96,8 @@ PathRecording::CopyToBuilder(FillRule aFillRule) const already_AddRefed PathRecording::TransformedCopyToBuilder(const Matrix &aTransform, FillRule aFillRule) const { - RefPtr pathBuilder = mPath->TransformedCopyToBuilder(aTransform, aFillRule); - RefPtr recording = new PathBuilderRecording(pathBuilder, aFillRule); + nsRefPtr pathBuilder = mPath->TransformedCopyToBuilder(aTransform, aFillRule); + nsRefPtr recording = new PathBuilderRecording(pathBuilder, aFillRule); typedef std::vector pathOpVec; for (pathOpVec::const_iterator iter = mPathOps.begin(); iter != mPathOps.end(); iter++) { PathOp newPathOp; diff --git a/gfx/2d/PathRecording.h b/gfx/2d/PathRecording.h index 2d3e4eb9cd4..ee707e16bf1 100644 --- a/gfx/2d/PathRecording.h +++ b/gfx/2d/PathRecording.h @@ -77,7 +77,7 @@ public: private: friend class PathRecording; - RefPtr mPathBuilder; + nsRefPtr mPathBuilder; FillRule mFillRule; std::vector mPathOps; }; @@ -122,7 +122,7 @@ private: friend class DrawTargetRecording; friend class RecordedPathCreation; - RefPtr mPath; + nsRefPtr mPath; std::vector mPathOps; FillRule mFillRule; diff --git a/gfx/2d/QuartzSupport.h b/gfx/2d/QuartzSupport.h index 60a5b9c299e..01b45491920 100644 --- a/gfx/2d/QuartzSupport.h +++ b/gfx/2d/QuartzSupport.h @@ -12,7 +12,7 @@ #import #import "ApplicationServices/ApplicationServices.h" #include "gfxTypes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/MacIOSurface.h" #include "nsError.h" @@ -84,7 +84,7 @@ private: _CGLContextObject *mOpenGLContext; CGImageRef mCGImage; void *mCGData; - mozilla::RefPtr mIOSurface; + nsRefPtr mIOSurface; uint32_t mFBO; uint32_t mIOTexture; int mUnsupportedWidth; diff --git a/gfx/2d/QuartzSupport.mm b/gfx/2d/QuartzSupport.mm index 74589d93d30..f1fc3f5e549 100644 --- a/gfx/2d/QuartzSupport.mm +++ b/gfx/2d/QuartzSupport.mm @@ -25,7 +25,6 @@ - (void)setContentsScale:(double)scale; @end -using mozilla::RefPtr; CGColorSpaceRef CreateSystemColorSpace() { CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID()); @@ -421,7 +420,7 @@ nsresult nsCARenderer::Render(int aWidth, int aHeight, // mIOSurface is set by AttachIOSurface(), not by SetupRenderer(). So // since it may have been set by a prior call to AttachIOSurface(), we // need to preserve it across the call to Destroy(). - mozilla::RefPtr ioSurface = mIOSurface; + nsRefPtr ioSurface = mIOSurface; Destroy(); mIOSurface = ioSurface; if (SetupRenderer(caLayer, aWidth, aHeight, aContentsScaleFactor, diff --git a/gfx/2d/RadialGradientEffectD2D1.cpp b/gfx/2d/RadialGradientEffectD2D1.cpp index 403bdb2ddf1..57db19618a2 100644 --- a/gfx/2d/RadialGradientEffectD2D1.cpp +++ b/gfx/2d/RadialGradientEffectD2D1.cpp @@ -132,7 +132,7 @@ RadialGradientEffectD2D1::PrepareForRender(D2D1_CHANGE_TYPE changeType) return hr; } - RefPtr tex = CreateGradientTexture(); + nsRefPtr tex = CreateGradientTexture(); hr = mDrawInfo->SetResourceTexture(1, tex); if (FAILED(hr)) { @@ -302,7 +302,7 @@ RadialGradientEffectD2D1::CreateEffect(IUnknown **aEffectImpl) HRESULT RadialGradientEffectD2D1::SetStopCollection(IUnknown *aStopCollection) { - if (SUCCEEDED(aStopCollection->QueryInterface((ID2D1GradientStopCollection**)byRef(mStopCollection)))) { + if (SUCCEEDED(aStopCollection->QueryInterface((ID2D1GradientStopCollection**)getter_AddRefs(mStopCollection)))) { return S_OK; } @@ -370,7 +370,7 @@ RadialGradientEffectD2D1::CreateGradientTexture() texData[i * 4 + 3] = (char)(255.0f * newColor.a); } - RefPtr tex; + nsRefPtr tex; UINT32 width = 4096; UINT32 stride = 4096 * 4; @@ -385,7 +385,7 @@ RadialGradientEffectD2D1::CreateGradientTexture() D2D1_EXTEND_MODE extendMode[] = { mStopCollection->GetExtendMode(), mStopCollection->GetExtendMode() }; props.extendModes = extendMode; - HRESULT hr = mEffectContext->CreateResourceTexture(nullptr, &props, &textureData.front(), &stride, 4096 * 4, byRef(tex)); + HRESULT hr = mEffectContext->CreateResourceTexture(nullptr, &props, &textureData.front(), &stride, 4096 * 4, getter_AddRefs(tex)); if (FAILED(hr)) { gfxWarning() << "Failed to create resource texture: " << hexa(hr); diff --git a/gfx/2d/RadialGradientEffectD2D1.h b/gfx/2d/RadialGradientEffectD2D1.h index baa02aafb7e..c9702597a18 100644 --- a/gfx/2d/RadialGradientEffectD2D1.h +++ b/gfx/2d/RadialGradientEffectD2D1.h @@ -84,9 +84,9 @@ private: RadialGradientEffectD2D1(); uint32_t mRefCount; - RefPtr mStopCollection; - RefPtr mEffectContext; - RefPtr mDrawInfo; + nsRefPtr mStopCollection; + nsRefPtr mEffectContext; + nsRefPtr mDrawInfo; SIMPLE_PROP(D2D1_VECTOR_2F, Center1); SIMPLE_PROP(D2D1_VECTOR_2F, Center2); SIMPLE_PROP(FLOAT, Radius1); diff --git a/gfx/2d/RecordedEvent.cpp b/gfx/2d/RecordedEvent.cpp index 1b3876976f8..f75c0e522bf 100644 --- a/gfx/2d/RecordedEvent.cpp +++ b/gfx/2d/RecordedEvent.cpp @@ -365,7 +365,7 @@ RecordedDrawingEvent::GetObjectRef() const void RecordedDrawTargetCreation::PlayEvent(Translator *aTranslator) const { - RefPtr newDT = + nsRefPtr newDT = aTranslator->GetReferenceDrawTarget()->CreateSimilarDrawTarget(mSize, mFormat); aTranslator->AddDrawTarget(mRefPtr, newDT); @@ -387,7 +387,7 @@ RecordedDrawTargetCreation::RecordToStream(ostream &aStream) const if (mHasExistingData) { MOZ_ASSERT(mExistingData); MOZ_ASSERT(mExistingData->GetSize() == mSize); - RefPtr dataSurf = mExistingData->GetDataSurface(); + nsRefPtr dataSurf = mExistingData->GetDataSurface(); for (int y = 0; y < mSize.height; y++) { aStream.write((const char*)dataSurf->GetData() + y * dataSurf->Stride(), BytesPerPixel(mFormat) * mSize.width); @@ -406,7 +406,7 @@ RecordedDrawTargetCreation::RecordedDrawTargetCreation(istream &aStream) ReadElement(aStream, mHasExistingData); if (mHasExistingData) { - RefPtr dataSurf = Factory::CreateDataSourceSurface(mSize, mFormat); + nsRefPtr dataSurf = Factory::CreateDataSourceSurface(mSize, mFormat); if (!dataSurf) { gfxWarning() << "RecordedDrawTargetCreation had to reset mHasExistingData"; mHasExistingData = false; @@ -1024,7 +1024,7 @@ RecordedPathCreation::~RecordedPathCreation() void RecordedPathCreation::PlayEvent(Translator *aTranslator) const { - RefPtr builder = + nsRefPtr builder = aTranslator->GetReferenceDrawTarget()->CreatePathBuilder(mFillRule); for (size_t i = 0; i < mPathOps.size(); i++) { @@ -1048,7 +1048,7 @@ RecordedPathCreation::PlayEvent(Translator *aTranslator) const } } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); aTranslator->AddPath(mRefPtr, path); } @@ -1140,7 +1140,7 @@ RecordedSourceSurfaceCreation::~RecordedSourceSurfaceCreation() void RecordedSourceSurfaceCreation::PlayEvent(Translator *aTranslator) const { - RefPtr src = aTranslator->GetReferenceDrawTarget()-> + nsRefPtr src = aTranslator->GetReferenceDrawTarget()-> CreateSourceSurfaceFromData(mData, mSize, mSize.width * BytesPerPixel(mFormat), mFormat); aTranslator->AddSourceSurface(mRefPtr, src); } @@ -1203,7 +1203,7 @@ RecordedFilterNodeCreation::~RecordedFilterNodeCreation() void RecordedFilterNodeCreation::PlayEvent(Translator *aTranslator) const { - RefPtr node = aTranslator->GetReferenceDrawTarget()-> + nsRefPtr node = aTranslator->GetReferenceDrawTarget()-> CreateFilter(mType); aTranslator->AddFilterNode(mRefPtr, node); } @@ -1262,7 +1262,7 @@ RecordedGradientStopsCreation::~RecordedGradientStopsCreation() void RecordedGradientStopsCreation::PlayEvent(Translator *aTranslator) const { - RefPtr src = aTranslator->GetReferenceDrawTarget()-> + nsRefPtr src = aTranslator->GetReferenceDrawTarget()-> CreateGradientStops(mStops, mNumStops, mExtendMode); aTranslator->AddGradientStops(mRefPtr, src); } @@ -1320,7 +1320,7 @@ RecordedGradientStopsDestruction::OutputSimpleEventInfo(stringstream &aStringStr void RecordedSnapshot::PlayEvent(Translator *aTranslator) const { - RefPtr src = aTranslator->LookupDrawTarget(mDT)->Snapshot(); + nsRefPtr src = aTranslator->LookupDrawTarget(mDT)->Snapshot(); aTranslator->AddSourceSurface(mRefPtr, src); } @@ -1352,7 +1352,7 @@ RecordedScaledFontCreation::~RecordedScaledFontCreation() void RecordedScaledFontCreation::PlayEvent(Translator *aTranslator) const { - RefPtr scaledFont = + nsRefPtr scaledFont = Factory::CreateScaledFontForTrueTypeData(mData, mSize, mIndex, mGlyphSize, aTranslator->GetDesiredFontType()); aTranslator->AddScaledFont(mRefPtr, scaledFont); diff --git a/gfx/2d/RecordedEvent.h b/gfx/2d/RecordedEvent.h index 242bff632a9..3613724981e 100644 --- a/gfx/2d/RecordedEvent.h +++ b/gfx/2d/RecordedEvent.h @@ -36,7 +36,7 @@ struct ReferencePtr {} template - MOZ_IMPLICIT ReferencePtr(const RefPtr& aPtr) + MOZ_IMPLICIT ReferencePtr(const nsRefPtr& aPtr) : mLongPtr(uint64_t(aPtr.get())) {} @@ -46,7 +46,7 @@ struct ReferencePtr } template - ReferencePtr &operator =(const RefPtr& aPtr) { + ReferencePtr &operator =(const nsRefPtr& aPtr) { mLongPtr = uint64_t(aPtr.get()); return *this; } @@ -250,7 +250,7 @@ public: IntSize mSize; SurfaceFormat mFormat; bool mHasExistingData; - RefPtr mExistingData; + nsRefPtr mExistingData; private: friend class RecordedEvent; diff --git a/gfx/2d/SVGTurbulenceRenderer-inl.h b/gfx/2d/SVGTurbulenceRenderer-inl.h index 7b18903e86e..7c953c08d40 100644 --- a/gfx/2d/SVGTurbulenceRenderer-inl.h +++ b/gfx/2d/SVGTurbulenceRenderer-inl.h @@ -330,7 +330,7 @@ template SVGTurbulenceRenderer::Render(const IntSize &aSize, const Point &aOffset) const { - RefPtr target = + nsRefPtr target = Factory::CreateDataSourceSurface(aSize, SurfaceFormat::B8G8R8A8); if (!target) { return nullptr; diff --git a/gfx/2d/ScaledFontBase.cpp b/gfx/2d/ScaledFontBase.cpp index 0e5fbd38e10..13feafd37c5 100644 --- a/gfx/2d/ScaledFontBase.cpp +++ b/gfx/2d/ScaledFontBase.cpp @@ -112,7 +112,7 @@ ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *a cairo_glyph_path(ctx, &glyphs[0], aBuffer.mNumGlyphs); - RefPtr newPath = new PathCairo(ctx); + nsRefPtr newPath = new PathCairo(ctx); if (isNewContext) { cairo_destroy(ctx); } @@ -157,7 +157,7 @@ ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBu cairo_set_scaled_font(ctx, mScaledFont); cairo_glyph_path(ctx, &glyphs[0], aBuffer.mNumGlyphs); - RefPtr cairoPath = new PathCairo(ctx); + nsRefPtr cairoPath = new PathCairo(ctx); cairo_destroy(ctx); cairoPath->AppendPathToBuilder(builder); diff --git a/gfx/2d/ScaledFontDWrite.cpp b/gfx/2d/ScaledFontDWrite.cpp index 85873da933a..7ed11359a73 100644 --- a/gfx/2d/ScaledFontDWrite.cpp +++ b/gfx/2d/ScaledFontDWrite.cpp @@ -294,14 +294,14 @@ ScaledFontDWrite::ScaledFontDWrite(uint8_t *aData, uint32_t aSize, key.mData = aData; key.mSize = aSize; - RefPtr fontFile; - if (FAILED(factory->CreateCustomFontFileReference(&key, sizeof(ffReferenceKey), DWriteFontFileLoader::Instance(), byRef(fontFile)))) { + nsRefPtr fontFile; + if (FAILED(factory->CreateCustomFontFileReference(&key, sizeof(ffReferenceKey), DWriteFontFileLoader::Instance(), getter_AddRefs(fontFile)))) { gfxWarning() << "Failed to load font file from data!"; return; } IDWriteFontFile *ff = fontFile; - if (FAILED(factory->CreateFontFace(DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &ff, aIndex, DWRITE_FONT_SIMULATIONS_NONE, byRef(mFontFace)))) { + if (FAILED(factory->CreateFontFace(DWRITE_FONT_FACE_TYPE_TRUETYPE, 1, &ff, aIndex, DWRITE_FONT_SIMULATIONS_NONE, getter_AddRefs(mFontFace)))) { gfxWarning() << "Failed to create font face from font file data!"; } } @@ -313,7 +313,7 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget return ScaledFontBase::GetPathForGlyphs(aBuffer, aTarget); } - RefPtr pathBuilder = aTarget->CreatePathBuilder(); + nsRefPtr pathBuilder = aTarget->CreatePathBuilder(); PathBuilderD2D *pathBuilderD2D = static_cast(pathBuilder.get()); @@ -370,8 +370,8 @@ ScaledFontDWrite::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton return false; } - RefPtr file; - mFontFace->GetFiles(&fileCount, byRef(file)); + nsRefPtr file; + mFontFace->GetFiles(&fileCount, getter_AddRefs(file)); const void *referenceKey; UINT32 refKeySize; @@ -381,11 +381,11 @@ ScaledFontDWrite::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton // have to happen inside thebes. file->GetReferenceKey(&referenceKey, &refKeySize); - RefPtr loader; - file->GetLoader(byRef(loader)); + nsRefPtr loader; + file->GetLoader(getter_AddRefs(loader)); - RefPtr stream; - loader->CreateStreamFromKey(referenceKey, refKeySize, byRef(stream)); + nsRefPtr stream; + loader->CreateStreamFromKey(referenceKey, refKeySize, getter_AddRefs(stream)); UINT64 fileSize64; stream->GetFileSize(&fileSize64); diff --git a/gfx/2d/ScaledFontDWrite.h b/gfx/2d/ScaledFontDWrite.h index a517ab55db0..68b2819612e 100644 --- a/gfx/2d/ScaledFontDWrite.h +++ b/gfx/2d/ScaledFontDWrite.h @@ -43,7 +43,7 @@ public: } #endif - RefPtr mFontFace; + nsRefPtr mFontFace; }; class GlyphRenderingOptionsDWrite : public GlyphRenderingOptions @@ -61,7 +61,7 @@ private: friend class DrawTargetD2D; friend class DrawTargetD2D1; - RefPtr mParams; + nsRefPtr mParams; }; } diff --git a/gfx/2d/ScaledFontMac.cpp b/gfx/2d/ScaledFontMac.cpp index 7c68b90d993..f923f0f301f 100644 --- a/gfx/2d/ScaledFontMac.cpp +++ b/gfx/2d/ScaledFontMac.cpp @@ -94,7 +94,7 @@ ScaledFontMac::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aT CGPathAddPath(path, &matrix, glyphPath); CGPathRelease(glyphPath); } - RefPtr ret = new PathCG(path, FillRule::FILL_WINDING); + nsRefPtr ret = new PathCG(path, FillRule::FILL_WINDING); CGPathRelease(path); return ret.forget(); } diff --git a/gfx/2d/SourceSurfaceCG.cpp b/gfx/2d/SourceSurfaceCG.cpp index b2627b44036..ea90978c844 100644 --- a/gfx/2d/SourceSurfaceCG.cpp +++ b/gfx/2d/SourceSurfaceCG.cpp @@ -41,7 +41,7 @@ SourceSurfaceCG::GetDataSurface() { //XXX: we should be more disciplined about who takes a reference and where CGImageRetain(mImage); - RefPtr dataSurf = new DataSourceSurfaceCG(mImage); + nsRefPtr dataSurf = new DataSourceSurfaceCG(mImage); // We also need to make sure that the returned surface has // surface->GetType() == SurfaceType::DATA. @@ -388,7 +388,7 @@ SourceSurfaceCGIOSurfaceContext::SourceSurfaceCGIOSurfaceContext(DrawTargetCG *a { CGContextRef cg = (CGContextRef)aDrawTarget->GetNativeSurface(NativeSurfaceType::CGCONTEXT_ACCELERATED); - RefPtr surf = MacIOSurface::IOSurfaceContextGetSurface(cg); + nsRefPtr surf = MacIOSurface::IOSurfaceContextGetSurface(cg); mFormat = aDrawTarget->GetFormat(); mSize.width = surf->GetWidth(); diff --git a/gfx/2d/SourceSurfaceCG.h b/gfx/2d/SourceSurfaceCG.h index 5d8655d503a..cda3616a27b 100644 --- a/gfx/2d/SourceSurfaceCG.h +++ b/gfx/2d/SourceSurfaceCG.h @@ -127,7 +127,7 @@ public: // // For more information see bug 925448. DrawTargetWillChange(); - RefPtr copy(this); + nsRefPtr copy(this); return copy.forget(); } diff --git a/gfx/2d/SourceSurfaceCairo.cpp b/gfx/2d/SourceSurfaceCairo.cpp index 2ead9510f3b..9f51ef5466e 100644 --- a/gfx/2d/SourceSurfaceCairo.cpp +++ b/gfx/2d/SourceSurfaceCairo.cpp @@ -61,7 +61,7 @@ SourceSurfaceCairo::GetFormat() const already_AddRefed SourceSurfaceCairo::GetDataSurface() { - RefPtr dataSurf; + nsRefPtr dataSurf; if (cairo_surface_get_type(mSurface) == CAIRO_SURFACE_TYPE_IMAGE) { dataSurf = new DataSourceSurfaceCairo(mSurface); diff --git a/gfx/2d/SourceSurfaceD2D.cpp b/gfx/2d/SourceSurfaceD2D.cpp index 438cdace2cd..995ca668dd8 100644 --- a/gfx/2d/SourceSurfaceD2D.cpp +++ b/gfx/2d/SourceSurfaceD2D.cpp @@ -43,7 +43,7 @@ SourceSurfaceD2D::IsValid() const already_AddRefed SourceSurfaceD2D::GetDataSurface() { - RefPtr result = new DataSourceSurfaceD2D(this); + nsRefPtr result = new DataSourceSurfaceD2D(this); if (result->IsValid()) { return result.forget(); } @@ -69,7 +69,7 @@ SourceSurfaceD2D::InitFromData(unsigned char *aData, } D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(aFormat)); - hr = aRT->CreateBitmap(D2DIntSize(aSize), props, byRef(mBitmap)); + hr = aRT->CreateBitmap(D2DIntSize(aSize), props, getter_AddRefs(mBitmap)); if (FAILED(hr)) { gfxWarning() << "Failed to create D2D Bitmap for data. Code: " << hexa(hr); @@ -96,7 +96,7 @@ SourceSurfaceD2D::InitFromTexture(ID3D10Texture2D *aTexture, { HRESULT hr; - RefPtr surf; + nsRefPtr surf; hr = aTexture->QueryInterface((IDXGISurface**)&surf); @@ -112,14 +112,14 @@ SourceSurfaceD2D::InitFromTexture(ID3D10Texture2D *aTexture, mFormat = aFormat; D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(aFormat)); - hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap)); + hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, getter_AddRefs(mBitmap)); if (FAILED(hr)) { gfxWarning() << "Failed to create SharedBitmap. Code: " << hexa(hr); return false; } - aTexture->GetDevice(byRef(mDevice)); + aTexture->GetDevice(getter_AddRefs(mDevice)); DrawTargetD2D::mVRAMUsageSS += GetByteSize(); return true; @@ -146,16 +146,16 @@ DataSourceSurfaceD2D::DataSourceSurfaceD2D(SourceSurfaceD2D* aSourceSurface) desc.MipLevels = 1; desc.Usage = D3D10_USAGE_DEFAULT; desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE; - RefPtr sourceTexture; + nsRefPtr sourceTexture; HRESULT hr = aSourceSurface->mDevice->CreateTexture2D(&desc, nullptr, - byRef(sourceTexture)); + getter_AddRefs(sourceTexture)); if (FAILED(hr)) { gfxWarning() << "Failed to create texture. Code: " << hexa(hr); return; } - RefPtr dxgiSurface; - hr = sourceTexture->QueryInterface((IDXGISurface**)byRef(dxgiSurface)); + nsRefPtr dxgiSurface; + hr = sourceTexture->QueryInterface((IDXGISurface**)getter_AddRefs(dxgiSurface)); if (FAILED(hr)) { gfxWarning() << "Failed to create DXGI surface. Code: " << hexa(hr); return; @@ -165,10 +165,10 @@ DataSourceSurfaceD2D::DataSourceSurfaceD2D(SourceSurfaceD2D* aSourceSurface) D2D1_RENDER_TARGET_TYPE_DEFAULT, D2D1::PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED)); - RefPtr renderTarget; + nsRefPtr renderTarget; hr = DrawTargetD2D::factory()->CreateDxgiSurfaceRenderTarget(dxgiSurface, &rtProps, - byRef(renderTarget)); + getter_AddRefs(renderTarget)); if (FAILED(hr)) { gfxWarning() << "Failed to create render target. Code: " << hexa(hr); return; @@ -182,8 +182,8 @@ DataSourceSurfaceD2D::DataSourceSurfaceD2D(SourceSurfaceD2D* aSourceSurface) Float(mSize.width), Float(mSize.height))); } else { - RefPtr brush; - renderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), byRef(brush)); + nsRefPtr brush; + renderTarget->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::White), getter_AddRefs(brush)); renderTarget->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); renderTarget->FillOpacityMask(aSourceSurface->mBitmap, brush, D2D1_OPACITY_MASK_CONTENT_GRAPHICS); } @@ -196,7 +196,7 @@ DataSourceSurfaceD2D::DataSourceSurfaceD2D(SourceSurfaceD2D* aSourceSurface) desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ | D3D10_CPU_ACCESS_WRITE; desc.Usage = D3D10_USAGE_STAGING; desc.BindFlags = 0; - hr = aSourceSurface->mDevice->CreateTexture2D(&desc, nullptr, byRef(mTexture)); + hr = aSourceSurface->mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture)); if (FAILED(hr)) { gfxWarning() << "Failed to create staging texture. Code: " << hexa(hr); mTexture = nullptr; diff --git a/gfx/2d/SourceSurfaceD2D.h b/gfx/2d/SourceSurfaceD2D.h index 22ee5f125f9..61353f42aa5 100644 --- a/gfx/2d/SourceSurfaceD2D.h +++ b/gfx/2d/SourceSurfaceD2D.h @@ -45,9 +45,9 @@ private: uint32_t GetByteSize() const; - RefPtr mBitmap; + nsRefPtr mBitmap; // We need to keep this pointer here to check surface validity. - RefPtr mDevice; + nsRefPtr mDevice; SurfaceFormat mFormat; IntSize mSize; }; @@ -75,7 +75,7 @@ public: private: void EnsureMappedTexture(); - RefPtr mTexture; + nsRefPtr mTexture; D3D10_MAPPED_TEXTURE2D mData; diff --git a/gfx/2d/SourceSurfaceD2D1.cpp b/gfx/2d/SourceSurfaceD2D1.cpp index 925c4ee51bb..1a687d6d60b 100644 --- a/gfx/2d/SourceSurfaceD2D1.cpp +++ b/gfx/2d/SourceSurfaceD2D1.cpp @@ -18,7 +18,7 @@ SourceSurfaceD2D1::SourceSurfaceD2D1(ID2D1Image *aImage, ID2D1DeviceContext *aDC , mDrawTarget(aDT) , mDevice(Factory::GetD2D1Device()) { - aImage->QueryInterface((ID2D1Bitmap1**)byRef(mRealizedBitmap)); + aImage->QueryInterface((ID2D1Bitmap1**)getter_AddRefs(mRealizedBitmap)); mFormat = aFormat; mSize = aSize; @@ -44,7 +44,7 @@ SourceSurfaceD2D1::GetDataSurface() return nullptr; } - RefPtr softwareBitmap; + nsRefPtr softwareBitmap; D2D1_BITMAP_PROPERTIES1 props; props.dpiX = 96; props.dpiY = 96; @@ -52,7 +52,7 @@ SourceSurfaceD2D1::GetDataSurface() props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_CANNOT_DRAW | D2D1_BITMAP_OPTIONS_CPU_READ; - hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(softwareBitmap)); + hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(softwareBitmap)); if (FAILED(hr)) { gfxCriticalError() << "Failed to create software bitmap: " << mSize << " Code: " << hexa(hr); @@ -85,8 +85,8 @@ SourceSurfaceD2D1::EnsureRealizedBitmap() return false; } - RefPtr dc; - device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, byRef(dc)); + nsRefPtr dc; + device->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, getter_AddRefs(dc)); D2D1_BITMAP_PROPERTIES1 props; props.dpiX = 96; @@ -94,7 +94,7 @@ SourceSurfaceD2D1::EnsureRealizedBitmap() props.pixelFormat = D2DPixelFormat(mFormat); props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; - dc->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap)); + dc->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(mRealizedBitmap)); dc->SetTarget(mRealizedBitmap); @@ -111,7 +111,7 @@ SourceSurfaceD2D1::DrawTargetWillChange() // At this point in time this should always be true here. MOZ_ASSERT(mRealizedBitmap); - RefPtr oldBitmap = mRealizedBitmap; + nsRefPtr oldBitmap = mRealizedBitmap; D2D1_BITMAP_PROPERTIES1 props; props.dpiX = 96; @@ -119,7 +119,7 @@ SourceSurfaceD2D1::DrawTargetWillChange() props.pixelFormat = D2DPixelFormat(mFormat); props.colorContext = nullptr; props.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET; - HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)byRef(mRealizedBitmap)); + HRESULT hr = mDC->CreateBitmap(D2DIntSize(mSize), nullptr, 0, props, (ID2D1Bitmap1**)getter_AddRefs(mRealizedBitmap)); if (FAILED(hr)) { gfxCriticalError() << "Failed to create bitmap to make DrawTarget copy. Size: " << mSize << " Code: " << hexa(hr); diff --git a/gfx/2d/SourceSurfaceD2D1.h b/gfx/2d/SourceSurfaceD2D1.h index 5b7cedf4cc7..94b86554e43 100644 --- a/gfx/2d/SourceSurfaceD2D1.h +++ b/gfx/2d/SourceSurfaceD2D1.h @@ -50,13 +50,13 @@ private: // this may happen on destruction or copying. void MarkIndependent(); - RefPtr mImage; + nsRefPtr mImage; // This may be null if we were created for a non-bitmap image and have not // had a reason yet to realize ourselves. - RefPtr mRealizedBitmap; - RefPtr mDC; + nsRefPtr mRealizedBitmap; + nsRefPtr mDC; // Keep this around to verify whether out image is still valid in the future. - RefPtr mDevice; + nsRefPtr mDevice; SurfaceFormat mFormat; IntSize mSize; @@ -83,7 +83,7 @@ private: friend class SourceSurfaceD2DTarget; void EnsureMapped(); - mutable RefPtr mBitmap; + mutable nsRefPtr mBitmap; SurfaceFormat mFormat; D2D1_MAPPED_RECT mMap; bool mMapped; diff --git a/gfx/2d/SourceSurfaceD2DTarget.cpp b/gfx/2d/SourceSurfaceD2DTarget.cpp index 6953508f56c..7a998dd8fa7 100644 --- a/gfx/2d/SourceSurfaceD2DTarget.cpp +++ b/gfx/2d/SourceSurfaceD2DTarget.cpp @@ -53,7 +53,7 @@ SourceSurfaceD2DTarget::GetFormat() const already_AddRefed SourceSurfaceD2DTarget::GetDataSurface() { - RefPtr dataSurf = + nsRefPtr dataSurf = new DataSourceSurfaceD2DTarget(mFormat); D3D10_TEXTURE2D_DESC desc; @@ -69,7 +69,7 @@ SourceSurfaceD2DTarget::GetDataSurface() return nullptr; } - HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(dataSurf->mTexture)); + HRESULT hr = Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(dataSurf->mTexture)); if (FAILED(hr)) { gfxDebug() << "Failed to create staging texture for SourceSurface. Code: " << hexa(hr); @@ -96,7 +96,7 @@ SourceSurfaceD2DTarget::GetSRView() return mSRView; } - HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, nullptr, byRef(mSRView)); + HRESULT hr = Factory::GetDirect3D10Device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView)); if (FAILED(hr)) { gfxWarning() << "Failed to create ShaderResourceView. Code: " << hexa(hr); @@ -108,7 +108,7 @@ SourceSurfaceD2DTarget::GetSRView() void SourceSurfaceD2DTarget::DrawTargetWillChange() { - RefPtr oldTexture = mTexture; + nsRefPtr oldTexture = mTexture; D3D10_TEXTURE2D_DESC desc; mTexture->GetDesc(&desc); @@ -119,7 +119,7 @@ SourceSurfaceD2DTarget::DrawTargetWillChange() desc.MiscFlags = 0; // Get a copy of the surface data so the content at snapshot time was saved. - Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, byRef(mTexture)); + Factory::GetDirect3D10Device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture)); Factory::GetDirect3D10Device()->CopyResource(mTexture, oldTexture); mBitmap = nullptr; @@ -144,8 +144,8 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) IntSize size(desc.Width, desc.Height); - RefPtr surf; - hr = mTexture->QueryInterface((IDXGISurface**)byRef(surf)); + nsRefPtr surf; + hr = mTexture->QueryInterface((IDXGISurface**)getter_AddRefs(surf)); if (FAILED(hr)) { gfxWarning() << "Failed to query interface texture to DXGISurface. Code: " << hexa(hr); @@ -153,20 +153,20 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) } D2D1_BITMAP_PROPERTIES props = D2D1::BitmapProperties(D2DPixelFormat(mFormat)); - hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, byRef(mBitmap)); + hr = aRT->CreateSharedBitmap(IID_IDXGISurface, surf, &props, getter_AddRefs(mBitmap)); if (FAILED(hr)) { // This seems to happen for SurfaceFormat::A8 sometimes... hr = aRT->CreateBitmap(D2D1::SizeU(desc.Width, desc.Height), D2D1::BitmapProperties(D2DPixelFormat(mFormat)), - byRef(mBitmap)); + getter_AddRefs(mBitmap)); if (FAILED(hr)) { gfxWarning() << "Failed in CreateBitmap. Code: " << hexa(hr); return nullptr; } - RefPtr rt; + nsRefPtr rt; if (mDrawTarget) { rt = mDrawTarget->mRT; @@ -176,9 +176,9 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) // Okay, we already separated from our drawtarget. And we're an A8 // surface the only way we can get to a bitmap is by creating a // a rendertarget and from there copying to a bitmap! Terrible! - RefPtr surface; + nsRefPtr surface; - hr = mTexture->QueryInterface((IDXGISurface**)byRef(surface)); + hr = mTexture->QueryInterface((IDXGISurface**)getter_AddRefs(surface)); if (FAILED(hr)) { gfxWarning() << "Failed to QI texture to surface."; @@ -187,7 +187,7 @@ SourceSurfaceD2DTarget::GetBitmap(ID2D1RenderTarget *aRT) D2D1_RENDER_TARGET_PROPERTIES props = D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT, D2DPixelFormat(mFormat)); - hr = DrawTargetD2D::factory()->CreateDxgiSurfaceRenderTarget(surface, props, byRef(rt)); + hr = DrawTargetD2D::factory()->CreateDxgiSurfaceRenderTarget(surface, props, getter_AddRefs(rt)); if (FAILED(hr)) { gfxWarning() << "Failed to create D2D render target for texture."; diff --git a/gfx/2d/SourceSurfaceD2DTarget.h b/gfx/2d/SourceSurfaceD2DTarget.h index 82b5b20778c..d519e1d14c8 100644 --- a/gfx/2d/SourceSurfaceD2DTarget.h +++ b/gfx/2d/SourceSurfaceD2DTarget.h @@ -47,14 +47,14 @@ private: // this may happen on destruction or copying. void MarkIndependent(); - RefPtr mSRView; - RefPtr mBitmap; + nsRefPtr mSRView; + nsRefPtr mBitmap; // Non-null if this is a "lazy copy" of the given draw target. // Null if we've made a copy. The target is not kept alive, otherwise we'd // have leaks since it might keep us alive. If the target is destroyed, it // will notify us. DrawTargetD2D* mDrawTarget; - mutable RefPtr mTexture; + mutable nsRefPtr mTexture; SurfaceFormat mFormat; bool mOwnsCopy; }; @@ -78,7 +78,7 @@ private: friend class SourceSurfaceD2DTarget; void EnsureMapped(); - mutable RefPtr mTexture; + mutable nsRefPtr mTexture; SurfaceFormat mFormat; D3D10_MAPPED_TEXTURE2D mMap; bool mMapped; diff --git a/gfx/2d/SourceSurfaceDual.h b/gfx/2d/SourceSurfaceDual.h index df81b87f266..c9f1202c39e 100644 --- a/gfx/2d/SourceSurfaceDual.h +++ b/gfx/2d/SourceSurfaceDual.h @@ -37,8 +37,8 @@ private: friend class DualSurface; friend class DualPattern; - RefPtr mA; - RefPtr mB; + nsRefPtr mA; + nsRefPtr mB; }; } // namespace gfx diff --git a/gfx/2d/SourceSurfaceSkia.h b/gfx/2d/SourceSurfaceSkia.h index 567b2e77d1a..8b175007bc1 100644 --- a/gfx/2d/SourceSurfaceSkia.h +++ b/gfx/2d/SourceSurfaceSkia.h @@ -62,7 +62,7 @@ private: SurfaceFormat mFormat; IntSize mSize; int32_t mStride; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; bool mLocked; }; diff --git a/gfx/2d/unittest/TestBugs.cpp b/gfx/2d/unittest/TestBugs.cpp index f127eed8b4f..8b181a0b535 100644 --- a/gfx/2d/unittest/TestBugs.cpp +++ b/gfx/2d/unittest/TestBugs.cpp @@ -19,14 +19,14 @@ TestBugs::TestBugs() void TestBugs::CairoClip918671() { - RefPtr dt = Factory::CreateDrawTarget(BackendType::CAIRO, + nsRefPtr dt = Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(100, 100), SurfaceFormat::B8G8R8A8); - RefPtr ref = Factory::CreateDrawTarget(BackendType::CAIRO, + nsRefPtr ref = Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(100, 100), SurfaceFormat::B8G8R8A8); // Create a path that extends around the center rect but doesn't intersect it. - RefPtr pb1 = dt->CreatePathBuilder(); + nsRefPtr pb1 = dt->CreatePathBuilder(); pb1->MoveTo(Point(10, 10)); pb1->LineTo(Point(90, 10)); pb1->LineTo(Point(90, 20)); @@ -38,27 +38,27 @@ TestBugs::CairoClip918671() pb1->LineTo(Point(91, 90)); pb1->Close(); - RefPtr path1 = pb1->Finish(); + nsRefPtr path1 = pb1->Finish(); dt->PushClip(path1); // This center rect must NOT be rectilinear! - RefPtr pb2 = dt->CreatePathBuilder(); + nsRefPtr pb2 = dt->CreatePathBuilder(); pb2->MoveTo(Point(50, 50)); pb2->LineTo(Point(55, 51)); pb2->LineTo(Point(54, 55)); pb2->LineTo(Point(50, 56)); pb2->Close(); - RefPtr path2 = pb2->Finish(); + nsRefPtr path2 = pb2->Finish(); dt->PushClip(path2); dt->FillRect(Rect(0, 0, 100, 100), ColorPattern(Color(1,0,0))); - RefPtr surf1 = dt->Snapshot(); - RefPtr surf2 = ref->Snapshot(); + nsRefPtr surf1 = dt->Snapshot(); + nsRefPtr surf2 = ref->Snapshot(); - RefPtr dataSurf1 = surf1->GetDataSurface(); - RefPtr dataSurf2 = surf2->GetDataSurface(); + nsRefPtr dataSurf1 = surf1->GetDataSurface(); + nsRefPtr dataSurf2 = surf2->GetDataSurface(); for (int y = 0; y < dt->GetSize().height; y++) { VERIFY(memcmp(dataSurf1->GetData() + y * dataSurf1->Stride(), @@ -71,7 +71,7 @@ TestBugs::CairoClip918671() void TestBugs::PushPopClip950550() { - RefPtr dt = Factory::CreateDrawTarget(BackendType::CAIRO, + nsRefPtr dt = Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(500, 500), SurfaceFormat::B8G8R8A8); dt->PushClipRect(Rect(0, 0, 100, 100)); diff --git a/gfx/2d/unittest/TestDrawTargetBase.cpp b/gfx/2d/unittest/TestDrawTargetBase.cpp index 2a0d95ed66a..1be8b64c828 100644 --- a/gfx/2d/unittest/TestDrawTargetBase.cpp +++ b/gfx/2d/unittest/TestDrawTargetBase.cpp @@ -50,7 +50,7 @@ TestDrawTargetBase::FillRect() void TestDrawTargetBase::RefreshSnapshot() { - RefPtr snapshot = mDT->Snapshot(); + nsRefPtr snapshot = mDT->Snapshot(); mDataSnapshot = snapshot->GetDataSurface(); } diff --git a/gfx/2d/unittest/TestDrawTargetBase.h b/gfx/2d/unittest/TestDrawTargetBase.h index 1e51f308233..30d306247c1 100644 --- a/gfx/2d/unittest/TestDrawTargetBase.h +++ b/gfx/2d/unittest/TestDrawTargetBase.h @@ -33,6 +33,6 @@ protected: uint32_t RGBAPixelFromColor(const mozilla::gfx::Color &aColor); - mozilla::RefPtr mDT; - mozilla::RefPtr mDataSnapshot; + nsRefPtr mDT; + nsRefPtr mDataSnapshot; }; diff --git a/gfx/2d/unittest/TestDrawTargetD2D.cpp b/gfx/2d/unittest/TestDrawTargetD2D.cpp index 27c25767d54..0715f93d828 100644 --- a/gfx/2d/unittest/TestDrawTargetD2D.cpp +++ b/gfx/2d/unittest/TestDrawTargetD2D.cpp @@ -15,7 +15,7 @@ TestDrawTargetD2D::TestDrawTargetD2D() D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS, D3D10_FEATURE_LEVEL_10_0, D3D10_1_SDK_VERSION, - byRef(mDevice)); + getter_AddRefs(mDevice)); Factory::SetDirect3D10Device(mDevice); diff --git a/gfx/2d/unittest/TestDrawTargetD2D.h b/gfx/2d/unittest/TestDrawTargetD2D.h index e4647ba748e..61cb652ecf3 100644 --- a/gfx/2d/unittest/TestDrawTargetD2D.h +++ b/gfx/2d/unittest/TestDrawTargetD2D.h @@ -15,5 +15,5 @@ public: TestDrawTargetD2D(); private: - mozilla::RefPtr mDevice; + nsRefPtr mDevice; }; diff --git a/gfx/cairo/cairo/src/cairo-d2d-private.h b/gfx/cairo/cairo/src/cairo-d2d-private.h index 15810eb6dcd..d825a0a3f1c 100644 --- a/gfx/cairo/cairo/src/cairo-d2d-private.h +++ b/gfx/cairo/cairo/src/cairo-d2d-private.h @@ -61,15 +61,15 @@ struct _cairo_d2d_device cairo_device_t base; HMODULE mD3D10_1; - RefPtr mD3D10Device; - RefPtr mSampleEffect; - RefPtr mInputLayout; - RefPtr mQuadBuffer; - RefPtr mRasterizerState; - RefPtr mBlendStates[MAX_OPERATORS]; + nsRefPtr mD3D10Device; + nsRefPtr mSampleEffect; + nsRefPtr mInputLayout; + nsRefPtr mQuadBuffer; + nsRefPtr mRasterizerState; + nsRefPtr mBlendStates[MAX_OPERATORS]; /** Texture used for manual glyph rendering */ - RefPtr mTextTexture; - RefPtr mTextTextureView; + nsRefPtr mTextTexture; + nsRefPtr mTextTextureView; int mVRAMUsage; }; @@ -94,20 +94,20 @@ struct _cairo_d2d_surface { cairo_d2d_device_t *device; /** Render target of the texture we render to */ - RefPtr rt; + nsRefPtr rt; /** Surface containing our backstore */ - RefPtr surface; + nsRefPtr surface; /** * Surface used to temporarily store our surface if a bitmap isn't available * straight from our render target surface. */ - RefPtr bufferTexture; + nsRefPtr bufferTexture; /** Backbuffer surface hwndrt renders to (NULL if not a window surface) */ - RefPtr backBuf; + nsRefPtr backBuf; /** Bitmap shared with texture and rendered to by rt */ - RefPtr surfaceBitmap; + nsRefPtr surfaceBitmap; /** Swap chain holding our backbuffer (NULL if not a window surface) */ - RefPtr dxgiChain; + nsRefPtr dxgiChain; /** Window handle of the window we belong to */ HWND hwnd; /** Format of the surface */ @@ -118,18 +118,18 @@ struct _cairo_d2d_surface { /** Mask layer used by surface_mask to push opacity masks */ - RefPtr maskLayer; + nsRefPtr maskLayer; /** * Layer used for clipping when tiling, and also for clearing out geometries * - lazily initialized */ - RefPtr helperLayer; + nsRefPtr helperLayer; /** If this layer currently is clipping, used to prevent excessive push/pops */ bool clipping; /** Brush used for bitmaps */ - RefPtr bitmapBrush; + nsRefPtr bitmapBrush; /** Brush used for solid colors */ - RefPtr solidColorBrush; + nsRefPtr solidColorBrush; /** Indicates if our render target is currently in drawing mode */ bool isDrawing; /** Indicates if text rendering is initialized */ @@ -141,8 +141,8 @@ struct _cairo_d2d_surface { }; TextRenderingState textRenderingState; - RefPtr buffer_rt_view; - RefPtr buffer_sr_view; + nsRefPtr buffer_rt_view; + nsRefPtr buffer_sr_view; // Other d2d surfaces which depend on this one and need to be flushed if // it is drawn to. This is required for situations where this surface is diff --git a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp index 6d32ebaf6ba..8f0557102a0 100644 --- a/gfx/cairo/cairo/src/cairo-d2d-surface.cpp +++ b/gfx/cairo/cairo/src/cairo-d2d-surface.cpp @@ -284,7 +284,7 @@ cairo_d2d_create_device() return NULL; } - RefPtr d3ddevice; + nsRefPtr d3ddevice; /** * On usage of D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS: @@ -383,7 +383,7 @@ cairo_d2d_finish_device(cairo_device_t *device) D3D10_QUERY_DESC queryDesc; queryDesc.MiscFlags = 0; queryDesc.Query = D3D10_QUERY_EVENT; - RefPtr query; + nsRefPtr query; d2d_device->mD3D10Device->CreateQuery(&queryDesc, &query); @@ -786,7 +786,7 @@ static ID3D10Texture2D* _cairo_d2d_get_buffer_texture(cairo_d2d_surface_t *surface) { if (!surface->bufferTexture) { - RefPtr surf; + nsRefPtr surf; DXGI_SURFACE_DESC surfDesc; surface->surface->QueryInterface(&surf); surf->GetDesc(&surfDesc); @@ -855,7 +855,7 @@ struct d2d_clip_t d2d_clip_t(d2d_clip_t *prev, clip_type type) : prev(prev), type(type) { } }; -static RefPtr +static nsRefPtr _cairo_d2d_create_path_geometry_for_path(cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, D2D1_FIGURE_BEGIN type); @@ -895,10 +895,10 @@ push_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_path_t *clip_path) d2dsurf->d2d_clip = new d2d_clip_t (d2dsurf->d2d_clip, d2d_clip_t::AXIS_ALIGNED_CLIP); } else { HRESULT hr; - RefPtr geom = _cairo_d2d_create_path_geometry_for_path (&clip_path->path, + nsRefPtr geom = _cairo_d2d_create_path_geometry_for_path (&clip_path->path, clip_path->fill_rule, D2D1_FIGURE_BEGIN_FILLED); - RefPtr layer; + nsRefPtr layer; hr = d2dsurf->rt->CreateLayer (&layer); @@ -911,7 +911,7 @@ push_clip (cairo_d2d_surface_t *d2dsurf, cairo_clip_path_t *clip_path) options1 = D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND; } - RefPtr dc; + nsRefPtr dc; hr = d2dsurf->rt->QueryInterface(IID_ID2D1DeviceContext, (void**)&dc); if (FAILED(hr)) { @@ -1155,7 +1155,7 @@ _cairo_d2d_invert_matrix(const D2D1::Matrix3x2F &mat) * \param style Cairo stroke style object * \return D2D StrokeStyle interface */ -static RefPtr +static nsRefPtr _cairo_d2d_create_strokestyle_for_stroke_style(const cairo_stroke_style_t *style) { D2D1_CAP_STYLE line_cap = D2D1_CAP_STYLE_FLAT; @@ -1201,7 +1201,7 @@ _cairo_d2d_create_strokestyle_for_stroke_style(const cairo_stroke_style_t *style dashStyle = D2D1_DASH_STYLE_CUSTOM; } - RefPtr strokeStyle; + nsRefPtr strokeStyle; sD2DFactory->CreateStrokeStyle(D2D1::StrokeStyleProperties(line_cap, line_cap, line_cap, @@ -1244,7 +1244,7 @@ struct cached_bitmap { * device cache, see bug 607408 */ cairo_d2d_device_t *device; /** The cached bitmap */ - RefPtr bitmap; + nsRefPtr bitmap; /** The cached bitmap is dirty and needs its data refreshed */ bool dirty; /** Order of snapshot detach/release bitmap called not guaranteed, single threaded refcount for now */ @@ -1305,7 +1305,7 @@ _cairo_d2d_calculate_visible_rect(cairo_d2d_surface_t *d2dsurf, cairo_image_surf cairo_matrix_invert(&invMat); } - RefPtr surf; + nsRefPtr surf; d2dsurf->surface->QueryInterface(&surf); DXGI_SURFACE_DESC desc; surf->GetDesc(&desc); @@ -1379,7 +1379,7 @@ _cairo_d2d_dot_product(const cairo_point_double_t &p1, const cairo_point_double_ return p1.x * p2.x + p1.y * p2.y; } -static RefPtr +static nsRefPtr _cairo_d2d_create_radial_gradient_brush(cairo_d2d_surface_t *d2dsurf, cairo_radial_pattern_t *source_pattern) { @@ -1419,7 +1419,7 @@ _cairo_d2d_create_radial_gradient_brush(cairo_d2d_surface_t *d2dsurf, bool reflected = false; bool reflect = source_pattern->base.base.extend == CAIRO_EXTEND_REFLECT; - RefPtr surf; + nsRefPtr surf; d2dsurf->surface->QueryInterface(&surf); DXGI_SURFACE_DESC desc; surf->GetDesc(&desc); @@ -1541,9 +1541,9 @@ _cairo_d2d_create_radial_gradient_brush(cairo_d2d_surface_t *d2dsurf, return NULL; } - RefPtr stopCollection; + nsRefPtr stopCollection; d2dsurf->rt->CreateGradientStopCollection(stops, num_stops, &stopCollection); - RefPtr brush; + nsRefPtr brush; d2dsurf->rt->CreateRadialGradientBrush(D2D1::RadialGradientBrushProperties(center, origin, @@ -1556,7 +1556,7 @@ _cairo_d2d_create_radial_gradient_brush(cairo_d2d_surface_t *d2dsurf, return brush; } -static RefPtr +static nsRefPtr _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf, cairo_path_fixed_t *fill_path, cairo_linear_pattern_t *source_pattern) @@ -1564,7 +1564,7 @@ _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf, if (source_pattern->p1.x == source_pattern->p2.x && source_pattern->p1.y == source_pattern->p2.y) { // Cairo behavior in this situation is to draw a solid color the size of the last stop. - RefPtr brush; + nsRefPtr brush; d2dsurf->rt->CreateSolidColorBrush( _cairo_d2d_color_from_cairo_color_stop(source_pattern->base.stops[source_pattern->base.n_stops - 1].color), &brush); @@ -1606,7 +1606,7 @@ _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf, top_right.x = bottom_right.x = _cairo_fixed_to_double (fill_extents.p2.x); bottom_right.y = bottom_left.y = _cairo_fixed_to_double (fill_extents.p2.y); } else { - RefPtr surf; + nsRefPtr surf; d2dsurf->surface->QueryInterface(&surf); DXGI_SURFACE_DESC desc; surf->GetDesc(&desc); @@ -1718,9 +1718,9 @@ _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf, stops[source_pattern->base.n_stops + 1].position = 1.0f; stops[source_pattern->base.n_stops + 1].color = D2D1::ColorF(0, 0); } - RefPtr stopCollection; + nsRefPtr stopCollection; d2dsurf->rt->CreateGradientStopCollection(stops, num_stops, &stopCollection); - RefPtr brush; + nsRefPtr brush; d2dsurf->rt->CreateLinearGradientBrush(D2D1::LinearGradientBrushProperties(D2D1::Point2F((FLOAT)p1.x, (FLOAT)p1.y), D2D1::Point2F((FLOAT)p2.x, (FLOAT)p2.y)), brushProps, @@ -1742,7 +1742,7 @@ _cairo_d2d_create_linear_gradient_brush(cairo_d2d_surface_t *d2dsurf, * this will make the function return a seperate brush. * \return A brush object */ -static RefPtr +static nsRefPtr _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf, cairo_path_fixed_t *fill_path, const cairo_pattern_t *pattern, @@ -1755,7 +1755,7 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf, (cairo_solid_pattern_t*)pattern; D2D1_COLOR_F color = _cairo_d2d_color_from_cairo_color(sourcePattern->color); if (unique) { - RefPtr brush; + nsRefPtr brush; d2dsurf->rt->CreateSolidColorBrush(color, &brush); return brush; @@ -1803,7 +1803,7 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf, extendMode = D2D1_EXTEND_MODE_CLAMP; } - RefPtr sourceBitmap; + nsRefPtr sourceBitmap; bool partial = false; int xoffset = 0; int yoffset = 0; @@ -1918,7 +1918,7 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf, * this by 45 degrees and scale it to a size of 5x5 pixels and composite it to the destination, * the composition will require all 10 original columns to do the best possible sampling. */ - RefPtr surf; + nsRefPtr surf; d2dsurf->surface->QueryInterface(&surf); DXGI_SURFACE_DESC desc; surf->GetDesc(&desc); @@ -2097,7 +2097,7 @@ _cairo_d2d_create_brush_for_pattern(cairo_d2d_surface_t *d2dsurf, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR); } if (unique) { - RefPtr bitBrush; + nsRefPtr bitBrush; D2D1_BRUSH_PROPERTIES brushProps = D2D1::BrushProperties(1.0, _cairo_d2d_matrix_from_matrix(&mat)); d2dsurf->rt->CreateBitmapBrush(sourceBitmap, @@ -2241,14 +2241,14 @@ _cairo_d2d_path_close(void *closure) * \param type Figure begin type to use * \return A D2D geometry */ -static RefPtr +static nsRefPtr _cairo_d2d_create_path_geometry_for_path(cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, D2D1_FIGURE_BEGIN type) { - RefPtr d2dpath; + nsRefPtr d2dpath; sD2DFactory->CreatePathGeometry(&d2dpath); - RefPtr sink; + nsRefPtr sink; d2dpath->Open(&sink); D2D1_FILL_MODE fillMode = D2D1_FILL_MODE_WINDING; if (fill_rule == CAIRO_FILL_RULE_WINDING) { @@ -2455,7 +2455,7 @@ _cairo_d2d_create_similar(void *surface, if (sizePixels.height < 1) { sizePixels.height = 1; } - RefPtr oldDxgiSurface; + nsRefPtr oldDxgiSurface; d2dsurf->surface->QueryInterface(&oldDxgiSurface); DXGI_SURFACE_DESC origDesc; @@ -2477,8 +2477,8 @@ _cairo_d2d_create_similar(void *surface, if (desc.Format != DXGI_FORMAT_A8_UNORM) desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE; - RefPtr texture; - RefPtr dxgiSurface; + nsRefPtr texture; + nsRefPtr dxgiSurface; D2D1_RENDER_TARGET_USAGE usage = (desc.MiscFlags & D3D10_RESOURCE_MISC_GDI_COMPATIBLE) ? D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE @@ -2586,9 +2586,9 @@ _cairo_d2d_acquire_source_image(void *abstract_surface, HRESULT hr; D2D1_SIZE_U size = d2dsurf->rt->GetPixelSize(); - RefPtr softTexture; + nsRefPtr softTexture; - RefPtr dxgiSurface; + nsRefPtr dxgiSurface; d2dsurf->surface->QueryInterface(&dxgiSurface); DXGI_SURFACE_DESC desc; @@ -2680,10 +2680,10 @@ _cairo_d2d_acquire_dest_image(void *abstract_surface, HRESULT hr; D2D1_SIZE_U size = d2dsurf->rt->GetPixelSize(); - RefPtr softTexture; + nsRefPtr softTexture; - RefPtr dxgiSurface; + nsRefPtr dxgiSurface; d2dsurf->surface->QueryInterface(&dxgiSurface); DXGI_SURFACE_DESC desc; @@ -2768,9 +2768,9 @@ _cairo_d2d_copy_surface(cairo_d2d_surface_t *dst, cairo_point_int_t *translation, cairo_region_t *region) { - RefPtr dstSurface; + nsRefPtr dstSurface; dst->surface->QueryInterface(&dstSurface); - RefPtr srcSurface; + nsRefPtr srcSurface; src->surface->QueryInterface(&srcSurface); DXGI_SURFACE_DESC srcDesc, dstDesc; @@ -3031,12 +3031,12 @@ _cairo_d2d_try_fastblit(cairo_d2d_surface_t *dst, return rv; } -static RefPtr +static nsRefPtr _cairo_d2d_get_temp_rt(cairo_d2d_surface_t *surf, cairo_clip_t *clip) { - RefPtr texture = _cairo_d2d_get_buffer_texture(surf); - RefPtr new_rt; - RefPtr dxgiSurface; + nsRefPtr texture = _cairo_d2d_get_buffer_texture(surf); + nsRefPtr new_rt; + nsRefPtr dxgiSurface; texture->QueryInterface(&dxgiSurface); HRESULT hr; @@ -3081,10 +3081,10 @@ _cairo_d2d_get_temp_rt(cairo_d2d_surface_t *surf, cairo_clip_t *clip) aaMode); } else { HRESULT hr; - RefPtr geom = _cairo_d2d_create_path_geometry_for_path (&path->path, + nsRefPtr geom = _cairo_d2d_create_path_geometry_for_path (&path->path, path->fill_rule, D2D1_FIGURE_BEGIN_FILLED); - RefPtr layer; + nsRefPtr layer; hr = new_rt->CreateLayer (&layer); @@ -3140,8 +3140,8 @@ _cairo_d2d_blend_temp_surface(cairo_d2d_surface_t *surf, cairo_operator_t op, ID rt->EndDraw(); HRESULT hr; - RefPtr srcTexture = _cairo_d2d_get_buffer_texture(surf); - RefPtr dstTexture; + nsRefPtr srcTexture = _cairo_d2d_get_buffer_texture(surf); + nsRefPtr dstTexture; surf->surface->QueryInterface(&dstTexture); ID3D10Device *device = surf->device->mD3D10Device; @@ -3256,7 +3256,7 @@ _cairo_d2d_paint(void *surface, return status; } } - RefPtr target_rt = d2dsurf->rt; + nsRefPtr target_rt = d2dsurf->rt; #ifndef ALWAYS_MANUAL_COMPOSITE if (op != CAIRO_OPERATOR_OVER) { #endif @@ -3276,7 +3276,7 @@ _cairo_d2d_paint(void *surface, target_rt->SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); - RefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, source); if (!brush) { @@ -3397,12 +3397,12 @@ _cairo_d2d_mask(void *surface, } } - RefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, source); + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, source); if (!brush) { return CAIRO_INT_STATUS_UNSUPPORTED; } - RefPtr target_rt = d2dsurf->rt; + nsRefPtr target_rt = d2dsurf->rt; #ifndef ALWAYS_MANUAL_COMPOSITE if (op != CAIRO_OPERATOR_OVER) { #endif @@ -3437,7 +3437,7 @@ _cairo_d2d_mask(void *surface, return CAIRO_INT_STATUS_SUCCESS; } - RefPtr opacityBrush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, mask, true); + nsRefPtr opacityBrush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, mask, true); if (!opacityBrush) { return CAIRO_INT_STATUS_UNSUPPORTED; } @@ -3485,7 +3485,7 @@ _cairo_d2d_stroke(void *surface, return CAIRO_INT_STATUS_UNSUPPORTED; } - RefPtr target_rt = d2dsurf->rt; + nsRefPtr target_rt = d2dsurf->rt; #ifndef ALWAYS_MANUAL_COMPOSITE if (op != CAIRO_OPERATOR_OVER) { #endif @@ -3508,12 +3508,12 @@ _cairo_d2d_stroke(void *surface, } else { target_rt->SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); } - RefPtr strokeStyle = _cairo_d2d_create_strokestyle_for_stroke_style(style); + nsRefPtr strokeStyle = _cairo_d2d_create_strokestyle_for_stroke_style(style); if (!strokeStyle) { return CAIRO_INT_STATUS_UNSUPPORTED; } - RefPtr d2dpath = _cairo_d2d_create_path_geometry_for_path(path, + nsRefPtr d2dpath = _cairo_d2d_create_path_geometry_for_path(path, CAIRO_FILL_RULE_WINDING, D2D1_FIGURE_BEGIN_FILLED); @@ -3523,7 +3523,7 @@ _cairo_d2d_stroke(void *surface, transformed = false; } - RefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, NULL, source); if (!brush) { return CAIRO_INT_STATUS_UNSUPPORTED; @@ -3537,7 +3537,7 @@ _cairo_d2d_stroke(void *surface, mat = _cairo_d2d_matrix_from_matrix(ctm); D2D1::Matrix3x2F inverse_mat = _cairo_d2d_invert_matrix(mat); - RefPtr trans_geom; + nsRefPtr trans_geom; sD2DFactory->CreateTransformedGeometry(d2dpath, &inverse_mat, &trans_geom); // If we are setting a transform on the render target, we've multiplied @@ -3619,7 +3619,7 @@ _cairo_d2d_fill(void *surface, } } - RefPtr target_rt = d2dsurf->rt; + nsRefPtr target_rt = d2dsurf->rt; #ifndef ALWAYS_MANUAL_COMPOSITE if (op != CAIRO_OPERATOR_OVER) { @@ -3649,7 +3649,7 @@ _cairo_d2d_fill(void *surface, float y1 = _cairo_fixed_to_float(box.p1.y); float x2 = _cairo_fixed_to_float(box.p2.x); float y2 = _cairo_fixed_to_float(box.p2.y); - RefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, path, source); if (!brush) { return CAIRO_INT_STATUS_UNSUPPORTED; @@ -3661,9 +3661,9 @@ _cairo_d2d_fill(void *surface, y2), brush); } else { - RefPtr d2dpath = _cairo_d2d_create_path_geometry_for_path(path, fill_rule, D2D1_FIGURE_BEGIN_FILLED); + nsRefPtr d2dpath = _cairo_d2d_create_path_geometry_for_path(path, fill_rule, D2D1_FIGURE_BEGIN_FILLED); - RefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(d2dsurf, path, source); if (!brush) { return CAIRO_INT_STATUS_UNSUPPORTED; @@ -3730,10 +3730,10 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface, AutoDWriteGlyphRun run; _cairo_dwrite_glyph_run_from_glyphs(glyphs, num_glyphs, scaled_font, &run, &transform); - RefPtr analysis; + nsRefPtr analysis; DWRITE_MATRIX dwmat = _cairo_dwrite_matrix_from_matrix(&scaled_font->mat); - RefPtr params; + nsRefPtr params; dst->rt->GetTextRenderingParams(¶ms); DWRITE_RENDERING_MODE renderMode = DWRITE_RENDERING_MODE_DEFAULT; @@ -3834,7 +3834,7 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface, return CAIRO_INT_STATUS_UNSUPPORTED; } - RefPtr srView; + nsRefPtr srView; ID3D10Device1 *device = dst->device->mD3D10Device; int textureWidth, textureHeight; @@ -3843,7 +3843,7 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface, cairo_bounds.height < TEXT_TEXTURE_HEIGHT) { // Use our cached TextTexture when it is big enough. - RefPtr tmpTexture; + nsRefPtr tmpTexture; CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, cairo_bounds.width, cairo_bounds.height, 1, 1, 0); @@ -3921,7 +3921,7 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface, data.SysMemPitch = cairo_bounds.width * 4; data.pSysMem = alignedTextureData; - RefPtr tex; + nsRefPtr tex; hr = device->CreateTexture2D(&desc, &data, &tex); delete [] alignedTextureData; @@ -3942,7 +3942,7 @@ _cairo_dwrite_manual_show_glyphs_on_d2d_surface(void *surface, } // Prepare destination surface for rendering. - RefPtr dstTexture; + nsRefPtr dstTexture; dst->surface->QueryInterface(&dstTexture); @@ -4070,7 +4070,7 @@ _cairo_dwrite_show_glyphs_on_d2d_surface(void *surface, } } - RefPtr target_rt = dst->rt; + nsRefPtr target_rt = dst->rt; cairo_rectangle_int_t fontArea; #ifndef ALWAYS_MANUAL_COMPOSITE if (op != CAIRO_OPERATOR_OVER) { @@ -4097,7 +4097,7 @@ _cairo_dwrite_show_glyphs_on_d2d_surface(void *surface, cleartype_quality = D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE; } - RefPtr params; + nsRefPtr params; target_rt->GetTextRenderingParams(¶ms); DWRITE_RENDERING_MODE renderMode = DWRITE_RENDERING_MODE_DEFAULT; @@ -4165,7 +4165,7 @@ _cairo_dwrite_show_glyphs_on_d2d_surface(void *surface, } if (dst->rt.get() != target_rt.get()) { - RefPtr analysis; + nsRefPtr analysis; DWRITE_MATRIX dwmat = _cairo_dwrite_matrix_from_matrix(&dwritesf->mat); DWriteFactory::Instance()->CreateGlyphRunAnalysis(&run, 1.0f, @@ -4186,7 +4186,7 @@ _cairo_dwrite_show_glyphs_on_d2d_surface(void *surface, fontArea.height = bounds.bottom - bounds.top; } - RefPtr brush = _cairo_d2d_create_brush_for_pattern(dst, NULL, + nsRefPtr brush = _cairo_d2d_create_brush_for_pattern(dst, NULL, source); if (!brush) { @@ -4238,7 +4238,7 @@ _cairo_d2d_show_glyphs (void *surface, cairo_d2d_surface_t::TextRenderingState textRenderingState = reinterpret_cast(scaled_font)->rendering_mode; if (d2dsurf->textRenderingState != textRenderingState) { - RefPtr params = + nsRefPtr params = DWriteFactory::RenderingParams(textRenderingState); d2dsurf->rt->SetTextRenderingParams(params); d2dsurf->textRenderingState = textRenderingState; @@ -4304,9 +4304,9 @@ cairo_d2d_surface_create_for_hwnd(cairo_device_t *cairo_device, sizePixels.height = 1; } ID3D10Device1 *device = d2d_device->mD3D10Device; - RefPtr dxgiDevice; - RefPtr dxgiAdapter; - RefPtr dxgiFactory; + nsRefPtr dxgiDevice; + nsRefPtr dxgiAdapter; + nsRefPtr dxgiFactory; D2D1_RENDER_TARGET_PROPERTIES props; D2D1_BITMAP_PROPERTIES bitProps; @@ -4439,8 +4439,8 @@ cairo_d2d_surface_create(cairo_device_t *device, if (desc.Format != DXGI_FORMAT_A8_UNORM) desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE; - RefPtr texture; - RefPtr dxgiSurface; + nsRefPtr texture; + nsRefPtr dxgiSurface; D2D1_BITMAP_PROPERTIES bitProps; D2D1_RENDER_TARGET_PROPERTIES props; @@ -4516,8 +4516,8 @@ cairo_d2d_surface_create_for_handle(cairo_device_t *device, HANDLE handle, cairo cairo_status_t status = CAIRO_STATUS_NO_MEMORY; HRESULT hr; - RefPtr texture; - RefPtr dxgiSurface; + nsRefPtr texture; + nsRefPtr dxgiSurface; D2D1_BITMAP_PROPERTIES bitProps; D2D1_RENDER_TARGET_PROPERTIES props; DXGI_FORMAT format; @@ -4623,7 +4623,7 @@ cairo_d2d_surface_create_for_texture(cairo_device_t *device, HRESULT hr; D3D10_TEXTURE2D_DESC desc; - RefPtr dxgiSurface; + nsRefPtr dxgiSurface; D2D1_BITMAP_PROPERTIES bitProps; D2D1_RENDER_TARGET_PROPERTIES props; @@ -4692,7 +4692,7 @@ cairo_d2d_surface_get_texture(cairo_surface_t *surface) cairo_d2d_surface_t *d2dsurf = reinterpret_cast(surface); - RefPtr texture; + nsRefPtr texture; d2dsurf->surface->QueryInterface(&texture); return texture; @@ -4711,7 +4711,7 @@ void cairo_d2d_scroll(cairo_surface_t *surface, int x, int y, cairo_rectangle_t rect.front = 0; rect.back = 1; - RefPtr dxgiSurface; + nsRefPtr dxgiSurface; d2dsurf->surface->QueryInterface(&dxgiSurface); DXGI_SURFACE_DESC desc; @@ -4781,7 +4781,7 @@ cairo_d2d_get_dc(cairo_surface_t *surface, cairo_bool_t retain_contents) d2dsurf->isDrawing = true; } - RefPtr interopRT; + nsRefPtr interopRT; /* This QueryInterface call will always succeed even if the * the render target doesn't support the ID2D1GdiInteropRenderTarget @@ -4809,7 +4809,7 @@ cairo_d2d_release_dc(cairo_surface_t *surface, const cairo_rectangle_int_t *upda } cairo_d2d_surface_t *d2dsurf = reinterpret_cast(surface); - RefPtr interopRT; + nsRefPtr interopRT; d2dsurf->rt->QueryInterface(&interopRT); diff --git a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp index f234421dc65..52e3da643b2 100644 --- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp +++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp @@ -1542,7 +1542,7 @@ _cairo_dwrite_scaled_font_create_win32_scaled_font (cairo_scaled_font_t *scaled_ cairo_font_face_t *face = cairo_scaled_font_get_font_face (scaled_font); cairo_dwrite_font_face_t *dwface = reinterpret_cast(face); - RefPtr gdiInterop; + nsRefPtr gdiInterop; DWriteFactory::Instance()->GetGdiInterop(&gdiInterop); if (!gdiInterop) { return CAIRO_INT_STATUS_UNSUPPORTED; diff --git a/gfx/cairo/cairo/src/cairo-win32-refptr.h b/gfx/cairo/cairo/src/cairo-win32-refptr.h index 0baf8ee7b18..2887c538274 100644 --- a/gfx/cairo/cairo/src/cairo-win32-refptr.h +++ b/gfx/cairo/cairo/src/cairo-win32-refptr.h @@ -41,7 +41,7 @@ template class TemporaryRef; /** * RefPtr points to a refcounted thing that has AddRef and Release * methods to increase/decrease the refcount, respectively. After a - * RefPtr is assigned a T*, the T* can be used through the RefPtr + * nsRefPtr is assigned a T*, the T* can be used through the RefPtr * as if it were a T*. * * A RefPtr can forget its underlying T*, which results in the T* @@ -63,7 +63,7 @@ public: RefPtr(T* t) : ptr(ref(t)) {} template - RefPtr(const RefPtr& o) : ptr(ref(o.get())) {} + RefPtr(const nsRefPtr& o) : ptr(ref(o.get())) {} ~RefPtr() { unref(ptr); } @@ -81,7 +81,7 @@ public: } template - RefPtr& operator=(const RefPtr& o) { + RefPtr& operator=(const nsRefPtr& o) { assign(ref(o.get())); return *this; } @@ -147,18 +147,18 @@ template class TemporaryRef { // To allow it to construct TemporaryRef from a bare T* - friend class RefPtr; + friend class nsRefPtr; - typedef typename RefPtr::dontRef dontRef; + typedef typename nsRefPtr::dontRef dontRef; public: - TemporaryRef(T* t) : ptr(RefPtr::ref(t)) {} + TemporaryRef(T* t) : ptr(nsRefPtr::ref(t)) {} TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {} template TemporaryRef(const TemporaryRef& o) : ptr(o.drop()) {} - ~TemporaryRef() { RefPtr::unref(ptr); } + ~TemporaryRef() { nsRefPtr::unref(ptr); } T* drop() const { T* tmp = ptr; diff --git a/gfx/gl/AndroidSurfaceTexture.cpp b/gfx/gl/AndroidSurfaceTexture.cpp index e7fa1cc21c7..250574f5c1d 100644 --- a/gfx/gl/AndroidSurfaceTexture.cpp +++ b/gfx/gl/AndroidSurfaceTexture.cpp @@ -50,7 +50,7 @@ AndroidSurfaceTexture::Create(GLContext* aContext, GLuint aTexture) return nullptr; } - RefPtr st = new AndroidSurfaceTexture(); + nsRefPtr st = new AndroidSurfaceTexture(); if (!st->Init(aContext, aTexture)) { printf_stderr("Failed to initialize AndroidSurfaceTexture"); st = nullptr; diff --git a/gfx/gl/AndroidSurfaceTexture.h b/gfx/gl/AndroidSurfaceTexture.h index 3099a6e259f..45169cb07fc 100644 --- a/gfx/gl/AndroidSurfaceTexture.h +++ b/gfx/gl/AndroidSurfaceTexture.h @@ -105,7 +105,7 @@ private: GLContext* mAttachedContext; bool mCanDetach; - RefPtr mNativeWindow; + nsRefPtr mNativeWindow; int mID; nsCOMPtr mFrameAvailableCallback; }; diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index 58501d63c04..d43bc767802 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -34,7 +34,7 @@ #endif #include "../../mfbt/Maybe.h" -#include "../../mfbt/RefPtr.h" +#include "../../mfbt/nsRefPtr.h" #include "../../mfbt/UniquePtr.h" #include "GLDefs.h" @@ -3344,7 +3344,7 @@ public: } protected: - RefPtr mSharedContext; + nsRefPtr mSharedContext; // The thread id which this context was created. PlatformThreadId mOwningThreadId; @@ -3478,7 +3478,7 @@ public: bool IsDrawingToDefaultFramebuffer(); protected: - RefPtr mTexGarbageBin; + nsRefPtr mTexGarbageBin; public: TextureGarbageBin* TexGarbageBin() { diff --git a/gfx/gl/GLContextProviderCGL.mm b/gfx/gl/GLContextProviderCGL.mm index f0f223c3463..7dea5e17abf 100644 --- a/gfx/gl/GLContextProviderCGL.mm +++ b/gfx/gl/GLContextProviderCGL.mm @@ -320,7 +320,7 @@ GLContextProviderCGL::CreateOffscreen(const IntSize& size, const SurfaceCaps& minCaps, CreateContextFlags flags) { - RefPtr gl = CreateHeadless(flags); + nsRefPtr gl = CreateHeadless(flags); if (!gl) return nullptr; diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 5983ed128c1..fe55ba720e5 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -953,7 +953,7 @@ GLContextEGL::CreateEGLPBufferOffscreenContext(const mozilla::gfx::IntSize& size } - RefPtr gl = GLContextEGL::CreateGLContext(configCaps, nullptr, true, + nsRefPtr gl = GLContextEGL::CreateGLContext(configCaps, nullptr, true, config, surface); if (!gl) { NS_WARNING("Failed to create GLContext from PBuffer"); @@ -1039,7 +1039,7 @@ GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size, canOffscreenUseHeadless = false; } - RefPtr gl; + nsRefPtr gl; SurfaceCaps minOffscreenCaps = minCaps; if (canOffscreenUseHeadless) { diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 3c34c5cff36..34b17f07df0 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -1216,7 +1216,7 @@ CreateOffscreenPixmapContext(const IntSize& size, const SurfaceCaps& minCaps) GLXPixmap pixmap; gfx::IntSize dummySize(16, 16); - RefPtr surface = gfxXlibSurface::Create(DefaultScreenOfDisplay(display), + nsRefPtr surface = gfxXlibSurface::Create(DefaultScreenOfDisplay(display), visual, dummySize); if (surface->CairoStatus() != 0) { @@ -1269,7 +1269,7 @@ GLContextProviderGLX::CreateOffscreen(const IntSize& size, minBackbufferCaps.stencil = false; } - RefPtr gl; + nsRefPtr gl; gl = CreateOffscreenPixmapContext(size, minBackbufferCaps); if (!gl) return nullptr; @@ -1305,7 +1305,7 @@ GLContextProviderGLX::GetGlobalContext() // StaticPtr doesn't support assignments from already_AddRefed, // so use a temporary nsRefPtr to make the reference counting // fall out correctly. - RefPtr holder; + nsRefPtr holder; holder = CreateOffscreenPixmapContext(dummySize, dummyCaps); gGlobalContext = holder; } diff --git a/gfx/gl/GLContextProviderWGL.cpp b/gfx/gl/GLContextProviderWGL.cpp index 0dcc830fd7c..7c72bdfb405 100644 --- a/gfx/gl/GLContextProviderWGL.cpp +++ b/gfx/gl/GLContextProviderWGL.cpp @@ -644,7 +644,7 @@ GLContextProviderWGL::CreateOffscreen(const IntSize& size, const SurfaceCaps& minCaps, CreateContextFlags flags) { - RefPtr gl = CreateHeadless(flags); + nsRefPtr gl = CreateHeadless(flags); if (!gl) return nullptr; diff --git a/gfx/gl/GLLibraryEGL.h b/gfx/gl/GLLibraryEGL.h index 1f42a951a75..83a0ab0ca27 100644 --- a/gfx/gl/GLLibraryEGL.h +++ b/gfx/gl/GLLibraryEGL.h @@ -613,7 +613,7 @@ private: bool mInitialized; PRLibrary* mEGLLibrary; EGLDisplay mEGLDisplay; - RefPtr mReadbackGL; + nsRefPtr mReadbackGL; bool mIsANGLE; bool mIsWARP; diff --git a/gfx/gl/GLReadTexImageHelper.cpp b/gfx/gl/GLReadTexImageHelper.cpp index 7e43d8b350b..10764819da4 100644 --- a/gfx/gl/GLReadTexImageHelper.cpp +++ b/gfx/gl/GLReadTexImageHelper.cpp @@ -410,7 +410,7 @@ ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest) destFormat, destType, &readFormat, &readType); - RefPtr tempSurf; + nsRefPtr tempSurf; DataSourceSurface* readSurf = dest; int readAlignment = GuessAlignment(dest->GetSize().width, destPixelSize, @@ -536,7 +536,7 @@ ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest) already_AddRefed YInvertImageSurface(gfx::DataSourceSurface* aSurf) { - RefPtr temp = + nsRefPtr temp = Factory::CreateDataSourceSurfaceWithStride(aSurf->GetSize(), aSurf->GetFormat(), aSurf->Stride()); @@ -549,7 +549,7 @@ YInvertImageSurface(gfx::DataSourceSurface* aSurf) return nullptr; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, temp->GetSize(), @@ -581,7 +581,7 @@ ReadBackSurface(GLContext* gl, GLuint aTexture, bool aYInvert, SurfaceFormat aFo gl->fGetTexLevelParameteriv(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_TEXTURE_WIDTH, &size.width); gl->fGetTexLevelParameteriv(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_TEXTURE_HEIGHT, &size.height); - RefPtr surf = + nsRefPtr surf = Factory::CreateDataSourceSurfaceWithStride(size, SurfaceFormat::B8G8R8A8, GetAlignedStride<4>(size.width * BytesPerPixel(SurfaceFormat::B8G8R8A8))); @@ -626,7 +626,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId, { /* Allocate resulting image surface */ int32_t stride = aSize.width * BytesPerPixel(SurfaceFormat::R8G8B8A8); - RefPtr isurf = + nsRefPtr isurf = Factory::CreateDataSourceSurfaceWithStride(aSize, SurfaceFormat::R8G8B8A8, stride); diff --git a/gfx/gl/GLReadTexImageHelper.h b/gfx/gl/GLReadTexImageHelper.h index 685afcf270c..688521697ad 100644 --- a/gfx/gl/GLReadTexImageHelper.h +++ b/gfx/gl/GLReadTexImageHelper.h @@ -11,7 +11,7 @@ #include "mozilla/Attributes.h" #include "nsSize.h" #include "nsAutoPtr.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/Types.h" namespace mozilla { diff --git a/gfx/gl/GLScreenBuffer.cpp b/gfx/gl/GLScreenBuffer.cpp index e0fb75cb7fd..df4acb80213 100755 --- a/gfx/gl/GLScreenBuffer.cpp +++ b/gfx/gl/GLScreenBuffer.cpp @@ -68,7 +68,7 @@ GLScreenBuffer::Create(GLContext* gl, /* static */ UniquePtr GLScreenBuffer::CreateFactory(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& forwarder, + const nsRefPtr& forwarder, const layers::TextureFlags& flags) { UniquePtr factory = nullptr; @@ -521,7 +521,7 @@ GLScreenBuffer::Attach(SharedSurface* surf, const gfx::IntSize& size) bool GLScreenBuffer::Swap(const gfx::IntSize& size) { - RefPtr newBack = mFactory->NewTexClient(size); + nsRefPtr newBack = mFactory->NewTexClient(size); if (!newBack) return false; @@ -585,7 +585,7 @@ GLScreenBuffer::PublishFrame(const gfx::IntSize& size) bool GLScreenBuffer::Resize(const gfx::IntSize& size) { - RefPtr newBack = mFactory->NewTexClient(size); + nsRefPtr newBack = mFactory->NewTexClient(size); if (!newBack) return false; diff --git a/gfx/gl/GLScreenBuffer.h b/gfx/gl/GLScreenBuffer.h index 2b31500cebf..1a00eb22897 100644 --- a/gfx/gl/GLScreenBuffer.h +++ b/gfx/gl/GLScreenBuffer.h @@ -137,7 +137,7 @@ public: static UniquePtr CreateFactory(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& forwarder, + const nsRefPtr& forwarder, const layers::TextureFlags& flags); protected: @@ -147,8 +147,8 @@ public: protected: UniquePtr mFactory; - RefPtr mBack; - RefPtr mFront; + nsRefPtr mBack; + nsRefPtr mFront; UniquePtr mDraw; UniquePtr mRead; @@ -180,7 +180,7 @@ public: return mFactory.get(); } - const RefPtr& Front() const { + const nsRefPtr& Front() const { return mFront; } diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index 906a2815ebf..9ff7405f086 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -158,8 +158,8 @@ BasicTextureImage::EndUpdate() // FIXME: this is the slow boat. Make me fast (with GLXPixmap?). - RefPtr updateSnapshot = mUpdateDrawTarget->Snapshot(); - RefPtr updateData = updateSnapshot->GetDataSurface(); + nsRefPtr updateSnapshot = mUpdateDrawTarget->Snapshot(); + nsRefPtr updateData = updateSnapshot->GetDataSurface(); bool relative = FinishedSurfaceUpdate(); @@ -463,7 +463,7 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion) // adjust for tile offset aRegion.MoveBy(-xPos, -yPos); // forward the actual call - RefPtr drawTarget = mImages[i]->BeginUpdate(aRegion); + nsRefPtr drawTarget = mImages[i]->BeginUpdate(aRegion); // caller expects container space aRegion.MoveBy(xPos, yPos); // we don't have a temp surface @@ -503,8 +503,8 @@ TiledTextureImage::EndUpdate() return; } - RefPtr updateSnapshot = mUpdateDrawTarget->Snapshot(); - RefPtr updateData = updateSnapshot->GetDataSurface(); + nsRefPtr updateSnapshot = mUpdateDrawTarget->Snapshot(); + nsRefPtr updateData = updateSnapshot->GetDataSurface(); // upload tiles from temp surface for (unsigned i = 0; i < mImages.Length(); i++) { diff --git a/gfx/gl/GLTextureImage.h b/gfx/gl/GLTextureImage.h index ed42249e83f..5a1e60ac736 100644 --- a/gfx/gl/GLTextureImage.h +++ b/gfx/gl/GLTextureImage.h @@ -12,7 +12,7 @@ #include "gfxTypes.h" #include "GLContextTypes.h" #include "mozilla/gfx/Rect.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" class gfxASurface; @@ -278,7 +278,7 @@ protected: GLuint mTexture; TextureState mTextureState; nsRefPtr mGLContext; - RefPtr mUpdateDrawTarget; + nsRefPtr mUpdateDrawTarget; nsIntRegion mUpdateRegion; // The offset into the update surface at which the update rect is located. @@ -330,7 +330,7 @@ protected: unsigned int mRows, mColumns; GLContext* mGL; // A temporary draw target to faciliate cross-tile updates. - RefPtr mUpdateDrawTarget; + nsRefPtr mUpdateDrawTarget; // The region of update requested nsIntRegion mUpdateRegion; TextureState mTextureState; diff --git a/gfx/gl/SharedSurface.cpp b/gfx/gl/SharedSurface.cpp index 5631be1772e..ffcb0e457ec 100644 --- a/gfx/gl/SharedSurface.cpp +++ b/gfx/gl/SharedSurface.cpp @@ -303,7 +303,7 @@ ChooseBufferBits(const SurfaceCaps& caps, SurfaceFactory::SurfaceFactory(SharedSurfaceType type, GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) : mType(type) , mGL(gl) @@ -333,7 +333,7 @@ already_AddRefed SurfaceFactory::NewTexClient(const gfx::IntSize& size) { while (!mRecycleFreePool.empty()) { - RefPtr cur = mRecycleFreePool.front(); + nsRefPtr cur = mRecycleFreePool.front(); mRecycleFreePool.pop(); if (cur->Surf()->mSize == size) { @@ -348,7 +348,7 @@ SurfaceFactory::NewTexClient(const gfx::IntSize& size) if (!surf) return nullptr; - RefPtr ret; + nsRefPtr ret; ret = new layers::SharedSurfaceTextureClient(mAllocator, mFlags, Move(surf), this); StartRecycling(ret); @@ -381,7 +381,7 @@ SurfaceFactory::StopRecycling(layers::SharedSurfaceTextureClient* tc) /*static*/ void SurfaceFactory::RecycleCallback(layers::TextureClient* rawTC, void* rawFactory) { - RefPtr tc; + nsRefPtr tc; tc = static_cast(rawTC); SurfaceFactory* factory = static_cast(rawFactory); @@ -404,7 +404,7 @@ SurfaceFactory::Recycle(layers::SharedSurfaceTextureClient* texClient) return false; } - RefPtr texClientRef = texClient; + nsRefPtr texClientRef = texClient; mRecycleFreePool.push(texClientRef); return true; } diff --git a/gfx/gl/SharedSurface.h b/gfx/gl/SharedSurface.h index 0e98689acf0..f8f4e539770 100644 --- a/gfx/gl/SharedSurface.h +++ b/gfx/gl/SharedSurface.h @@ -301,7 +301,7 @@ public: const SharedSurfaceType mType; GLContext* const mGL; const SurfaceCaps mCaps; - const RefPtr mAllocator; + const nsRefPtr mAllocator; const layers::TextureFlags mFlags; const GLFormats mFormats; Mutex mMutex; @@ -312,7 +312,7 @@ protected: RefSet mRecycleTotalPool; SurfaceFactory(SharedSurfaceType type, GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); public: diff --git a/gfx/gl/SharedSurfaceANGLE.cpp b/gfx/gl/SharedSurfaceANGLE.cpp index 9b8c444f6d7..fd5f17682fe 100644 --- a/gfx/gl/SharedSurfaceANGLE.cpp +++ b/gfx/gl/SharedSurfaceANGLE.cpp @@ -70,7 +70,7 @@ SharedSurface_ANGLEShareHandle::Create(GLContext* gl, EGLConfig config, pbuffer, LOCAL_EGL_DXGI_KEYED_MUTEX_ANGLE, &opaqueKeyedMutex); - RefPtr keyedMutex = static_cast(opaqueKeyedMutex); + nsRefPtr keyedMutex = static_cast(opaqueKeyedMutex); GLuint fence = 0; if (gl->IsExtensionSupported(GLContext::NV_fence)) { @@ -96,7 +96,7 @@ SharedSurface_ANGLEShareHandle::SharedSurface_ANGLEShareHandle(GLContext* gl, bool hasAlpha, EGLSurface pbuffer, HANDLE shareHandle, - const RefPtr& keyedMutex, + const nsRefPtr& keyedMutex, GLuint fence) : SharedSurface(SharedSurfaceType::EGLSurfaceANGLE, AttachmentType::Screen, @@ -196,14 +196,14 @@ void SharedSurface_ANGLEShareHandle::ConsumerAcquireImpl() { if (!mConsumerTexture) { - RefPtr tex; + nsRefPtr tex; HRESULT hr = gfxWindowsPlatform::GetPlatform()->GetD3D11Device()->OpenSharedResource(mShareHandle, __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(tex)); + (void**)(ID3D11Texture2D**)getter_AddRefs(tex)); if (SUCCEEDED(hr)) { mConsumerTexture = tex; - RefPtr mutex; - hr = tex->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + hr = tex->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); if (SUCCEEDED(hr)) { mConsumerKeyedMutex = mutex; @@ -285,7 +285,7 @@ public: *succeeded = false; HRESULT hr; - mTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mMutex)); + mTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mMutex)); if (mMutex) { hr = mMutex->AcquireSync(0, 10000); if (hr == WAIT_TIMEOUT) { @@ -299,7 +299,7 @@ public: } ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11Device(); - device->GetImmediateContext(byRef(mDeviceContext)); + device->GetImmediateContext(getter_AddRefs(mDeviceContext)); mTexture->GetDesc(&mDesc); mDesc.BindFlags = 0; @@ -307,7 +307,7 @@ public: mDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ; mDesc.MiscFlags = 0; - hr = device->CreateTexture2D(&mDesc, nullptr, byRef(mCopiedTexture)); + hr = device->CreateTexture2D(&mDesc, nullptr, getter_AddRefs(mCopiedTexture)); if (FAILED(hr)) { return; @@ -337,10 +337,10 @@ public: } bool mIsLocked; - RefPtr mTexture; - RefPtr mCopiedTexture; - RefPtr mMutex; - RefPtr mDeviceContext; + nsRefPtr mTexture; + nsRefPtr mCopiedTexture; + nsRefPtr mMutex; + nsRefPtr mDeviceContext; D3D11_TEXTURE2D_DESC mDesc; D3D11_MAPPED_SUBRESOURCE mSubresource; }; @@ -349,11 +349,11 @@ bool SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surface) { MOZ_ASSERT(out_surface); - RefPtr tex; + nsRefPtr tex; ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11Device(); HRESULT hr = device->OpenSharedResource(mShareHandle, __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(tex)); + (void**)(ID3D11Texture2D**)getter_AddRefs(tex)); if (FAILED(hr)) { return false; @@ -410,7 +410,7 @@ SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* o /*static*/ UniquePtr SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) { GLLibraryEGL* egl = &sEGLLibrary; @@ -430,7 +430,7 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps, SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags, GLLibraryEGL* egl, EGLConfig config) diff --git a/gfx/gl/SharedSurfaceANGLE.h b/gfx/gl/SharedSurfaceANGLE.h index f37b50ed988..13e12ebc354 100644 --- a/gfx/gl/SharedSurfaceANGLE.h +++ b/gfx/gl/SharedSurfaceANGLE.h @@ -39,9 +39,9 @@ protected: public: const HANDLE mShareHandle; protected: - RefPtr mKeyedMutex; - RefPtr mConsumerKeyedMutex; - RefPtr mConsumerTexture; + nsRefPtr mKeyedMutex; + nsRefPtr mConsumerKeyedMutex; + nsRefPtr mConsumerTexture; const GLuint mFence; @@ -51,7 +51,7 @@ protected: bool hasAlpha, EGLSurface pbuffer, HANDLE shareHandle, - const RefPtr& keyedMutex, + const nsRefPtr& keyedMutex, GLuint fence); EGLDisplay Display(); @@ -76,7 +76,7 @@ public: virtual bool WaitSync_ContentThread_Impl() override; virtual bool PollSync_ContentThread_Impl() override; - const RefPtr& GetConsumerTexture() const { + const nsRefPtr& GetConsumerTexture() const { return mConsumerTexture; } @@ -98,12 +98,12 @@ protected: public: static UniquePtr Create(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); protected: SurfaceFactory_ANGLEShareHandle(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags, GLLibraryEGL* egl, EGLConfig config); diff --git a/gfx/gl/SharedSurfaceEGL.cpp b/gfx/gl/SharedSurfaceEGL.cpp index f4391cd0fbd..5478977834e 100644 --- a/gfx/gl/SharedSurfaceEGL.cpp +++ b/gfx/gl/SharedSurfaceEGL.cpp @@ -224,7 +224,7 @@ SharedSurface_EGLImage::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surfa /*static*/ UniquePtr SurfaceFactory_EGLImage::Create(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) { EGLContext context = GLContextEGL::Cast(prodGL)->mContext; diff --git a/gfx/gl/SharedSurfaceEGL.h b/gfx/gl/SharedSurfaceEGL.h index 7dd847ef6f1..81d420ae41a 100644 --- a/gfx/gl/SharedSurfaceEGL.h +++ b/gfx/gl/SharedSurfaceEGL.h @@ -92,14 +92,14 @@ public: // Fallible: static UniquePtr Create(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); protected: const EGLContext mContext; SurfaceFactory_EGLImage(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags, EGLContext context) : SurfaceFactory(SharedSurfaceType::EGLImageShare, prodGL, caps, allocator, flags) diff --git a/gfx/gl/SharedSurfaceGLX.cpp b/gfx/gl/SharedSurfaceGLX.cpp index e91630c22ea..33e6fea6735 100644 --- a/gfx/gl/SharedSurfaceGLX.cpp +++ b/gfx/gl/SharedSurfaceGLX.cpp @@ -31,7 +31,7 @@ SharedSurface_GLXDrawable::Create(GLContext* prodGL, Screen* screen = XDefaultScreenOfDisplay(display); Visual* visual = gfxXlibSurface::FindVisual(screen, gfxImageFormat::ARGB32); - RefPtr surf = gfxXlibSurface::Create(screen, visual, size); + nsRefPtr surf = gfxXlibSurface::Create(screen, visual, size); if (!deallocateClient) surf->ReleasePixmap(); @@ -43,7 +43,7 @@ SharedSurface_GLXDrawable::Create(GLContext* prodGL, SharedSurface_GLXDrawable::SharedSurface_GLXDrawable(GLContext* gl, const gfx::IntSize& size, bool inSameProcess, - const RefPtr& xlibSurface) + const nsRefPtr& xlibSurface) : SharedSurface(SharedSurfaceType::GLXDrawable, AttachmentType::Screen, gl, @@ -88,7 +88,7 @@ bool SharedSurface_GLXDrawable::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surface) { MOZ_ASSERT(out_surface); - RefPtr dataSurf = + nsRefPtr dataSurf = new gfx::DataSourceSurfaceCairo(mXlibSurface->CairoSurface()); gfx::DataSourceSurface::ScopedMap mapSrc(dataSurf, gfx::DataSourceSurface::READ); @@ -120,7 +120,7 @@ SharedSurface_GLXDrawable::ReadbackBySharedHandle(gfx::DataSourceSurface* out_su UniquePtr SurfaceFactory_GLXDrawable::Create(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) { MOZ_ASSERT(caps.alpha, "GLX surfaces require an alpha channel!"); diff --git a/gfx/gl/SharedSurfaceGLX.h b/gfx/gl/SharedSurfaceGLX.h index 528c223400b..b740671e74c 100644 --- a/gfx/gl/SharedSurfaceGLX.h +++ b/gfx/gl/SharedSurfaceGLX.h @@ -7,7 +7,7 @@ #define SHARED_SURFACE_GLX_H_ #include "SharedSurface.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" class gfxXlibSurface; @@ -38,9 +38,9 @@ private: SharedSurface_GLXDrawable(GLContext* gl, const gfx::IntSize& size, bool inSameProcess, - const RefPtr& xlibSurface); + const nsRefPtr& xlibSurface); - RefPtr mXlibSurface; + nsRefPtr mXlibSurface; bool mInSameProcess; }; @@ -50,14 +50,14 @@ class SurfaceFactory_GLXDrawable public: static UniquePtr Create(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); virtual UniquePtr CreateShared(const gfx::IntSize& size) override; private: SurfaceFactory_GLXDrawable(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) : SurfaceFactory(SharedSurfaceType::GLXDrawable, prodGL, caps, allocator, flags) { } diff --git a/gfx/gl/SharedSurfaceGralloc.cpp b/gfx/gl/SharedSurfaceGralloc.cpp index 87c285ca135..6c898559c2c 100644 --- a/gfx/gl/SharedSurfaceGralloc.cpp +++ b/gfx/gl/SharedSurfaceGralloc.cpp @@ -35,7 +35,7 @@ using namespace mozilla::layers; using namespace android; SurfaceFactory_Gralloc::SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) : SurfaceFactory(SharedSurfaceType::Gralloc, prodGL, caps, allocator, flags) { @@ -64,7 +64,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL, : gfxContentType::COLOR; typedef GrallocTextureClientOGL ptrT; - RefPtr grallocTC = new ptrT(allocator, + nsRefPtr grallocTC = new ptrT(allocator, gfxPlatform::GetPlatform()->Optimal2DFormatForContent(type), gfx::BackendType::NONE, // we don't need to use it with a DrawTarget flags); diff --git a/gfx/gl/SharedSurfaceGralloc.h b/gfx/gl/SharedSurfaceGralloc.h index d19e33c461d..202bc993ac8 100644 --- a/gfx/gl/SharedSurfaceGralloc.h +++ b/gfx/gl/SharedSurfaceGralloc.h @@ -40,8 +40,8 @@ public: protected: GLLibraryEGL* const mEGL; EGLSync mSync; - RefPtr mAllocator; - RefPtr mTextureClient; + nsRefPtr mAllocator; + nsRefPtr mTextureClient; const GLuint mProdTex; SharedSurface_Gralloc(GLContext* prodGL, @@ -84,7 +84,7 @@ class SurfaceFactory_Gralloc { public: SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); virtual UniquePtr CreateShared(const gfx::IntSize& size) override { diff --git a/gfx/gl/SharedSurfaceIO.cpp b/gfx/gl/SharedSurfaceIO.cpp index 2154327daf3..ba605c9feb7 100644 --- a/gfx/gl/SharedSurfaceIO.cpp +++ b/gfx/gl/SharedSurfaceIO.cpp @@ -15,7 +15,7 @@ namespace mozilla { namespace gl { /*static*/ UniquePtr -SharedSurface_IOSurface::Create(const RefPtr& ioSurf, +SharedSurface_IOSurface::Create(const nsRefPtr& ioSurf, GLContext* gl, bool hasAlpha) { @@ -145,7 +145,7 @@ BackTextureWithIOSurf(GLContext* gl, GLuint tex, MacIOSurface* ioSurf) ioSurf->CGLTexImageIOSurface2D(cgl); } -SharedSurface_IOSurface::SharedSurface_IOSurface(const RefPtr& ioSurf, +SharedSurface_IOSurface::SharedSurface_IOSurface(const nsRefPtr& ioSurf, GLContext* gl, const gfx::IntSize& size, bool hasAlpha) @@ -212,7 +212,7 @@ SharedSurface_IOSurface::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surf /*static*/ UniquePtr SurfaceFactory_IOSurface::Create(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags) { gfx::IntSize maxDims(MacIOSurface::GetMaxWidth(), @@ -233,7 +233,7 @@ SurfaceFactory_IOSurface::CreateShared(const gfx::IntSize& size) } bool hasAlpha = mReadCaps.alpha; - RefPtr ioSurf; + nsRefPtr ioSurf; ioSurf = MacIOSurface::CreateIOSurface(size.width, size.height, 1.0, hasAlpha); diff --git a/gfx/gl/SharedSurfaceIO.h b/gfx/gl/SharedSurfaceIO.h index fe787ef9cf1..633d2f8864f 100644 --- a/gfx/gl/SharedSurfaceIO.h +++ b/gfx/gl/SharedSurfaceIO.h @@ -6,7 +6,7 @@ #ifndef SHARED_SURFACEIO_H_ #define SHARED_SURFACEIO_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "SharedSurface.h" class MacIOSurface; @@ -17,16 +17,16 @@ namespace gl { class SharedSurface_IOSurface : public SharedSurface { private: - const RefPtr mIOSurf; + const nsRefPtr mIOSurf; GLuint mProdTex; public: - static UniquePtr Create(const RefPtr& ioSurf, + static UniquePtr Create(const nsRefPtr& ioSurf, GLContext* gl, bool hasAlpha); private: - SharedSurface_IOSurface(const RefPtr& ioSurf, + SharedSurface_IOSurface(const nsRefPtr& ioSurf, GLContext* gl, const gfx::IntSize& size, bool hasAlpha); @@ -78,13 +78,13 @@ public: // Infallible. static UniquePtr Create(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags); protected: const gfx::IntSize mMaxDims; SurfaceFactory_IOSurface(GLContext* gl, const SurfaceCaps& caps, - const RefPtr& allocator, + const nsRefPtr& allocator, const layers::TextureFlags& flags, const gfx::IntSize& maxDims) : SurfaceFactory(SharedSurfaceType::IOSurface, gl, caps, allocator, flags) diff --git a/gfx/gl/SkiaGLGlue.h b/gfx/gl/SkiaGLGlue.h index c7ef5a5eee0..9e98b2c64b2 100755 --- a/gfx/gl/SkiaGLGlue.h +++ b/gfx/gl/SkiaGLGlue.h @@ -9,7 +9,7 @@ #ifdef USE_SKIA_GPU #include "mozilla/gfx/RefPtrSkia.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" struct GrGLInterface; class GrContext; @@ -31,7 +31,7 @@ protected: virtual ~SkiaGLGlue(); private: - RefPtr mGLContext; + nsRefPtr mGLContext; gfx::RefPtrSkia mGrGLInterface; gfx::RefPtrSkia mGrContext; }; diff --git a/gfx/gl/SurfaceTypes.h b/gfx/gl/SurfaceTypes.h index f4507291cd4..f32ac79e862 100644 --- a/gfx/gl/SurfaceTypes.h +++ b/gfx/gl/SurfaceTypes.h @@ -6,7 +6,7 @@ #ifndef SURFACE_TYPES_H_ #define SURFACE_TYPES_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Attributes.h" #include @@ -29,7 +29,7 @@ struct SurfaceCaps final // The surface allocator that we want to create this // for. May be null. - RefPtr surfaceAllocator; + nsRefPtr surfaceAllocator; SurfaceCaps(); SurfaceCaps(const SurfaceCaps& other); diff --git a/gfx/gl/TextureImageEGL.cpp b/gfx/gl/TextureImageEGL.cpp index b60110dea93..14b85fd68be 100644 --- a/gfx/gl/TextureImageEGL.cpp +++ b/gfx/gl/TextureImageEGL.cpp @@ -146,8 +146,8 @@ TextureImageEGL::EndUpdate() // a fast mapping between our cairo target surface and the GL // texture, so we have to upload data. - RefPtr updateSurface = nullptr; - RefPtr uploadImage = nullptr; + nsRefPtr updateSurface = nullptr; + nsRefPtr uploadImage = nullptr; gfx::IntSize updateSize(mUpdateRect.width, mUpdateRect.height); NS_ASSERTION(mUpdateDrawTarget->GetSize() == updateSize, diff --git a/gfx/gl/TextureImageEGL.h b/gfx/gl/TextureImageEGL.h index 472718e2efd..dc9a326d047 100644 --- a/gfx/gl/TextureImageEGL.h +++ b/gfx/gl/TextureImageEGL.h @@ -67,7 +67,7 @@ protected: gfx::IntRect mUpdateRect; gfx::SurfaceFormat mUpdateFormat; - RefPtr mUpdateDrawTarget; + nsRefPtr mUpdateDrawTarget; EGLImage mEGLImage; GLuint mTexture; EGLSurface mSurface; diff --git a/gfx/layers/AsyncCanvasRenderer.cpp b/gfx/layers/AsyncCanvasRenderer.cpp index f8a35572a7b..a55b772bd8a 100644 --- a/gfx/layers/AsyncCanvasRenderer.cpp +++ b/gfx/layers/AsyncCanvasRenderer.cpp @@ -147,7 +147,7 @@ void AsyncCanvasRenderer::CopyFromTextureClient(TextureClient* aTextureClient) { MutexAutoLock lock(mMutex); - RefPtr buffer = static_cast(aTextureClient); + nsRefPtr buffer = static_cast(aTextureClient); if (!buffer->Lock(layers::OpenMode::OPEN_READ)) { return; } @@ -209,7 +209,7 @@ AsyncCanvasRenderer::UpdateTarget() // B8G8R8A8 format here. const gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8; uint32_t stride = gfx::GetAlignedStride<8>(size.width * BytesPerPixel(format)); - RefPtr surface = + nsRefPtr surface = gfx::Factory::CreateDataSourceSurfaceWithStride(size, format, stride); @@ -236,7 +236,7 @@ AsyncCanvasRenderer::GetSurface() MutexAutoLock lock(mMutex); if (mSurfaceForBasic) { // Since SourceSurface isn't thread-safe, we need copy to a new SourceSurface. - RefPtr result = + nsRefPtr result = gfx::Factory::CreateDataSourceSurfaceWithStride(mSurfaceForBasic->GetSize(), mSurfaceForBasic->GetFormat(), mSurfaceForBasic->Stride()); @@ -264,13 +264,13 @@ AsyncCanvasRenderer::GetInputStream(const char *aMimeType, nsIInputStream **aStream) { MOZ_ASSERT(NS_IsMainThread()); - RefPtr surface = GetSurface(); + nsRefPtr surface = GetSurface(); if (!surface) { return NS_ERROR_FAILURE; } // Handle y flip. - RefPtr dataSurf = gl::YInvertImageSurface(surface); + nsRefPtr dataSurf = gl::YInvertImageSurface(surface); return gfxUtils::GetInputStream(dataSurf, false, aMimeType, aEncoderOptions, aStream); } diff --git a/gfx/layers/AsyncCanvasRenderer.h b/gfx/layers/AsyncCanvasRenderer.h index 6a84b070352..b2e87ca63f8 100644 --- a/gfx/layers/AsyncCanvasRenderer.h +++ b/gfx/layers/AsyncCanvasRenderer.h @@ -10,7 +10,7 @@ #include "LayersTypes.h" #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" // for nsAutoPtr, nsRefPtr, etc +#include "mozilla/nsRefPtr.h" // for nsAutoPtr, nsRefPtr, etc #include "nsCOMPtr.h" // for nsCOMPtr class nsICanvasRenderingContextInternal; @@ -129,7 +129,7 @@ public: // We need to keep a reference to the context around here, otherwise the // canvas' surface texture destructor will deref and destroy it too early // Only accessed in active thread. - RefPtr mGLContext; + nsRefPtr mGLContext; private: virtual ~AsyncCanvasRenderer(); @@ -154,7 +154,7 @@ private: // in order to send frame to compositor. To avoid readback again, // we copy from this TextureClient to this mSurfaceForBasic directly // by calling CopyFromTextureClient(). - RefPtr mSurfaceForBasic; + nsRefPtr mSurfaceForBasic; // Protect non thread-safe objects. Mutex mMutex; diff --git a/gfx/layers/AtomicRefCountedWithFinalize.h b/gfx/layers/AtomicRefCountedWithFinalize.h index 5e9483df6d7..4c7c3e94c28 100644 --- a/gfx/layers/AtomicRefCountedWithFinalize.h +++ b/gfx/layers/AtomicRefCountedWithFinalize.h @@ -6,7 +6,7 @@ #ifndef MOZILLA_ATOMICREFCOUNTEDWITHFINALIZE_H_ #define MOZILLA_ATOMICREFCOUNTEDWITHFINALIZE_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Likely.h" #include "MainThreadUtils.h" #include "base/message_loop.h" diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 13648a9289e..87db7d60546 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -8,7 +8,7 @@ #include "Units.h" // for ScreenPoint #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted +#include "mozilla/nsRefPtr.h" // for already_AddRefed, RefCounted #include "mozilla/gfx/Point.h" // for IntSize, Point #include "mozilla/gfx/Rect.h" // for Rect, IntRect #include "mozilla/gfx/Types.h" // for Float @@ -538,7 +538,7 @@ protected: virtual gfx::IntSize GetWidgetSize() const = 0; - RefPtr mTarget; + nsRefPtr mTarget; gfx::IntRect mTargetBounds; private: diff --git a/gfx/layers/CopyableCanvasLayer.cpp b/gfx/layers/CopyableCanvasLayer.cpp index 0fad0aa3668..8a40ab3a98e 100644 --- a/gfx/layers/CopyableCanvasLayer.cpp +++ b/gfx/layers/CopyableCanvasLayer.cpp @@ -136,7 +136,7 @@ CopyableCanvasLayer::UpdateTarget(DrawTarget* aDestTarget) SurfaceFormat destFormat; if (aDestTarget->LockBits(&destData, &destSize, &destStride, &destFormat)) { if (destSize == readSize && destFormat == format) { - RefPtr data = + nsRefPtr data = Factory::CreateWrappingDataSourceSurface(destData, destStride, destSize, destFormat); mGLContext->Readback(frontbuffer, data); if (needsPremult) { @@ -149,7 +149,7 @@ CopyableCanvasLayer::UpdateTarget(DrawTarget* aDestTarget) } } - RefPtr resultSurf = GetTempSurface(readSize, format); + nsRefPtr resultSurf = GetTempSurface(readSize, format); // There will already be a warning from inside of GetTempSurface, but // it doesn't hurt to complain: if (NS_WARN_IF(!resultSurf)) { diff --git a/gfx/layers/CopyableCanvasLayer.h b/gfx/layers/CopyableCanvasLayer.h index ae291bdf07d..f2ad2914d0a 100644 --- a/gfx/layers/CopyableCanvasLayer.h +++ b/gfx/layers/CopyableCanvasLayer.h @@ -14,7 +14,7 @@ #include "gfxPlatform.h" // for gfxImageFormat #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Preferences.h" // for Preferences -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/mozalloc.h" // for operator delete, etc #include "nsAutoPtr.h" // for nsRefPtr @@ -50,17 +50,17 @@ public: protected: void UpdateTarget(gfx::DrawTarget* aDestTarget = nullptr); - RefPtr mSurface; + nsRefPtr mSurface; nsRefPtr mGLContext; GLuint mCanvasFrontbufferTexID; - RefPtr mBufferProvider; + nsRefPtr mBufferProvider; UniquePtr mGLFrontbuffer; bool mIsAlphaPremultiplied; gl::OriginPos mOriginPos; - RefPtr mCachedTempSurface; + nsRefPtr mCachedTempSurface; gfx::DataSourceSurface* GetTempSurface(const gfx::IntSize& aSize, const gfx::SurfaceFormat aFormat); diff --git a/gfx/layers/D3D11ShareHandleImage.cpp b/gfx/layers/D3D11ShareHandleImage.cpp index b483b7d9326..143fd71d96f 100644 --- a/gfx/layers/D3D11ShareHandleImage.cpp +++ b/gfx/layers/D3D11ShareHandleImage.cpp @@ -47,17 +47,17 @@ D3D11ShareHandleImage::GetTextureClient(CompositableClient* aClient) already_AddRefed D3D11ShareHandleImage::GetAsSourceSurface() { - RefPtr texture = GetTexture(); + nsRefPtr texture = GetTexture(); if (!texture) { NS_WARNING("Cannot readback from shared texture because no texture is available."); return nullptr; } - RefPtr device; - texture->GetDevice(byRef(device)); + nsRefPtr device; + texture->GetDevice(getter_AddRefs(device)); - RefPtr keyedMutex; - if (FAILED(texture->QueryInterface(static_cast(byRef(keyedMutex))))) { + nsRefPtr keyedMutex; + if (FAILED(texture->QueryInterface(static_cast(getter_AddRefs(keyedMutex))))) { NS_WARNING("Failed to QueryInterface for IDXGIKeyedMutex, strange."); return nullptr; } @@ -77,10 +77,10 @@ D3D11ShareHandleImage::GetAsSourceSurface() softDesc.MipLevels = 1; softDesc.Usage = D3D11_USAGE_STAGING; - RefPtr softTexture; + nsRefPtr softTexture; HRESULT hr = device->CreateTexture2D(&softDesc, NULL, - static_cast(byRef(softTexture))); + static_cast(getter_AddRefs(softTexture))); if (FAILED(hr)) { NS_WARNING("Failed to create 2D staging texture."); @@ -88,8 +88,8 @@ D3D11ShareHandleImage::GetAsSourceSurface() return nullptr; } - RefPtr context; - device->GetImmediateContext(byRef(context)); + nsRefPtr context; + device->GetImmediateContext(getter_AddRefs(context)); if (!context) { keyedMutex->ReleaseSync(0); return nullptr; @@ -98,7 +98,7 @@ D3D11ShareHandleImage::GetAsSourceSurface() context->CopyResource(softTexture, texture); keyedMutex->ReleaseSync(0); - RefPtr surface = + nsRefPtr surface = gfx::Factory::CreateDataSourceSurface(mSize, gfx::SurfaceFormat::B8G8R8X8); if (NS_WARN_IF(!surface)) { return nullptr; @@ -151,7 +151,7 @@ already_AddRefed D3D11RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat, const gfx::IntSize& aSize) { - RefPtr textureClient = + nsRefPtr textureClient = CreateOrRecycle(aFormat, aSize, BackendSelector::Content, @@ -160,7 +160,7 @@ D3D11RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat, return nullptr; } - RefPtr textureD3D11 = static_cast(textureClient.get()); + nsRefPtr textureD3D11 = static_cast(textureClient.get()); return textureD3D11.forget(); } diff --git a/gfx/layers/D3D11ShareHandleImage.h b/gfx/layers/D3D11ShareHandleImage.h index 93836705c23..aa83513c529 100644 --- a/gfx/layers/D3D11ShareHandleImage.h +++ b/gfx/layers/D3D11ShareHandleImage.h @@ -6,7 +6,7 @@ #ifndef GFX_D311_SHARE_HANDLE_IMAGE_H #define GFX_D311_SHARE_HANDLE_IMAGE_H -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "ImageContainer.h" #include "nsAutoPtr.h" #include "d3d11.h" @@ -38,7 +38,7 @@ protected: TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags) override; - RefPtr mDevice; + nsRefPtr mDevice; }; // Image class that wraps a ID3D11Texture2D. This class copies the image @@ -55,7 +55,7 @@ public: : mAllocator(aAllocator) , mSize(aSize) , mRegion(aRegion) {} - RefPtr mAllocator; + nsRefPtr mAllocator; gfx::IntSize mSize; gfx::IntRect mRegion; }; @@ -81,7 +81,7 @@ private: gfx::IntSize mSize; gfx::IntRect mPictureRect; - RefPtr mTextureClient; + nsRefPtr mTextureClient; }; } // namepace layers diff --git a/gfx/layers/D3D9SurfaceImage.cpp b/gfx/layers/D3D9SurfaceImage.cpp index 9eb2cc616e2..76459ec5092 100644 --- a/gfx/layers/D3D9SurfaceImage.cpp +++ b/gfx/layers/D3D9SurfaceImage.cpp @@ -31,14 +31,14 @@ D3D9SurfaceImage::SetData(const Data& aData) { NS_ENSURE_TRUE(aData.mSurface, E_POINTER); HRESULT hr; - RefPtr surface = aData.mSurface; + nsRefPtr surface = aData.mSurface; - RefPtr device; - hr = surface->GetDevice(byRef(device)); + nsRefPtr device; + hr = surface->GetDevice(getter_AddRefs(device)); NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); - RefPtr d3d9; - hr = device->GetDirect3D(byRef(d3d9)); + nsRefPtr d3d9; + hr = device->GetDirect3D(getter_AddRefs(d3d9)); NS_ENSURE_TRUE(SUCCEEDED(hr), E_FAIL); D3DSURFACE_DESC desc; @@ -55,7 +55,7 @@ D3D9SurfaceImage::SetData(const Data& aData) // to a sharable texture to that it's accessible to the layer manager's // device. const gfx::IntRect& region = aData.mRegion; - RefPtr textureClient = + nsRefPtr textureClient = aData.mAllocator->CreateOrRecycleClient(gfx::SurfaceFormat::B8G8R8X8, region.Size()); if (!textureClient) { @@ -63,7 +63,7 @@ D3D9SurfaceImage::SetData(const Data& aData) } // Copy the image onto the texture, preforming YUV -> RGB conversion if necessary. - RefPtr textureSurface = textureClient->GetD3D9Surface(); + nsRefPtr textureSurface = textureClient->GetD3D9Surface(); if (!textureSurface) { return E_FAIL; } @@ -75,8 +75,8 @@ D3D9SurfaceImage::SetData(const Data& aData) // Flush the draw command now, so that by the time we come to draw this // image, we're less likely to need to wait for the draw operation to // complete. - RefPtr query; - hr = device->CreateQuery(D3DQUERYTYPE_EVENT, byRef(query)); + nsRefPtr query; + hr = device->CreateQuery(D3DQUERYTYPE_EVENT, getter_AddRefs(query)); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); hr = query->Issue(D3DISSUE_END); NS_ENSURE_TRUE(SUCCEEDED(hr), hr); @@ -99,7 +99,7 @@ D3D9SurfaceImage::IsValid() void D3D9SurfaceImage::EnsureSynchronized() { - RefPtr query = mQuery; + nsRefPtr query = mQuery; if (!query) { // Not setup, or already synchronized. return; @@ -147,7 +147,7 @@ D3D9SurfaceImage::GetAsSourceSurface() NS_ENSURE_TRUE(mTextureClient, nullptr); HRESULT hr; - RefPtr surface = gfx::Factory::CreateDataSourceSurface(mSize, gfx::SurfaceFormat::B8G8R8X8); + nsRefPtr surface = gfx::Factory::CreateDataSourceSurface(mSize, gfx::SurfaceFormat::B8G8R8X8); if (NS_WARN_IF(!surface)) { return nullptr; } @@ -157,22 +157,22 @@ D3D9SurfaceImage::GetAsSourceSurface() // Readback the texture from GPU memory into system memory, so that // we can copy it into the Cairo image. This is expensive. - RefPtr textureSurface = mTextureClient->GetD3D9Surface(); + nsRefPtr textureSurface = mTextureClient->GetD3D9Surface(); if (!textureSurface) { return nullptr; } - RefPtr device = mTextureClient->GetD3D9Device(); + nsRefPtr device = mTextureClient->GetD3D9Device(); if (!device) { return nullptr; } - RefPtr systemMemorySurface; + nsRefPtr systemMemorySurface; hr = device->CreateOffscreenPlainSurface(mSize.width, mSize.height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, - byRef(systemMemorySurface), + getter_AddRefs(systemMemorySurface), 0); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); @@ -221,7 +221,7 @@ already_AddRefed D3D9RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat, const gfx::IntSize& aSize) { - RefPtr textureClient = + nsRefPtr textureClient = CreateOrRecycle(aFormat, aSize, BackendSelector::Content, @@ -230,7 +230,7 @@ D3D9RecycleAllocator::CreateOrRecycleClient(gfx::SurfaceFormat aFormat, return nullptr; } - RefPtr textureD3D9 = static_cast(textureClient.get()); + nsRefPtr textureD3D9 = static_cast(textureClient.get()); return textureD3D9.forget(); } diff --git a/gfx/layers/D3D9SurfaceImage.h b/gfx/layers/D3D9SurfaceImage.h index a4c68288a55..85c8da298e2 100644 --- a/gfx/layers/D3D9SurfaceImage.h +++ b/gfx/layers/D3D9SurfaceImage.h @@ -6,7 +6,7 @@ #ifndef GFX_D3DSURFACEIMAGE_H #define GFX_D3DSURFACEIMAGE_H -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "ImageContainer.h" #include "nsAutoPtr.h" #include "d3d9.h" @@ -38,7 +38,7 @@ protected: TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags) override; - RefPtr mDevice; + nsRefPtr mDevice; }; // Image class that wraps a IDirect3DSurface9. This class copies the image @@ -59,9 +59,9 @@ public: , mIsFirstFrame(aIsFirstFrame) {} - RefPtr mSurface; + nsRefPtr mSurface; gfx::IntRect mRegion; - RefPtr mAllocator; + nsRefPtr mAllocator; bool mIsFirstFrame; }; @@ -90,8 +90,8 @@ private: void EnsureSynchronized(); gfx::IntSize mSize; - RefPtr mQuery; - RefPtr mTextureClient; + nsRefPtr mQuery; + nsRefPtr mTextureClient; bool mValid; bool mIsFirstFrame; }; diff --git a/gfx/layers/Effects.h b/gfx/layers/Effects.h index 53d397a1955..2173d94af21 100644 --- a/gfx/layers/Effects.h +++ b/gfx/layers/Effects.h @@ -7,7 +7,7 @@ #define MOZILLA_LAYERS_EFFECTS_H #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed, etc #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Rect.h" // for Rect @@ -120,7 +120,7 @@ struct EffectVRDistortion : public Effect virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix); nsRefPtr mHMD; - RefPtr mRenderTarget; + nsRefPtr mRenderTarget; TextureSource* mTexture; // The viewport for each eye in the source and @@ -152,7 +152,7 @@ struct EffectRenderTarget : public TexturedEffect virtual const char* Name() { return "EffectRenderTarget"; } virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix); - RefPtr mRenderTarget; + nsRefPtr mRenderTarget; protected: EffectRenderTarget(EffectTypes aType, CompositingRenderTarget *aRenderTarget) @@ -239,8 +239,8 @@ struct EffectChain EffectChain() : mLayerRef(nullptr) {} explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {} - RefPtr mPrimaryEffect; - EnumeratedArray> + nsRefPtr mPrimaryEffect; + EnumeratedArray> mSecondaryEffects; void* mLayerRef; //!< For LayerScope logging }; @@ -262,7 +262,7 @@ CreateTexturedEffect(gfx::SurfaceFormat aFormat, const LayerRenderState &state = LayerRenderState()) { MOZ_ASSERT(aSource); - RefPtr result; + nsRefPtr result; switch (aFormat) { case gfx::SurfaceFormat::B8G8R8A8: case gfx::SurfaceFormat::B8G8R8X8: diff --git a/gfx/layers/GLImages.cpp b/gfx/layers/GLImages.cpp index 598e2f7e6fd..521605e0225 100644 --- a/gfx/layers/GLImages.cpp +++ b/gfx/layers/GLImages.cpp @@ -71,7 +71,7 @@ GLImage::GetAsSourceSurface() return nullptr; } - RefPtr source = + nsRefPtr source = gfx::Factory::CreateDataSourceSurface(size, gfx::SurfaceFormat::B8G8R8A8); if (NS_WARN_IF(!source)) { return nullptr; diff --git a/gfx/layers/GrallocImages.cpp b/gfx/layers/GrallocImages.cpp index 77576f577b6..fc34f41a778 100644 --- a/gfx/layers/GrallocImages.cpp +++ b/gfx/layers/GrallocImages.cpp @@ -73,7 +73,7 @@ GrallocImage::SetData(const Data& aData) return; } - RefPtr textureClient = + nsRefPtr textureClient = new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(), gfx::SurfaceFormat::UNKNOWN, gfx::BackendType::NONE); @@ -407,7 +407,7 @@ GrallocImage::GetAsSourceSurface() android::sp graphicBuffer = mTextureClient->GetGraphicBuffer(); - RefPtr surface = + nsRefPtr surface = gfx::Factory::CreateDataSourceSurface(GetSize(), gfx::SurfaceFormat::R5G6B5); if (NS_WARN_IF(!surface)) { return nullptr; diff --git a/gfx/layers/GrallocImages.h b/gfx/layers/GrallocImages.h index 121015e0a95..9c71db5b9f8 100644 --- a/gfx/layers/GrallocImages.h +++ b/gfx/layers/GrallocImages.h @@ -124,7 +124,7 @@ public: } private: - RefPtr mTextureClient; + nsRefPtr mTextureClient; }; } // namespace layers diff --git a/gfx/layers/IMFYCbCrImage.cpp b/gfx/layers/IMFYCbCrImage.cpp index 329b3d27009..979f900a11b 100644 --- a/gfx/layers/IMFYCbCrImage.cpp +++ b/gfx/layers/IMFYCbCrImage.cpp @@ -34,7 +34,7 @@ struct AutoLockTexture { AutoLockTexture(ID3D11Texture2D* aTexture) { - aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mMutex)); + aTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mMutex)); HRESULT hr = mMutex->AcquireSync(0, 10000); if (hr == WAIT_TIMEOUT) { MOZ_CRASH(); @@ -53,14 +53,14 @@ struct AutoLockTexture } } - RefPtr mMutex; + nsRefPtr mMutex; }; static already_AddRefed InitTextures(IDirect3DDevice9* aDevice, const IntSize &aSize, _D3DFORMAT aFormat, - RefPtr& aSurface, + nsRefPtr& aSurface, HANDLE& aHandle, D3DLOCKED_RECT& aLockedRect) { @@ -68,27 +68,27 @@ InitTextures(IDirect3DDevice9* aDevice, return nullptr; } - RefPtr result; + nsRefPtr result; if (FAILED(aDevice->CreateTexture(aSize.width, aSize.height, 1, 0, aFormat, D3DPOOL_DEFAULT, - byRef(result), &aHandle))) { + getter_AddRefs(result), &aHandle))) { return nullptr; } if (!result) { return nullptr; } - RefPtr tmpTexture; + nsRefPtr tmpTexture; if (FAILED(aDevice->CreateTexture(aSize.width, aSize.height, 1, 0, aFormat, D3DPOOL_SYSTEMMEM, - byRef(tmpTexture), nullptr))) { + getter_AddRefs(tmpTexture), nullptr))) { return nullptr; } if (!tmpTexture) { return nullptr; } - tmpTexture->GetSurfaceLevel(0, byRef(aSurface)); + tmpTexture->GetSurfaceLevel(0, getter_AddRefs(aSurface)); if (FAILED(aSurface->LockRect(&aLockedRect, nullptr, 0)) || !aLockedRect.pBits) { NS_WARNING("Could not lock surface"); @@ -126,13 +126,13 @@ FinishTextures(IDirect3DDevice9* aDevice, } static bool UploadData(IDirect3DDevice9* aDevice, - RefPtr& aTexture, + nsRefPtr& aTexture, HANDLE& aHandle, uint8_t* aSrc, const gfx::IntSize& aSrcSize, int32_t aSrcStride) { - RefPtr surf; + nsRefPtr surf; D3DLOCKED_RECT rect; aTexture = InitTextures(aDevice, aSrcSize, D3DFMT_A8, surf, aHandle, rect); if (!aTexture) { @@ -160,29 +160,29 @@ IMFYCbCrImage::GetD3D9TextureClient(CompositableClient* aClient) return nullptr; } - RefPtr textureY; + nsRefPtr textureY; HANDLE shareHandleY = 0; if (!UploadData(device, textureY, shareHandleY, mData.mYChannel, mData.mYSize, mData.mYStride)) { return nullptr; } - RefPtr textureCb; + nsRefPtr textureCb; HANDLE shareHandleCb = 0; if (!UploadData(device, textureCb, shareHandleCb, mData.mCbChannel, mData.mCbCrSize, mData.mCbCrStride)) { return nullptr; } - RefPtr textureCr; + nsRefPtr textureCr; HANDLE shareHandleCr = 0; if (!UploadData(device, textureCr, shareHandleCr, mData.mCrChannel, mData.mCbCrSize, mData.mCbCrStride)) { return nullptr; } - RefPtr query; - HRESULT hr = device->CreateQuery(D3DQUERYTYPE_EVENT, byRef(query)); + nsRefPtr query; + HRESULT hr = device->CreateQuery(D3DQUERYTYPE_EVENT, getter_AddRefs(query)); hr = query->Issue(D3DISSUE_END); int iterations = 0; @@ -237,27 +237,27 @@ IMFYCbCrImage::GetTextureClient(CompositableClient* aClient) return mTextureClient; } - RefPtr ctx; - device->GetImmediateContext(byRef(ctx)); + nsRefPtr ctx; + device->GetImmediateContext(getter_AddRefs(ctx)); CD3D11_TEXTURE2D_DESC newDesc(DXGI_FORMAT_R8_UNORM, mData.mYSize.width, mData.mYSize.height, 1, 1); newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; - RefPtr textureY; - HRESULT hr = device->CreateTexture2D(&newDesc, nullptr, byRef(textureY)); + nsRefPtr textureY; + HRESULT hr = device->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(textureY)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); newDesc.Width = mData.mCbCrSize.width; newDesc.Height = mData.mCbCrSize.height; - RefPtr textureCb; - hr = device->CreateTexture2D(&newDesc, nullptr, byRef(textureCb)); + nsRefPtr textureCb; + hr = device->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(textureCb)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); - RefPtr textureCr; - hr = device->CreateTexture2D(&newDesc, nullptr, byRef(textureCr)); + nsRefPtr textureCr; + hr = device->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(textureCr)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); { diff --git a/gfx/layers/IMFYCbCrImage.h b/gfx/layers/IMFYCbCrImage.h index d2ba5ec5bbc..ee01c31d6c2 100644 --- a/gfx/layers/IMFYCbCrImage.h +++ b/gfx/layers/IMFYCbCrImage.h @@ -6,7 +6,7 @@ #ifndef GFX_IMFYCBCRIMAGE_H #define GFX_IMFYCBCRIMAGE_H -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "ImageContainer.h" #include "mfidl.h" @@ -32,9 +32,9 @@ protected: ~IMFYCbCrImage(); - RefPtr mBuffer; - RefPtr m2DBuffer; - RefPtr mTextureClient; + nsRefPtr mBuffer; + nsRefPtr m2DBuffer; + nsRefPtr mTextureClient; }; } // namepace layers diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index 3bb80ebe44f..21a36bfc43d 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -10,7 +10,7 @@ #include "gfx2DGlue.h" #include "gfxPlatform.h" // for gfxPlatform #include "gfxUtils.h" // for gfxUtils -#include "mozilla/RefPtr.h" // for already_AddRefed +#include "mozilla/nsRefPtr.h" // for already_AddRefed #include "mozilla/ipc/CrossProcessMutex.h" // for CrossProcessMutex, etc #include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/ImageBridgeChild.h" // for ImageBridgeChild @@ -552,7 +552,7 @@ already_AddRefed PlanarYCbCrImage::GetAsSourceSurface() { if (mSourceSurface) { - RefPtr surface(mSourceSurface); + nsRefPtr surface(mSourceSurface); return surface.forget(); } @@ -565,7 +565,7 @@ PlanarYCbCrImage::GetAsSourceSurface() return nullptr; } - RefPtr surface = gfx::Factory::CreateDataSourceSurface(size, format); + nsRefPtr surface = gfx::Factory::CreateDataSourceSurface(size, format); if (NS_WARN_IF(!surface)) { return nullptr; } @@ -598,12 +598,12 @@ CairoImage::GetTextureClient(CompositableClient *aClient) } CompositableForwarder* forwarder = aClient->GetForwarder(); - RefPtr textureClient = mTextureClients.Get(forwarder->GetSerial()); + nsRefPtr textureClient = mTextureClients.Get(forwarder->GetSerial()); if (textureClient) { return textureClient; } - RefPtr surface = GetAsSourceSurface(); + nsRefPtr surface = GetAsSourceSurface(); MOZ_ASSERT(surface); if (!surface) { return nullptr; @@ -617,7 +617,7 @@ CairoImage::GetTextureClient(CompositableClient *aClient) // XXX only gonk ensure when TextureClient is recycled, // TextureHost is not used by CompositableHost. #ifdef MOZ_WIDGET_GONK - RefPtr recycler = + nsRefPtr recycler = aClient->GetTextureClientRecycler(); if (recycler) { textureClient = diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index ae03564fded..1fe86391385 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -741,7 +741,7 @@ class CairoImage final : public Image { public: struct Data { gfx::IntSize mSize; - RefPtr mSourceSurface; + nsRefPtr mSourceSurface; }; /** @@ -757,7 +757,7 @@ public: virtual already_AddRefed GetAsSourceSurface() override { - RefPtr surface(mSourceSurface); + nsRefPtr surface(mSourceSurface); return surface.forget(); } @@ -771,7 +771,7 @@ public: gfx::IntSize mSize; nsCountedRef mSourceSurface; - nsDataHashtable > mTextureClients; + nsDataHashtable > mTextureClients; }; #ifdef MOZ_WIDGET_GONK diff --git a/gfx/layers/ImageDataSerializer.cpp b/gfx/layers/ImageDataSerializer.cpp index 2b235c60ab3..ecbaea5825e 100644 --- a/gfx/layers/ImageDataSerializer.cpp +++ b/gfx/layers/ImageDataSerializer.cpp @@ -151,7 +151,7 @@ already_AddRefed ImageDataSerializerBase::GetAsDrawTarget(gfx::BackendType aBackend) { MOZ_ASSERT(IsValid()); - RefPtr dt = gfx::Factory::CreateDrawTargetForData(aBackend, + nsRefPtr dt = gfx::Factory::CreateDrawTargetForData(aBackend, GetData(), GetSize(), GetStride(), GetFormat()); if (!dt) { diff --git a/gfx/layers/ImageDataSerializer.h b/gfx/layers/ImageDataSerializer.h index e2752f25735..e30c2fb1e4d 100644 --- a/gfx/layers/ImageDataSerializer.h +++ b/gfx/layers/ImageDataSerializer.h @@ -10,7 +10,7 @@ #include // for uint8_t, uint32_t #include "mozilla/Attributes.h" // for MOZ_STACK_CLASS -#include "mozilla/RefPtr.h" // for already_AddRefed +#include "mozilla/nsRefPtr.h" // for already_AddRefed #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat diff --git a/gfx/layers/LayerScope.cpp b/gfx/layers/LayerScope.cpp index 0a88a68d052..857bc5ae3b6 100644 --- a/gfx/layers/LayerScope.cpp +++ b/gfx/layers/LayerScope.cpp @@ -1060,7 +1060,7 @@ SenderHelper::SendTextureSource(GLContext* aGLContext, // By sending 0 to ReadTextureImage rely upon aSource->BindTexture binding // texture correctly. texID is used for tracking in DebugGLTextureData. - RefPtr img = + nsRefPtr img = aGLContext->ReadTexImageHelper()->ReadTexImage(0, textureTarget, size, shaderConfig, aFlipY); diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index ab618aea97c..c5933779895 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -168,7 +168,7 @@ already_AddRefed LayerManager::CreatePersistentBufferProvider(const mozilla::gfx::IntSize &aSize, mozilla::gfx::SurfaceFormat aFormat) { - RefPtr bufferProvider = + nsRefPtr bufferProvider = new PersistentBufferProviderBasic(aSize, aFormat, gfxPlatform::GetPlatform()->GetPreferredCanvasBackend()); @@ -1662,8 +1662,8 @@ void WriteSnapshotToDumpFile(LayerManager* aManager, DataSourceSurface* aSurf) void WriteSnapshotToDumpFile(Compositor* aCompositor, DrawTarget* aTarget) { - RefPtr surf = aTarget->Snapshot(); - RefPtr dSurf = surf->GetDataSurface(); + nsRefPtr surf = aTarget->Snapshot(); + nsRefPtr dSurf = surf->GetDataSurface(); WriteSnapshotToDumpFile_internal(aCompositor, dSurf); } #endif diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index f7e5f66e577..4d20e3b300d 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -20,7 +20,7 @@ #include "mozilla/DebugOnly.h" // for DebugOnly #include "mozilla/EventForwards.h" // for nsPaintEvent #include "mozilla/Maybe.h" // for Maybe -#include "mozilla/RefPtr.h" // for already_AddRefed +#include "mozilla/nsRefPtr.h" // for already_AddRefed #include "mozilla/StyleAnimationValue.h" // for StyleAnimationValue, etc #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration #include "mozilla/UniquePtr.h" // for UniquePtr diff --git a/gfx/layers/MacIOSurfaceImage.cpp b/gfx/layers/MacIOSurfaceImage.cpp index ac29393d141..1d46e1cab42 100644 --- a/gfx/layers/MacIOSurfaceImage.cpp +++ b/gfx/layers/MacIOSurfaceImage.cpp @@ -27,7 +27,7 @@ MacIOSurfaceImage::GetTextureClient(CompositableClient* aClient) already_AddRefed MacIOSurfaceImage::GetAsSourceSurface() { - RefPtr dataSurface; + nsRefPtr dataSurface; mSurface->Lock(); size_t bytesPerRow = mSurface->GetBytesPerRow(); size_t ioWidth = mSurface->GetDevicePixelWidth(); diff --git a/gfx/layers/MacIOSurfaceImage.h b/gfx/layers/MacIOSurfaceImage.h index 31d33a2c186..6d3587f0e51 100644 --- a/gfx/layers/MacIOSurfaceImage.h +++ b/gfx/layers/MacIOSurfaceImage.h @@ -31,8 +31,8 @@ public: MacIOSurfaceImage() : Image(nullptr, ImageFormat::MAC_IOSURFACE) {} private: - RefPtr mSurface; - RefPtr mTextureClient; + nsRefPtr mSurface; + nsRefPtr mTextureClient; }; } // namespace layers diff --git a/gfx/layers/PersistentBufferProvider.h b/gfx/layers/PersistentBufferProvider.h index 35835b7e945..519c4e4a48c 100644 --- a/gfx/layers/PersistentBufferProvider.h +++ b/gfx/layers/PersistentBufferProvider.h @@ -7,7 +7,7 @@ #define MOZILLA_GFX_PersistentBUFFERPROVIDER_H #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed, etc #include "mozilla/layers/LayersTypes.h" #include "mozilla/layers/CompositableForwarder.h" #include "mozilla/gfx/Types.h" @@ -67,7 +67,7 @@ public: bool ReturnAndUseDT(gfx::DrawTarget* aDT) { MOZ_ASSERT(mDrawTarget == aDT); return true; } virtual already_AddRefed GetSnapshot() { return mDrawTarget->Snapshot(); } private: - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; }; } // namespace layers diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index c12312c045f..f8d40c91c20 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -97,7 +97,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget, gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y); MOZ_ASSERT(aSource != BUFFER_BOTH); - RefPtr snapshot = GetSourceSurface(aSource); + nsRefPtr snapshot = GetSourceSurface(aSource); // direct2d is much slower when using OP_SOURCE so use OP_OVER and // (maybe) a clear instead. Normally we need to draw in a single operation @@ -180,7 +180,7 @@ RotatedBuffer::DrawBufferWithRotation(gfx::DrawTarget *aTarget, ContextSource aS already_AddRefed SourceRotatedBuffer::GetSourceSurface(ContextSource aSource) const { - RefPtr surf; + nsRefPtr surf; if (aSource == BUFFER_BLACK) { surf = mSource; } else { @@ -554,8 +554,8 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, } IntRect drawBounds = result.mRegionToDraw.GetBounds(); - RefPtr destDTBuffer; - RefPtr destDTBufferOnWhite; + nsRefPtr destDTBuffer; + nsRefPtr destDTBufferOnWhite; uint32_t bufferFlags = 0; if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { bufferFlags |= BUFFER_COMPONENT_ALPHA; diff --git a/gfx/layers/RotatedBuffer.h b/gfx/layers/RotatedBuffer.h index 0e2ecaaf3d0..8a1078ccb7a 100644 --- a/gfx/layers/RotatedBuffer.h +++ b/gfx/layers/RotatedBuffer.h @@ -9,7 +9,7 @@ #include "gfxTypes.h" #include // for uint32_t #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/2D.h" // for DrawTarget, etc #include "mozilla/mozalloc.h" // for operator delete #include "nsAutoPtr.h" // for nsRefPtr @@ -146,8 +146,8 @@ public: virtual bool HaveBufferOnWhite() const { return !!mSourceOnWhite; } private: - RefPtr mSource; - RefPtr mSourceOnWhite; + nsRefPtr mSource; + nsRefPtr mSourceOnWhite; }; // Mixin class for classes which need logic for loaning out a draw target. @@ -160,7 +160,7 @@ protected: // The draw target loaned by BorrowDrawTargetForQuadrantUpdate. It should not // be used, we just keep a reference to ensure it is kept alive and so we can // correctly restore state when it is returned. - RefPtr mLoanedDrawTarget; + nsRefPtr mLoanedDrawTarget; gfx::Matrix mLoanedTransform; }; @@ -309,7 +309,7 @@ public: */ virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags, - RefPtr* aBlackDT, RefPtr* aWhiteDT) = 0; + nsRefPtr* aBlackDT, nsRefPtr* aWhiteDT) = 0; /** * Get the underlying buffer, if any. This is useful because we can pass @@ -411,8 +411,8 @@ protected: */ virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) {} - RefPtr mDTBuffer; - RefPtr mDTBufferOnWhite; + nsRefPtr mDTBuffer; + nsRefPtr mDTBufferOnWhite; /** * These members are only set transiently. They're used to map mDTBuffer diff --git a/gfx/layers/TextureDIB.cpp b/gfx/layers/TextureDIB.cpp index b3ff47f85e0..a44be0ae532 100644 --- a/gfx/layers/TextureDIB.cpp +++ b/gfx/layers/TextureDIB.cpp @@ -31,8 +31,8 @@ TextureClientDIB::Unlock() MOZ_ASSERT(mIsLocked, "Unlocked called while the texture is not locked!"); if (mDrawTarget) { if (mReadbackSink) { - RefPtr snapshot = mDrawTarget->Snapshot(); - RefPtr dataSurf = snapshot->GetDataSurface(); + nsRefPtr snapshot = mDrawTarget->Snapshot(); + nsRefPtr dataSurf = snapshot->GetDataSurface(); mReadbackSink->ProcessReadback(dataSurf); } @@ -67,7 +67,7 @@ TextureClientDIB::UpdateFromSurface(gfx::SourceSurface* aSurface) nsRefPtr imgSurf = mSurface->GetAsImageSurface(); - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface."; @@ -103,7 +103,7 @@ already_AddRefed TextureClientMemoryDIB::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new TextureClientMemoryDIB(mAllocator, mFormat, + nsRefPtr tex = new TextureClientMemoryDIB(mAllocator, mFormat, mFlags | aFlags); if (!tex->AllocateForSurface(mSize, aAllocFlags)) { @@ -171,7 +171,7 @@ already_AddRefed TextureClientShmemDIB::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new TextureClientShmemDIB(mAllocator, mFormat, + nsRefPtr tex = new TextureClientShmemDIB(mAllocator, mFormat, mFlags | aFlags); if (!tex->AllocateForSurface(mSize, aAllocFlags)) { @@ -340,7 +340,7 @@ DIBTextureHost::UpdatedInternal(const nsIntRegion* aRegion) nsRefPtr imgSurf = mSurface->GetAsImageSurface(); - RefPtr surf = Factory::CreateWrappingDataSourceSurface(imgSurf->Data(), imgSurf->Stride(), mSize, mFormat); + nsRefPtr surf = Factory::CreateWrappingDataSourceSurface(imgSurf->Data(), imgSurf->Stride(), mSize, mFormat); if (!mTextureSource->Update(surf, const_cast(aRegion))) { mTextureSource = nullptr; @@ -375,7 +375,7 @@ TextureHostFileMapping::UpdatedInternal(const nsIntRegion* aRegion) uint8_t* data = (uint8_t*)::MapViewOfFile(mFileMapping, FILE_MAP_READ, 0, 0, mSize.width * mSize.height * BytesPerPixel(mFormat)); if (data) { - RefPtr surf = Factory::CreateWrappingDataSourceSurface(data, mSize.width * BytesPerPixel(mFormat), mSize, mFormat); + nsRefPtr surf = Factory::CreateWrappingDataSourceSurface(data, mSize.width * BytesPerPixel(mFormat), mSize, mFormat); if (!mTextureSource->Update(surf, const_cast(aRegion))) { mTextureSource = nullptr; diff --git a/gfx/layers/TextureDIB.h b/gfx/layers/TextureDIB.h index 5983ce4a414..87cf85dd2db 100644 --- a/gfx/layers/TextureDIB.h +++ b/gfx/layers/TextureDIB.h @@ -46,7 +46,7 @@ protected: { } nsRefPtr mSurface; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; gfx::IntSize mSize; gfx::SurfaceFormat mFormat; bool mIsLocked; @@ -146,8 +146,8 @@ public: virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override; protected: - RefPtr mTextureSource; - RefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mCompositor; gfx::SurfaceFormat mFormat; gfx::IntSize mSize; bool mIsLocked; diff --git a/gfx/layers/YCbCrImageDataSerializer.cpp b/gfx/layers/YCbCrImageDataSerializer.cpp index 29b964a9704..96e3d0d1843 100644 --- a/gfx/layers/YCbCrImageDataSerializer.cpp +++ b/gfx/layers/YCbCrImageDataSerializer.cpp @@ -281,7 +281,7 @@ YCbCrImageDataSerializer::CopyData(const uint8_t* aYData, already_AddRefed YCbCrImageDataDeserializer::ToDataSourceSurface() { - RefPtr result = + nsRefPtr result = Factory::CreateDataSourceSurface(GetYSize(), gfx::SurfaceFormat::B8G8R8X8); if (NS_WARN_IF(!result)) { return nullptr; diff --git a/gfx/layers/YCbCrImageDataSerializer.h b/gfx/layers/YCbCrImageDataSerializer.h index ec55a85c5d6..aab4cd8e18e 100644 --- a/gfx/layers/YCbCrImageDataSerializer.h +++ b/gfx/layers/YCbCrImageDataSerializer.h @@ -10,7 +10,7 @@ #include // for uint8_t, uint32_t #include "ImageTypes.h" // for StereoMode #include "mozilla/Attributes.h" // for MOZ_STACK_CLASS -#include "mozilla/RefPtr.h" // for already_AddRefed +#include "mozilla/nsRefPtr.h" // for already_AddRefed #include "mozilla/gfx/Point.h" // for IntSize namespace mozilla { diff --git a/gfx/layers/apz/src/AsyncPanZoomAnimation.h b/gfx/layers/apz/src/AsyncPanZoomAnimation.h index 27caa20da91..b6170b055ca 100644 --- a/gfx/layers/apz/src/AsyncPanZoomAnimation.h +++ b/gfx/layers/apz/src/AsyncPanZoomAnimation.h @@ -8,7 +8,7 @@ #define mozilla_layers_AsyncPanZoomAnimation_h_ #include "base/message_loop.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "mozilla/Vector.h" #include "FrameMetrics.h" diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 4d4b7d8fbe6..39f059cc2f9 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -15,7 +15,7 @@ #include "mozilla/EventForwards.h" #include "mozilla/Monitor.h" #include "mozilla/ReentrantMonitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "mozilla/Atomics.h" #include "InputData.h" diff --git a/gfx/layers/basic/AutoMaskData.h b/gfx/layers/basic/AutoMaskData.h index 7bf7f9b3c8b..e862f31cf33 100644 --- a/gfx/layers/basic/AutoMaskData.h +++ b/gfx/layers/basic/AutoMaskData.h @@ -48,7 +48,7 @@ private: } gfx::Matrix mTransform; - RefPtr mSurface; + nsRefPtr mSurface; AutoMoz2DMaskData(const AutoMoz2DMaskData&) = delete; AutoMoz2DMaskData& operator=(const AutoMoz2DMaskData&) = delete; diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 6328cef755d..a8acac388f4 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -64,7 +64,7 @@ public: } public: - RefPtr mSurface; + nsRefPtr mSurface; }; BasicCompositor::BasicCompositor(nsIWidget *aWidget) @@ -131,13 +131,13 @@ BasicCompositor::CreateRenderTarget(const IntRect& aRect, SurfaceInitMode aInit) return nullptr; } - RefPtr target = mDrawTarget->CreateSimilarDrawTarget(aRect.Size(), SurfaceFormat::B8G8R8A8); + nsRefPtr target = mDrawTarget->CreateSimilarDrawTarget(aRect.Size(), SurfaceFormat::B8G8R8A8); if (!target) { return nullptr; } - RefPtr rt = new BasicCompositingRenderTarget(target, aRect); + nsRefPtr rt = new BasicCompositingRenderTarget(target, aRect); return rt.forget(); } @@ -154,7 +154,7 @@ BasicCompositor::CreateRenderTargetFromSource(const IntRect &aRect, already_AddRefed BasicCompositor::CreateDataTextureSource(TextureFlags aFlags) { - RefPtr result = new DataTextureSourceBasic(); + nsRefPtr result = new DataTextureSourceBasic(); return result.forget(); } @@ -345,11 +345,11 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, const gfx::Matrix4x4& aTransform, const gfx::Rect& aVisibleRect) { - RefPtr buffer = mRenderTarget->mDrawTarget; + nsRefPtr buffer = mRenderTarget->mDrawTarget; // For 2D drawing, |dest| and |buffer| are the same surface. For 3D drawing, // |dest| is a temporary surface. - RefPtr dest = buffer; + nsRefPtr dest = buffer; buffer->PushClipRect(aClipRect); AutoRestoreTransform autoRestoreTransform(dest); @@ -385,7 +385,7 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, newTransform.PostTranslate(-offset.x, -offset.y); buffer->SetTransform(newTransform); - RefPtr sourceMask; + nsRefPtr sourceMask; Matrix maskTransform; if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) { EffectMask *effectMask = static_cast(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get()); @@ -423,11 +423,11 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, DrawOptions(aOpacity, blendMode), sourceMask, &maskTransform); } else { - RefPtr srcData = source->GetSurface(dest)->GetDataSurface(); + nsRefPtr srcData = source->GetSurface(dest)->GetDataSurface(); // Yes, we re-create the premultiplied data every time. // This might be better with a cache, eventually. - RefPtr premultData = gfxUtils::CreatePremultipliedDataSurface(srcData); + nsRefPtr premultData = gfxUtils::CreatePremultipliedDataSurface(srcData); DrawSurfaceWithTextureCoords(dest, aRect, premultData, @@ -445,9 +445,9 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, case EffectTypes::RENDER_TARGET: { EffectRenderTarget* effectRenderTarget = static_cast(aEffectChain.mPrimaryEffect.get()); - RefPtr surface + nsRefPtr surface = static_cast(effectRenderTarget->mRenderTarget.get()); - RefPtr sourceSurf = surface->mDrawTarget->Snapshot(); + nsRefPtr sourceSurf = surface->mDrawTarget->Snapshot(); DrawSurfaceWithTextureCoords(dest, aRect, sourceSurf, @@ -470,9 +470,9 @@ BasicCompositor::DrawQuad(const gfx::Rect& aRect, if (!aTransform.Is2D()) { dest->Flush(); - RefPtr snapshot = dest->Snapshot(); - RefPtr source = snapshot->GetDataSurface(); - RefPtr temp = + nsRefPtr snapshot = dest->Snapshot(); + nsRefPtr source = snapshot->GetDataSurface(); + nsRefPtr temp = Factory::CreateDataSourceSurface(RoundOut(transformBounds).Size(), SurfaceFormat::B8G8R8A8 #ifdef MOZ_ENABLE_SKIA , true @@ -538,7 +538,7 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion, // Setup an intermediate render target to buffer all compositing. We will // copy this into mDrawTarget (the widget), and/or mTarget in EndFrame() - RefPtr target = CreateRenderTarget(mInvalidRect, INIT_MODE_CLEAR); + nsRefPtr target = CreateRenderTarget(mInvalidRect, INIT_MODE_CLEAR); if (!target) { if (!mTarget) { mWidget->EndRemoteDrawingInRegion(mDrawTarget, mInvalidRegion); @@ -588,8 +588,8 @@ BasicCompositor::EndFrame() // Note: Most platforms require us to buffer drawing to the widget surface. // That's why we don't draw to mDrawTarget directly. - RefPtr source = mRenderTarget->mDrawTarget->Snapshot(); - RefPtr dest(mTarget ? mTarget : mDrawTarget); + nsRefPtr source = mRenderTarget->mDrawTarget->Snapshot(); + nsRefPtr dest(mTarget ? mTarget : mDrawTarget); nsIntPoint offset = mTarget ? mTargetBounds.TopLeft() : nsIntPoint(); diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index 0f408d8b1f2..a63bd999c24 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -33,7 +33,7 @@ public: : gfx::SurfaceFormat(gfx::SurfaceFormat::UNKNOWN); } - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; gfx::IntSize mSize; }; @@ -127,9 +127,9 @@ private: gfx::IntSize mWidgetSize; // The final destination surface - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; // The current render target for drawing - RefPtr mRenderTarget; + nsRefPtr mRenderTarget; gfx::IntRect mInvalidRect; nsIntRegion mInvalidRegion; diff --git a/gfx/layers/basic/BasicImageLayer.cpp b/gfx/layers/basic/BasicImageLayer.cpp index ade40a758e5..7dcf1cb170a 100644 --- a/gfx/layers/basic/BasicImageLayer.cpp +++ b/gfx/layers/basic/BasicImageLayer.cpp @@ -78,7 +78,7 @@ BasicImageLayer::Paint(DrawTarget* aDT, mContainer->SetImageFactory(originalIF); return; } - RefPtr surface = image->GetAsSourceSurface(); + nsRefPtr surface = image->GetAsSourceSurface(); if (!surface || !surface->IsValid()) { mContainer->SetImageFactory(originalIF); return; diff --git a/gfx/layers/basic/BasicImages.cpp b/gfx/layers/basic/BasicImages.cpp index bdb04f8f83b..fa977a99bd3 100644 --- a/gfx/layers/basic/BasicImages.cpp +++ b/gfx/layers/basic/BasicImages.cpp @@ -136,7 +136,7 @@ BasicPlanarYCbCrImage::GetAsSourceSurface() NS_ASSERTION(NS_IsMainThread(), "Must be main thread"); if (mSourceSurface) { - RefPtr surface(mSourceSurface); + nsRefPtr surface(mSourceSurface); return surface.forget(); } @@ -146,12 +146,12 @@ BasicPlanarYCbCrImage::GetAsSourceSurface() gfxImageFormat format = GetOffscreenFormat(); - RefPtr surface; + nsRefPtr surface; { // Create a DrawTarget so that we can own the data inside mDecodeBuffer. // We create the target out of mDecodedBuffer, and get a snapshot from it. // The draw target is destroyed on scope exit and the surface owns the data. - RefPtr drawTarget + nsRefPtr drawTarget = gfxPlatform::GetPlatform()->CreateDrawTargetForData(mDecodedBuffer, mSize, mStride, diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 0f014bb3329..16f3db476d4 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -629,7 +629,7 @@ BasicLayerManager_Matrix3DToSkia(const Matrix4x4& aMatrix) static void Transform(const gfxImageSurface* aDest, - RefPtr aSrc, + nsRefPtr aSrc, const Matrix4x4& aTransform, gfxPoint aDestOffset) { @@ -691,7 +691,7 @@ BasicLayerManager_Matrix3DToPixman(const Matrix4x4& aMatrix) static void Transform(const gfxImageSurface* aDest, - RefPtr aSrc, + nsRefPtr aSrc, const Matrix4x4& aTransform, gfxPoint aDestOffset) { @@ -754,7 +754,7 @@ Transform(const gfxImageSurface* aDest, * @return Transformed surface */ static already_AddRefed -Transform3D(RefPtr aSource, +Transform3D(nsRefPtr aSource, gfxContext* aDest, const gfxRect& aBounds, const Matrix4x4& aTransform, @@ -984,7 +984,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, } const IntRect& bounds = visibleRegion.GetBounds(); - RefPtr untransformedDT = + nsRefPtr untransformedDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(bounds.width, bounds.height), SurfaceFormat::B8G8R8A8); if (!untransformedDT) { diff --git a/gfx/layers/basic/BasicLayersImpl.cpp b/gfx/layers/basic/BasicLayersImpl.cpp index 01e9ae8d84f..4b134332e04 100644 --- a/gfx/layers/basic/BasicLayersImpl.cpp +++ b/gfx/layers/basic/BasicLayersImpl.cpp @@ -24,7 +24,7 @@ GetMaskData(Layer* aMaskLayer, AutoMoz2DMaskData* aMaskData) { if (aMaskLayer) { - RefPtr surface = + nsRefPtr surface = static_cast(aMaskLayer->ImplData())->GetAsSourceSurface(); if (surface) { Matrix transform; diff --git a/gfx/layers/basic/BasicPaintedLayer.h b/gfx/layers/basic/BasicPaintedLayer.h index ae5d896121b..134fbdcc0c5 100644 --- a/gfx/layers/basic/BasicPaintedLayer.h +++ b/gfx/layers/basic/BasicPaintedLayer.h @@ -11,7 +11,7 @@ #include "BasicImplData.h" // for BasicImplData #include "BasicLayers.h" // for BasicLayerManager #include "gfxPoint.h" // for gfxPoint -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/BasePoint.h" // for BasePoint #include "mozilla/layers/ContentClient.h" // for ContentClientBasic #include "mozilla/mozalloc.h" // for operator delete @@ -123,7 +123,7 @@ protected: mValidRegion.Or(mValidRegion, tmp); } - RefPtr mContentClient; + nsRefPtr mContentClient; }; } // namespace layers diff --git a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h index 19a8a707805..bb154167bd7 100644 --- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h +++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h @@ -42,9 +42,9 @@ public: virtual void SetCompositor(Compositor* aCompositor) override; protected: - RefPtr mCompositor; - RefPtr mSurface; - RefPtr mSourceSurface; + nsRefPtr mCompositor; + nsRefPtr mSurface; + nsRefPtr mSourceSurface; }; /** @@ -82,9 +82,9 @@ public: #endif protected: - RefPtr mCompositor; - RefPtr mTextureSource; - RefPtr mSurface; + nsRefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mSurface; }; } // namespace layers diff --git a/gfx/layers/basic/TextureClientX11.cpp b/gfx/layers/basic/TextureClientX11.cpp index 3748177ef9e..faccd11f1dc 100644 --- a/gfx/layers/basic/TextureClientX11.cpp +++ b/gfx/layers/basic/TextureClientX11.cpp @@ -38,7 +38,7 @@ already_AddRefed TextureClientX11::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new TextureClientX11(mAllocator, mFormat, mFlags); + nsRefPtr tex = new TextureClientX11(mAllocator, mFormat, mFlags); // mSize is guaranteed to be non-negative MOZ_ASSERT(mSize.width >= 0 && mSize.height >= 0); diff --git a/gfx/layers/basic/TextureClientX11.h b/gfx/layers/basic/TextureClientX11.h index 4017c6df9f4..c9b3438c6db 100644 --- a/gfx/layers/basic/TextureClientX11.h +++ b/gfx/layers/basic/TextureClientX11.h @@ -56,8 +56,8 @@ class TextureClientX11 : public TextureClient private: gfx::SurfaceFormat mFormat; gfx::IntSize mSize; - RefPtr mSurface; - RefPtr mDrawTarget; + nsRefPtr mSurface; + nsRefPtr mDrawTarget; bool mLocked; }; diff --git a/gfx/layers/basic/X11BasicCompositor.cpp b/gfx/layers/basic/X11BasicCompositor.cpp index b3e98e62602..f5c013db6d0 100644 --- a/gfx/layers/basic/X11BasicCompositor.cpp +++ b/gfx/layers/basic/X11BasicCompositor.cpp @@ -102,7 +102,7 @@ X11DataTextureSourceBasic::GetFormat() const SourceSurface* X11DataTextureSourceBasic::GetSurface(DrawTarget* aTarget) { - RefPtr surface; + nsRefPtr surface; if (mBufferDrawTarget) { surface = mBufferDrawTarget->Snapshot(); return surface.get(); @@ -120,7 +120,7 @@ X11DataTextureSourceBasic::DeallocateDeviceData() already_AddRefed X11BasicCompositor::CreateDataTextureSource(TextureFlags aFlags) { - RefPtr result = + nsRefPtr result = new X11DataTextureSourceBasic(); return result.forget(); } diff --git a/gfx/layers/basic/X11BasicCompositor.h b/gfx/layers/basic/X11BasicCompositor.h index 4e3cf037d8f..e4340acb41f 100644 --- a/gfx/layers/basic/X11BasicCompositor.h +++ b/gfx/layers/basic/X11BasicCompositor.h @@ -38,7 +38,7 @@ public: private: // We are going to buffer layer content on this xlib draw target - RefPtr mBufferDrawTarget; + nsRefPtr mBufferDrawTarget; }; class X11BasicCompositor : public BasicCompositor diff --git a/gfx/layers/basic/X11TextureSourceBasic.h b/gfx/layers/basic/X11TextureSourceBasic.h index 92c9f6c63d0..9824add2686 100644 --- a/gfx/layers/basic/X11TextureSourceBasic.h +++ b/gfx/layers/basic/X11TextureSourceBasic.h @@ -41,9 +41,9 @@ public: static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType); protected: - RefPtr mCompositor; - RefPtr mSurface; - RefPtr mSourceSurface; + nsRefPtr mCompositor; + nsRefPtr mSurface; + nsRefPtr mSourceSurface; }; } // namespace layers diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 23b6c544932..9e9e75888bf 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -106,7 +106,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) bool updated = false; { // Restrict drawTarget to a scope so that terminates before Unlock. - RefPtr target = + nsRefPtr target = mBuffer->BorrowDrawTarget(); if (target) { aLayer->UpdateTarget(target); @@ -216,7 +216,7 @@ public: } already_AddRefed CreateR8G8B8AX8() { - RefPtr ret; + nsRefPtr ret; bool areRGBAFormatsBroken = mLayersBackend == LayersBackend::LAYERS_BASIC; if (!areRGBAFormatsBroken) { @@ -244,7 +244,7 @@ TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator, TexClientFactory factory(allocator, src->mHasAlpha, src->mSize, backendType, baseFlags, layersBackend); - RefPtr texClient; + nsRefPtr texClient; { gl::ScopedReadbackFB autoReadback(src); @@ -330,7 +330,7 @@ TexClientFromReadback(SharedSurface* src, ISurfaceAllocator* allocator, static already_AddRefed CloneSurface(gl::SharedSurface* src, gl::SurfaceFactory* factory) { - RefPtr dest = factory->NewTexClient(src->mSize); + nsRefPtr dest = factory->NewTexClient(src->mSize); if (!dest) { return nullptr; } @@ -370,7 +370,7 @@ CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize, Renderer& aRendere } gl->MakeCurrent(); - RefPtr newFront; + nsRefPtr newFront; if (layer && layer->mGLFrontbuffer) { mShSurfClient = CloneSurface(layer->mGLFrontbuffer.get(), layer->mFactory.get()); diff --git a/gfx/layers/client/CanvasClient.h b/gfx/layers/client/CanvasClient.h index 7a8a1748515..6fa115589fd 100644 --- a/gfx/layers/client/CanvasClient.h +++ b/gfx/layers/client/CanvasClient.h @@ -8,7 +8,7 @@ #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/layers/CompositableClient.h" // for CompositableClient #include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor @@ -122,7 +122,7 @@ private: TextureFlags aFlags, ClientCanvasLayer* aLayer); - RefPtr mBuffer; + nsRefPtr mBuffer; }; // Used for GL canvases where we don't need to do any readback, i.e., with a @@ -130,10 +130,10 @@ private: class CanvasClientSharedSurface : public CanvasClient { private: - RefPtr mShSurfClient; - RefPtr mReadbackClient; - RefPtr mFront; - RefPtr mNewFront; + nsRefPtr mShSurfClient; + nsRefPtr mReadbackClient; + nsRefPtr mFront; + nsRefPtr mNewFront; void ClearSurfaces(); diff --git a/gfx/layers/client/ClientCanvasLayer.h b/gfx/layers/client/ClientCanvasLayer.h index d2308197b17..80cfa36b181 100644 --- a/gfx/layers/client/ClientCanvasLayer.h +++ b/gfx/layers/client/ClientCanvasLayer.h @@ -11,7 +11,7 @@ #include "CopyableCanvasLayer.h" // for CopyableCanvasLayer #include "Layers.h" // for CanvasLayer, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/LayersMessages.h" // for CanvasLayerAttributes, etc #include "mozilla/mozalloc.h" // for operator delete #include "nsAutoPtr.h" // for nsRefPtr @@ -91,7 +91,7 @@ protected: CanvasClientType GetCanvasClientType(); - RefPtr mCanvasClient; + nsRefPtr mCanvasClient; UniquePtr mFactory; diff --git a/gfx/layers/client/ClientImageLayer.cpp b/gfx/layers/client/ClientImageLayer.cpp index bc92c4aac31..13e2cf9dc1a 100644 --- a/gfx/layers/client/ClientImageLayer.cpp +++ b/gfx/layers/client/ClientImageLayer.cpp @@ -7,7 +7,7 @@ #include "ImageContainer.h" // for AutoLockImage, etc #include "ImageLayers.h" // for ImageLayer #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/ImageClient.h" // for ImageClient, etc #include "mozilla/layers/LayersMessages.h" // for ImageLayerAttributes, etc @@ -120,7 +120,7 @@ protected: return mImageClientTypeContainer; } - RefPtr mImageClient; + nsRefPtr mImageClient; CompositableType mImageClientTypeContainer; }; diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index 99875dc3767..4533ea66e08 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -505,7 +505,7 @@ ClientLayerManager::MakeSnapshotIfRequired() gfxContentType::COLOR_ALPHA, &inSnapshot) && remoteRenderer->SendMakeSnapshot(inSnapshot, bounds)) { - RefPtr surf = GetSurfaceForDescriptor(inSnapshot); + nsRefPtr surf = GetSurfaceForDescriptor(inSnapshot); DrawTarget* dt = mShadowTarget->GetDrawTarget(); Rect dstRect(bounds.x, bounds.y, bounds.width, bounds.height); diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 23926a218e8..28be3080ead 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -346,8 +346,8 @@ private: APZTestData mApzTestData; - RefPtr mForwarder; - nsAutoTArray,2> mTexturePools; + nsRefPtr mForwarder; + nsAutoTArray,2> mTexturePools; nsAutoTArray mOverfillCallbacks; mozilla::TimeStamp mTransactionStart; diff --git a/gfx/layers/client/ClientPaintedLayer.h b/gfx/layers/client/ClientPaintedLayer.h index 670a1c75fd5..b75b106e75b 100644 --- a/gfx/layers/client/ClientPaintedLayer.h +++ b/gfx/layers/client/ClientPaintedLayer.h @@ -10,7 +10,7 @@ #include "Layers.h" // for PaintedLayer, etc #include "RotatedBuffer.h" // for RotatedContentBuffer, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/ContentClient.h" // for ContentClient #include "mozilla/mozalloc.h" // for operator delete #include "nsDebug.h" // for NS_ASSERTION @@ -112,7 +112,7 @@ protected: mContentClient = nullptr; } - RefPtr mContentClient; + nsRefPtr mContentClient; }; } // namespace layers diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index cda3867a3e0..07e36ec2b2c 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -7,7 +7,7 @@ #include "ClientLayerManager.h" // for ClientLayer, etc #include "Layers.h" // for PaintedLayer, etc -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/TiledContentClient.h" #include "nsDebug.h" // for NS_RUNTIMEABORT #include "nsRegion.h" // for nsIntRegion @@ -132,7 +132,7 @@ private: */ void EndPaint(); - RefPtr mContentClient; + nsRefPtr mContentClient; nsIntRegion mLowPrecisionValidRegion; BasicTiledLayerPaintData mPaintData; }; diff --git a/gfx/layers/client/CompositableClient.cpp b/gfx/layers/client/CompositableClient.cpp index a580e1ef925..a81350dcfb5 100644 --- a/gfx/layers/client/CompositableClient.cpp +++ b/gfx/layers/client/CompositableClient.cpp @@ -64,7 +64,7 @@ RemoveTextureFromCompositableTracker::ReleaseTextureClient() !mTextureClient->GetAllocator()->IsImageBridgeChild()) { TextureClientReleaseTask* task = new TextureClientReleaseTask(mTextureClient); - RefPtr allocator = mTextureClient->GetAllocator(); + nsRefPtr allocator = mTextureClient->GetAllocator(); mTextureClient = nullptr; allocator->GetMessageLoop()->PostTask(FROM_HERE, task); } else { @@ -265,7 +265,7 @@ CompositableClient::DumpTextureClient(std::stringstream& aStream, if (!aTexture) { return; } - RefPtr dSurf = aTexture->GetAsSurface(); + nsRefPtr dSurf = aTexture->GetAsSurface(); if (!dSurf) { return; } @@ -281,8 +281,8 @@ AutoRemoveTexture::~AutoRemoveTexture() #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17 if (mCompositable && mTexture && mCompositable->GetForwarder()) { // remove old buffer from CompositableHost - RefPtr waiter = new AsyncTransactionWaiter(); - RefPtr tracker = + nsRefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr tracker = new RemoveTextureFromCompositableTracker(waiter); // Hold TextureClient until transaction complete. tracker->SetTextureClient(mTexture); diff --git a/gfx/layers/client/CompositableClient.h b/gfx/layers/client/CompositableClient.h index 1544a82d745..a08198c6891 100644 --- a/gfx/layers/client/CompositableClient.h +++ b/gfx/layers/client/CompositableClient.h @@ -10,7 +10,7 @@ #include // for vector #include // for map #include "mozilla/Assertions.h" // for MOZ_CRASH -#include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted +#include "mozilla/nsRefPtr.h" // for already_AddRefed, RefCounted #include "mozilla/gfx/Types.h" // for SurfaceFormat #include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTracker #include "mozilla/layers/CompositorTypes.h" @@ -76,7 +76,7 @@ protected: void ReleaseTextureClient(); private: - RefPtr mTextureClient; + nsRefPtr mTextureClient; }; /** @@ -239,7 +239,7 @@ protected: // (like disallowing tiling) TextureFlags mTextureFlags; bool mDestroyed; - RefPtr mTextureClientRecycler; + nsRefPtr mTextureClientRecycler; friend class CompositableChild; }; @@ -257,7 +257,7 @@ struct AutoRemoveTexture ~AutoRemoveTexture(); - RefPtr mTexture; + nsRefPtr mTexture; private: CompositableClient* mCompositable; }; diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index cbe3f68b16c..0ea5d14579e 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -124,8 +124,8 @@ void ContentClientBasic::CreateBuffer(ContentType aType, const IntRect& aRect, uint32_t aFlags, - RefPtr* aBlackDT, - RefPtr* aWhiteDT) + nsRefPtr* aBlackDT, + nsRefPtr* aWhiteDT) { MOZ_ASSERT(!(aFlags & BUFFER_COMPONENT_ALPHA)); @@ -203,7 +203,7 @@ public: private: nsTArray mReadbackUpdates; // This array is used to keep the layers alive until the callback. - vector> mLayerRefs; + vector> mLayerRefs; IntRect mBufferRect; nsIntPoint mBufferRotation; @@ -242,7 +242,7 @@ ContentClientRemoteBuffer::EndPaint(nsTArray* aReadba if (mTextureClient && mTextureClient->IsLocked()) { if (aReadbackUpdates->Length() > 0) { - RefPtr readbackSink = new RemoteBufferReadbackProcessor(aReadbackUpdates, mBufferRect, mBufferRotation); + nsRefPtr readbackSink = new RemoteBufferReadbackProcessor(aReadbackUpdates, mBufferRect, mBufferRotation); mTextureClient->SetReadbackSink(readbackSink); } @@ -317,8 +317,8 @@ void ContentClientRemoteBuffer::CreateBuffer(ContentType aType, const IntRect& aRect, uint32_t aFlags, - RefPtr* aBlackDT, - RefPtr* aWhiteDT) + nsRefPtr* aBlackDT, + nsRefPtr* aWhiteDT) { BuildTextureClients(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType), aRect, aFlags); if (!mTextureClient) { @@ -447,8 +447,8 @@ ContentClientDoubleBuffered::Updated(const nsIntRegion& aRegionToDraw, #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17 if (mFrontClient) { // remove old buffer from CompositableHost - RefPtr waiter = new AsyncTransactionWaiter(); - RefPtr tracker = + nsRefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr tracker = new RemoveTextureFromCompositableTracker(waiter); // Hold TextureClient until transaction complete. tracker->SetTextureClient(mFrontClient); @@ -459,8 +459,8 @@ ContentClientDoubleBuffered::Updated(const nsIntRegion& aRegionToDraw, if (mFrontClientOnWhite) { // remove old buffer from CompositableHost - RefPtr waiter = new AsyncTransactionWaiter(); - RefPtr tracker = + nsRefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr tracker = new RemoveTextureFromCompositableTracker(waiter); // Hold TextureClient until transaction complete. tracker->SetTextureClient(mFrontClientOnWhite); @@ -476,7 +476,7 @@ ContentClientDoubleBuffered::SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) { mFrontUpdatedRegion = aFrontUpdatedRegion; - RefPtr oldBack = mTextureClient; + nsRefPtr oldBack = mTextureClient; mTextureClient = mFrontClient; mFrontClient = oldBack; @@ -582,8 +582,8 @@ ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw) // Restrict the DrawTargets and frontBuffer to a scope to make // sure there is no more external references to the DrawTargets // when we Unlock the TextureClients. - RefPtr surf = mFrontClient->BorrowDrawTarget()->Snapshot(); - RefPtr surfOnWhite = mFrontClientOnWhite + nsRefPtr surf = mFrontClient->BorrowDrawTarget()->Snapshot(); + nsRefPtr surfOnWhite = mFrontClientOnWhite ? mFrontClientOnWhite->BorrowDrawTarget()->Snapshot() : nullptr; SourceRotatedBuffer frontBuffer(surf, diff --git a/gfx/layers/client/ContentClient.h b/gfx/layers/client/ContentClient.h index 602029acc39..c33f4730ff6 100644 --- a/gfx/layers/client/ContentClient.h +++ b/gfx/layers/client/ContentClient.h @@ -12,7 +12,7 @@ #include "gfxPlatform.h" // for gfxPlatform #include "mozilla/Assertions.h" // for MOZ_CRASH #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/layers/CompositableClient.h" // for CompositableClient #include "mozilla/layers/CompositableForwarder.h" @@ -159,7 +159,7 @@ public: } virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags, - RefPtr* aBlackDT, RefPtr* aWhiteDT) override; + nsRefPtr* aBlackDT, nsRefPtr* aWhiteDT) override; virtual TextureInfo GetTextureInfo() const override { @@ -255,7 +255,7 @@ public: } virtual void CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags, - RefPtr* aBlackDT, RefPtr* aWhiteDT) override; + nsRefPtr* aBlackDT, nsRefPtr* aWhiteDT) override; virtual TextureFlags ExtraTextureFlags() const { @@ -290,12 +290,12 @@ protected: mIsNewBuffer = false; } - RefPtr mTextureClient; - RefPtr mTextureClientOnWhite; + nsRefPtr mTextureClient; + nsRefPtr mTextureClientOnWhite; // keep a record of texture clients we have created and need to keep around // (for RotatedBuffer to access), then unlock and remove them when we are done // painting. - nsTArray > mOldTextures; + nsTArray > mOldTextures; bool mIsNewBuffer; bool mFrontAndBackBufferDiffer; @@ -366,8 +366,8 @@ private: mFrontClientOnWhite = nullptr; } - RefPtr mFrontClient; - RefPtr mFrontClientOnWhite; + nsRefPtr mFrontClient; + nsRefPtr mFrontClientOnWhite; nsIntRegion mFrontUpdatedRegion; gfx::IntRect mFrontBufferRect; nsIntPoint mFrontBufferRotation; diff --git a/gfx/layers/client/ImageClient.cpp b/gfx/layers/client/ImageClient.cpp index 719b03d3358..47ca45ba6ab 100644 --- a/gfx/layers/client/ImageClient.cpp +++ b/gfx/layers/client/ImageClient.cpp @@ -11,7 +11,7 @@ #include "gfx2DGlue.h" // for ImageFormatToSurfaceFormat #include "gfxPlatform.h" // for gfxPlatform #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/BaseSize.h" // for BaseSize #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat, etc @@ -46,7 +46,7 @@ ImageClient::CreateImageClient(CompositableType aCompositableHostType, CompositableForwarder* aForwarder, TextureFlags aFlags) { - RefPtr result = nullptr; + nsRefPtr result = nullptr; switch (aCompositableHostType) { case CompositableType::IMAGE: result = new ImageClientSingle(aForwarder, aFlags, CompositableType::IMAGE); @@ -90,7 +90,7 @@ ImageClient::RemoveTextureWithWaiter(TextureClient* aTexture, && aTexture->GetRecycleAllocator() #endif ) { - RefPtr request = + nsRefPtr request = new RemoveTextureFromCompositableTracker(aAsyncTransactionWaiter); // Hold TextureClient until the transaction complete to postpone // the TextureClient recycle/delete. @@ -156,7 +156,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag for (auto& img : images) { Image* image = img.mImage; - RefPtr texture = image->GetTextureClient(this); + nsRefPtr texture = image->GetTextureClient(this); for (int32_t i = mBuffers.Length() - 1; i >= 0; --i) { if (mBuffers[i].mImageSerial == image->GetSerial()) { @@ -218,7 +218,7 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag MOZ_ASSERT(false, "Bad ImageFormat."); } } else { - RefPtr surface = image->GetAsSourceSurface(); + nsRefPtr surface = image->GetAsSourceSurface(); MOZ_ASSERT(surface); texture = CreateTextureClientForDrawing(surface->GetFormat(), image->GetSize(), BackendSelector::Content, mTextureFlags); diff --git a/gfx/layers/client/ImageClient.h b/gfx/layers/client/ImageClient.h index 3751c7338e4..151e744bb48 100644 --- a/gfx/layers/client/ImageClient.h +++ b/gfx/layers/client/ImageClient.h @@ -9,7 +9,7 @@ #include // for uint32_t, uint64_t #include // for int32_t #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/Types.h" // for SurfaceFormat #include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTracker #include "mozilla/layers/CompositableClient.h" // for CompositableClient @@ -105,7 +105,7 @@ public: protected: struct Buffer { - RefPtr mTextureClient; + nsRefPtr mTextureClient; int32_t mImageSerial; }; nsTArray mBuffers; diff --git a/gfx/layers/client/SingleTiledContentClient.cpp b/gfx/layers/client/SingleTiledContentClient.cpp index ab611645b51..1ebdce23c8e 100644 --- a/gfx/layers/client/SingleTiledContentClient.cpp +++ b/gfx/layers/client/SingleTiledContentClient.cpp @@ -146,8 +146,8 @@ ClientSingleTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion, nsIntRegion tileDirtyRegion = paintRegion.MovedBy(-mTilingOrigin); nsIntRegion extraPainted; - RefPtr backBufferOnWhite; - RefPtr backBuffer = + nsRefPtr backBufferOnWhite; + nsRefPtr backBuffer = mTile.GetBackBuffer(tileDirtyRegion, content, mode, extraPainted, @@ -164,8 +164,8 @@ ClientSingleTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion, return; } - RefPtr dt = backBuffer->BorrowDrawTarget(); - RefPtr dtOnWhite; + nsRefPtr dt = backBuffer->BorrowDrawTarget(); + nsRefPtr dtOnWhite; if (backBufferOnWhite) { dtOnWhite = backBufferOnWhite->BorrowDrawTarget(); } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 65887f93f8e..7b66fe21db4 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -159,8 +159,8 @@ private: mTextureClient = aTextureClient; } - RefPtr mForwarder; - RefPtr mWaitForRecycle; + nsRefPtr mForwarder; + nsRefPtr mWaitForRecycle; // Monitor protecting mTextureClient. Monitor mMonitor; @@ -347,12 +347,12 @@ CreateBufferTextureClient(ISurfaceAllocator* aAllocator, gfx::BackendType aMoz2DBackend) { if (aAllocator->IsSameProcess()) { - RefPtr result = new MemoryTextureClient(aAllocator, aFormat, + nsRefPtr result = new MemoryTextureClient(aAllocator, aFormat, aMoz2DBackend, aTextureFlags); return result.forget(); } - RefPtr result = new ShmemTextureClient(aAllocator, aFormat, + nsRefPtr result = new ShmemTextureClient(aAllocator, aFormat, aMoz2DBackend, aTextureFlags); return result.forget(); @@ -384,7 +384,7 @@ TextureClient::CreateForDrawing(CompositableForwarder* aAllocator, LayersBackend parentBackend = aAllocator->GetCompositorBackendType(); gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(parentBackend, aSelector); - RefPtr texture; + nsRefPtr texture; #if defined(MOZ_WIDGET_GONK) || defined(XP_WIN) int32_t maxTextureSize = aAllocator->GetMaxTextureSize(); @@ -487,7 +487,7 @@ TextureClient::CreateForRawBufferAccess(ISurfaceAllocator* aAllocator, TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags) { - RefPtr texture = + nsRefPtr texture = CreateBufferTextureClient(aAllocator, aFormat, aTextureFlags, aMoz2DBackend); if (texture) { @@ -506,7 +506,7 @@ TextureClient::CreateForYCbCr(ISurfaceAllocator* aAllocator, StereoMode aStereoMode, TextureFlags aTextureFlags) { - RefPtr texture; + nsRefPtr texture; if (aAllocator->IsSameProcess()) { texture = new MemoryTextureClient(aAllocator, gfx::SurfaceFormat::YUV, gfx::BackendType::NONE, @@ -531,7 +531,7 @@ TextureClient::CreateWithBufferSize(ISurfaceAllocator* aAllocator, size_t aSize, TextureFlags aTextureFlags) { - RefPtr texture; + nsRefPtr texture; if (aAllocator->IsSameProcess()) { texture = new MemoryTextureClient(aAllocator, gfx::SurfaceFormat::YUV, gfx::BackendType::NONE, @@ -608,19 +608,19 @@ bool TextureClient::CopyToTextureClient(TextureClient* aTarget, return false; } - RefPtr destinationTarget = aTarget->BorrowDrawTarget(); + nsRefPtr destinationTarget = aTarget->BorrowDrawTarget(); if (!destinationTarget) { gfxWarning() << "TextureClient::CopyToTextureClient (dest) failed in BorrowDrawTarget"; return false; } - RefPtr sourceTarget = BorrowDrawTarget(); + nsRefPtr sourceTarget = BorrowDrawTarget(); if (!sourceTarget) { gfxWarning() << "TextureClient::CopyToTextureClient (src) failed in BorrowDrawTarget"; return false; } - RefPtr source = sourceTarget->Snapshot(); + nsRefPtr source = sourceTarget->Snapshot(); destinationTarget->CopySurface(source, aRect ? *aRect : gfx::IntRect(gfx::IntPoint(0, 0), GetSize()), aPoint ? *aPoint : gfx::IntPoint(0, 0)); @@ -634,7 +634,7 @@ TextureClient::Finalize() // Always make a temporary strong reference to the actor before we use it, // in case TextureChild::ActorDestroy might null mActor concurrently. - RefPtr actor = mActor; + nsRefPtr actor = mActor; if (actor) { if (actor->mDestroyed) { @@ -685,7 +685,7 @@ TextureClient::PrintInfo(std::stringstream& aStream, const char* aPrefix) pfx += " "; aStream << "\n" << pfx.get() << "Surface: "; - RefPtr dSurf = GetAsSurface(); + nsRefPtr dSurf = GetAsSurface(); if (dSurf) { aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get(); } @@ -820,7 +820,7 @@ BufferTextureClient::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { // This may return null - RefPtr newBufferTex = TextureClient::CreateForRawBufferAccess( + nsRefPtr newBufferTex = TextureClient::CreateForRawBufferAccess( mAllocator, mFormat, mSize, mBackend, mFlags | aFlags, aAllocFlags ); @@ -896,14 +896,14 @@ BufferTextureClient::UpdateFromSurface(gfx::SourceSurface* aSurface) { ImageDataSerializer serializer(GetBuffer(), GetBufferSize()); - RefPtr surface = serializer.GetAsSurface(); + nsRefPtr surface = serializer.GetAsSurface(); if (!surface) { gfxCriticalError() << "Failed to get serializer as surface!"; return; } - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface."; @@ -964,8 +964,8 @@ BufferTextureClient::Unlock() MOZ_ASSERT(mDrawTarget->refCount() == 1); if (mReadbackSink) { - RefPtr snapshot = mDrawTarget->Snapshot(); - RefPtr dataSurf = snapshot->GetDataSurface(); + nsRefPtr snapshot = mDrawTarget->Snapshot(); + nsRefPtr dataSurf = snapshot->GetDataSurface(); mReadbackSink->ProcessReadback(dataSurf); } diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 72f11165017..222a41b7815 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -12,7 +12,7 @@ #include "ImageTypes.h" // for StereoMode #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, RefCounted +#include "mozilla/nsRefPtr.h" // for RefPtr, RefCounted #include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat @@ -294,8 +294,8 @@ public: */ virtual already_AddRefed GetAsSurface() { Lock(OpenMode::OPEN_READ); - RefPtr surf = BorrowDrawTarget()->Snapshot(); - RefPtr data = surf->GetDataSurface(); + nsRefPtr surf = BorrowDrawTarget()->Snapshot(); + nsRefPtr data = surf->GetDataSurface(); Unlock(); return data.forget(); } @@ -539,9 +539,9 @@ protected: */ virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aDescriptor) = 0; - RefPtr mActor; - RefPtr mAllocator; - RefPtr mRecycleAllocator; + nsRefPtr mActor; + nsRefPtr mAllocator; + nsRefPtr mRecycleAllocator; TextureFlags mFlags; FenceHandle mReleaseFenceHandle; FenceHandle mAcquireFenceHandle; @@ -550,7 +550,7 @@ protected: bool mValid; bool mAddedToCompositableClient; - RefPtr mReadbackSink; + nsRefPtr mReadbackSink; friend class TextureChild; friend class RemoveTextureFromCompositableTracker; @@ -580,7 +580,7 @@ public: } private: - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; }; /** @@ -647,7 +647,7 @@ public: TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override; protected: - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; gfx::SurfaceFormat mFormat; gfx::IntSize mSize; gfx::BackendType mBackend; @@ -745,7 +745,7 @@ class TKeepAlive : public KeepAlive public: explicit TKeepAlive(T* aData) : mData(aData) {} protected: - RefPtr mData; + nsRefPtr mData; }; } // namespace layers diff --git a/gfx/layers/client/TextureClientPool.cpp b/gfx/layers/client/TextureClientPool.cpp index c0d5fe0d7d1..8774b3824c5 100644 --- a/gfx/layers/client/TextureClientPool.cpp +++ b/gfx/layers/client/TextureClientPool.cpp @@ -87,7 +87,7 @@ already_AddRefed TextureClientPool::GetTextureClient() { // Try to fetch a client from the pool - RefPtr textureClient; + nsRefPtr textureClient; if (mTextureClients.size()) { mOutstandingClients++; textureClient = mTextureClients.top(); diff --git a/gfx/layers/client/TextureClientPool.h b/gfx/layers/client/TextureClientPool.h index 76abe4c8c60..9183e5889fd 100644 --- a/gfx/layers/client/TextureClientPool.h +++ b/gfx/layers/client/TextureClientPool.h @@ -8,7 +8,7 @@ #include "mozilla/gfx/Types.h" #include "mozilla/gfx/Point.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "TextureClient.h" #include "nsITimer.h" #include @@ -135,10 +135,10 @@ private: // On b2g gonk, std::queue might be a better choice. // On ICS, fence wait happens implicitly before drawing. // Since JB, fence wait happens explicitly when fetching a client from the pool. - std::stack > mTextureClients; - std::stack > mTextureClientsDeferred; + std::stack > mTextureClients; + std::stack > mTextureClientsDeferred; nsRefPtr mTimer; - RefPtr mSurfaceAllocator; + nsRefPtr mSurfaceAllocator; }; } // namespace layers diff --git a/gfx/layers/client/TextureClientRecycleAllocator.cpp b/gfx/layers/client/TextureClientRecycleAllocator.cpp index 825bbe10e77..47220452b38 100644 --- a/gfx/layers/client/TextureClientRecycleAllocator.cpp +++ b/gfx/layers/client/TextureClientRecycleAllocator.cpp @@ -29,7 +29,7 @@ public: void ClearTextureClient() { mTextureClient = nullptr; } protected: - RefPtr mTextureClient; + nsRefPtr mTextureClient; }; TextureClientRecycleAllocator::TextureClientRecycleAllocator(CompositableForwarder* aAllocator) @@ -68,7 +68,7 @@ public: } private: - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; TextureFlags mFlags; }; @@ -86,7 +86,7 @@ TextureClientRecycleAllocator::CreateOrRecycle(gfx::SurfaceFormat aFormat, MOZ_ASSERT(!(aTextureFlags & TextureFlags::RECYCLE)); aTextureFlags = aTextureFlags | TextureFlags::RECYCLE; // Set recycle flag - RefPtr textureHolder; + nsRefPtr textureHolder; { MutexAutoLock lock(mLock); @@ -110,7 +110,7 @@ TextureClientRecycleAllocator::CreateOrRecycle(gfx::SurfaceFormat aFormat, if (!textureHolder) { // Allocate new TextureClient - RefPtr texture = Allocate(aFormat, aSize, aSelector, aTextureFlags, aAllocFlags); + nsRefPtr texture = Allocate(aFormat, aSize, aSelector, aTextureFlags, aAllocFlags); if (!texture) { return nullptr; } @@ -123,7 +123,7 @@ TextureClientRecycleAllocator::CreateOrRecycle(gfx::SurfaceFormat aFormat, // Register TextureClient mInUseClients[textureHolder->GetTextureClient()] = textureHolder; } - RefPtr client(textureHolder->GetTextureClient()); + nsRefPtr client(textureHolder->GetTextureClient()); // Make sure the texture holds a reference to us, and ask it to call RecycleTextureClient when its // ref count drops to 1. @@ -147,10 +147,10 @@ TextureClientRecycleAllocator::RecycleTextureClient(TextureClient* aClient) { // Clearing the recycle allocator drops a reference, so make sure we stay alive // for the duration of this function. - RefPtr kungFuDeathGrip(this); + nsRefPtr kungFuDeathGrip(this); aClient->SetRecycleAllocator(nullptr); - RefPtr textureHolder; + nsRefPtr textureHolder; { MutexAutoLock lock(mLock); if (mInUseClients.find(aClient) != mInUseClients.end()) { diff --git a/gfx/layers/client/TextureClientRecycleAllocator.h b/gfx/layers/client/TextureClientRecycleAllocator.h index 4fd35851dee..9c0441ed5fd 100644 --- a/gfx/layers/client/TextureClientRecycleAllocator.h +++ b/gfx/layers/client/TextureClientRecycleAllocator.h @@ -9,7 +9,7 @@ #include #include #include "mozilla/gfx/Types.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "TextureClient.h" #include "mozilla/Mutex.h" @@ -57,7 +57,7 @@ protected: TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags); - RefPtr mSurfaceAllocator; + nsRefPtr mSurfaceAllocator; private: friend class TextureClient; @@ -66,13 +66,13 @@ private: static const uint32_t kMaxPooledSized = 2; uint32_t mMaxPooledSize; - std::map > mInUseClients; + std::map > mInUseClients; // On b2g gonk, std::queue might be a better choice. // On ICS, fence wait happens implicitly before drawing. // Since JB, fence wait happens explicitly when fetching a client from the pool. // stack is good from Graphics cache usage point of view. - std::stack > mPooledClients; + std::stack > mPooledClients; Mutex mLock; }; diff --git a/gfx/layers/client/TextureClientSharedSurface.h b/gfx/layers/client/TextureClientSharedSurface.h index 8f645e24404..dd126dc754b 100644 --- a/gfx/layers/client/TextureClientSharedSurface.h +++ b/gfx/layers/client/TextureClientSharedSurface.h @@ -11,7 +11,7 @@ #include "GLContextTypes.h" // for GLContext (ptr only), etc #include "TextureClient.h" #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, RefCounted +#include "mozilla/nsRefPtr.h" // for RefPtr, RefCounted #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat #include "mozilla/layers/CompositorTypes.h" // for TextureFlags, etc diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index 97a66d18ff8..757e07eeac2 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -478,7 +478,7 @@ void ShutdownTileCache() } void -TileClient::PrivateProtector::Set(TileClient * const aContainer, RefPtr aNewValue) +TileClient::PrivateProtector::Set(TileClient * const aContainer, nsRefPtr aNewValue) { if (mBuffer) { TileExpiry::RemoveTile(aContainer); @@ -492,7 +492,7 @@ TileClient::PrivateProtector::Set(TileClient * const aContainer, RefPtr(aNewValue)); + Set(aContainer, nsRefPtr(aNewValue)); } // Placeholder @@ -570,8 +570,8 @@ TileClient::Flip() if (mFrontBuffer && mFrontBuffer->GetIPDLActor() && mCompositableClient && mCompositableClient->GetIPDLActor()) { // remove old buffer from CompositableHost - RefPtr waiter = new AsyncTransactionWaiter(); - RefPtr tracker = + nsRefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr tracker = new RemoveTextureFromCompositableTracker(waiter); // Hold TextureClient until transaction complete. tracker->SetTextureClient(mFrontBuffer); @@ -582,13 +582,13 @@ TileClient::Flip() mFrontBuffer); } #endif - RefPtr frontBuffer = mFrontBuffer; - RefPtr frontBufferOnWhite = mFrontBufferOnWhite; + nsRefPtr frontBuffer = mFrontBuffer; + nsRefPtr frontBufferOnWhite = mFrontBufferOnWhite; mFrontBuffer = mBackBuffer; mFrontBufferOnWhite = mBackBufferOnWhite; mBackBuffer.Set(this, frontBuffer); mBackBufferOnWhite = frontBufferOnWhite; - RefPtr frontLock = mFrontLock; + nsRefPtr frontLock = mFrontLock; mFrontLock = mBackLock; mBackLock = frontLock; nsIntRegion invalidFront = mInvalidFront; @@ -670,8 +670,8 @@ TileClient::DiscardFrontBuffer() if (mFrontBuffer->GetIPDLActor() && mCompositableClient && mCompositableClient->GetIPDLActor()) { // remove old buffer from CompositableHost - RefPtr waiter = new AsyncTransactionWaiter(); - RefPtr tracker = + nsRefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr tracker = new RemoveTextureFromCompositableTracker(waiter); // Hold TextureClient until transaction complete. tracker->SetTextureClient(mFrontBuffer); @@ -736,7 +736,7 @@ TileClient::GetBackBuffer(const nsIntRegion& aDirtyRegion, gfxContentType aContent, SurfaceMode aMode, nsIntRegion& aAddPaintedRegion, - RefPtr* aBackBufferOnWhite) + nsRefPtr* aBackBufferOnWhite) { // Try to re-use the front-buffer if possible bool createdTextureClient = false; @@ -1002,7 +1002,7 @@ ClientMultiTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion, mSinglePaintDrawTarget = nullptr; } -void PadDrawTargetOutFromRegion(RefPtr drawTarget, nsIntRegion ®ion) +void PadDrawTargetOutFromRegion(nsRefPtr drawTarget, nsIntRegion ®ion) { struct LockedBits { uint8_t *data; @@ -1164,10 +1164,10 @@ void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion, } tileset.mTiles = &mMoz2DTiles[0]; tileset.mTileCount = mMoz2DTiles.size(); - RefPtr drawTarget = gfx::Factory::CreateTiledDrawTarget(tileset); + nsRefPtr drawTarget = gfx::Factory::CreateTiledDrawTarget(tileset); drawTarget->SetTransform(Matrix()); - RefPtr ctx = new gfxContext(drawTarget); + nsRefPtr ctx = new gfxContext(drawTarget); ctx->SetMatrix( ctx->CurrentMatrix().Scale(mResolution, mResolution).Translate(ThebesPoint(-mTilingOrigin))); @@ -1208,7 +1208,7 @@ void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion, tileValidRegion = tileValidRegion.Intersect(tileRect); // translate the region into tile space and pad tileValidRegion.MoveBy(-IntPoint(tileOffset.x, tileOffset.y)); - RefPtr drawTarget = tile.mFrontBuffer->BorrowDrawTarget(); + nsRefPtr drawTarget = tile.mFrontBuffer->BorrowDrawTarget(); PadDrawTargetOutFromRegion(drawTarget, tileValidRegion); } } @@ -1252,8 +1252,8 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile, MOZ_ASSERT(usingTiledDrawTarget || !!mSinglePaintDrawTarget); nsIntRegion extraPainted; - RefPtr backBufferOnWhite; - RefPtr backBuffer = + nsRefPtr backBufferOnWhite; + nsRefPtr backBuffer = aTile.GetBackBuffer(offsetScaledDirtyRegion, content, mode, extraPainted, @@ -1271,8 +1271,8 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile, if (usingTiledDrawTarget) { gfx::Tile moz2DTile; - RefPtr dt = backBuffer->BorrowDrawTarget(); - RefPtr dtOnWhite; + nsRefPtr dt = backBuffer->BorrowDrawTarget(); + nsRefPtr dtOnWhite; if (backBufferOnWhite) { dtOnWhite = backBufferOnWhite->BorrowDrawTarget(); moz2DTile.mDrawTarget = Factory::CreateDualDrawTarget(dt, dtOnWhite); @@ -1325,13 +1325,13 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile, // We must not keep a reference to the DrawTarget after it has been unlocked, // make sure these are null'd before unlocking as destruction of the context // may cause the target to be flushed. - RefPtr drawTarget = backBuffer->BorrowDrawTarget(); + nsRefPtr drawTarget = backBuffer->BorrowDrawTarget(); drawTarget->SetTransform(Matrix()); - RefPtr ctxt = new gfxContext(drawTarget); + nsRefPtr ctxt = new gfxContext(drawTarget); // XXX Perhaps we should just copy the bounding rectangle here? - RefPtr source = mSinglePaintDrawTarget->Snapshot(); + nsRefPtr source = mSinglePaintDrawTarget->Snapshot(); nsIntRegionRectIterator it(aDirtyRegion); for (const IntRect* dirtyRect = it.Next(); dirtyRect != nullptr; dirtyRect = it.Next()) { #ifdef GFX_TILEDLAYER_PREF_WARNINGS diff --git a/gfx/layers/client/TiledContentClient.h b/gfx/layers/client/TiledContentClient.h index ade863f1b12..b7724654b66 100644 --- a/gfx/layers/client/TiledContentClient.h +++ b/gfx/layers/client/TiledContentClient.h @@ -15,7 +15,7 @@ #include "Units.h" // for CSSPoint #include "gfxTypes.h" #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/ipc/Shmem.h" // for Shmem #include "mozilla/ipc/SharedMemory.h" // for SharedMemory #include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform @@ -137,7 +137,7 @@ private: (mShmemSection.shmem().get() + mShmemSection.offset()); } - RefPtr mAllocator; + nsRefPtr mAllocator; mozilla::layers::ShmemSection mShmemSection; bool mAllocSuccess; }; @@ -246,7 +246,7 @@ struct TileClient TextureClient* GetBackBuffer(const nsIntRegion& aDirtyRegion, gfxContentType aContent, SurfaceMode aMode, nsIntRegion& aAddPaintedRegion, - RefPtr* aTextureClientOnWhite); + nsRefPtr* aTextureClientOnWhite); void DiscardFrontBuffer(); @@ -257,23 +257,23 @@ struct TileClient * the expiry tracker for expiring the back buffers */ class PrivateProtector { public: - void Set(TileClient * container, RefPtr); + void Set(TileClient * container, nsRefPtr); void Set(TileClient * container, TextureClient*); // Implicitly convert to TextureClient* because we can't chain - // implicit conversion that would happen on RefPtr + // implicit conversion that would happen on nsRefPtr operator TextureClient*() const { return mBuffer; } - RefPtr operator ->() { return mBuffer; } + nsRefPtr operator ->() { return mBuffer; } private: PrivateProtector& operator=(const PrivateProtector &); - RefPtr mBuffer; + nsRefPtr mBuffer; } mBackBuffer; - RefPtr mBackBufferOnWhite; - RefPtr mFrontBuffer; - RefPtr mFrontBufferOnWhite; - RefPtr mBackLock; - RefPtr mFrontLock; - RefPtr mManager; - RefPtr mAllocator; + nsRefPtr mBackBufferOnWhite; + nsRefPtr mFrontBuffer; + nsRefPtr mFrontBufferOnWhite; + nsRefPtr mBackLock; + nsRefPtr mFrontLock; + nsRefPtr mManager; + nsRefPtr mAllocator; gfx::IntRect mUpdateRect; CompositableClient* mCompositableClient; #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY @@ -552,7 +552,7 @@ private: nsIntRegion mNewValidRegion; // The DrawTarget we use when UseSinglePaintBuffer() above is true. - RefPtr mSinglePaintDrawTarget; + nsRefPtr mSinglePaintDrawTarget; nsIntPoint mSinglePaintBufferOffset; SharedFrameMetricsHelper* mSharedFrameMetricsHelper; // When using Moz2D's CreateTiledDrawTarget we maintain a list of gfx::Tiles diff --git a/gfx/layers/composite/AsyncCompositionManager.h b/gfx/layers/composite/AsyncCompositionManager.h index efad498e1ed..f5a08b6014a 100644 --- a/gfx/layers/composite/AsyncCompositionManager.h +++ b/gfx/layers/composite/AsyncCompositionManager.h @@ -9,7 +9,7 @@ #include "Units.h" // for ScreenPoint, etc #include "mozilla/layers/LayerManagerComposite.h" // for LayerManagerComposite #include "mozilla/Attributes.h" // for final, etc -#include "mozilla/RefPtr.h" // for RefCounted +#include "mozilla/nsRefPtr.h" // for RefCounted #include "mozilla/TimeStamp.h" // for TimeStamp #include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation #include "mozilla/gfx/BasePoint.h" // for BasePoint diff --git a/gfx/layers/composite/CanvasLayerComposite.cpp b/gfx/layers/composite/CanvasLayerComposite.cpp index 02392132987..235b2427a87 100644 --- a/gfx/layers/composite/CanvasLayerComposite.cpp +++ b/gfx/layers/composite/CanvasLayerComposite.cpp @@ -89,7 +89,7 @@ CanvasLayerComposite::RenderLayer(const IntRect& aClipRect) #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpCompositorTextures) { - RefPtr surf = mCompositableHost->GetAsSurface(); + nsRefPtr surf = mCompositableHost->GetAsSurface(); WriteSnapshotToDumpFile(this, surf); } #endif diff --git a/gfx/layers/composite/CanvasLayerComposite.h b/gfx/layers/composite/CanvasLayerComposite.h index d9d01a14cd1..580fd413fc3 100644 --- a/gfx/layers/composite/CanvasLayerComposite.h +++ b/gfx/layers/composite/CanvasLayerComposite.h @@ -8,7 +8,7 @@ #include "Layers.h" // for CanvasLayer, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc #include "nsDebug.h" // for NS_RUNTIMEABORT @@ -72,7 +72,7 @@ private: gfx::Filter GetEffectFilter(); private: - RefPtr mCompositableHost; + nsRefPtr mCompositableHost; }; } // namespace layers diff --git a/gfx/layers/composite/ColorLayerComposite.cpp b/gfx/layers/composite/ColorLayerComposite.cpp index 179e20102b8..589542e973d 100644 --- a/gfx/layers/composite/ColorLayerComposite.cpp +++ b/gfx/layers/composite/ColorLayerComposite.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ColorLayerComposite.h" -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for Point #include "mozilla/gfx/Rect.h" // for Rect diff --git a/gfx/layers/composite/CompositableHost.cpp b/gfx/layers/composite/CompositableHost.cpp index 56da661c114..96ebcb2b918 100644 --- a/gfx/layers/composite/CompositableHost.cpp +++ b/gfx/layers/composite/CompositableHost.cpp @@ -69,7 +69,7 @@ public: } } - RefPtr mHost; + nsRefPtr mHost; }; CompositableHost::CompositableHost(const TextureInfo& aTextureInfo) @@ -151,7 +151,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects, bool aIs3D) { CompositableTextureSourceRef source; - RefPtr host = GetAsTextureHost(); + nsRefPtr host = GetAsTextureHost(); if (!host) { NS_WARNING("Using compositable with no valid TextureHost as mask"); @@ -170,7 +170,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects, } MOZ_ASSERT(source); - RefPtr effect = new EffectMask(source, + nsRefPtr effect = new EffectMask(source, source->GetSize(), aTransform); effect->mIs3D = aIs3D; @@ -181,7 +181,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects, void CompositableHost::RemoveMaskEffect() { - RefPtr host = GetAsTextureHost(); + nsRefPtr host = GetAsTextureHost(); if (host) { host->Unlock(); } @@ -190,7 +190,7 @@ CompositableHost::RemoveMaskEffect() /* static */ already_AddRefed CompositableHost::Create(const TextureInfo& aTextureInfo) { - RefPtr result; + nsRefPtr result; switch (aTextureInfo.mCompositableType) { case CompositableType::IMAGE_BRIDGE: NS_ERROR("Cannot create an image bridge compositable this way"); @@ -224,7 +224,7 @@ CompositableHost::DumpTextureHost(std::stringstream& aStream, TextureHost* aText if (!aTexture) { return; } - RefPtr dSurf = aTexture->GetAsSurface(); + nsRefPtr dSurf = aTexture->GetAsSurface(); if (!dSurf) { return; } diff --git a/gfx/layers/composite/CompositableHost.h b/gfx/layers/composite/CompositableHost.h index 7a66bd18738..499a1df3a1a 100644 --- a/gfx/layers/composite/CompositableHost.h +++ b/gfx/layers/composite/CompositableHost.h @@ -11,7 +11,7 @@ #include "gfxRect.h" // for gfxRect #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, RefCounted, etc +#include "mozilla/nsRefPtr.h" // for RefPtr, RefCounted, etc #include "mozilla/gfx/Point.h" // for Point #include "mozilla/gfx/Rect.h" // for Rect #include "mozilla/gfx/Types.h" // for Filter @@ -186,7 +186,7 @@ public: virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) = 0; struct TimedTexture { - RefPtr mTexture; + nsRefPtr mTexture; TimeStamp mTimeStamp; gfx::IntRect mPictureRect; int32_t mFrameID; @@ -236,7 +236,7 @@ protected: TextureInfo mTextureInfo; uint64_t mAsyncID; uint64_t mCompositorID; - RefPtr mCompositor; + nsRefPtr mCompositor; Layer* mLayer; uint32_t mFlashCounter; // used when the pref "layers.flash-borders" is true. bool mAttached; @@ -262,7 +262,7 @@ public: bool Failed() const { return !mSucceeded; } private: - RefPtr mHost; + nsRefPtr mHost; bool mSucceeded; }; diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index 66bb2cbb5cd..8fa0aad49f4 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -11,7 +11,7 @@ #include "gfxPrefs.h" // for gfxPrefs #include "gfxUtils.h" // for gfxUtils, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/UniquePtr.h" // for UniquePtr #include "mozilla/gfx/BaseRect.h" // for BaseRect #include "mozilla/gfx/Matrix.h" // for Matrix4x4 @@ -140,11 +140,11 @@ ContainerRenderVR(ContainerT* aContainer, const gfx::IntRect& aClipRect, gfx::VRHMDInfo* aHMD) { - RefPtr surface; + nsRefPtr surface; Compositor* compositor = aManager->GetCompositor(); - RefPtr previousTarget = compositor->GetCurrentRenderTarget(); + nsRefPtr previousTarget = compositor->GetCurrentRenderTarget(); float opacity = aContainer->GetEffectiveOpacity(); @@ -321,7 +321,7 @@ ContainerRenderVR(ContainerT* aContainer, /* all of the prepared data that we need in RenderLayer() */ struct PreparedData { - RefPtr mTmpTarget; + nsRefPtr mTmpTarget; nsAutoTArray mLayers; bool mNeedsSurfaceCopy; }; @@ -396,9 +396,9 @@ ContainerPrepare(ContainerT* aContainer, aContainer->DefaultComputeSupportsComponentAlphaChildren(&surfaceCopyNeeded); if (aContainer->UseIntermediateSurface()) { if (!surfaceCopyNeeded) { - RefPtr surface = nullptr; + nsRefPtr surface = nullptr; - RefPtr& lastSurf = aContainer->mLastIntermediateSurface; + nsRefPtr& lastSurf = aContainer->mLastIntermediateSurface; if (lastSurf && !aContainer->mChildrenChanged && lastSurf->GetRect().IsEqualEdges(surfaceRect)) { surface = lastSurf; } @@ -605,7 +605,7 @@ RenderLayers(ContainerT* aContainer, } } -template RefPtr +template nsRefPtr CreateOrRecycleTarget(ContainerT* aContainer, LayerManagerComposite* aManager) { @@ -618,7 +618,7 @@ CreateOrRecycleTarget(ContainerT* aContainer, mode = INIT_MODE_NONE; } - RefPtr& lastSurf = aContainer->mLastIntermediateSurface; + nsRefPtr& lastSurf = aContainer->mLastIntermediateSurface; if (lastSurf && lastSurf->GetRect().IsEqualEdges(surfaceRect)) { if (mode == INIT_MODE_CLEAR) { lastSurf->ClearOnBind(); @@ -632,13 +632,13 @@ CreateOrRecycleTarget(ContainerT* aContainer, } } -template RefPtr +template nsRefPtr CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager) { Compositor* compositor = aManager->GetCompositor(); gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); - RefPtr previousTarget = compositor->GetCurrentRenderTarget(); + nsRefPtr previousTarget = compositor->GetCurrentRenderTarget(); gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height); @@ -658,10 +658,10 @@ template void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, const gfx::IntRect& aClipRect, - RefPtr surface) + nsRefPtr surface) { Compositor* compositor = aManager->GetCompositor(); - RefPtr previousTarget = compositor->GetCurrentRenderTarget(); + nsRefPtr previousTarget = compositor->GetCurrentRenderTarget(); if (!surface) { return; @@ -689,7 +689,7 @@ ContainerRender(ContainerT* aContainer, } if (aContainer->UseIntermediateSurface()) { - RefPtr surface; + nsRefPtr surface; if (aContainer->mPrepared->mNeedsSurfaceCopy) { // we needed to copy the background so we waited until now to render the intermediate @@ -709,7 +709,7 @@ ContainerRender(ContainerT* aContainer, nsRefPtr compositor = aManager->GetCompositor(); #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpCompositorTextures) { - RefPtr surf = surface->Dump(compositor); + nsRefPtr surf = surface->Dump(compositor); if (surf) { WriteSnapshotToDumpFile(aContainer, surf); } diff --git a/gfx/layers/composite/ContainerLayerComposite.h b/gfx/layers/composite/ContainerLayerComposite.h index ec506022a45..c4f669ba863 100644 --- a/gfx/layers/composite/ContainerLayerComposite.h +++ b/gfx/layers/composite/ContainerLayerComposite.h @@ -39,14 +39,14 @@ class ContainerLayerComposite : public ContainerLayer, friend void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, const gfx::IntRect& aClipRect, - RefPtr surface); + nsRefPtr surface); template - friend RefPtr + friend nsRefPtr CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager, const RenderTargetIntRect& aClipRect); template - friend RefPtr + friend nsRefPtr CreateOrRecycleTarget(ContainerT* aContainer, LayerManagerComposite* aManager, const RenderTargetIntRect& aClipRect); @@ -115,8 +115,8 @@ public: virtual const char* Name() const override { return "ContainerLayerComposite"; } UniquePtr mPrepared; - RefPtr mLastIntermediateSurface; - RefPtr mVRRenderTargetSet; + nsRefPtr mLastIntermediateSurface; + nsRefPtr mVRRenderTargetSet; }; class RefLayerComposite : public RefLayer, @@ -138,14 +138,14 @@ class RefLayerComposite : public RefLayer, friend void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, const gfx::IntRect& aClipRect, - RefPtr surface); + nsRefPtr surface); template - friend RefPtr + friend nsRefPtr CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager, const gfx::IntRect& aClipRect); template - friend RefPtr + friend nsRefPtr CreateTemporaryTarget(ContainerT* aContainer, LayerManagerComposite* aManager, const gfx::IntRect& aClipRect); @@ -181,7 +181,7 @@ public: virtual const char* Name() const override { return "RefLayerComposite"; } UniquePtr mPrepared; - RefPtr mLastIntermediateSurface; + nsRefPtr mLastIntermediateSurface; nsRefPtr mVRRenderTargetSet; }; diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index 68b2bb2962e..2d1d1b707a2 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -62,7 +62,7 @@ ContentHostTexture::Composite(LayerComposite* aLayer, return; } - RefPtr effect = CreateTexturedEffect(mTextureSource.get(), + nsRefPtr effect = CreateTexturedEffect(mTextureSource.get(), mTextureSourceOnWhite.get(), aFilter, true, GetRenderState()); diff --git a/gfx/layers/composite/ContentHost.h b/gfx/layers/composite/ContentHost.h index 544236fb487..01a3a1361fc 100644 --- a/gfx/layers/composite/ContentHost.h +++ b/gfx/layers/composite/ContentHost.h @@ -12,7 +12,7 @@ #include "CompositableHost.h" // for CompositableHost, etc #include "RotatedBuffer.h" // for RotatedContentBuffer, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/BasePoint.h" // for BasePoint #include "mozilla/gfx/Point.h" // for Point #include "mozilla/gfx/Rect.h" // for Rect diff --git a/gfx/layers/composite/FPSCounter.cpp b/gfx/layers/composite/FPSCounter.cpp index cb1ba0eb66b..db687d518d7 100644 --- a/gfx/layers/composite/FPSCounter.cpp +++ b/gfx/layers/composite/FPSCounter.cpp @@ -389,7 +389,7 @@ static void DrawDigits(unsigned int aValue, unsigned int digit = aValue % (divisor * 10) / divisor; divisor /= 10; - RefPtr texturedEffect = static_cast(aEffectChain.mPrimaryEffect.get()); + nsRefPtr texturedEffect = static_cast(aEffectChain.mPrimaryEffect.get()); texturedEffect->mTextureCoords = Rect(float(digit * FontWidth) / textureWidth, 0, FontWidth / textureWidth, 1.0f); Rect drawRect = Rect(aOffsetX + n * FontWidth, aOffsetY, FontWidth, FontHeight); @@ -427,7 +427,7 @@ void FPSState::DrawFPS(TimeStamp aNow, } int bytesPerPixel = 4; - RefPtr fpsSurface = Factory::CreateWrappingDataSourceSurface( + nsRefPtr fpsSurface = Factory::CreateWrappingDataSourceSurface( reinterpret_cast(buf), w * bytesPerPixel, IntSize(w, h), SurfaceFormat::B8G8R8A8); mFPSTextureSource = aCompositor->CreateDataTextureSource(); mFPSTextureSource->Update(fpsSurface); diff --git a/gfx/layers/composite/FPSCounter.h b/gfx/layers/composite/FPSCounter.h index bf594093dbc..3436269781c 100644 --- a/gfx/layers/composite/FPSCounter.h +++ b/gfx/layers/composite/FPSCounter.h @@ -10,7 +10,7 @@ #include // for size_t #include // for std::map #include "GLDefs.h" // for GLuint -#include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted +#include "mozilla/nsRefPtr.h" // for already_AddRefed, RefCounted #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration #include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl, etc #include "prio.h" // for NSPR file i/o @@ -105,7 +105,7 @@ struct FPSState { FPSCounter mTransactionFps; private: - RefPtr mFPSTextureSource; + nsRefPtr mFPSTextureSource; }; } // namespace layers diff --git a/gfx/layers/composite/ImageHost.cpp b/gfx/layers/composite/ImageHost.cpp index 61dde6f2e1e..6ce2d476995 100644 --- a/gfx/layers/composite/ImageHost.cpp +++ b/gfx/layers/composite/ImageHost.cpp @@ -304,7 +304,7 @@ ImageHost::Composite(LayerComposite* aLayer, bool isAlphaPremultiplied = !(img->mFrontBuffer->GetFlags() & TextureFlags::NON_PREMULTIPLIED); - RefPtr effect = + nsRefPtr effect = CreateTexturedEffect(img->mFrontBuffer->GetFormat(), img->mTextureSource.get(), aFilter, isAlphaPremultiplied, GetRenderState()); diff --git a/gfx/layers/composite/ImageHost.h b/gfx/layers/composite/ImageHost.h index e77afa9a006..d6d25afffe1 100644 --- a/gfx/layers/composite/ImageHost.h +++ b/gfx/layers/composite/ImageHost.h @@ -9,7 +9,7 @@ #include // for FILE #include "CompositableHost.h" // for CompositableHost #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Point.h" // for Point #include "mozilla/gfx/Rect.h" // for Rect #include "mozilla/gfx/Types.h" // for Filter diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index c54fb56ba76..df77d6c3946 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -88,7 +88,7 @@ ImageLayerComposite::RenderLayer(const IntRect& aClipRect) #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpCompositorTextures) { - RefPtr surf = mImageHost->GetAsSurface(); + nsRefPtr surf = mImageHost->GetAsSurface(); WriteSnapshotToDumpFile(this, surf); } #endif diff --git a/gfx/layers/composite/ImageLayerComposite.h b/gfx/layers/composite/ImageLayerComposite.h index d6b8c31e6ab..39faf104605 100644 --- a/gfx/layers/composite/ImageLayerComposite.h +++ b/gfx/layers/composite/ImageLayerComposite.h @@ -10,7 +10,7 @@ #include "ImageLayers.h" // for ImageLayer #include "mozilla/Attributes.h" // for override #include "mozilla/gfx/Rect.h" -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc #include "nsISupportsImpl.h" // for TextureImage::AddRef, etc @@ -73,7 +73,7 @@ private: gfx::Filter GetEffectFilter(); private: - RefPtr mImageHost; + nsRefPtr mImageHost; }; } // namespace layers diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 1e50b17d3ab..54a003246fd 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -29,7 +29,7 @@ #include "gfxRect.h" // for gfxRect #include "gfxUtils.h" // for frame color util #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for IntSize, Point @@ -533,7 +533,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds) } } -RefPtr +nsRefPtr LayerManagerComposite::PushGroupForLayerEffects() { // This is currently true, so just making sure that any new use of this @@ -542,7 +542,7 @@ LayerManagerComposite::PushGroupForLayerEffects() gfxPrefs::LayersEffectGrayscale() || gfxPrefs::LayersEffectContrast() != 0.0); - RefPtr previousTarget = mCompositor->GetCurrentRenderTarget(); + nsRefPtr previousTarget = mCompositor->GetCurrentRenderTarget(); // make our render target the same size as the destination target // so that we don't have to change size if the drawing area changes. IntRect rect(previousTarget->GetOrigin(), previousTarget->GetSize()); @@ -557,7 +557,7 @@ LayerManagerComposite::PushGroupForLayerEffects() return previousTarget; } void -LayerManagerComposite::PopGroupForLayerEffects(RefPtr aPreviousTarget, +LayerManagerComposite::PopGroupForLayerEffects(nsRefPtr aPreviousTarget, IntRect aClipRect, bool aGrayscaleEffect, bool aInvertEffect, @@ -735,7 +735,7 @@ LayerManagerComposite::Render() actualBounds.width, actualBounds.height)); - RefPtr previousTarget; + nsRefPtr previousTarget; if (haveLayerEffects) { previousTarget = PushGroupForLayerEffects(); } else { diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index ca83ff2e0f3..a95a7eef4d3 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -12,7 +12,7 @@ #include "Units.h" // for ParentLayerIntRect #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Rect.h" // for Rect @@ -22,7 +22,7 @@ #include "mozilla/layers/LayersMessages.h" #include "mozilla/layers/LayersTypes.h" // for LayersBackend, etc #include "mozilla/Maybe.h" // for Maybe -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "nsAString.h" #include "mozilla/nsRefPtr.h" // for nsRefPtr @@ -311,8 +311,8 @@ private: void RenderDebugOverlay(const gfx::Rect& aBounds); - RefPtr PushGroupForLayerEffects(); - void PopGroupForLayerEffects(RefPtr aPreviousTarget, + nsRefPtr PushGroupForLayerEffects(); + void PopGroupForLayerEffects(nsRefPtr aPreviousTarget, gfx::IntRect aClipRect, bool aGrayscaleEffect, bool aInvertEffect, @@ -321,7 +321,7 @@ private: float mWarningLevel; mozilla::TimeStamp mWarnTime; bool mUnusedApzTransformWarning; - RefPtr mCompositor; + nsRefPtr mCompositor; UniquePtr mClonedLayerTreeProperties; nsTArray mImageCompositeNotifications; @@ -329,7 +329,7 @@ private: /** * Context target, nullptr when drawing directly to our swap chain. */ - RefPtr mTarget; + nsRefPtr mTarget; gfx::IntRect mTargetBounds; nsIntRegion mInvalidRegion; @@ -339,8 +339,8 @@ private: bool mIsCompositorReady; bool mDebugOverlayWantsNextFrame; - RefPtr mTwoPassTmpTarget; - RefPtr mTextRenderer; + nsRefPtr mTwoPassTmpTarget; + nsRefPtr mTextRenderer; bool mGeometryChanged; // Testing property. If hardware composer is supported, this will return @@ -478,7 +478,7 @@ protected: nsIntRegion mShadowVisibleRegion; Maybe mShadowClipRect; LayerManagerComposite* mCompositeManager; - RefPtr mCompositor; + nsRefPtr mCompositor; float mShadowOpacity; bool mShadowTransformSetByAnimation; bool mDestroyed; @@ -559,10 +559,10 @@ RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor, return; } - RefPtr originalTarget = + nsRefPtr originalTarget = aCompositor->GetCurrentRenderTarget(); - RefPtr firstTarget = + nsRefPtr firstTarget = aCompositor->CreateRenderTarget(surfaceRect, INIT_MODE_CLEAR); if (!firstTarget) { return; @@ -581,10 +581,10 @@ RenderWithAllMasks(Layer* aLayer, Compositor* aCompositor, // Apply the intermediate masks. gfx::Rect intermediateClip(surfaceRect - surfaceRect.TopLeft()); - RefPtr previousTarget = firstTarget; + nsRefPtr previousTarget = firstTarget; for (size_t i = nextAncestorMaskLayer; i < ancestorMaskLayerCount - 1; i++) { Layer* intermediateMask = aLayer->GetAncestorMaskLayerAt(i); - RefPtr intermediateTarget = + nsRefPtr intermediateTarget = aCompositor->CreateRenderTarget(surfaceRect, INIT_MODE_CLEAR); if (!intermediateTarget) { break; diff --git a/gfx/layers/composite/PaintedLayerComposite.cpp b/gfx/layers/composite/PaintedLayerComposite.cpp index e1b98020de2..a5479f76ae7 100644 --- a/gfx/layers/composite/PaintedLayerComposite.cpp +++ b/gfx/layers/composite/PaintedLayerComposite.cpp @@ -116,7 +116,7 @@ PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpCompositorTextures) { - RefPtr surf = mBuffer->GetAsSurface(); + nsRefPtr surf = mBuffer->GetAsSurface(); if (surf) { WriteSnapshotToDumpFile(this, surf); } diff --git a/gfx/layers/composite/PaintedLayerComposite.h b/gfx/layers/composite/PaintedLayerComposite.h index c4107d6a9b2..a0281f8c491 100644 --- a/gfx/layers/composite/PaintedLayerComposite.h +++ b/gfx/layers/composite/PaintedLayerComposite.h @@ -9,7 +9,7 @@ #include "Layers.h" // for Layer (ptr only), etc #include "mozilla/gfx/Rect.h" #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc #include "nsDebug.h" // for NS_RUNTIMEABORT @@ -83,7 +83,7 @@ private: gfx::Filter GetEffectFilter() { return gfx::Filter::LINEAR; } private: - RefPtr mBuffer; + nsRefPtr mBuffer; }; } // namespace layers diff --git a/gfx/layers/composite/TextRenderer.cpp b/gfx/layers/composite/TextRenderer.cpp index a32f1f8ed2b..2bbee24090a 100644 --- a/gfx/layers/composite/TextRenderer.cpp +++ b/gfx/layers/composite/TextRenderer.cpp @@ -83,7 +83,7 @@ TextRenderer::RenderText(const string& aText, const IntPoint& aOrigin, } // Create a surface to draw our glyphs to. - RefPtr textSurf = + nsRefPtr textSurf = Factory::CreateDataSourceSurface(IntSize(maxWidth, numLines * sCellHeight), sTextureFormat); if (NS_WARN_IF(!textSurf)) { return; @@ -124,14 +124,14 @@ TextRenderer::RenderText(const string& aText, const IntPoint& aOrigin, textSurf->Unmap(); - RefPtr src = mCompositor->CreateDataTextureSource(); + nsRefPtr src = mCompositor->CreateDataTextureSource(); if (!src->Update(textSurf)) { // Upload failed. return; } - RefPtr effect = new EffectRGB(src, true, Filter::LINEAR); + nsRefPtr effect = new EffectRGB(src, true, Filter::LINEAR); EffectChain chain; chain.mPrimaryEffect = effect; diff --git a/gfx/layers/composite/TextRenderer.h b/gfx/layers/composite/TextRenderer.h index 7665558eb3b..0499e78f310 100644 --- a/gfx/layers/composite/TextRenderer.h +++ b/gfx/layers/composite/TextRenderer.h @@ -39,8 +39,8 @@ private: // if the underlying CreateDataSourceSurface fails for some reason. void EnsureInitialized(); - RefPtr mCompositor; - RefPtr mGlyphBitmaps; + nsRefPtr mCompositor; + nsRefPtr mGlyphBitmaps; gfx::DataSourceSurface::MappedSurface mMap; }; diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index e086cb964a7..94532cda3e2 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -89,8 +89,8 @@ public: void ClearTextureHost(); CompositableParentManager* mCompositableManager; - RefPtr mWaitForClientRecycle; - RefPtr mTextureHost; + nsRefPtr mWaitForClientRecycle; + nsRefPtr mTextureHost; }; //////////////////////////////////////////////////////////////////////////////// @@ -254,7 +254,7 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, TextureFlags aFlags) { - RefPtr result; + nsRefPtr result; switch (aDesc.type()) { case SurfaceDescriptor::TSurfaceDescriptorShmem: { const SurfaceDescriptorShmem& descriptor = aDesc.get_SurfaceDescriptorShmem(); @@ -346,7 +346,7 @@ TextureHost::PrintInfo(std::stringstream& aStream, const char* aPrefix) pfx += " "; aStream << "\n" << pfx.get() << "Surface: "; - RefPtr dSurf = GetAsSurface(); + nsRefPtr dSurf = GetAsSurface(); if (dSurf) { aStream << gfxUtils::GetAsLZ4Base64Str(dSurf).get(); } @@ -432,7 +432,7 @@ BufferTextureHost::SetCompositor(Compositor* aCompositor) if (mCompositor == aCompositor) { return; } - RefPtr it = mFirstSource; + nsRefPtr it = mFirstSource; while (it) { it->SetCompositor(aCompositor); it = it->GetNextSibling(); @@ -444,7 +444,7 @@ BufferTextureHost::SetCompositor(Compositor* aCompositor) void BufferTextureHost::DeallocateDeviceData() { - RefPtr it = mFirstSource; + nsRefPtr it = mFirstSource; while (it) { it->DeallocateDeviceData(); it = it->GetNextSibling(); @@ -535,7 +535,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) MOZ_ASSERT(yuvDeserializer.IsValid()); if (!mCompositor->SupportsEffect(EffectTypes::YCBCR)) { - RefPtr surf = yuvDeserializer.ToDataSourceSurface(); + nsRefPtr surf = yuvDeserializer.ToDataSourceSurface(); if (NS_WARN_IF(!surf)) { return false; } @@ -546,9 +546,9 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) return true; } - RefPtr srcY; - RefPtr srcU; - RefPtr srcV; + nsRefPtr srcY; + nsRefPtr srcU; + nsRefPtr srcV; if (!mFirstSource) { // We don't support BigImages for YCbCr compositing. srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE); @@ -570,17 +570,17 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) } - RefPtr tempY = + nsRefPtr tempY = gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetYData(), yuvDeserializer.GetYStride(), yuvDeserializer.GetYSize(), gfx::SurfaceFormat::A8); - RefPtr tempCb = + nsRefPtr tempCb = gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCbData(), yuvDeserializer.GetCbCrStride(), yuvDeserializer.GetCbCrSize(), gfx::SurfaceFormat::A8); - RefPtr tempCr = + nsRefPtr tempCr = gfx::Factory::CreateWrappingDataSourceSurface(yuvDeserializer.GetCrData(), yuvDeserializer.GetCbCrStride(), yuvDeserializer.GetCbCrSize(), @@ -612,7 +612,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) return false; } - RefPtr surf = deserializer.GetAsSurface(); + nsRefPtr surf = deserializer.GetAsSurface(); if (!surf) { return false; } @@ -629,7 +629,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion) already_AddRefed BufferTextureHost::GetAsSurface() { - RefPtr result; + nsRefPtr result; if (mFormat == gfx::SurfaceFormat::UNKNOWN) { NS_WARNING("BufferTextureHost: unsupported format!"); return nullptr; diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index 22c9685ece2..9cfc2c9fe4e 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -11,7 +11,7 @@ #include "gfxTypes.h" #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed, etc #include "mozilla/gfx/2D.h" // for DataSourceSurface #include "mozilla/gfx/Point.h" // for IntSize, IntPoint #include "mozilla/gfx/Types.h" // for SurfaceFormat, etc @@ -153,12 +153,12 @@ public: protected: - RefPtr mNextSibling; + nsRefPtr mNextSibling; int mCompositableCount; }; /** - * equivalent of a RefPtr, that calls AddCompositableRef and + * equivalent of a nsRefPtr, that calls AddCompositableRef and * ReleaseCompositableRef in addition to the usual AddRef and Release. */ template @@ -213,7 +213,7 @@ public: T& operator*() const { return *mRef; } private: - RefPtr mRef; + nsRefPtr mRef; }; typedef CompositableTextureRef CompositableTextureSourceRef; @@ -609,8 +609,8 @@ protected: virtual void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override; - RefPtr mCompositor; - RefPtr mFirstSource; + nsRefPtr mCompositor; + nsRefPtr mFirstSource; nsIntRegion mMaybeUpdatedRegion; gfx::IntSize mSize; // format of the data that is shared with the content process. @@ -651,7 +651,7 @@ public: protected: UniquePtr mShmem; - RefPtr mDeallocator; + nsRefPtr mDeallocator; }; /** @@ -704,7 +704,7 @@ public: bool Failed() { return mTexture && !mLocked; } private: - RefPtr mTexture; + nsRefPtr mTexture; bool mLocked; }; diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index 1d5704b6e91..6b751e019b5 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -477,7 +477,7 @@ TiledContentHost::RenderTile(TileHost& aTile, return; } - RefPtr effect = + nsRefPtr effect = CreateTexturedEffect(aTile.mTextureSource, aTile.mTextureSourceOnWhite, aFilter, diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index f15df1ffdc8..fc79f6408d1 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -14,7 +14,7 @@ #include "CompositableHost.h" #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Point.h" // for Point #include "mozilla/gfx/Rect.h" // for Rect #include "mozilla/gfx/Types.h" // for Filter @@ -113,7 +113,7 @@ public: CompositableHost::DumpTextureHost(aStream, mTextureHost); } - RefPtr mSharedLock; + nsRefPtr mSharedLock; CompositableTextureHostRef mTextureHost; CompositableTextureHostRef mTextureHostOnWhite; mutable CompositableTextureSourceRef mTextureSource; @@ -155,7 +155,7 @@ public: protected: CSSToParentLayerScale2D mFrameResolution; - nsTArray> mDelayedUnlocks; + nsTArray> mDelayedUnlocks; }; /** diff --git a/gfx/layers/composite/X11TextureHost.cpp b/gfx/layers/composite/X11TextureHost.cpp index 614510740e0..32d99e4b5ee 100644 --- a/gfx/layers/composite/X11TextureHost.cpp +++ b/gfx/layers/composite/X11TextureHost.cpp @@ -92,13 +92,13 @@ X11TextureHost::GetAsSurface() if (!mTextureSource || !mTextureSource->AsSourceBasic()) { return nullptr; } - RefPtr tempDT = + nsRefPtr tempDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( GetSize(), GetFormat()); if (!tempDT) { return nullptr; } - RefPtr surf = mTextureSource->AsSourceBasic()->GetSurface(tempDT); + nsRefPtr surf = mTextureSource->AsSourceBasic()->GetSurface(tempDT); if (!surf) { return nullptr; } diff --git a/gfx/layers/composite/X11TextureHost.h b/gfx/layers/composite/X11TextureHost.h index 4ac586f01b1..0acc4b50eea 100644 --- a/gfx/layers/composite/X11TextureHost.h +++ b/gfx/layers/composite/X11TextureHost.h @@ -57,9 +57,9 @@ protected: mTextureSource->Updated(); } - RefPtr mCompositor; - RefPtr mTextureSource; - RefPtr mSurface; + nsRefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mSurface; }; } // namespace layers diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 20ed0235a9f..15c59745a2b 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -58,13 +58,13 @@ struct DeviceAttachmentsD3D11 bool CreateShaders(); bool InitSyncObject(); - typedef EnumeratedArray> + typedef EnumeratedArray> VertexShaderArray; - typedef EnumeratedArray> + typedef EnumeratedArray> PixelShaderArray; - RefPtr mInputLayout; - RefPtr mVertexBuffer; + nsRefPtr mInputLayout; + nsRefPtr mVertexBuffer; VertexShaderArray mVSQuadShader; PixelShaderArray mSolidColorShader; @@ -72,47 +72,47 @@ struct DeviceAttachmentsD3D11 PixelShaderArray mRGBShader; PixelShaderArray mYCbCrShader; PixelShaderArray mComponentAlphaShader; - RefPtr mPSConstantBuffer; - RefPtr mVSConstantBuffer; - RefPtr mRasterizerState; - RefPtr mLinearSamplerState; - RefPtr mPointSamplerState; - RefPtr mPremulBlendState; - RefPtr mNonPremulBlendState; - RefPtr mComponentBlendState; - RefPtr mDisabledBlendState; - RefPtr mSyncTexture; + nsRefPtr mPSConstantBuffer; + nsRefPtr mVSConstantBuffer; + nsRefPtr mRasterizerState; + nsRefPtr mLinearSamplerState; + nsRefPtr mPointSamplerState; + nsRefPtr mPremulBlendState; + nsRefPtr mNonPremulBlendState; + nsRefPtr mComponentBlendState; + nsRefPtr mDisabledBlendState; + nsRefPtr mSyncTexture; HANDLE mSyncHandle; // // VR pieces // - typedef EnumeratedArray> + typedef EnumeratedArray> VRDistortionInputLayoutArray; - typedef EnumeratedArray> + typedef EnumeratedArray> VRVertexShaderArray; - typedef EnumeratedArray> + typedef EnumeratedArray> VRPixelShaderArray; VRDistortionInputLayoutArray mVRDistortionInputLayout; VRVertexShaderArray mVRDistortionVS; VRPixelShaderArray mVRDistortionPS; - RefPtr mVRDistortionConstants; + nsRefPtr mVRDistortionConstants; // These will be created/filled in as needed during rendering whenever the configuration // changes. VRHMDConfiguration mVRConfiguration; - RefPtr mVRDistortionVertices[2]; // one for each eye - RefPtr mVRDistortionIndices[2]; + nsRefPtr mVRDistortionVertices[2]; // one for each eye + nsRefPtr mVRDistortionIndices[2]; uint32_t mVRDistortionIndexCount[2]; private: void InitVertexShader(const ShaderBytes& aShader, VertexShaderArray& aArray, MaskType aMaskType) { - InitVertexShader(aShader, byRef(aArray[aMaskType])); + InitVertexShader(aShader, getter_AddRefs(aArray[aMaskType])); } void InitPixelShader(const ShaderBytes& aShader, PixelShaderArray& aArray, MaskType aMaskType) { - InitPixelShader(aShader, byRef(aArray[aMaskType])); + InitPixelShader(aShader, getter_AddRefs(aArray[aMaskType])); } void InitVertexShader(const ShaderBytes& aShader, ID3D11VertexShader** aOut) { if (!mInitOkay) { @@ -141,7 +141,7 @@ private: } // Only used during initialization. - RefPtr mDevice; + nsRefPtr mDevice; bool mInitOkay; }; @@ -195,7 +195,7 @@ CompositorD3D11::Initialize() return false; } - mDevice->GetImmediateContext(byRef(mContext)); + mDevice->GetImmediateContext(getter_AddRefs(mContext)); if (!mContext) { gfxCriticalError(CriticalLog::DefaultOptions(false)) @@ -236,7 +236,7 @@ CompositorD3D11::Initialize() sizeof(layout) / sizeof(D3D11_INPUT_ELEMENT_DESC), LayerQuadVS, sizeof(LayerQuadVS), - byRef(mAttachments->mInputLayout)); + getter_AddRefs(mAttachments->mInputLayout)); if (Failed(hr, "CreateInputLayout")) { return false; @@ -247,7 +247,7 @@ CompositorD3D11::Initialize() D3D11_SUBRESOURCE_DATA data; data.pSysMem = (void*)vertices; - hr = mDevice->CreateBuffer(&bufferDesc, &data, byRef(mAttachments->mVertexBuffer)); + hr = mDevice->CreateBuffer(&bufferDesc, &data, getter_AddRefs(mAttachments->mVertexBuffer)); if (Failed(hr, "create vertex buffer")) { return false; @@ -262,13 +262,13 @@ CompositorD3D11::Initialize() D3D11_USAGE_DYNAMIC, D3D11_CPU_ACCESS_WRITE); - hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mVSConstantBuffer)); + hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, getter_AddRefs(mAttachments->mVSConstantBuffer)); if (Failed(hr, "create vs buffer")) { return false; } cBufferDesc.ByteWidth = sizeof(PixelShaderConstants); - hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mPSConstantBuffer)); + hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, getter_AddRefs(mAttachments->mPSConstantBuffer)); if (Failed(hr, "create ps buffer")) { return false; } @@ -277,19 +277,19 @@ CompositorD3D11::Initialize() rastDesc.CullMode = D3D11_CULL_NONE; rastDesc.ScissorEnable = TRUE; - hr = mDevice->CreateRasterizerState(&rastDesc, byRef(mAttachments->mRasterizerState)); + hr = mDevice->CreateRasterizerState(&rastDesc, getter_AddRefs(mAttachments->mRasterizerState)); if (Failed(hr, "create rasterizer")) { return false; } CD3D11_SAMPLER_DESC samplerDesc(D3D11_DEFAULT); - hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mLinearSamplerState)); + hr = mDevice->CreateSamplerState(&samplerDesc, getter_AddRefs(mAttachments->mLinearSamplerState)); if (Failed(hr, "create linear sampler")) { return false; } samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; - hr = mDevice->CreateSamplerState(&samplerDesc, byRef(mAttachments->mPointSamplerState)); + hr = mDevice->CreateSamplerState(&samplerDesc, getter_AddRefs(mAttachments->mPointSamplerState)); if (Failed(hr, "create point sampler")) { return false; } @@ -302,7 +302,7 @@ CompositorD3D11::Initialize() D3D11_COLOR_WRITE_ENABLE_ALL }; blendDesc.RenderTarget[0] = rtBlendPremul; - hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mPremulBlendState)); + hr = mDevice->CreateBlendState(&blendDesc, getter_AddRefs(mAttachments->mPremulBlendState)); if (Failed(hr, "create pm blender")) { return false; } @@ -314,7 +314,7 @@ CompositorD3D11::Initialize() D3D11_COLOR_WRITE_ENABLE_ALL }; blendDesc.RenderTarget[0] = rtBlendNonPremul; - hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mNonPremulBlendState)); + hr = mDevice->CreateBlendState(&blendDesc, getter_AddRefs(mAttachments->mNonPremulBlendState)); if (Failed(hr, "create npm blender")) { return false; } @@ -331,7 +331,7 @@ CompositorD3D11::Initialize() D3D11_COLOR_WRITE_ENABLE_ALL }; blendDesc.RenderTarget[0] = rtBlendComponent; - hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mComponentBlendState)); + hr = mDevice->CreateBlendState(&blendDesc, getter_AddRefs(mAttachments->mComponentBlendState)); if (Failed(hr, "create component blender")) { return false; } @@ -344,7 +344,7 @@ CompositorD3D11::Initialize() D3D11_COLOR_WRITE_ENABLE_ALL }; blendDesc.RenderTarget[0] = rtBlendDisabled; - hr = mDevice->CreateBlendState(&blendDesc, byRef(mAttachments->mDisabledBlendState)); + hr = mDevice->CreateBlendState(&blendDesc, getter_AddRefs(mAttachments->mDisabledBlendState)); if (Failed(hr, "create null blender")) { return false; } @@ -369,14 +369,14 @@ CompositorD3D11::Initialize() sizeof(vrlayout) / sizeof(D3D11_INPUT_ELEMENT_DESC), Oculus050VRDistortionVS, sizeof(Oculus050VRDistortionVS), - byRef(mAttachments->mVRDistortionInputLayout[VRHMDType::Oculus050])); + getter_AddRefs(mAttachments->mVRDistortionInputLayout[VRHMDType::Oculus050])); // XXX shared for now, rename mAttachments->mVRDistortionInputLayout[VRHMDType::Cardboard] = mAttachments->mVRDistortionInputLayout[VRHMDType::Oculus050]; cBufferDesc.ByteWidth = sizeof(gfx::VRDistortionConstants); - hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, byRef(mAttachments->mVRDistortionConstants)); + hr = mDevice->CreateBuffer(&cBufferDesc, nullptr, getter_AddRefs(mAttachments->mVRDistortionConstants)); if (Failed(hr, "create vr buffer ")) { return false; } @@ -414,7 +414,7 @@ CompositorD3D11::Initialize() * the window we draw to. The front buffer is the full screen front * buffer. */ - hr = dxgiFactory->CreateSwapChain(dxgiDevice, &swapDesc, byRef(mSwapChain)); + hr = dxgiFactory->CreateSwapChain(dxgiDevice, &swapDesc, getter_AddRefs(mSwapChain)); if (Failed(hr, "create swap chain")) { return false; } @@ -435,7 +435,7 @@ CompositorD3D11::Initialize() already_AddRefed CompositorD3D11::CreateDataTextureSource(TextureFlags aFlags) { - RefPtr result = new DataTextureSourceD3D11(gfx::SurfaceFormat::UNKNOWN, + nsRefPtr result = new DataTextureSourceD3D11(gfx::SurfaceFormat::UNKNOWN, this, aFlags); return result.forget(); } @@ -482,14 +482,14 @@ CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect, CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aRect.width, aRect.height, 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); - RefPtr texture; - HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture)); + nsRefPtr texture; + HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture)); if (Failed(hr) || !texture) { gfxCriticalError(gfxCriticalError::DefaultOptions(false)) << "Failed in CreateRenderTarget"; return nullptr; } - RefPtr rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft()); + nsRefPtr rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft()); rt->SetSize(IntSize(aRect.width, aRect.height)); if (aInit == INIT_MODE_CLEAR) { @@ -515,8 +515,8 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect, aRect.width, aRect.height, 1, 1, D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET); - RefPtr texture; - HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture)); + nsRefPtr texture; + HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture)); NS_ASSERTION(texture, "Could not create texture"); if (Failed(hr) || !texture) { gfxCriticalError(gfxCriticalError::DefaultOptions(false)) << "Failed in CreateRenderTargetFromSource"; @@ -553,7 +553,7 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect, } } - RefPtr rt = + nsRefPtr rt = new CompositingRenderTargetD3D11(texture, aRect.TopLeft()); rt->SetSize(aRect.Size()); @@ -695,7 +695,7 @@ CompositorD3D11::DrawVRDistortion(const gfx::Rect& aRect, desc.ByteWidth = mesh.mVertices.Length() * sizeof(gfx::VRDistortionVertex); sdata.pSysMem = mesh.mVertices.Elements(); - hr = mDevice->CreateBuffer(&desc, &sdata, byRef(mAttachments->mVRDistortionVertices[eye])); + hr = mDevice->CreateBuffer(&desc, &sdata, getter_AddRefs(mAttachments->mVRDistortionVertices[eye])); if (FAILED(hr)) { NS_WARNING("CreateBuffer failed"); return; @@ -705,7 +705,7 @@ CompositorD3D11::DrawVRDistortion(const gfx::Rect& aRect, desc.ByteWidth = mesh.mIndices.Length() * sizeof(uint16_t); sdata.pSysMem = mesh.mIndices.Elements(); - hr = mDevice->CreateBuffer(&desc, &sdata, byRef(mAttachments->mVRDistortionIndices[eye])); + hr = mDevice->CreateBuffer(&desc, &sdata, getter_AddRefs(mAttachments->mVRDistortionIndices[eye])); if (FAILED(hr)) { NS_WARNING("CreateBuffer failed"); return; @@ -1078,8 +1078,8 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, ClearRect(Rect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height)); if (mAttachments->mSyncTexture) { - RefPtr mutex; - mAttachments->mSyncTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + mAttachments->mSyncTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); MOZ_ASSERT(mutex); HRESULT hr = mutex->AcquireSync(0, 10000); @@ -1114,8 +1114,8 @@ CompositorD3D11::EndFrame() } if (oldSize == mSize) { - RefPtr chain; - HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)byRef(chain)); + nsRefPtr chain; + HRESULT hr = mSwapChain->QueryInterface((IDXGISwapChain1**)getter_AddRefs(chain)); nsString vendorID; nsCOMPtr gfxInfo = services::GetGfxInfo(); gfxInfo->GetAdapterVendorID(vendorID); @@ -1284,13 +1284,13 @@ DeviceAttachmentsD3D11::InitSyncObject() D3D11_BIND_RENDER_TARGET); desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; - RefPtr texture; - HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, byRef(texture)); + nsRefPtr texture; + HRESULT hr = mDevice->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture)); if (Failed(hr, "create sync texture")) { return false; } - hr = texture->QueryInterface((IDXGIResource**)byRef(mSyncTexture)); + hr = texture->QueryInterface((IDXGIResource**)getter_AddRefs(mSyncTexture)); if (Failed(hr, "QI sync texture")) { return false; } @@ -1329,8 +1329,8 @@ DeviceAttachmentsD3D11::CreateShaders() InitPixelShader(sComponentAlphaShaderMask, mComponentAlphaShader, MaskType::Mask2d); } - InitVertexShader(sOculus050VRDistortionVS, byRef(mVRDistortionVS[VRHMDType::Oculus050])); - InitPixelShader(sOculus050VRDistortionPS, byRef(mVRDistortionPS[VRHMDType::Oculus050])); + InitVertexShader(sOculus050VRDistortionVS, getter_AddRefs(mVRDistortionVS[VRHMDType::Oculus050])); + InitPixelShader(sOculus050VRDistortionPS, getter_AddRefs(mVRDistortionPS[VRHMDType::Oculus050])); // These are shared // XXX rename Oculus050 shaders to something more generic @@ -1425,7 +1425,7 @@ CompositorD3D11::PaintToTarget() gfxCriticalErrorOnce(gfxCriticalError::DefaultOptions(false)) << "Failed in PaintToTarget 3"; return; } - RefPtr sourceSurface = + nsRefPtr sourceSurface = Factory::CreateWrappingDataSourceSurface((uint8_t*)map.pData, map.RowPitch, IntSize(bbDesc.Width, bbDesc.Height), diff --git a/gfx/layers/d3d11/CompositorD3D11.h b/gfx/layers/d3d11/CompositorD3D11.h index c7ef283d3c8..79633cd1e81 100644 --- a/gfx/layers/d3d11/CompositorD3D11.h +++ b/gfx/layers/d3d11/CompositorD3D11.h @@ -175,11 +175,11 @@ private: virtual gfx::IntSize GetWidgetSize() const override { return mSize; } - RefPtr mContext; - RefPtr mDevice; - RefPtr mSwapChain; - RefPtr mDefaultRT; - RefPtr mCurrentRT; + nsRefPtr mContext; + nsRefPtr mDevice; + nsRefPtr mSwapChain; + nsRefPtr mDefaultRT; + nsRefPtr mCurrentRT; DeviceAttachmentsD3D11* mAttachments; diff --git a/gfx/layers/d3d11/ReadbackManagerD3D11.cpp b/gfx/layers/d3d11/ReadbackManagerD3D11.cpp index 28d7f5146dd..8a60f1dd707 100644 --- a/gfx/layers/d3d11/ReadbackManagerD3D11.cpp +++ b/gfx/layers/d3d11/ReadbackManagerD3D11.cpp @@ -26,7 +26,7 @@ struct ReadbackTask { // The texture that we copied the contents of the paintedlayer to. nsRefPtr mReadbackTexture; // The sink that we're trying to read back to. - RefPtr mSink; + nsRefPtr mSink; }; // This class is created and dispatched from the Readback thread but it must be @@ -54,7 +54,7 @@ public: } { - RefPtr surf = + nsRefPtr surf = Factory::CreateWrappingDataSourceSurface((uint8_t*)mappedTex.pData, mappedTex.RowPitch, IntSize(desc.Width, desc.Height), SurfaceFormat::B8G8R8X8); diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 4c6467237e8..4539f940de6 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -71,9 +71,9 @@ TextureSourceD3D11::GetShaderResourceView() MOZ_ASSERT(mTexture == GetD3D11Texture(), "You need to override GetShaderResourceView if you're overriding GetD3D11Texture!"); if (!mSRV && mTexture) { - RefPtr device; - mTexture->GetDevice(byRef(device)); - HRESULT hr = device->CreateShaderResourceView(mTexture, nullptr, byRef(mSRV)); + nsRefPtr device; + mTexture->GetDevice(getter_AddRefs(device)); + HRESULT hr = device->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRV)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(false)) << "[D3D11] TextureSourceD3D11:GetShaderResourceView CreateSRV failure " << gfx::hexa(hr); return nullptr; @@ -126,8 +126,8 @@ template // ID3D10Texture2D or ID3D11Texture2D static bool LockD3DTexture(T* aTexture) { MOZ_ASSERT(aTexture); - RefPtr mutex; - aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + aTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); // Textures created by the DXVA decoders don't have a mutex for synchronization if (mutex) { HRESULT hr = mutex->AcquireSync(0, 10000); @@ -147,8 +147,8 @@ template // ID3D10Texture2D or ID3D11Texture2D static void UnlockD3DTexture(T* aTexture) { MOZ_ASSERT(aTexture); - RefPtr mutex; - aTexture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + aTexture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); if (mutex) { HRESULT hr = mutex->ReleaseSync(0); if (FAILED(hr)) { @@ -162,7 +162,7 @@ CreateTextureHostD3D11(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, TextureFlags aFlags) { - RefPtr result; + nsRefPtr result; switch (aDesc.type()) { case SurfaceDescriptor::TSurfaceDescriptorShmem: case SurfaceDescriptor::TSurfaceDescriptorMemory: { @@ -241,7 +241,7 @@ TextureClientD3D11::Create(ISurfaceAllocator* aAllocator, ID3D11Texture2D* aTexture, gfx::IntSize aSize) { - RefPtr texture = new TextureClientD3D11(aAllocator, + nsRefPtr texture = new TextureClientD3D11(aAllocator, aFormat, aFlags); texture->mTexture = aTexture; @@ -256,7 +256,7 @@ TextureClientD3D11::Create(ISurfaceAllocator* aAllocator, ID3D11Device* aDevice, const gfx::IntSize& aSize) { - RefPtr texture = new TextureClientD3D11(aAllocator, + nsRefPtr texture = new TextureClientD3D11(aAllocator, aFormat, aFlags); if (!texture->AllocateD3D11Surface(aDevice, aSize)) { @@ -269,7 +269,7 @@ already_AddRefed TextureClientD3D11::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new TextureClientD3D11(mAllocator, mFormat, + nsRefPtr tex = new TextureClientD3D11(mAllocator, mFormat, mFlags | aFlags); if (!tex->AllocateForSurface(mSize, aAllocFlags)) { @@ -378,8 +378,8 @@ TextureClientD3D11::Unlock() desc.CPUAccessFlags = D3D10_CPU_ACCESS_READ; desc.MiscFlags = 0; - RefPtr tex; - HRESULT hr = device->CreateTexture2D(&desc, nullptr, byRef(tex)); + nsRefPtr tex; + HRESULT hr = device->CreateTexture2D(&desc, nullptr, getter_AddRefs(tex)); if (SUCCEEDED(hr)) { device->CopyResource(tex, mTexture10); @@ -432,7 +432,7 @@ TextureClientD3D11::BorrowDrawTarget() void TextureClientD3D11::UpdateFromSurface(gfx::SourceSurface* aSurface) { - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface."; @@ -457,10 +457,10 @@ TextureClientD3D11::UpdateFromSurface(gfx::SourceSurface* aSurface) } if (mTexture) { - RefPtr device; - mTexture->GetDevice(byRef(device)); - RefPtr ctx; - device->GetImmediateContext(byRef(ctx)); + nsRefPtr device; + mTexture->GetDevice(getter_AddRefs(device)); + nsRefPtr ctx; + device->GetImmediateContext(getter_AddRefs(ctx)); D3D11_BOX box; box.front = 0; @@ -471,8 +471,8 @@ TextureClientD3D11::UpdateFromSurface(gfx::SourceSurface* aSurface) ctx->UpdateSubresource(mTexture, 0, &box, sourceMap.mData, sourceMap.mStride, 0); } else { - RefPtr device; - mTexture10->GetDevice(byRef(device)); + nsRefPtr device; + mTexture10->GetDevice(getter_AddRefs(device)); D3D10_BOX box; box.front = 0; @@ -550,7 +550,7 @@ TextureClientD3D11::AllocateD3D11Surface(ID3D11Device* aDevice, const gfx::IntSi newDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; } - HRESULT hr = aDevice->CreateTexture2D(&newDesc, nullptr, byRef(mTexture)); + HRESULT hr = aDevice->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(mTexture)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize))) << "[D3D11] 2 CreateTexture2D failure " << aSize << " Code: " << gfx::hexa(hr); return false; @@ -595,7 +595,7 @@ TextureClientD3D11::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFlag newDesc.MiscFlags = D3D10_RESOURCE_MISC_SHARED; - hr = device->CreateTexture2D(&newDesc, nullptr, byRef(mTexture10)); + hr = device->CreateTexture2D(&newDesc, nullptr, getter_AddRefs(mTexture10)); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(Factory::ReasonableSurfaceSize(aSize))) << "[D3D10] 2 CreateTexture2D failure " << aSize << " Code: " << gfx::hexa(hr); return false; @@ -620,11 +620,11 @@ TextureClientD3D11::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) if (!IsAllocated()) { return false; } - RefPtr resource; + nsRefPtr resource; if (mTexture) { - mTexture->QueryInterface((IDXGIResource**)byRef(resource)); + mTexture->QueryInterface((IDXGIResource**)getter_AddRefs(resource)); } else { - mTexture10->QueryInterface((IDXGIResource**)byRef(resource)); + mTexture10->QueryInterface((IDXGIResource**)getter_AddRefs(resource)); } HANDLE sharedHandle; @@ -650,7 +650,7 @@ DXGIYCbCrTextureClient::DXGIYCbCrTextureClient(ISurfaceAllocator* aAllocator, class YCbCrKeepAliveD3D11 : public KeepAlive { public: - YCbCrKeepAliveD3D11(RefPtr aTextures[3]) + YCbCrKeepAliveD3D11(nsRefPtr aTextures[3]) { mTextures[0] = aTextures[0]; mTextures[1] = aTextures[1]; @@ -658,7 +658,7 @@ public: } protected: - RefPtr mTextures[3]; + nsRefPtr mTextures[3]; }; DXGIYCbCrTextureClient::~DXGIYCbCrTextureClient() @@ -700,7 +700,7 @@ DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator, aTextureCr->SetPrivateData(sD3D11TextureUsage, new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height), sizeof(IUnknown*), D3DSPD_IUNKNOWN); - RefPtr texture = + nsRefPtr texture = new DXGIYCbCrTextureClient(aAllocator, aFlags); texture->mHandles[0] = aHandleY; texture->mHandles[1] = aHandleCb; @@ -735,24 +735,24 @@ DXGIYCbCrTextureClient::Create(ISurfaceAllocator* aAllocator, aTextureCr->SetPrivateDataInterface(sD3D11TextureUsage, new TextureMemoryMeasurer(aSizeCbCr.width * aSizeCbCr.height)); - RefPtr texture = + nsRefPtr texture = new DXGIYCbCrTextureClient(aAllocator, aFlags); - RefPtr resource; + nsRefPtr resource; - aTextureY->QueryInterface((IDXGIResource**)byRef(resource)); + aTextureY->QueryInterface((IDXGIResource**)getter_AddRefs(resource)); HRESULT hr = resource->GetSharedHandle(&texture->mHandles[0]); if (FAILED(hr)) { return nullptr; } - aTextureCb->QueryInterface((IDXGIResource**)byRef(resource)); + aTextureCb->QueryInterface((IDXGIResource**)getter_AddRefs(resource)); hr = resource->GetSharedHandle(&texture->mHandles[1]); if (FAILED(hr)) { return nullptr; } - aTextureCr->QueryInterface((IDXGIResource**)byRef(resource)); + aTextureCr->QueryInterface((IDXGIResource**)getter_AddRefs(resource)); hr = resource->GetSharedHandle(&texture->mHandles[2]); if (FAILED(hr)) { return nullptr; @@ -817,7 +817,7 @@ DXGITextureHostD3D11::OpenSharedHandle() HRESULT hr = GetDevice()->OpenSharedResource((HANDLE)mHandle, __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(mTexture)); + (void**)(ID3D11Texture2D**)getter_AddRefs(mTexture)); if (FAILED(hr)) { NS_WARNING("Failed to open shared texture"); return false; @@ -901,11 +901,11 @@ DXGIYCbCrTextureHostD3D11::OpenSharedHandle() return false; } - RefPtr textures[3]; + nsRefPtr textures[3]; HRESULT hr = GetDevice()->OpenSharedResource((HANDLE)mHandles[0], __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(textures[0])); + (void**)(ID3D11Texture2D**)getter_AddRefs(textures[0])); if (FAILED(hr)) { NS_WARNING("Failed to open shared texture for Y Plane"); return false; @@ -913,7 +913,7 @@ DXGIYCbCrTextureHostD3D11::OpenSharedHandle() hr = GetDevice()->OpenSharedResource((HANDLE)mHandles[1], __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(textures[1])); + (void**)(ID3D11Texture2D**)getter_AddRefs(textures[1])); if (FAILED(hr)) { NS_WARNING("Failed to open shared texture for Cb Plane"); return false; @@ -921,7 +921,7 @@ DXGIYCbCrTextureHostD3D11::OpenSharedHandle() hr = GetDevice()->OpenSharedResource((HANDLE)mHandles[2], __uuidof(ID3D11Texture2D), - (void**)(ID3D11Texture2D**)byRef(textures[2])); + (void**)(ID3D11Texture2D**)getter_AddRefs(textures[2])); if (FAILED(hr)) { NS_WARNING("Failed to open shared texture for Cr Plane"); return false; @@ -1040,7 +1040,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, } if (!mTexture) { - hr = mCompositor->GetDevice()->CreateTexture2D(&desc, nullptr, byRef(mTexture)); + hr = mCompositor->GetDevice()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture)); mIsTiled = false; if (FAILED(hr) || !mTexture) { Reset(); @@ -1099,7 +1099,7 @@ DataTextureSourceD3D11::Update(DataSourceSurface* aSurface, tileRect.x * bpp; initData.SysMemPitch = aSurface->Stride(); - hr = mCompositor->GetDevice()->CreateTexture2D(&desc, &initData, byRef(mTileTextures[i])); + hr = mCompositor->GetDevice()->CreateTexture2D(&desc, &initData, getter_AddRefs(mTileTextures[i])); if (FAILED(hr) || !mTileTextures[i]) { Reset(); return false; @@ -1125,9 +1125,9 @@ DataTextureSourceD3D11::GetShaderResourceView() return nullptr; } - RefPtr device; - mTileTextures[mCurrentTile]->GetDevice(byRef(device)); - HRESULT hr = device->CreateShaderResourceView(mTileTextures[mCurrentTile], nullptr, byRef(mTileSRVs[mCurrentTile])); + nsRefPtr device; + mTileTextures[mCurrentTile]->GetDevice(getter_AddRefs(device)); + HRESULT hr = device->CreateShaderResourceView(mTileTextures[mCurrentTile], nullptr, getter_AddRefs(mTileSRVs[mCurrentTile])); if (FAILED(hr)) { gfxCriticalError(CriticalLog::DefaultOptions(false)) << "[D3D11] DataTextureSourceD3D11:GetShaderResourceView CreateSRV failure " << gfx::hexa(hr); return nullptr; @@ -1181,10 +1181,10 @@ CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTex mTexture = aTexture; - RefPtr device; - mTexture->GetDevice(byRef(device)); + nsRefPtr device; + mTexture->GetDevice(getter_AddRefs(device)); - HRESULT hr = device->CreateRenderTargetView(mTexture, nullptr, byRef(mRTView)); + HRESULT hr = device->CreateRenderTargetView(mTexture, nullptr, getter_AddRefs(mRTView)); if (FAILED(hr)) { LOGD3D11("Failed to create RenderTargetView."); @@ -1236,7 +1236,7 @@ SyncObjectD3D11::FinalizeFrame() if (!mD3D10Texture && mD3D10SyncedTextures.size()) { ID3D10Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D10Device(); - hr = device->OpenSharedResource(mHandle, __uuidof(ID3D10Texture2D), (void**)(ID3D10Texture2D**)byRef(mD3D10Texture)); + hr = device->OpenSharedResource(mHandle, __uuidof(ID3D10Texture2D), (void**)(ID3D10Texture2D**)getter_AddRefs(mD3D10Texture)); if (FAILED(hr) || !mD3D10Texture) { gfxCriticalError() << "Failed to D3D10 OpenSharedResource for frame finalization: " << hexa(hr); @@ -1249,8 +1249,8 @@ SyncObjectD3D11::FinalizeFrame() } // test QI - RefPtr mutex; - hr = mD3D10Texture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + hr = mD3D10Texture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); if (FAILED(hr) || !mutex) { gfxCriticalError() << "Failed to get KeyedMutex: " << hexa(hr); @@ -1261,7 +1261,7 @@ SyncObjectD3D11::FinalizeFrame() if (!mD3D11Texture && mD3D11SyncedTextures.size()) { ID3D11Device* device = gfxWindowsPlatform::GetPlatform()->GetD3D11ContentDevice(); - hr = device->OpenSharedResource(mHandle, __uuidof(ID3D11Texture2D), (void**)(ID3D11Texture2D**)byRef(mD3D11Texture)); + hr = device->OpenSharedResource(mHandle, __uuidof(ID3D11Texture2D), (void**)(ID3D11Texture2D**)getter_AddRefs(mD3D11Texture)); if (FAILED(hr) || !mD3D11Texture) { gfxCriticalError() << "Failed to D3D11 OpenSharedResource for frame finalization: " << hexa(hr); @@ -1274,8 +1274,8 @@ SyncObjectD3D11::FinalizeFrame() } // test QI - RefPtr mutex; - hr = mD3D11Texture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + hr = mD3D11Texture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); if (FAILED(hr) || !mutex) { gfxCriticalError() << "Failed to get KeyedMutex: " << hexa(hr); @@ -1284,8 +1284,8 @@ SyncObjectD3D11::FinalizeFrame() } if (mD3D10SyncedTextures.size()) { - RefPtr mutex; - hr = mD3D10Texture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + hr = mD3D10Texture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); hr = mutex->AcquireSync(0, 20000); if (hr == WAIT_TIMEOUT) { @@ -1312,8 +1312,8 @@ SyncObjectD3D11::FinalizeFrame() } if (mD3D11SyncedTextures.size()) { - RefPtr mutex; - hr = mD3D11Texture->QueryInterface((IDXGIKeyedMutex**)byRef(mutex)); + nsRefPtr mutex; + hr = mD3D11Texture->QueryInterface((IDXGIKeyedMutex**)getter_AddRefs(mutex)); hr = mutex->AcquireSync(0, 20000); if (hr == WAIT_TIMEOUT) { @@ -1337,8 +1337,8 @@ SyncObjectD3D11::FinalizeFrame() MOZ_CRASH(); } - RefPtr ctx; - dev->GetImmediateContext(byRef(ctx)); + nsRefPtr ctx; + dev->GetImmediateContext(getter_AddRefs(ctx)); for (auto iter = mD3D11SyncedTextures.begin(); iter != mD3D11SyncedTextures.end(); iter++) { ctx->CopySubresourceRegion(mD3D11Texture, 0, 0, 0, 0, *iter, 0, &box); diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index b19877ce49b..100178cc34d 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -91,9 +91,9 @@ protected: virtual void FinalizeOnIPDLThread() override; gfx::IntSize mSize; - RefPtr mTexture10; - RefPtr mTexture; - RefPtr mDrawTarget; + nsRefPtr mTexture10; + nsRefPtr mTexture; + nsRefPtr mDrawTarget; gfx::SurfaceFormat mFormat; bool mIsLocked; bool mNeedsClear; @@ -161,7 +161,7 @@ public: private: virtual void FinalizeOnIPDLThread() override; - RefPtr mHoldRefs[3]; + nsRefPtr mHoldRefs[3]; HANDLE mHandles[3]; gfx::IntSize mSize; gfx::IntSize mSizeY; @@ -186,8 +186,8 @@ protected: virtual gfx::IntSize GetSize() const { return mSize; } gfx::IntSize mSize; - RefPtr mTexture; - RefPtr mSRV; + nsRefPtr mTexture; + nsRefPtr mSRV; }; /** @@ -256,9 +256,9 @@ protected: void Reset(); - std::vector< RefPtr > mTileTextures; - std::vector< RefPtr > mTileSRVs; - RefPtr mCompositor; + std::vector< nsRefPtr > mTileTextures; + std::vector< nsRefPtr > mTileSRVs; + nsRefPtr mCompositor; gfx::SurfaceFormat mFormat; TextureFlags mFlags; uint32_t mCurrentTile; @@ -300,9 +300,9 @@ protected: bool OpenSharedHandle(); - RefPtr mTexture; - RefPtr mTextureSource; - RefPtr mCompositor; + nsRefPtr mTexture; + nsRefPtr mTextureSource; + nsRefPtr mCompositor; gfx::IntSize mSize; WindowsHandle mHandle; gfx::SurfaceFormat mFormat; @@ -339,10 +339,10 @@ protected: bool OpenSharedHandle(); - RefPtr mTextures[3]; - RefPtr mTextureSources[3]; + nsRefPtr mTextures[3]; + nsRefPtr mTextureSources[3]; - RefPtr mCompositor; + nsRefPtr mCompositor; gfx::IntSize mSize; WindowsHandle mHandles[3]; bool mIsLocked; @@ -366,7 +366,7 @@ public: private: friend class CompositorD3D11; - RefPtr mRTView; + nsRefPtr mRTView; }; class SyncObjectD3D11 : public SyncObject @@ -381,8 +381,8 @@ public: void RegisterTexture(ID3D10Texture2D* aTexture); private: - RefPtr mD3D11Texture; - RefPtr mD3D10Texture; + nsRefPtr mD3D11Texture; + nsRefPtr mD3D10Texture; std::vector mD3D10SyncedTextures; std::vector mD3D11SyncedTextures; SyncHandle mHandle; diff --git a/gfx/layers/d3d9/CompositorD3D9.cpp b/gfx/layers/d3d9/CompositorD3D9.cpp index ab703aa288e..f6ae7c427d4 100644 --- a/gfx/layers/d3d9/CompositorD3D9.cpp +++ b/gfx/layers/d3d9/CompositorD3D9.cpp @@ -114,10 +114,10 @@ CompositorD3D9::CreateRenderTarget(const gfx::IntRect &aRect, return nullptr; } - RefPtr texture; + nsRefPtr texture; HRESULT hr = device()->CreateTexture(aRect.width, aRect.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, byRef(texture), + D3DPOOL_DEFAULT, getter_AddRefs(texture), nullptr); if (FAILED(hr)) { ReportFailure(NS_LITERAL_CSTRING("CompositorD3D9::CreateRenderTarget: Failed to create texture"), @@ -143,10 +143,10 @@ CompositorD3D9::CreateRenderTargetFromSource(const gfx::IntRect &aRect, return nullptr; } - RefPtr texture; + nsRefPtr texture; HRESULT hr = device()->CreateTexture(aRect.width, aRect.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, - D3DPOOL_DEFAULT, byRef(texture), + D3DPOOL_DEFAULT, getter_AddRefs(texture), nullptr); if (FAILED(hr)) { ReportFailure(NS_LITERAL_CSTRING("CompositorD3D9::CreateRenderTargetFromSource: Failed to create texture"), @@ -198,7 +198,7 @@ void CompositorD3D9::SetRenderTarget(CompositingRenderTarget *aRenderTarget) { MOZ_ASSERT(aRenderTarget && mDeviceManager); - RefPtr oldRT = mCurrentRT; + nsRefPtr oldRT = mCurrentRT; mCurrentRT = static_cast(aRenderTarget); mCurrentRT->BindRenderTarget(device()); PrepareViewport(mCurrentRT->GetSize()); @@ -753,7 +753,7 @@ CompositorD3D9::PaintToTarget() gfxCriticalError() << "Failed to lock rect in paint to target D3D9 " << hexa(hr); return; } - RefPtr sourceSurface = + nsRefPtr sourceSurface = Factory::CreateWrappingDataSourceSurface((uint8_t*)rect.pBits, rect.Pitch, IntSize(desc.Width, desc.Height), diff --git a/gfx/layers/d3d9/CompositorD3D9.h b/gfx/layers/d3d9/CompositorD3D9.h index 53c8bdaefb5..e9f4e638e03 100644 --- a/gfx/layers/d3d9/CompositorD3D9.h +++ b/gfx/layers/d3d9/CompositorD3D9.h @@ -166,8 +166,8 @@ private: /* Widget associated with this layer manager */ nsIWidget *mWidget; - RefPtr mDefaultRT; - RefPtr mCurrentRT; + nsRefPtr mDefaultRT; + nsRefPtr mCurrentRT; gfx::IntSize mSize; diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.cpp b/gfx/layers/d3d9/DeviceManagerD3D9.cpp index adeb7fe49fe..1eaff1ea110 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp +++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp @@ -830,10 +830,10 @@ DeviceManagerD3D9::CreateTexture(const IntSize &aSize, if (mDeviceWasRemoved) { return nullptr; } - RefPtr result; + nsRefPtr result; if (FAILED(device()->CreateTexture(aSize.width, aSize.height, 1, 0, aFormat, aPool, - byRef(result), nullptr))) { + getter_AddRefs(result), nullptr))) { return nullptr; } diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.h b/gfx/layers/d3d9/DeviceManagerD3D9.h index 6b8cb7c5263..ebfc86157df 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.h +++ b/gfx/layers/d3d9/DeviceManagerD3D9.h @@ -11,7 +11,7 @@ #include "d3d9.h" #include "nsTArray.h" #include "mozilla/layers/CompositorTypes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/Rect.h" namespace mozilla { diff --git a/gfx/layers/d3d9/TextureD3D9.cpp b/gfx/layers/d3d9/TextureD3D9.cpp index 004b97520dd..775b7b2a22f 100644 --- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -51,7 +51,7 @@ CreateTextureHostD3D9(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, TextureFlags aFlags) { - RefPtr result; + nsRefPtr result; switch (aDesc.type()) { case SurfaceDescriptor::TSurfaceDescriptorShmem: case SurfaceDescriptor::TSurfaceDescriptorMemory: { @@ -169,13 +169,13 @@ already_AddRefed TextureSourceD3D9::InitTextures(DeviceManagerD3D9* aDeviceManager, const IntSize &aSize, _D3DFORMAT aFormat, - RefPtr& aSurface, + nsRefPtr& aSurface, D3DLOCKED_RECT& aLockedRect) { if (!aDeviceManager) { return nullptr; } - RefPtr result; + nsRefPtr result; // D3D9Ex doesn't support managed textures and we don't want the hassle even // if we don't have Ex. We could use dynamic textures // here but since Images are immutable that probably isn't such a great @@ -185,13 +185,13 @@ TextureSourceD3D9::InitTextures(DeviceManagerD3D9* aDeviceManager, return nullptr; } - RefPtr tmpTexture = + nsRefPtr tmpTexture = aDeviceManager->CreateTexture(aSize, aFormat, D3DPOOL_SYSTEMMEM, this); if (!tmpTexture) { return nullptr; } - tmpTexture->GetSurfaceLevel(0, byRef(aSurface)); + tmpTexture->GetSurfaceLevel(0, getter_AddRefs(aSurface)); HRESULT hr = aSurface->LockRect(&aLockedRect, nullptr, 0); if (FAILED(hr) || !aLockedRect.pBits) { @@ -229,9 +229,9 @@ TextureSourceD3D9::DataToTexture(DeviceManagerD3D9* aDeviceManager, _D3DFORMAT aFormat, uint32_t aBPP) { - RefPtr surface; + nsRefPtr surface; D3DLOCKED_RECT lockedRect; - RefPtr texture = InitTextures(aDeviceManager, aSize, aFormat, + nsRefPtr texture = InitTextures(aDeviceManager, aSize, aFormat, surface, lockedRect); if (!texture) { return nullptr; @@ -260,7 +260,7 @@ TextureSourceD3D9::TextureToTexture(DeviceManagerD3D9* aDeviceManager, return nullptr; } - RefPtr texture = + nsRefPtr texture = aDeviceManager->CreateTexture(aSize, aFormat, D3DPOOL_DEFAULT, this); if (!texture) { return nullptr; @@ -463,7 +463,7 @@ TextureClientD3D9::~TextureClientD3D9() already_AddRefed TextureClientD3D9::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new TextureClientD3D9(mAllocator, mFormat, + nsRefPtr tex = new TextureClientD3D9(mAllocator, mFormat, mFlags | aFlags); if (!tex->AllocateForSurface(mSize, aAllocFlags)) { @@ -607,7 +607,7 @@ TextureClientD3D9::UpdateFromSurface(gfx::SourceSurface* aSurface) return; } - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface."; @@ -693,7 +693,7 @@ SharedTextureClientD3D9::Create(ISurfaceAllocator* aAllocator, { MOZ_ASSERT(aFormat == gfx::SurfaceFormat::B8G8R8X8); - RefPtr texture; + nsRefPtr texture; HANDLE shareHandle = nullptr; HRESULT hr = aDevice->CreateTexture(aSize.width, aSize.height, @@ -701,11 +701,11 @@ SharedTextureClientD3D9::Create(ISurfaceAllocator* aAllocator, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, - byRef(texture), + getter_AddRefs(texture), &shareHandle); NS_ENSURE_TRUE(SUCCEEDED(hr) && shareHandle, nullptr); - RefPtr client = + nsRefPtr client = new SharedTextureClientD3D9(aAllocator, aFormat, aFlags); @@ -722,8 +722,8 @@ SharedTextureClientD3D9::Create(ISurfaceAllocator* aAllocator, already_AddRefed SharedTextureClientD3D9::GetD3D9Surface() const { - RefPtr textureSurface; - HRESULT hr = mTexture->GetSurfaceLevel(0, byRef(textureSurface)); + nsRefPtr textureSurface; + HRESULT hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(textureSurface)); NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr); return textureSurface.forget(); @@ -810,14 +810,14 @@ DataTextureSourceD3D9::UpdateFromTexture(IDirect3DTexture9* aTexture, } } - RefPtr srcSurface; - RefPtr dstSurface; + nsRefPtr srcSurface; + nsRefPtr dstSurface; - hr = aTexture->GetSurfaceLevel(0, byRef(srcSurface)); + hr = aTexture->GetSurfaceLevel(0, getter_AddRefs(srcSurface)); if (FAILED(hr)) { return false; } - hr = mTexture->GetSurfaceLevel(0, byRef(dstSurface)); + hr = mTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface)); if (FAILED(hr)) { return false; } @@ -1052,19 +1052,19 @@ DXGIYCbCrTextureHostD3D9::Lock() if (FAILED(GetDevice()->CreateTexture(mSizeY.width, mSizeY.height, 1, 0, D3DFMT_A8, D3DPOOL_DEFAULT, - byRef(mTextures[0]), &mHandles[0]))) { + getter_AddRefs(mTextures[0]), &mHandles[0]))) { return false; } if (FAILED(GetDevice()->CreateTexture(mSizeCbCr.width, mSizeCbCr.height, 1, 0, D3DFMT_A8, D3DPOOL_DEFAULT, - byRef(mTextures[1]), &mHandles[1]))) { + getter_AddRefs(mTextures[1]), &mHandles[1]))) { return false; } if (FAILED(GetDevice()->CreateTexture(mSizeCbCr.width, mSizeCbCr.height, 1, 0, D3DFMT_A8, D3DPOOL_DEFAULT, - byRef(mTextures[2]), &mHandles[2]))) { + getter_AddRefs(mTextures[2]), &mHandles[2]))) { return false; } diff --git a/gfx/layers/d3d9/TextureD3D9.h b/gfx/layers/d3d9/TextureD3D9.h index 5708775af9d..c7262e243a4 100644 --- a/gfx/layers/d3d9/TextureD3D9.h +++ b/gfx/layers/d3d9/TextureD3D9.h @@ -57,7 +57,7 @@ protected: DeviceManagerD3D9* aDeviceManager, const gfx::IntSize &aSize, _D3DFORMAT aFormat, - RefPtr& aSurface, + nsRefPtr& aSurface, D3DLOCKED_RECT& aLockedRect); already_AddRefed DataToTexture( @@ -85,7 +85,7 @@ protected: DeviceManagerD3D9* mCreatingDeviceManager; StereoMode mStereoMode; - RefPtr mTexture; + nsRefPtr mTexture; }; /** @@ -161,8 +161,8 @@ protected: void Reset(); - std::vector< RefPtr > mTileTextures; - RefPtr mCompositor; + std::vector< nsRefPtr > mTileTextures; + nsRefPtr mCompositor; gfx::SurfaceFormat mFormat; uint32_t mCurrentTile; TextureFlags mFlags; @@ -214,9 +214,9 @@ public: TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override; private: - RefPtr mTexture; + nsRefPtr mTexture; nsRefPtr mD3D9Surface; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; gfx::IntSize mSize; gfx::SurfaceFormat mFormat; bool mIsLocked; @@ -287,8 +287,8 @@ public: private: virtual void FinalizeOnIPDLThread() override; - RefPtr mDevice; - RefPtr mTexture; + nsRefPtr mDevice; + nsRefPtr mTexture; gfx::SurfaceFormat mFormat; HANDLE mHandle; D3DSURFACE_DESC mDesc; @@ -328,9 +328,9 @@ protected: virtual void UpdatedInternal(const nsIntRegion* aRegion) override; - RefPtr mTextureSource; - RefPtr mTexture; - RefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mTexture; + nsRefPtr mCompositor; gfx::IntSize mSize; gfx::SurfaceFormat mFormat; bool mIsLocked; @@ -365,8 +365,8 @@ protected: void OpenSharedHandle(); IDirect3DDevice9* GetDevice(); - RefPtr mTextureSource; - RefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mCompositor; WindowsHandle mHandle; gfx::SurfaceFormat mFormat; gfx::IntSize mSize; @@ -400,10 +400,10 @@ public: IDirect3DDevice9* GetDevice(); HANDLE mHandles[3]; - RefPtr mTextures[3]; - RefPtr mTextureSources[3]; + nsRefPtr mTextures[3]; + nsRefPtr mTextureSources[3]; - RefPtr mCompositor; + nsRefPtr mCompositor; gfx::IntSize mSize; gfx::IntSize mSizeY; gfx::IntSize mSizeCbCr; diff --git a/gfx/layers/ipc/AsyncTransactionTracker.cpp b/gfx/layers/ipc/AsyncTransactionTracker.cpp index 9cb8fd52966..a777a43a08b 100755 --- a/gfx/layers/ipc/AsyncTransactionTracker.cpp +++ b/gfx/layers/ipc/AsyncTransactionTracker.cpp @@ -138,7 +138,7 @@ AsyncTransactionTrackersHolder::TransactionCompleteted(uint64_t aTransactionId) void AsyncTransactionTrackersHolder::TransactionCompletetedInternal(uint64_t aTransactionId) { - std::map >::iterator it + std::map >::iterator it = mAsyncTransactionTrackers.find(aTransactionId); if (it != mAsyncTransactionTrackers.end()) { it->second->NotifyComplete(); @@ -150,7 +150,7 @@ void AsyncTransactionTrackersHolder::SetReleaseFenceHandle(FenceHandle& aReleaseFenceHandle, uint64_t aTransactionId) { - std::map >::iterator it + std::map >::iterator it = mAsyncTransactionTrackers.find(aTransactionId); if (it != mAsyncTransactionTrackers.end()) { it->second->SetReleaseFenceHandle(aReleaseFenceHandle); @@ -187,7 +187,7 @@ AsyncTransactionTrackersHolder::ClearAllAsyncTransactionTrackers() if (sHolderLock) { sHolderLock->Lock(); } - std::map >::iterator it; + std::map >::iterator it; for (it = mAsyncTransactionTrackers.begin(); it != mAsyncTransactionTrackers.end(); it++) { it->second->NotifyCancel(); diff --git a/gfx/layers/ipc/AsyncTransactionTracker.h b/gfx/layers/ipc/AsyncTransactionTracker.h index 67ce8617761..ffcc509f6ba 100644 --- a/gfx/layers/ipc/AsyncTransactionTracker.h +++ b/gfx/layers/ipc/AsyncTransactionTracker.h @@ -13,7 +13,7 @@ #include "mozilla/Atomics.h" #include "mozilla/layers/FenceUtils.h" // for FenceHandle #include "mozilla/Monitor.h" // for Monitor -#include "mozilla/RefPtr.h" // for AtomicRefCounted +#include "mozilla/nsRefPtr.h" // for AtomicRefCounted namespace mozilla { namespace layers { @@ -130,7 +130,7 @@ protected: } uint64_t mSerial; - RefPtr mWaiter; + nsRefPtr mWaiter; DebugOnly mCompleted; /** @@ -200,7 +200,7 @@ protected: uint64_t mSerial; bool mIsTrackersHolderDestroyed; - std::map > mAsyncTransactionTrackers; + std::map > mAsyncTransactionTrackers; /** * gecko does not provide atomic operation for uint64_t. diff --git a/gfx/layers/ipc/CompositableForwarder.h b/gfx/layers/ipc/CompositableForwarder.h index d015bbb216f..0a8edbefe5b 100644 --- a/gfx/layers/ipc/CompositableForwarder.h +++ b/gfx/layers/ipc/CompositableForwarder.h @@ -195,8 +195,8 @@ public: protected: TextureFactoryIdentifier mTextureFactoryIdentifier; - nsTArray > mTexturesToRemove; - RefPtr mSyncObject; + nsTArray > mTexturesToRemove; + nsRefPtr mSyncObject; const int32_t mSerial; static mozilla::Atomic sSerialCounter; }; diff --git a/gfx/layers/ipc/CompositableTransactionParent.cpp b/gfx/layers/ipc/CompositableTransactionParent.cpp index 3060a8c00c0..6533614e8c0 100644 --- a/gfx/layers/ipc/CompositableTransactionParent.cpp +++ b/gfx/layers/ipc/CompositableTransactionParent.cpp @@ -12,7 +12,7 @@ #include "Layers.h" // for Layer #include "RenderTrace.h" // for RenderTraceInvalidateEnd, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/CompositorTypes.h" #include "mozilla/layers/ContentHost.h" // for ContentHostBase #include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent @@ -128,7 +128,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation case CompositableOperation::TOpRemoveTexture: { const OpRemoveTexture& op = aEdit.get_OpRemoveTexture(); CompositableHost* compositable = AsCompositable(op); - RefPtr tex = TextureHost::AsTextureHost(op.textureParent()); + nsRefPtr tex = TextureHost::AsTextureHost(op.textureParent()); MOZ_ASSERT(tex.get()); compositable->RemoveTextureHost(tex); @@ -139,7 +139,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation case CompositableOperation::TOpRemoveTextureAsync: { const OpRemoveTextureAsync& op = aEdit.get_OpRemoveTextureAsync(); CompositableHost* compositable = AsCompositable(op); - RefPtr tex = TextureHost::AsTextureHost(op.textureParent()); + nsRefPtr tex = TextureHost::AsTextureHost(op.textureParent()); MOZ_ASSERT(tex.get()); compositable->RemoveTextureHost(tex); @@ -202,8 +202,8 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation case CompositableOperation::TOpUseComponentAlphaTextures: { const OpUseComponentAlphaTextures& op = aEdit.get_OpUseComponentAlphaTextures(); CompositableHost* compositable = AsCompositable(op); - RefPtr texOnBlack = TextureHost::AsTextureHost(op.textureOnBlackParent()); - RefPtr texOnWhite = TextureHost::AsTextureHost(op.textureOnWhiteParent()); + nsRefPtr texOnBlack = TextureHost::AsTextureHost(op.textureOnBlackParent()); + nsRefPtr texOnWhite = TextureHost::AsTextureHost(op.textureOnWhiteParent()); MOZ_ASSERT(texOnBlack && texOnWhite); compositable->UseComponentAlphaTextures(texOnBlack, texOnWhite); diff --git a/gfx/layers/ipc/CompositorBench.cpp b/gfx/layers/ipc/CompositorBench.cpp index 5b9e61c2516..0fbd4f6d9f1 100644 --- a/gfx/layers/ipc/CompositorBench.cpp +++ b/gfx/layers/ipc/CompositorBench.cpp @@ -160,8 +160,8 @@ public: {} uint32_t* mBuf; - RefPtr mSurface; - RefPtr mTexture; + nsRefPtr mSurface; + nsRefPtr mTexture; virtual void Setup(Compositor* aCompositor, size_t aStep) { int bytesPerPixel = 4; @@ -194,8 +194,8 @@ public: {} uint32_t* mBuf; - RefPtr mSurface; - RefPtr mTexture; + nsRefPtr mSurface; + nsRefPtr mTexture; virtual void Setup(Compositor* aCompositor, size_t aStep) { int bytesPerPixel = 4; @@ -237,8 +237,8 @@ public: {} uint32_t* mBuf; - RefPtr mSurface; - RefPtr mTexture; + nsRefPtr mSurface; + nsRefPtr mTexture; virtual void Setup(Compositor* aCompositor, size_t aStep) { int bytesPerPixel = 4; @@ -282,7 +282,7 @@ public: uint32_t* mBuf; android::sp mGralloc; - RefPtr mTexture; + nsRefPtr mTexture; virtual void Setup(Compositor* aCompositor, size_t aStep) { mBuf = nullptr; @@ -323,7 +323,7 @@ public: uint32_t* mBuf; android::sp mGralloc; - RefPtr mTexture; + nsRefPtr mTexture; virtual void Setup(Compositor* aCompositor, size_t aStep) { mBuf = nullptr; diff --git a/gfx/layers/ipc/CompositorChild.cpp b/gfx/layers/ipc/CompositorChild.cpp index 60c4bb7aa7c..7a0ab5576af 100644 --- a/gfx/layers/ipc/CompositorChild.cpp +++ b/gfx/layers/ipc/CompositorChild.cpp @@ -95,7 +95,7 @@ CompositorChild::Destroy() nsAutoTArray transactions; ManagedPLayerTransactionChild(transactions); for (int i = transactions.Length() - 1; i >= 0; --i) { - RefPtr layers = + nsRefPtr layers = static_cast(transactions[i]); layers->Destroy(); } diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index b4ac44acb96..93f07817adf 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -710,7 +710,7 @@ bool CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, const gfx::IntRect& aRect) { - RefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); + nsRefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); ForceComposeToTarget(target, &aRect); return true; } @@ -722,7 +722,7 @@ CompositorParent::RecvMakeWidgetSnapshot(const SurfaceDescriptor& aInSnapshot) return false; } - RefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); + nsRefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); mCompositor->GetWidget()->CaptureWidgetOnScreen(target); return true; } @@ -1419,7 +1419,7 @@ CompositorParent::InitializeLayerManager(const nsTArray& aBackend NS_ASSERTION(!mCompositor, "Already initialised mCompositor"); for (size_t i = 0; i < aBackendHints.Length(); ++i) { - RefPtr compositor; + nsRefPtr compositor; if (aBackendHints[i] == LayersBackend::LAYERS_OPENGL) { compositor = new CompositorOGL(mWidget, mEGLSurfaceSize.width, @@ -1449,7 +1449,7 @@ CompositorParent::InitializeLayerManager(const nsTArray& aBackend } compositor->SetCompositorID(mCompositorID); - RefPtr layerManager = new LayerManagerComposite(compositor); + nsRefPtr layerManager = new LayerManagerComposite(compositor); if (layerManager->Initialize()) { mLayerManager = layerManager; diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 69649ebcbfb..b0b710876f1 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -23,7 +23,7 @@ #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 #include "mozilla/Attributes.h" // for override #include "mozilla/Monitor.h" // for Monitor -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/TimeStamp.h" // for TimeStamp #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/ipc/ProtocolUtils.h" @@ -458,7 +458,7 @@ protected: nsRefPtr mLayerManager; nsRefPtr mCompositor; - RefPtr mCompositionManager; + nsRefPtr mCompositionManager; nsIWidget* mWidget; TimeStamp mTestTime; bool mIsTesting; diff --git a/gfx/layers/ipc/ISurfaceAllocator.h b/gfx/layers/ipc/ISurfaceAllocator.h index b76f7df8053..0758246bf60 100644 --- a/gfx/layers/ipc/ISurfaceAllocator.h +++ b/gfx/layers/ipc/ISurfaceAllocator.h @@ -11,7 +11,7 @@ #include "gfxTypes.h" #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsIMemoryReporter.h" // for nsIMemoryReporter #include "mozilla/Atomics.h" // for Atomic #include "mozilla/layers/LayersMessages.h" // for ShmemSection diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index f54b1fd6b93..b701426eaa4 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -194,7 +194,7 @@ static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone) InfallibleTArray textures; sImageBridgeChildSingleton->ManagedPTextureChild(textures); for (int i = textures.Length() - 1; i >= 0; --i) { - RefPtr client = TextureClient::AsTextureClient(textures[i]); + nsRefPtr client = TextureClient::AsTextureClient(textures[i]); if (client) { client->ForceRemove(); } @@ -224,7 +224,7 @@ static void ImageBridgeShutdownStep2(ReentrantMonitor *aBarrier, bool *aDone) } // dispatched function -static void CreateImageClientSync(RefPtr* result, +static void CreateImageClientSync(nsRefPtr* result, ReentrantMonitor* barrier, CompositableType aType, ImageContainer* aImageContainer, @@ -241,7 +241,7 @@ static void CreateImageClientSync(RefPtr* result, static void CreateCanvasClientSync(ReentrantMonitor* aBarrier, CanvasClient::CanvasClientType aType, TextureFlags aFlags, - RefPtr* const outResult, + nsRefPtr* const outResult, bool* aDone) { ReentrantMonitorAutoEnter autoMon(*aBarrier); @@ -583,7 +583,7 @@ void ImageBridgeChild::FlushAllImages(ImageClient* aClient, return; } - RefPtr waiter = new AsyncTransactionWaiter(); + nsRefPtr waiter = new AsyncTransactionWaiter(); // This increment is balanced by the decrement in FlushAllImagesSync waiter->IncrementWaitCount(); @@ -795,7 +795,7 @@ ImageBridgeChild::CreateImageClient(CompositableType aType, ReentrantMonitorAutoEnter autoMon(barrier); bool done = false; - RefPtr result = nullptr; + nsRefPtr result = nullptr; GetMessageLoop()->PostTask(FROM_HERE, NewRunnableFunction(&CreateImageClientSync, &result, &barrier, aType, aImageContainer, &done)); @@ -815,7 +815,7 @@ ImageBridgeChild::CreateImageClientNow(CompositableType aType, if (aImageContainer) { SendPImageContainerConstructor(aImageContainer->GetPImageContainerChild()); } - RefPtr client + nsRefPtr client = ImageClient::CreateImageClient(aType, this, TextureFlags::NO_FLAGS); MOZ_ASSERT(client, "failed to create ImageClient"); if (client) { @@ -835,7 +835,7 @@ ImageBridgeChild::CreateCanvasClient(CanvasClient::CanvasClientType aType, ReentrantMonitorAutoEnter autoMon(barrier); bool done = false; - RefPtr result = nullptr; + nsRefPtr result = nullptr; GetMessageLoop()->PostTask(FROM_HERE, NewRunnableFunction(&CreateCanvasClientSync, &barrier, aType, aFlag, &result, &done)); @@ -851,7 +851,7 @@ already_AddRefed ImageBridgeChild::CreateCanvasClientNow(CanvasClient::CanvasClientType aType, TextureFlags aFlag) { - RefPtr client + nsRefPtr client = CanvasClient::CreateCanvasClient(aType, this, aFlag); MOZ_ASSERT(client, "failed to create CanvasClient"); if (client) { @@ -889,7 +889,7 @@ ImageBridgeChild::AllocShmem(size_t aSize, // NewRunnableFunction accepts a limited number of parameters so we need a // struct here struct AllocShmemParams { - RefPtr mAllocator; + nsRefPtr mAllocator; size_t mSize; ipc::SharedMemory::SharedMemoryType mType; ipc::Shmem* mShmem; @@ -1040,7 +1040,7 @@ ImageBridgeChild::RecvParentAsyncMessages(InfallibleTArray texture = TextureClient::AsTextureClient(child); + nsRefPtr texture = TextureClient::AsTextureClient(child); if (texture) { texture->SetReleaseFenceHandle(fence); } diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index 4f834b7c782..f2a37bac08b 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -9,7 +9,7 @@ #include // for size_t #include // for uint32_t, uint64_t #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for already_AddRefed +#include "mozilla/nsRefPtr.h" // for already_AddRefed #include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc #include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTrackerHolder #include "mozilla/layers/CanvasClient.h" diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index 6850a5cacec..b22ff1d3633 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -192,7 +192,7 @@ bool ImageBridgeParent::RecvWillStop() InfallibleTArray textures; ManagedPTextureParent(textures); for (unsigned int i = 0; i < textures.Length(); ++i) { - RefPtr tex = TextureHost::AsTextureHost(textures[i]); + nsRefPtr tex = TextureHost::AsTextureHost(textures[i]); tex->DeallocateDeviceData(); } return true; @@ -409,7 +409,7 @@ void ImageBridgeParent::SendFenceHandleIfPresent(PTextureParent* aTexture, CompositableHost* aCompositableHost) { - RefPtr texture = TextureHost::AsTextureHost(aTexture); + nsRefPtr texture = TextureHost::AsTextureHost(aTexture); if (!texture) { return; } @@ -437,7 +437,7 @@ ImageBridgeParent::AppendDeliverFenceMessage(uint64_t aDestHolderId, PTextureParent* aTexture, CompositableHost* aCompositableHost) { - RefPtr texture = TextureHost::AsTextureHost(aTexture); + nsRefPtr texture = TextureHost::AsTextureHost(aTexture); if (!texture) { return; } diff --git a/gfx/layers/ipc/LayerTransactionChild.cpp b/gfx/layers/ipc/LayerTransactionChild.cpp index 1e456c4a22d..4d6196ff224 100644 --- a/gfx/layers/ipc/LayerTransactionChild.cpp +++ b/gfx/layers/ipc/LayerTransactionChild.cpp @@ -88,7 +88,7 @@ LayerTransactionChild::RecvParentAsyncMessages(InfallibleTArray texture = TextureClient::AsTextureClient(child); + nsRefPtr texture = TextureClient::AsTextureClient(child); if (texture) { texture->SetReleaseFenceHandle(fence); } diff --git a/gfx/layers/ipc/LayerTransactionChild.h b/gfx/layers/ipc/LayerTransactionChild.h index 765f9d73a87..25ec946005e 100644 --- a/gfx/layers/ipc/LayerTransactionChild.h +++ b/gfx/layers/ipc/LayerTransactionChild.h @@ -13,7 +13,7 @@ #include "mozilla/ipc/ProtocolUtils.h" #include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTracker #include "mozilla/layers/PLayerTransactionChild.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index eee59ae7f3f..c2d68597797 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -944,7 +944,7 @@ LayerTransactionParent::RecvChildAsyncMessages(InfallibleTArray tex = TextureHost::AsTextureHost(op.textureParent()); + nsRefPtr tex = TextureHost::AsTextureHost(op.textureParent()); MOZ_ASSERT(tex.get()); compositable->RemoveTextureHost(tex); @@ -990,7 +990,7 @@ void LayerTransactionParent::SendFenceHandleIfPresent(PTextureParent* aTexture, CompositableHost* aCompositableHost) { - RefPtr texture = TextureHost::AsTextureHost(aTexture); + nsRefPtr texture = TextureHost::AsTextureHost(aTexture); if (!texture) { return; } diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index f8956905fd5..6a1e9d224db 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -360,7 +360,7 @@ protected: bool InWorkerThread(); - RefPtr mShadowManager; + nsRefPtr mShadowManager; private: diff --git a/gfx/layers/ipc/SharedPlanarYCbCrImage.h b/gfx/layers/ipc/SharedPlanarYCbCrImage.h index b8b4162c731..e8ad12575b1 100644 --- a/gfx/layers/ipc/SharedPlanarYCbCrImage.h +++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.h @@ -6,7 +6,7 @@ #include // for uint8_t, uint32_t #include "ImageContainer.h" // for PlanarYCbCrImage, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/ipc/Shmem.h" // for Shmem #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_WARNING @@ -54,8 +54,8 @@ public: virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override; private: - RefPtr mTextureClient; - RefPtr mCompositable; + nsRefPtr mTextureClient; + nsRefPtr mCompositable; }; } // namespace layers diff --git a/gfx/layers/ipc/SharedRGBImage.h b/gfx/layers/ipc/SharedRGBImage.h index 9bb0b03f258..b154e3ed9aa 100644 --- a/gfx/layers/ipc/SharedRGBImage.h +++ b/gfx/layers/ipc/SharedRGBImage.h @@ -10,7 +10,7 @@ #include "ImageContainer.h" // for ISharedImage, Image, etc #include "gfxTypes.h" #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat #include "nsCOMPtr.h" // for already_AddRefed @@ -52,8 +52,8 @@ public: bool Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat); private: gfx::IntSize mSize; - RefPtr mCompositable; - RefPtr mTextureClient; + nsRefPtr mCompositable; + nsRefPtr mTextureClient; }; } // namespace layers diff --git a/gfx/layers/opengl/CompositingRenderTargetOGL.h b/gfx/layers/opengl/CompositingRenderTargetOGL.h index 3b6b055c522..fed8a69695f 100644 --- a/gfx/layers/opengl/CompositingRenderTargetOGL.h +++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h @@ -10,7 +10,7 @@ #include "GLDefs.h" // for GLenum, LOCAL_GL_FRAMEBUFFER, etc #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed +#include "mozilla/nsRefPtr.h" // for RefPtr, already_AddRefed #include "mozilla/gfx/Point.h" // for IntSize, IntSizeTyped #include "mozilla/gfx/Types.h" // for SurfaceFormat, etc #include "mozilla/layers/Compositor.h" // for SurfaceInitMode, etc @@ -85,7 +85,7 @@ public: RenderTargetForWindow(CompositorOGL* aCompositor, const gfx::IntSize& aSize) { - RefPtr result + nsRefPtr result = new CompositingRenderTargetOGL(aCompositor, gfx::IntPoint(), 0, 0); result->mInitParams = InitParams(aSize, 0, INIT_MODE_NONE); result->mInitParams.mStatus = InitParams::INITIALIZED; @@ -168,7 +168,7 @@ private: * each having a strong ref to the other. The compositor's reference to * the target is always cleared at the end of a frame. */ - RefPtr mCompositor; + nsRefPtr mCompositor; GLContext* mGL; GLuint mTextureHandle; GLuint mFBO; diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index b7e4d9c5cbc..362d33dfb45 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -244,7 +244,7 @@ CompositorOGL::Initialize() mGLContext->fEnable(LOCAL_GL_BLEND); // initialise a common shader to check that we can actually compile a shader - RefPtr effect = new EffectSolidColor(Color(0, 0, 0, 0)); + nsRefPtr effect = new EffectSolidColor(Color(0, 0, 0, 0)); ShaderConfigOGL config = GetShaderConfigFor(effect); if (!GetShaderProgramFor(config)) { return false; @@ -504,7 +504,7 @@ CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit) GLuint tex = 0; GLuint fbo = 0; CreateFBOWithTexture(aRect, false, 0, &fbo, &tex); - RefPtr surface + nsRefPtr surface = new CompositingRenderTargetOGL(this, aRect.TopLeft(), tex, fbo); surface->Initialize(aRect.Size(), mFBOTextureTarget, aInit); return surface.forget(); @@ -534,7 +534,7 @@ CompositorOGL::CreateRenderTargetFromSource(const IntRect &aRect, &fbo, &tex); } - RefPtr surface + nsRefPtr surface = new CompositingRenderTargetOGL(this, aRect.TopLeft(), tex, fbo); surface->Initialize(aRect.Size(), mFBOTextureTarget, @@ -673,7 +673,7 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion, mGLContext->fScissor(0, 0, viewportSize.width, viewportSize.height); } - RefPtr rt = + nsRefPtr rt = CompositingRenderTargetOGL::RenderTargetForWindow(this, viewportSize); SetRenderTarget(rt); @@ -1281,7 +1281,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, case EffectTypes::RENDER_TARGET: { EffectRenderTarget* effectRenderTarget = static_cast(aEffectChain.mPrimaryEffect.get()); - RefPtr surface + nsRefPtr surface = static_cast(effectRenderTarget->mRenderTarget.get()); surface->BindTexture(LOCAL_GL_TEXTURE0, mFBOTextureTarget); @@ -1402,7 +1402,7 @@ CompositorOGL::EndFrame() } else { mWidget->GetBounds(rect); } - RefPtr target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(rect.width, rect.height), SurfaceFormat::B8G8R8A8); + nsRefPtr target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(IntSize(rect.width, rect.height), SurfaceFormat::B8G8R8A8); if (target) { CopyToTarget(target, nsIntPoint(), Matrix()); WriteSnapshotToDumpFile(this, target); @@ -1473,7 +1473,7 @@ CompositorOGL::SetDispAcquireFence(Layer* aLayer, nsIWidget* aWidget) return; } nsWindow* window = static_cast(aWidget); - RefPtr fence = new FenceHandle::FdObj( + nsRefPtr fence = new FenceHandle::FdObj( window->GetScreen()->GetPrevDispAcquireFd()); mReleaseFenceHandle.Merge(FenceHandle(fence)); } @@ -1549,7 +1549,7 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con mGLContext->fReadBuffer(LOCAL_GL_BACK); } - RefPtr source = + nsRefPtr source = Factory::CreateDataSourceSurface(rect.Size(), gfx::SurfaceFormat::B8G8R8A8); if (NS_WARN_IF(!source)) { return; diff --git a/gfx/layers/opengl/CompositorOGL.h b/gfx/layers/opengl/CompositorOGL.h index 6d385d412e1..693da51f34e 100644 --- a/gfx/layers/opengl/CompositorOGL.h +++ b/gfx/layers/opengl/CompositorOGL.h @@ -14,7 +14,7 @@ #include "Units.h" // for ScreenPoint #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override, final -#include "mozilla/RefPtr.h" // for already_AddRefed, RefPtr +#include "mozilla/nsRefPtr.h" // for already_AddRefed, RefPtr #include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/BaseSize.h" // for BaseSize #include "mozilla/gfx/Point.h" // for IntSize, Point @@ -106,7 +106,7 @@ protected: GLenum mTextureTarget; nsTArray mTextures; - RefPtr mGL; + nsRefPtr mGL; }; /** @@ -144,7 +144,7 @@ protected: void DestroyTextures(); GLenum mTextureTarget; - RefPtr mGL; + nsRefPtr mGL; nsTArray mCreatedTextures; nsTArray mUnusedTextures; }; @@ -344,7 +344,7 @@ private: GLenum mFBOTextureTarget; /** Currently bound render target */ - RefPtr mCurrentRenderTarget; + nsRefPtr mCurrentRenderTarget; #ifdef DEBUG CompositingRenderTargetOGL* mWindowRenderTarget; #endif @@ -440,7 +440,7 @@ private: */ GLint FlipY(GLint y) const { return mViewportSize.height - y; } - RefPtr mTexturePool; + nsRefPtr mTexturePool; ContextStateTrackerOGL mContextStateTracker; diff --git a/gfx/layers/opengl/CompositorOGLVR.cpp b/gfx/layers/opengl/CompositorOGLVR.cpp index c11a6d31d1f..774828502e5 100644 --- a/gfx/layers/opengl/CompositorOGLVR.cpp +++ b/gfx/layers/opengl/CompositorOGLVR.cpp @@ -225,7 +225,7 @@ CompositorOGL::DrawVRDistortion(const gfx::Rect& aRect, if (vrEffect->mRenderTarget) textureTarget = mFBOTextureTarget; - RefPtr surface = + nsRefPtr surface = static_cast(vrEffect->mRenderTarget.get()); VRHMDInfo* hmdInfo = vrEffect->mHMD; diff --git a/gfx/layers/opengl/GLManager.cpp b/gfx/layers/opengl/GLManager.cpp index 233128ef0b9..9063f7b2e4d 100644 --- a/gfx/layers/opengl/GLManager.cpp +++ b/gfx/layers/opengl/GLManager.cpp @@ -8,7 +8,7 @@ #include "GLContext.h" // for GLContext #include "mozilla/Assertions.h" // for MOZ_CRASH #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/LayersTypes.h" @@ -56,7 +56,7 @@ public: } private: - RefPtr mImpl; + nsRefPtr mImpl; }; /* static */ GLManager* diff --git a/gfx/layers/opengl/GrallocTextureClient.cpp b/gfx/layers/opengl/GrallocTextureClient.cpp index 5e6b5195c40..c11ba2fd7c9 100644 --- a/gfx/layers/opengl/GrallocTextureClient.cpp +++ b/gfx/layers/opengl/GrallocTextureClient.cpp @@ -52,7 +52,7 @@ already_AddRefed GrallocTextureClientOGL::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const { - RefPtr tex = new GrallocTextureClientOGL( + nsRefPtr tex = new GrallocTextureClientOGL( mAllocator, mFormat, mBackend, mFlags | aFlags ); @@ -224,7 +224,7 @@ GrallocTextureClientOGL::UpdateFromSurface(gfx::SourceSurface* aSurface) return; } - RefPtr srcSurf = aSurface->GetDataSurface(); + nsRefPtr srcSurf = aSurface->GetDataSurface(); if (!srcSurf) { gfxCriticalError() << "Failed to GetDataSurface in UpdateFromSurface."; @@ -401,7 +401,7 @@ GrallocTextureClientOGL::FromSharedSurface(gl::SharedSurface* abstractSurf, { auto surf = gl::SharedSurface_Gralloc::Cast(abstractSurf); - RefPtr ret = surf->GetTextureClient(); + nsRefPtr ret = surf->GetTextureClient(); TextureFlags mask = TextureFlags::ORIGIN_BOTTOM_LEFT | TextureFlags::RB_SWAPPED | diff --git a/gfx/layers/opengl/GrallocTextureClient.h b/gfx/layers/opengl/GrallocTextureClient.h index 2c5ae47bc64..cc82750a553 100644 --- a/gfx/layers/opengl/GrallocTextureClient.h +++ b/gfx/layers/opengl/GrallocTextureClient.h @@ -129,7 +129,7 @@ protected: */ MaybeMagicGrallocBufferHandle mGrallocHandle; - RefPtr mRemoveFromCompositableWaiter; + nsRefPtr mRemoveFromCompositableWaiter; android::sp mGraphicBuffer; @@ -139,7 +139,7 @@ protected: */ uint8_t* mMappedBuffer; - RefPtr mDrawTarget; + nsRefPtr mDrawTarget; android::MediaBuffer* mMediaBuffer; diff --git a/gfx/layers/opengl/GrallocTextureHost.cpp b/gfx/layers/opengl/GrallocTextureHost.cpp index 3909472d279..83dcc5805f9 100644 --- a/gfx/layers/opengl/GrallocTextureHost.cpp +++ b/gfx/layers/opengl/GrallocTextureHost.cpp @@ -242,7 +242,7 @@ GrallocTextureHostOGL::GetAsSurface() { if (rv) { return nullptr; } - RefPtr grallocTempSurf = + nsRefPtr grallocTempSurf = gfx::Factory::CreateWrappingDataSourceSurface(grallocData, graphicBuffer->getStride() * android::bytesPerPixel(graphicBuffer->getPixelFormat()), GetSize(), GetFormat()); @@ -250,7 +250,7 @@ GrallocTextureHostOGL::GetAsSurface() { graphicBuffer->unlock(); return nullptr; } - RefPtr surf = CreateDataSourceSurfaceByCloning(grallocTempSurf); + nsRefPtr surf = CreateDataSourceSurfaceByCloning(grallocTempSurf); graphicBuffer->unlock(); diff --git a/gfx/layers/opengl/GrallocTextureHost.h b/gfx/layers/opengl/GrallocTextureHost.h index a258a1e427f..ed4ba0168e5 100644 --- a/gfx/layers/opengl/GrallocTextureHost.h +++ b/gfx/layers/opengl/GrallocTextureHost.h @@ -64,8 +64,8 @@ private: void DestroyEGLImage(); NewSurfaceDescriptorGralloc mGrallocHandle; - RefPtr mGLTextureSource; - RefPtr mCompositor; + nsRefPtr mGLTextureSource; + nsRefPtr mCompositor; // Size reported by the GraphicBuffer gfx::IntSize mSize; // Size reported by TextureClient, can be different in some cases (video?), diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp index fbefd06c8f6..5f26a2adfaa 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp @@ -33,7 +33,7 @@ MacIOSurfaceTextureClientOGL::Create(ISurfaceAllocator* aAllocator, TextureFlags aFlags, MacIOSurface* aSurface) { - RefPtr texture = + nsRefPtr texture = new MacIOSurfaceTextureClientOGL(aAllocator, aFlags); MOZ_ASSERT(texture->IsValid()); MOZ_ASSERT(!texture->IsAllocated()); @@ -84,7 +84,7 @@ MacIOSurfaceTextureClientOGL::GetSize() const already_AddRefed MacIOSurfaceTextureClientOGL::GetAsSurface() { - RefPtr surf = mSurface->GetAsSurface(); + nsRefPtr surf = mSurface->GetAsSurface(); return surf->GetDataSurface(); } diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h index 7548beeafdc..fe855de9700 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h @@ -52,7 +52,7 @@ public: protected: virtual void FinalizeOnIPDLThread() override; - RefPtr mSurface; + nsRefPtr mSurface; bool mIsLocked; }; diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp index bea27ebd176..0057ec3456c 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp @@ -55,9 +55,9 @@ MacIOSurfaceTextureHostOGL::Lock() if (!mTextureSource) { mTextureSource = CreateTextureSourceForPlane(0); - RefPtr prev = mTextureSource; + nsRefPtr prev = mTextureSource; for (size_t i = 1; i < mSurface->GetPlaneCount(); i++) { - RefPtr next = CreateTextureSourceForPlane(i); + nsRefPtr next = CreateTextureSourceForPlane(i); prev->SetNextSibling(next); prev = next; } diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h index f408244acc4..5254ac4ac64 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h @@ -50,8 +50,8 @@ public: gl::GLContext* gl() const; protected: - RefPtr mCompositor; - RefPtr mSurface; + nsRefPtr mCompositor; + nsRefPtr mSurface; }; /** @@ -97,9 +97,9 @@ public: protected: GLTextureSource* CreateTextureSourceForPlane(size_t aPlane); - RefPtr mCompositor; - RefPtr mTextureSource; - RefPtr mSurface; + nsRefPtr mCompositor; + nsRefPtr mTextureSource; + nsRefPtr mSurface; }; } // namespace layers diff --git a/gfx/layers/opengl/OGLShaderProgram.h b/gfx/layers/opengl/OGLShaderProgram.h index f1d5ae1b70e..0ccd4710ee1 100644 --- a/gfx/layers/opengl/OGLShaderProgram.h +++ b/gfx/layers/opengl/OGLShaderProgram.h @@ -9,7 +9,7 @@ #include "GLContext.h" // for fast inlines of glUniform* #include "gfxTypes.h" #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Rect.h" // for Rect #include "mozilla/gfx/Types.h" @@ -476,7 +476,7 @@ public: } protected: - RefPtr mGL; + nsRefPtr mGL; // the OpenGL id of the program GLuint mProgram; ProgramProfileOGL mProfile; diff --git a/gfx/layers/opengl/TextureClientOGL.h b/gfx/layers/opengl/TextureClientOGL.h index dd0dd7729b9..19eab4b5693 100644 --- a/gfx/layers/opengl/TextureClientOGL.h +++ b/gfx/layers/opengl/TextureClientOGL.h @@ -61,7 +61,7 @@ public: } protected: - RefPtr mImage; + nsRefPtr mImage; const gfx::IntSize mSize; bool mIsLocked; }; @@ -112,7 +112,7 @@ public: } protected: - const RefPtr mSurfTex; + const nsRefPtr mSurfTex; const gfx::IntSize mSize; bool mIsLocked; }; diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index e8f7d56409d..ee395c539e1 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -50,7 +50,7 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator, TextureFlags aFlags) { - RefPtr result; + nsRefPtr result; switch (aDesc.type()) { case SurfaceDescriptor::TSurfaceDescriptorShmem: case SurfaceDescriptor::TSurfaceDescriptorMemory: { diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index fe3e9990e7b..054864d4d85 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -16,7 +16,7 @@ #include "mozilla/GfxMessageUtils.h" // for gfxContentType #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/Attributes.h" // for override -#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/nsRefPtr.h" // for RefPtr #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for IntSize, IntPoint #include "mozilla/gfx/Types.h" // for SurfaceFormat, etc @@ -212,7 +212,7 @@ public: protected: nsRefPtr mTexImage; - RefPtr mCompositor; + nsRefPtr mCompositor; TextureFlags mFlags; bool mIterating; }; @@ -269,7 +269,7 @@ public: protected: void DeleteTextureHandle(); - RefPtr mCompositor; + nsRefPtr mCompositor; GLuint mTextureHandle; GLenum mTextureTarget; gfx::IntSize mSize; @@ -319,7 +319,7 @@ public: gl::GLContext* gl() const; protected: - RefPtr mCompositor; + nsRefPtr mCompositor; mozilla::gl::AndroidSurfaceTexture* const mSurfTex; const gfx::SurfaceFormat mFormat; const GLenum mTextureTarget; @@ -367,8 +367,8 @@ public: protected: mozilla::gl::AndroidSurfaceTexture* const mSurfTex; const gfx::IntSize mSize; - RefPtr mCompositor; - RefPtr mTextureSource; + nsRefPtr mCompositor; + nsRefPtr mTextureSource; }; #endif // MOZ_WIDGET_ANDROID @@ -411,7 +411,7 @@ public: gl::GLContext* gl() const; protected: - RefPtr mCompositor; + nsRefPtr mCompositor; const EGLImage mImage; const gfx::SurfaceFormat mFormat; const GLenum mTextureTarget; @@ -463,8 +463,8 @@ protected: const EGLSync mSync; const gfx::IntSize mSize; const bool mHasAlpha; - RefPtr mCompositor; - RefPtr mTextureSource; + nsRefPtr mCompositor; + nsRefPtr mTextureSource; }; } // namespace layers diff --git a/gfx/layers/opengl/X11TextureSourceOGL.h b/gfx/layers/opengl/X11TextureSourceOGL.h index 097d5c1a222..f30e81743c8 100644 --- a/gfx/layers/opengl/X11TextureSourceOGL.h +++ b/gfx/layers/opengl/X11TextureSourceOGL.h @@ -50,9 +50,9 @@ public: static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType); protected: - RefPtr mCompositor; + nsRefPtr mCompositor; nsRefPtr mSurface; - RefPtr mSourceSurface; + nsRefPtr mSourceSurface; GLuint mTexture; bool mUpdated; }; diff --git a/gfx/skia/skia/include/record/SkRecording.h b/gfx/skia/skia/include/record/SkRecording.h index a4e8809c3a3..ab008a7e4b9 100644 --- a/gfx/skia/skia/include/record/SkRecording.h +++ b/gfx/skia/skia/include/record/SkRecording.h @@ -22,7 +22,7 @@ namespace EXPERIMENTAL { /** Easy mode interface to SkRecord-based SkCanvas recording. * * scoped_ptr recording(new SkRecording(1920, 1080)); - * skia::RefPtr canvas(skia::SharePtr(recording->canvas())); + * skia::nsRefPtr canvas(skia::SharePtr(recording->canvas())); * * canvas->drawThis(); * canvas->clipThat(); diff --git a/gfx/src/FilterSupport.cpp b/gfx/src/FilterSupport.cpp index 3040b0e0263..31a4ec35080 100644 --- a/gfx/src/FilterSupport.cpp +++ b/gfx/src/FilterSupport.cpp @@ -101,7 +101,7 @@ namespace FilterWrappers { static already_AddRefed Unpremultiply(DrawTarget* aDT, FilterNode* aInput) { - RefPtr filter = aDT->CreateFilter(FilterType::UNPREMULTIPLY); + nsRefPtr filter = aDT->CreateFilter(FilterType::UNPREMULTIPLY); if (filter) { filter->SetInput(IN_UNPREMULTIPLY_IN, aInput); return filter.forget(); @@ -112,7 +112,7 @@ namespace FilterWrappers { static already_AddRefed Premultiply(DrawTarget* aDT, FilterNode* aInput) { - RefPtr filter = aDT->CreateFilter(FilterType::PREMULTIPLY); + nsRefPtr filter = aDT->CreateFilter(FilterType::PREMULTIPLY); if (filter) { filter->SetInput(IN_PREMULTIPLY_IN, aInput); return filter.forget(); @@ -123,7 +123,7 @@ namespace FilterWrappers { static already_AddRefed LinearRGBToSRGB(DrawTarget* aDT, FilterNode* aInput) { - RefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); + nsRefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); if (transfer) { transfer->SetAttribute(ATT_DISCRETE_TRANSFER_DISABLE_R, false); transfer->SetAttribute(ATT_DISCRETE_TRANSFER_TABLE_R, glinearRGBTosRGBMap, 256); @@ -141,7 +141,7 @@ namespace FilterWrappers { static already_AddRefed SRGBToLinearRGB(DrawTarget* aDT, FilterNode* aInput) { - RefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); + nsRefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); if (transfer) { transfer->SetAttribute(ATT_DISCRETE_TRANSFER_DISABLE_R, false); transfer->SetAttribute(ATT_DISCRETE_TRANSFER_TABLE_R, gsRGBToLinearRGBMap, 256); @@ -159,7 +159,7 @@ namespace FilterWrappers { static already_AddRefed Crop(DrawTarget* aDT, FilterNode* aInputFilter, const IntRect& aRect) { - RefPtr filter = aDT->CreateFilter(FilterType::CROP); + nsRefPtr filter = aDT->CreateFilter(FilterType::CROP); if (filter) { filter->SetAttribute(ATT_CROP_RECT, Rect(aRect)); filter->SetInput(IN_CROP_IN, aInputFilter); @@ -171,7 +171,7 @@ namespace FilterWrappers { static already_AddRefed Offset(DrawTarget* aDT, FilterNode* aInputFilter, const IntPoint& aOffset) { - RefPtr filter = aDT->CreateFilter(FilterType::TRANSFORM); + nsRefPtr filter = aDT->CreateFilter(FilterType::TRANSFORM); if (filter) { filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix::Translation(aOffset.x, aOffset.y)); filter->SetInput(IN_TRANSFORM_IN, aInputFilter); @@ -186,7 +186,7 @@ namespace FilterWrappers { float stdX = float(std::min(aStdDeviation.width, kMaxStdDeviation)); float stdY = float(std::min(aStdDeviation.height, kMaxStdDeviation)); if (stdX == stdY) { - RefPtr filter = aDT->CreateFilter(FilterType::GAUSSIAN_BLUR); + nsRefPtr filter = aDT->CreateFilter(FilterType::GAUSSIAN_BLUR); if (filter) { filter->SetAttribute(ATT_GAUSSIAN_BLUR_STD_DEVIATION, stdX); filter->SetInput(IN_GAUSSIAN_BLUR_IN, aInputFilter); @@ -194,8 +194,8 @@ namespace FilterWrappers { } return nullptr; } - RefPtr filterH = aDT->CreateFilter(FilterType::DIRECTIONAL_BLUR); - RefPtr filterV = aDT->CreateFilter(FilterType::DIRECTIONAL_BLUR); + nsRefPtr filterH = aDT->CreateFilter(FilterType::DIRECTIONAL_BLUR); + nsRefPtr filterV = aDT->CreateFilter(FilterType::DIRECTIONAL_BLUR); if (filterH && filterV) { filterH->SetAttribute(ATT_DIRECTIONAL_BLUR_DIRECTION, (uint32_t)BLUR_DIRECTION_X); filterH->SetAttribute(ATT_DIRECTIONAL_BLUR_STD_DEVIATION, stdX); @@ -211,7 +211,7 @@ namespace FilterWrappers { static already_AddRefed Clear(DrawTarget* aDT) { - RefPtr filter = aDT->CreateFilter(FilterType::FLOOD); + nsRefPtr filter = aDT->CreateFilter(FilterType::FLOOD); if (filter) { filter->SetAttribute(ATT_FLOOD_COLOR, Color(0, 0, 0, 0)); return filter.forget(); @@ -223,7 +223,7 @@ namespace FilterWrappers { ForSurface(DrawTarget* aDT, SourceSurface* aSurface, const IntPoint& aSurfacePosition) { - RefPtr filter = aDT->CreateFilter(FilterType::TRANSFORM); + nsRefPtr filter = aDT->CreateFilter(FilterType::TRANSFORM); if (filter) { filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix::Translation(aSurfacePosition.x, aSurfacePosition.y)); @@ -237,7 +237,7 @@ namespace FilterWrappers { ToAlpha(DrawTarget* aDT, FilterNode* aInput) { float zero = 0.0f; - RefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); + nsRefPtr transfer = aDT->CreateFilter(FilterType::DISCRETE_TRANSFER); if (transfer) { transfer->SetAttribute(ATT_DISCRETE_TRANSFER_DISABLE_R, false); transfer->SetAttribute(ATT_DISCRETE_TRANSFER_TABLE_R, &zero, 1); @@ -281,11 +281,11 @@ private: // Create the required FilterNode that will be cached by ForColorModel. already_AddRefed WrapForColorModel(ColorModel aColorModel); - RefPtr mDT; + nsRefPtr mDT; ColorModel mOriginalColorModel; // This array is indexed by ColorModel::ToIndex. - RefPtr mFilterForColorModel[4]; + nsRefPtr mFilterForColorModel[4]; ~FilterCachedColorModels() {} }; @@ -299,7 +299,7 @@ FilterCachedColorModels::FilterCachedColorModels(DrawTarget* aDT, if (aFilter) { mFilterForColorModel[aOriginalColorModel.ToIndex()] = aFilter; } else { - RefPtr clear = FilterWrappers::Clear(aDT); + nsRefPtr clear = FilterWrappers::Clear(aDT); mFilterForColorModel[0] = clear; mFilterForColorModel[1] = clear; mFilterForColorModel[2] = clear; @@ -313,7 +313,7 @@ FilterCachedColorModels::ForColorModel(ColorModel aColorModel) if (!mFilterForColorModel[aColorModel.ToIndex()]) { mFilterForColorModel[aColorModel.ToIndex()] = WrapForColorModel(aColorModel); } - RefPtr filter(mFilterForColorModel[aColorModel.ToIndex()]); + nsRefPtr filter(mFilterForColorModel[aColorModel.ToIndex()]); return filter.forget(); } @@ -327,19 +327,19 @@ FilterCachedColorModels::WrapForColorModel(ColorModel aColorModel) // unpremultiplied color channels. if (aColorModel.mAlphaModel == AlphaModel::Premultiplied) { - RefPtr unpre = + nsRefPtr unpre = ForColorModel(ColorModel(aColorModel.mColorSpace, AlphaModel::Unpremultiplied)); return FilterWrappers::Premultiply(mDT, unpre); } MOZ_ASSERT(aColorModel.mAlphaModel == AlphaModel::Unpremultiplied); if (aColorModel.mColorSpace == mOriginalColorModel.mColorSpace) { - RefPtr premultiplied = + nsRefPtr premultiplied = ForColorModel(ColorModel(aColorModel.mColorSpace, AlphaModel::Premultiplied)); return FilterWrappers::Unpremultiply(mDT, premultiplied); } - RefPtr unpremultipliedOriginal = + nsRefPtr unpremultipliedOriginal = ForColorModel(ColorModel(mOriginalColorModel.mColorSpace, AlphaModel::Unpremultiplied)); if (aColorModel.mColorSpace == ColorSpace::LinearRGB) { return FilterWrappers::SRGBToLinearRGB(mDT, unpremultipliedOriginal); @@ -536,10 +536,10 @@ static void ConvertComponentTransferFunctionToFilter(const AttributeMap& aFunctionAttributes, int32_t aChannel, DrawTarget* aDT, - RefPtr& aTableTransfer, - RefPtr& aDiscreteTransfer, - RefPtr& aLinearTransfer, - RefPtr& aGammaTransfer) + nsRefPtr& aTableTransfer, + nsRefPtr& aDiscreteTransfer, + nsRefPtr& aLinearTransfer, + nsRefPtr& aGammaTransfer) { static const TransferAtts disableAtt[4] = { ATT_TRANSFER_DISABLE_R, @@ -548,7 +548,7 @@ ConvertComponentTransferFunctionToFilter(const AttributeMap& aFunctionAttributes ATT_TRANSFER_DISABLE_A }; - RefPtr filter; + nsRefPtr filter; uint32_t type = aFunctionAttributes.GetUint(eComponentTransferFunctionType); @@ -692,9 +692,9 @@ const int32_t kMorphologyMaxRadius = 100000; static already_AddRefed FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescription, DrawTarget* aDT, - nsTArray >& aSources, + nsTArray >& aSources, nsTArray& aSourceRegions, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { const AttributeMap& atts = aDescription.Attributes(); switch (aDescription.Type()) { @@ -705,7 +705,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::Blend: { uint32_t mode = atts.GetUint(eBlendBlendmode); - RefPtr filter; + nsRefPtr filter; if (mode == SVG_FEBLEND_MODE_UNKNOWN) { return nullptr; } @@ -756,7 +756,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio const nsTArray& values = atts.GetFloats(eColorMatrixValues); if (NS_FAILED(ComputeColorMatrix(type, values, colorMatrix)) || PodEqual(colorMatrix, identityMatrix)) { - RefPtr filter(aSources[0]); + nsRefPtr filter(aSources[0]); return filter.forget(); } Matrix5x4 matrix(colorMatrix[0], colorMatrix[5], colorMatrix[10], colorMatrix[15], @@ -764,7 +764,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio colorMatrix[2], colorMatrix[7], colorMatrix[12], colorMatrix[17], colorMatrix[3], colorMatrix[8], colorMatrix[13], colorMatrix[18], colorMatrix[4], colorMatrix[9], colorMatrix[14], colorMatrix[19]); - RefPtr filter = aDT->CreateFilter(FilterType::COLOR_MATRIX); + nsRefPtr filter = aDT->CreateFilter(FilterType::COLOR_MATRIX); if (!filter) { return nullptr; } @@ -794,7 +794,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio MorphologyOperator op = atts.GetUint(eMorphologyOperator) == SVG_OPERATOR_ERODE ? MORPHOLOGY_OPERATOR_ERODE : MORPHOLOGY_OPERATOR_DILATE; - RefPtr filter = aDT->CreateFilter(FilterType::MORPHOLOGY); + nsRefPtr filter = aDT->CreateFilter(FilterType::MORPHOLOGY); if (!filter) { return nullptr; } @@ -807,7 +807,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::Flood: { Color color = atts.GetColor(eFloodColor); - RefPtr filter = aDT->CreateFilter(FilterType::FLOOD); + nsRefPtr filter = aDT->CreateFilter(FilterType::FLOOD); if (!filter) { return nullptr; } @@ -817,7 +817,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::Tile: { - RefPtr filter = aDT->CreateFilter(FilterType::TILE); + nsRefPtr filter = aDT->CreateFilter(FilterType::TILE); if (!filter) { return nullptr; } @@ -828,7 +828,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::ComponentTransfer: { - RefPtr filters[4]; // one for each FILTER_*_TRANSFER type + nsRefPtr filters[4]; // one for each FILTER_*_TRANSFER type static const AttributeName componentFunctionNames[4] = { eComponentTransferFunctionR, eComponentTransferFunctionG, @@ -843,7 +843,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio } // Connect all used filters nodes. - RefPtr lastFilter = aSources[0]; + nsRefPtr lastFilter = aSources[0]; for (int32_t i = 0; i < 4; i++) { if (filters[i]) { filters[i]->SetInput(0, lastFilter); @@ -856,7 +856,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::ConvolveMatrix: { - RefPtr filter = aDT->CreateFilter(FilterType::CONVOLVE_MATRIX); + nsRefPtr filter = aDT->CreateFilter(FilterType::CONVOLVE_MATRIX); if (!filter) { return nullptr; } @@ -896,7 +896,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::DisplacementMap: { - RefPtr filter = aDT->CreateFilter(FilterType::DISPLACEMENT_MAP); + nsRefPtr filter = aDT->CreateFilter(FilterType::DISPLACEMENT_MAP); if (!filter) { return nullptr; } @@ -920,7 +920,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::Turbulence: { - RefPtr filter = aDT->CreateFilter(FilterType::TURBULENCE); + nsRefPtr filter = aDT->CreateFilter(FilterType::TURBULENCE); if (!filter) { return nullptr; } @@ -946,7 +946,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::Composite: { - RefPtr filter; + nsRefPtr filter; uint32_t op = atts.GetUint(eCompositeOperator); if (op == SVG_FECOMPOSITE_OPERATOR_ARITHMETIC) { const nsTArray& coefficients = atts.GetFloats(eCompositeCoefficients); @@ -988,10 +988,10 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio return nullptr; } if (aSources.Length() == 1) { - RefPtr filter(aSources[0]); + nsRefPtr filter(aSources[0]); return filter.forget(); } - RefPtr filter = aDT->CreateFilter(FilterType::COMPOSITE); + nsRefPtr filter = aDT->CreateFilter(FilterType::COMPOSITE); if (!filter) { return nullptr; } @@ -1010,12 +1010,12 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio case PrimitiveType::DropShadow: { - RefPtr alpha = FilterWrappers::ToAlpha(aDT, aSources[0]); - RefPtr blur = FilterWrappers::GaussianBlur(aDT, alpha, + nsRefPtr alpha = FilterWrappers::ToAlpha(aDT, aSources[0]); + nsRefPtr blur = FilterWrappers::GaussianBlur(aDT, alpha, atts.GetSize(eDropShadowStdDeviation)); - RefPtr offsetBlur = FilterWrappers::Offset(aDT, blur, + nsRefPtr offsetBlur = FilterWrappers::Offset(aDT, blur, atts.GetIntPoint(eDropShadowOffset)); - RefPtr flood = aDT->CreateFilter(FilterType::FLOOD); + nsRefPtr flood = aDT->CreateFilter(FilterType::FLOOD); if (!flood) { return nullptr; } @@ -1028,7 +1028,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio } flood->SetAttribute(ATT_FLOOD_COLOR, color); - RefPtr composite = aDT->CreateFilter(FilterType::COMPOSITE); + nsRefPtr composite = aDT->CreateFilter(FilterType::COMPOSITE); if (!composite) { return nullptr; } @@ -1036,7 +1036,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio composite->SetInput(IN_COMPOSITE_IN_START, offsetBlur); composite->SetInput(IN_COMPOSITE_IN_START + 1, flood); - RefPtr filter = aDT->CreateFilter(FilterType::COMPOSITE); + nsRefPtr filter = aDT->CreateFilter(FilterType::COMPOSITE); if (!filter) { return nullptr; } @@ -1070,7 +1070,7 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio { FilterType::POINT_DIFFUSE, FilterType::SPOT_DIFFUSE, FilterType::DISTANT_DIFFUSE }, { FilterType::POINT_SPECULAR, FilterType::SPOT_SPECULAR, FilterType::DISTANT_SPECULAR } }; - RefPtr filter = + nsRefPtr filter = aDT->CreateFilter(filterType[isSpecular][lightType]); if (!filter) { return nullptr; @@ -1130,10 +1130,10 @@ FilterNodeFromPrimitiveDescription(const FilterPrimitiveDescription& aDescriptio // Pull the image from the additional image list using the index that's // stored in the primitive description. - RefPtr inputImage = + nsRefPtr inputImage = aInputImages[atts.GetUint(eImageInputIndex)]; - RefPtr transform = aDT->CreateFilter(FilterType::TRANSFORM); + nsRefPtr transform = aDT->CreateFilter(FilterType::TRANSFORM); if (!transform) { return nullptr; } @@ -1228,17 +1228,17 @@ FilterNodeGraphFromDescription(DrawTarget* aDT, const IntRect& aFillPaintRect, SourceSurface* aStrokePaint, const IntRect& aStrokePaintRect, - nsTArray>& aAdditionalImages) + nsTArray>& aAdditionalImages) { const nsTArray& primitives = aFilter.mPrimitives; - RefPtr sourceFilters[4]; - nsTArray > primitiveFilters; + nsRefPtr sourceFilters[4]; + nsTArray > primitiveFilters; for (size_t i = 0; i < primitives.Length(); ++i) { const FilterPrimitiveDescription& descr = primitives[i]; - nsTArray > inputFilterNodes; + nsTArray > inputFilterNodes; nsTArray inputSourceRects; nsTArray inputAlphaModels; @@ -1251,7 +1251,7 @@ FilterNodeGraphFromDescription(DrawTarget* aDT, inputSourceRects.AppendElement(primitives[inputIndex].PrimitiveSubregion()); } - RefPtr inputFilter; + nsRefPtr inputFilter; if (inputIndex >= 0) { MOZ_ASSERT(inputIndex < (int64_t)primitiveFilters.Length(), "out-of-bounds input index!"); inputFilter = primitiveFilters[inputIndex]; @@ -1262,11 +1262,11 @@ FilterNodeGraphFromDescription(DrawTarget* aDT, MOZ_ASSERT(sourceIndex < 4, "invalid source index"); inputFilter = sourceFilters[sourceIndex]; if (!inputFilter) { - RefPtr sourceFilterNode; + nsRefPtr sourceFilterNode; nsTArray primitiveSurfaces; nsTArray primitiveSurfaceRects; - RefPtr surf = + nsRefPtr surf = ElementForIndex(inputIndex, primitiveSurfaces, aSourceGraphic, aFillPaint, aStrokePaint); IntRect surfaceRect = @@ -1304,7 +1304,7 @@ FilterNodeGraphFromDescription(DrawTarget* aDT, inputFilterNodes.AppendElement(inputFilter->ForColorModel(inputColorModel)); } - RefPtr primitiveFilterNode = + nsRefPtr primitiveFilterNode = FilterNodeFromPrimitiveDescription(descr, aDT, inputFilterNodes, inputSourceRects, aAdditionalImages); @@ -1315,7 +1315,7 @@ FilterNodeGraphFromDescription(DrawTarget* aDT, ColorModel outputColorModel(descr.OutputColorSpace(), OutputAlphaModelForPrimitive(descr, inputAlphaModels)); - RefPtr primitiveFilter = + nsRefPtr primitiveFilter = new FilterCachedColorModels(aDT, primitiveFilterNode, outputColorModel); primitiveFilters.AppendElement(primitiveFilter); @@ -1336,11 +1336,11 @@ FilterSupport::RenderFilterDescription(DrawTarget* aDT, const IntRect& aFillPaintRect, SourceSurface* aStrokePaint, const IntRect& aStrokePaintRect, - nsTArray>& aAdditionalImages, + nsTArray>& aAdditionalImages, const Point& aDestPoint, const DrawOptions& aOptions) { - RefPtr resultFilter = + nsRefPtr resultFilter = FilterNodeGraphFromDescription(aDT, aFilter, aRenderRect, aSourceGraphic, aSourceGraphicRect, aFillPaint, aFillPaintRect, aStrokePaint, aStrokePaintRect, aAdditionalImages); diff --git a/gfx/src/FilterSupport.h b/gfx/src/FilterSupport.h index 96a43d7cbba..00a1d32ea7f 100644 --- a/gfx/src/FilterSupport.h +++ b/gfx/src/FilterSupport.h @@ -7,7 +7,7 @@ #define __FilterSupport_h #include "mozilla/Attributes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/Rect.h" #include "mozilla/gfx/Matrix.h" #include "mozilla/gfx/2D.h" @@ -431,7 +431,7 @@ public: const IntRect& aFillPaintRect, SourceSurface* aStrokePaint, const IntRect& aStrokePaintRect, - nsTArray>& aAdditionalImages, + nsTArray>& aAdditionalImages, const Point& aDestPoint, const DrawOptions& aOptions = DrawOptions()); diff --git a/gfx/src/nsDeviceContext.cpp b/gfx/src/nsDeviceContext.cpp index 9d44d60d4a5..7aad21b9467 100644 --- a/gfx/src/nsDeviceContext.cpp +++ b/gfx/src/nsDeviceContext.cpp @@ -409,7 +409,7 @@ nsDeviceContext::CreateRenderingContext() } #endif - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(printingSurface, gfx::IntSize(mWidth, mHeight)); diff --git a/gfx/tests/gtest/TestCompositor.cpp b/gfx/tests/gtest/TestCompositor.cpp index 4a195e6ce61..b01ffce8d57 100644 --- a/gfx/tests/gtest/TestCompositor.cpp +++ b/gfx/tests/gtest/TestCompositor.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "TestLayers.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/layers/BasicCompositor.h" // for BasicCompositor #include "mozilla/layers/Compositor.h" // for Compositor #include "mozilla/layers/CompositorOGL.h" // for CompositorOGL @@ -87,8 +87,8 @@ private: NS_IMPL_ISUPPORTS_INHERITED0(MockWidget, nsBaseWidget) struct LayerManagerData { - RefPtr mWidget; - RefPtr mCompositor; + nsRefPtr mWidget; + nsRefPtr mCompositor; nsRefPtr mLayerManager; LayerManagerData(Compositor* compositor, MockWidget* widget, LayerManagerComposite* layerManager) @@ -102,7 +102,7 @@ static already_AddRefed CreateTestCompositor(LayersBackend backend, { gfxPrefs::GetSingleton(); - RefPtr compositor; + nsRefPtr compositor; if (backend == LayersBackend::LAYERS_OPENGL) { compositor = new CompositorOGL(widget, @@ -140,8 +140,8 @@ static std::vector GetLayerManagers(std::vector for (size_t i = 0; i < aBackends.size(); i++) { auto backend = aBackends[i]; - RefPtr widget = new MockWidget(); - RefPtr compositor = CreateTestCompositor(backend, widget); + nsRefPtr widget = new MockWidget(); + nsRefPtr compositor = CreateTestCompositor(backend, widget); nsRefPtr layerManager = new LayerManagerComposite(compositor); @@ -180,17 +180,17 @@ static already_AddRefed CreateDT() static bool CompositeAndCompare(nsRefPtr layerManager, DrawTarget* refDT) { - RefPtr drawTarget = CreateDT(); + nsRefPtr drawTarget = CreateDT(); layerManager->BeginTransactionWithDrawTarget(drawTarget, IntRect(0, 0, gCompWidth, gCompHeight)); layerManager->EndTransaction(TimeStamp::Now()); - RefPtr ss = drawTarget->Snapshot(); - RefPtr dss = ss->GetDataSurface(); + nsRefPtr ss = drawTarget->Snapshot(); + nsRefPtr dss = ss->GetDataSurface(); uint8_t* bitmap = dss->GetData(); - RefPtr ssRef = refDT->Snapshot(); - RefPtr dssRef = ssRef->GetDataSurface(); + nsRefPtr ssRef = refDT->Snapshot(); + nsRefPtr dssRef = ssRef->GetDataSurface(); uint8_t* bitmapRef = dssRef->GetData(); for (int y = 0; y < gCompHeight; y++) { @@ -256,7 +256,7 @@ TEST(Gfx, CompositorSimpleTree) colorLayer->SetBounds(colorLayer->GetVisibleRegion().GetBounds()); } - RefPtr refDT = CreateDT(); + nsRefPtr refDT = CreateDT(); refDT->FillRect(Rect(0, 0, gCompWidth, gCompHeight), ColorPattern(Color(1.f, 0.f, 1.f, 1.f))); refDT->FillRect(Rect(0, 0, 100, 100), ColorPattern(Color(1.f, 0.f, 0.f, 1.f))); refDT->FillRect(Rect(0, 50, 100, 100), ColorPattern(Color(0.f, 0.f, 1.f, 1.f))); diff --git a/gfx/tests/gtest/TestJobScheduler.cpp b/gfx/tests/gtest/TestJobScheduler.cpp index 8c18ffcaa08..83df162aa98 100644 --- a/gfx/tests/gtest/TestJobScheduler.cpp +++ b/gfx/tests/gtest/TestJobScheduler.cpp @@ -120,9 +120,9 @@ void TestSchedulerJoin(uint32_t aNumThreads, uint32_t aNumCmdBuffers) { JoinTestSanityCheck check(aNumCmdBuffers); - RefPtr beforeFilter = new SyncObject(aNumCmdBuffers); - RefPtr afterFilter = new SyncObject(); - RefPtr completion = new SyncObject(aNumCmdBuffers); + nsRefPtr beforeFilter = new SyncObject(aNumCmdBuffers); + nsRefPtr afterFilter = new SyncObject(); + nsRefPtr completion = new SyncObject(aNumCmdBuffers); for (uint32_t i = 0; i < aNumCmdBuffers; ++i) { @@ -145,7 +145,7 @@ void TestSchedulerJoin(uint32_t aNumThreads, uint32_t aNumCmdBuffers) } completion->FreezePrerequisites(); - RefPtr waitForCompletion = new EventObject(); + nsRefPtr waitForCompletion = new EventObject(); auto evtJob = new SetEventJob(waitForCompletion, completion); JobScheduler::SubmitJob(evtJob); @@ -168,13 +168,13 @@ void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) { SanityChecker check(aNumCmdBuffers); - RefPtr completion = new SyncObject(aNumCmdBuffers); + nsRefPtr completion = new SyncObject(aNumCmdBuffers); uint32_t numJobs = 10; for (uint32_t i = 0; i < aNumCmdBuffers; ++i) { - std::vector> syncs; + std::vector> syncs; std::vector tasks; syncs.reserve(numJobs); tasks.reserve(numJobs); @@ -205,7 +205,7 @@ void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers) } completion->FreezePrerequisites(); - RefPtr waitForCompletion = new EventObject(); + nsRefPtr waitForCompletion = new EventObject(); auto evtJob = new SetEventJob(waitForCompletion, completion); JobScheduler::SubmitJob(evtJob); diff --git a/gfx/tests/gtest/TestTextures.cpp b/gfx/tests/gtest/TestTextures.cpp index 3d50550855b..7cbf11bfc5f 100644 --- a/gfx/tests/gtest/TestTextures.cpp +++ b/gfx/tests/gtest/TestTextures.cpp @@ -10,7 +10,7 @@ #include "mozilla/gfx/Tools.h" #include "mozilla/layers/TextureClient.h" #include "mozilla/layers/TextureHost.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gfx2DGlue.h" #include "gfxImageSurface.h" #include "gfxTypes.h" @@ -86,8 +86,8 @@ void AssertSurfacesEqual(SourceSurface* surface1, ASSERT_EQ(surface1->GetSize(), surface2->GetSize()); ASSERT_EQ(surface1->GetFormat(), surface2->GetFormat()); - RefPtr dataSurface1 = surface1->GetDataSurface(); - RefPtr dataSurface2 = surface2->GetDataSurface(); + nsRefPtr dataSurface1 = surface1->GetDataSurface(); + nsRefPtr dataSurface2 = surface2->GetDataSurface(); DataSourceSurface::MappedSurface map1; DataSourceSurface::MappedSurface map2; if (!dataSurface1->Map(DataSourceSurface::READ, &map1)) { @@ -153,12 +153,12 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface) ASSERT_TRUE(texture->Lock(OpenMode::OPEN_READ_WRITE)); // client painting - RefPtr dt = texture->BorrowDrawTarget(); - RefPtr source = + nsRefPtr dt = texture->BorrowDrawTarget(); + nsRefPtr source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surface); dt->CopySurface(source, IntRect(IntPoint(), source->GetSize()), IntPoint()); - RefPtr snapshot = dt->Snapshot(); + nsRefPtr snapshot = dt->Snapshot(); AssertSurfacesEqual(snapshot, source); @@ -172,7 +172,7 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface) ASSERT_NE(descriptor.type(), SurfaceDescriptor::Tnull_t); // host deserialization - RefPtr host = CreateBackendIndependentTextureHost(descriptor, nullptr, + nsRefPtr host = CreateBackendIndependentTextureHost(descriptor, nullptr, texture->GetFlags()); ASSERT_TRUE(host.get() != nullptr); @@ -185,7 +185,7 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface) // not sure it'll be worth it. Maybe always test against a BasicCompositor, // but the latter needs a widget... if (host->Lock()) { - RefPtr hostDataSurface = host->GetAsSurface(); + nsRefPtr hostDataSurface = host->GetAsSurface(); nsRefPtr hostSurface = new gfxImageSurface(hostDataSurface->GetData(), @@ -220,10 +220,10 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) { ASSERT_NE(descriptor.type(), SurfaceDescriptor::Tnull_t); // host deserialization - RefPtr textureHost = CreateBackendIndependentTextureHost(descriptor, nullptr, + nsRefPtr textureHost = CreateBackendIndependentTextureHost(descriptor, nullptr, client->GetFlags()); - RefPtr host = static_cast(textureHost.get()); + nsRefPtr host = static_cast(textureHost.get()); ASSERT_TRUE(host.get() != nullptr); ASSERT_EQ(host->GetFlags(), client->GetFlags()); @@ -269,11 +269,11 @@ TEST(Layers, TextureSerialization) { }; for (int f = 0; f < 3; ++f) { - RefPtr surface = new gfxImageSurface(IntSize(400,300), formats[f]); + nsRefPtr surface = new gfxImageSurface(IntSize(400,300), formats[f]); SetupSurface(surface.get()); AssertSurfacesEqual(surface, surface); - RefPtr client + nsRefPtr client = new MemoryTextureClient(nullptr, mozilla::gfx::ImageFormatToSurfaceFormat(surface->Format()), gfx::BackendType::CAIRO, @@ -286,9 +286,9 @@ TEST(Layers, TextureSerialization) { } TEST(Layers, TextureYCbCrSerialization) { - RefPtr ySurface = new gfxImageSurface(IntSize(400,300), gfxImageFormat::A8); - RefPtr cbSurface = new gfxImageSurface(IntSize(200,150), gfxImageFormat::A8); - RefPtr crSurface = new gfxImageSurface(IntSize(200,150), gfxImageFormat::A8); + nsRefPtr ySurface = new gfxImageSurface(IntSize(400,300), gfxImageFormat::A8); + nsRefPtr cbSurface = new gfxImageSurface(IntSize(200,150), gfxImageFormat::A8); + nsRefPtr crSurface = new gfxImageSurface(IntSize(200,150), gfxImageFormat::A8); SetupSurface(ySurface.get()); SetupSurface(cbSurface.get()); SetupSurface(crSurface.get()); @@ -310,7 +310,7 @@ TEST(Layers, TextureYCbCrSerialization) { clientData.mPicX = 0; clientData.mPicX = 0; - RefPtr client + nsRefPtr client = new MemoryTextureClient(nullptr, mozilla::gfx::SurfaceFormat::YUV, gfx::BackendType::CAIRO, diff --git a/gfx/tests/gtest/gfxFontSelectionTest.cpp b/gfx/tests/gtest/gfxFontSelectionTest.cpp index ca5e72b02c8..ca090b1e817 100644 --- a/gfx/tests/gtest/gfxFontSelectionTest.cpp +++ b/gfx/tests/gtest/gfxFontSelectionTest.cpp @@ -6,7 +6,7 @@ #include "gtest/gtest.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsTArray.h" #include "nsString.h" @@ -188,7 +188,7 @@ MakeContext () { const int size = 200; - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(size, size), SurfaceFormat::B8G8R8X8); nsRefPtr ctx = new gfxContext(drawTarget); diff --git a/gfx/tests/gtest/gfxTextRunPerfTest.cpp b/gfx/tests/gtest/gfxTextRunPerfTest.cpp index c321b0ff67b..baebc2a4364 100644 --- a/gfx/tests/gtest/gfxTextRunPerfTest.cpp +++ b/gfx/tests/gtest/gfxTextRunPerfTest.cpp @@ -7,7 +7,7 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsTArray.h" @@ -40,7 +40,7 @@ MakeContext () { const int size = 200; - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(size, size), SurfaceFormat::B8G8R8X8); nsRefPtr ctx = new gfxContext(drawTarget); diff --git a/gfx/tests/gtest/gfxWordCacheTest.cpp b/gfx/tests/gtest/gfxWordCacheTest.cpp index 5352add0780..758187818c8 100644 --- a/gfx/tests/gtest/gfxWordCacheTest.cpp +++ b/gfx/tests/gtest/gfxWordCacheTest.cpp @@ -7,7 +7,7 @@ #include "gtest/gtest.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsTArray.h" #include "nsString.h" @@ -86,7 +86,7 @@ MakeContext () { const int size = 200; - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(size, size), SurfaceFormat::B8G8R8X8); nsRefPtr ctx = new gfxContext(drawTarget); diff --git a/gfx/thebes/SoftwareVsyncSource.h b/gfx/thebes/SoftwareVsyncSource.h index f4923b274a6..b0cf4d2e18b 100644 --- a/gfx/thebes/SoftwareVsyncSource.h +++ b/gfx/thebes/SoftwareVsyncSource.h @@ -8,7 +8,7 @@ #define GFX_SOFTWARE_VSYNC_SOURCE_H #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "base/thread.h" #include "nsISupportsImpl.h" diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index 78db721361d..515bcca8016 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -360,8 +360,8 @@ gfxASurface::CopyToARGB32ImageSurface() nsRefPtr imgSurface = new gfxImageSurface(size, gfxImageFormat::ARGB32); - RefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(imgSurface, IntSize(size.width, size.height)); - RefPtr source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, this); + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(imgSurface, IntSize(size.width, size.height)); + nsRefPtr source = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, this); dt->CopySurface(source, IntRect(0, 0, size.width, size.height), IntPoint()); diff --git a/gfx/thebes/gfxBlur.cpp b/gfx/thebes/gfxBlur.cpp index caf747ae7ac..c0fa7b0a6a1 100644 --- a/gfx/thebes/gfxBlur.cpp +++ b/gfx/thebes/gfxBlur.cpp @@ -69,7 +69,7 @@ gfxAlphaBoxBlur::Init(const gfxRect& aRect, } memset(mData, 0, blurDataSize); - mozilla::RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForData(mData, size, mBlur->GetStride(), SurfaceFormat::A8); @@ -144,7 +144,7 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDestinationCtx) Rect* dirtyRect = mBlur->GetDirtyRect(); IntPoint topLeft; - RefPtr mask = DoBlur(dest, &topLeft); + nsRefPtr mask = DoBlur(dest, &topLeft); if (!mask) { NS_ERROR("Failed to create mask!"); return; @@ -294,7 +294,7 @@ struct BlurCacheData { } nsExpirationState mExpirationState; - RefPtr mBlur; + nsRefPtr mBlur; IntMargin mExtendDest; BlurCacheKey mKey; }; @@ -473,7 +473,7 @@ CreateBlurMask(const IntSize& aRectSize, ColorPattern black(Color(0.f, 0.f, 0.f, 1.f)); if (aCornerRadii) { - RefPtr roundedRect = + nsRefPtr roundedRect = MakePathForRoundedRect(*blurDT, Rect(minRect), *aCornerRadii); blurDT->Fill(roundedRect, black); } else { @@ -481,7 +481,7 @@ CreateBlurMask(const IntSize& aRectSize, } IntPoint topLeft; - RefPtr result = blur.DoBlur(&aDestDrawTarget, &topLeft); + nsRefPtr result = blur.DoBlur(&aDestDrawTarget, &topLeft); if (!result) { return nullptr; } @@ -501,7 +501,7 @@ CreateBoxShadow(SourceSurface* aBlurMask, const Color& aShadowColor) { IntSize blurredSize = aBlurMask->GetSize(); gfxPlatform* platform = gfxPlatform::GetPlatform(); - RefPtr boxShadowDT = + nsRefPtr boxShadowDT = platform->CreateOffscreenContentDrawTarget(blurredSize, SurfaceFormat::B8G8R8A8); if (!boxShadowDT) { @@ -539,14 +539,14 @@ GetBlur(DrawTarget& aDT, return cached->mBlur; } - RefPtr blurMask = + nsRefPtr blurMask = CreateBlurMask(aRectSize, aCornerRadii, aBlurRadius, aExtendDestBy, aSlice, aDT); if (!blurMask) { return nullptr; } - RefPtr boxShadow = CreateBoxShadow(blurMask, aShadowColor); + nsRefPtr boxShadow = CreateBoxShadow(blurMask, aShadowColor); if (!boxShadow) { return nullptr; } @@ -695,7 +695,7 @@ gfxAlphaBoxBlur::BlurRectangle(gfxContext* aDestinationCtx, IntMargin extendDestBy; IntMargin slice; - RefPtr boxShadow = GetBlur(destDrawTarget, + nsRefPtr boxShadow = GetBlur(destDrawTarget, rect.Size(), blurRadius, aCornerRadii, aShadowColor, extendDestBy, slice); @@ -774,7 +774,7 @@ GetBoxShadowInsetPath(DrawTarget* aDrawTarget, * The outer rect and the inside rect. The path * creates a frame around the content where we draw the inset shadow. */ - RefPtr builder = + nsRefPtr builder = aDrawTarget->CreatePathBuilder(FillRule::FILL_EVEN_ODD); AppendRectToPath(builder, aOuterRect, true); @@ -846,7 +846,7 @@ FillDestinationPath(gfxContext* aDestinationCtx, // surface. aDestinationCtx->SetColor(aShadowColor); DrawTarget* destDrawTarget = aDestinationCtx->GetDrawTarget(); - RefPtr shadowPath = GetBoxShadowInsetPath(destDrawTarget, aDestinationRect, + nsRefPtr shadowPath = GetBoxShadowInsetPath(destDrawTarget, aDestinationRect, aShadowClipRect, aHasBorderRadius, aInnerClipRadii); @@ -914,7 +914,7 @@ gfxAlphaBoxBlur::GetInsetBlur(IntMargin& aExtendDestBy, aSlice += aExtendDestBy; // So we don't forget the actual cached blur - RefPtr cachedBlur = cached->mBlur; + nsRefPtr cachedBlur = cached->mBlur; return cachedBlur.forget(); } @@ -929,7 +929,7 @@ gfxAlphaBoxBlur::GetInsetBlur(IntMargin& aExtendDestBy, } DrawTarget* minDrawTarget = minGfxContext->GetDrawTarget(); - RefPtr maskPath = GetBoxShadowInsetPath(minDrawTarget, ToRect(outerRect), + nsRefPtr maskPath = GetBoxShadowInsetPath(minDrawTarget, ToRect(outerRect), ToRect(innerRect), aHasBorderRadius, aInnerClipRadii); @@ -938,12 +938,12 @@ gfxAlphaBoxBlur::GetInsetBlur(IntMargin& aExtendDestBy, minGfxContext->Fill(); IntPoint topLeft; - RefPtr minMask = DoBlur(minDrawTarget, &topLeft); + nsRefPtr minMask = DoBlur(minDrawTarget, &topLeft); if (!minMask) { return nullptr; } - RefPtr minInsetBlur = CreateBoxShadow(minMask, aShadowColor); + nsRefPtr minInsetBlur = CreateBoxShadow(minMask, aShadowColor); if (!minInsetBlur) { return nullptr; } @@ -991,7 +991,7 @@ gfxAlphaBoxBlur::BlurInsetBox(gfxContext* aDestinationCtx, IntMargin extendDest; IntMargin slice; - RefPtr minInsetBlur = GetInsetBlur(extendDest, slice, + nsRefPtr minInsetBlur = GetInsetBlur(extendDest, slice, aDestinationRect, aShadowClipRect, aBlurRadius, aSpreadRadius, aInnerClipRadii, aShadowColor, diff --git a/gfx/thebes/gfxBlur.h b/gfx/thebes/gfxBlur.h index c2cf901c0a6..a402c011dc7 100644 --- a/gfx/thebes/gfxBlur.h +++ b/gfx/thebes/gfxBlur.h @@ -10,7 +10,7 @@ #include "nsSize.h" #include "nsAutoPtr.h" #include "gfxPoint.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" class gfxContext; diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp index 6035c12d71e..251c42e84d6 100644 --- a/gfx/thebes/gfxContext.cpp +++ b/gfx/thebes/gfxContext.cpp @@ -203,7 +203,7 @@ gfxContext::ClosePath() already_AddRefed gfxContext::GetPath() { EnsurePath(); - RefPtr path(mPath); + nsRefPtr path(mPath); return path.forget(); } @@ -808,7 +808,7 @@ gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset) js::ProfileEntry::Category::GRAPHICS); // Lifetime needs to be limited here as we may simply wrap surface's data. - RefPtr sourceSurf = + nsRefPtr sourceSurf = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(mDT, surface); if (!sourceSurf) { @@ -903,7 +903,7 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content) mDT->GetOpaqueRect().Contains(clipExtents)) && !mDT->GetUserData(&sDontUseAsSourceKey)) { DrawTarget *oldDT = mDT; - RefPtr source = mDT->Snapshot(); + nsRefPtr source = mDT->Snapshot(); Point oldDeviceOffset = CurrentState().deviceOffset; PushNewDT(gfxContentType::COLOR); @@ -953,7 +953,7 @@ gfxContext::PushGroupAndCopyBackground(gfxContentType content) already_AddRefed gfxContext::PopGroup() { - RefPtr src = mDT->Snapshot(); + nsRefPtr src = mDT->Snapshot(); Point deviceOffset = CurrentState().deviceOffset; Restore(); @@ -970,7 +970,7 @@ gfxContext::PopGroup() already_AddRefed gfxContext::PopGroupToSurface(Matrix* aTransform) { - RefPtr src = mDT->Snapshot(); + nsRefPtr src = mDT->Snapshot(); Point deviceOffset = CurrentState().deviceOffset; Restore(); @@ -988,7 +988,7 @@ gfxContext::PopGroupToSurface(Matrix* aTransform) void gfxContext::PopGroupToSource() { - RefPtr src = mDT->Snapshot(); + nsRefPtr src = mDT->Snapshot(); Point deviceOffset = CurrentState().deviceOffset; Restore(); CurrentState().sourceSurfCairo = nullptr; @@ -1105,7 +1105,7 @@ gfxContext::EnsurePathBuilder() invTransform.Invert(); Matrix toNewUS = mPathTransform * invTransform; - RefPtr path = mPathBuilder->Finish(); + nsRefPtr path = mPathBuilder->Finish(); mPathBuilder = path->TransformedCopyToBuilder(toNewUS, CurrentState().fillRule); } @@ -1311,7 +1311,7 @@ gfxContext::PushNewDT(gfxContentType content) SurfaceFormat format = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content); - RefPtr newDT = + nsRefPtr newDT = mDT->CreateSimilarDrawTarget(IntSize(int32_t(clipBounds.width), int32_t(clipBounds.height)), format); diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h index ead7e5f8f6a..738013c4969 100644 --- a/gfx/thebes/gfxContext.h +++ b/gfx/thebes/gfxContext.h @@ -504,12 +504,12 @@ private: Color color; nsRefPtr pattern; nsRefPtr sourceSurfCairo; - mozilla::RefPtr sourceSurface; + nsRefPtr sourceSurface; mozilla::gfx::Point sourceSurfaceDeviceOffset; Matrix surfTransform; Matrix transform; struct PushedClip { - mozilla::RefPtr path; + nsRefPtr path; Rect rect; Matrix transform; }; @@ -518,8 +518,8 @@ private: bool clipWasReset; mozilla::gfx::FillRule fillRule; StrokeOptions strokeOptions; - mozilla::RefPtr drawTarget; - mozilla::RefPtr parentTarget; + nsRefPtr drawTarget; + nsRefPtr parentTarget; mozilla::gfx::AntialiasMode aaMode; bool patternTransformChanged; Matrix patternTransform; @@ -545,8 +545,8 @@ private: bool mTransformChanged; Matrix mPathTransform; Rect mRect; - mozilla::RefPtr mPathBuilder; - mozilla::RefPtr mPath; + nsRefPtr mPathBuilder; + nsRefPtr mPath; Matrix mTransform; nsTArray mStateStack; @@ -555,8 +555,8 @@ private: cairo_t *mRefCairo; - mozilla::RefPtr mDT; - mozilla::RefPtr mOriginalDT; + nsRefPtr mDT; + nsRefPtr mOriginalDT; }; /** @@ -671,7 +671,7 @@ public: } private: - mozilla::RefPtr mDT; + nsRefPtr mDT; bool mSubpixelAntialiasingEnabled; }; diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index 04e67b66fb4..41d4d413802 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -674,7 +674,7 @@ gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget) { bool wantCairo = aTarget->GetBackendType() == BackendType::CAIRO; if (mAzureScaledFont && mAzureScaledFontIsCairo == wantCairo) { - RefPtr scaledFont(mAzureScaledFont); + nsRefPtr scaledFont(mAzureScaledFont); return scaledFont.forget(); } @@ -693,6 +693,6 @@ gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget) mAzureScaledFontIsCairo = wantCairo; - RefPtr scaledFont(mAzureScaledFont); + nsRefPtr scaledFont(mAzureScaledFont); return scaledFont.forget(); } diff --git a/gfx/thebes/gfxDrawable.cpp b/gfx/thebes/gfxDrawable.cpp index ec78b59c688..c4d954ff1c9 100644 --- a/gfx/thebes/gfxDrawable.cpp +++ b/gfx/thebes/gfxDrawable.cpp @@ -120,7 +120,7 @@ gfxCallbackDrawable::MakeSurfaceDrawable(const Filter aFilter) { SurfaceFormat format = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(gfxContentType::COLOR_ALPHA); - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(mSize, format); if (!dt) @@ -129,7 +129,7 @@ gfxCallbackDrawable::MakeSurfaceDrawable(const Filter aFilter) nsRefPtr ctx = new gfxContext(dt); Draw(ctx, gfxRect(0, 0, mSize.width, mSize.height), false, aFilter); - RefPtr surface = dt->Snapshot(); + nsRefPtr surface = dt->Snapshot(); if (surface) { nsRefPtr drawable = new gfxSurfaceDrawable(surface, mSize); return drawable.forget(); diff --git a/gfx/thebes/gfxDrawable.h b/gfx/thebes/gfxDrawable.h index e1a470146db..84834790418 100644 --- a/gfx/thebes/gfxDrawable.h +++ b/gfx/thebes/gfxDrawable.h @@ -89,7 +89,7 @@ protected: gfxFloat aOpacity, const gfxMatrix& aTransform = gfxMatrix()); - mozilla::RefPtr mSourceSurface; + nsRefPtr mSourceSurface; const gfxMatrix mTransform; }; diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 2cbb45f253d..34a5de1f5c5 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -1604,7 +1604,7 @@ private: void FlushStroke(gfx::GlyphBuffer& aBuf, gfxContext::AzureState& aState) { - RefPtr path = + nsRefPtr path = mFontParams.scaledFont->GetPathForGlyphs(aBuf, mRunParams.dt); if (mFontParams.contextPaint) { nsRefPtr strokePattern = @@ -2060,7 +2060,7 @@ gfxFont::RenderColorGlyph(gfxContext* aContext, return false; } - RefPtr dt = aContext->GetDrawTarget(); + nsRefPtr dt = aContext->GetDrawTarget(); for (uint32_t layerIndex = 0; layerIndex < layerGlyphs.Length(); layerIndex++) { Glyph glyph; diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 03ff72f62a6..b80124a722b 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -2064,7 +2064,7 @@ protected: // ranges supported by font nsRefPtr mUnicodeRangeMap; - mozilla::RefPtr mAzureScaledFont; + nsRefPtr mAzureScaledFont; // For vertical metrics, created on demand. nsAutoPtr mVerticalMetrics; @@ -2119,7 +2119,7 @@ protected: // are dependent on the specific font, so they are set per GlyphRun. struct TextRunDrawParams { - mozilla::RefPtr dt; + nsRefPtr dt; gfxContext *context; gfxFont::Spacing *spacing; gfxTextRunDrawCallbacks *callbacks; @@ -2134,8 +2134,8 @@ struct TextRunDrawParams { }; struct FontDrawParams { - mozilla::RefPtr scaledFont; - mozilla::RefPtr renderingOptions; + nsRefPtr scaledFont; + nsRefPtr renderingOptions; gfxTextContextPaint *contextPaint; mozilla::gfx::Matrix *passedInvMatrix; mozilla::gfx::Matrix matInv; diff --git a/gfx/thebes/gfxFontMissingGlyphs.cpp b/gfx/thebes/gfxFontMissingGlyphs.cpp index 92ea5e96726..5676cfeab34 100644 --- a/gfx/thebes/gfxFontMissingGlyphs.cpp +++ b/gfx/thebes/gfxFontMissingGlyphs.cpp @@ -9,7 +9,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Helpers.h" #include "mozilla/gfx/PathHelpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsDeviceContext.h" #include "nsLayoutUtils.h" @@ -163,7 +163,7 @@ DrawHexChar(uint32_t aDigit, const Point& aPt, DrawTarget& aDrawTarget, // To avoid the potential for seams showing between rects when we're under // a transform we concat all the rects into a PathBuilder and fill the // resulting Path (rather than using DrawTarget::FillRect). - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); uint32_t glyphBits = glyphMicroFont[aDigit]; for (int y = 0; y < MINIFONT_HEIGHT; ++y) { for (int x = 0; x < MINIFONT_WIDTH; ++x) { @@ -179,7 +179,7 @@ DrawHexChar(uint32_t aDigit, const Point& aPt, DrawTarget& aDrawTarget, glyphBits >>= 1; } } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); aDrawTarget.Fill(path, aPattern); } #endif // MOZ_GFX_OPTIMIZE_MOBILE diff --git a/gfx/thebes/gfxGradientCache.cpp b/gfx/thebes/gfxGradientCache.cpp index 6fdb972bce3..ddfd21659c9 100644 --- a/gfx/thebes/gfxGradientCache.cpp +++ b/gfx/thebes/gfxGradientCache.cpp @@ -100,7 +100,7 @@ struct GradientCacheData { } nsExpirationState mExpirationState; - const RefPtr mStops; + const nsRefPtr mStops; GradientCacheKey mKey; }; @@ -200,7 +200,7 @@ gfxGradientCache::GetGradientStops(const DrawTarget *aDT, nsTArray GradientStops * gfxGradientCache::GetOrCreateGradientStops(const DrawTarget *aDT, nsTArray& aStops, ExtendMode aExtend) { - RefPtr gs = GetGradientStops(aDT, aStops, aExtend); + nsRefPtr gs = GetGradientStops(aDT, aStops, aExtend); if (!gs) { gs = aDT->CreateGradientStops(aStops.Elements(), aStops.Length(), aExtend); if (!gs) { diff --git a/gfx/thebes/gfxImageSurface.cpp b/gfx/thebes/gfxImageSurface.cpp index 7c431977277..1cf44005b42 100644 --- a/gfx/thebes/gfxImageSurface.cpp +++ b/gfx/thebes/gfxImageSurface.cpp @@ -257,7 +257,7 @@ FormatsAreCompatible(gfxImageFormat a1, gfxImageFormat a2) bool gfxImageSurface::CopyFrom (SourceSurface *aSurface) { - mozilla::RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { return false; @@ -297,7 +297,7 @@ gfxImageSurface::CopyFrom(gfxImageSurface *other) bool gfxImageSurface::CopyTo(SourceSurface *aSurface) { - mozilla::RefPtr data = aSurface->GetDataSurface(); + nsRefPtr data = aSurface->GetDataSurface(); if (!data) { return false; @@ -321,7 +321,7 @@ gfxImageSurface::CopyTo(SourceSurface *aSurface) { already_AddRefed gfxImageSurface::CopyToB8G8R8A8DataSourceSurface() { - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(IntSize(GetSize().width, GetSize().height), SurfaceFormat::B8G8R8A8); if (dataSurface) { diff --git a/gfx/thebes/gfxImageSurface.h b/gfx/thebes/gfxImageSurface.h index 0d96f161324..d337f93381e 100644 --- a/gfx/thebes/gfxImageSurface.h +++ b/gfx/thebes/gfxImageSurface.h @@ -7,7 +7,7 @@ #define GFX_IMAGESURFACE_H #include "mozilla/MemoryReporting.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gfxASurface.h" #include "nsAutoPtr.h" #include "nsSize.h" diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 1e0600c891c..4f2837b717f 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -437,7 +437,7 @@ gfxMacFont::GetScaledFont(DrawTarget *aTarget) mAzureScaledFont = mozilla::gfx::Factory::CreateScaledFontWithCairo(nativeFont, GetAdjustedSize(), mScaledFont); } - RefPtr scaledFont(mAzureScaledFont); + nsRefPtr scaledFont(mAzureScaledFont); return scaledFont.forget(); } diff --git a/gfx/thebes/gfxPattern.h b/gfx/thebes/gfxPattern.h index 845d8dcc176..35d82d18220 100644 --- a/gfx/thebes/gfxPattern.h +++ b/gfx/thebes/gfxPattern.h @@ -68,9 +68,9 @@ private: ~gfxPattern() {} mozilla::gfx::GeneralPattern mGfxPattern; - mozilla::RefPtr mSourceSurface; + nsRefPtr mSourceSurface; mozilla::gfx::Matrix mPatternToUserSpace; - mozilla::RefPtr mStops; + nsRefPtr mStops; nsTArray mStopsList; mozilla::gfx::ExtendMode mExtend; }; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 151eda14eb1..ba01ea60bf6 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -784,7 +784,7 @@ already_AddRefed gfxPlatform::CreateDrawTargetForSurface(gfxASurface *aSurface, const IntSize& aSize) { SurfaceFormat format = aSurface->GetSurfaceFormat(); - RefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); + nsRefPtr drawTarget = Factory::CreateDrawTargetForCairoSurface(aSurface->CairoSurface(), aSize, &format); if (!drawTarget) { gfxWarning() << "gfxPlatform::CreateDrawTargetForSurface failed in CreateDrawTargetForCairoSurface"; return nullptr; @@ -822,7 +822,7 @@ cairo_user_data_key_t kSourceSurface; */ struct SourceSurfaceUserData { - RefPtr mSrcSurface; + nsRefPtr mSrcSurface; BackendType mBackendType; }; @@ -869,7 +869,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa SourceSurfaceUserData *surf = static_cast(userData); if (surf->mSrcSurface->IsValid() && surf->mBackendType == aTarget->GetBackendType()) { - RefPtr srcSurface(surf->mSrcSurface); + nsRefPtr srcSurface(surf->mSrcSurface); return srcSurface.forget(); } // We can just continue here as when setting new user data the destroy @@ -905,14 +905,14 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa return aTarget->CreateSourceSurfaceFromNativeSurface(surf); } - RefPtr srcBuffer; + nsRefPtr srcBuffer; // Currently no other DrawTarget types implement CreateSourceSurfaceFromNativeSurface if (!srcBuffer) { // If aSurface wraps data, we can create a SourceSurfaceRawData that wraps // the same data, then optimize it for aTarget: - RefPtr surf = GetWrappedDataSourceSurface(aSurface); + nsRefPtr surf = GetWrappedDataSourceSurface(aSurface); if (surf) { srcBuffer = aTarget->OptimizeSourceSurface(surf); if (srcBuffer == surf) { @@ -948,7 +948,7 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa surf.mType = NativeSurfaceType::CAIRO_SURFACE; surf.mSurface = aSurface->CairoSurface(); surf.mSize = aSurface->GetSize(); - RefPtr drawTarget = + nsRefPtr drawTarget = Factory::CreateDrawTarget(BackendType::CAIRO, IntSize(1, 1), format); if (!drawTarget) { gfxWarning() << "gfxPlatform::GetSourceSurfaceForSurface failed in CreateDrawTarget"; @@ -990,7 +990,7 @@ gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface) if (!image) { return nullptr; } - RefPtr result = + nsRefPtr result = Factory::CreateWrappingDataSourceSurface(image->Data(), image->Stride(), image->GetSize(), @@ -1231,7 +1231,7 @@ already_AddRefed gfxPlatform::CreateOffscreenCanvasDrawTarget(const IntSize& aSize, SurfaceFormat aFormat) { NS_ASSERTION(mPreferredCanvasBackend != BackendType::NONE, "No backend."); - RefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); + nsRefPtr target = CreateDrawTargetForBackend(mPreferredCanvasBackend, aSize, aFormat); if (target || mFallbackCanvasBackend == BackendType::NONE) { return target.forget(); @@ -1263,7 +1263,7 @@ gfxPlatform::CreateDrawTargetForData(unsigned char* aData, const IntSize& aSize, backendType = BackendType::CAIRO; } - RefPtr dt = Factory::CreateDrawTargetForData(backendType, + nsRefPtr dt = Factory::CreateDrawTargetForData(backendType, aData, aSize, aStride, aFormat); diff --git a/gfx/thebes/gfxPlatform.h b/gfx/thebes/gfxPlatform.h index 2a9e61dc8c3..fadc23ea922 100644 --- a/gfx/thebes/gfxPlatform.h +++ b/gfx/thebes/gfxPlatform.h @@ -20,7 +20,7 @@ #include "qcms.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "GfxInfoCollector.h" #include "mozilla/layers/CompositorTypes.h" @@ -718,7 +718,7 @@ protected: // Hardware vsync source. Only valid on parent process nsRefPtr mVsyncSource; - mozilla::RefPtr mScreenReferenceDrawTarget; + nsRefPtr mScreenReferenceDrawTarget; private: /** @@ -766,8 +766,8 @@ private: mozilla::widget::GfxInfoCollector mAzureCanvasBackendCollector; mozilla::widget::GfxInfoCollector mApzSupportCollector; - mozilla::RefPtr mRecorder; - mozilla::RefPtr mSkiaGlue; + nsRefPtr mRecorder; + nsRefPtr mSkiaGlue; // Backend that we are compositing with. NONE, if no compositor has been // created yet. diff --git a/gfx/thebes/gfxQuartzNativeDrawing.cpp b/gfx/thebes/gfxQuartzNativeDrawing.cpp index 369160dcf51..62e33975fe7 100644 --- a/gfx/thebes/gfxQuartzNativeDrawing.cpp +++ b/gfx/thebes/gfxQuartzNativeDrawing.cpp @@ -64,7 +64,7 @@ gfxQuartzNativeDrawing::EndNativeDrawing() mBorrowedContext.Finish(); if (mTempDrawTarget) { - RefPtr source = mTempDrawTarget->Snapshot(); + nsRefPtr source = mTempDrawTarget->Snapshot(); AutoRestoreTransform autoRestore(mDrawTarget); mDrawTarget->SetTransform(Matrix()); diff --git a/gfx/thebes/gfxQuartzNativeDrawing.h b/gfx/thebes/gfxQuartzNativeDrawing.h index d584c1fb227..db463273c12 100644 --- a/gfx/thebes/gfxQuartzNativeDrawing.h +++ b/gfx/thebes/gfxQuartzNativeDrawing.h @@ -10,7 +10,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/BorrowedContext.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" class gfxQuartzNativeDrawing { typedef mozilla::gfx::DrawTarget DrawTarget; @@ -59,8 +59,8 @@ private: const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&) = delete; // Final destination context - mozilla::RefPtr mDrawTarget; - mozilla::RefPtr mTempDrawTarget; + nsRefPtr mDrawTarget; + nsRefPtr mTempDrawTarget; mozilla::gfx::BorrowedCGContext mBorrowedContext; mozilla::gfx::Rect mNativeRect; diff --git a/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.h b/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.h index 4b30b23899b..4d58651d331 100644 --- a/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.h +++ b/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.h @@ -6,7 +6,7 @@ #define GFXSHMCOWSURFACEWRAPPER #include "gfxReusableSurfaceWrapper.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" class gfxSharedImageSurface; @@ -56,7 +56,7 @@ public: Open(mozilla::layers::ISurfaceAllocator* aAllocator, const mozilla::ipc::Shmem& aShmem); private: - mozilla::RefPtr mAllocator; + nsRefPtr mAllocator; nsRefPtr mSurface; }; diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 5b0eb47d1d4..966f289e1ed 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -19,7 +19,7 @@ #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/gfx/Logging.h" #include "mozilla/Maybe.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Vector.h" #include "nsComponentManagerUtils.h" #include "nsIClipboardHelper.h" @@ -81,7 +81,7 @@ void mozilla_dump_image(void* bytes, int width, int height, int bytepp, break; } - RefPtr surf = + nsRefPtr surf = Factory::CreateWrappingDataSourceSurface((uint8_t*)bytes, strideBytes, IntSize(width, height), format); @@ -286,7 +286,7 @@ gfxUtils::UnpremultiplyDataSurface(DataSourceSurface* srcSurf, static bool MapSrcAndCreateMappedDest(DataSourceSurface* srcSurf, - RefPtr* out_destSurf, + nsRefPtr* out_destSurf, DataSourceSurface::MappedSurface* out_srcMap, DataSourceSurface::MappedSurface* out_destMap) { @@ -306,7 +306,7 @@ MapSrcAndCreateMappedDest(DataSourceSurface* srcSurf, } // Make our dest surface based on the src. - RefPtr destSurf = + nsRefPtr destSurf = Factory::CreateDataSourceSurfaceWithStride(srcSurf->GetSize(), srcSurf->GetFormat(), srcMap.mStride); @@ -330,12 +330,12 @@ MapSrcAndCreateMappedDest(DataSourceSurface* srcSurf, already_AddRefed gfxUtils::CreatePremultipliedDataSurface(DataSourceSurface* srcSurf) { - RefPtr destSurf; + nsRefPtr destSurf; DataSourceSurface::MappedSurface srcMap; DataSourceSurface::MappedSurface destMap; if (!MapSrcAndCreateMappedDest(srcSurf, &destSurf, &srcMap, &destMap)) { MOZ_ASSERT(false, "MapSrcAndCreateMappedDest failed."); - RefPtr surface(srcSurf); + nsRefPtr surface(srcSurf); return surface.forget(); } @@ -351,12 +351,12 @@ gfxUtils::CreatePremultipliedDataSurface(DataSourceSurface* srcSurf) already_AddRefed gfxUtils::CreateUnpremultipliedDataSurface(DataSourceSurface* srcSurf) { - RefPtr destSurf; + nsRefPtr destSurf; DataSourceSurface::MappedSurface srcMap; DataSourceSurface::MappedSurface destMap; if (!MapSrcAndCreateMappedDest(srcSurf, &destSurf, &srcMap, &destMap)) { MOZ_ASSERT(false, "MapSrcAndCreateMappedDest failed."); - RefPtr surface(srcSurf); + nsRefPtr surface(srcSurf); return surface.forget(); } @@ -449,7 +449,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable, IntSize size(int32_t(needed.Width()), int32_t(needed.Height())); - RefPtr target = + nsRefPtr target = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, aFormat); if (!target) { return nullptr; @@ -459,7 +459,7 @@ CreateSamplingRestrictedDrawable(gfxDrawable* aDrawable, tmpCtx->SetOp(OptimalFillOp()); aDrawable->Draw(tmpCtx, needed - needed.TopLeft(), true, Filter::LINEAR, 1.0, gfxMatrix::Translation(needed.TopLeft())); - RefPtr surface = target->Snapshot(); + nsRefPtr surface = target->Snapshot(); nsRefPtr drawable = new gfxSurfaceDrawable(surface, size, gfxMatrix::Translation(-needed.TopLeft())); return drawable.forget(); @@ -673,7 +673,7 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable, return false; } - RefPtr scaledDT = + nsRefPtr scaledDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(scaledImageSize, aFormat); if (!scaledDT) { return false; @@ -684,7 +684,7 @@ PrescaleAndTileDrawable(gfxDrawable* aDrawable, gfxRect gfxImageRect(aImageRect.x, aImageRect.y, aImageRect.width, aImageRect.height); aDrawable->Draw(tmpCtx, gfxImageRect, true, aFilter, 1.0, gfxMatrix()); - RefPtr scaledImage = scaledDT->Snapshot(); + nsRefPtr scaledImage = scaledDT->Snapshot(); { gfxContextMatrixAutoSaveRestore autoSR(aContext); @@ -818,7 +818,7 @@ ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion) static already_AddRefed PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion) { - RefPtr pb = aTarget->CreatePathBuilder(); + nsRefPtr pb = aTarget->CreatePathBuilder(); nsIntRegionRectIterator iter(aRegion); const IntRect* r; @@ -841,7 +841,7 @@ ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion) return; } - RefPtr path = PathFromRegionInternal(aTarget, aRegion); + nsRefPtr path = PathFromRegionInternal(aTarget, aRegion); aTarget->PushClip(path); } @@ -1139,7 +1139,7 @@ gfxUtils::CopySurfaceToDataSourceSurfaceWithFormat(SourceSurface* aSurface, // a single readback due to the unavoidable GetDataSurface() call. Using // CreateOffscreenContentDrawTarget ensures the conversion happens on the // GPU. - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(aSurface->GetSize(), aFormat); if (!dt) { gfxWarning() << "gfxUtils::CopySurfaceToDataSourceSurfaceWithFormat failed in CreateOffscreenContentDrawTarget"; @@ -1152,7 +1152,7 @@ gfxUtils::CopySurfaceToDataSourceSurfaceWithFormat(SourceSurface* aSurface, // generally more optimized. dt->DrawSurface(aSurface, bounds, bounds, DrawSurfaceOptions(), DrawOptions(1.0f, CompositionOp::OP_OVER)); - RefPtr surface = dt->Snapshot(); + nsRefPtr surface = dt->Snapshot(); return surface->GetDataSurface(); } @@ -1171,14 +1171,14 @@ gfxUtils::CopySurfaceToDataSourceSurfaceWithFormat(SourceSurface* aSurface, // been passed actually IS in main memory anyway. For these reasons it's most // likely best to create a data wrapping DrawTarget here to do the format // conversion. - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(aSurface->GetSize(), aFormat); DataSourceSurface::MappedSurface map; if (!dataSurface || !dataSurface->Map(DataSourceSurface::MapType::READ_WRITE, &map)) { return nullptr; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), @@ -1240,7 +1240,7 @@ EncodeSourceSurfaceInternal(SourceSurface* aSurface, } const Size floatSize(size.width, size.height); - RefPtr dataSurface; + nsRefPtr dataSurface; if (aSurface->GetFormat() != SurfaceFormat::B8G8R8A8) { // FIXME bug 995807 (B8G8R8X8), bug 831898 (R5G6B5) dataSurface = @@ -1442,7 +1442,7 @@ gfxUtils::WriteAsPNG(DrawTarget* aDT, const nsAString& aFile) /* static */ void gfxUtils::WriteAsPNG(DrawTarget* aDT, const char* aFile) { - RefPtr surface = aDT->Snapshot(); + nsRefPtr surface = aDT->Snapshot(); if (surface) { WriteAsPNG(surface, aFile); } else { @@ -1457,7 +1457,7 @@ gfxUtils::WriteAsPNG(nsIPresShell* aShell, const char* aFile) nsRect r(0, 0, aShell->GetPresContext()->DevPixelsToAppUnits(width), aShell->GetPresContext()->DevPixelsToAppUnits(height)); - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(width, height), SurfaceFormat::B8G8R8A8); NS_ENSURE_TRUE(dt, /*void*/); @@ -1483,7 +1483,7 @@ gfxUtils::GetAsDataURI(SourceSurface* aSurface) /* static */ void gfxUtils::DumpAsDataURI(DrawTarget* aDT, FILE* aFile) { - RefPtr surface = aDT->Snapshot(); + nsRefPtr surface = aDT->Snapshot(); if (surface) { DumpAsDataURI(surface, aFile); } else { @@ -1520,7 +1520,7 @@ gfxUtils::GetAsLZ4Base64Str(DataSourceSurface* aSourceSurface) /* static */ nsCString gfxUtils::GetAsDataURI(DrawTarget* aDT) { - RefPtr surface = aDT->Snapshot(); + nsRefPtr surface = aDT->Snapshot(); if (surface) { return EncodeSourceSurfaceAsPNGURI(surface); } else { @@ -1539,7 +1539,7 @@ gfxUtils::CopyAsDataURI(SourceSurface* aSurface) /* static */ void gfxUtils::CopyAsDataURI(DrawTarget* aDT) { - RefPtr surface = aDT->Snapshot(); + nsRefPtr surface = aDT->Snapshot(); if (surface) { CopyAsDataURI(surface); } else { diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 9f6a7ca179f..1e0235986d2 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -9,7 +9,7 @@ #include "gfxTypes.h" #include "imgIContainer.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsColor.h" #include "nsPrintfCString.h" #include "mozilla/gfx/Rect.h" diff --git a/gfx/thebes/gfxWindowsNativeDrawing.cpp b/gfx/thebes/gfxWindowsNativeDrawing.cpp index e6f7282f3bb..a2a22a01a55 100644 --- a/gfx/thebes/gfxWindowsNativeDrawing.cpp +++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp @@ -269,7 +269,7 @@ gfxWindowsNativeDrawing::PaintToContext() NS_ERROR("Alpha recovery failure"); return; } - RefPtr source = + nsRefPtr source = Factory::CreateWrappingDataSourceSurface(black->Data(), black->Stride(), black->GetSize(), diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index bfc0adda8eb..1d51152c238 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -452,11 +452,11 @@ gfxWindowsPlatform::InitDWriteSupport() // I need a direct pointer to be able to cast to IUnknown**, I also need to // remember to release this because the nsRefPtr will AddRef it. - RefPtr factory; + nsRefPtr factory; HRESULT hr = createDWriteFactory( DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), - (IUnknown **)((IDWriteFactory **)byRef(factory))); + (IUnknown **)((IDWriteFactory **)getter_AddRefs(factory))); if (FAILED(hr) || !factory) { return false; } @@ -1638,7 +1638,7 @@ gfxWindowsPlatform::GetDXGIAdapter() return nullptr; } - hr = factory1->EnumAdapters1(0, byRef(mAdapter)); + hr = factory1->EnumAdapters1(0, getter_AddRefs(mAdapter)); if (FAILED(hr)) { // We should return and not accelerate if we can't obtain // an adapter. @@ -1864,7 +1864,7 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma } } - RefPtr texture; + nsRefPtr texture; D3D11_TEXTURE2D_DESC desc; desc.Width = 32; desc.Height = 32; @@ -1877,7 +1877,7 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma desc.CPUAccessFlags = 0; desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX; desc.BindFlags = bindflags; - if (FAILED(device->CreateTexture2D(&desc, NULL, byRef(texture)))) { + if (FAILED(device->CreateTexture2D(&desc, NULL, getter_AddRefs(texture)))) { return false; } @@ -1908,10 +1908,10 @@ bool DoesD3D11TextureSharingWorkInternal(ID3D11Device *device, DXGI_FORMAT forma return false; } - RefPtr sharedView; + nsRefPtr sharedView; // This if(FAILED()) is the one that actually fails on systems affected by bug 1083071. - if (FAILED(device->CreateShaderResourceView(sharedTexture, NULL, byRef(sharedView)))) { + if (FAILED(device->CreateShaderResourceView(sharedTexture, NULL, getter_AddRefs(sharedView)))) { gfxCriticalError(CriticalLog::DefaultOptions(false)) << "CreateShaderResourceView failed for format" << format; return false; } @@ -2012,7 +2012,7 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreationHelper( // to prevent bug 1092260. IE 11 also uses this flag. D3D11_CREATE_DEVICE_BGRA_SUPPORT | D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS, mFeatureLevels.Elements(), mFeatureLevels.Length(), - D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr); + D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr); } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) { return false; } @@ -2022,7 +2022,7 @@ gfxWindowsPlatform::AttemptD3D11DeviceCreationHelper( FeatureStatus gfxWindowsPlatform::AttemptD3D11DeviceCreation() { - RefPtr adapter = GetDXGIAdapter(); + nsRefPtr adapter = GetDXGIAdapter(); if (!adapter) { return FeatureStatus::Unavailable; } @@ -2071,7 +2071,7 @@ gfxWindowsPlatform::AttemptWARPDeviceCreationHelper( // to prevent bug 1092260. IE 11 also uses this flag. D3D11_CREATE_DEVICE_BGRA_SUPPORT, mFeatureLevels.Elements(), mFeatureLevels.Length(), - D3D11_SDK_VERSION, byRef(mD3D11Device), nullptr, nullptr); + D3D11_SDK_VERSION, getter_AddRefs(mD3D11Device), nullptr, nullptr); aReporterWARP.SetSuccessful(); } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) { @@ -2140,7 +2140,7 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreationHelper( aAdapter, mIsWARP ? D3D_DRIVER_TYPE_WARP : D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT, mFeatureLevels.Elements(), mFeatureLevels.Length(), - D3D11_SDK_VERSION, byRef(mD3D11ContentDevice), nullptr, nullptr); + D3D11_SDK_VERSION, getter_AddRefs(mD3D11ContentDevice), nullptr, nullptr); } MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) { return false; @@ -2151,7 +2151,7 @@ gfxWindowsPlatform::AttemptD3D11ContentDeviceCreationHelper( FeatureStatus gfxWindowsPlatform::AttemptD3D11ContentDeviceCreation() { - RefPtr adapter; + nsRefPtr adapter; if (!mIsWARP) { adapter = GetDXGIAdapter(); if (!adapter) { @@ -2202,7 +2202,7 @@ gfxWindowsPlatform::AttemptD3D11ImageBridgeDeviceCreation() sD3D11CreateDeviceFn(GetDXGIAdapter(), D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_BGRA_SUPPORT, mFeatureLevels.Elements(), mFeatureLevels.Length(), - D3D11_SDK_VERSION, byRef(mD3D11ImageBridgeDevice), nullptr, nullptr); + D3D11_SDK_VERSION, getter_AddRefs(mD3D11ImageBridgeDevice), nullptr, nullptr); } MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { return FeatureStatus::Crashed; } @@ -2532,7 +2532,7 @@ gfxWindowsPlatform::InitializeD2D1() bool gfxWindowsPlatform::CreateD3D11DecoderDeviceHelper( - IDXGIAdapter1* aAdapter, RefPtr& aDevice, HRESULT& aResOut) + IDXGIAdapter1* aAdapter, nsRefPtr& aDevice, HRESULT& aResOut) { MOZ_SEH_TRY{ aResOut = @@ -2540,7 +2540,7 @@ gfxWindowsPlatform::CreateD3D11DecoderDeviceHelper( aAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr, D3D11_CREATE_DEVICE_VIDEO_SUPPORT, mFeatureLevels.Elements(), mFeatureLevels.Length(), - D3D11_SDK_VERSION, byRef(aDevice), nullptr, nullptr); + D3D11_SDK_VERSION, getter_AddRefs(aDevice), nullptr, nullptr); } MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { return false; @@ -2556,13 +2556,13 @@ gfxWindowsPlatform::CreateD3D11DecoderDevice() return nullptr; } - RefPtr adapter = GetDXGIAdapter(); + nsRefPtr adapter = GetDXGIAdapter(); if (!adapter) { return nullptr; } - RefPtr device; + nsRefPtr device; HRESULT hr; if (!CreateD3D11DecoderDeviceHelper(adapter, device, hr)) { diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index e55bf9af34e..eb5671e68fe 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -28,7 +28,7 @@ #include "nsTArray.h" #include "nsDataHashtable.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include #include @@ -253,7 +253,7 @@ public: // Create a D3D11 device to be used for DXVA decoding. already_AddRefed CreateD3D11DecoderDevice(); bool CreateD3D11DecoderDeviceHelper( - IDXGIAdapter1* aAdapter, mozilla::RefPtr& aDevice, + IDXGIAdapter1* aAdapter, nsRefPtr& aDevice, HRESULT& aResOut); mozilla::layers::ReadbackManagerD3D11* GetReadbackManager(); @@ -352,13 +352,13 @@ private: nsRefPtr mRenderingParams[TEXT_RENDERING_COUNT]; DWRITE_MEASURING_MODE mMeasuringMode; #endif - mozilla::RefPtr mAdapter; + nsRefPtr mAdapter; nsRefPtr mDeviceManager; - mozilla::RefPtr mD3D10Device; - mozilla::RefPtr mD3D11Device; - mozilla::RefPtr mD3D11ContentDevice; - mozilla::RefPtr mD3D11ImageBridgeDevice; - mozilla::RefPtr mD3D11ReadbackManager; + nsRefPtr mD3D10Device; + nsRefPtr mD3D11Device; + nsRefPtr mD3D11ContentDevice; + nsRefPtr mD3D11ImageBridgeDevice; + nsRefPtr mD3D11ReadbackManager; bool mIsWARP; bool mHasDeviceReset; bool mHasFakeDeviceReset; diff --git a/gfx/thebes/gfxXlibNativeRenderer.cpp b/gfx/thebes/gfxXlibNativeRenderer.cpp index 28b44867f27..42dab94383d 100644 --- a/gfx/thebes/gfxXlibNativeRenderer.cpp +++ b/gfx/thebes/gfxXlibNativeRenderer.cpp @@ -574,7 +574,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size, native.mType = NativeSurfaceType::CAIRO_SURFACE; native.mSurface = tempXlibSurface; native.mSize = size; - RefPtr sourceSurface = + nsRefPtr sourceSurface = drawTarget->CreateSourceSurfaceFromNativeSurface(native); if (sourceSurface) { drawTarget->DrawSurface(sourceSurface, @@ -616,7 +616,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size, native.mType = NativeSurfaceType::CAIRO_SURFACE; native.mSurface = paintSurface->CairoSurface(); native.mSize = size; - RefPtr sourceSurface = + nsRefPtr sourceSurface = drawTarget->CreateSourceSurfaceFromNativeSurface(native); if (sourceSurface) { drawTarget->DrawSurface(sourceSurface, diff --git a/hal/gonk/GonkHal.cpp b/hal/gonk/GonkHal.cpp index 9e51ffe465c..71d65c1b3de 100644 --- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -53,7 +53,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/FileUtils.h" #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "mozilla/Preferences.h" diff --git a/hal/gonk/GonkSwitch.cpp b/hal/gonk/GonkSwitch.cpp index 1e8ee81f719..33ac19e3a52 100644 --- a/hal/gonk/GonkSwitch.cpp +++ b/hal/gonk/GonkSwitch.cpp @@ -22,7 +22,7 @@ #include "Hal.h" #include "HalLog.h" #include "mozilla/FileUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Monitor.h" #include "nsPrintfCString.h" #include "nsXULAppAPI.h" @@ -210,7 +210,7 @@ protected: }; -typedef nsTArray > SwitchHandlerArray; +typedef nsTArray > SwitchHandlerArray; class SwitchEventRunnable : public nsRunnable { @@ -336,7 +336,7 @@ private: // (from IsHeadphoneEventFromInputDev) void Init() { - RefPtr switchHeadPhone = + nsRefPtr switchHeadPhone = new SwitchHandlerHeadphone(SWITCH_HEADSET_DEVPATH); // If the initial state is unknown, it means the headphone event is from input dev @@ -383,7 +383,7 @@ private: } }; -static RefPtr sSwitchObserver; +static nsRefPtr sSwitchObserver; static void InitializeResourceIfNeed() @@ -473,7 +473,7 @@ bool IsHeadphoneEventFromInputDev() { // Instead of calling InitializeResourceIfNeed, create new SwitchEventObserver // to prevent calling RegisterUeventListener in main thread. - RefPtr switchObserver = new SwitchEventObserver(); + nsRefPtr switchObserver = new SwitchEventObserver(); return switchObserver->GetHeadphonesFromInputDev(); } diff --git a/image/ClippedImage.cpp b/image/ClippedImage.cpp index 2920c5a9ea6..fd0bc4cd1ca 100644 --- a/image/ClippedImage.cpp +++ b/image/ClippedImage.cpp @@ -12,7 +12,7 @@ #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/Move.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Pair.h" #include "mozilla/Tuple.h" @@ -65,7 +65,7 @@ public: already_AddRefed Surface() const { - RefPtr surf(mSurface); + nsRefPtr surf(mSurface); return surf.forget(); } @@ -81,7 +81,7 @@ public: } private: - RefPtr mSurface; + nsRefPtr mSurface; const nsIntSize mSize; Maybe mSVGContext; const float mFrame; @@ -239,7 +239,7 @@ ClippedImage::GetFrame(uint32_t aWhichFrame, uint32_t aFlags) { DrawResult result; - RefPtr surface; + nsRefPtr surface; Tie(result, surface) = GetFrameInternal(mClip.Size(), Nothing(), aWhichFrame, aFlags); return surface.forget(); } @@ -254,14 +254,14 @@ ClippedImage::GetFrameAtSize(const IntSize& aSize, return GetFrame(aWhichFrame, aFlags); } -Pair> +Pair> ClippedImage::GetFrameInternal(const nsIntSize& aSize, const Maybe& aSVGContext, uint32_t aWhichFrame, uint32_t aFlags) { if (!ShouldClip()) { - RefPtr surface = InnerImage()->GetFrame(aWhichFrame, aFlags); + nsRefPtr surface = InnerImage()->GetFrame(aWhichFrame, aFlags); return MakePair(surface ? DrawResult::SUCCESS : DrawResult::NOT_READY, Move(surface)); } @@ -271,12 +271,12 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize, !mCachedSurface->Matches(aSize, aSVGContext, frameToDraw, aFlags) || mCachedSurface->NeedsRedraw()) { // Create a surface to draw into. - RefPtr target = gfxPlatform::GetPlatform()-> + nsRefPtr target = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(IntSize(aSize.width, aSize.height), SurfaceFormat::B8G8R8A8); if (!target) { NS_ERROR("Could not create a DrawTarget"); - return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr()); + return MakePair(DrawResult::TEMPORARY_ERROR, nsRefPtr()); } nsRefPtr ctx = new gfxContext(target); @@ -302,7 +302,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize, } MOZ_ASSERT(mCachedSurface, "Should have a cached surface now"); - RefPtr surface = mCachedSurface->Surface(); + nsRefPtr surface = mCachedSurface->Surface(); return MakePair(mCachedSurface->GetDrawResult(), Move(surface)); } @@ -365,7 +365,7 @@ ClippedImage::Draw(gfxContext* aContext, // Create a temporary surface containing a single tile of this image. // GetFrame will call DrawSingleTile internally. DrawResult result; - RefPtr surface; + nsRefPtr surface; Tie(result, surface) = GetFrameInternal(aSize, aSVGContext, aWhichFrame, aFlags); if (!surface) { diff --git a/image/ClippedImage.h b/image/ClippedImage.h index d9a69497b7c..93c0da643c5 100644 --- a/image/ClippedImage.h +++ b/image/ClippedImage.h @@ -9,7 +9,7 @@ #include "ImageWrapper.h" #include "mozilla/gfx/2D.h" #include "mozilla/Maybe.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { namespace image { @@ -68,7 +68,7 @@ protected: virtual ~ClippedImage(); private: - Pair> + Pair> GetFrameInternal(const nsIntSize& aSize, const Maybe& aSVGContext, uint32_t aWhichFrame, diff --git a/image/Decoder.h b/image/Decoder.h index 73282da8b06..07ed423f1c8 100644 --- a/image/Decoder.h +++ b/image/Decoder.h @@ -8,7 +8,7 @@ #include "FrameAnimator.h" #include "RasterImage.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "DecodePool.h" #include "DecoderFlags.h" #include "Downscaler.h" diff --git a/image/DynamicImage.cpp b/image/DynamicImage.cpp index dd7c89015a4..c3e0c93aa14 100644 --- a/image/DynamicImage.cpp +++ b/image/DynamicImage.cpp @@ -7,7 +7,7 @@ #include "gfxPlatform.h" #include "gfxUtils.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "ImageRegion.h" #include "Orientation.h" #include "SVGImageContext.h" @@ -178,7 +178,7 @@ DynamicImage::GetFrameAtSize(const IntSize& aSize, uint32_t aWhichFrame, uint32_t aFlags) { - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8); if (!dt) { gfxWarning() << diff --git a/image/FrozenImage.h b/image/FrozenImage.h index 3f87f304366..6e6b118dfa0 100644 --- a/image/FrozenImage.h +++ b/image/FrozenImage.h @@ -8,7 +8,7 @@ #include "ImageWrapper.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { namespace image { diff --git a/image/ImageOps.cpp b/image/ImageOps.cpp index 0e7833e2583..bf0f4a94fee 100644 --- a/image/ImageOps.cpp +++ b/image/ImageOps.cpp @@ -135,7 +135,7 @@ ImageOps::DecodeToSurface(nsIInputStream* aInputStream, return nullptr; } - RefPtr surface = frame->GetSurface(); + nsRefPtr surface = frame->GetSurface(); if (!surface) { return nullptr; } diff --git a/image/ImageWrapper.cpp b/image/ImageWrapper.cpp index 3289678669e..3ef7869331f 100644 --- a/image/ImageWrapper.cpp +++ b/image/ImageWrapper.cpp @@ -5,7 +5,7 @@ #include "ImageWrapper.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "Orientation.h" #include "mozilla/MemoryReporting.h" diff --git a/image/OrientedImage.cpp b/image/OrientedImage.cpp index 39ffdbf38ec..4399051e9e2 100644 --- a/image/OrientedImage.cpp +++ b/image/OrientedImage.cpp @@ -96,7 +96,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame, } // Create a surface to draw into. - RefPtr target = + nsRefPtr target = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(size, surfaceFormat); if (!target) { @@ -106,7 +106,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame, // Create our drawable. - RefPtr innerSurface = + nsRefPtr innerSurface = InnerImage()->GetFrame(aWhichFrame, aFlags); NS_ENSURE_TRUE(innerSurface, nullptr); nsRefPtr drawable = diff --git a/image/OrientedImage.h b/image/OrientedImage.h index 5db5d70f411..14670b91493 100644 --- a/image/OrientedImage.h +++ b/image/OrientedImage.h @@ -8,7 +8,7 @@ #include "ImageWrapper.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "Orientation.h" namespace mozilla { diff --git a/image/ProgressTracker.h b/image/ProgressTracker.h index 1cb0c116d84..951f5144ba4 100644 --- a/image/ProgressTracker.h +++ b/image/ProgressTracker.h @@ -9,7 +9,7 @@ #include "CopyOnWrite.h" #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/WeakPtr.h" #include "nsDataHashtable.h" #include "nsCOMPtr.h" diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 76ab99b681c..d8bec3392c5 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -35,7 +35,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/DebugOnly.h" #include "mozilla/Likely.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Move.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Services.h" @@ -495,7 +495,7 @@ RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags) // rect, implicitly padding the frame out to the image's size. IntSize size(mSize.width, mSize.height); - RefPtr surf = + nsRefPtr surf = Factory::CreateDataSourceSurface(size, SurfaceFormat::B8G8R8A8, /* aZero = */ true); @@ -509,7 +509,7 @@ RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags) return nullptr; } - RefPtr target = + nsRefPtr target = Factory::CreateDrawTargetForData(BackendType::CAIRO, mapping.mData, size, @@ -527,7 +527,7 @@ RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags) target->FillRect(rect, ColorPattern(frameRef->SinglePixelColor()), DrawOptions(1.0f, CompositionOp::OP_SOURCE)); } else { - RefPtr srcSurf = frameRef->GetSurface(); + nsRefPtr srcSurf = frameRef->GetSurface(); if (!srcSurf) { RecoverFromInvalidFrames(mSize, aFlags); return nullptr; @@ -561,7 +561,7 @@ RasterImage::GetFrameAtSize(const IntSize& aSize, return GetFrameInternal(aSize, aWhichFrame, aFlags).second().forget(); } -Pair> +Pair> RasterImage::GetFrameInternal(const IntSize& aSize, uint32_t aWhichFrame, uint32_t aFlags) @@ -569,15 +569,15 @@ RasterImage::GetFrameInternal(const IntSize& aSize, MOZ_ASSERT(aWhichFrame <= FRAME_MAX_VALUE); if (aSize.IsEmpty()) { - return MakePair(DrawResult::BAD_ARGS, RefPtr()); + return MakePair(DrawResult::BAD_ARGS, nsRefPtr()); } if (aWhichFrame > FRAME_MAX_VALUE) { - return MakePair(DrawResult::BAD_ARGS, RefPtr()); + return MakePair(DrawResult::BAD_ARGS, nsRefPtr()); } if (mError) { - return MakePair(DrawResult::BAD_IMAGE, RefPtr()); + return MakePair(DrawResult::BAD_IMAGE, nsRefPtr()); } // Get the frame. If it's not there, it's probably the caller's fault for @@ -587,12 +587,12 @@ RasterImage::GetFrameInternal(const IntSize& aSize, LookupFrame(GetRequestedFrameIndex(aWhichFrame), aSize, aFlags); if (!frameRef) { // The OS threw this frame away and we couldn't redecode it. - return MakePair(DrawResult::TEMPORARY_ERROR, RefPtr()); + return MakePair(DrawResult::TEMPORARY_ERROR, nsRefPtr()); } // If this frame covers the entire image, we can just reuse its existing // surface. - RefPtr frameSurf; + nsRefPtr frameSurf; if (!frameRef->NeedsPadding() && frameRef->GetSize() == aSize) { frameSurf = frameRef->GetSurface(); @@ -620,7 +620,7 @@ RasterImage::GetCurrentImage(ImageContainer* aContainer, uint32_t aFlags) MOZ_ASSERT(aContainer); DrawResult drawResult; - RefPtr surface; + nsRefPtr surface; Tie(drawResult, surface) = GetFrameInternal(mSize, FRAME_CURRENT, aFlags | FLAG_ASYNC_NOTIFY); if (!surface) { diff --git a/image/RasterImage.h b/image/RasterImage.h index a5420cfc1f3..d0222fd092c 100644 --- a/image/RasterImage.h +++ b/image/RasterImage.h @@ -259,7 +259,7 @@ private: already_AddRefed CopyFrame(uint32_t aWhichFrame, uint32_t aFlags); - Pair> + Pair> GetFrameInternal(const gfx::IntSize& aSize, uint32_t aWhichFrame, uint32_t aFlags); diff --git a/image/SourceBuffer.h b/image/SourceBuffer.h index 66458823ec0..d4b553e933e 100644 --- a/image/SourceBuffer.h +++ b/image/SourceBuffer.h @@ -16,7 +16,7 @@ #include "mozilla/Mutex.h" #include "mozilla/Move.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/RefCounted.h" #include "mozilla/UniquePtr.h" #include "mozilla/nsRefPtr.h" diff --git a/image/SurfaceCache.cpp b/image/SurfaceCache.cpp index 75241de0b93..a7304ded0f2 100644 --- a/image/SurfaceCache.cpp +++ b/image/SurfaceCache.cpp @@ -17,7 +17,7 @@ #include "mozilla/Move.h" #include "mozilla/Mutex.h" #include "mozilla/Pair.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/StaticPtr.h" #include "mozilla/Tuple.h" #include "nsIMemoryReporter.h" diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp index b458073c47b..3161e37f182 100644 --- a/image/VectorImage.cpp +++ b/image/VectorImage.cpp @@ -15,7 +15,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/dom/SVGSVGElement.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsIDOMEvent.h" #include "nsIPresShell.h" #include "nsIStreamListener.h" @@ -726,7 +726,7 @@ VectorImage::GetFrameAtSize(const IntSize& aSize, // Make our surface the size of what will ultimately be drawn to it. // (either the full image size, or the restricted region) - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(aSize, SurfaceFormat::B8G8R8A8); if (!dt) { NS_ERROR("Could not create a DrawTarget"); @@ -860,7 +860,7 @@ VectorImage::Draw(gfxContext* aContext, // Draw. if (result) { - RefPtr surface = result.DrawableRef()->GetSurface(); + nsRefPtr surface = result.DrawableRef()->GetSurface(); if (surface) { nsRefPtr svgDrawable = new gfxSurfaceDrawable(surface, result.DrawableRef()->GetSize()); @@ -927,7 +927,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams) // Take a strong reference to the frame's surface and make sure it hasn't // already been purged by the operating system. - RefPtr surface = frame->GetSurface(); + nsRefPtr surface = frame->GetSurface(); if (!surface) { return Show(svgDrawable, aParams); } diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp index f5a6fdc8d67..2432ff9fa5e 100644 --- a/image/imgFrame.cpp +++ b/image/imgFrame.cpp @@ -58,7 +58,7 @@ CreateLockedSurface(VolatileBuffer* vbuf, MOZ_ASSERT(!vbufptr->WasBufferPurged(), "Expected image data!"); int32_t stride = VolatileSurfaceStride(size, format); - RefPtr surf = + nsRefPtr surf = Factory::CreateWrappingDataSourceSurface(*vbufptr, stride, size, format); if (!surf) { delete vbufptr; @@ -73,7 +73,7 @@ static already_AddRefed AllocateBufferForImage(const IntSize& size, SurfaceFormat format) { int32_t stride = VolatileSurfaceStride(size, format); - RefPtr buf = new VolatileBuffer(); + nsRefPtr buf = new VolatileBuffer(); if (buf->Init(stride * size.height, 1 << gfxAlphaRecovery::GoodAlignmentLog2())) { return buf.forget(); @@ -255,7 +255,7 @@ imgFrame::InitWithDrawable(gfxDrawable* aDrawable, mFormat = aFormat; mPaletteDepth = 0; - RefPtr target; + nsRefPtr target; bool canUseDataSurface = gfxPlatform::GetPlatform()->CanRenderContentToDataSurface(); @@ -397,13 +397,13 @@ imgFrame::Optimize() if (mFormat != SurfaceFormat::B8G8R8A8 && optFormat == SurfaceFormat::R5G6B5) { - RefPtr buf = + nsRefPtr buf = AllocateBufferForImage(mSize, optFormat); if (!buf) { return NS_OK; } - RefPtr surf = + nsRefPtr surf = CreateLockedSurface(buf, mSize, optFormat); if (!surf) { return NS_ERROR_OUT_OF_MEMORY; @@ -415,7 +415,7 @@ imgFrame::Optimize() return NS_ERROR_FAILURE; } - RefPtr target = + nsRefPtr target = Factory::CreateDrawTargetForData(BackendType::CAIRO, mapping.mData, mSize, @@ -508,7 +508,7 @@ imgFrame::SurfaceForDrawing(bool aDoPadding, // Create a temporary surface. // Give this surface an alpha channel because there are // transparent pixels in the padding or undecoded area - RefPtr target = + nsRefPtr target = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(size, SurfaceFormat::B8G8R8A8); if (!target) { @@ -527,7 +527,7 @@ imgFrame::SurfaceForDrawing(bool aDoPadding, target->FillRect(ToRect(aRegion.Intersect(available).Rect()), pattern); } - RefPtr newsurf = target->Snapshot(); + nsRefPtr newsurf = target->Snapshot(); return SurfaceWithFormat(new gfxSurfaceDrawable(newsurf, size), target->GetFormat()); } @@ -571,14 +571,14 @@ bool imgFrame::Draw(gfxContext* aContext, const ImageRegion& aRegion, if (mSinglePixelColor.a == 0.0) { return true; } - RefPtr dt = aContext->GetDrawTarget(); + nsRefPtr dt = aContext->GetDrawTarget(); dt->FillRect(ToRect(aRegion.Rect()), ColorPattern(mSinglePixelColor), DrawOptions(1.0f, aContext->CurrentOp())); return true; } - RefPtr surf = GetSurfaceInternal(); + nsRefPtr surf = GetSurfaceInternal(); if (!surf && !mSinglePixel) { return false; } @@ -904,7 +904,7 @@ imgFrame::GetSurfaceInternal() if (mOptSurface) { if (mOptSurface->IsValid()) { - RefPtr surf(mOptSurface); + nsRefPtr surf(mOptSurface); return surf.forget(); } else { mOptSurface = nullptr; @@ -912,7 +912,7 @@ imgFrame::GetSurfaceInternal() } if (mImageSurface) { - RefPtr surf(mImageSurface); + nsRefPtr surf(mImageSurface); return surf.forget(); } diff --git a/image/imgFrame.h b/image/imgFrame.h index 228a25e6549..c21eca0265e 100644 --- a/image/imgFrame.h +++ b/image/imgFrame.h @@ -322,10 +322,10 @@ private: // data mutable Monitor mMonitor; - RefPtr mImageSurface; - RefPtr mOptSurface; + nsRefPtr mImageSurface; + nsRefPtr mOptSurface; - RefPtr mVBuf; + nsRefPtr mVBuf; VolatileBufferPtr mVBufPtr; nsIntRect mDecoded; diff --git a/image/imgIContainer.idl b/image/imgIContainer.idl index c190494ca6a..1bf15aa6a29 100644 --- a/image/imgIContainer.idl +++ b/image/imgIContainer.idl @@ -13,7 +13,7 @@ #include "gfxRect.h" #include "mozilla/gfx/2D.h" #include "mozilla/Maybe.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsRect.h" #include "nsSize.h" #include "limits.h" diff --git a/image/imgTools.cpp b/image/imgTools.cpp index 6cbe950fc37..83618527b81 100644 --- a/image/imgTools.cpp +++ b/image/imgTools.cpp @@ -8,7 +8,7 @@ #include "gfxUtils.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" @@ -161,12 +161,12 @@ imgTools::EncodeImage(imgIContainer* aContainer, nsIInputStream** aStream) { // Use frame 0 from the image container. - RefPtr frame = + nsRefPtr frame = aContainer->GetFrame(imgIContainer::FRAME_FIRST, imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - RefPtr dataSurface; + nsRefPtr dataSurface; if (frame->GetFormat() == SurfaceFormat::B8G8R8A8) { dataSurface = frame->GetDataSurface(); @@ -210,14 +210,14 @@ imgTools::EncodeScaledImage(imgIContainer* aContainer, aScaledHeight == 0 ? imageHeight : aScaledHeight); // Use frame 0 from the image container. - RefPtr frame = + nsRefPtr frame = aContainer->GetFrameAtSize(scaledSize, imgIContainer::FRAME_FIRST, imgIContainer::FLAG_HIGH_QUALITY_SCALING | imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(scaledSize, SurfaceFormat::B8G8R8A8); if (NS_WARN_IF(!dataSurface)) { return NS_ERROR_FAILURE; @@ -228,7 +228,7 @@ imgTools::EncodeScaledImage(imgIContainer* aContainer, return NS_ERROR_FAILURE; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), @@ -274,7 +274,7 @@ imgTools::EncodeCroppedImage(imgIContainer* aContainer, } // Use frame 0 from the image container. - RefPtr frame = + nsRefPtr frame = aContainer->GetFrame(imgIContainer::FRAME_FIRST, imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); @@ -294,7 +294,7 @@ imgTools::EncodeCroppedImage(imgIContainer* aContainer, NS_ENSURE_ARG(frameWidth >= aOffsetX + aWidth && frameHeight >= aOffsetY + aHeight); - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(IntSize(aWidth, aHeight), SurfaceFormat::B8G8R8A8, /* aZero = */ true); @@ -307,7 +307,7 @@ imgTools::EncodeCroppedImage(imgIContainer* aContainer, return NS_ERROR_FAILURE; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), diff --git a/ipc/dbus/DBusUtils.h b/ipc/dbus/DBusUtils.h index 42e046d1ed5..fdf24a8a1e7 100644 --- a/ipc/dbus/DBusUtils.h +++ b/ipc/dbus/DBusUtils.h @@ -19,7 +19,7 @@ #ifndef mozilla_ipc_dbus_dbusutils_h__ #define mozilla_ipc_dbus_dbusutils_h__ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" // LOGE and free a D-Bus error // Using #define so that __FUNCTION__ resolves usefully diff --git a/ipc/netd/Netd.cpp b/ipc/netd/Netd.cpp index 8eeb7307bd7..d2196da1373 100644 --- a/ipc/netd/Netd.cpp +++ b/ipc/netd/Netd.cpp @@ -16,7 +16,7 @@ #include "nsAutoPtr.h" #include "nsString.h" #include "nsThreadUtils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Snprintf.h" #define NETD_LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Gonk", args) @@ -26,8 +26,8 @@ namespace { -mozilla::RefPtr gNetdClient; -mozilla::RefPtr gNetdConsumer; +nsRefPtr gNetdClient; +nsRefPtr gNetdConsumer; class StopNetdConsumer : public nsRunnable { public: diff --git a/ipc/ril/RilSocket.cpp b/ipc/ril/RilSocket.cpp index 017a0905e85..e54643e42a4 100644 --- a/ipc/ril/RilSocket.cpp +++ b/ipc/ril/RilSocket.cpp @@ -8,7 +8,7 @@ #include #include "mozilla/dom/workers/Workers.h" #include "mozilla/ipc/UnixSocketConnector.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR #include "nsXULAppAPI.h" #include "RilSocketConsumer.h" @@ -77,7 +77,7 @@ private: * directly from consumer thread. All non-consumer-thread accesses should * happen with mIO as container. */ - RefPtr mRilSocket; + nsRefPtr mRilSocket; /** * If true, do not requeue whatever task we're running diff --git a/ipc/unixsocket/ListenSocket.cpp b/ipc/unixsocket/ListenSocket.cpp index 79b23848fe1..2cf6c92b7e2 100644 --- a/ipc/unixsocket/ListenSocket.cpp +++ b/ipc/unixsocket/ListenSocket.cpp @@ -9,7 +9,7 @@ #include "ConnectionOrientedSocket.h" #include "DataSocket.h" #include "ListenSocketConsumer.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR #include "nsXULAppAPI.h" #include "UnixSocketConnector.h" diff --git a/ipc/unixsocket/StreamSocket.cpp b/ipc/unixsocket/StreamSocket.cpp index be274a2ac4c..b883ad9b671 100644 --- a/ipc/unixsocket/StreamSocket.cpp +++ b/ipc/unixsocket/StreamSocket.cpp @@ -6,7 +6,7 @@ #include "StreamSocket.h" #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR #include "nsXULAppAPI.h" #include "StreamSocketConsumer.h" diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 5b1f394236b..030bfb988f7 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -332,7 +332,7 @@ IterPerformanceStats(JSContext* cx, continue; } js::AutoCompartment autoCompartment(cx, compartment); - mozilla::RefPtr group = compartment->performanceMonitoring.getSharedGroup(cx); + nsRefPtr group = compartment->performanceMonitoring.getSharedGroup(cx); if (group->data.ticks == 0) { // Don't report compartments that have never been used. continue; @@ -369,12 +369,12 @@ IterPerformanceStats(JSContext* cx, continue; } js::AutoCompartment autoCompartment(cx, compartment); - mozilla::RefPtr ownGroup = compartment->performanceMonitoring.getOwnGroup(); + nsRefPtr ownGroup = compartment->performanceMonitoring.getOwnGroup(); if (ownGroup->data.ticks == 0) { // Don't report compartments that have never been used. continue; } - mozilla::RefPtr sharedGroup = compartment->performanceMonitoring.getSharedGroup(cx); + nsRefPtr sharedGroup = compartment->performanceMonitoring.getSharedGroup(cx); if (!(*walker)(cx, ownGroup->data, ownGroup->uid, &sharedGroup->uid, closure)) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index f1b9a381d15..4250f895dbe 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -13,7 +13,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/Range.h" #include "mozilla/RangedPtr.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include #include @@ -5784,7 +5784,7 @@ struct PerformanceGroup { recentCPOW = 0; } - // Refcounting. For use with mozilla::RefPtr. + // Refcounting. For use with nsRefPtr. void AddRef(); void Release(); @@ -5868,8 +5868,8 @@ struct PerformanceGroupHolder { // The PerformanceGroups held by this object. // Initially set to `nullptr` until the first call to `getGroup`. // May be reset to `nullptr` by a call to `unlink`. - mozilla::RefPtr sharedGroup_; - mozilla::RefPtr ownGroup_; + nsRefPtr sharedGroup_; + nsRefPtr ownGroup_; }; /** diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index e26c9656a5f..9f74916e803 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -441,16 +441,16 @@ class MOZ_RAII AutoStopwatch final // The performance group shared by this compartment and possibly // others, or `nullptr` if another AutoStopwatch is already in // charge of monitoring that group. - mozilla::RefPtr sharedGroup_; + nsRefPtr sharedGroup_; // The toplevel group, representing the entire process, or `nullptr` // if another AutoStopwatch is already in charge of monitoring that group. - mozilla::RefPtr topGroup_; + nsRefPtr topGroup_; // The performance group specific to this compartment, or // `nullptr` if another AutoStopwatch is already in charge of // monitoring that group. - mozilla::RefPtr ownGroup_; + nsRefPtr ownGroup_; public: // If the stopwatch is active, constructing an instance of diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 8a538794a65..3b11d45bb85 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -1033,16 +1033,16 @@ JSRuntime::Stopwatch::commit() if (systemTimeStop > systemTimeStart_) systemTimeDelta = systemTimeStop - systemTimeStart_; - mozilla::RefPtr group = performance.getOwnGroup(); + nsRefPtr group = performance.getOwnGroup(); const uint64_t totalRecentCycles = group->recentCycles; - mozilla::Vector> recentGroups; + mozilla::Vector> recentGroups; touchedGroups.swap(recentGroups); MOZ_ASSERT(recentGroups.length() > 0); // We should only reach this stage if `group` has had some activity. MOZ_ASSERT(group->recentTicks > 0); - for (mozilla::RefPtr* iter = recentGroups.begin(); iter != recentGroups.end(); ++iter) { + for (nsRefPtr* iter = recentGroups.begin(); iter != recentGroups.end(); ++iter) { transferDeltas(userTimeDelta, systemTimeDelta, totalRecentCycles, *iter); } diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 3c0740d95a7..bfd70975901 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -1789,7 +1789,7 @@ struct JSRuntime : public JS::shadow::Runtime, * * They are cleared by `commit()` and `reset()`. */ - mozilla::Vector> touchedGroups; + mozilla::Vector> touchedGroups; }; Stopwatch stopwatch; }; diff --git a/layout/base/DisplayItemClip.cpp b/layout/base/DisplayItemClip.cpp index d3a5e1aa83d..ef881bf7ae1 100644 --- a/layout/base/DisplayItemClip.cpp +++ b/layout/base/DisplayItemClip.cpp @@ -115,7 +115,7 @@ DisplayItemClip::ApplyRoundedRectClipsTo(gfxContext* aContext, aEnd = std::min(aEnd, mRoundedClipRects.Length()); for (uint32_t i = aBegin; i < aEnd; ++i) { - RefPtr roundedRect = + nsRefPtr roundedRect = MakeRoundedRectPath(aDrawTarget, A2D, mRoundedClipRects[i]); aContext->Clip(roundedRect); } @@ -140,7 +140,7 @@ DisplayItemClip::FillIntersectionOfRoundedRectClips(gfxContext* aContext, ApplyRoundedRectClipsTo(aContext, aAppUnitsPerDevPixel, aBegin, aEnd - 1); // Now fill the rect at |aEnd - 1|: - RefPtr roundedRect = MakeRoundedRectPath(aDrawTarget, + nsRefPtr roundedRect = MakeRoundedRectPath(aDrawTarget, aAppUnitsPerDevPixel, mRoundedClipRects[aEnd - 1]); ColorPattern color(ToDeviceColor(aColor)); diff --git a/layout/base/DisplayItemClip.h b/layout/base/DisplayItemClip.h index 9afca38b846..ceda08a22eb 100644 --- a/layout/base/DisplayItemClip.h +++ b/layout/base/DisplayItemClip.h @@ -6,7 +6,7 @@ #ifndef DISPLAYITEMCLIP_H_ #define DISPLAYITEMCLIP_H_ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsRect.h" #include "nsTArray.h" #include "nsStyleConsts.h" diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index f487ccd7c55..bd06b69a614 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -3634,7 +3634,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, nsIntRect itemVisibleRect = aItem->GetVisibleRect().ToOutsidePixels(appUnitsPerDevPixel); - RefPtr tempDT; + nsRefPtr tempDT; if (gfxUtils::sDumpPainting) { tempDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( itemVisibleRect.Size(), @@ -3666,7 +3666,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpPainting && tempDT) { - RefPtr surface = tempDT->Snapshot(); + nsRefPtr surface = tempDT->Snapshot(); DumpPaintedImage(aItem, surface); DrawTarget* drawTarget = aContext->GetDrawTarget(); @@ -5532,7 +5532,7 @@ static void DebugPaintItem(DrawTarget& aDrawTarget, Rect bounds = NSRectToRect(aItem->GetBounds(aBuilder, &snap), aPresContext->AppUnitsPerDevPixel()); - RefPtr tempDT = + nsRefPtr tempDT = aDrawTarget.CreateSimilarDrawTarget(IntSize(bounds.width, bounds.height), SurfaceFormat::B8G8R8A8); nsRefPtr context = new gfxContext(tempDT); @@ -5540,7 +5540,7 @@ static void DebugPaintItem(DrawTarget& aDrawTarget, nsRenderingContext ctx(context); aItem->Paint(aBuilder, &ctx); - RefPtr surface = tempDT->Snapshot(); + nsRefPtr surface = tempDT->Snapshot(); DumpPaintedImage(aItem, surface); aDrawTarget.DrawSurface(surface, bounds, Rect(Point(0,0), bounds.Size())); @@ -6059,7 +6059,7 @@ ContainerState::CreateMaskLayer(Layer *aLayer, IntSize surfaceSizeInt(NSToIntCeil(surfaceSize.width), NSToIntCeil(surfaceSize.height)); // no existing mask image, so build a new one - RefPtr dt = + nsRefPtr dt = aLayer->Manager()->CreateOptimalMaskDrawTarget(surfaceSizeInt); // fail if we can't get the right surface @@ -6078,7 +6078,7 @@ ContainerState::CreateMaskLayer(Layer *aLayer, 0, aRoundedRectClipCount); - RefPtr surface = dt->Snapshot(); + nsRefPtr surface = dt->Snapshot(); // build the image and container container = aLayer->Manager()->CreateImageContainer(); diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 1646c47777f..5a31c1116c2 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1376,7 +1376,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext, { // Clip out the interior of the frame's border edge so that the shadow // is only painted outside that area. - RefPtr builder = + nsRefPtr builder = aDrawTarget.CreatePathBuilder(FillRule::FILL_EVEN_ODD); AppendRectToPath(builder, shadowGfxRectPlusBlur); if (hasBorderRadius) { @@ -1384,7 +1384,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext, } else { AppendRectToPath(builder, frameGfxRect); } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); renderContext->Clip(path); } @@ -1596,7 +1596,7 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext, // This clips the outside border radius. // clipRectRadii is the border radius inside the inset shadow. if (hasBorderRadius) { - RefPtr roundedRect = + nsRefPtr roundedRect = MakePathForRoundedRect(*drawTarget, shadowGfxRect, innerRadii); renderContext->Clip(roundedRect); } else { @@ -1881,7 +1881,7 @@ SetupBackgroundClip(nsCSSRendering::BackgroundClipState& aClipState, aAutoSR->EnsureSaved(aCtx); - RefPtr roundedRect = + nsRefPtr roundedRect = MakePathForRoundedRect(*drawTarget, bgAreaGfx, aClipState.mClippedRadii); aCtx->Clip(roundedRect); } @@ -1937,7 +1937,7 @@ DrawBackgroundColor(nsCSSRendering::BackgroundClipState& aClipState, aCtx->Clip(); } - RefPtr roundedRect = + nsRefPtr roundedRect = MakePathForRoundedRect(*drawTarget, bgAreaGfx, aClipState.mClippedRadii); aCtx->SetPath(roundedRect); aCtx->Fill(); @@ -2732,7 +2732,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, rawStops[i].color = stops[i].mColor; rawStops[i].offset = stopScale * (stops[i].mPosition - stopOrigin); } - mozilla::RefPtr gs = + nsRefPtr gs = gfxGradientCache::GetOrCreateGradientStops(ctx->GetDrawTarget(), rawStops, isRepeat ? gfx::ExtendMode::REPEAT : gfx::ExtendMode::CLAMP); @@ -3781,13 +3781,13 @@ DrawSolidBorderSegment(nsRenderingContext& aContext, poly[3].y -= endBevelOffset; } - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); builder->MoveTo(poly[0]); builder->LineTo(poly[1]); builder->LineTo(poly[2]); builder->LineTo(poly[3]); builder->Close(); - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); drawTarget->Fill(path, color, drawOptions); } } @@ -4343,8 +4343,8 @@ nsCSSRendering::PaintDecorationLine(nsIFrame* aFrame, iCoordLimit -= skipCycles * cycleLength; } - RefPtr builder = aDrawTarget.CreatePathBuilder(); - RefPtr path; + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr path; ptICoord -= lineThickness; builder->MoveTo(pt); // 1 @@ -5447,7 +5447,7 @@ nsContextBoxBlur::BlurRectangle(gfxContext* aDestinationCtx, if (aBlurRadius <= 0) { ColorPattern color(ToDeviceColor(aShadowColor)); if (aCornerRadii) { - RefPtr roundedRect = MakePathForRoundedRect(aDestDrawTarget, + nsRefPtr roundedRect = MakePathForRoundedRect(aDestDrawTarget, shadowGfxRect, *aCornerRadii); aDestDrawTarget.Fill(roundedRect, color); diff --git a/layout/base/nsCSSRenderingBorders.cpp b/layout/base/nsCSSRenderingBorders.cpp index 13b91ae785f..b1b39a7a819 100644 --- a/layout/base/nsCSSRenderingBorders.cpp +++ b/layout/base/nsCSSRenderingBorders.cpp @@ -506,7 +506,7 @@ nsCSSBorderRenderer::GetSideClipSubPath(mozilla::css::Side aSide) end[0] = Point(mOuterRect.CWCorner(aSide).x, mInnerRect.CWCorner(aSide).y); } - RefPtr builder = mDrawTarget->CreatePathBuilder(); + nsRefPtr builder = mDrawTarget->CreatePathBuilder(); builder->MoveTo(start[0]); builder->LineTo(end[0]); builder->LineTo(end[1]); @@ -529,7 +529,7 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect, // If we have a border radius, do full rounded rectangles // and fill, regardless of what sides we're asked to draw. if (!AllCornersZeroSize(aBorderRadii)) { - RefPtr builder = mDrawTarget->CreatePathBuilder(); + nsRefPtr builder = mDrawTarget->CreatePathBuilder(); RectCornerRadii innerRadii; ComputeInnerRadii(aBorderRadii, aBorderSizes, &innerRadii); @@ -540,7 +540,7 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect, // then do the inner border CCW AppendRoundedRectToPath(builder, aInnerRect, innerRadii, false); - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); mDrawTarget->Fill(path, aColor); return; @@ -1213,8 +1213,8 @@ DrawBorderRadius(DrawTarget* aDrawTarget, // Inner radius center Point innerCenter = aInnerCorner + (aCornerMultPrev + aCornerMultNext) * aInnerRadius; - RefPtr builder; - RefPtr path; + nsRefPtr builder; + nsRefPtr path; if (aFirstColor.a > 0) { builder = aDrawTarget->CreatePathBuilder(); @@ -1312,8 +1312,8 @@ DrawCorner(DrawTarget* aDrawTarget, // Corner box end point Point cornerEnd = aOuterCorner + aCornerMultNext * aCornerDims; - RefPtr builder; - RefPtr path; + nsRefPtr builder; + nsRefPtr path; if (aFirstColor.a > 0) { builder = aDrawTarget->CreatePathBuilder(); @@ -1648,10 +1648,10 @@ nsCSSBorderRenderer::DrawBorders() // doesn't need to compute an offset curve to stroke the path. We know that // the rounded parts are elipses we can offset exactly and can just compute // a new cubic approximation. - RefPtr builder = mDrawTarget->CreatePathBuilder(); + nsRefPtr builder = mDrawTarget->CreatePathBuilder(); AppendRoundedRectToPath(builder, mOuterRect, mBorderRadii, true); AppendRoundedRectToPath(builder, ToRect(borderInnerRect.rect), borderInnerRect.corners, false); - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); mDrawTarget->Fill(path, color); return; } @@ -1815,7 +1815,7 @@ nsCSSBorderRenderer::DrawBorders() PrintAsFormatString("corner: %d cornerSide: %d side: %d style: %d\n", corner, cornerSide, side, style); - RefPtr path = GetSideClipSubPath(side); + nsRefPtr path = GetSideClipSubPath(side); mDrawTarget->PushClip(path); DrawBorderSides(1 << side); diff --git a/layout/base/nsCSSRenderingBorders.h b/layout/base/nsCSSRenderingBorders.h index 581577847cb..f14540f117f 100644 --- a/layout/base/nsCSSRenderingBorders.h +++ b/layout/base/nsCSSRenderingBorders.h @@ -11,7 +11,7 @@ #include "mozilla/Attributes.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsColor.h" #include "nsCOMPtr.h" #include "nsStyleConsts.h" diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 31823eebffd..c2f15a90066 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -6825,7 +6825,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement, // (that would result in terrible performance), so we convert once here // upfront if aTarget is specified. if (aTarget) { - RefPtr optSurface = + nsRefPtr optSurface = aTarget->OptimizeSourceSurface(result.mSourceSurface); if (optSurface) { result.mSourceSurface = optSurface; @@ -6879,13 +6879,13 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement, // If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just // draw nothing, so return an empty surface. DrawTarget *ref = aTarget ? aTarget : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); - RefPtr dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height), + nsRefPtr dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height), SurfaceFormat::B8G8R8A8); if (dt) { result.mSourceSurface = dt->Snapshot(); } } else if (aTarget) { - RefPtr opt = aTarget->OptimizeSourceSurface(result.mSourceSurface); + nsRefPtr opt = aTarget->OptimizeSourceSurface(result.mSourceSurface); if (opt) { result.mSourceSurface = opt; } @@ -6945,7 +6945,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement, return result; if (aTarget) { - RefPtr opt = aTarget->OptimizeSourceSurface(result.mSourceSurface); + nsRefPtr opt = aTarget->OptimizeSourceSurface(result.mSourceSurface); if (opt) { result.mSourceSurface = opt; } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index bd3dfb2a133..7c6c1f3676d 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2058,7 +2058,7 @@ public: SurfaceFromElementResult(); /* mSourceSurface will contain the resulting surface, or will be nullptr on error */ - mozilla::RefPtr mSourceSurface; + nsRefPtr mSourceSurface; /* Contains info for drawing when there is no mSourceSurface. */ DirectDrawInfo mDrawInfo; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 8331c4e7975..ccbd6f7683a 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5020,7 +5020,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, aScreenRect->width = pixelArea.width; aScreenRect->height = pixelArea.height; - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( IntSize(pixelArea.width, pixelArea.height), SurfaceFormat::B8G8R8A8); diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 4a31fe1f150..25fdf151969 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -40,7 +40,7 @@ PaintCheckMark(nsIFrame* aFrame, rect.y + rect.height / 2); DrawTarget* drawTarget = aCtx->GetDrawTarget(); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); nsPoint p = paintCenter + nsPoint(checkPolygonX[0] * paintScale, checkPolygonY[0] * paintScale); @@ -51,7 +51,7 @@ PaintCheckMark(nsIFrame* aFrame, checkPolygonY[polyIndex] * paintScale); builder->LineTo(NSPointToPoint(p, appUnitsPerDevPixel)); } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); drawTarget->Fill(path, ColorPattern(ToDeviceColor(aFrame->StyleColor()->mColor))); } diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index 7de80ba978b..110375bc744 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -63,9 +63,9 @@ PaintCheckedRadioButton(nsIFrame* aFrame, ColorPattern color(ToDeviceColor(aFrame->StyleColor()->mColor)); DrawTarget* drawTarget = aCtx->GetDrawTarget(); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); AppendEllipseToPath(builder, devPxRect.Center(), devPxRect.Size()); - RefPtr ellipse = builder->Finish(); + nsRefPtr ellipse = builder->Finish(); drawTarget->Fill(ellipse, color); } diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index f1ceb316bef..d709e59b871 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -323,9 +323,9 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, mRect.width - (padding.left + padding.right), mRect.height - (padding.top + padding.bottom)); Rect devPxRect = NSRectToRect(rect, appUnitsPerDevPixel); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); AppendEllipseToPath(builder, devPxRect.Center(), devPxRect.Size()); - RefPtr ellipse = builder->Finish(); + nsRefPtr ellipse = builder->Finish(); if (listStyleType->GetStyle() == NS_STYLE_LIST_STYLE_DISC) { drawTarget->Fill(ellipse, color); } else { @@ -379,7 +379,7 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, rect.x = pc->RoundAppUnitsToNearestDevPixels(rect.x); rect.y = pc->RoundAppUnitsToNearestDevPixels(rect.y); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); if (isDown) { // to bottom builder->MoveTo(NSPointToPoint(rect.TopLeft(), appUnitsPerDevPixel)); @@ -402,7 +402,7 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt, appUnitsPerDevPixel)); } } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); drawTarget->Fill(path, color); } break; diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index f4189ef7dce..a0ad718d7d2 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -363,7 +363,7 @@ nsDisplayCanvasBackgroundColor::WriteDebugInfo(std::stringstream& aStream) static void BlitSurface(DrawTarget* aDest, const gfxRect& aRect, DrawTarget* aSource) { - RefPtr source = aSource->Snapshot(); + nsRefPtr source = aSource->Snapshot(); aDest->DrawSurface(source, Rect(aRect.x, aRect.y, aRect.width, aRect.height), Rect(0, 0, aRect.width, aRect.height)); @@ -379,7 +379,7 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext context; nsRefPtr dest = aCtx->ThebesContext(); - RefPtr dt; + nsRefPtr dt; gfxRect destRect; #ifndef MOZ_GFX_OPTIMIZE_MOBILE if (IsSingleFixedPositionImage(aBuilder, bgClipRect, &destRect) && diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 0d57424da79..6a102abd76e 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1416,9 +1416,9 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext, size/2 - twoPX, size/2 - twoPX); devPxRect = ToRect(nsLayoutUtils::RectToGfxRect(rect, PresContext()->AppUnitsPerDevPixel())); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); AppendEllipseToPath(builder, devPxRect.Center(), devPxRect.Size()); - RefPtr ellipse = builder->Finish(); + nsRefPtr ellipse = builder->Finish(); drawTarget->Fill(ellipse, color); } diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index 79ce5e6d81a..969e3629af3 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -652,9 +652,9 @@ void CircleArea::Draw(nsIFrame* aFrame, DrawTarget& aDrawTarget, if (diameter <= 0) { return; } - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); AppendEllipseToPath(builder, center, Size(diameter, diameter)); - RefPtr circle = builder->Finish(); + nsRefPtr circle = builder->Finish(); aDrawTarget.Stroke(circle, aColor, aStrokeOptions); } } diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp index e9633df04e1..15605f1487b 100644 --- a/layout/mathml/nsMathMLmencloseFrame.cpp +++ b/layout/mathml/nsMathMLmencloseFrame.cpp @@ -788,7 +788,7 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder, switch(mType) { case NOTATION_CIRCLE: { - RefPtr ellipse = + nsRefPtr ellipse = MakePathForEllipse(aDrawTarget, rect.Center(), rect.Size()); aDrawTarget.Stroke(ellipse, color, strokeOptions); return; @@ -796,7 +796,7 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder, case NOTATION_ROUNDEDBOX: { Float radius = 3 * strokeWidth; RectCornerRadii radii(radius, radius); - RefPtr roundedRect = + nsRefPtr roundedRect = MakePathForRoundedRect(aDrawTarget, rect, radii, true); aDrawTarget.Stroke(roundedRect, color, strokeOptions); return; @@ -825,13 +825,13 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder, color, strokeOptions); // Draw the arrow head - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); builder->MoveTo(rect.TopRight()); builder->LineTo(rect.TopRight() + Point(-w -.4*h, std::max(-strokeWidth / 2.0, h - .4*w))); builder->LineTo(rect.TopRight() + Point(-.7*w, .7*h)); builder->LineTo(rect.TopRight() + Point(std::min(strokeWidth / 2.0, -w + .4*h), h + .4*w)); builder->Close(); - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); aDrawTarget.Fill(path, color); return; } diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 92b6fc79f15..d60b96a2cb0 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -8,7 +8,7 @@ #include "gfxUtils.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsRenderingContext.h" @@ -622,7 +622,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder, // draw the slash as a parallelogram Point delta = Point(presContext->AppUnitsToGfxUnits(mThickness), 0); - RefPtr builder = aDrawTarget.CreatePathBuilder(); + nsRefPtr builder = aDrawTarget.CreatePathBuilder(); if (mRTL) { builder->MoveTo(rect.TopLeft()); builder->LineTo(rect.TopLeft() + delta); @@ -634,7 +634,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder, builder->LineTo(rect.TopRight()); builder->LineTo(rect.TopRight() - delta); } - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); aDrawTarget.Fill(path, color); } diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index beffafd392b..0c8cf63adc4 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -2940,7 +2940,7 @@ void SVGTextDrawPathCallbacks::HandleTextGeometry() { if (IsClipPathChild()) { - RefPtr path = gfx->GetPath(); + nsRefPtr path = gfx->GetPath(); ColorPattern white(Color(1.f, 1.f, 1.f, 1.f)); // for masking, so no ToDeviceColor gfx->GetDrawTarget()->Fill(path, white); } else { @@ -3009,12 +3009,12 @@ SVGTextDrawPathCallbacks::FillGeometry() GeneralPattern fillPattern; MakeFillPattern(&fillPattern); if (fillPattern.GetPattern()) { - RefPtr path = gfx->GetPath(); + nsRefPtr path = gfx->GetPath(); FillRule fillRule = nsSVGUtils::ToFillRule(IsClipPathChild() ? mFrame->StyleSVG()->mClipRule : mFrame->StyleSVG()->mFillRule); if (fillRule != path->GetFillRule()) { - RefPtr builder = path->CopyToBuilder(fillRule); + nsRefPtr builder = path->CopyToBuilder(fillRule); path = builder->Finish(); } gfx->GetDrawTarget()->Fill(path, fillPattern); @@ -3046,7 +3046,7 @@ SVGTextDrawPathCallbacks::StrokeGeometry() gfx->Multiply(outerSVGToUser); } - RefPtr path = gfx->GetPath(); + nsRefPtr path = gfx->GetPath(); SVGContentUtils::AutoStrokeOptions strokeOptions; SVGContentUtils::GetStrokeOptions(&strokeOptions, svgOwner, mFrame->StyleContext(), @@ -4954,14 +4954,14 @@ SVGTextFrame::GetTextPath(nsIFrame* aTextPathFrame) return nullptr; } - RefPtr path = element->GetOrBuildPathForMeasuring(); + nsRefPtr path = element->GetOrBuildPathForMeasuring(); if (!path) { return nullptr; } gfxMatrix matrix = element->PrependLocalTransformsTo(gfxMatrix()); if (!matrix.IsIdentity()) { - RefPtr builder = + nsRefPtr builder = path->TransformedCopyToBuilder(ToMatrix(matrix)); path = builder->Finish(); } @@ -4988,7 +4988,7 @@ SVGTextFrame::GetStartOffset(nsIFrame* aTextPathFrame) &tp->mLengthAttributes[dom::SVGTextPathElement::STARTOFFSET]; if (length->IsPercentage()) { - RefPtr data = GetTextPath(aTextPathFrame); + nsRefPtr data = GetTextPath(aTextPathFrame); return data ? length->GetAnimValInSpecifiedUnits() * data->ComputeLength() / 100.0 : 0.0; @@ -5011,7 +5011,7 @@ SVGTextFrame::DoTextPathLayout() } // Get the path itself. - RefPtr path = GetTextPath(textPathFrame); + nsRefPtr path = GetTextPath(textPathFrame); if (!path) { it.AdvancePastCurrentTextPathFrame(); continue; diff --git a/layout/svg/SVGTextFrame.h b/layout/svg/SVGTextFrame.h index 3b36b6158a2..a98c97ff43f 100644 --- a/layout/svg/SVGTextFrame.h +++ b/layout/svg/SVGTextFrame.h @@ -7,7 +7,7 @@ #define MOZILLA_SVGTEXTFRAME_H #include "mozilla/Attributes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/gfx/2D.h" #include "gfxMatrix.h" #include "gfxRect.h" diff --git a/layout/svg/nsFilterInstance.cpp b/layout/svg/nsFilterInstance.cpp index ee6ab737bec..d1956b0f174 100644 --- a/layout/svg/nsFilterInstance.cpp +++ b/layout/svg/nsFilterInstance.cpp @@ -34,7 +34,7 @@ nsFilterInstance::GetFilterDescription(nsIContent* aFilteredElement, const nsTArray& aFilterChain, const UserSpaceMetrics& aMetrics, const gfxRect& aBBox, - nsTArray>& aOutAdditionalImages) + nsTArray>& aOutAdditionalImages) { gfxMatrix unused; // aPaintTransform arg not used since we're not painting nsFilterInstance instance(nullptr, aFilteredElement, aMetrics, @@ -351,7 +351,7 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource, MOZ_ASSERT(mTargetFrame); nsIntRect neededRect = aSource->mNeededBounds; - RefPtr offscreenDT = + nsRefPtr offscreenDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( neededRect.Size(), SurfaceFormat::B8G8R8A8); if (!offscreenDT) { @@ -415,7 +415,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT) return NS_OK; } - RefPtr offscreenDT = + nsRefPtr offscreenDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( neededRect.Size(), SurfaceFormat::B8G8R8A8); if (!offscreenDT) { @@ -468,7 +468,7 @@ nsFilterInstance::Render(gfxContext* aContext) return NS_OK; } - RefPtr dt = aContext->GetDrawTarget(); + nsRefPtr dt = aContext->GetDrawTarget(); AutoRestoreTransform autoRestoreTransform(dt); Matrix newTM = ToMatrix(ctm).PreTranslate(filterRect.x, filterRect.y) * dt->GetTransform(); diff --git a/layout/svg/nsFilterInstance.h b/layout/svg/nsFilterInstance.h index 5c3780e4e63..c45ea763d4c 100644 --- a/layout/svg/nsFilterInstance.h +++ b/layout/svg/nsFilterInstance.h @@ -68,7 +68,7 @@ public: const nsTArray& aFilterChain, const UserSpaceMetrics& aMetrics, const gfxRect& aBBox, - nsTArray>& aOutAdditionalImages); + nsTArray>& aOutAdditionalImages); /** * Paint the given filtered frame. @@ -157,7 +157,7 @@ public: */ nsresult Render(gfxContext* aContext); - const FilterDescription& ExtractDescriptionAndAdditionalImages(nsTArray>& aOutAdditionalImages) + const FilterDescription& ExtractDescriptionAndAdditionalImages(nsTArray>& aOutAdditionalImages) { mInputImages.SwapElements(aOutAdditionalImages); return mFilterDescription; @@ -206,7 +206,7 @@ private: // The surface that contains the input rendering. // Set by BuildSourceImage / BuildSourcePaint. - mozilla::RefPtr mSourceSurface; + nsRefPtr mSourceSurface; // The position and size of mSourceSurface in filter space. // Set by BuildSourceImage / BuildSourcePaint. @@ -364,7 +364,7 @@ private: */ gfxMatrix mPaintTransform; - nsTArray> mInputImages; + nsTArray> mInputImages; nsTArray mPrimitiveDescriptions; FilterDescription mFilterDescription; bool mInitialized; diff --git a/layout/svg/nsSVGClipPathFrame.cpp b/layout/svg/nsSVGClipPathFrame.cpp index 418a87e2911..a9018330db1 100644 --- a/layout/svg/nsSVGClipPathFrame.cpp +++ b/layout/svg/nsSVGClipPathFrame.cpp @@ -52,7 +52,7 @@ nsSVGClipPathFrame::ApplyClipOrPaintClipMask(gfxContext& aContext, if (IsTrivial(&singleClipPathChild)) { gfxContextMatrixAutoSaveRestore autoRestore(&aContext); - RefPtr clipPath; + nsRefPtr clipPath; if (singleClipPathChild) { nsSVGPathGeometryFrame* pathFrame = do_QueryFrame(singleClipPathChild); if (pathFrame) { @@ -144,7 +144,7 @@ nsSVGClipPathFrame::ApplyClipOrPaintClipMask(gfxContext& aContext, clipPathFrame->ApplyClipOrPaintClipMask(aContext, aClippedFrame, aMatrix); Matrix maskTransform; - RefPtr clipMaskSurface = aContext.PopGroupToSurface(&maskTransform); + nsRefPtr clipMaskSurface = aContext.PopGroupToSurface(&maskTransform); if (clipMaskSurface) { aContext.Mask(clipMaskSurface, maskTransform); @@ -163,7 +163,7 @@ nsSVGClipPathFrame::ApplyClipOrPaintClipMask(gfxContext& aContext, clipPathFrame->ApplyClipOrPaintClipMask(aContext, aClippedFrame, aMatrix); Matrix maskTransform; - RefPtr clipMaskSurface = aContext.PopGroupToSurface(&maskTransform); + nsRefPtr clipMaskSurface = aContext.PopGroupToSurface(&maskTransform); if (clipMaskSurface) { aContext.Mask(clipMaskSurface, maskTransform); diff --git a/layout/svg/nsSVGFilterInstance.cpp b/layout/svg/nsSVGFilterInstance.cpp index 00eb53f7a29..4ee2ee57192 100644 --- a/layout/svg/nsSVGFilterInstance.cpp +++ b/layout/svg/nsSVGFilterInstance.cpp @@ -361,7 +361,7 @@ nsSVGFilterInstance::GetSourceIndices(nsSVGFE* aPrimitiveElement, nsresult nsSVGFilterInstance::BuildPrimitives(nsTArray& aPrimitiveDescrs, - nsTArray>& aInputImages) + nsTArray>& aInputImages) { mSourceGraphicIndex = GetLastResultIndex(aPrimitiveDescrs); diff --git a/layout/svg/nsSVGFilterInstance.h b/layout/svg/nsSVGFilterInstance.h index ab37e784057..6b2787d603d 100644 --- a/layout/svg/nsSVGFilterInstance.h +++ b/layout/svg/nsSVGFilterInstance.h @@ -99,7 +99,7 @@ public: * new images from feImage filter primitive elements to the aInputImages list. */ nsresult BuildPrimitives(nsTArray& aPrimitiveDescrs, - nsTArray>& aInputImages); + nsTArray>& aInputImages); /** * Returns the user specified "filter region", in the filtered element's user diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 981e94b7bb1..7bf4e606354 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -559,7 +559,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext, aContext.PopGroupToSource(); Matrix maskTransform; - RefPtr maskSurface = + nsRefPtr maskSurface = maskFrame ? maskFrame->GetMaskForMaskedFrame(&aContext, aFrame, cssPxToDevPxMatrix, opacity, &maskTransform) @@ -570,7 +570,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext, nsresult rv = clipPathFrame->ApplyClipOrPaintClipMask(aContext, aFrame, cssPxToDevPxMatrix); Matrix clippedMaskTransform; - RefPtr clipMaskSurface = aContext.PopGroupToSurface(&clippedMaskTransform); + nsRefPtr clipMaskSurface = aContext.PopGroupToSurface(&clippedMaskTransform); if (NS_SUCCEEDED(rv) && clipMaskSurface) { // Still more set after clipping, so clip to another surface diff --git a/layout/svg/nsSVGMaskFrame.cpp b/layout/svg/nsSVGMaskFrame.cpp index 9421e66b6f4..e2714bcdb79 100644 --- a/layout/svg/nsSVGMaskFrame.cpp +++ b/layout/svg/nsSVGMaskFrame.cpp @@ -10,7 +10,7 @@ #include "gfx2DGlue.h" #include "gfxContext.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsSVGEffects.h" #include "mozilla/dom/SVGMaskElement.h" #ifdef BUILD_ARM_NEON @@ -249,7 +249,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext, return nullptr; } - RefPtr maskDT = + nsRefPtr maskDT = Factory::CreateDrawTarget(BackendType::CAIRO, maskSurfaceSize, SurfaceFormat::B8G8R8A8); if (!maskDT) { @@ -279,28 +279,28 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext, nsSVGUtils::PaintFrameWithEffects(kid, *tmpCtx, m); } - RefPtr maskSnapshot = maskDT->Snapshot(); + nsRefPtr maskSnapshot = maskDT->Snapshot(); if (!maskSnapshot) { return nullptr; } - RefPtr maskSurface = maskSnapshot->GetDataSurface(); + nsRefPtr maskSurface = maskSnapshot->GetDataSurface(); DataSourceSurface::MappedSurface map; if (!maskSurface->Map(DataSourceSurface::MapType::READ, &map)) { return nullptr; } // Create alpha channel mask for output - RefPtr destMaskDT = + nsRefPtr destMaskDT = Factory::CreateDrawTarget(BackendType::CAIRO, maskSurfaceSize, SurfaceFormat::A8); if (!destMaskDT) { return nullptr; } - RefPtr destMaskSnapshot = destMaskDT->Snapshot(); + nsRefPtr destMaskSnapshot = destMaskDT->Snapshot(); if (!destMaskSnapshot) { return nullptr; } - RefPtr destMaskSurface = destMaskSnapshot->GetDataSurface(); + nsRefPtr destMaskSurface = destMaskSnapshot->GetDataSurface(); DataSourceSurface::MappedSurface destMap; if (!destMaskSurface->Map(DataSourceSurface::MapType::READ_WRITE, &destMap)) { return nullptr; diff --git a/layout/svg/nsSVGMaskFrame.h b/layout/svg/nsSVGMaskFrame.h index f3e4cfbef1d..6ae3a316b2d 100644 --- a/layout/svg/nsSVGMaskFrame.h +++ b/layout/svg/nsSVGMaskFrame.h @@ -8,7 +8,7 @@ #include "mozilla/Attributes.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "gfxPattern.h" #include "gfxMatrix.h" #include "nsSVGContainerFrame.h" diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index 41fa7e12a65..a7909243d7a 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -14,7 +14,7 @@ #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/Helpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsDisplayList.h" #include "nsGkAtoms.h" #include "nsLayoutUtils.h" @@ -314,9 +314,9 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) // Using ScreenReferenceDrawTarget() opens us to Moz2D backend specific hit- // testing bugs. Maybe we should use a BackendType::CAIRO DT for hit-testing // so that we get more consistent/backwards compatible results? - RefPtr drawTarget = + nsRefPtr drawTarget = gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget(); - RefPtr path = content->GetOrBuildPath(*drawTarget, fillRule); + nsRefPtr path = content->GetOrBuildPath(*drawTarget, fillRule); if (!path) { return nullptr; // no path, so we don't paint anything that can be hit } @@ -335,7 +335,7 @@ nsSVGPathGeometryFrame::GetFrameForPoint(const gfxPoint& aPoint) // Naturally we also need to transform the point into the same // coordinate system in order to hit-test against the path. point = ToMatrix(userToOuterSVG) * point; - RefPtr builder = + nsRefPtr builder = path->TransformedCopyToBuilder(ToMatrix(userToOuterSVG), fillRule); path = builder->Finish(); } @@ -519,7 +519,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace, bbox = simpleBounds; } else { // Get the bounds using a Moz2D Path object (more expensive): - RefPtr tmpDT; + nsRefPtr tmpDT; #ifdef XP_WIN // Unfortunately D2D backed DrawTarget produces bounds with rounding errors // when whole number results are expected, even in the case of trivial @@ -535,15 +535,15 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace, #endif FillRule fillRule = nsSVGUtils::ToFillRule(StyleSVG()->mFillRule); - RefPtr pathInUserSpace = element->GetOrBuildPath(*tmpDT, fillRule); + nsRefPtr pathInUserSpace = element->GetOrBuildPath(*tmpDT, fillRule); if (!pathInUserSpace) { return bbox; } - RefPtr pathInBBoxSpace; + nsRefPtr pathInBBoxSpace; if (aToBBoxUserspace.IsIdentity()) { pathInBBoxSpace = pathInUserSpace; } else { - RefPtr builder = + nsRefPtr builder = pathInUserSpace->TransformedCopyToBuilder(aToBBoxUserspace, fillRule); pathInBBoxSpace = builder->Finish(); if (!pathInBBoxSpace) { @@ -603,9 +603,9 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace, Matrix outerSVGToUser = ToMatrix(userToOuterSVG); outerSVGToUser.Invert(); Matrix outerSVGToBBox = aToBBoxUserspace * outerSVGToUser; - RefPtr builder = + nsRefPtr builder = pathInUserSpace->TransformedCopyToBuilder(ToMatrix(userToOuterSVG)); - RefPtr pathInOuterSVGSpace = builder->Finish(); + nsRefPtr pathInOuterSVGSpace = builder->Finish(); strokeBBoxExtents = pathInOuterSVGSpace->GetStrokedBounds(strokeOptions, outerSVGToBBox); } else { @@ -753,7 +753,7 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext, if (GetStateBits() & NS_STATE_SVG_CLIPPATH_CHILD) { // We don't complicate this code with GetAsSimplePath since the cost of // masking will dwarf Path creation overhead anyway. - RefPtr path = element->GetOrBuildPath(*drawTarget, fillRule); + nsRefPtr path = element->GetOrBuildPath(*drawTarget, fillRule); if (path) { ColorPattern white(ToDeviceColor(Color(1.0f, 1.0f, 1.0f, 1.0f))); drawTarget->Fill(path, white, @@ -763,7 +763,7 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext, } nsSVGPathGeometryElement::SimplePath simplePath; - RefPtr path; + nsRefPtr path; element->GetAsSimplePath(&simplePath); if (!simplePath.IsPath()) { @@ -810,7 +810,7 @@ nsSVGPathGeometryFrame::Render(gfxContext* aContext, gfxMatrix outerSVGToUser = userToOuterSVG; outerSVGToUser.Invert(); aContext->Multiply(outerSVGToUser); - RefPtr builder = + nsRefPtr builder = path->TransformedCopyToBuilder(ToMatrix(userToOuterSVG), fillRule); path = builder->Finish(); } diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index 90ff295150e..f4c17e6183d 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -370,7 +370,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget, patternHeight / surfaceSize.height); } - RefPtr dt = + nsRefPtr dt = aDrawTarget->CreateSimilarDrawTarget(surfaceSize, SurfaceFormat::B8G8R8A8); if (!dt) { return nullptr; @@ -710,7 +710,7 @@ nsSVGPatternFrame::GetPaintServerPattern(nsIFrame *aSource, // Paint it! Matrix pMatrix; - RefPtr surface = + nsRefPtr surface = PaintPattern(aDrawTarget, &pMatrix, ToMatrix(aContextMatrix), aSource, aFillOrStroke, aGraphicOpacity, aOverrideBounds); diff --git a/layout/svg/nsSVGPatternFrame.h b/layout/svg/nsSVGPatternFrame.h index ed832a591c6..9d91b8450bd 100644 --- a/layout/svg/nsSVGPatternFrame.h +++ b/layout/svg/nsSVGPatternFrame.h @@ -9,7 +9,7 @@ #include "mozilla/Attributes.h" #include "gfxMatrix.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsSVGPaintServerFrame.h" class nsIFrame; diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 5d7aeb4a80a..6ab2187c13e 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -658,7 +658,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, aContext.PopGroupToSource(); Matrix maskTransform; - RefPtr maskSurface = + nsRefPtr maskSurface = maskFrame ? maskFrame->GetMaskForMaskedFrame(&aContext, aFrame, aTransform, opacity, &maskTransform) : nullptr; @@ -668,7 +668,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, nsresult rv = clipPathFrame->ApplyClipOrPaintClipMask(aContext, aFrame, aTransform); Matrix clippedMaskTransform; - RefPtr clipMaskSurface = aContext.PopGroupToSurface(&clippedMaskTransform); + nsRefPtr clipMaskSurface = aContext.PopGroupToSurface(&clippedMaskTransform); if (NS_SUCCEEDED(rv) && clipMaskSurface) { // Still more set after clipping, so clip to another surface diff --git a/media/mtransport/dtlsidentity.cpp b/media/mtransport/dtlsidentity.cpp index 63be7a3d6b5..f507a2c7b40 100644 --- a/media/mtransport/dtlsidentity.cpp +++ b/media/mtransport/dtlsidentity.cpp @@ -23,7 +23,7 @@ DtlsIdentity::~DtlsIdentity() { } } -RefPtr DtlsIdentity::Generate() { +nsRefPtr DtlsIdentity::Generate() { ScopedPK11SlotInfo slot(PK11_GetInternalSlot()); if (!slot) { return nullptr; @@ -152,7 +152,7 @@ RefPtr DtlsIdentity::Generate() { } certificate->derCert = *signedCert; - RefPtr identity = + nsRefPtr identity = new DtlsIdentity(private_key.forget(), certificate.forget(), ssl_kea_ecdh); return identity.forget(); } diff --git a/media/mtransport/dtlsidentity.h b/media/mtransport/dtlsidentity.h index e29f9afc2de..e2c80882d6c 100644 --- a/media/mtransport/dtlsidentity.h +++ b/media/mtransport/dtlsidentity.h @@ -9,7 +9,7 @@ #include #include "m_cpp_utils.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" #include "sslt.h" #include "ScopedNSSTypes.h" @@ -29,7 +29,7 @@ class DtlsIdentity final { // This is only for use in tests, or for external linkage. It makes a (bad) // instance of this class. - static RefPtr Generate(); + static nsRefPtr Generate(); // These don't create copies or transfer ownership. If you want these to live // on, make a copy. diff --git a/media/mtransport/nr_socket_prsock.cpp b/media/mtransport/nr_socket_prsock.cpp index 371a5a7efab..8ec6cd1d8c0 100644 --- a/media/mtransport/nr_socket_prsock.cpp +++ b/media/mtransport/nr_socket_prsock.cpp @@ -1115,7 +1115,7 @@ NS_IMETHODIMP NrUdpSocketIpc::CallListenerReceivedData(const nsACString &host, } nsAutoPtr buf(new DataBuffer(data, data_length)); - RefPtr msg(new nr_udp_message(addr, buf)); + nsRefPtr msg(new nr_udp_message(addr, buf)); RUN_ON_THREAD(sts_thread_, mozilla::WrapRunnable(nsRefPtr(this), @@ -1288,7 +1288,7 @@ void NrUdpSocketIpc::close() { NS_DISPATCH_NORMAL); //remove all enqueued messages - std::queue > empty; + std::queue > empty; std::swap(received_msgs_, empty); } @@ -1312,7 +1312,7 @@ int NrUdpSocketIpc::recvfrom(void *buf, size_t maxlen, size_t *len, int flags, } { - RefPtr msg(received_msgs_.front()); + nsRefPtr msg(received_msgs_.front()); received_msgs_.pop(); @@ -1463,7 +1463,7 @@ void NrUdpSocketIpc::release_use_s() { } #endif -void NrUdpSocketIpc::recv_callback_s(RefPtr msg) { +void NrUdpSocketIpc::recv_callback_s(nsRefPtr msg) { ASSERT_ON_THREAD(sts_thread_); { @@ -1684,7 +1684,7 @@ void NrTcpSocketIpc::close() { NS_DISPATCH_NORMAL); //remove all enqueued messages - std::queue> empty; + std::queue> empty; std::swap(msg_queue_, empty); } @@ -1962,7 +1962,7 @@ static nr_socket_vtbl nr_socket_local_vtbl={ }; int nr_socket_local_create(void *obj, nr_transport_addr *addr, nr_socket **sockp) { - RefPtr sock; + nsRefPtr sock; int r, _status; // create IPC bridge for content process diff --git a/media/mtransport/nr_socket_prsock.h b/media/mtransport/nr_socket_prsock.h index c923da398a2..9c5e695b687 100644 --- a/media/mtransport/nr_socket_prsock.h +++ b/media/mtransport/nr_socket_prsock.h @@ -65,7 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "databuffer.h" #include "m_cpp_utils.h" #include "mozilla/ReentrantMonitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "mozilla/ClearOnShutdown.h" @@ -276,13 +276,13 @@ private: static void release_use_s(); #endif // STS thread executor - void recv_callback_s(RefPtr msg); + void recv_callback_s(nsRefPtr msg); ReentrantMonitor monitor_; // protects err_and state_ bool err_; NrSocketIpcState state_; - std::queue> received_msgs_; + std::queue> received_msgs_; nsRefPtr socket_child_; // only accessed from the io_thread }; @@ -380,7 +380,7 @@ private: // variables that can only be accessed on STS. NrSocketIpcState state_; - std::queue> msg_queue_; + std::queue> msg_queue_; uint32_t buffered_bytes_; uint32_t tracking_number_; std::deque writes_in_flight_; diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index fdc65b12edc..036be3552b2 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -284,7 +284,7 @@ int NrIceCtx::stream_ready(void *obj, nr_ice_media_stream *stream) { // Get the ICE ctx. NrIceCtx *ctx = static_cast(obj); - RefPtr s = ctx->FindStream(stream); + nsRefPtr s = ctx->FindStream(stream); // Streams which do not exist should never be ready. MOZ_ASSERT(s); @@ -299,7 +299,7 @@ int NrIceCtx::stream_failed(void *obj, nr_ice_media_stream *stream) { // Get the ICE ctx NrIceCtx *ctx = static_cast(obj); - RefPtr s = ctx->FindStream(stream); + nsRefPtr s = ctx->FindStream(stream); // Streams which do not exist should never fail. MOZ_ASSERT(s); @@ -339,7 +339,7 @@ int NrIceCtx::msg_recvd(void *obj, nr_ice_peer_ctx *pctx, UCHAR *msg, int len) { // Get the ICE ctx NrIceCtx *ctx = static_cast(obj); - RefPtr s = ctx->FindStream(stream); + nsRefPtr s = ctx->FindStream(stream); // Streams which do not exist should never have packets. MOZ_ASSERT(s); @@ -355,7 +355,7 @@ void NrIceCtx::trickle_cb(void *arg, nr_ice_ctx *ice_ctx, nr_ice_candidate *candidate) { // Get the ICE ctx NrIceCtx *ctx = static_cast(arg); - RefPtr s = ctx->FindStream(stream); + nsRefPtr s = ctx->FindStream(stream); if (!s) { // This stream has been removed because it is inactive @@ -376,14 +376,14 @@ void NrIceCtx::trickle_cb(void *arg, nr_ice_ctx *ice_ctx, s->SignalCandidate(s, candidate_str); } -RefPtr NrIceCtx::Create(const std::string& name, +nsRefPtr NrIceCtx::Create(const std::string& name, bool offerer, bool allow_loopback, bool tcp_enabled, bool allow_link_local, bool hide_non_default, Policy policy) { - RefPtr ctx = new NrIceCtx(name, offerer, policy); + nsRefPtr ctx = new NrIceCtx(name, offerer, policy); // Initialize the crypto callbacks and logging stuff if (!initialized) { @@ -550,7 +550,7 @@ NrIceCtx::~NrIceCtx() { delete ice_handler_; } -RefPtr +nsRefPtr NrIceCtx::CreateStream(const std::string& name, int components) { return NrIceMediaStream::Create(this, name, components); } @@ -561,7 +561,7 @@ NrIceCtx::SetStream(size_t index, NrIceMediaStream* stream) { streams_.resize(index + 1); } - RefPtr oldStream(streams_[index]); + nsRefPtr oldStream(streams_[index]); streams_[index] = stream; if (oldStream) { @@ -724,7 +724,7 @@ nsresult NrIceCtx::StartGathering() { return NS_OK; } -RefPtr NrIceCtx::FindStream( +nsRefPtr NrIceCtx::FindStream( nr_ice_media_stream *stream) { for (size_t i=0; istream() == stream)) { diff --git a/media/mtransport/nricectx.h b/media/mtransport/nricectx.h index 081bc104e2e..ec645c9708c 100644 --- a/media/mtransport/nricectx.h +++ b/media/mtransport/nricectx.h @@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "prnetdb.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Scoped.h" #include "mozilla/TimeStamp.h" #include "nsAutoPtr.h" @@ -215,7 +215,7 @@ class NrIceCtx { }; // TODO(ekr@rtfm.com): Too many bools here. Bug 1193437. - static RefPtr Create(const std::string& name, + static nsRefPtr Create(const std::string& name, bool offerer, bool allow_loopback = false, bool tcp_enabled = true, @@ -234,12 +234,12 @@ class NrIceCtx { void destroy_peer_ctx(); // Create a media stream - RefPtr CreateStream(const std::string& name, + nsRefPtr CreateStream(const std::string& name, int components); void SetStream(size_t index, NrIceMediaStream* stream); - RefPtr GetStream(size_t index) { + nsRefPtr GetStream(size_t index) { if (index < streams_.size()) { return streams_[index]; } @@ -370,7 +370,7 @@ class NrIceCtx { int component_id, nr_ice_candidate *candidate); // Find a media stream by stream ptr. Gross - RefPtr FindStream(nr_ice_media_stream *stream); + nsRefPtr FindStream(nr_ice_media_stream *stream); // Set the state void SetConnectionState(ConnectionState state); @@ -382,7 +382,7 @@ class NrIceCtx { GatheringState gathering_state_; const std::string name_; bool offerer_; - std::vector > streams_; + std::vector > streams_; nr_ice_ctx *ctx_; nr_ice_peer_ctx *peer_; nr_ice_handler_vtbl* ice_handler_vtbl_; // Must be pointer diff --git a/media/mtransport/nricemediastream.cpp b/media/mtransport/nricemediastream.cpp index c331f26e518..4dd34ecd8e6 100644 --- a/media/mtransport/nricemediastream.cpp +++ b/media/mtransport/nricemediastream.cpp @@ -179,11 +179,11 @@ static NrIceCandidate* MakeNrIceCandidate(const nr_ice_candidate& candc) { } // NrIceMediaStream -RefPtr +nsRefPtr NrIceMediaStream::Create(NrIceCtx *ctx, const std::string& name, int components) { - RefPtr stream = + nsRefPtr stream = new NrIceMediaStream(ctx, name, components); int r = nr_ice_add_media_stream(ctx->ctx(), diff --git a/media/mtransport/nricemediastream.h b/media/mtransport/nricemediastream.h index 16e14fc2ec1..139047a2737 100644 --- a/media/mtransport/nricemediastream.h +++ b/media/mtransport/nricemediastream.h @@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "sigslot.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Scoped.h" #include "nsCOMPtr.h" #include "nsIEventTarget.h" @@ -124,7 +124,7 @@ struct NrIceCandidatePair { class NrIceMediaStream { public: - static RefPtr Create(NrIceCtx *ctx, + static nsRefPtr Create(NrIceCtx *ctx, const std::string& name, int components); enum State { ICE_CONNECTING, ICE_OPEN, ICE_CLOSED}; diff --git a/media/mtransport/runnable_utils.h b/media/mtransport/runnable_utils.h index 3733fcbeb16..17d07e17cf6 100644 --- a/media/mtransport/runnable_utils.h +++ b/media/mtransport/runnable_utils.h @@ -12,7 +12,7 @@ #include "nsThreadUtils.h" #include "mozilla/IndexSequence.h" #include "mozilla/Move.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Tuple.h" // Abstract base class for all of our templates diff --git a/media/mtransport/test/ice_unittest.cpp b/media/mtransport/test/ice_unittest.cpp index 5e1ee850fc8..5bd6e4e1cdd 100644 --- a/media/mtransport/test/ice_unittest.cpp +++ b/media/mtransport/test/ice_unittest.cpp @@ -313,7 +313,7 @@ class IceTestPeer : public sigslot::has_slots<> { snprintf(name, sizeof(name), "%s:stream%d", name_.c_str(), (int)streams_.size()); - mozilla::RefPtr stream = + nsRefPtr stream = ice_ctx_->CreateStream(static_cast(name), components); ice_ctx_->SetStream(streams_.size(), stream); @@ -823,7 +823,7 @@ class IceTestPeer : public sigslot::has_slots<> { // If we are connected, then try to trickle to the // other side. if (remote_ && remote_->remote_ && (trickle_mode_ != TRICKLE_SIMULATE)) { - std::vector >::iterator it = + std::vector >::iterator it = std::find(streams_.begin(), streams_.end(), stream); ASSERT_NE(streams_.end(), it); size_t index = it - streams_.begin(); @@ -1105,7 +1105,7 @@ class IceTestPeer : public sigslot::has_slots<> { private: std::string name_; nsRefPtr ice_ctx_; - std::vector > streams_; + std::vector > streams_; std::map > candidates_; // Maps from stream id to list of remote trickle candidates std::map > @@ -1669,7 +1669,7 @@ class PacketFilterTest : public ::testing::Test { } nsCOMPtr filter_; - RefPtr ice_ctx_; + nsRefPtr ice_ctx_; }; } // end namespace diff --git a/media/mtransport/test/runnable_utils_unittest.cpp b/media/mtransport/test/runnable_utils_unittest.cpp index 2f970c95727..ad5a098fcc9 100644 --- a/media/mtransport/test/runnable_utils_unittest.cpp +++ b/media/mtransport/test/runnable_utils_unittest.cpp @@ -14,7 +14,7 @@ #include "nsXPCOM.h" #include "nsXPCOMGlue.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" #include "nsIIOService.h" @@ -77,7 +77,7 @@ class TargetClass { void destructor_target(Destructor*) { } - void destructor_target_ref(RefPtr destructor) { + void destructor_target_ref(nsRefPtr destructor) { } int *ran_; @@ -203,7 +203,7 @@ TEST_F(DispatchTest, TestNonMethodRet) { TEST_F(DispatchTest, TestDestructor) { bool destroyed = false; - RefPtr destructor = new Destructor(&destroyed); + nsRefPtr destructor = new Destructor(&destroyed); target_->Dispatch(WrapRunnable(&cl_, &TargetClass::destructor_target, destructor), NS_DISPATCH_SYNC); @@ -214,7 +214,7 @@ TEST_F(DispatchTest, TestDestructor) { TEST_F(DispatchTest, TestDestructorRef) { bool destroyed = false; - RefPtr destructor = new Destructor(&destroyed); + nsRefPtr destructor = new Destructor(&destroyed); target_->Dispatch(WrapRunnable(&cl_, &TargetClass::destructor_target_ref, destructor), NS_DISPATCH_SYNC); diff --git a/media/mtransport/test/sctp_unittest.cpp b/media/mtransport/test/sctp_unittest.cpp index a27faf3a0d7..d4abca5f460 100644 --- a/media/mtransport/test/sctp_unittest.cpp +++ b/media/mtransport/test/sctp_unittest.cpp @@ -199,7 +199,7 @@ class TransportTestPeer : public sigslot::has_slots<> { bool connected() const { return connected_; } static TransportResult SendPacket_s(const unsigned char* data, size_t len, - const mozilla::RefPtr& flow) { + const nsRefPtr& flow) { TransportResult res = flow->SendPacket(data, len); delete data; // we always allocate return res; @@ -288,7 +288,7 @@ class TransportTestPeer : public sigslot::has_slots<> { bool connected_; size_t sent_; size_t received_; - mozilla::RefPtr flow_; + nsRefPtr flow_; TransportLayerLoopback *loopback_; struct sockaddr_conn local_addr_; diff --git a/media/mtransport/test/transport_unittests.cpp b/media/mtransport/test/transport_unittests.cpp index 8f76ad9fb99..83a1b998b60 100644 --- a/media/mtransport/test/transport_unittests.cpp +++ b/media/mtransport/test/transport_unittests.cpp @@ -611,7 +611,7 @@ class TransportTestPeer : public sigslot::has_slots<> { (int)streams_.size()); // Create the media stream - mozilla::RefPtr stream = + nsRefPtr stream = ice_ctx_->CreateStream(static_cast(name), 1); ASSERT_TRUE(stream != nullptr); @@ -799,15 +799,15 @@ class TransportTestPeer : public sigslot::has_slots<> { std::string name_; nsCOMPtr target_; size_t received_; - mozilla::RefPtr flow_; + nsRefPtr flow_; TransportLayerLoopback *loopback_; TransportLayerLogging *logging_; TransportLayerLossy *lossy_; TransportLayerDtls *dtls_; TransportLayerIce *ice_; - mozilla::RefPtr identity_; - mozilla::RefPtr ice_ctx_; - std::vector > streams_; + nsRefPtr identity_; + nsRefPtr ice_ctx_; + std::vector > streams_; std::map > candidates_; TransportTestPeer *peer_; bool gathering_complete_; @@ -1221,7 +1221,7 @@ TEST_F(TransportTest, TestDheOnlyFails) { } TEST(PushTests, LayerFail) { - mozilla::RefPtr flow = new TransportFlow(); + nsRefPtr flow = new TransportFlow(); nsresult rv; bool destroyed1, destroyed2; @@ -1241,7 +1241,7 @@ TEST(PushTests, LayerFail) { } TEST(PushTests, LayersFail) { - mozilla::RefPtr flow = new TransportFlow(); + nsRefPtr flow = new TransportFlow(); nsresult rv; bool destroyed1, destroyed2, destroyed3; diff --git a/media/mtransport/test_nr_socket.cpp b/media/mtransport/test_nr_socket.cpp index a1dab091b76..5ac49c036a8 100644 --- a/media/mtransport/test_nr_socket.cpp +++ b/media/mtransport/test_nr_socket.cpp @@ -90,7 +90,7 @@ extern "C" { #include "transport_addr.h" } -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "test_nr_socket.h" #include "runnable_utils.h" @@ -99,7 +99,7 @@ namespace mozilla { static int test_nat_socket_create(void *obj, nr_transport_addr *addr, nr_socket **sockp) { - RefPtr sock = new TestNrSocket(static_cast(obj)); + nsRefPtr sock = new TestNrSocket(static_cast(obj)); int r, _status; diff --git a/media/mtransport/transportlayer.h b/media/mtransport/transportlayer.h index 85afad7fd9a..67331ed402a 100644 --- a/media/mtransport/transportlayer.h +++ b/media/mtransport/transportlayer.h @@ -12,7 +12,7 @@ #include "sigslot.h" #include "mozilla/DebugOnly.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsIEventTarget.h" diff --git a/media/mtransport/transportlayerdtls.cpp b/media/mtransport/transportlayerdtls.cpp index 1d1bb00ce7e..a49bca74b60 100644 --- a/media/mtransport/transportlayerdtls.cpp +++ b/media/mtransport/transportlayerdtls.cpp @@ -1116,7 +1116,7 @@ SECStatus TransportLayerDtls::AuthCertificateHook(void *arg, } SECStatus -TransportLayerDtls::CheckDigest(const RefPtr& +TransportLayerDtls::CheckDigest(const nsRefPtr& digest, CERTCertificate *peer_cert) { unsigned char computed_digest[kMaxDigestLength]; @@ -1195,7 +1195,7 @@ SECStatus TransportLayerDtls::AuthCertificateHook(PRFileDesc *fd, // Checking functions call PR_SetError() SECStatus rv = SECFailure; for (size_t i = 0; i < digests_.size(); i++) { - RefPtr digest = digests_[i]; + nsRefPtr digest = digests_[i]; rv = CheckDigest(digest, peer_cert); // Matches a digest, we are good to go diff --git a/media/mtransport/transportlayerdtls.h b/media/mtransport/transportlayerdtls.h index cc72ee7cbc8..bdb91bc4f2c 100644 --- a/media/mtransport/transportlayerdtls.h +++ b/media/mtransport/transportlayerdtls.h @@ -14,7 +14,7 @@ #include "sigslot.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Scoped.h" #include "nsCOMPtr.h" #include "nsIEventTarget.h" @@ -68,7 +68,7 @@ class TransportLayerDtls final : public TransportLayer { void SetRole(Role role) { role_ = role;} Role role() { return role_; } - void SetIdentity(const RefPtr& identity) { + void SetIdentity(const nsRefPtr& identity) { identity_ = identity; } nsresult SetAlpn(const std::set& allowedAlpn, @@ -158,10 +158,10 @@ class TransportLayerDtls final : public TransportLayer { static void TimerCallback(nsITimer *timer, void *arg); - SECStatus CheckDigest(const RefPtr& digest, + SECStatus CheckDigest(const nsRefPtr& digest, CERTCertificate *cert); - RefPtr identity_; + nsRefPtr identity_; // What ALPN identifiers are permitted. std::set alpn_allowed_; // What ALPN identifier is used if ALPN is not supported. @@ -173,7 +173,7 @@ class TransportLayerDtls final : public TransportLayer { Role role_; Verification verification_mode_; - std::vector > digests_; + std::vector > digests_; // Must delete nspr_io_adapter after ssl_fd_ b/c ssl_fd_ causes an alert // (ssl_fd_ contains an un-owning pointer to nspr_io_adapter_) diff --git a/media/mtransport/transportlayerice.cpp b/media/mtransport/transportlayerice.cpp index 2c40226525c..15e796c8532 100644 --- a/media/mtransport/transportlayerice.cpp +++ b/media/mtransport/transportlayerice.cpp @@ -91,8 +91,8 @@ TransportLayerIce::~TransportLayerIce() { // No need to do anything here, since we use smart pointers } -void TransportLayerIce::SetParameters(RefPtr ctx, - RefPtr stream, +void TransportLayerIce::SetParameters(nsRefPtr ctx, + nsRefPtr stream, int component) { ctx_ = ctx; stream_ = stream; diff --git a/media/mtransport/transportlayerice.h b/media/mtransport/transportlayerice.h index bff30128082..39f4f261f26 100644 --- a/media/mtransport/transportlayerice.h +++ b/media/mtransport/transportlayerice.h @@ -14,7 +14,7 @@ #include "sigslot.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Scoped.h" #include "nsCOMPtr.h" #include "nsIEventTarget.h" @@ -35,8 +35,8 @@ class TransportLayerIce : public TransportLayer { virtual ~TransportLayerIce(); - void SetParameters(RefPtr ctx, - RefPtr stream, + void SetParameters(nsRefPtr ctx, + nsRefPtr stream, int component); // Transport layer overrides. @@ -56,8 +56,8 @@ class TransportLayerIce : public TransportLayer { void PostSetup(); const std::string name_; - RefPtr ctx_; - RefPtr stream_; + nsRefPtr ctx_; + nsRefPtr stream_; int component_; }; diff --git a/media/webrtc/signaling/src/jsep/JsepSession.h b/media/webrtc/signaling/src/jsep/JsepSession.h index 0f4d1a911ed..36c17048857 100644 --- a/media/webrtc/signaling/src/jsep/JsepSession.h +++ b/media/webrtc/signaling/src/jsep/JsepSession.h @@ -8,7 +8,7 @@ #include #include #include "mozilla/Maybe.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "nsError.h" @@ -103,7 +103,7 @@ public: virtual std::vector& Codecs() = 0; // Manage tracks. We take shared ownership of any track. - virtual nsresult AddTrack(const RefPtr& track) = 0; + virtual nsresult AddTrack(const nsRefPtr& track) = 0; virtual nsresult RemoveTrack(const std::string& streamId, const std::string& trackId) = 0; virtual nsresult ReplaceTrack(const std::string& oldStreamId, @@ -111,19 +111,19 @@ public: const std::string& newStreamId, const std::string& newTrackId) = 0; - virtual std::vector> GetLocalTracks() const = 0; + virtual std::vector> GetLocalTracks() const = 0; - virtual std::vector> GetRemoteTracks() const = 0; + virtual std::vector> GetRemoteTracks() const = 0; - virtual std::vector> GetRemoteTracksAdded() const = 0; + virtual std::vector> GetRemoteTracksAdded() const = 0; - virtual std::vector> GetRemoteTracksRemoved() const = 0; + virtual std::vector> GetRemoteTracksRemoved() const = 0; // Access the negotiated track pairs. virtual std::vector GetNegotiatedTrackPairs() const = 0; // Access transports. - virtual std::vector> GetTransports() const = 0; + virtual std::vector> GetTransports() const = 0; // Basic JSEP operations. virtual nsresult CreateOffer(const JsepOfferOptions& options, diff --git a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp index e204d8b4e3f..c633bed5353 100644 --- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp +++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp @@ -100,7 +100,7 @@ FindUnassignedTrackByType(std::vector& tracks, } nsresult -JsepSessionImpl::AddTrack(const RefPtr& track) +JsepSessionImpl::AddTrack(const nsRefPtr& track) { mLastError.clear(); MOZ_ASSERT(track->GetDirection() == sdp::kSend); @@ -227,10 +227,10 @@ JsepSessionImpl::AddVideoRtpExtension(const std::string& extensionName) } template -std::vector> +std::vector> GetTracks(const std::vector& wrappedTracks) { - std::vector> result; + std::vector> result; for (auto i = wrappedTracks.begin(); i != wrappedTracks.end(); ++i) { result.push_back(i->mTrack); } @@ -264,25 +264,25 @@ JsepSessionImpl::ReplaceTrack(const std::string& oldStreamId, return NS_OK; } -std::vector> +std::vector> JsepSessionImpl::GetLocalTracks() const { return GetTracks(mLocalTracks); } -std::vector> +std::vector> JsepSessionImpl::GetRemoteTracks() const { return GetTracks(mRemoteTracks); } -std::vector> +std::vector> JsepSessionImpl::GetRemoteTracksAdded() const { return GetTracks(mRemoteTracksAdded); } -std::vector> +std::vector> JsepSessionImpl::GetRemoteTracksRemoved() const { return GetTracks(mRemoteTracksRemoved); @@ -459,7 +459,7 @@ void JsepSessionImpl::SetupOfferToReceiveMsection(SdpMediaSection* offer) { // Create a dummy recv track, and have it add codecs, set direction, etc. - RefPtr dummy = new JsepTrack(offer->GetMediaType(), + nsRefPtr dummy = new JsepTrack(offer->GetMediaType(), "", "", sdp::kRecv); @@ -934,7 +934,7 @@ JsepSessionImpl::BindMatchingLocalTrackToAnswer(SdpMediaSection* msection) return NS_ERROR_FAILURE; } - AddTrack(RefPtr( + AddTrack(nsRefPtr( new JsepTrack(SdpMediaSection::kApplication, streamId, trackId))); track = FindUnassignedTrackByType(mLocalTracks, msection->GetMediaType()); MOZ_ASSERT(track != mLocalTracks.end()); @@ -1068,7 +1068,7 @@ JsepSessionImpl::SetLocalDescription(JsepSdpType type, const std::string& sdp) mOldTransports = mTransports; // Save in case we need to rollback for (size_t t = 0; t < parsed->GetMediaSectionCount(); ++t) { if (t >= mTransports.size()) { - mTransports.push_back(RefPtr(new JsepTransport)); + mTransports.push_back(nsRefPtr(new JsepTransport)); } UpdateTransport(parsed->GetMediaSection(t), mTransports[t].get()); @@ -1265,7 +1265,7 @@ JsepSessionImpl::HandleNegotiatedSession(const UniquePtr& local, } } - RefPtr transport = mTransports[transportLevel]; + nsRefPtr transport = mTransports[transportLevel]; rv = FinalizeTransport( remote->GetMediaSection(transportLevel).GetAttributeList(), @@ -1307,7 +1307,7 @@ JsepSessionImpl::HandleNegotiatedSession(const UniquePtr& local, nsresult JsepSessionImpl::MakeNegotiatedTrackPair(const SdpMediaSection& remote, const SdpMediaSection& local, - const RefPtr& transport, + const nsRefPtr& transport, bool usingBundle, size_t transportLevel, JsepTrackPair* trackPairOut) @@ -1418,7 +1418,7 @@ JsepSessionImpl::UpdateTransport(const SdpMediaSection& msection, nsresult JsepSessionImpl::FinalizeTransport(const SdpAttributeList& remote, const SdpAttributeList& answer, - const RefPtr& transport) + const nsRefPtr& transport) { UniquePtr ice = MakeUnique(); @@ -1703,7 +1703,7 @@ JsepSessionImpl::SetRemoteTracksFromDescription(const Sdp* remoteDescription) } if (track == mRemoteTracks.end()) { - RefPtr track; + nsRefPtr track; rv = CreateReceivingTrack(i, *remoteDescription, msection, &track); NS_ENSURE_SUCCESS(rv, rv); @@ -1891,7 +1891,7 @@ nsresult JsepSessionImpl::CreateReceivingTrack(size_t mline, const Sdp& sdp, const SdpMediaSection& msection, - RefPtr* track) + nsRefPtr* track) { std::string streamId; std::string trackId; diff --git a/media/webrtc/signaling/src/jsep/JsepSessionImpl.h b/media/webrtc/signaling/src/jsep/JsepSessionImpl.h index 29c800aaf59..6510b841923 100644 --- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.h +++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.h @@ -46,7 +46,7 @@ public: // Implement JsepSession methods. virtual nsresult Init() override; - virtual nsresult AddTrack(const RefPtr& track) override; + virtual nsresult AddTrack(const nsRefPtr& track) override; virtual nsresult RemoveTrack(const std::string& streamId, const std::string& trackId) override; @@ -87,14 +87,14 @@ public: const std::string& newStreamId, const std::string& newTrackId) override; - virtual std::vector> GetLocalTracks() const override; + virtual std::vector> GetLocalTracks() const override; - virtual std::vector> GetRemoteTracks() const override; + virtual std::vector> GetRemoteTracks() const override; - virtual std::vector> + virtual std::vector> GetRemoteTracksAdded() const override; - virtual std::vector> + virtual std::vector> GetRemoteTracksRemoved() const override; virtual nsresult CreateOffer(const JsepOfferOptions& options, @@ -145,7 +145,7 @@ public: } // Access transports. - virtual std::vector> + virtual std::vector> GetTransports() const override { return mTransports; @@ -166,12 +166,12 @@ private: }; struct JsepSendingTrack { - RefPtr mTrack; + nsRefPtr mTrack; Maybe mAssignedMLine; }; struct JsepReceivingTrack { - RefPtr mTrack; + nsRefPtr mTrack; Maybe mAssignedMLine; }; @@ -203,7 +203,7 @@ private: nsresult CreateReceivingTrack(size_t mline, const Sdp& sdp, const SdpMediaSection& msection, - RefPtr* track); + nsRefPtr* track); nsresult HandleNegotiatedSession(const UniquePtr& local, const UniquePtr& remote); nsresult AddTransportAttributes(SdpMediaSection* msection, @@ -254,7 +254,7 @@ private: SdpSetupAttribute::Role* rolep); nsresult MakeNegotiatedTrackPair(const SdpMediaSection& remote, const SdpMediaSection& local, - const RefPtr& transport, + const nsRefPtr& transport, bool usingBundle, size_t transportLevel, JsepTrackPair* trackPairOut); @@ -263,7 +263,7 @@ private: nsresult FinalizeTransport(const SdpAttributeList& remote, const SdpAttributeList& answer, - const RefPtr& transport); + const nsRefPtr& transport); nsresult GetNegotiatedBundledMids(SdpHelper::BundledMids* bundledMids); @@ -276,9 +276,9 @@ private: // By the most recent SetRemoteDescription std::vector mRemoteTracksAdded; std::vector mRemoteTracksRemoved; - std::vector > mTransports; + std::vector > mTransports; // So we can rollback - std::vector > mOldTransports; + std::vector > mOldTransports; std::vector mNegotiatedTrackPairs; bool mIsOfferer; diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signaling/src/jsep/JsepTrack.cpp index 337b21ace52..6b3555f9921 100644 --- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp +++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp @@ -257,13 +257,13 @@ JsepTrack::Negotiate(const SdpMediaSection& answer, // We figure that out here. /* static */ void -JsepTrack::SetUniquePayloadTypes(const std::vector>& tracks) +JsepTrack::SetUniquePayloadTypes(const std::vector>& tracks) { // Maps to track details if no other track contains the payload type, // otherwise maps to nullptr. std::map payloadTypeToDetailsMap; - for (const RefPtr& track : tracks) { + for (const nsRefPtr& track : tracks) { if (track->GetMediaType() == SdpMediaSection::kApplication) { continue; } diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.h b/media/webrtc/signaling/src/jsep/JsepTrack.h index 79f1cc0d34f..79a7c0afe15 100644 --- a/media/webrtc/signaling/src/jsep/JsepTrack.h +++ b/media/webrtc/signaling/src/jsep/JsepTrack.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include "nsISupportsImpl.h" @@ -146,7 +146,7 @@ public: virtual void Negotiate(const SdpMediaSection& answer, const SdpMediaSection& remote); static void SetUniquePayloadTypes( - const std::vector>& tracks); + const std::vector>& tracks); virtual void GetNegotiatedPayloadTypes(std::vector* payloadTypes); // This will be set when negotiation is carried out. @@ -218,10 +218,10 @@ struct JsepTrackPair { // Is this track pair sharing a transport with another? Maybe mBundleLevel; uint32_t mRecvonlySsrc; - RefPtr mSending; - RefPtr mReceiving; - RefPtr mRtpTransport; - RefPtr mRtcpTransport; + nsRefPtr mSending; + nsRefPtr mReceiving; + nsRefPtr mRtpTransport; + nsRefPtr mRtcpTransport; }; } // namespace mozilla diff --git a/media/webrtc/signaling/src/jsep/JsepTransport.h b/media/webrtc/signaling/src/jsep/JsepTransport.h index 3b0d38ad64b..849645ad286 100644 --- a/media/webrtc/signaling/src/jsep/JsepTransport.h +++ b/media/webrtc/signaling/src/jsep/JsepTransport.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include "nsISupportsImpl.h" diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp index c39b9803ec1..9ec6633707e 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp @@ -41,7 +41,7 @@ const unsigned int WebrtcAudioConduit::CODEC_PLNAME_SIZE = 32; /** * Factory Method for AudioConduit */ -mozilla::RefPtr AudioSessionConduit::Create() +nsRefPtr AudioSessionConduit::Create() { CSFLogDebug(logTag, "%s ", __FUNCTION__); NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); @@ -330,7 +330,7 @@ MediaConduitErrorCode WebrtcAudioConduit::Init() // AudioSessionConduit Implementation MediaConduitErrorCode -WebrtcAudioConduit::SetTransmitterTransport(mozilla::RefPtr aTransport) +WebrtcAudioConduit::SetTransmitterTransport(nsRefPtr aTransport) { CSFLogDebug(logTag, "%s ", __FUNCTION__); @@ -341,7 +341,7 @@ WebrtcAudioConduit::SetTransmitterTransport(mozilla::RefPtr } MediaConduitErrorCode -WebrtcAudioConduit::SetReceiverTransport(mozilla::RefPtr aTransport) +WebrtcAudioConduit::SetReceiverTransport(nsRefPtr aTransport) { CSFLogDebug(logTag, "%s ", __FUNCTION__); diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.h b/media/webrtc/signaling/src/media-conduit/AudioConduit.h index faafc6bc017..b8d0b7cdd90 100755 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.h +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.h @@ -99,9 +99,9 @@ public: * Register External Transport to this Conduit. RTP and RTCP frames from the VoiceEngine * shall be passed to the registered transport for transporting externally. */ - virtual MediaConduitErrorCode SetTransmitterTransport(mozilla::RefPtr aTransport) override; + virtual MediaConduitErrorCode SetTransmitterTransport(nsRefPtr aTransport) override; - virtual MediaConduitErrorCode SetReceiverTransport(mozilla::RefPtr aTransport) override; + virtual MediaConduitErrorCode SetReceiverTransport(nsRefPtr aTransport) override; /** * Function to deliver externally captured audio sample for encoding and transport @@ -252,8 +252,8 @@ private: webrtc::VoiceEngine* mVoiceEngine; mozilla::ReentrantMonitor mTransportMonitor; - mozilla::RefPtr mTransmitterTransport; - mozilla::RefPtr mReceiverTransport; + nsRefPtr mTransmitterTransport; + nsRefPtr mReceiverTransport; ScopedCustomReleasePtr mPtrVoENetwork; ScopedCustomReleasePtr mPtrVoEBase; ScopedCustomReleasePtr mPtrVoECodec; diff --git a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h index 7f6846b40f1..30365e14a0a 100755 --- a/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h +++ b/media/webrtc/signaling/src/media-conduit/MediaConduitInterface.h @@ -8,7 +8,7 @@ #include "nsISupportsImpl.h" #include "nsXPCOM.h" #include "nsDOMNavigationTiming.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "CodecConfig.h" #include "VideoTypes.h" #include "MediaConduitErrors.h" @@ -58,10 +58,10 @@ class ImageHandle public: explicit ImageHandle(layers::Image* image) : mImage(image) {} - const RefPtr& GetImage() const { return mImage; } + const nsRefPtr& GetImage() const { return mImage; } private: - RefPtr mImage; + nsRefPtr mImage; }; /** @@ -170,7 +170,7 @@ public: * set. In the future, we should ensure that RTCP sender reports use this * regardless of whether the receiver transport is set. */ - virtual MediaConduitErrorCode SetTransmitterTransport(RefPtr aTransport) = 0; + virtual MediaConduitErrorCode SetTransmitterTransport(nsRefPtr aTransport) = 0; /** * Function to attach receiver transport end-point of the Media conduit. @@ -181,7 +181,7 @@ public: * Note: This transport is used for RTCP. * Note: In the future, we should avoid using this for RTCP sender reports. */ - virtual MediaConduitErrorCode SetReceiverTransport(RefPtr aTransport) = 0; + virtual MediaConduitErrorCode SetReceiverTransport(nsRefPtr aTransport) = 0; virtual bool SetLocalSSRC(unsigned int ssrc) = 0; virtual bool GetLocalSSRC(unsigned int* ssrc) = 0; @@ -256,7 +256,7 @@ public: * return: Concrete VideoSessionConduitObject or nullptr in the case * of failure */ - static RefPtr Create(); + static nsRefPtr Create(); enum FrameRequestType { @@ -280,7 +280,7 @@ public: * Note: Multiple invocations of this API shall remove an existing renderer * and attaches the new to the Conduit. */ - virtual MediaConduitErrorCode AttachRenderer(RefPtr aRenderer) = 0; + virtual MediaConduitErrorCode AttachRenderer(nsRefPtr aRenderer) = 0; virtual void DetachRenderer() = 0; /** @@ -387,7 +387,7 @@ public: * return: Concrete AudioSessionConduitObject or nullptr in the case * of failure */ - static mozilla::RefPtr Create(); + static nsRefPtr Create(); virtual ~AudioSessionConduit() {} diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp index 3ca59d5ecb3..a75dd3cf2b6 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.cpp @@ -46,7 +46,7 @@ const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32; /** * Factory Method for VideoConduit */ -mozilla::RefPtr +nsRefPtr VideoSessionConduit::Create() { NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); @@ -510,7 +510,7 @@ WebrtcVideoConduit::SyncTo(WebrtcAudioConduit *aConduit) } MediaConduitErrorCode -WebrtcVideoConduit::AttachRenderer(mozilla::RefPtr aVideoRenderer) +WebrtcVideoConduit::AttachRenderer(nsRefPtr aVideoRenderer) { CSFLogDebug(logTag, "%s ", __FUNCTION__); @@ -564,7 +564,7 @@ WebrtcVideoConduit::DetachRenderer() } MediaConduitErrorCode -WebrtcVideoConduit::SetTransmitterTransport(mozilla::RefPtr aTransport) +WebrtcVideoConduit::SetTransmitterTransport(nsRefPtr aTransport) { CSFLogDebug(logTag, "%s ", __FUNCTION__); @@ -575,7 +575,7 @@ WebrtcVideoConduit::SetTransmitterTransport(mozilla::RefPtr } MediaConduitErrorCode -WebrtcVideoConduit::SetReceiverTransport(mozilla::RefPtr aTransport) +WebrtcVideoConduit::SetReceiverTransport(nsRefPtr aTransport) { CSFLogDebug(logTag, "%s ", __FUNCTION__); diff --git a/media/webrtc/signaling/src/media-conduit/VideoConduit.h b/media/webrtc/signaling/src/media-conduit/VideoConduit.h index 2a81aff2fd5..221c8ccaa3d 100755 --- a/media/webrtc/signaling/src/media-conduit/VideoConduit.h +++ b/media/webrtc/signaling/src/media-conduit/VideoConduit.h @@ -80,7 +80,7 @@ public: * Note: Multiple invocations of this API shall remove an existing renderer * and attaches the new to the Conduit. */ - virtual MediaConduitErrorCode AttachRenderer(mozilla::RefPtr aVideoRenderer) override; + virtual MediaConduitErrorCode AttachRenderer(nsRefPtr aVideoRenderer) override; virtual void DetachRenderer() override; /** @@ -131,9 +131,9 @@ public: * Register Transport for this Conduit. RTP and RTCP frames from the VideoEngine * shall be passed to the registered transport for transporting externally. */ - virtual MediaConduitErrorCode SetTransmitterTransport(mozilla::RefPtr aTransport) override; + virtual MediaConduitErrorCode SetTransmitterTransport(nsRefPtr aTransport) override; - virtual MediaConduitErrorCode SetReceiverTransport(mozilla::RefPtr aTransport) override; + virtual MediaConduitErrorCode SetReceiverTransport(nsRefPtr aTransport) override; void SelectBandwidth(webrtc::VideoCodec& vie_codec, unsigned short width, @@ -316,9 +316,9 @@ private: webrtc::VideoEngine* mVideoEngine; mozilla::ReentrantMonitor mTransportMonitor; - mozilla::RefPtr mTransmitterTransport; - mozilla::RefPtr mReceiverTransport; - mozilla::RefPtr mRenderer; + nsRefPtr mTransmitterTransport; + nsRefPtr mReceiverTransport; + nsRefPtr mRenderer; ScopedCustomReleasePtr mPtrViEBase; ScopedCustomReleasePtr mPtrViECapture; @@ -359,7 +359,7 @@ private: static const unsigned int sAlphaDen = 8; static const unsigned int sRoundingPadding = 1024; - mozilla::RefPtr mSyncedTo; + nsRefPtr mSyncedTo; nsAutoPtr mExternalSendCodec; nsAutoPtr mExternalRecvCodec; diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp index 83c1ee99c13..a1d4b216604 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcMediaCodecVP8VideoCodec.cpp @@ -538,7 +538,7 @@ class OutputDrain : public MediaCodecOutputDrain jobjectArray mInputBuffers; jobjectArray mOutputBuffers; - RefPtr mOutputDrain; + nsRefPtr mOutputDrain; uint32_t mWidth; uint32_t mHeight; bool isStarted; diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp index 5383e152f18..e47227069a4 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.cpp @@ -100,7 +100,7 @@ public: } private: - RefPtr mImage; + nsRefPtr mImage; }; struct EncodedFrame @@ -518,7 +518,7 @@ public: // buffers back to native window for rendering. void OnNewFrame() override { - RefPtr buffer = mNativeWindow->getCurrentBuffer(); + nsRefPtr buffer = mNativeWindow->getCurrentBuffer(); if (!buffer) { CODEC_LOGE("Decoder NewFrame: Get null buffer"); return; @@ -645,7 +645,7 @@ private: sp mNativeWindow; - RefPtr mOutputDrain; + nsRefPtr mOutputDrain; webrtc::DecodedImageCallback* mCallback; Mutex mDecodedFrameLock; // To protect mDecodedFrames and mEnding @@ -1197,7 +1197,7 @@ WebrtcOMXH264VideoDecoder::Decode(const webrtc::EncodedImage& aInputImage, this, aInputImage._buffer[sizeof(kNALStartCode)] & 0x1f, aInputImage._length); return WEBRTC_VIDEO_CODEC_UNINITIALIZED; } - RefPtr omx = new WebrtcOMXDecoder(MEDIA_MIMETYPE_VIDEO_AVC, + nsRefPtr omx = new WebrtcOMXDecoder(MEDIA_MIMETYPE_VIDEO_AVC, mCallback); result = omx->ConfigureWithPicDimensions(width, height); if (NS_WARN_IF(result != OK)) { diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h index 9c2cc84a353..c8edbc2b0ab 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h +++ b/media/webrtc/signaling/src/media-conduit/WebrtcOMXH264VideoCodec.h @@ -60,7 +60,7 @@ private: android::sp mReservation; webrtc::EncodedImageCallback* mCallback; - RefPtr mOutputDrain; + nsRefPtr mOutputDrain; uint32_t mWidth; uint32_t mHeight; uint32_t mFrameRate; @@ -99,7 +99,7 @@ public: private: webrtc::DecodedImageCallback* mCallback; - RefPtr mOMX; + nsRefPtr mOMX; android::sp mReservation; }; diff --git a/media/webrtc/signaling/src/media/CSFAudioControlWrapper.h b/media/webrtc/signaling/src/media/CSFAudioControlWrapper.h index 49f3b892370..5034d4147f7 100644 --- a/media/webrtc/signaling/src/media/CSFAudioControlWrapper.h +++ b/media/webrtc/signaling/src/media/CSFAudioControlWrapper.h @@ -4,7 +4,7 @@ #pragma once -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "CC_Common.h" #include "CSFAudioControl.h" @@ -37,6 +37,6 @@ namespace CSF private: virtual ~AudioControlWrapper(); - mozilla::RefPtr _realAudioControl; + nsRefPtr _realAudioControl; }; }; diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index b7cce346c9c..49848846181 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -137,8 +137,8 @@ MediaPipeline::AttachTransport_s() void MediaPipeline::UpdateTransport_m(int level, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter) { RUN_ON_THREAD(sts_thread_, @@ -154,8 +154,8 @@ MediaPipeline::UpdateTransport_m(int level, void MediaPipeline::UpdateTransport_s(int level, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter) { bool rtcp_mux = false; @@ -760,7 +760,7 @@ nsresult MediaPipeline::PipelineTransport::SendRtpPacket( RUN_ON_THREAD(sts_thread_, WrapRunnable( - RefPtr(this), + nsRefPtr(this), &MediaPipeline::PipelineTransport::SendRtpRtcpPacket_s, buf, true), NS_DISPATCH_NORMAL); @@ -827,7 +827,7 @@ nsresult MediaPipeline::PipelineTransport::SendRtcpPacket( RUN_ON_THREAD(sts_thread_, WrapRunnable( - RefPtr(this), + nsRefPtr(this), &MediaPipeline::PipelineTransport::SendRtpRtcpPacket_s, buf, false), NS_DISPATCH_NORMAL); @@ -1160,13 +1160,13 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk( } } - RefPtr surf = img->GetAsSourceSurface(); + nsRefPtr surf = img->GetAsSourceSurface(); if (!surf) { MOZ_MTLOG(ML_ERROR, "Getting surface from " << Stringify(format) << " image failed"); return; } - RefPtr data = surf->GetDataSurface(); + nsRefPtr data = surf->GetDataSurface(); if (!data) { MOZ_MTLOG(ML_ERROR, "Getting data surface from " << Stringify(format) << " image with " << Stringify(surf->GetType()) << "(" @@ -1246,7 +1246,7 @@ nsresult MediaPipelineReceiveAudio::Init() { static void AddTrackAndListener(MediaStream* source, TrackID track_id, TrackRate track_rate, MediaStreamListener* listener, MediaSegment* segment, - const RefPtr& completed, + const nsRefPtr& completed, bool queue_track) { // This both adds the listener and the track #if !defined(MOZILLA_EXTERNAL_LINKAGE) @@ -1254,7 +1254,7 @@ static void AddTrackAndListener(MediaStream* source, public: Message(MediaStream* stream, TrackID track, TrackRate rate, MediaSegment* segment, MediaStreamListener* listener, - const RefPtr& completed) + const nsRefPtr& completed) : ControlMessage(stream), track_id_(track), track_rate_(rate), @@ -1299,7 +1299,7 @@ static void AddTrackAndListener(MediaStream* source, TrackRate track_rate_; nsAutoPtr segment_; nsRefPtr listener_; - const RefPtr completed_; + const nsRefPtr completed_; }; MOZ_ASSERT(listener); @@ -1329,14 +1329,14 @@ static void AddTrackAndListener(MediaStream* source, } void GenericReceiveListener::AddSelf(MediaSegment* segment) { - RefPtr callback = new GenericReceiveCallback(this); + nsRefPtr callback = new GenericReceiveCallback(this); AddTrackAndListener(source_, track_id_, track_rate_, this, segment, callback, queue_track_); } MediaPipelineReceiveAudio::PipelineListener::PipelineListener( SourceMediaStream * source, TrackID track_id, - const RefPtr& conduit, bool queue_track) + const nsRefPtr& conduit, bool queue_track) : GenericReceiveListener(source, track_id, DEFAULT_SAMPLE_RATE, queue_track), // XXX rate assumption conduit_(conduit) { @@ -1466,7 +1466,7 @@ void MediaPipelineReceiveVideo::PipelineListener::RenderVideoFrame( unsigned int buffer_size, uint32_t time_stamp, int64_t render_time, - const RefPtr& video_image) { + const nsRefPtr& video_image) { #ifdef MOZILLA_INTERNAL_API ReentrantMonitorAutoEnter enter(monitor_); diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h index 114c17d93ca..b6df12a9caf 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.h @@ -80,9 +80,9 @@ class MediaPipeline : public sigslot::has_slots<> { MediaStream *stream, const std::string& track_id, int level, - RefPtr conduit, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr conduit, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter) : direction_(direction), stream_(stream), @@ -134,13 +134,13 @@ class MediaPipeline : public sigslot::has_slots<> { virtual nsresult Init(); void UpdateTransport_m(int level, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter); void UpdateTransport_s(int level, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter); virtual Direction direction() const { return direction_; } @@ -202,7 +202,7 @@ class MediaPipeline : public sigslot::has_slots<> { class TransportInfo { public: - TransportInfo(RefPtr flow, RtpType type) : + TransportInfo(nsRefPtr flow, RtpType type) : transport_(flow), state_(MP_CONNECTING), type_(type) { @@ -216,10 +216,10 @@ class MediaPipeline : public sigslot::has_slots<> { recv_srtp_ = nullptr; } - RefPtr transport_; + nsRefPtr transport_; State state_; - RefPtr send_srtp_; - RefPtr recv_srtp_; + nsRefPtr send_srtp_; + nsRefPtr recv_srtp_; RtpType type_; }; @@ -252,7 +252,7 @@ class MediaPipeline : public sigslot::has_slots<> { size_t len); Direction direction_; - RefPtr stream_; // A pointer to the stream we are servicing. + nsRefPtr stream_; // A pointer to the stream we are servicing. // Written on the main thread. // Used on STS and MediaStreamGraph threads. // May be changed by rtpSender.replaceTrack() @@ -263,7 +263,7 @@ class MediaPipeline : public sigslot::has_slots<> { // this value is updated from STS, but read on main, and we don't want to // bother with dispatches just to get an int occasionally. Atomic level_; - RefPtr conduit_; // Our conduit. Written on the main + nsRefPtr conduit_; // Our conduit. Written on the main // thread. Read on STS thread. // The transport objects. Read/written on STS thread. @@ -277,7 +277,7 @@ class MediaPipeline : public sigslot::has_slots<> { // Created on Init. Referenced by the conduit and eventually // destroyed on the STS thread. - RefPtr transport_; + nsRefPtr transport_; // Only safe to access from STS thread. // Build into TransportInfo? @@ -356,7 +356,7 @@ class GenericReceiveCallback : public TrackAddedCallback } private: - RefPtr listener_; + nsRefPtr listener_; }; class ConduitDeleteEvent: public nsRunnable @@ -368,7 +368,7 @@ public: /* we exist solely to proxy release of the conduit */ NS_IMETHOD Run() { return NS_OK; } private: - RefPtr mConduit; + nsRefPtr mConduit; }; // A specialization of pipeline for reading from an input device @@ -383,9 +383,9 @@ public: const std::string& track_id, int level, bool is_video, - RefPtr conduit, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr conduit, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter) : MediaPipeline(pc, TRANSMIT, main_thread, sts_thread, domstream->GetOwnedStream(), track_id, level, @@ -439,7 +439,7 @@ public: class PipelineListener : public MediaStreamDirectListener { friend class MediaPipelineTransmit; public: - explicit PipelineListener(const RefPtr& conduit) + explicit PipelineListener(const nsRefPtr& conduit) : conduit_(conduit), track_id_(TRACK_INVALID), mMutex("MediaPipelineTransmit::PipelineListener"), @@ -510,7 +510,7 @@ public: virtual void ProcessVideoChunk(VideoSessionConduit *conduit, VideoChunk& chunk); #endif - RefPtr conduit_; + nsRefPtr conduit_; // May be TRACK_INVALID until we see data from the track TrackID track_id_; // this is the current TrackID this listener is attached to @@ -534,7 +534,7 @@ public: }; private: - RefPtr listener_; + nsRefPtr listener_; DOMMediaStream *domstream_; bool is_video_; }; @@ -551,9 +551,9 @@ class MediaPipelineReceive : public MediaPipeline { MediaStream *stream, const std::string& track_id, int level, - RefPtr conduit, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr conduit, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter) : MediaPipeline(pc, RECEIVE, main_thread, sts_thread, stream, track_id, level, conduit, rtp_transport, @@ -586,9 +586,9 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive { // used by MediaStreamGraph TrackID numeric_track_id, int level, - RefPtr conduit, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr conduit, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter, bool queue_track) : MediaPipelineReceive(pc, main_thread, sts_thread, @@ -613,7 +613,7 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive { class PipelineListener : public GenericReceiveListener { public: PipelineListener(SourceMediaStream * source, TrackID track_id, - const RefPtr& conduit, + const nsRefPtr& conduit, bool queue_track); ~PipelineListener() @@ -637,10 +637,10 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive { virtual void NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) override; private: - RefPtr conduit_; + nsRefPtr conduit_; }; - RefPtr listener_; + nsRefPtr listener_; }; @@ -660,9 +660,9 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive { // used by MediaStreamGraph TrackID numeric_track_id, int level, - RefPtr conduit, - RefPtr rtp_transport, - RefPtr rtcp_transport, + nsRefPtr conduit, + nsRefPtr rtp_transport, + nsRefPtr rtcp_transport, nsAutoPtr filter, bool queue_track) : MediaPipelineReceive(pc, main_thread, sts_thread, @@ -748,7 +748,7 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive { unsigned int buffer_size, uint32_t time_stamp, int64_t render_time, - const RefPtr& video_image); + const nsRefPtr& video_image); private: int width_; @@ -767,8 +767,8 @@ class MediaPipelineReceiveVideo : public MediaPipelineReceive { friend class PipelineRenderer; - RefPtr renderer_; - RefPtr listener_; + nsRefPtr renderer_; + nsRefPtr listener_; }; diff --git a/media/webrtc/signaling/src/mediapipeline/SrtpFlow.cpp b/media/webrtc/signaling/src/mediapipeline/SrtpFlow.cpp index 59c3dac0ac0..e5cd87cefdd 100644 --- a/media/webrtc/signaling/src/mediapipeline/SrtpFlow.cpp +++ b/media/webrtc/signaling/src/mediapipeline/SrtpFlow.cpp @@ -11,7 +11,7 @@ #include "ssl.h" #include "sslproto.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" // Logging context using namespace mozilla; @@ -27,7 +27,7 @@ SrtpFlow::~SrtpFlow() { } } -RefPtr SrtpFlow::Create(int cipher_suite, +nsRefPtr SrtpFlow::Create(int cipher_suite, bool inbound, const void *key, size_t key_len) { @@ -35,7 +35,7 @@ RefPtr SrtpFlow::Create(int cipher_suite, if (!NS_SUCCEEDED(res)) return nullptr; - RefPtr flow = new SrtpFlow(); + nsRefPtr flow = new SrtpFlow(); if (!key) { MOZ_MTLOG(ML_ERROR, "Null SRTP key specified"); diff --git a/media/webrtc/signaling/src/mediapipeline/SrtpFlow.h b/media/webrtc/signaling/src/mediapipeline/SrtpFlow.h index eaf0eb3698b..58ffee0dd6b 100644 --- a/media/webrtc/signaling/src/mediapipeline/SrtpFlow.h +++ b/media/webrtc/signaling/src/mediapipeline/SrtpFlow.h @@ -9,7 +9,7 @@ #include "ssl.h" #include "sslproto.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsISupportsImpl.h" typedef struct srtp_policy_t srtp_policy_t; @@ -32,7 +32,7 @@ class SrtpFlow { public: - static mozilla::RefPtr Create(int cipher_suite, + static nsRefPtr Create(int cipher_suite, bool inbound, const void *key, size_t key_len); diff --git a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp index 9b518bd3a4d..9bf99a6ea8c 100644 --- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp +++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.cpp @@ -133,8 +133,8 @@ JsepCodecDescToCodecConfig(const JsepCodecDescription& aCodec, // have enqueued this function unless it was still active and // the ICE data is destroyed on the STS. static void -FinalizeTransportFlow_s(RefPtr aPCMedia, - RefPtr aFlow, size_t aLevel, +FinalizeTransportFlow_s(nsRefPtr aPCMedia, + nsRefPtr aFlow, size_t aLevel, bool aIsRtcp, nsAutoPtr > aLayerList) { @@ -157,10 +157,10 @@ MediaPipelineFactory::CreateOrGetTransportFlow( size_t aLevel, bool aIsRtcp, const JsepTransport& aTransport, - RefPtr* aFlowOutparam) + nsRefPtr* aFlowOutparam) { nsresult rv; - RefPtr flow; + nsRefPtr flow; flow = mPCMedia->GetTransportFlow(aLevel, aIsRtcp); if (flow) { @@ -181,7 +181,7 @@ MediaPipelineFactory::CreateOrGetTransportFlow( ? TransportLayerDtls::CLIENT : TransportLayerDtls::SERVER); - RefPtr pcid = mPC->Identity(); + nsRefPtr pcid = mPC->Identity(); if (!pcid) { MOZ_MTLOG(ML_ERROR, "Failed to get DTLS identity."); return NS_ERROR_FAILURE; @@ -254,8 +254,8 @@ MediaPipelineFactory::GetTransportParameters( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t* aLevelOut, - RefPtr* aRtpOut, - RefPtr* aRtcpOut, + nsRefPtr* aRtpOut, + nsRefPtr* aRtcpOut, nsAutoPtr* aFilterOut) { *aLevelOut = aTrackPair.mLevel; @@ -331,8 +331,8 @@ MediaPipelineFactory::CreateOrUpdateMediaPipeline( bool receiving = aTrack.GetDirection() == sdp::kRecv; size_t level; - RefPtr rtpFlow; - RefPtr rtcpFlow; + nsRefPtr rtpFlow; + nsRefPtr rtcpFlow; nsAutoPtr filter; nsresult rv = GetTransportParameters(aTrackPair, @@ -375,7 +375,7 @@ MediaPipelineFactory::CreateOrUpdateMediaPipeline( return NS_ERROR_FAILURE; } - RefPtr conduit; + nsRefPtr conduit; if (aTrack.GetMediaType() == SdpMediaSection::kAudio) { rv = GetOrCreateAudioConduit(aTrackPair, aTrack, &conduit); if (NS_FAILED(rv)) @@ -389,7 +389,7 @@ MediaPipelineFactory::CreateOrUpdateMediaPipeline( return NS_OK; } - RefPtr pipeline = + nsRefPtr pipeline = stream->GetPipelineByTrackId_m(aTrack.GetTrackId()); if (pipeline && pipeline->level() != static_cast(level)) { @@ -437,16 +437,16 @@ MediaPipelineFactory::CreateMediaPipelineReceiving( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t aLevel, - RefPtr aRtpFlow, - RefPtr aRtcpFlow, + nsRefPtr aRtpFlow, + nsRefPtr aRtcpFlow, nsAutoPtr aFilter, - const RefPtr& aConduit) + const nsRefPtr& aConduit) { // We will error out earlier if this isn't here. nsRefPtr stream = mPCMedia->GetRemoteStreamById(aTrack.GetStreamId()); - RefPtr pipeline; + nsRefPtr pipeline; TrackID numericTrackId = stream->GetNumericTrackId(aTrack.GetTrackId()); MOZ_ASSERT(numericTrackId != TRACK_INVALID); @@ -497,7 +497,7 @@ MediaPipelineFactory::CreateMediaPipelineReceiving( } rv = stream->StorePipeline(aTrack.GetTrackId(), - RefPtr(pipeline)); + nsRefPtr(pipeline)); if (NS_FAILED(rv)) { MOZ_MTLOG(ML_ERROR, "Couldn't store receiving pipeline " << static_cast(rv)); @@ -514,10 +514,10 @@ MediaPipelineFactory::CreateMediaPipelineSending( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t aLevel, - RefPtr aRtpFlow, - RefPtr aRtcpFlow, + nsRefPtr aRtpFlow, + nsRefPtr aRtcpFlow, nsAutoPtr aFilter, - const RefPtr& aConduit) + const nsRefPtr& aConduit) { nsresult rv; @@ -526,7 +526,7 @@ MediaPipelineFactory::CreateMediaPipelineSending( mPCMedia->GetLocalStreamById(aTrack.GetStreamId()); // Now we have all the pieces, create the pipeline - RefPtr pipeline = new MediaPipelineTransmit( + nsRefPtr pipeline = new MediaPipelineTransmit( mPC->GetHandle(), mPC->GetMainThread().get(), mPC->GetSTSThread(), @@ -558,7 +558,7 @@ MediaPipelineFactory::CreateMediaPipelineSending( } rv = stream->StorePipeline(aTrack.GetTrackId(), - RefPtr(pipeline)); + nsRefPtr(pipeline)); if (NS_FAILED(rv)) { MOZ_MTLOG(ML_ERROR, "Couldn't store receiving pipeline " << static_cast(rv)); @@ -581,7 +581,7 @@ nsresult MediaPipelineFactory::GetOrCreateAudioConduit( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, - RefPtr* aConduitp) + nsRefPtr* aConduitp) { if (!aTrack.GetNegotiatedDetails()) { @@ -591,7 +591,7 @@ MediaPipelineFactory::GetOrCreateAudioConduit( bool receiving = aTrack.GetDirection() == sdp::kRecv; - RefPtr conduit = + nsRefPtr conduit = mPCMedia->GetAudioConduit(aTrackPair.mLevel); if (!conduit) { @@ -691,7 +691,7 @@ nsresult MediaPipelineFactory::GetOrCreateVideoConduit( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, - RefPtr* aConduitp) + nsRefPtr* aConduitp) { if (!aTrack.GetNegotiatedDetails()) { @@ -701,7 +701,7 @@ MediaPipelineFactory::GetOrCreateVideoConduit( bool receiving = aTrack.GetDirection() == sdp::kRecv; - RefPtr conduit = + nsRefPtr conduit = mPCMedia->GetVideoConduit(aTrackPair.mLevel); if (!conduit) { diff --git a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.h b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.h index 972c4368a69..c877775558f 100644 --- a/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.h +++ b/media/webrtc/signaling/src/peerconnection/MediaPipelineFactory.h @@ -9,7 +9,7 @@ #include "transportflow.h" #include "signaling/src/jsep/JsepTrack.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" namespace mozilla { @@ -30,27 +30,27 @@ private: const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t level, - RefPtr aRtpFlow, - RefPtr aRtcpFlow, + nsRefPtr aRtpFlow, + nsRefPtr aRtcpFlow, nsAutoPtr filter, - const RefPtr& aConduit); + const nsRefPtr& aConduit); nsresult CreateMediaPipelineSending( const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t level, - RefPtr aRtpFlow, - RefPtr aRtcpFlow, + nsRefPtr aRtpFlow, + nsRefPtr aRtcpFlow, nsAutoPtr filter, - const RefPtr& aConduit); + const nsRefPtr& aConduit); nsresult GetOrCreateAudioConduit(const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, - RefPtr* aConduitp); + nsRefPtr* aConduitp); nsresult GetOrCreateVideoConduit(const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, - RefPtr* aConduitp); + nsRefPtr* aConduitp); MediaConduitErrorCode EnsureExternalCodec(VideoSessionConduit& aConduit, VideoCodecConfig* aConfig, @@ -58,13 +58,13 @@ private: nsresult CreateOrGetTransportFlow(size_t aLevel, bool aIsRtcp, const JsepTransport& transport, - RefPtr* out); + nsRefPtr* out); nsresult GetTransportParameters(const JsepTrackPair& aTrackPair, const JsepTrack& aTrack, size_t* aLevelOut, - RefPtr* aRtpOut, - RefPtr* aRtcpOut, + nsRefPtr* aRtpOut, + nsRefPtr* aRtcpOut, nsAutoPtr* aFilterOut); nsresult ConfigureVideoCodecMode(const JsepTrack& aTrack, diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 97f7d74052b..9568b0ed238 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -881,7 +881,7 @@ PeerConnectionImpl::Certificate() const } #endif -mozilla::RefPtr +nsRefPtr PeerConnectionImpl::Identity() const { PC_AUTO_ENTER_API_CALL_NO_CHECK(); @@ -889,7 +889,7 @@ PeerConnectionImpl::Identity() const MOZ_ASSERT(mCertificate); return mCertificate->CreateDtlsIdentity(); #else - mozilla::RefPtr id = mIdentity; + nsRefPtr id = mIdentity; return id; #endif } @@ -1367,7 +1367,7 @@ PeerConnectionImpl::CreateDataChannel(const nsAString& aLabel, return NS_ERROR_FAILURE; } - RefPtr track(new JsepTrack( + nsRefPtr track(new JsepTrack( mozilla::SdpMediaSection::kApplication, streamId, trackId, @@ -1763,13 +1763,13 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) __FUNCTION__, mHandle.c_str(), errorString.c_str()); pco->OnSetRemoteDescriptionError(error, ObString(errorString.c_str()), jrv); } else { - std::vector> newTracks = + std::vector> newTracks = mJsepSession->GetRemoteTracksAdded(); // Group new tracks by stream id - std::map>> tracksByStreamId; + std::map>> tracksByStreamId; for (auto i = newTracks.begin(); i != newTracks.end(); ++i) { - RefPtr track = *i; + nsRefPtr track = *i; if (track->GetMediaType() == mozilla::SdpMediaSection::kApplication) { // Ignore datachannel @@ -1781,7 +1781,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) for (auto i = tracksByStreamId.begin(); i != tracksByStreamId.end(); ++i) { std::string streamId = i->first; - std::vector>& tracks = i->second; + std::vector>& tracks = i->second; nsRefPtr info = mMedia->GetRemoteStreamById(streamId); @@ -1817,7 +1817,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) size_t numPreexistingTrackIds = 0; for (auto j = tracks.begin(); j != tracks.end(); ++j) { - RefPtr track = *j; + nsRefPtr track = *j; if (!info->HasTrack(track->GetTrackId())) { if (track->GetMediaType() == SdpMediaSection::kAudio) { ++numNewAudioTracks; @@ -1850,7 +1850,7 @@ PeerConnectionImpl::SetRemoteDescription(int32_t action, const char* aSDP) #endif } - std::vector> removedTracks = + std::vector> removedTracks = mJsepSession->GetRemoteTracksRemoved(); for (auto i = removedTracks.begin(); i != removedTracks.end(); ++i) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index b562834fd2c..8467f0dedfa 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -12,7 +12,7 @@ #include #include "prlock.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsWeakPtr.h" #include "nsAutoPtr.h" #include "nsIWeakReferenceUtils.h" // for the definition of nsWeakPtr @@ -222,8 +222,8 @@ class RTCStatsQuery { friend class PeerConnectionImpl; std::string pcName; bool internalStats; - nsTArray> pipelines; - mozilla::RefPtr iceCtx; + nsTArray> pipelines; + nsRefPtr iceCtx; bool grabAllLevels; DOMHighResTimeStamp now; }; @@ -365,7 +365,7 @@ public: const nsRefPtr& Certificate() const; #endif // This is a hack to support external linkage. - mozilla::RefPtr Identity() const; + nsRefPtr Identity() const; NS_IMETHODIMP_TO_ERRORRESULT(CreateOffer, ErrorResult &rv, const RTCOfferOptions& aOptions) @@ -742,7 +742,7 @@ private: // The certificate we are using. nsRefPtr mCertificate; #else - mozilla::RefPtr mIdentity; + nsRefPtr mIdentity; #endif // Whether an app should be prevented from accessing media produced by the PC // If this is true, then media will not be sent until mPeerIdentity matches diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index a0b8eb11026..0aaeb5c477d 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -61,7 +61,7 @@ PeerConnectionMedia::ReplaceTrack(const std::string& aOldStreamId, const std::string& aNewStreamId, const std::string& aNewTrackId) { - RefPtr oldInfo(GetLocalStreamById(aOldStreamId)); + nsRefPtr oldInfo(GetLocalStreamById(aOldStreamId)); if (!oldInfo) { CSFLogError(logTag, "Failed to find stream id %s", aOldStreamId.c_str()); @@ -71,7 +71,7 @@ PeerConnectionMedia::ReplaceTrack(const std::string& aOldStreamId, nsresult rv = AddTrack(aNewStream, aNewStreamId, aNewTrackId); NS_ENSURE_SUCCESS(rv, rv); - RefPtr newInfo(GetLocalStreamById(aNewStreamId)); + nsRefPtr newInfo(GetLocalStreamById(aNewStreamId)); if (!newInfo) { CSFLogError(logTag, "Failed to add track id %s", aNewTrackId.c_str()); @@ -86,11 +86,11 @@ PeerConnectionMedia::ReplaceTrack(const std::string& aOldStreamId, } static void -PipelineReleaseRef_m(RefPtr pipeline) +PipelineReleaseRef_m(nsRefPtr pipeline) {} static void -PipelineDetachTransport_s(RefPtr pipeline, +PipelineDetachTransport_s(nsRefPtr pipeline, nsCOMPtr mainThread) { pipeline->ShutdownTransport_s(); @@ -105,7 +105,7 @@ void SourceStreamInfo::RemoveTrack(const std::string& trackId) { mTracks.erase(trackId); - RefPtr pipeline = GetPipelineByTrackId_m(trackId); + nsRefPtr pipeline = GetPipelineByTrackId_m(trackId); if (pipeline) { mPipelines.erase(trackId); pipeline->ShutdownMedia_m(); @@ -377,10 +377,10 @@ PeerConnectionMedia::EnsureTransports(const JsepSession& aSession) { auto transports = aSession.GetTransports(); for (size_t i = 0; i < transports.size(); ++i) { - RefPtr transport = transports[i]; + nsRefPtr transport = transports[i]; RUN_ON_THREAD( GetSTSThread(), - WrapRunnable(RefPtr(this), + WrapRunnable(nsRefPtr(this), &PeerConnectionMedia::EnsureTransport_s, i, transport->mComponents), @@ -393,7 +393,7 @@ PeerConnectionMedia::EnsureTransports(const JsepSession& aSession) void PeerConnectionMedia::EnsureTransport_s(size_t aLevel, size_t aComponentCount) { - RefPtr stream(mIceCtx->GetStream(aLevel)); + nsRefPtr stream(mIceCtx->GetStream(aLevel)); if (!stream) { CSFLogDebug(logTag, "%s: Creating ICE media stream=%u components=%u", mParentHandle.c_str(), @@ -402,7 +402,7 @@ PeerConnectionMedia::EnsureTransport_s(size_t aLevel, size_t aComponentCount) std::ostringstream os; os << mParentName << " aLevel=" << aLevel; - RefPtr stream = mIceCtx->CreateStream(os.str().c_str(), + nsRefPtr stream = mIceCtx->CreateStream(os.str().c_str(), aComponentCount); if (!stream) { @@ -423,7 +423,7 @@ PeerConnectionMedia::ActivateOrRemoveTransports(const JsepSession& aSession) { auto transports = aSession.GetTransports(); for (size_t i = 0; i < transports.size(); ++i) { - RefPtr transport = transports[i]; + nsRefPtr transport = transports[i]; std::string ufrag; std::string pwd; @@ -444,7 +444,7 @@ PeerConnectionMedia::ActivateOrRemoveTransports(const JsepSession& aSession) RUN_ON_THREAD( GetSTSThread(), - WrapRunnable(RefPtr(this), + WrapRunnable(nsRefPtr(this), &PeerConnectionMedia::ActivateOrRemoveTransport_s, i, transport->mComponents, @@ -457,7 +457,7 @@ PeerConnectionMedia::ActivateOrRemoveTransports(const JsepSession& aSession) // We can have more streams than m-lines due to rollback. RUN_ON_THREAD( GetSTSThread(), - WrapRunnable(RefPtr(this), + WrapRunnable(nsRefPtr(this), &PeerConnectionMedia::RemoveTransportsAtOrAfter_s, transports.size()), NS_DISPATCH_NORMAL); @@ -479,7 +479,7 @@ PeerConnectionMedia::ActivateOrRemoveTransport_s( return; } - RefPtr stream(mIceCtx->GetStream(aMLine)); + nsRefPtr stream(mIceCtx->GetStream(aMLine)); if (!stream) { MOZ_ASSERT(false); return; @@ -555,7 +555,7 @@ PeerConnectionMedia::StartIceChecks(const JsepSession& aSession) { nsCOMPtr runnable( WrapRunnable( - RefPtr(this), + nsRefPtr(this), &PeerConnectionMedia::StartIceChecks_s, aSession.IsIceControlling(), aSession.RemoteIsIceLite(), @@ -603,7 +603,7 @@ PeerConnectionMedia::AddIceCandidate(const std::string& candidate, uint32_t aMLine) { RUN_ON_THREAD(GetSTSThread(), WrapRunnable( - RefPtr(this), + nsRefPtr(this), &PeerConnectionMedia::AddIceCandidate_s, std::string(candidate), // Make copies. std::string(mid), @@ -614,7 +614,7 @@ void PeerConnectionMedia::AddIceCandidate_s(const std::string& aCandidate, const std::string& aMid, uint32_t aMLine) { - RefPtr stream(mIceCtx->GetStream(aMLine)); + nsRefPtr stream(mIceCtx->GetStream(aMLine)); if (!stream) { CSFLogError(logTag, "No ICE stream for candidate at level %u: %s", static_cast(aMLine), aCandidate.c_str()); @@ -661,7 +661,7 @@ PeerConnectionMedia::GatherIfReady() { ASSERT_ON_THREAD(mMainThread); nsCOMPtr runnable(WrapRunnable( - RefPtr(this), + nsRefPtr(this), &PeerConnectionMedia::EnsureIceGathering_s)); PerformOrEnqueueIceCtxOperation(runnable); @@ -909,7 +909,7 @@ PeerConnectionMedia::IceGatheringStateChange_s(NrIceCtx* ctx, if (state == NrIceCtx::ICE_CTX_GATHER_COMPLETE) { // Fire off EndOfLocalCandidates for each stream for (size_t i = 0; ; ++i) { - RefPtr stream(ctx->GetStream(i)); + nsRefPtr stream(ctx->GetStream(i)); if (!stream) { break; } @@ -1076,7 +1076,7 @@ PeerConnectionMedia::DtlsConnected_m(const std::string& aParentHandle, void PeerConnectionMedia::AddTransportFlow(int aIndex, bool aRtcp, - const RefPtr &aFlow) + const nsRefPtr &aFlow) { int index_inner = GetTransportFlowIndex(aIndex, aRtcp); @@ -1099,7 +1099,7 @@ PeerConnectionMedia::RemoveTransportFlow(int aIndex, bool aRtcp) } void -PeerConnectionMedia::ConnectDtlsListener_s(const RefPtr& aFlow) +PeerConnectionMedia::ConnectDtlsListener_s(const nsRefPtr& aFlow) { TransportLayer* dtls = aFlow->GetLayer(TransportLayerDtls::ID()); if (dtls) { @@ -1108,7 +1108,7 @@ PeerConnectionMedia::ConnectDtlsListener_s(const RefPtr& aFlow) } nsresult -LocalSourceStreamInfo::TakePipelineFrom(RefPtr& info, +LocalSourceStreamInfo::TakePipelineFrom(nsRefPtr& info, const std::string& oldTrackId, const std::string& newTrackId) { @@ -1118,7 +1118,7 @@ LocalSourceStreamInfo::TakePipelineFrom(RefPtr& info, return NS_ERROR_INVALID_ARG; } - RefPtr pipeline(info->ForgetPipelineByTrackId_m(oldTrackId)); + nsRefPtr pipeline(info->ForgetPipelineByTrackId_m(oldTrackId)); if (!pipeline) { // Replacetrack can potentially happen in the middle of offer/answer, before @@ -1255,7 +1255,7 @@ SourceStreamInfo::GetVideoTrackByTrackId(const std::string& trackId) nsresult SourceStreamInfo::StorePipeline( const std::string& trackId, - const mozilla::RefPtr& aPipeline) + const nsRefPtr& aPipeline) { MOZ_ASSERT(mPipelines.find(trackId) == mPipelines.end()); if (mPipelines.find(trackId) != mPipelines.end()) { @@ -1269,7 +1269,7 @@ SourceStreamInfo::StorePipeline( void RemoteSourceStreamInfo::SyncPipeline( - RefPtr aPipeline) + nsRefPtr aPipeline) { // See if we have both audio and video here, and if so cross the streams and // sync them @@ -1316,14 +1316,14 @@ RemoteSourceStreamInfo::StartReceiving() CSFLogDebug(logTag, "Finished adding tracks to MediaStream %p", source); } -RefPtr SourceStreamInfo::GetPipelineByTrackId_m( +nsRefPtr SourceStreamInfo::GetPipelineByTrackId_m( const std::string& trackId) { ASSERT_ON_THREAD(mParent->GetMainThread()); // Refuse to hand out references if we're tearing down. // (Since teardown involves a dispatch to and from STS before MediaPipelines // are released, it is safe to start other dispatches to and from STS with a - // RefPtr, since that reference won't be the last one + // nsRefPtr, since that reference won't be the last one // standing) if (mMediaStream) { if (mPipelines.count(trackId)) { @@ -1342,11 +1342,11 @@ LocalSourceStreamInfo::ForgetPipelineByTrackId_m(const std::string& trackId) // Refuse to hand out references if we're tearing down. // (Since teardown involves a dispatch to and from STS before MediaPipelines // are released, it is safe to start other dispatches to and from STS with a - // RefPtr, since that reference won't be the last one + // nsRefPtr, since that reference won't be the last one // standing) if (mMediaStream) { if (mPipelines.count(trackId)) { - RefPtr pipeline(mPipelines[trackId]); + nsRefPtr pipeline(mPipelines[trackId]); mPipelines.erase(trackId); return pipeline.forget(); } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h index 4e71b7f682b..71c5443760e 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h @@ -12,7 +12,7 @@ #include "nspr.h" #include "prlock.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "nsComponentManagerUtils.h" #if !defined(MOZILLA_XPCOMRT_API) @@ -87,7 +87,7 @@ public: } nsresult StorePipeline(const std::string& trackId, - const RefPtr& aPipeline); + const nsRefPtr& aPipeline); virtual void AddTrack(const std::string& trackId) { mTracks.insert(trackId); } void RemoveTrack(const std::string& trackId); @@ -99,9 +99,9 @@ public: // This method exists for stats and the unittests. // It allows visibility into the pipelines and flows. - const std::map>& + const std::map>& GetPipelines() const { return mPipelines; } - RefPtr GetPipelineByTrackId_m(const std::string& trackId); + nsRefPtr GetPipelineByTrackId_m(const std::string& trackId); const std::string& GetId() const { return mId; } void DetachTransport_s(); @@ -117,7 +117,7 @@ protected: // These get set up before we generate our local description, the pipelines // and conduits are set up once offer/answer completes. std::set mTracks; - std::map> mPipelines; + std::map> mPipelines; }; // TODO(ekr@rtfm.com): Refactor {Local,Remote}SourceStreamInfo @@ -132,7 +132,7 @@ public: const std::string& aId) : SourceStreamInfo(aMediaStream, aParent, aId) {} - nsresult TakePipelineFrom(RefPtr& info, + nsresult TakePipelineFrom(nsRefPtr& info, const std::string& oldTrackId, const std::string& newTrackId); @@ -159,7 +159,7 @@ class RemoteSourceStreamInfo : public SourceStreamInfo { { } - void SyncPipeline(RefPtr aPipeline); + void SyncPipeline(nsRefPtr aPipeline); #if !defined(MOZILLA_EXTERNAL_LINKAGE) void UpdatePrincipal_m(nsIPrincipal* aPrincipal); @@ -233,9 +233,9 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // WARNING: This destroys the object! void SelfDestruct(); - RefPtr ice_ctx() const { return mIceCtx; } + nsRefPtr ice_ctx() const { return mIceCtx; } - RefPtr ice_media_stream(size_t i) const { + nsRefPtr ice_media_stream(size_t i) const { return mIceCtx->GetStream(i); } @@ -325,7 +325,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // Get a transport flow either RTP/RTCP for a particular stream // A stream can be of audio/video/datachannel/budled(?) types - RefPtr GetTransportFlow(int aStreamIndex, bool aIsRtcp) { + nsRefPtr GetTransportFlow(int aStreamIndex, bool aIsRtcp) { int index_inner = GetTransportFlowIndex(aStreamIndex, aIsRtcp); if (mTransportFlows.find(index_inner) == mTransportFlows.end()) @@ -336,15 +336,15 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // Add a transport flow void AddTransportFlow(int aIndex, bool aRtcp, - const RefPtr &aFlow); + const nsRefPtr &aFlow); void RemoveTransportFlow(int aIndex, bool aRtcp); - void ConnectDtlsListener_s(const RefPtr& aFlow); + void ConnectDtlsListener_s(const nsRefPtr& aFlow); void DtlsConnected_s(TransportLayer* aFlow, TransportLayer::State state); static void DtlsConnected_m(const std::string& aParentHandle, bool aPrivacyRequested); - RefPtr GetAudioConduit(size_t level) { + nsRefPtr GetAudioConduit(size_t level) { auto it = mConduits.find(level); if (it == mConduits.end()) { return nullptr; @@ -355,11 +355,11 @@ class PeerConnectionMedia : public sigslot::has_slots<> { return nullptr; } - return RefPtr( + return nsRefPtr( static_cast(it->second.second.get())); } - RefPtr GetVideoConduit(size_t level) { + nsRefPtr GetVideoConduit(size_t level) { auto it = mConduits.find(level); if (it == mConduits.end()) { return nullptr; @@ -370,16 +370,16 @@ class PeerConnectionMedia : public sigslot::has_slots<> { return nullptr; } - return RefPtr( + return nsRefPtr( static_cast(it->second.second.get())); } // Add a conduit - void AddAudioConduit(size_t level, const RefPtr &aConduit) { + void AddAudioConduit(size_t level, const nsRefPtr &aConduit) { mConduits[level] = std::make_pair(false, aConduit); } - void AddVideoConduit(size_t level, const RefPtr &aConduit) { + void AddVideoConduit(size_t level, const nsRefPtr &aConduit) { mConduits[level] = std::make_pair(true, aConduit); } @@ -410,7 +410,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> { private: void SetProxyOnPcm(nsIProxyInfo& proxyinfo); - RefPtr pcm_; + nsRefPtr pcm_; virtual ~ProtocolProxyQueryHandler() {} }; #endif // !defined(MOZILLA_XPCOMRT_API) @@ -487,16 +487,16 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // This is only accessed on the main thread (with one special exception) nsTArray > mRemoteSourceStreams; - std::map>> mConduits; + std::map>> mConduits; // ICE objects - RefPtr mIceCtx; + nsRefPtr mIceCtx; // DNS nsRefPtr mDNSResolver; // Transport flows: even is RTP, odd is RTCP - std::map > mTransportFlows; + std::map > mTransportFlows; // UUID Generator UniquePtr mUuidGen; diff --git a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp index 33486b36ce6..a0416b06dc5 100644 --- a/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp +++ b/media/webrtc/signaling/src/peerconnection/WebrtcGlobalInformation.cpp @@ -28,7 +28,7 @@ #include "mozilla/Telemetry.h" #include "mozilla/unused.h" #include "mozilla/StaticMutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "rlogringbuffer.h" #include "runnable_utils.h" @@ -84,13 +84,13 @@ public: } Result mResult; - std::queue> mContactList; + std::queue> mContactList; const int mRequestId; - RefPtr GetNextParent() + nsRefPtr GetNextParent() { while (!mContactList.empty()) { - RefPtr next = mContactList.front(); + nsRefPtr next = mContactList.front(); mContactList.pop(); if (next->IsActive()) { return next; @@ -193,22 +193,22 @@ public: { return sContentParents.empty(); } - static const std::vector>& GetAll() + static const std::vector>& GetAll() { return sContentParents; } private: - static std::vector> sContentParents; + static std::vector> sContentParents; WebrtcContentParents() = delete; WebrtcContentParents(const WebrtcContentParents&) = delete; WebrtcContentParents& operator=(const WebrtcContentParents&) = delete; }; -std::vector> WebrtcContentParents::sContentParents; +std::vector> WebrtcContentParents::sContentParents; WebrtcGlobalParent* WebrtcContentParents::Alloc() { - RefPtr cp = new WebrtcGlobalParent; + nsRefPtr cp = new WebrtcGlobalParent; sContentParents.push_back(cp); return cp.get(); } diff --git a/media/webrtc/signaling/test/jsep_session_unittest.cpp b/media/webrtc/signaling/test/jsep_session_unittest.cpp index 6f486ee9664..269fdfd53e7 100644 --- a/media/webrtc/signaling/test/jsep_session_unittest.cpp +++ b/media/webrtc/signaling/test/jsep_session_unittest.cpp @@ -11,7 +11,7 @@ #include "nss.h" #include "ssl.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Tuple.h" #define GTEST_HAS_RTTI 0 @@ -202,12 +202,12 @@ protected: for (auto track = mediatypes.begin(); track != mediatypes.end(); ++track) { ASSERT_TRUE(uuid_gen.Generate(&track_id)); - RefPtr mst(new JsepTrack(*track, stream_id, track_id)); + nsRefPtr mst(new JsepTrack(*track, stream_id, track_id)); side.AddTrack(mst); } } - bool HasMediaStream(std::vector> tracks) const { + bool HasMediaStream(std::vector> tracks) const { for (auto i = tracks.begin(); i != tracks.end(); ++i) { if ((*i)->GetMediaType() != SdpMediaSection::kApplication) { return 1; @@ -222,7 +222,7 @@ protected: } std::vector - GetMediaStreamIds(std::vector> tracks) const { + GetMediaStreamIds(std::vector> tracks) const { std::vector ids; for (auto i = tracks.begin(); i != tracks.end(); ++i) { // data channels don't have msid's @@ -262,7 +262,7 @@ protected: return sortUniqueStrVector(GetRemoteMediaStreamIds(side)); } - RefPtr GetTrack(JsepSessionImpl& side, + nsRefPtr GetTrack(JsepSessionImpl& side, SdpMediaSection::MediaType type, size_t index) const { auto tracks = side.GetLocalTracks(); @@ -280,15 +280,15 @@ protected: return *i; } - return RefPtr(nullptr); + return nsRefPtr(nullptr); } - RefPtr GetTrackOff(size_t index, + nsRefPtr GetTrackOff(size_t index, SdpMediaSection::MediaType type) { return GetTrack(mSessionOff, type, index); } - RefPtr GetTrackAns(size_t index, + nsRefPtr GetTrackAns(size_t index, SdpMediaSection::MediaType type) { return GetTrack(mSessionAns, type, index); } @@ -1296,7 +1296,7 @@ TEST_P(JsepSessionTest, RenegotiationOffererRemovesTrack) auto offererPairs = GetTrackPairsByLevel(mSessionOff); auto answererPairs = GetTrackPairsByLevel(mSessionAns); - RefPtr removedTrack = GetTrackOff(0, types.front()); + nsRefPtr removedTrack = GetTrackOff(0, types.front()); ASSERT_TRUE(removedTrack); ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(), removedTrack->GetTrackId())); @@ -1374,7 +1374,7 @@ TEST_P(JsepSessionTest, RenegotiationAnswererRemovesTrack) auto offererPairs = GetTrackPairsByLevel(mSessionOff); auto answererPairs = GetTrackPairsByLevel(mSessionAns); - RefPtr removedTrack = GetTrackAns(0, types.front()); + nsRefPtr removedTrack = GetTrackAns(0, types.front()); ASSERT_TRUE(removedTrack); ASSERT_EQ(NS_OK, mSessionAns.RemoveTrack(removedTrack->GetStreamId(), removedTrack->GetTrackId())); @@ -1452,12 +1452,12 @@ TEST_P(JsepSessionTest, RenegotiationBothRemoveTrack) auto offererPairs = GetTrackPairsByLevel(mSessionOff); auto answererPairs = GetTrackPairsByLevel(mSessionAns); - RefPtr removedTrackAnswer = GetTrackAns(0, types.front()); + nsRefPtr removedTrackAnswer = GetTrackAns(0, types.front()); ASSERT_TRUE(removedTrackAnswer); ASSERT_EQ(NS_OK, mSessionAns.RemoveTrack(removedTrackAnswer->GetStreamId(), removedTrackAnswer->GetTrackId())); - RefPtr removedTrackOffer = GetTrackOff(0, types.front()); + nsRefPtr removedTrackOffer = GetTrackOff(0, types.front()); ASSERT_TRUE(removedTrackOffer); ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrackOffer->GetStreamId(), removedTrackOffer->GetTrackId())); @@ -1541,12 +1541,12 @@ TEST_P(JsepSessionTest, RenegotiationBothRemoveThenAddTrack) OfferAnswer(); - RefPtr removedTrackAnswer = GetTrackAns(0, removedType); + nsRefPtr removedTrackAnswer = GetTrackAns(0, removedType); ASSERT_TRUE(removedTrackAnswer); ASSERT_EQ(NS_OK, mSessionAns.RemoveTrack(removedTrackAnswer->GetStreamId(), removedTrackAnswer->GetTrackId())); - RefPtr removedTrackOffer = GetTrackOff(0, removedType); + nsRefPtr removedTrackOffer = GetTrackOff(0, removedType); ASSERT_TRUE(removedTrackOffer); ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrackOffer->GetStreamId(), removedTrackOffer->GetTrackId())); @@ -1609,13 +1609,13 @@ TEST_P(JsepSessionTest, RenegotiationBothRemoveTrackDifferentMsection) auto offererPairs = GetTrackPairsByLevel(mSessionOff); auto answererPairs = GetTrackPairsByLevel(mSessionAns); - RefPtr removedTrackAnswer = GetTrackAns(0, types.front()); + nsRefPtr removedTrackAnswer = GetTrackAns(0, types.front()); ASSERT_TRUE(removedTrackAnswer); ASSERT_EQ(NS_OK, mSessionAns.RemoveTrack(removedTrackAnswer->GetStreamId(), removedTrackAnswer->GetTrackId())); // Second instance of the same type - RefPtr removedTrackOffer = GetTrackOff(1, types.front()); + nsRefPtr removedTrackOffer = GetTrackOff(1, types.front()); ASSERT_TRUE(removedTrackOffer); ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrackOffer->GetStreamId(), removedTrackOffer->GetTrackId())); @@ -1712,11 +1712,11 @@ TEST_P(JsepSessionTest, RenegotiationOffererReplacesTrack) auto offererPairs = GetTrackPairsByLevel(mSessionOff); auto answererPairs = GetTrackPairsByLevel(mSessionAns); - RefPtr removedTrack = GetTrackOff(0, types.front()); + nsRefPtr removedTrack = GetTrackOff(0, types.front()); ASSERT_TRUE(removedTrack); ASSERT_EQ(NS_OK, mSessionOff.RemoveTrack(removedTrack->GetStreamId(), removedTrack->GetTrackId())); - RefPtr addedTrack( + nsRefPtr addedTrack( new JsepTrack(types.front(), "newstream", "newtrack")); ASSERT_EQ(NS_OK, mSessionOff.AddTrack(addedTrack)); @@ -2598,11 +2598,11 @@ TEST_F(JsepSessionTest, OfferToReceiveVideoNotUsed) TEST_F(JsepSessionTest, CreateOfferNoDatachannelDefault) { - RefPtr msta( + nsRefPtr msta( new JsepTrack(SdpMediaSection::kAudio, "offerer_stream", "a1")); mSessionOff.AddTrack(msta); - RefPtr mstv1( + nsRefPtr mstv1( new JsepTrack(SdpMediaSection::kVideo, "offerer_stream", "v1")); mSessionOff.AddTrack(mstv1); @@ -2623,10 +2623,10 @@ TEST_F(JsepSessionTest, ValidateOfferedCodecParams) types.push_back(SdpMediaSection::kAudio); types.push_back(SdpMediaSection::kVideo); - RefPtr msta( + nsRefPtr msta( new JsepTrack(SdpMediaSection::kAudio, "offerer_stream", "a1")); mSessionOff.AddTrack(msta); - RefPtr mstv1( + nsRefPtr mstv1( new JsepTrack(SdpMediaSection::kVideo, "offerer_stream", "v2")); mSessionOff.AddTrack(mstv1); @@ -2744,10 +2744,10 @@ TEST_F(JsepSessionTest, ValidateAnsweredCodecParams) types.push_back(SdpMediaSection::kAudio); types.push_back(SdpMediaSection::kVideo); - RefPtr msta( + nsRefPtr msta( new JsepTrack(SdpMediaSection::kAudio, "offerer_stream", "a1")); mSessionOff.AddTrack(msta); - RefPtr mstv1( + nsRefPtr mstv1( new JsepTrack(SdpMediaSection::kVideo, "offerer_stream", "v1")); mSessionOff.AddTrack(mstv1); @@ -2755,10 +2755,10 @@ TEST_F(JsepSessionTest, ValidateAnsweredCodecParams) SetLocalOffer(offer); SetRemoteOffer(offer); - RefPtr msta_ans( + nsRefPtr msta_ans( new JsepTrack(SdpMediaSection::kAudio, "answerer_stream", "a1")); mSessionAns.AddTrack(msta); - RefPtr mstv1_ans( + nsRefPtr mstv1_ans( new JsepTrack(SdpMediaSection::kVideo, "answerer_stream", "v1")); mSessionAns.AddTrack(mstv1); @@ -2898,7 +2898,7 @@ GetCodec(JsepSession& session, *codecOut = nullptr; ASSERT_LT(pairIndex, session.GetNegotiatedTrackPairs().size()); JsepTrackPair pair(session.GetNegotiatedTrackPairs().front()); - RefPtr track( + nsRefPtr track( (direction == sdp::kSend) ? pair.mSending : pair.mReceiving); ASSERT_TRUE(track); ASSERT_TRUE(track->GetNegotiatedDetails()); @@ -3392,7 +3392,7 @@ TEST_F(JsepSessionTest, TestRtcpFbStar) SetRemoteAnswer(answer, CHECK_SUCCESS); ASSERT_EQ(1U, mSessionAns.GetRemoteTracks().size()); - RefPtr track = mSessionAns.GetRemoteTracks()[0]; + nsRefPtr track = mSessionAns.GetRemoteTracks()[0]; ASSERT_TRUE(track->GetNegotiatedDetails()); auto* details = track->GetNegotiatedDetails(); for (size_t i = 0; i < details->GetCodecCount(); ++i) { @@ -3685,7 +3685,7 @@ size_t GetActiveTransportCount(const JsepSession& session) { auto transports = session.GetTransports(); size_t activeTransportCount = 0; - for (RefPtr& transport : transports) { + for (nsRefPtr& transport : transports) { activeTransportCount += transport->mComponents; } return activeTransportCount; diff --git a/media/webrtc/signaling/test/mediaconduit_unittests.cpp b/media/webrtc/signaling/test/mediaconduit_unittests.cpp index 63050c2bcda..e5077bc62d5 100644 --- a/media/webrtc/signaling/test/mediaconduit_unittests.cpp +++ b/media/webrtc/signaling/test/mediaconduit_unittests.cpp @@ -83,7 +83,7 @@ public: void SetRate(int r) { rate = r; } - void Init(mozilla::RefPtr aSession) + void Init(nsRefPtr aSession) { mSession = aSession; mLen = ((width * height) * 3 / 2); @@ -109,7 +109,7 @@ public: } private: -mozilla::RefPtr mSession; +nsRefPtr mSession; mozilla::ScopedDeletePtr mFrame; int mLen; int width, height; @@ -141,8 +141,8 @@ public: { } - void Init(mozilla::RefPtr aSession, - mozilla::RefPtr aOtherSession, + void Init(nsRefPtr aSession, + nsRefPtr aOtherSession, std::string fileIn, std::string fileOut) { @@ -157,8 +157,8 @@ public: private: - mozilla::RefPtr mSession; - mozilla::RefPtr mOtherSession; + nsRefPtr mSession; + nsRefPtr mOtherSession; std::string iFile; std::string oFile; @@ -465,8 +465,8 @@ public: } //Treat this object as Audio Transport - void SetAudioSession(mozilla::RefPtr aSession, - mozilla::RefPtr + void SetAudioSession(nsRefPtr aSession, + nsRefPtr aOtherSession) { mAudioSession = aSession; @@ -475,8 +475,8 @@ public: } // Treat this object as Video Transport - void SetVideoSession(mozilla::RefPtr aSession, - mozilla::RefPtr + void SetVideoSession(nsRefPtr aSession, + nsRefPtr aOtherSession) { mVideoSession = aSession; @@ -485,10 +485,10 @@ public: } private: - mozilla::RefPtr mAudioSession; - mozilla::RefPtr mVideoSession; - mozilla::RefPtr mOtherVideoSession; - mozilla::RefPtr mOtherAudioSession; + nsRefPtr mAudioSession; + nsRefPtr mVideoSession; + nsRefPtr mOtherVideoSession; + nsRefPtr mOtherAudioSession; int numPkts; bool mAudio, mVideo; }; @@ -687,7 +687,7 @@ class TransportConduitTest : public ::testing::Test void TestVideoConduitCodecAPI() { int err = 0; - mozilla::RefPtr videoSession; + nsRefPtr videoSession; //get pointer to VideoSessionConduit mozilla::SyncRunnable::DispatchToThread(gMainThread, WrapRunnableNMRet(&videoSession, @@ -948,16 +948,16 @@ class TransportConduitTest : public ::testing::Test private: //Audio Conduit Test Objects - mozilla::RefPtr mAudioSession; - mozilla::RefPtr mAudioSession2; - mozilla::RefPtr mAudioTransport; + nsRefPtr mAudioSession; + nsRefPtr mAudioSession2; + nsRefPtr mAudioTransport; AudioSendAndReceive audioTester; //Video Conduit Test Objects - mozilla::RefPtr mVideoSession; - mozilla::RefPtr mVideoSession2; - mozilla::RefPtr mVideoRenderer; - mozilla::RefPtr mVideoTransport; + nsRefPtr mVideoSession; + nsRefPtr mVideoSession2; + nsRefPtr mVideoRenderer; + nsRefPtr mVideoTransport; VideoSendAndReceive videoTester; mozilla::VideoEncoder* mExternalEncoder; diff --git a/media/webrtc/signaling/test/mediapipeline_unittest.cpp b/media/webrtc/signaling/test/mediapipeline_unittest.cpp index e2484926d6d..2d38c8bf6b0 100644 --- a/media/webrtc/signaling/test/mediapipeline_unittest.cpp +++ b/media/webrtc/signaling/test/mediapipeline_unittest.cpp @@ -16,7 +16,7 @@ #include "sslproto.h" #include "dtlsidentity.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "FakeMediaStreams.h" #include "FakeMediaStreamsImpl.h" #include "MediaConduitErrors.h" @@ -123,7 +123,7 @@ class TransportInfo { flow_ = nullptr; } - mozilla::RefPtr flow_; + nsRefPtr flow_; TransportLayerLoopback *loopback_; TransportLayerDtls *dtls_; }; @@ -228,12 +228,12 @@ class TestAgent { protected: mozilla::AudioCodecConfig audio_config_; - mozilla::RefPtr audio_conduit_; + nsRefPtr audio_conduit_; nsRefPtr audio_; // TODO(bcampen@mozilla.com): Right now this does not let us test RTCP in // both directions; only the sender's RTCP is sent, but the receiver should // be sending it too. - mozilla::RefPtr audio_pipeline_; + nsRefPtr audio_pipeline_; TransportInfo audio_rtp_transport_; TransportInfo audio_rtcp_transport_; TransportInfo bundle_transport_; @@ -257,8 +257,8 @@ class TestAgentSend : public TestAgent { ASSERT_FALSE(audio_rtcp_transport_.flow_); } - RefPtr rtp(audio_rtp_transport_.flow_); - RefPtr rtcp(audio_rtcp_transport_.flow_); + nsRefPtr rtp(audio_rtp_transport_.flow_); + nsRefPtr rtcp(audio_rtcp_transport_.flow_); if (use_bundle_) { rtp = bundle_transport_.flow_; diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 454c5e5b0b7..55bdf4f2bf0 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -1136,7 +1136,7 @@ class SignalingAgent { ASSERT_TRUE(info) << "No such local stream id: " << streamId; - RefPtr pipeline; + nsRefPtr pipeline; mozilla::SyncRunnable::DispatchToThread( gMainThread, @@ -1183,7 +1183,7 @@ class SignalingAgent { ASSERT_TRUE(info) << "No such remote stream id: " << streamId; - RefPtr pipeline; + nsRefPtr pipeline; mozilla::SyncRunnable::DispatchToThread( gMainThread, @@ -1506,7 +1506,7 @@ class SignalingAgent { // the SDP. For now, we just specify audio/video, since a given DOMMediaStream // can have only one of each anyway. Once this is fixed, we will need to // pass a real track id if we want to test that case. - mozilla::RefPtr GetMediaPipeline( + nsRefPtr GetMediaPipeline( bool local, size_t stream, bool video) { SourceStreamInfo* streamInfo; if (local) { @@ -4051,7 +4051,7 @@ TEST_P(SignalingTest, MaxFsFrCalleeCodec) // Checking callee's video sending configuration does respect max-fs and // max-fr in SDP offer. - mozilla::RefPtr pipeline = + nsRefPtr pipeline = a2_->GetMediaPipeline(1, 0, 1); ASSERT_TRUE(pipeline); mozilla::MediaSessionConduit *conduit = pipeline->Conduit(); @@ -4096,7 +4096,7 @@ TEST_P(SignalingTest, MaxFsFrCallerCodec) // Checking caller's video sending configuration does respect max-fs and // max-fr in SDP answer. - mozilla::RefPtr pipeline = + nsRefPtr pipeline = a1_->GetMediaPipeline(1, 0, 1); ASSERT_TRUE(pipeline); mozilla::MediaSessionConduit *conduit = pipeline->Conduit(); diff --git a/memory/volatile/VolatileBuffer.h b/memory/volatile/VolatileBuffer.h index afb075c7253..ab623e6c058 100644 --- a/memory/volatile/VolatileBuffer.h +++ b/memory/volatile/VolatileBuffer.h @@ -7,7 +7,7 @@ #include "mozilla/mozalloc.h" #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/MemoryReporting.h" #include "mozilla/RefCounted.h" @@ -101,7 +101,7 @@ public: } protected: - RefPtr mVBuf; + nsRefPtr mVBuf; void* mMapping; void Set(VolatileBuffer* vbuf) { diff --git a/memory/volatile/tests/TestVolatileBuffer.cpp b/memory/volatile/tests/TestVolatileBuffer.cpp index 9a4a8781d7f..69984ff0269 100644 --- a/memory/volatile/tests/TestVolatileBuffer.cpp +++ b/memory/volatile/tests/TestVolatileBuffer.cpp @@ -20,7 +20,7 @@ using namespace mozilla; TEST(VolatileBufferTest, HeapVolatileBuffersWork) { - RefPtr heapbuf = new VolatileBuffer(); + nsRefPtr heapbuf = new VolatileBuffer(); ASSERT_TRUE(heapbuf) << "Failed to create VolatileBuffer"; ASSERT_TRUE(heapbuf->Init(512)) << "Failed to initialize VolatileBuffer"; @@ -34,7 +34,7 @@ TEST(VolatileBufferTest, HeapVolatileBuffersWork) TEST(VolatileBufferTest, RealVolatileBuffersWork) { - RefPtr buf = new VolatileBuffer(); + nsRefPtr buf = new VolatileBuffer(); ASSERT_TRUE(buf) << "Failed to create VolatileBuffer"; ASSERT_TRUE(buf->Init(16384)) << "Failed to initialize VolatileBuffer"; diff --git a/mfbt/RefPtr.h b/mfbt/RefPtr.h index a1ad86031ee..889aef2e027 100644 --- a/mfbt/RefPtr.h +++ b/mfbt/RefPtr.h @@ -31,7 +31,7 @@ namespace mozilla { template class OutParamRef; -template OutParamRef byRef(RefPtr&); +template OutParamRef getter_AddRefs(RefPtr&); /** * RefPtr points to a refcounted thing that has AddRef and Release @@ -159,7 +159,7 @@ private: template class OutParamRef { - friend OutParamRef byRef(RefPtr&); + friend OutParamRef getter_AddRefs(RefPtr&); public: ~OutParamRef() @@ -181,11 +181,11 @@ private: }; /** - * byRef cooperates with OutParamRef to implement COM outparam semantics. + * getter_AddRefs cooperates with OutParamRef to implement COM outparam semantics. */ template OutParamRef -byRef(RefPtr& aPtr) +getter_AddRefs(RefPtr& aPtr) { return OutParamRef(aPtr); } diff --git a/mfbt/WeakPtr.h b/mfbt/WeakPtr.h index 8b1ee0e228d..7f801f2657a 100644 --- a/mfbt/WeakPtr.h +++ b/mfbt/WeakPtr.h @@ -71,7 +71,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" #include "mozilla/RefCounted.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TypeTraits.h" #include @@ -200,9 +200,9 @@ public: private: friend class SupportsWeakPtr; - explicit WeakPtr(const RefPtr& aOther) : mRef(aOther) {} + explicit WeakPtr(const nsRefPtr& aOther) : mRef(aOther) {} - RefPtr mRef; + nsRefPtr mRef; }; } // namespace mozilla diff --git a/mfbt/tests/TestRefPtr.cpp b/mfbt/tests/TestRefPtr.cpp index 316f91df2bc..f6641affff4 100644 --- a/mfbt/tests/TestRefPtr.cpp +++ b/mfbt/tests/TestRefPtr.cpp @@ -4,11 +4,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/RefCounted.h" using mozilla::RefCounted; -using mozilla::RefPtr; class Foo : public RefCounted { @@ -36,14 +35,14 @@ struct Bar : public Foo {}; already_AddRefed NewFoo() { - RefPtr f(new Foo()); + nsRefPtr f(new Foo()); return f.forget(); } already_AddRefed NewBar() { - RefPtr bar = new Bar(); + nsRefPtr bar = new Bar(); return bar.forget(); } @@ -56,7 +55,7 @@ GetNewFoo(Foo** aFoo) } void -GetNewFoo(RefPtr* aFoo) +GetNewFoo(nsRefPtr* aFoo) { *aFoo = new Bar(); } @@ -72,30 +71,30 @@ main() { MOZ_RELEASE_ASSERT(0 == Foo::sNumDestroyed); { - RefPtr f = new Foo(); + nsRefPtr f = new Foo(); MOZ_RELEASE_ASSERT(f->refCount() == 1); } MOZ_RELEASE_ASSERT(1 == Foo::sNumDestroyed); { - RefPtr f1 = NewFoo(); - RefPtr f2(NewFoo()); + nsRefPtr f1 = NewFoo(); + nsRefPtr f2(NewFoo()); MOZ_RELEASE_ASSERT(1 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(3 == Foo::sNumDestroyed); { - RefPtr b = NewBar(); + nsRefPtr b = NewBar(); MOZ_RELEASE_ASSERT(3 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(4 == Foo::sNumDestroyed); { - RefPtr f1; + nsRefPtr f1; { f1 = new Foo(); - RefPtr f2(f1); - RefPtr f3 = f2; + nsRefPtr f2(f1); + nsRefPtr f3 = f2; MOZ_RELEASE_ASSERT(4 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(4 == Foo::sNumDestroyed); @@ -104,33 +103,33 @@ main() { { - RefPtr f = new Foo(); - RefPtr g = f.forget(); + nsRefPtr f = new Foo(); + nsRefPtr g = f.forget(); } MOZ_RELEASE_ASSERT(6 == Foo::sNumDestroyed); } { - RefPtr f = new Foo(); - GetNewFoo(byRef(f)); + nsRefPtr f = new Foo(); + GetNewFoo(getter_AddRefs(f)); MOZ_RELEASE_ASSERT(7 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(8 == Foo::sNumDestroyed); { - RefPtr f = new Foo(); + nsRefPtr f = new Foo(); GetNewFoo(&f); MOZ_RELEASE_ASSERT(9 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(10 == Foo::sNumDestroyed); { - RefPtr f1 = new Bar(); + nsRefPtr f1 = new Bar(); } MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed); { - RefPtr f = GetNullFoo(); + nsRefPtr f = GetNullFoo(); MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed); } MOZ_RELEASE_ASSERT(11 == Foo::sNumDestroyed); diff --git a/mozglue/android/nsGeckoUtils.cpp b/mozglue/android/nsGeckoUtils.cpp index 939419fa417..b6e064b82dc 100644 --- a/mozglue/android/nsGeckoUtils.cpp +++ b/mozglue/android/nsGeckoUtils.cpp @@ -9,7 +9,7 @@ #include #include "APKOpen.h" #include "Zip.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" extern "C" __attribute__ ((visibility("default"))) @@ -62,7 +62,7 @@ Java_org_mozilla_gecko_mozglue_NativeZip_getZip(JNIEnv *jenv, jclass, jstring pa JNI_Throw(jenv, "java/lang/IllegalArgumentException", "Invalid path"); return 0; } - mozilla::RefPtr zip = ZipCollection::GetZip(str); + nsRefPtr zip = ZipCollection::GetZip(str); jenv->ReleaseStringUTFChars(path, str); if (!zip) { JNI_Throw(jenv, "java/lang/IllegalArgumentException", "Invalid path or invalid zip"); @@ -79,7 +79,7 @@ Java_org_mozilla_gecko_mozglue_NativeZip_getZipFromByteBuffer(JNIEnv *jenv, jcla { void *buf = jenv->GetDirectBufferAddress(buffer); size_t size = jenv->GetDirectBufferCapacity(buffer); - mozilla::RefPtr zip = Zip::Create(buf, size); + nsRefPtr zip = Zip::Create(buf, size); if (!zip) { JNI_Throw(jenv, "java/lang/IllegalArgumentException", "Invalid zip"); return 0; diff --git a/mozglue/linker/BaseElf.cpp b/mozglue/linker/BaseElf.cpp index 8a78285ef6e..1586934ff51 100644 --- a/mozglue/linker/BaseElf.cpp +++ b/mozglue/linker/BaseElf.cpp @@ -5,7 +5,7 @@ #include "BaseElf.h" #include "Elfxx.h" #include "Logging.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" using namespace Elf; using namespace mozilla; @@ -97,7 +97,7 @@ LoadedElf::Create(const char *path, void *base_addr) if (mincore(const_cast(base_addr), PageSize(), &mapped)) return nullptr; - RefPtr elf = new LoadedElf(path); + nsRefPtr elf = new LoadedElf(path); const Ehdr *ehdr = Ehdr::validate(base_addr); if (!ehdr) diff --git a/mozglue/linker/BaseElf.h b/mozglue/linker/BaseElf.h index a7b708b50bb..40c9d1563bf 100644 --- a/mozglue/linker/BaseElf.h +++ b/mozglue/linker/BaseElf.h @@ -81,7 +81,7 @@ public: /* Appropriated Mappable */ /* /!\ we rely on this being nullptr for BaseElf instances, but not * CustomElf instances. */ - mozilla::RefPtr mappable; + nsRefPtr mappable; /* Base address where the library is loaded */ MappedPtr base; diff --git a/mozglue/linker/CustomElf.cpp b/mozglue/linker/CustomElf.cpp index 6ceaee485ca..76e5db97485 100644 --- a/mozglue/linker/CustomElf.cpp +++ b/mozglue/linker/CustomElf.cpp @@ -97,7 +97,7 @@ private: mappable->munmap(buf, length); } - mozilla::RefPtr mappable; + nsRefPtr mappable; }; @@ -109,7 +109,7 @@ CustomElf::Load(Mappable *mappable, const char *path, int flags) return nullptr; /* Keeping a RefPtr of the CustomElf is going to free the appropriate * resources when returning nullptr */ - RefPtr elf = new CustomElf(mappable, path); + nsRefPtr elf = new CustomElf(mappable, path); /* Map the first page of the Elf object to access Elf and program headers */ Mappable1stPagePtr ehdr_raw(mappable); if (ehdr_raw == MAP_FAILED) @@ -341,7 +341,7 @@ CustomElf::GetSymbolPtrInDeps(const char *symbol) const * directly, not in their own dependent libraries. Building libraries with * --no-allow-shlib-undefined ensures such indirect symbol dependency don't * happen. */ - for (std::vector >::const_iterator it = dependencies.begin(); + for (std::vector >::const_iterator it = dependencies.begin(); it < dependencies.end(); ++it) { /* Skip if it's the library containing this code, since we've already * looked at it above. */ @@ -626,7 +626,7 @@ CustomElf::InitDyn(const Phdr *pt_dyn) /* Load dependent libraries */ for (size_t i = 0; i < dt_needed.size(); i++) { const char *name = strtab.GetStringAt(dt_needed[i]); - RefPtr handle = + nsRefPtr handle = ElfLoader::Singleton.Load(name, RTLD_GLOBAL | RTLD_LAZY, this); if (!handle) return false; diff --git a/mozglue/linker/CustomElf.h b/mozglue/linker/CustomElf.h index 430ce766597..0a4d8272c47 100644 --- a/mozglue/linker/CustomElf.h +++ b/mozglue/linker/CustomElf.h @@ -135,7 +135,7 @@ private: } /* List of dependent libraries */ - std::vector > dependencies; + std::vector > dependencies; /* List of .rel.dyn/.rela.dyn relocations */ Array relocations; diff --git a/mozglue/linker/ElfLoader.cpp b/mozglue/linker/ElfLoader.cpp index c8f2b1a78f8..73ad716b037 100644 --- a/mozglue/linker/ElfLoader.cpp +++ b/mozglue/linker/ElfLoader.cpp @@ -52,7 +52,7 @@ using namespace mozilla; void * __wrap_dlopen(const char *path, int flags) { - RefPtr handle = ElfLoader::Singleton.Load(path, flags); + nsRefPtr handle = ElfLoader::Singleton.Load(path, flags); if (handle) handle->AddDirectRef(); return handle; @@ -94,7 +94,7 @@ __wrap_dlclose(void *handle) int __wrap_dladdr(void *addr, Dl_info *info) { - RefPtr handle = ElfLoader::Singleton.GetHandleByPtr(addr); + nsRefPtr handle = ElfLoader::Singleton.GetHandleByPtr(addr); if (!handle) { return dladdr(addr, info); } @@ -141,7 +141,7 @@ __wrap_dl_iterate_phdr(dl_phdr_cb callback, void *data) const void * __wrap___gnu_Unwind_Find_exidx(void *pc, int *pcount) { - RefPtr handle = ElfLoader::Singleton.GetHandleByPtr(pc); + nsRefPtr handle = ElfLoader::Singleton.GetHandleByPtr(pc); if (handle) return handle->FindExidx(pcount); if (__gnu_Unwind_Find_exidx) @@ -268,7 +268,7 @@ SystemElf::Load(const char *path, int flags) if (handle) { SystemElf *elf = new SystemElf(path, handle); ElfLoader::Singleton.Register(elf); - RefPtr lib(elf); + nsRefPtr lib(elf); return lib.forget(); } return nullptr; @@ -341,7 +341,7 @@ ElfLoader::Load(const char *path, int flags, LibHandle *parent) if (!self_elf) Init(); - RefPtr handle; + nsRefPtr handle; /* Handle dlopen(nullptr) directly. */ if (!path) { @@ -412,7 +412,7 @@ ElfLoader::GetHandleByPtr(void *addr) /* Scan the list of handles we already have for a match */ for (LibHandleList::iterator it = handles.begin(); it < handles.end(); ++it) { if ((*it)->Contains(addr)) { - RefPtr lib = *it; + nsRefPtr lib = *it; return lib.forget(); } } @@ -424,7 +424,7 @@ ElfLoader::GetMappableFromPath(const char *path) { const char *name = LeafName(path); Mappable *mappable = nullptr; - RefPtr zip; + nsRefPtr zip; const char *subpath; if ((subpath = strchr(path, '!'))) { char *zip_path = strndup(path, subpath - path); @@ -1209,7 +1209,7 @@ void SEGVHandler::handler(int signum, siginfo_t *info, void *context) /* Check whether we segfaulted in the address space of a CustomElf. We're * only expecting that to happen as an access error. */ if (info->si_code == SEGV_ACCERR) { - mozilla::RefPtr handle = + nsRefPtr handle = ElfLoader::Singleton.GetHandleByPtr(info->si_addr); BaseElf *elf; if (handle && (elf = handle->AsBaseElf())) { diff --git a/mozglue/linker/ElfLoader.h b/mozglue/linker/ElfLoader.h index 6b0f768ac46..09c56c96c7a 100644 --- a/mozglue/linker/ElfLoader.h +++ b/mozglue/linker/ElfLoader.h @@ -9,7 +9,7 @@ #include #include #include "mozilla/RefCounted.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "Zip.h" #include "Elfxx.h" @@ -235,7 +235,7 @@ private: char *path; /* Mappable object keeping the result of GetMappable() */ - mutable mozilla::RefPtr mappable; + mutable nsRefPtr mappable; }; /** @@ -469,14 +469,14 @@ private: /* System loader handle for the library/program containing our code. This * is used to resolve wrapped functions. */ - mozilla::RefPtr self_elf; + nsRefPtr self_elf; #if defined(ANDROID) /* System loader handle for the libc. This is used to resolve weak symbols * that some libcs contain that the Android linker won't dlsym(). Normally, * we wouldn't treat non-Android differently, but glibc uses versioned * symbols which this linker doesn't support. */ - mozilla::RefPtr libc; + nsRefPtr libc; #endif /* Bookkeeping */ diff --git a/mozglue/linker/Mappable.h b/mozglue/linker/Mappable.h index 7e3981dc9ea..5d8e00ed186 100644 --- a/mozglue/linker/Mappable.h +++ b/mozglue/linker/Mappable.h @@ -9,7 +9,7 @@ #include #include "Zip.h" #include "SeekableZStream.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "zlib.h" @@ -174,7 +174,7 @@ private: MappableDeflate(_MappableBuffer *buf, Zip *zip, Zip::Stream *stream); /* Zip reference */ - mozilla::RefPtr zip; + nsRefPtr zip; /* Decompression buffer */ mozilla::UniquePtr<_MappableBuffer> buffer; @@ -214,7 +214,7 @@ private: MappableSeekableZStream(Zip *zip); /* Zip reference */ - mozilla::RefPtr zip; + nsRefPtr zip; /* Decompression buffer */ mozilla::UniquePtr<_MappableBuffer> buffer; diff --git a/mozglue/linker/Zip.cpp b/mozglue/linker/Zip.cpp index 3344a9a349b..31239d80a9d 100644 --- a/mozglue/linker/Zip.cpp +++ b/mozglue/linker/Zip.cpp @@ -44,7 +44,7 @@ Zip::Create(const char *filename) already_AddRefed Zip::Create(const char *filename, void *mapped, size_t size) { - mozilla::RefPtr zip = new Zip(filename, mapped, size); + nsRefPtr zip = new Zip(filename, mapped, size); // If neither the first Local File entry nor central directory entries // have been found, the zip was invalid. @@ -188,7 +188,7 @@ ZipCollection::GetZip(const char *path) for (std::vector::iterator it = Singleton.zips.begin(); it < Singleton.zips.end(); ++it) { if ((*it)->GetName() && (strcmp((*it)->GetName(), path) == 0)) { - mozilla::RefPtr zip = *it; + nsRefPtr zip = *it; return zip.forget(); } } diff --git a/mozglue/linker/Zip.h b/mozglue/linker/Zip.h index 398bbc5536c..5885a672120 100644 --- a/mozglue/linker/Zip.h +++ b/mozglue/linker/Zip.h @@ -12,7 +12,7 @@ #include "Utils.h" #include "mozilla/Assertions.h" #include "mozilla/RefCounted.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" /** * Helper class wrapping z_stream to avoid malloc() calls during diff --git a/mozglue/linker/tests/TestZip.cpp b/mozglue/linker/tests/TestZip.cpp index 389c3852817..9bc47bdce50 100644 --- a/mozglue/linker/tests/TestZip.cpp +++ b/mozglue/linker/tests/TestZip.cpp @@ -5,7 +5,7 @@ #include #include #include "Zip.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" extern "C" void report_mapping() { } @@ -45,7 +45,7 @@ int main(int argc, char *argv[]) } chdir(argv[1]); Zip::Stream s; - mozilla::RefPtr z = ZipCollection::GetZip("test.zip"); + nsRefPtr z = ZipCollection::GetZip("test.zip"); for (size_t i = 0; i < sizeof(test_entries) / sizeof(*test_entries); i++) { if (!z->GetStream(test_entries[i], &s)) { fprintf(stderr, "TEST-UNEXPECTED-FAIL | TestZip | test.zip: Couldn't get entry \"%s\"\n", test_entries[i]); diff --git a/netwerk/protocol/http/PackagedAppService.cpp b/netwerk/protocol/http/PackagedAppService.cpp index df660ad472b..f02b2d6cc7b 100644 --- a/netwerk/protocol/http/PackagedAppService.cpp +++ b/netwerk/protocol/http/PackagedAppService.cpp @@ -955,7 +955,7 @@ PackagedAppService::PackagedAppDownloader::OnVerified(bool aIsManifest, return NS_OK; } - RefPtr info = + nsRefPtr info = new ResourceCacheInfo(aUri, aCacheEntry, aStatusCode, aIsLastPart); aIsManifest ? OnManifestVerified(info, aVerificationSuccess) diff --git a/netwerk/protocol/http/PackagedAppVerifier.cpp b/netwerk/protocol/http/PackagedAppVerifier.cpp index d823b29dcd2..f2220f8c9fb 100644 --- a/netwerk/protocol/http/PackagedAppVerifier.cpp +++ b/netwerk/protocol/http/PackagedAppVerifier.cpp @@ -57,7 +57,7 @@ PackagedAppVerifier::~PackagedAppVerifier() while (auto i = mPendingResourceCacheInfoList.popFirst()) { // This seems to be the only way that we can manually delete a // nsISupports instance with no warning. - RefPtr deleter(i); + nsRefPtr deleter(i); } } @@ -371,7 +371,7 @@ PackagedAppVerifier::OnManifestVerified(bool aSuccess) } } - RefPtr info(mPendingResourceCacheInfoList.popFirst()); + nsRefPtr info(mPendingResourceCacheInfoList.popFirst()); MOZ_ASSERT(info); mListener->OnVerified(true, // aIsManifest. @@ -399,7 +399,7 @@ PackagedAppVerifier::OnResourceVerified(bool aSuccess) return; } - RefPtr info(mPendingResourceCacheInfoList.popFirst()); + nsRefPtr info(mPendingResourceCacheInfoList.popFirst()); MOZ_ASSERT(info); mListener->OnVerified(false, // aIsManifest. diff --git a/security/apps/AppSignatureVerification.cpp b/security/apps/AppSignatureVerification.cpp index c7016f35941..ddd8d64d084 100644 --- a/security/apps/AppSignatureVerification.cpp +++ b/security/apps/AppSignatureVerification.cpp @@ -10,7 +10,7 @@ #include "base64.h" #include "certdb.h" #include "CryptoTask.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/UniquePtr.h" #include "nsComponentManagerUtils.h" #include "nsCOMPtr.h" @@ -999,7 +999,7 @@ nsNSSCertificateDB::OpenSignedAppFileAsync( { NS_ENSURE_ARG_POINTER(aJarFile); NS_ENSURE_ARG_POINTER(aCallback); - RefPtr task(new OpenSignedAppFileTask(aTrustedRoot, + nsRefPtr task(new OpenSignedAppFileTask(aTrustedRoot, aJarFile, aCallback)); return task->Dispatch("SignedJAR"); @@ -1014,7 +1014,7 @@ nsNSSCertificateDB::VerifySignedManifestAsync( NS_ENSURE_ARG_POINTER(aSignatureStream); NS_ENSURE_ARG_POINTER(aCallback); - RefPtr task( + nsRefPtr task( new VerifySignedmanifestTask(aTrustedRoot, aManifestStream, aSignatureStream, aCallback)); return task->Dispatch("SignedManifest"); @@ -1508,7 +1508,7 @@ nsNSSCertificateDB::VerifySignedDirectoryAsync( { NS_ENSURE_ARG_POINTER(aUnpackedJar); NS_ENSURE_ARG_POINTER(aCallback); - RefPtr task(new VerifySignedDirectoryTask(aTrustedRoot, + nsRefPtr task(new VerifySignedDirectoryTask(aTrustedRoot, aUnpackedJar, aCallback)); return task->Dispatch("UnpackedJar"); diff --git a/security/manager/ssl/SSLServerCertVerification.cpp b/security/manager/ssl/SSLServerCertVerification.cpp index 7471c44a710..e49714c9589 100644 --- a/security/manager/ssl/SSLServerCertVerification.cpp +++ b/security/manager/ssl/SSLServerCertVerification.cpp @@ -245,7 +245,7 @@ public: void Dispatch(); private: - const RefPtr mInfoObject; + const nsRefPtr mInfoObject; public: const PRErrorCode mErrorCode; const SSLErrorMessageType mErrorMessageType; @@ -276,13 +276,13 @@ class CertErrorRunnable : public SyncRunnableBase } virtual void RunOnTargetThread(); - RefPtr mResult; // out + nsRefPtr mResult; // out private: SSLServerCertVerificationResult* CheckCertOverrides(); const void* const mFdForLogging; // may become an invalid pointer; do not dereference const nsCOMPtr mCert; - const RefPtr mInfoObject; + const nsRefPtr mInfoObject; const PRErrorCode mDefaultErrorCodeToReport; const uint32_t mCollectedErrors; const PRErrorCode mErrorCodeTrust; @@ -652,7 +652,7 @@ CreateCertErrorRunnable(CertVerifier& certVerifier, return nullptr; } - RefPtr nssCert(nsNSSCertificate::Create(cert)); + nsRefPtr nssCert(nsNSSCertificate::Create(cert)); if (!nssCert) { NS_ERROR("nsNSSCertificate::Create failed"); PR_SetError(SEC_ERROR_NO_MEMORY, 0); @@ -706,14 +706,14 @@ private: } return rv; } - RefPtr mCertErrorRunnable; + nsRefPtr mCertErrorRunnable; }; class SSLServerCertVerificationJob : public nsRunnable { public: // Must be called only on the socket transport thread - static SECStatus Dispatch(const RefPtr& certVerifier, + static SECStatus Dispatch(const nsRefPtr& certVerifier, const void* fdForLogging, TransportSecurityInfo* infoObject, CERTCertificate* serverCert, @@ -726,7 +726,7 @@ private: NS_DECL_NSIRUNNABLE // Must be called only on the socket transport thread - SSLServerCertVerificationJob(const RefPtr& certVerifier, + SSLServerCertVerificationJob(const nsRefPtr& certVerifier, const void* fdForLogging, TransportSecurityInfo* infoObject, CERTCertificate* cert, @@ -735,9 +735,9 @@ private: uint32_t providerFlags, Time time, PRTime prtime); - const RefPtr mCertVerifier; + const nsRefPtr mCertVerifier; const void* const mFdForLogging; - const RefPtr mInfoObject; + const nsRefPtr mInfoObject; const ScopedCERTCertificate mCert; ScopedCERTCertList mPeerCertChain; const uint32_t mProviderFlags; @@ -748,7 +748,7 @@ private: }; SSLServerCertVerificationJob::SSLServerCertVerificationJob( - const RefPtr& certVerifier, const void* fdForLogging, + const nsRefPtr& certVerifier, const void* fdForLogging, TransportSecurityInfo* infoObject, CERTCertificate* cert, CERTCertList* peerCertChain, SECItem* stapledOCSPResponse, uint32_t providerFlags, Time time, PRTime prtime) @@ -784,7 +784,7 @@ BlockServerCertChangeForSpdy(nsNSSSocketInfo* infoObject, // no cert change to worry about. nsCOMPtr cert; - RefPtr status(infoObject->SSLStatus()); + nsRefPtr status(infoObject->SSLStatus()); if (!status) { // If we didn't have a status, then this is the // first handshake on this connection, not a @@ -1263,8 +1263,8 @@ AuthCertificate(CertVerifier& certVerifier, // complete chain at any time it might need it. // But we keep only those CA certs in the temp db, that we didn't already know. - RefPtr status(infoObject->SSLStatus()); - RefPtr nsc; + nsRefPtr status(infoObject->SSLStatus()); + nsRefPtr nsc; if (!status || !status->HasServerCert()) { if( rv == SECSuccess ){ @@ -1325,7 +1325,7 @@ AuthCertificate(CertVerifier& certVerifier, /*static*/ SECStatus SSLServerCertVerificationJob::Dispatch( - const RefPtr& certVerifier, + const nsRefPtr& certVerifier, const void* fdForLogging, TransportSecurityInfo* infoObject, CERTCertificate* serverCert, @@ -1349,7 +1349,7 @@ SSLServerCertVerificationJob::Dispatch( nsNSSShutDownPreventionLock lock; CERTCertList* peerCertChainCopy = nsNSSCertList::DupCertList(peerCertChain, lock); - RefPtr job( + nsRefPtr job( new SSLServerCertVerificationJob(certVerifier, fdForLogging, infoObject, serverCert, peerCertChainCopy, stapledOCSPResponse, providerFlags, @@ -1407,7 +1407,7 @@ SSLServerCertVerificationJob::Run() mProviderFlags, mTime); if (rv == SECSuccess) { uint32_t interval = (uint32_t) ((TimeStamp::Now() - mJobStartTime).ToMilliseconds()); - RefPtr restart( + nsRefPtr restart( new SSLServerCertVerificationResult(mInfoObject, 0, successTelemetry, interval)); restart->Dispatch(); @@ -1424,7 +1424,7 @@ SSLServerCertVerificationJob::Run() Telemetry::AccumulateTimeDelta(failureTelemetry, mJobStartTime, now); } if (error != 0) { - RefPtr runnable( + nsRefPtr runnable( CreateCertErrorRunnable(*mCertVerifier, error, mInfoObject, mCert.get(), mFdForLogging, mProviderFlags, mPRTime)); @@ -1463,7 +1463,7 @@ SSLServerCertVerificationJob::Run() error = PR_INVALID_STATE_ERROR; } - RefPtr failure( + nsRefPtr failure( new SSLServerCertVerificationResult(mInfoObject, error)); failure->Dispatch(); return NS_OK; @@ -1477,7 +1477,7 @@ SSLServerCertVerificationJob::Run() SECStatus AuthCertificateHook(void* arg, PRFileDesc* fd, PRBool checkSig, PRBool isServer) { - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); if (!certVerifier) { PR_SetError(SEC_ERROR_NOT_INITIALIZED, 0); return SECFailure; @@ -1581,7 +1581,7 @@ AuthCertificateHook(void* arg, PRFileDesc* fd, PRBool checkSig, PRBool isServer) PRErrorCode error = PR_GetError(); if (error != 0) { - RefPtr runnable( + nsRefPtr runnable( CreateCertErrorRunnable(*certVerifier, error, socketInfo, serverCert, static_cast(fd), providerFlags, prnow)); @@ -1655,7 +1655,7 @@ void EnsureServerVerificationInitialized() return; triggeredCertVerifierInit = true; - RefPtr initJob = new InitializeIdentityInfo(); + nsRefPtr initJob = new InitializeIdentityInfo(); if (gCertVerificationThreadPool) gCertVerificationThreadPool->Dispatch(initJob, NS_DISPATCH_NORMAL); #endif diff --git a/security/manager/ssl/SharedCertVerifier.h b/security/manager/ssl/SharedCertVerifier.h index 10241d991f4..37fa8197e40 100644 --- a/security/manager/ssl/SharedCertVerifier.h +++ b/security/manager/ssl/SharedCertVerifier.h @@ -7,7 +7,7 @@ #include "certt.h" #include "CertVerifier.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" namespace mozilla { namespace psm { diff --git a/security/manager/ssl/SharedSSLState.cpp b/security/manager/ssl/SharedSSLState.cpp index b783331a90a..39117a009b1 100644 --- a/security/manager/ssl/SharedSSLState.cpp +++ b/security/manager/ssl/SharedSSLState.cpp @@ -76,7 +76,7 @@ void ClearPrivateSSLState() MOZ_ASSERT(NS_SUCCEEDED(rv) && onSTSThread); #endif - RefPtr runnable = new MainThreadClearer; + nsRefPtr runnable = new MainThreadClearer; runnable->DispatchToMainThreadAndWait(); // If NSS isn't initialized, this throws an assertion. We guard it by checking if diff --git a/security/manager/ssl/SharedSSLState.h b/security/manager/ssl/SharedSSLState.h index 396f5fef698..edd747cb112 100644 --- a/security/manager/ssl/SharedSSLState.h +++ b/security/manager/ssl/SharedSSLState.h @@ -7,7 +7,7 @@ #ifndef SharedSSLState_h #define SharedSSLState_h -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsNSSIOLayer.h" class nsClientAuthRememberService; @@ -52,7 +52,7 @@ private: void Cleanup(); nsCOMPtr mObserver; - RefPtr mClientAuthRemember; + nsRefPtr mClientAuthRemember; nsSSLIOLayerHelpers mIOLayerHelpers; // True if any sockets have been created that use this shared data. diff --git a/security/manager/ssl/TransportSecurityInfo.cpp b/security/manager/ssl/TransportSecurityInfo.cpp index 91fbd827645..ba8ca654322 100644 --- a/security/manager/ssl/TransportSecurityInfo.cpp +++ b/security/manager/ssl/TransportSecurityInfo.cpp @@ -952,8 +952,8 @@ formatOverridableCertErrorMessage(nsISSLStatus & sslStatus, returnedMessage.AppendLiteral("\n\n"); - RefPtr ix509; - rv = sslStatus.GetServerCert(byRef(ix509)); + nsRefPtr ix509; + rv = sslStatus.GetServerCert(getter_AddRefs(ix509)); NS_ENSURE_SUCCESS(rv, rv); bool isUntrusted; diff --git a/security/manager/ssl/TransportSecurityInfo.h b/security/manager/ssl/TransportSecurityInfo.h index 637f4d7c86c..68d69f528a3 100644 --- a/security/manager/ssl/TransportSecurityInfo.h +++ b/security/manager/ssl/TransportSecurityInfo.h @@ -10,7 +10,7 @@ #include "ScopedNSSTypes.h" #include "certt.h" #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsDataHashtable.h" #include "nsIAssociatedContentSecurity.h" #include "nsIInterfaceRequestor.h" @@ -102,7 +102,7 @@ private: nsXPIDLCString mHostName; /* SSL Status */ - mozilla::RefPtr mSSLStatus; + nsRefPtr mSSLStatus; /* Peer cert chain for failed connections (for error reporting) */ nsCOMPtr mFailedCertChain; diff --git a/security/manager/ssl/nsCertPicker.cpp b/security/manager/ssl/nsCertPicker.cpp index f4b6913611f..a58aeb9234f 100644 --- a/security/manager/ssl/nsCertPicker.cpp +++ b/security/manager/ssl/nsCertPicker.cpp @@ -75,7 +75,7 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, while (!CERT_LIST_END(node, certList)) { /* if the cert has at least one e-mail address, check if suitable */ if (CERT_GetFirstEmailAddress(node->cert)) { - RefPtr tempCert(nsNSSCertificate::Create(node->cert)); + nsRefPtr tempCert(nsNSSCertificate::Create(node->cert)); bool match = false; rv = tempCert->ContainsEmailAddress(emailAddress, &match); if (NS_FAILED(rv)) { @@ -115,7 +115,7 @@ NS_IMETHODIMP nsCertPicker::PickByUsage(nsIInterfaceRequestor *ctx, node = CERT_LIST_NEXT(node) ) { - RefPtr tempCert(nsNSSCertificate::Create(node->cert)); + nsRefPtr tempCert(nsNSSCertificate::Create(node->cert)); if (tempCert) { diff --git a/security/manager/ssl/nsCertTree.cpp b/security/manager/ssl/nsCertTree.cpp index b565330f718..d70ee6f2847 100644 --- a/security/manager/ssl/nsCertTree.cpp +++ b/security/manager/ssl/nsCertTree.cpp @@ -256,7 +256,7 @@ nsCertTree::GetThreadDescAtIndex(int32_t index) already_AddRefed nsCertTree::GetCertAtIndex(int32_t index, int32_t *outAbsoluteCertOffset) { - RefPtr certdi( + nsRefPtr certdi( GetDispInfoAtIndex(index, outAbsoluteCertOffset)); if (!certdi) return nullptr; @@ -286,7 +286,7 @@ nsCertTree::GetDispInfoAtIndex(int32_t index, int32_t certIndex = cIndex + index - idx; if (outAbsoluteCertOffset) *outAbsoluteCertOffset = certIndex; - RefPtr certdi(mDispInfo.SafeElementAt(certIndex, + nsRefPtr certdi(mDispInfo.SafeElementAt(certIndex, nullptr)); if (certdi) { return certdi.forget(); @@ -320,8 +320,8 @@ nsCertTree::GetCompareFuncFromCertType(uint32_t aType) struct nsCertAndArrayAndPositionAndCounterAndTracker { - RefPtr certai; - nsTArray< RefPtr > *array; + nsRefPtr certai; + nsTArray< nsRefPtr > *array; int position; int counter; nsTHashtable *tracker; @@ -384,7 +384,7 @@ CollectAllHostPortOverridesCallback(const nsCertOverride &aSettings, struct nsArrayAndPositionAndCounterAndTracker { - nsTArray< RefPtr > *array; + nsTArray< nsRefPtr > *array; int position; int counter; nsTHashtable *tracker; @@ -549,7 +549,7 @@ nsCertTree::GetCertsByTypeFromCertList(CERTCertList *aCertList, } } - RefPtr certai(new nsCertAddonInfo); + nsRefPtr certai(new nsCertAddonInfo); certai->mCert = pipCert; certai->mUsageCount = 0; @@ -557,7 +557,7 @@ nsCertTree::GetCertsByTypeFromCertList(CERTCertList *aCertList, int InsertPosition = 0; for (; InsertPosition < count; ++InsertPosition) { nsCOMPtr cert = nullptr; - RefPtr elem( + nsRefPtr elem( mDispInfo.SafeElementAt(InsertPosition, nullptr)); if (elem && elem->mAddonInfo) { cert = elem->mAddonInfo->mCert; @@ -761,7 +761,7 @@ nsCertTree::DeleteEntryObject(uint32_t index) int32_t certIndex = cIndex + index - idx; bool canRemoveEntry = false; - RefPtr certdi(mDispInfo.SafeElementAt(certIndex, + nsRefPtr certdi(mDispInfo.SafeElementAt(certIndex, nullptr)); // We will remove the element from the visual tree. @@ -850,7 +850,7 @@ nsCertTree::GetTreeItem(uint32_t aIndex, nsICertTreeItem **_treeitem) { NS_ENSURE_ARG(_treeitem); - RefPtr certdi(GetDispInfoAtIndex(aIndex)); + nsRefPtr certdi(GetDispInfoAtIndex(aIndex)); if (!certdi) return NS_ERROR_FAILURE; @@ -864,7 +864,7 @@ nsCertTree::IsHostPortOverride(uint32_t aIndex, bool *_retval) { NS_ENSURE_ARG(_retval); - RefPtr certdi(GetDispInfoAtIndex(aIndex)); + nsRefPtr certdi(GetDispInfoAtIndex(aIndex)); if (!certdi) return NS_ERROR_FAILURE; @@ -1062,7 +1062,7 @@ nsCertTree::GetCellText(int32_t row, nsITreeColumn* col, } int32_t absoluteCertOffset; - RefPtr certdi(GetDispInfoAtIndex(row, &absoluteCertOffset)); + nsRefPtr certdi(GetDispInfoAtIndex(row, &absoluteCertOffset)); if (!certdi) return NS_ERROR_FAILURE; diff --git a/security/manager/ssl/nsCertTree.h b/security/manager/ssl/nsCertTree.h index b869987545a..0b75773f9f8 100644 --- a/security/manager/ssl/nsCertTree.h +++ b/security/manager/ssl/nsCertTree.h @@ -46,7 +46,7 @@ public: nsCertAddonInfo() : mUsageCount(0) {} - mozilla::RefPtr mCert; + nsRefPtr mCert; // how many display entries reference this? // (and therefore depend on the underlying cert) int32_t mUsageCount; @@ -64,7 +64,7 @@ public: nsCertTreeDispInfo(); nsCertTreeDispInfo(nsCertTreeDispInfo &other); - mozilla::RefPtr mAddonInfo; + nsRefPtr mAddonInfo; enum { direct_db, host_port_override } mTypeOfEntry; @@ -118,7 +118,7 @@ protected: private: static const uint32_t kInitialCacheLength = 64; - nsTArray< mozilla::RefPtr > mDispInfo; + nsTArray< nsRefPtr > mDispInfo; nsCOMPtr mTree; nsCOMPtr mSelection; treeArrayEl *mTreeArray; @@ -127,7 +127,7 @@ private: PLDHashTable mCompareCache; nsCOMPtr mNSSComponent; nsCOMPtr mOverrideService; - mozilla::RefPtr mOriginalOverrideService; + nsRefPtr mOriginalOverrideService; treeArrayEl *GetThreadDescAtIndex(int32_t _index); already_AddRefed diff --git a/security/manager/ssl/nsCertVerificationThread.cpp b/security/manager/ssl/nsCertVerificationThread.cpp index 6f26d6b0b8b..1714b481898 100644 --- a/security/manager/ssl/nsCertVerificationThread.cpp +++ b/security/manager/ssl/nsCertVerificationThread.cpp @@ -46,7 +46,7 @@ void nsCertVerificationJob::Run() char16_t **usages; nsCOMPtr ires; - RefPtr vres(new nsCertVerificationResult); + nsRefPtr vres(new nsCertVerificationResult); if (vres) { nsresult rv = mCert->GetUsagesArray(false, // do not ignore OCSP diff --git a/security/manager/ssl/nsClientAuthRemember.cpp b/security/manager/ssl/nsClientAuthRemember.cpp index e955ae291e9..95c66258af3 100644 --- a/security/manager/ssl/nsClientAuthRemember.cpp +++ b/security/manager/ssl/nsClientAuthRemember.cpp @@ -7,7 +7,7 @@ #include "nsClientAuthRemember.h" #include "nsIX509Cert.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCRT.h" #include "nsNSSCertHelper.h" #include "nsIObserverService.h" @@ -82,7 +82,7 @@ void nsClientAuthRememberService::ClearRememberedDecisions() void nsClientAuthRememberService::ClearAllRememberedDecisions() { - RefPtr svc = + nsRefPtr svc = PublicSSLState()->GetClientAuthRememberService(); svc->ClearRememberedDecisions(); @@ -113,7 +113,7 @@ nsClientAuthRememberService::RememberDecision(const nsACString & aHostName, { ReentrantMonitorAutoEnter lock(monitor); if (aClientCert) { - RefPtr pipCert(new nsNSSCertificate(aClientCert)); + nsRefPtr pipCert(new nsNSSCertificate(aClientCert)); char *dbkey = nullptr; rv = pipCert->GetDbKey(&dbkey); if (NS_SUCCEEDED(rv) && dbkey) { diff --git a/security/manager/ssl/nsDataSignatureVerifier.cpp b/security/manager/ssl/nsDataSignatureVerifier.cpp index 04692c7389e..1b50a7bd72e 100644 --- a/security/manager/ssl/nsDataSignatureVerifier.cpp +++ b/security/manager/ssl/nsDataSignatureVerifier.cpp @@ -243,7 +243,7 @@ VerifyCertificate(CERTCertificate* cert, void* voidContext, void* pinArg) context->signingCert = xpcomCert; - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); return MapSECStatus(certVerifier->VerifyCert(cert, diff --git a/security/manager/ssl/nsNSSCallbacks.cpp b/security/manager/ssl/nsNSSCallbacks.cpp index a553c61a341..d7cc7f76ab0 100644 --- a/security/manager/ssl/nsNSSCallbacks.cpp +++ b/security/manager/ssl/nsNSSCallbacks.cpp @@ -393,7 +393,7 @@ nsNSSHttpRequestSession::internal_send_receive_attempt(bool &retryable_error, volatile bool &waitFlag = mListener->mWaitFlag; waitFlag = true; - RefPtr event(new nsHTTPDownloadEvent); + nsRefPtr event(new nsHTTPDownloadEvent); if (!event) return SECFailure; @@ -464,7 +464,7 @@ nsNSSHttpRequestSession::internal_send_receive_attempt(bool &retryable_error, { request_canceled = true; - RefPtr cancelevent( + nsRefPtr cancelevent( new nsCancelHTTPDownloadEvent); cancelevent->mListener = mListener; rv = NS_DispatchToMainThread(cancelevent); @@ -858,7 +858,7 @@ void PK11PasswordPromptRunnable::RunOnTargetThread() char* PK11PasswordPrompt(PK11SlotInfo* slot, PRBool retry, void* arg) { - RefPtr runnable( + nsRefPtr runnable( new PK11PasswordPromptRunnable(slot, static_cast(arg))); runnable->DispatchToMainThreadAndWait(); @@ -886,7 +886,7 @@ PreliminaryHandshakeDone(PRFileDesc* fd) if (SSL_GetCipherSuiteInfo(channelInfo.cipherSuite, &cipherInfo, sizeof cipherInfo) == SECSuccess) { /* Set the SSL Status information */ - RefPtr status(infoObject->SSLStatus()); + nsRefPtr status(infoObject->SSLStatus()); if (!status) { status = new nsSSLStatus(); infoObject->SetSSLStatus(status); @@ -1262,7 +1262,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { } /* Set the SSL Status information */ - RefPtr status(infoObject->SSLStatus()); + nsRefPtr status(infoObject->SSLStatus()); if (!status) { status = new nsSSLStatus(); infoObject->SetSSLStatus(status); @@ -1276,7 +1276,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { ("HandshakeCallback KEEPING existing cert\n")); } else { ScopedCERTCertificate serverCert(SSL_PeerCertificate(fd)); - RefPtr nssc(nsNSSCertificate::Create(serverCert.get())); + nsRefPtr nssc(nsNSSCertificate::Create(serverCert.get())); MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("HandshakeCallback using NEW cert %p\n", nssc.get())); status->SetServerCert(nssc, nsNSSCertificate::ev_status_unknown); diff --git a/security/manager/ssl/nsNSSCertificate.cpp b/security/manager/ssl/nsNSSCertificate.cpp index 075022926e1..14510259182 100644 --- a/security/manager/ssl/nsNSSCertificate.cpp +++ b/security/manager/ssl/nsNSSCertificate.cpp @@ -823,7 +823,7 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain) mozilla::pkix::Time now(mozilla::pkix::Now()); ScopedCERTCertList nssChain; - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); // We want to test all usages, but we start with server because most of the @@ -1384,7 +1384,7 @@ nsNSSCertificate::hasValidEVOidTag(SECOidTag& resultOidTag, bool& validEV) EnsureIdentityInfoLoaded(); - RefPtr + nsRefPtr certVerifier(mozilla::psm::GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); diff --git a/security/manager/ssl/nsNSSCertificateDB.cpp b/security/manager/ssl/nsNSSCertificateDB.cpp index 855b3a2d6a4..647674090c1 100644 --- a/security/manager/ssl/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/nsNSSCertificateDB.cpp @@ -565,7 +565,7 @@ nsNSSCertificateDB::ImportEmailCertificate(uint8_t * data, uint32_t length, return NS_ERROR_FAILURE; } - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); certdb = CERT_GetDefaultCertDB(); @@ -770,7 +770,7 @@ nsresult nsNSSCertificateDB::ImportValidCACertsInList(CERTCertList *certList, nsIInterfaceRequestor *ctx, const nsNSSShutDownPreventionLock &proofOfLock) { - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); if (!certVerifier) return NS_ERROR_UNEXPECTED; @@ -1239,7 +1239,7 @@ nsNSSCertificateDB::getCertNames(CERTCertList *certList, !CERT_LIST_END(node, certList); node = CERT_LIST_NEXT(node)) { if (getCertType(node->cert) == type) { - RefPtr pipCert(new nsNSSCertificate(node->cert)); + nsRefPtr pipCert(new nsNSSCertificate(node->cert)); char *dbkey = nullptr; char *namestr = nullptr; nsAutoString certstr; @@ -1350,7 +1350,7 @@ nsNSSCertificateDB::FindCertByEmailAddress(nsISupports *aToken, const char *aEma return NS_ERROR_NOT_AVAILABLE; } - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); ScopedCERTCertList certlist( @@ -1728,7 +1728,7 @@ VerifyCertAtTime(nsIX509Cert* aCert, return NS_ERROR_INVALID_ARG; } - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_FAILURE); ScopedCERTCertList resultChain; @@ -1824,7 +1824,7 @@ nsNSSCertificateDB::ClearOCSPCache() return NS_ERROR_NOT_AVAILABLE; } - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_FAILURE); certVerifier->ClearOCSPCache(); return NS_OK; diff --git a/security/manager/ssl/nsNSSCertificateDB.h b/security/manager/ssl/nsNSSCertificateDB.h index 3f272a9a217..3f955eb2ca6 100644 --- a/security/manager/ssl/nsNSSCertificateDB.h +++ b/security/manager/ssl/nsNSSCertificateDB.h @@ -7,7 +7,7 @@ #include "nsIX509CertDB.h" #include "nsNSSShutDown.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/Mutex.h" #include "certt.h" diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index 49dbe0336be..4b4fc474f6a 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -1581,7 +1581,7 @@ nsNSSComponent::GetDefaultCertVerifier() { MutexAutoLock lock(mutex); MOZ_ASSERT(mNSSInitialized); - RefPtr certVerifier(mDefaultCertVerifier); + nsRefPtr certVerifier(mDefaultCertVerifier); return certVerifier.forget(); } @@ -1593,7 +1593,7 @@ GetDefaultCertVerifier() static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID); nsCOMPtr nssComponent(do_GetService(kNSSComponentCID)); - RefPtr certVerifier; + nsRefPtr certVerifier; if (nssComponent) { return nssComponent->GetDefaultCertVerifier(); } diff --git a/security/manager/ssl/nsNSSComponent.h b/security/manager/ssl/nsNSSComponent.h index 24e4b82df9a..06810c0438b 100644 --- a/security/manager/ssl/nsNSSComponent.h +++ b/security/manager/ssl/nsNSSComponent.h @@ -8,7 +8,7 @@ #define _nsNSSComponent_h_ #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsCOMPtr.h" #include "nsIEntropyCollector.h" #include "nsIStringBundle.h" @@ -206,7 +206,7 @@ private: nsCertVerificationThread* mCertVerificationThread; nsNSSHttpInterface mHttpForNSS; - mozilla::RefPtr mDefaultCertVerifier; + nsRefPtr mDefaultCertVerifier; static PRStatus IdentityInfoInit(void); }; diff --git a/security/manager/ssl/nsNSSIOLayer.cpp b/security/manager/ssl/nsNSSIOLayer.cpp index 9a01a20dad0..29d95f2b973 100644 --- a/security/manager/ssl/nsNSSIOLayer.cpp +++ b/security/manager/ssl/nsNSSIOLayer.cpp @@ -377,7 +377,7 @@ nsNSSSocketInfo::IsAcceptableForHost(const nsACString& hostname, bool* _retval) // return the certificate chain built here, so that the calling Necko code // can associate the correct certificate chain with the HTTP transactions it // is trying to join onto this connection. - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); if (!certVerifier) { return NS_OK; } @@ -1035,7 +1035,7 @@ class SSLErrorRunnable : public SyncRunnableBase nsHandleSSLError(mInfoObject, mErrType, mErrorCode); } - RefPtr mInfoObject; + nsRefPtr mInfoObject; ::mozilla::psm::SSLErrorMessageType mErrType; const PRErrorCode mErrorCode; }; @@ -1227,7 +1227,7 @@ checkHandshake(int32_t bytesTransfered, bool wasReading, // expensive no-op.) if (!wantRetry && mozilla::psm::IsNSSErrorCode(err) && !socketInfo->GetErrorCode()) { - RefPtr runnable(new SSLErrorRunnable(socketInfo, + nsRefPtr runnable(new SSLErrorRunnable(socketInfo, PlainErrorMessage, err)); (void) runnable->DispatchToMainThreadAndWait(); @@ -1799,7 +1799,7 @@ nsSSLIOLayerHelpers::removeInsecureFallbackSite(const nsACString& hostname, if (!isPublic()) { return; } - RefPtr runnable = new FallbackPrefRemover(hostname); + nsRefPtr runnable = new FallbackPrefRemover(hostname); if (NS_IsMainThread()) { runnable->Run(); } else { @@ -2096,7 +2096,7 @@ nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket, return SECFailure; } - RefPtr info( + nsRefPtr info( reinterpret_cast(socket->higher->secret)); CERTCertificate* serverCert = SSL_PeerCertificate(socket); @@ -2120,7 +2120,7 @@ nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket, } // XXX: This should be done asynchronously; see bug 696976 - RefPtr runnable( + nsRefPtr runnable( new ClientAuthDataRunnable(caNames, pRetCert, pRetKey, info, serverCert)); nsresult rv = runnable->DispatchToMainThreadAndWait(); if (NS_FAILED(rv)) { @@ -2267,7 +2267,7 @@ ClientAuthDataRunnable::RunOnTargetThread() nsXPIDLCString hostname; mSocketInfo->GetHostName(getter_Copies(hostname)); - RefPtr cars = + nsRefPtr cars = mSocketInfo->SharedState().GetClientAuthRememberService(); bool hasRemembered = false; @@ -2404,7 +2404,7 @@ ClientAuthDataRunnable::RunOnTargetThread() !CERT_LIST_END(node, certList) && CertsToUse < nicknames->numnicknames; node = CERT_LIST_NEXT(node) ) { - RefPtr tempCert(nsNSSCertificate::Create(node->cert)); + nsRefPtr tempCert(nsNSSCertificate::Create(node->cert)); if (!tempCert) continue; diff --git a/security/manager/ssl/nsSiteSecurityService.cpp b/security/manager/ssl/nsSiteSecurityService.cpp index 407cb267790..76bcd92fb97 100644 --- a/security/manager/ssl/nsSiteSecurityService.cpp +++ b/security/manager/ssl/nsSiteSecurityService.cpp @@ -696,7 +696,7 @@ nsSiteSecurityService::ProcessPKPHeader(nsIURI* aSourceURI, mozilla::pkix::Time now(mozilla::pkix::Now()); ScopedCERTCertList certList; - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); if (certVerifier->VerifySSLServerCert(nssCert, nullptr, // stapled ocsp now, nullptr, // pinarg @@ -931,7 +931,7 @@ nsSiteSecurityService::IsSecureHost(uint32_t aType, const char* aHost, } if (aType == nsISiteSecurityService::HEADER_HPKP) { - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); if (!certVerifier) { return NS_ERROR_FAILURE; } diff --git a/security/manager/ssl/nsUsageArrayHelper.cpp b/security/manager/ssl/nsUsageArrayHelper.cpp index dc598431b94..90caba5db47 100644 --- a/security/manager/ssl/nsUsageArrayHelper.cpp +++ b/security/manager/ssl/nsUsageArrayHelper.cpp @@ -189,7 +189,7 @@ nsUsageArrayHelper::GetUsagesArray(const char *suffix, if (outArraySize < max_returned_out_array_size) return NS_ERROR_FAILURE; - RefPtr certVerifier(GetDefaultCertVerifier()); + nsRefPtr certVerifier(GetDefaultCertVerifier()); NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED); uint32_t &count = *_count; diff --git a/tools/profiler/core/GeckoSampler.h b/tools/profiler/core/GeckoSampler.h index a99f5bbc5fb..ce98add0315 100644 --- a/tools/profiler/core/GeckoSampler.h +++ b/tools/profiler/core/GeckoSampler.h @@ -137,7 +137,7 @@ protected: // This represent the application's main thread (SAMPLER_INIT) ThreadProfile* mPrimaryThreadProfile; - mozilla::RefPtr mBuffer; + nsRefPtr mBuffer; bool mSaveRequested; bool mAddLeafAddresses; bool mUseStackWalk; diff --git a/tools/profiler/core/ProfileBuffer.h b/tools/profiler/core/ProfileBuffer.h index 1426908f209..841e9921710 100644 --- a/tools/profiler/core/ProfileBuffer.h +++ b/tools/profiler/core/ProfileBuffer.h @@ -9,7 +9,7 @@ #include "ProfileEntry.h" #include "platform.h" #include "ProfileJSONWriter.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/RefCounted.h" class ProfileBuffer : public mozilla::RefCounted { diff --git a/tools/profiler/core/ProfileEntry.h b/tools/profiler/core/ProfileEntry.h index 8b3214a39b8..1e95dfe1443 100644 --- a/tools/profiler/core/ProfileEntry.h +++ b/tools/profiler/core/ProfileEntry.h @@ -12,7 +12,7 @@ #include "platform.h" #include "ProfileJSONWriter.h" #include "ProfilerBacktrace.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include #include #ifndef SPS_STANDALONE diff --git a/tools/profiler/core/ThreadProfile.h b/tools/profiler/core/ThreadProfile.h index 08559c30301..104ae2de892 100644 --- a/tools/profiler/core/ThreadProfile.h +++ b/tools/profiler/core/ThreadProfile.h @@ -71,7 +71,7 @@ private: FRIEND_TEST(ThreadProfile, MemoryMeasure); ThreadInfo* mThreadInfo; - const mozilla::RefPtr mBuffer; + const nsRefPtr mBuffer; // JS frames in the buffer may require a live JSRuntime to stream (e.g., // stringifying JIT frames). In the case of JSRuntime destruction, diff --git a/tools/profiler/tests/gtest/ThreadProfileTest.cpp b/tools/profiler/tests/gtest/ThreadProfileTest.cpp index 77a859516e1..ce3317fc8c4 100644 --- a/tools/profiler/tests/gtest/ThreadProfileTest.cpp +++ b/tools/profiler/tests/gtest/ThreadProfileTest.cpp @@ -13,7 +13,7 @@ TEST(ThreadProfile, Initialization) { PseudoStack* stack = PseudoStack::create(); Thread::tid_t tid = 1000; ThreadInfo info("testThread", tid, true, stack, nullptr); - mozilla::RefPtr pb = new ProfileBuffer(10); + nsRefPtr pb = new ProfileBuffer(10); ThreadProfile tp(&info, pb); } @@ -22,7 +22,7 @@ TEST(ThreadProfile, InsertOneTag) { PseudoStack* stack = PseudoStack::create(); Thread::tid_t tid = 1000; ThreadInfo info("testThread", tid, true, stack, nullptr); - mozilla::RefPtr pb = new ProfileBuffer(10); + nsRefPtr pb = new ProfileBuffer(10); pb->addTag(ProfileEntry('t', 123.1)); ASSERT_TRUE(pb->mEntries != nullptr); ASSERT_TRUE(pb->mEntries[pb->mReadPos].mTagName == 't'); @@ -34,7 +34,7 @@ TEST(ThreadProfile, InsertTagsNoWrap) { PseudoStack* stack = PseudoStack::create(); Thread::tid_t tid = 1000; ThreadInfo info("testThread", tid, true, stack, nullptr); - mozilla::RefPtr pb = new ProfileBuffer(100); + nsRefPtr pb = new ProfileBuffer(100); int test_size = 50; for (int i = 0; i < test_size; i++) { pb->addTag(ProfileEntry('t', i)); @@ -56,7 +56,7 @@ TEST(ThreadProfile, InsertTagsWrap) { int tags = 24; int buffer_size = tags + 1; ThreadInfo info("testThread", tid, true, stack, nullptr); - mozilla::RefPtr pb = new ProfileBuffer(buffer_size); + nsRefPtr pb = new ProfileBuffer(buffer_size); int test_size = 43; for (int i = 0; i < test_size; i++) { pb->addTag(ProfileEntry('t', i)); diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 7c0c9dbb7c2..509beb95a5d 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -929,14 +929,14 @@ PuppetWidget::SetCursor(imgIContainer* aCursor, return NS_OK; } - RefPtr surface = + nsRefPtr surface = aCursor->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (!surface) { return NS_ERROR_FAILURE; } - mozilla::RefPtr dataSurface = + nsRefPtr dataSurface = surface->GetDataSurface(); size_t length; int32_t stride; diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index 0206ad3778e..2fceb282bc8 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -16,7 +16,7 @@ #define mozilla_widget_PuppetWidget_h__ #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsBaseScreen.h" #include "nsBaseWidget.h" #include "nsIScreenManager.h" @@ -317,7 +317,7 @@ private: nsRefPtr mMemoryPressureObserver; // XXX/cjones: keeping this around until we teach LayerManager to do // retained-content-only transactions - mozilla::RefPtr mDrawTarget; + nsRefPtr mDrawTarget; // IME nsIMEUpdatePreference mIMEPreferenceOfParent; InputContext mInputContext; diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index a1e297282a8..52991f1ddba 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -1974,7 +1974,7 @@ nsresult AndroidBridge::CaptureThumbnail(nsIDOMWindow *window, int32_t bufW, int MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContentForType(BackendType::CAIRO), "Need BackendType::CAIRO support"); - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, data, IntSize(bufW, bufH), diff --git a/widget/cocoa/OSXNotificationCenter.h b/widget/cocoa/OSXNotificationCenter.h index 48a5bf39700..74e58fa2aff 100644 --- a/widget/cocoa/OSXNotificationCenter.h +++ b/widget/cocoa/OSXNotificationCenter.h @@ -11,7 +11,7 @@ #include "imgINotificationObserver.h" #include "nsITimer.h" #include "nsTArray.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" @class mozNotificationCenterDelegate; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index ec184f66c37..409d4ab2340 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -287,7 +287,7 @@ public: const nsIntRegion& aDirtyRegion, void (^aCallback)(gfx::DrawTarget*, const nsIntRegion&)) { - RefPtr drawTarget = BeginUpdate(aNewSize, aDirtyRegion); + nsRefPtr drawTarget = BeginUpdate(aNewSize, aDirtyRegion); if (drawTarget) { aCallback(drawTarget, GetUpdateRegion()); EndUpdate(); @@ -311,7 +311,7 @@ public: protected: - RefPtr mUpdateDrawTarget; + nsRefPtr mUpdateDrawTarget; GLContext* mGLContext; nsIntRegion mUpdateRegion; nsIntSize mUsedSize; @@ -2347,9 +2347,9 @@ nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const nsIntRect& aRect nsIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius); mCornerMaskImage->UpdateIfNeeded(size, nsIntRegion(), ^(gfx::DrawTarget* drawTarget, const nsIntRegion& updateRegion) { ClearRegion(drawTarget, updateRegion); - RefPtr builder = drawTarget->CreatePathBuilder(); + nsRefPtr builder = drawTarget->CreatePathBuilder(); builder->Arc(gfx::Point(mDevPixelCornerRadius, mDevPixelCornerRadius), mDevPixelCornerRadius, 0, 2.0f * M_PI); - RefPtr path = builder->Finish(); + nsRefPtr path = builder->Finish(); drawTarget->Fill(path, gfx::ColorPattern(gfx::Color(1.0, 1.0, 1.0, 1.0)), gfx::DrawOptions(1.0f, gfx::CompositionOp::OP_SOURCE)); @@ -2660,7 +2660,7 @@ nsChildView::StartRemoteDrawing() mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl()); } - RefPtr drawTarget = + nsRefPtr drawTarget = mBasicCompositorImage->BeginUpdate(renderSize, dirtyRegion); if (!drawTarget) { @@ -2929,7 +2929,7 @@ RectTextureImage::BeginUpdate(const nsIntSize& aNewSize, mInUpdate = true; - RefPtr drawTarget = mUpdateDrawTarget; + nsRefPtr drawTarget = mUpdateDrawTarget; return drawTarget.forget(); } @@ -2957,8 +2957,8 @@ RectTextureImage::EndUpdate(bool aKeepSurface) updateRegion = gfx::IntRect(gfx::IntPoint(0, 0), mTextureSize); } - RefPtr snapshot = mUpdateDrawTarget->Snapshot(); - RefPtr dataSnapshot = snapshot->GetDataSurface(); + nsRefPtr snapshot = mUpdateDrawTarget->Snapshot(); + nsRefPtr dataSnapshot = snapshot->GetDataSurface(); UploadSurfaceToTexture(mGLContext, dataSnapshot, @@ -2985,11 +2985,11 @@ RectTextureImage::UpdateFromCGContext(const nsIntSize& aNewSize, gfx::IntSize size = gfx::IntSize(CGBitmapContextGetWidth(aCGContext), CGBitmapContextGetHeight(aCGContext)); mBufferSize.SizeTo(size.width, size.height); - RefPtr dt = BeginUpdate(aNewSize, aDirtyRegion); + nsRefPtr dt = BeginUpdate(aNewSize, aDirtyRegion); if (dt) { gfx::Rect rect(0, 0, size.width, size.height); gfxUtils::ClipToRegion(dt, GetUpdateRegion()); - RefPtr sourceSurface = + nsRefPtr sourceSurface = dt->CreateSourceSurfaceFromData(static_cast(CGBitmapContextGetData(aCGContext)), size, CGBitmapContextGetBytesPerRow(aCGContext), @@ -3724,7 +3724,7 @@ NSEvent* gLastDragMouseDownEvent = nil; // Create Cairo objects. nsRefPtr targetSurface; - RefPtr dt = + nsRefPtr dt = gfx::Factory::CreateDrawTargetForCairoCGContext(aContext, gfx::IntSize(backingSize.width, backingSize.height)); diff --git a/widget/cocoa/nsClipboard.mm b/widget/cocoa/nsClipboard.mm index 7b1c703e141..bd1f7eba92d 100644 --- a/widget/cocoa/nsClipboard.mm +++ b/widget/cocoa/nsClipboard.mm @@ -27,7 +27,6 @@ using mozilla::gfx::DataSourceSurface; using mozilla::gfx::SourceSurface; using mozilla::LogLevel; -using mozilla::RefPtr; // Screenshots use the (undocumented) png pasteboard type. #define IMAGE_PASTEBOARD_TYPES NSTIFFPboardType, @"Apple PNG pasteboard type", nil @@ -462,7 +461,7 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable) continue; } - RefPtr surface = + nsRefPtr surface = image->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (!surface) { diff --git a/widget/cocoa/nsCocoaUtils.mm b/widget/cocoa/nsCocoaUtils.mm index dab2ffdcb2b..729230ecfaa 100644 --- a/widget/cocoa/nsCocoaUtils.mm +++ b/widget/cocoa/nsCocoaUtils.mm @@ -363,7 +363,7 @@ void data_ss_release_callback(void *aDataSourceSurface, nsresult nsCocoaUtils::CreateCGImageFromSurface(SourceSurface* aSurface, CGImageRef* aResult) { - RefPtr dataSurface; + nsRefPtr dataSurface; if (aSurface->GetFormat() == SurfaceFormat::B8G8R8A8) { dataSurface = aSurface->GetDataSurface(); @@ -469,7 +469,7 @@ nsresult nsCocoaUtils::CreateNSImageFromCGImage(CGImageRef aInputImage, NSImage nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, uint32_t aWhichFrame, NSImage **aResult, CGFloat scaleFactor) { - RefPtr surface; + nsRefPtr surface; int32_t width = 0, height = 0; aImage->GetWidth(&width); aImage->GetHeight(&height); @@ -478,7 +478,7 @@ nsresult nsCocoaUtils::CreateNSImageFromImageContainer(imgIContainer *aImage, ui if (aImage->GetType() == imgIContainer::TYPE_VECTOR && scaleFactor != 1.0f) { IntSize scaledSize(ceil(width * scaleFactor), ceil(height * scaleFactor)); - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(scaledSize, SurfaceFormat::B8G8R8A8); if (!drawTarget) { NS_ERROR("Failed to create DrawTarget"); diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm index 6b42f34ed7f..b2cd63bcd0a 100644 --- a/widget/cocoa/nsDragService.mm +++ b/widget/cocoa/nsDragService.mm @@ -179,7 +179,7 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode, CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(gLastDragView); - RefPtr surface; + nsRefPtr surface; nsPresContext* pc; nsresult rv = DrawDrag(aDOMNode, aRegion, NSToIntRound(screenPoint.x), @@ -201,7 +201,7 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode, - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(IntSize(width, height), SurfaceFormat::B8G8R8A8); DataSourceSurface::MappedSurface map; @@ -209,7 +209,7 @@ nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode, return nil; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), diff --git a/widget/cocoa/nsMenuItemIconX.mm b/widget/cocoa/nsMenuItemIconX.mm index 26c73101cbc..f2a0bafa748 100644 --- a/widget/cocoa/nsMenuItemIconX.mm +++ b/widget/cocoa/nsMenuItemIconX.mm @@ -43,7 +43,6 @@ #include "nsIContentPolicy.h" using mozilla::gfx::SourceSurface; -using mozilla::RefPtr; static const uint32_t kIconWidth = 16; static const uint32_t kIconHeight = 16; @@ -402,7 +401,7 @@ nsMenuItemIconX::OnFrameComplete(imgIRequest* aRequest) mImageRegionRect.SetRect(0, 0, origWidth, origHeight); } - RefPtr surface = + nsRefPtr surface = imageContainer->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (!surface) { diff --git a/widget/gonk/GonkClipboardData.cpp b/widget/gonk/GonkClipboardData.cpp index ced6422a59d..490512acc39 100644 --- a/widget/gonk/GonkClipboardData.cpp +++ b/widget/gonk/GonkClipboardData.cpp @@ -60,7 +60,7 @@ already_AddRefed GonkClipboardData::GetImage() const { // Return cloned DataSourceSurface. - RefPtr cloned = gfx::CreateDataSourceSurfaceByCloning(mImage); + nsRefPtr cloned = gfx::CreateDataSourceSurfaceByCloning(mImage); return cloned.forget(); } diff --git a/widget/gonk/GonkClipboardData.h b/widget/gonk/GonkClipboardData.h index 8bc1f1c9c4f..d1394571b18 100644 --- a/widget/gonk/GonkClipboardData.h +++ b/widget/gonk/GonkClipboardData.h @@ -5,7 +5,7 @@ #ifndef mozilla_GonkClipboardData #define mozilla_GonkClipboardData -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsString.h" namespace mozilla { @@ -41,7 +41,7 @@ public: private: nsAutoString mPlain; nsAutoString mHTML; - RefPtr mImage; + nsRefPtr mImage; }; } // namespace mozilla diff --git a/widget/gonk/nativewindow/GonkBufferQueueJB.cpp b/widget/gonk/nativewindow/GonkBufferQueueJB.cpp index 4fd47280273..08c9df8a752 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueJB.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueueJB.cpp @@ -137,7 +137,7 @@ GonkBufferQueue::getTextureClientFromBuffer(ANativeWindowBuffer* buffer) for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { if (mSlots[i].mGraphicBuffer != NULL && mSlots[i].mGraphicBuffer->handle == buffer->handle) { - RefPtr client(mSlots[i].mTextureClient); + nsRefPtr client(mSlots[i].mTextureClient); return client.forget(); } } @@ -421,7 +421,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp* outFence, sp graphicBuffer; if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) { - RefPtr textureClient = + nsRefPtr textureClient = new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(), gfx::SurfaceFormat::UNKNOWN, gfx::BackendType::NONE, diff --git a/widget/gonk/nativewindow/GonkBufferQueueJB.h b/widget/gonk/nativewindow/GonkBufferQueueJB.h index e3fa3d494be..1190dc6c7c7 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueJB.h +++ b/widget/gonk/nativewindow/GonkBufferQueueJB.h @@ -445,7 +445,7 @@ private: sp mGraphicBuffer; // mTextureClient is a thin abstraction over remotely allocated GraphicBuffer. - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; // BufferState represents the different states in which a buffer slot // can be. All slots are initially FREE. diff --git a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp index 3bacbb76f91..05e2f535a5a 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp @@ -129,7 +129,7 @@ GonkBufferQueue::getTextureClientFromBuffer(ANativeWindowBuffer* buffer) for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { if (mSlots[i].mGraphicBuffer != NULL && mSlots[i].mGraphicBuffer->handle == buffer->handle) { - RefPtr client(mSlots[i].mTextureClient); + nsRefPtr client(mSlots[i].mTextureClient); return client.forget(); } } @@ -442,7 +442,7 @@ status_t GonkBufferQueue::dequeueBuffer(int *outBuf, sp* outFence, bool a sp graphicBuffer; if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) { - RefPtr textureClient = + nsRefPtr textureClient = new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(), gfx::SurfaceFormat::UNKNOWN, gfx::BackendType::NONE, diff --git a/widget/gonk/nativewindow/GonkBufferQueueKK.h b/widget/gonk/nativewindow/GonkBufferQueueKK.h index cca3cb63dba..2536973d518 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueKK.h +++ b/widget/gonk/nativewindow/GonkBufferQueueKK.h @@ -386,7 +386,7 @@ private: sp mGraphicBuffer; // mTextureClient is a thin abstraction over remotely allocated GraphicBuffer. - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; // BufferState represents the different states in which a buffer slot // can be. All slots are initially FREE. diff --git a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueConsumer.cpp b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueConsumer.cpp index 1d7eb27021d..8c2391c9942 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueConsumer.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueConsumer.cpp @@ -531,7 +531,7 @@ GonkBufferQueueConsumer::getTextureClientFromBuffer(ANativeWindowBuffer* buffer) for (int i = 0; i < GonkBufferQueueDefs::NUM_BUFFER_SLOTS; i++) { if (mSlots[i].mGraphicBuffer != NULL && mSlots[i].mGraphicBuffer->handle == buffer->handle) { - RefPtr client(mSlots[i].mTextureClient); + nsRefPtr client(mSlots[i].mTextureClient); return client.forget(); } } diff --git a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueProducer.cpp b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueProducer.cpp index 8dd9480d60a..dbb99c60efc 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueProducer.cpp +++ b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferQueueProducer.cpp @@ -341,7 +341,7 @@ status_t GonkBufferQueueProducer::dequeueBuffer(int *outSlot, } // Autolock scope if (returnFlags & BUFFER_NEEDS_REALLOCATION) { - RefPtr textureClient = + nsRefPtr textureClient = new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(), gfx::SurfaceFormat::UNKNOWN, gfx::BackendType::NONE, diff --git a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferSlot.h b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferSlot.h index c93827eb51c..83ad77a9d54 100644 --- a/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferSlot.h +++ b/widget/gonk/nativewindow/GonkBufferQueueLL/GonkBufferSlot.h @@ -124,7 +124,7 @@ struct GonkBufferSlot { bool mAttachedByConsumer; // mTextureClient is a thin abstraction over remotely allocated GraphicBuffer. - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; }; } // namespace android diff --git a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp index 954bf7fe4b2..9e179fc4f7a 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp +++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp @@ -320,7 +320,7 @@ status_t GonkNativeWindow::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, sp graphicBuffer; if (alloc) { - RefPtr textureClient = + nsRefPtr textureClient = new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(), gfx::SurfaceFormat::UNKNOWN, gfx::BackendType::NONE, @@ -410,7 +410,7 @@ GonkNativeWindow::getTextureClientFromBuffer(ANativeWindowBuffer* buffer) return nullptr; } - RefPtr client(mSlots[buf].mTextureClient); + nsRefPtr client(mSlots[buf].mTextureClient); return client.forget(); } @@ -489,7 +489,7 @@ GonkNativeWindow::getCurrentBuffer() { mDequeueCondition.signal(); mSlots[buf].mTextureClient->SetRecycleCallback(GonkNativeWindow::RecycleCallback, this); - RefPtr client(mSlots[buf].mTextureClient); + nsRefPtr client(mSlots[buf].mTextureClient); return client.forget(); } diff --git a/widget/gonk/nativewindow/GonkNativeWindowICS.h b/widget/gonk/nativewindow/GonkNativeWindowICS.h index f4ec9ef2ae5..0a9774293d6 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowICS.h +++ b/widget/gonk/nativewindow/GonkNativeWindowICS.h @@ -177,7 +177,7 @@ private: sp mGraphicBuffer; // mTextureClient is a thin abstraction over remotely allocated GraphicBuffer. - mozilla::RefPtr mTextureClient; + nsRefPtr mTextureClient; // BufferState represents the different states in which a buffer slot // can be. diff --git a/widget/gonk/nativewindow/GonkNativeWindowJB.cpp b/widget/gonk/nativewindow/GonkNativeWindowJB.cpp index 3065559dcbb..9ca61ae40da 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowJB.cpp +++ b/widget/gonk/nativewindow/GonkNativeWindowJB.cpp @@ -23,7 +23,7 @@ #include "GonkNativeWindowJB.h" #include "GrallocImages.h" #include "mozilla/layers/ImageBridgeChild.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #define BI_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) #define BI_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) @@ -120,7 +120,7 @@ GonkNativeWindow::getCurrentBuffer() { return NULL; } - RefPtr textureClient = + nsRefPtr textureClient = mBufferQueue->getTextureClientFromBuffer(item.mGraphicBuffer.get()); if (!textureClient) { return NULL; diff --git a/widget/gonk/nativewindow/GonkNativeWindowKK.cpp b/widget/gonk/nativewindow/GonkNativeWindowKK.cpp index e1d0b307838..84c20f92715 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowKK.cpp +++ b/widget/gonk/nativewindow/GonkNativeWindowKK.cpp @@ -120,7 +120,7 @@ GonkNativeWindow::getCurrentBuffer() { return NULL; } - RefPtr textureClient = + nsRefPtr textureClient = mConsumer->getTextureClientFromBuffer(item.mGraphicBuffer.get()); if (!textureClient) { return NULL; diff --git a/widget/gonk/nativewindow/GonkNativeWindowLL.cpp b/widget/gonk/nativewindow/GonkNativeWindowLL.cpp index ea82a3a06ba..ab38e940e1e 100644 --- a/widget/gonk/nativewindow/GonkNativeWindowLL.cpp +++ b/widget/gonk/nativewindow/GonkNativeWindowLL.cpp @@ -131,7 +131,7 @@ GonkNativeWindow::getCurrentBuffer() { return NULL; } - RefPtr textureClient = + nsRefPtr textureClient = mConsumer->getTextureClientFromBuffer(item.mGraphicBuffer.get()); if (!textureClient) { return NULL; diff --git a/widget/gonk/nativewindow/IGonkGraphicBufferConsumerLL.h b/widget/gonk/nativewindow/IGonkGraphicBufferConsumerLL.h index 8a93a084971..66c0ab5efe0 100644 --- a/widget/gonk/nativewindow/IGonkGraphicBufferConsumerLL.h +++ b/widget/gonk/nativewindow/IGonkGraphicBufferConsumerLL.h @@ -27,7 +27,7 @@ #include #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" class ANativeWindowBuffer; diff --git a/widget/gonk/nsClipboard.cpp b/widget/gonk/nsClipboard.cpp index 63fe4fbe871..18545d57eec 100644 --- a/widget/gonk/nsClipboard.cpp +++ b/widget/gonk/nsClipboard.cpp @@ -144,14 +144,14 @@ nsClipboard::SetData(nsITransferable *aTransferable, continue; } - RefPtr surface = + nsRefPtr surface = image->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (!surface) { continue; } - RefPtr dataSurface; + nsRefPtr dataSurface; if (surface->GetFormat() == gfx::SurfaceFormat::B8G8R8A8) { dataSurface = surface->GetDataSurface(); } else { @@ -266,7 +266,7 @@ nsClipboard::GetData(nsITransferable *aTransferable, flavorStr.EqualsLiteral(kGIFImageMime)) && mClipboard->HasImage() ) { // Get image buffer from clipboard. - RefPtr image = mClipboard->GetImage(); + nsRefPtr image = mClipboard->GetImage(); // Encode according to MIME type. nsRefPtr drawable = new gfxSurfaceDrawable(image, image->GetSize()); diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 6cdd3356a0d..8ec3145149d 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -698,7 +698,7 @@ nsWindow::StartRemoteDrawing() mBackBuffer = mFramebufferTarget->CreateSimilarDrawTarget( mFramebufferTarget->GetSize(), mFramebufferTarget->GetFormat()); } - RefPtr buffer(mBackBuffer); + nsRefPtr buffer(mBackBuffer); return buffer.forget(); } @@ -708,7 +708,7 @@ nsWindow::EndRemoteDrawing() if (mFramebufferTarget && mFramebuffer) { IntSize size = mFramebufferTarget->GetSize(); Rect rect(0, 0, size.width, size.height); - RefPtr source = mBackBuffer->Snapshot(); + nsRefPtr source = mBackBuffer->Snapshot(); mFramebufferTarget->DrawSurface(source, rect, rect); // Convert from BGR to RGB diff --git a/widget/gonk/nsWindow.h b/widget/gonk/nsWindow.h index a2adfe31499..7d7ca764b5d 100644 --- a/widget/gonk/nsWindow.h +++ b/widget/gonk/nsWindow.h @@ -140,7 +140,7 @@ protected: // If we're using a BasicCompositor, these fields are temporarily // set during frame composition. They wrap the hardware // framebuffer. - mozilla::RefPtr mFramebufferTarget; + nsRefPtr mFramebufferTarget; ANativeWindowBuffer* mFramebuffer; /** * Points to a mapped gralloc buffer between calls to lock and unlock. @@ -155,7 +155,7 @@ protected: // // Only accessed on the compositor thread, except during // destruction. - mozilla::RefPtr mBackBuffer; + nsRefPtr mBackBuffer; virtual ~nsWindow(); diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index 9db14808f93..35ca0e069a3 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -18,7 +18,7 @@ #include "nsStringStream.h" #include "nsIObserverService.h" #include "mozilla/Services.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "imgIContainer.h" @@ -996,7 +996,7 @@ clipboard_contents_received(GtkClipboard *clipboard, static GtkSelectionData * wait_for_contents(GtkClipboard *clipboard, GdkAtom target) { - RefPtr context = new RetrievalContext(); + nsRefPtr context = new RetrievalContext(); // Balanced by Release in clipboard_contents_received context.get()->AddRef(); gtk_clipboard_request_contents(clipboard, target, @@ -1018,7 +1018,7 @@ clipboard_text_received(GtkClipboard *clipboard, static gchar * wait_for_text(GtkClipboard *clipboard) { - RefPtr context = new RetrievalContext(); + nsRefPtr context = new RetrievalContext(); // Balanced by Release in clipboard_text_received context.get()->AddRef(); gtk_clipboard_request_text(clipboard, clipboard_text_received, context.get()); diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index 2a19597c245..45a378e8ec7 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -434,7 +434,7 @@ nsDragService::SetAlphaPixmap(SourceSurface *aSurface, if (!xPixmapSurface) return false; - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateDrawTargetForSurface(xPixmapSurface, IntSize(dragRect.width, dragRect.height)); if (!dt) @@ -466,7 +466,7 @@ nsDragService::SetAlphaPixmap(SourceSurface *aSurface, if (!surf) return false; - RefPtr dt = gfxPlatform::GetPlatform()-> + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateDrawTargetForData(cairo_image_surface_get_data(surf), dragRect.Size(), cairo_image_surface_get_stride(surf), @@ -1635,7 +1635,7 @@ void nsDragService::SetDragIcon(GdkDragContext* aContext) nsIntRect dragRect; nsPresContext* pc; - RefPtr surface; + nsRefPtr surface; DrawDrag(mSourceNode, mSourceRegion, mScreenX, mScreenY, &dragRect, &surface, &pc); if (!pc) diff --git a/widget/gtk/nsImageToPixbuf.cpp b/widget/gtk/nsImageToPixbuf.cpp index a83a570d3d8..fd92dc82a90 100644 --- a/widget/gtk/nsImageToPixbuf.cpp +++ b/widget/gtk/nsImageToPixbuf.cpp @@ -9,12 +9,11 @@ #include "imgIContainer.h" #include "mozilla/gfx/2D.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsAutoPtr.h" using mozilla::gfx::DataSourceSurface; using mozilla::gfx::SurfaceFormat; -using mozilla::RefPtr; NS_IMPL_ISUPPORTS(nsImageToPixbuf, nsIImageToPixbuf) @@ -37,7 +36,7 @@ nsImageToPixbuf::ConvertImageToPixbuf(imgIContainer* aImage) GdkPixbuf* nsImageToPixbuf::ImageToPixbuf(imgIContainer* aImage) { - RefPtr surface = + nsRefPtr surface = aImage->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); @@ -73,7 +72,7 @@ nsImageToPixbuf::SourceSurfaceToPixbuf(SourceSurface* aSurface, uint32_t destStride = gdk_pixbuf_get_rowstride (pixbuf); guchar* destPixels = gdk_pixbuf_get_pixels (pixbuf); - RefPtr dataSurface = aSurface->GetDataSurface(); + nsRefPtr dataSurface = aSurface->GetDataSurface(); DataSourceSurface::MappedSurface map; if (!dataSurface->Map(DataSourceSurface::MapType::READ, &map)) return nullptr; diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp index 456bdd017a8..826d94bff40 100644 --- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -879,7 +879,7 @@ DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget, if (!NS_WARN_IF(!surf)) { cairo_t* cr = cairo_create(surf); if (!NS_WARN_IF(!cr)) { - RefPtr clipper = new SystemCairoClipper(cr); + nsRefPtr clipper = new SystemCairoClipper(cr); aContext->ExportClip(*clipper); cairo_set_matrix(cr, &mat); @@ -909,7 +909,7 @@ DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget, if (!NS_WARN_IF(!surf)) { cairo_t* cr = cairo_create(surf); if (!NS_WARN_IF(!cr)) { - RefPtr clipper = new SystemCairoClipper(cr); + nsRefPtr clipper = new SystemCairoClipper(cr); aContext->ExportClip(*clipper); cairo_set_matrix(cr, &mat); @@ -925,7 +925,7 @@ DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget, // If the widget has any transparency, make sure to choose an alpha format. format = aTransparency != nsITheme::eOpaque ? SurfaceFormat::B8G8R8A8 : aDrawTarget->GetFormat(); // Create a temporary data surface to render the widget into. - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(aDrawSize, format, aTransparency != nsITheme::eOpaque); DataSourceSurface::MappedSurface map; if (!NS_WARN_IF(!(dataSurface && dataSurface->Map(DataSourceSurface::MapType::WRITE, &map)))) { diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 43d135058fe..4e054fc34fd 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -2185,7 +2185,7 @@ nsWindow::OnExposeEvent(cairo_t *cr) return TRUE; } - RefPtr dt = GetDrawTarget(region); + nsRefPtr dt = GetDrawTarget(region); if(!dt) { return FALSE; } @@ -2301,7 +2301,7 @@ nsWindow::UpdateAlpha(gfxPattern* aPattern, nsIntRect aBoundsRect) aBoundsRect.width); int32_t bufferSize = stride * aBoundsRect.height; nsAutoArrayPtr imageBuffer(new (std::nothrow) uint8_t[bufferSize]); - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateDrawTargetForData(imageBuffer, aBoundsRect.Size(), stride, SurfaceFormat::A8); @@ -6335,7 +6335,7 @@ nsWindow::GetDrawTarget(const nsIntRegion& aRegion) return nullptr; } - RefPtr dt; + nsRefPtr dt; #ifdef MOZ_X11 # ifdef MOZ_HAVE_SHMIMAGE @@ -6346,7 +6346,7 @@ nsWindow::GetDrawTarget(const nsIntRegion& aRegion) } # endif // MOZ_HAVE_SHMIMAGE if (!dt) { - RefPtr surf = new gfxXlibSurface(mXDisplay, mXWindow, mXVisual, size); + nsRefPtr surf = new gfxXlibSurface(mXDisplay, mXWindow, mXVisual, size); if (!surf->CairoStatus()) { dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf.get(), surf->GetSize()); } diff --git a/widget/nsBaseDragService.cpp b/widget/nsBaseDragService.cpp index 32c9d9bcf8b..ace76425329 100644 --- a/widget/nsBaseDragService.cpp +++ b/widget/nsBaseDragService.cpp @@ -460,7 +460,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode, nsIScriptableRegion* aRegion, int32_t aScreenX, int32_t aScreenY, nsIntRect* aScreenDragRect, - RefPtr* aSurface, + nsRefPtr* aSurface, nsPresContext** aPresContext) { *aSurface = nullptr; @@ -622,7 +622,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext, HTMLCanvasElement* aCanvas, int32_t aScreenX, int32_t aScreenY, nsIntRect* aScreenDragRect, - RefPtr* aSurface) + nsRefPtr* aSurface) { nsCOMPtr imgContainer; if (aImageLoader) { @@ -657,7 +657,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext, nsresult result = NS_OK; if (aImageLoader) { - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()-> CreateOffscreenContentDrawTarget(destSize, SurfaceFormat::B8G8R8A8); diff --git a/widget/nsBaseDragService.h b/widget/nsBaseDragService.h index 38a1d783d4a..24034294a5e 100644 --- a/widget/nsBaseDragService.h +++ b/widget/nsBaseDragService.h @@ -14,7 +14,7 @@ #include "nsCOMPtr.h" #include "nsRect.h" #include "nsPoint.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/HTMLCanvasElement.h" #include "nsTArray.h" @@ -89,7 +89,7 @@ protected: nsIScriptableRegion* aRegion, int32_t aScreenX, int32_t aScreenY, nsIntRect* aScreenDragRect, - mozilla::RefPtr* aSurface, + nsRefPtr* aSurface, nsPresContext **aPresContext); /** @@ -101,7 +101,7 @@ protected: mozilla::dom::HTMLCanvasElement* aCanvas, int32_t aScreenX, int32_t aScreenY, nsIntRect* aScreenDragRect, - mozilla::RefPtr* aSurface); + nsRefPtr* aSurface); /** * Convert aScreenX and aScreenY from CSS pixels into unscaled device pixels. diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 7c5f760444f..f3e615fa3fb 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1956,8 +1956,8 @@ nsIWidget::SnapshotWidgetOnScreen() return nullptr; } - RefPtr snapshot = GetSurfaceForDescriptor(surface); - RefPtr dt = + nsRefPtr snapshot = GetSurfaceForDescriptor(surface); + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, gfx::SurfaceFormat::B8G8R8A8); if (!snapshot || !dt) { forwarder->DestroySharedSurface(&surface); diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index b8dc2bc914f..516c331e266 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -308,7 +308,7 @@ public: virtual const SizeConstraints& GetSizeConstraints() const override; virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override; - virtual bool CaptureWidgetOnScreen(mozilla::RefPtr aDT) override { + virtual bool CaptureWidgetOnScreen(nsRefPtr aDT) override { return false; } diff --git a/widget/nsDragServiceProxy.cpp b/widget/nsDragServiceProxy.cpp index 94726bc888c..5c9cbce0fdb 100644 --- a/widget/nsDragServiceProxy.cpp +++ b/widget/nsDragServiceProxy.cpp @@ -51,12 +51,12 @@ nsDragServiceProxy::InvokeDragSession(nsIDOMNode* aDOMNode, if (mHasImage || mSelection) { nsIntRect dragRect; nsPresContext* pc; - mozilla::RefPtr surface; + nsRefPtr surface; DrawDrag(mSourceNode, aRegion, mScreenX, mScreenY, &dragRect, &surface, &pc); if (surface) { - mozilla::RefPtr dataSurface = + nsRefPtr dataSurface = surface->GetDataSurface(); mozilla::gfx::IntSize size = dataSurface->GetSize(); diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 44919ce060d..b34504cd1f6 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -21,7 +21,7 @@ #include "mozilla/Maybe.h" #include "mozilla/EventForwards.h" #include "mozilla/layers/LayersTypes.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/TimeStamp.h" #include "mozilla/gfx/Point.h" #include "mozilla/widget/IMEData.h" @@ -1676,7 +1676,7 @@ class nsIWidget : public nsISupports { * compositor for SnapshotWidgetOnScreen(), and should not be called * otherwise. */ - virtual bool CaptureWidgetOnScreen(mozilla::RefPtr aDT) = 0; + virtual bool CaptureWidgetOnScreen(nsRefPtr aDT) = 0; virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) = 0; diff --git a/widget/qt/nsClipboard.cpp b/widget/qt/nsClipboard.cpp index dfac48e4eff..e39930aa050 100644 --- a/widget/qt/nsClipboard.cpp +++ b/widget/qt/nsClipboard.cpp @@ -178,13 +178,13 @@ nsClipboard::SetNativeClipboardData( nsITransferable *aTransferable, if (!image) // Not getting an image for an image mime type!? continue; - RefPtr surface = + nsRefPtr surface = image->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); if (!surface) continue; - RefPtr dataSurface = + nsRefPtr dataSurface = surface->GetDataSurface(); if (!dataSurface) continue; diff --git a/widget/uikit/nsWindow.mm b/widget/uikit/nsWindow.mm index 31a3e759782..9dbf8c87400 100644 --- a/widget/uikit/nsWindow.mm +++ b/widget/uikit/nsWindow.mm @@ -357,7 +357,7 @@ private: nsRefPtr targetContext; if (gfxPlatform::GetPlatform()->SupportsAzureContentForType(gfx::BackendType::COREGRAPHICS)) { - RefPtr dt = + nsRefPtr dt = gfx::Factory::CreateDrawTargetForCairoCGContext(aContext, gfx::IntSize(backingSize.width, backingSize.height)); @@ -368,7 +368,7 @@ private: // debugging. targetSurface = new gfxQuartzSurface(aContext, backingSize); targetSurface->SetAllowUseAsSource(false); - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface, gfx::IntSize(backingSize.width, backingSize.height)); diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index bb851706681..47adfe7df94 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -15,7 +15,7 @@ #include "mozilla/gfx/2D.h" #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/Preferences.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/WindowsVersion.h" #include "nsIContentPolicy.h" #include "nsContentUtils.h" @@ -1156,13 +1156,13 @@ AsyncFaviconDataReady::OnComplete(nsIURI *aFaviconURI, getter_AddRefs(container)); NS_ENSURE_SUCCESS(rv, rv); - RefPtr surface = + nsRefPtr surface = container->GetFrame(imgIContainer::FRAME_FIRST, imgIContainer::FLAG_SYNC_DECODE | imgIContainer::FLAG_ASYNC_NOTIFY); NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE); - RefPtr dataSurface; + nsRefPtr dataSurface; IntSize size; if (mURLShortcut) { @@ -1178,7 +1178,7 @@ AsyncFaviconDataReady::OnComplete(nsIURI *aFaviconURI, return NS_ERROR_FAILURE; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), @@ -1256,7 +1256,7 @@ NS_IMETHODIMP AsyncEncodeAndWriteIcon::Run() // Note that since we're off the main thread we can't use // gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget() - RefPtr surface = + nsRefPtr surface = Factory::CreateWrappingDataSourceSurface(mBuffer, mStride, IntSize(mWidth, mHeight), SurfaceFormat::B8G8R8A8); diff --git a/widget/windows/nsDragService.cpp b/widget/windows/nsDragService.cpp index 5b61ed6a68b..071134fbf12 100644 --- a/widget/windows/nsDragService.cpp +++ b/widget/windows/nsDragService.cpp @@ -79,7 +79,7 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode, // Prepare the drag image nsIntRect dragRect; - RefPtr surface; + nsRefPtr surface; nsPresContext* pc; DrawDrag(aDOMNode, aRegion, mScreenX, mScreenY, @@ -94,7 +94,7 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode, psdi->crColorKey = CLR_NONE; - RefPtr dataSurface = + nsRefPtr dataSurface = Factory::CreateDataSourceSurface(IntSize(bmWidth, bmHeight), SurfaceFormat::B8G8R8A8); NS_ENSURE_TRUE(dataSurface, false); @@ -104,7 +104,7 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode, return false; } - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), diff --git a/widget/windows/nsImageClipboard.cpp b/widget/windows/nsImageClipboard.cpp index fab62eab58c..36aab314401 100644 --- a/widget/windows/nsImageClipboard.cpp +++ b/widget/windows/nsImageClipboard.cpp @@ -8,7 +8,7 @@ #include "gfxUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/DataSurfaceHelpers.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsITransferable.h" #include "nsGfxCIID.h" #include "nsMemory.h" @@ -123,7 +123,7 @@ nsImageToClipboard::CreateFromImage ( imgIContainer* inImage, HANDLE* outBitmap nsresult rv; *outBitmap = nullptr; - RefPtr surface = + nsRefPtr surface = inImage->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(surface, NS_ERROR_FAILURE); @@ -131,7 +131,7 @@ nsImageToClipboard::CreateFromImage ( imgIContainer* inImage, HANDLE* outBitmap MOZ_ASSERT(surface->GetFormat() == SurfaceFormat::B8G8R8A8 || surface->GetFormat() == SurfaceFormat::B8G8R8X8); - RefPtr dataSurface; + nsRefPtr dataSurface; if (surface->GetFormat() == SurfaceFormat::B8G8R8A8) { dataSurface = surface->GetDataSurface(); } else { diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 7ef5148b55f..94eb80ddef6 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -7050,7 +7050,7 @@ void nsWindow::ClearTranslucentWindow() { if (mTransparentSurface) { IntSize size = mTransparentSurface->GetSize(); - RefPtr drawTarget = gfxPlatform::GetPlatform()-> + nsRefPtr drawTarget = gfxPlatform::GetPlatform()-> CreateDrawTargetForSurface(mTransparentSurface, size); drawTarget->ClearRect(Rect(0, 0, size.width, size.height)); UpdateTranslucentWindow(); @@ -7721,7 +7721,7 @@ void nsWindow::PickerClosed() } } -bool nsWindow::CaptureWidgetOnScreen(RefPtr aDT) +bool nsWindow::CaptureWidgetOnScreen(nsRefPtr aDT) { BOOL dwmEnabled = false; if (WinUtils::dwmIsCompositionEnabledPtr && @@ -7744,12 +7744,12 @@ bool nsWindow::CaptureWidgetOnScreen(RefPtr aDT) return false; } - RefPtr source = Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size); + nsRefPtr source = Factory::CreateDrawTargetForCairoSurface(surf->CairoSurface(), size); if (!source) { ::ReleaseDC(mWnd, dc); return false; } - RefPtr snapshot = source->Snapshot(); + nsRefPtr snapshot = source->Snapshot(); if (!snapshot) { ::ReleaseDC(mWnd, dc); return false; diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index eabcc67c985..5a413cc592c 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -291,7 +291,7 @@ public: bool IsPopup(); virtual bool ShouldUseOffMainThreadCompositing(); - bool CaptureWidgetOnScreen(mozilla::RefPtr aDT); + bool CaptureWidgetOnScreen(nsRefPtr aDT); protected: virtual ~nsWindow(); diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp index 7b7f3e5fcba..7a8915c60d6 100644 --- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -31,7 +31,7 @@ using mozilla::plugins::PluginInstanceParent; #include "mozilla/gfx/2D.h" #include "mozilla/gfx/DataSurfaceHelpers.h" #include "mozilla/gfx/Tools.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsGfxCIID.h" #include "gfxContext.h" #include "prmem.h" @@ -369,7 +369,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel) RECT paintRect; ::GetClientRect(mWnd, &paintRect); - RefPtr dt = + nsRefPtr dt = gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(targetSurface, IntSize(paintRect.right - paintRect.left, paintRect.bottom - paintRect.top)); @@ -582,7 +582,7 @@ nsresult nsWindowGfx::CreateIcon(imgIContainer *aContainer, (aScaledSize.width == 0 && aScaledSize.height == 0)); // Get the image data - RefPtr surface = + nsRefPtr surface = aContainer->GetFrame(imgIContainer::FRAME_CURRENT, imgIContainer::FLAG_SYNC_DECODE); NS_ENSURE_TRUE(surface, NS_ERROR_NOT_AVAILABLE); @@ -597,7 +597,7 @@ nsresult nsWindowGfx::CreateIcon(imgIContainer *aContainer, iconSize = frameSize; } - RefPtr dataSurface; + nsRefPtr dataSurface; bool mappedOK; DataSourceSurface::MappedSurface map; @@ -609,7 +609,7 @@ nsresult nsWindowGfx::CreateIcon(imgIContainer *aContainer, mappedOK = dataSurface->Map(DataSourceSurface::MapType::READ_WRITE, &map); NS_ENSURE_TRUE(mappedOK, NS_ERROR_FAILURE); - RefPtr dt = + nsRefPtr dt = Factory::CreateDrawTargetForData(BackendType::CAIRO, map.mData, dataSurface->GetSize(), diff --git a/xpcom/build/IOInterposer.cpp b/xpcom/build/IOInterposer.cpp index 26ad0045aeb..ead63b6a8fa 100644 --- a/xpcom/build/IOInterposer.cpp +++ b/xpcom/build/IOInterposer.cpp @@ -13,7 +13,7 @@ #include "MainThreadIOLogger.h" #include "mozilla/Atomics.h" #include "mozilla/Mutex.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "mozilla/StaticPtr.h" #include "mozilla/ThreadLocal.h" #include "nscore.h" // for NS_FREE_PERMANENT_DATA @@ -149,7 +149,7 @@ public: inline bool IsMainThread() const { return mIsMainThread; } inline void SetObserverLists(uint32_t aNewGeneration, - RefPtr& aNewLists) + nsRefPtr& aNewLists) { mCurrentGeneration = aNewGeneration; mObserverLists = aNewLists; @@ -167,7 +167,7 @@ private: bool mIsMainThread; bool mIsHandlingObservation; uint32_t mCurrentGeneration; - RefPtr mObserverLists; + nsRefPtr mObserverLists; }; class MasterList @@ -329,7 +329,7 @@ public: } private: - RefPtr mObserverLists; + nsRefPtr mObserverLists; // Note, we cannot use mozilla::Mutex here as the ObserverLists may be leaked // (We want to monitor IO during shutdown). Furthermore, as we may have to // unregister observers during shutdown an OffTheBooksMutex is not an option diff --git a/xpcom/threads/BackgroundHangMonitor.cpp b/xpcom/threads/BackgroundHangMonitor.cpp index f69cf86346b..21962217169 100644 --- a/xpcom/threads/BackgroundHangMonitor.cpp +++ b/xpcom/threads/BackgroundHangMonitor.cpp @@ -144,7 +144,7 @@ private: /* Keep a reference to the manager, so we can keep going even after BackgroundHangManager::Shutdown is called. */ - const RefPtr mManager; + const nsRefPtr mManager; // Unique thread ID for identification const PRThread* mThreadID; @@ -490,7 +490,7 @@ BackgroundHangThread::FindThread() return sTlsKey.get(); } // If TLS is unavailable, we can search through the thread list - RefPtr manager(BackgroundHangManager::sInstance); + nsRefPtr manager(BackgroundHangManager::sInstance); MOZ_ASSERT(manager, "Creating BackgroundHangMonitor after shutdown"); PRThread* threadID = PR_GetCurrentThread(); diff --git a/xpcom/threads/BackgroundHangMonitor.h b/xpcom/threads/BackgroundHangMonitor.h index edb29f15eaf..82ea81748db 100644 --- a/xpcom/threads/BackgroundHangMonitor.h +++ b/xpcom/threads/BackgroundHangMonitor.h @@ -9,7 +9,7 @@ #include "mozilla/HangAnnotations.h" #include "mozilla/Monitor.h" -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsString.h" @@ -112,7 +112,7 @@ class BackgroundHangMonitor private: friend BackgroundHangManager; - RefPtr mThread; + nsRefPtr mThread; static bool ShouldDisableOnBeta(const nsCString &); static bool DisableOnBeta(); diff --git a/xpcom/threads/SharedThreadPool.cpp b/xpcom/threads/SharedThreadPool.cpp index 4944e6fc684..df583629983 100644 --- a/xpcom/threads/SharedThreadPool.cpp +++ b/xpcom/threads/SharedThreadPool.cpp @@ -112,7 +112,7 @@ SharedThreadPool::Get(const nsCString& aName, uint32_t aThreadLimit) } MOZ_ASSERT(pool); - RefPtr instance(pool); + nsRefPtr instance(pool); return instance.forget(); } diff --git a/xpcom/threads/SharedThreadPool.h b/xpcom/threads/SharedThreadPool.h index 149a25e7c22..b0e41b7f3c9 100644 --- a/xpcom/threads/SharedThreadPool.h +++ b/xpcom/threads/SharedThreadPool.h @@ -8,7 +8,7 @@ #define SharedThreadPool_h_ #include -#include "mozilla/RefPtr.h" +#include "mozilla/nsRefPtr.h" #include "nsThreadUtils.h" #include "nsIThreadManager.h" #include "nsIThreadPool.h"