Closed
Bug 1264120
Opened 8 years ago
Closed 8 years ago
Remove usage of nsAutoPtr from gfx/src
Categories
(Core :: Graphics, defect)
Core
Graphics
Tracking
()
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: jrmuizel, Unassigned)
Details
Attachments
(1 file)
7.01 KB,
patch
|
jfkthame
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Reporter | ||
Comment 1•8 years ago
|
||
Comment on attachment 8740670 [details] [diff] [review] Remove usage of nsAutoPtr from gfx/src >commit 68968067a2a67d00aa96a32b6472b858906dcdc3 >Author: Jeff Muizelaar <jmuizelaar@mozilla.com> >Date: Tue Apr 12 14:26:47 2016 -0400 > > gfx/src uniquePtr > >diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp >index da002c3..4d90426 100644 >--- a/gfx/src/gfxCrashReporterUtils.cpp >+++ b/gfx/src/gfxCrashReporterUtils.cpp >@@ -11,17 +11,17 @@ > > #ifdef MOZ_GFXFEATUREREPORTER > #include "gfxCrashReporterUtils.h" > #include <string.h> // for strcmp > #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 > #include "mozilla/Services.h" // for GetObserverService > #include "mozilla/StaticMutex.h" > #include "mozilla/mozalloc.h" // for operator new, etc >-#include "nsAutoPtr.h" // for nsRefPtr >+#include "mozilla/RefPtr.h" // for RefPtr > #include "nsCOMPtr.h" // for nsCOMPtr > #include "nsError.h" // for NS_OK, NS_FAILED, nsresult > #include "nsExceptionHandler.h" // for AppendAppNotesToCrashReport > #include "nsID.h" > #include "nsIEventTarget.h" // for NS_DISPATCH_NORMAL > #include "nsIObserver.h" // for nsIObserver, etc > #include "nsIObserverService.h" // for nsIObserverService > #include "nsIRunnable.h" // for nsIRunnable >diff --git a/gfx/src/nsDeviceContext.h b/gfx/src/nsDeviceContext.h >index b50e8af..03383c1 100644 >--- a/gfx/src/nsDeviceContext.h >+++ b/gfx/src/nsDeviceContext.h >@@ -6,17 +6,17 @@ > #ifndef _NS_DEVICECONTEXT_H_ > #define _NS_DEVICECONTEXT_H_ > > #include <stdint.h> // for uint32_t > #include <sys/types.h> // for int32_t > #include "gfxTypes.h" // for gfxFloat > #include "gfxFont.h" // for gfxFont::Orientation > #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 >-#include "nsAutoPtr.h" // for nsRefPtr >+#include "mozilla/RefPtr.h" // for RefPtr > #include "nsCOMPtr.h" // for nsCOMPtr > #include "nsCoord.h" // for nscoord > #include "nsError.h" // for nsresult > #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING > #include "nsMathUtils.h" // for NS_round > #include "nscore.h" // for char16_t, nsAString > #include "mozilla/AppUnits.h" // for AppUnits > #include "nsFontMetrics.h" // for nsFontMetrics::Params >diff --git a/gfx/src/nsFont.h b/gfx/src/nsFont.h >index 48cbbfc..a2619ee5 100644 >--- a/gfx/src/nsFont.h >+++ b/gfx/src/nsFont.h >@@ -5,17 +5,17 @@ > > #ifndef nsFont_h___ > #define nsFont_h___ > > #include <stdint.h> // for uint8_t, uint16_t > #include <sys/types.h> // for int16_t > #include "gfxFontFamilyList.h" > #include "gfxFontFeatures.h" >-#include "nsAutoPtr.h" // for nsRefPtr >+#include "mozilla/RefPtr.h" // for RefPtr > #include "nsCoord.h" // for nscoord > #include "nsStringFwd.h" // for nsSubstring > #include "nsString.h" // for nsString > #include "nsTArray.h" // for nsTArray > > struct gfxFontStyle; > > // XXX we need a method to enumerate all of the possible fonts on the >diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp >index 523b68f..53f9c62 100644 >--- a/gfx/src/nsFontMetrics.cpp >+++ b/gfx/src/nsFontMetrics.cpp >@@ -15,49 +15,51 @@ > #include "nsDebug.h" // for NS_ERROR > #include "nsDeviceContext.h" // for nsDeviceContext > #include "nsIAtom.h" // for nsIAtom > #include "nsMathUtils.h" // for NS_round > #include "nsRenderingContext.h" // for nsRenderingContext > #include "nsString.h" // for nsString > #include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE > #include "mozilla/Assertions.h" // for MOZ_ASSERT >+#include "mozilla/UniquePtr.h" // for UniquePtr > > class gfxUserFontSet; >+using namespace mozilla; > > namespace { > > class AutoTextRun { > public: > typedef mozilla::gfx::DrawTarget DrawTarget; > > AutoTextRun(nsFontMetrics* aMetrics, DrawTarget* aDrawTarget, > const char* aString, int32_t aLength) > { >- mTextRun = aMetrics->GetThebesFontGroup()->MakeTextRun( >+ mTextRun.reset(aMetrics->GetThebesFontGroup()->MakeTextRun( > reinterpret_cast<const uint8_t*>(aString), aLength, > aDrawTarget, > aMetrics->AppUnitsPerDevPixel(), > ComputeFlags(aMetrics), >- nullptr); >+ nullptr)); > } > > AutoTextRun(nsFontMetrics* aMetrics, DrawTarget* aDrawTarget, > const char16_t* aString, int32_t aLength) > { >- mTextRun = aMetrics->GetThebesFontGroup()->MakeTextRun( >+ mTextRun.reset(aMetrics->GetThebesFontGroup()->MakeTextRun( > aString, aLength, > aDrawTarget, > aMetrics->AppUnitsPerDevPixel(), > ComputeFlags(aMetrics), >- nullptr); >+ nullptr)); > } > >- gfxTextRun *get() { return mTextRun; } >- gfxTextRun *operator->() { return mTextRun; } >+ gfxTextRun *get() { return mTextRun.get(); } >+ gfxTextRun *operator->() { return mTextRun.get(); } > > private: > static uint32_t ComputeFlags(nsFontMetrics* aMetrics) { > uint32_t flags = 0; > if (aMetrics->GetTextRunRTL()) { > flags |= gfxTextRunFactory::TEXT_IS_RTL; > } > if (aMetrics->GetVertical()) { >@@ -71,17 +73,17 @@ private: > case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS: > flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT; > break; > } > } > return flags; > } > >- nsAutoPtr<gfxTextRun> mTextRun; >+ UniquePtr<gfxTextRun> mTextRun; > }; > > class StubPropertyProvider : public gfxTextRun::PropertyProvider { > public: > virtual void GetHyphenationBreaks(gfxTextRun::Range aRange, > bool* aBreakBefore) { > NS_ERROR("This shouldn't be called because we never call BreakAndMeasureText"); > } >diff --git a/gfx/src/nsFontMetrics.h b/gfx/src/nsFontMetrics.h >index 886deed..163380c 100644 >--- a/gfx/src/nsFontMetrics.h >+++ b/gfx/src/nsFontMetrics.h >@@ -5,17 +5,17 @@ > > #ifndef NSFONTMETRICS__H__ > #define NSFONTMETRICS__H__ > > #include <stdint.h> // for uint32_t > #include <sys/types.h> // for int32_t > #include "gfxTextRun.h" // for gfxFont, gfxFontGroup > #include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 >-#include "nsAutoPtr.h" // for nsRefPtr >+#include "mozilla/RefPtr.h" // for RefPtr > #include "nsCOMPtr.h" // for nsCOMPtr > #include "nsCoord.h" // for nscoord > #include "nsError.h" // for nsresult > #include "nsFont.h" // for nsFont > #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING > #include "nscore.h" // for char16_t > > class gfxUserFontSet;
Attachment #8740670 -
Attachment is patch: true
Attachment #8740670 -
Flags: review?(jfkthame)
Comment 2•8 years ago
|
||
Comment on attachment 8740670 [details] [diff] [review] Remove usage of nsAutoPtr from gfx/src Review of attachment 8740670 [details] [diff] [review]: ----------------------------------------------------------------- LGTM
Attachment #8740670 -
Flags: review?(jfkthame) → review+
Comment 4•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/8827b7c4748b
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in
before you can comment on or make changes to this bug.
Description
•