Bug 1377328 - part 1 - Annotate some font-related helper classes as MOZ_STACK_CLASS. r=milan
authorJonathan Kew <jkew@mozilla.com>
Thu, 29 Jun 2017 17:52:38 -0700
changeset 374686 14a81abc410200721f759d072ee67aa29c83afc0
parent 374685 cfc37c6651dbe22f949a5f6aae8ea30a50471746
child 374687 c00b89451c8d9bb7c8746e02c80c1ea1bb60f5d0
push id32335
push usercbook@mozilla.com
push dateTue, 15 Aug 2017 09:42:31 +0000
treeherdermozilla-central@564e82f0f289 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1377328
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377328 - part 1 - Annotate some font-related helper classes as MOZ_STACK_CLASS. r=milan
gfx/src/nsFontMetrics.h
gfx/thebes/gfxFont.h
gfx/thebes/gfxTextRun.cpp
gfx/thebes/gfxTextRun.h
gfx/thebes/gfxUserFontSet.cpp
--- a/gfx/src/nsFontMetrics.h
+++ b/gfx/src/nsFontMetrics.h
@@ -44,17 +44,17 @@ struct nsBoundingMetrics;
  * reasonably well with the Western font that is loaded at Init time.
  */
 class nsFontMetrics final
 {
 public:
     typedef gfxTextRun::Range Range;
     typedef mozilla::gfx::DrawTarget DrawTarget;
 
-    struct Params
+    struct MOZ_STACK_CLASS Params
     {
       nsIAtom* language = nullptr;
       bool explicitLanguage = false;
       gfxFont::Orientation orientation = gfxFont::eHorizontal;
       gfxUserFontSet* userFontSet = nullptr;
       gfxTextPerfMetrics* textPerf = nullptr;
     };
 
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -332,17 +332,17 @@ protected:
         NS_DECL_ISUPPORTS
         NS_DECL_NSIOBSERVER
     };
 
     void DestroyFont(gfxFont *aFont);
 
     static gfxFontCache *gGlobalCache;
 
-    struct Key {
+    struct MOZ_STACK_CLASS Key {
         const gfxFontEntry* mFontEntry;
         const gfxFontStyle* mStyle;
         const gfxCharacterMap* mUnicodeRangeMap;
         Key(const gfxFontEntry* aFontEntry, const gfxFontStyle* aStyle,
             const gfxCharacterMap* aUnicodeRangeMap)
             : mFontEntry(aFontEntry), mStyle(aStyle),
               mUnicodeRangeMap(aUnicodeRangeMap)
         {}
@@ -538,17 +538,17 @@ class gfxTextRunFactory {
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxTextRunFactory)
 
 public:
     typedef mozilla::gfx::DrawTarget DrawTarget;
 
     /**
      * This record contains all the parameters needed to initialize a textrun.
      */
-    struct Parameters {
+    struct MOZ_STACK_CLASS Parameters {
         // Shape text params suggesting where the textrun will be rendered
         DrawTarget   *mDrawTarget;
         // Pointer to arbitrary user data (which should outlive the textrun)
         void         *mUserData;
         // A description of which characters have been stripped from the original
         // DOM string to produce the characters in the textrun. May be null
         // if that information is not relevant.
         gfxSkipChars *mSkipChars;
@@ -2216,17 +2216,17 @@ protected:
 
 // proportion of ascent used for x-height, if unable to read value from font
 #define DEFAULT_XHEIGHT_FACTOR 0.56f
 
 // Parameters passed to gfxFont methods for drawing glyphs from a textrun.
 // The TextRunDrawParams are set up once per textrun; the FontDrawParams
 // are dependent on the specific font, so they are set per GlyphRun.
 
-struct TextRunDrawParams {
+struct MOZ_STACK_CLASS TextRunDrawParams {
     RefPtr<mozilla::gfx::DrawTarget> dt;
     gfxContext              *context;
     gfxFont::Spacing        *spacing;
     gfxTextRunDrawCallbacks *callbacks;
     mozilla::SVGContextPaint *runContextPaint;
     mozilla::gfx::Color      fontSmoothingBGColor;
     gfxFloat                 direction;
     double                   devPerApp;
@@ -2235,31 +2235,31 @@ struct TextRunDrawParams {
     const mozilla::gfx::StrokeOptions *strokeOpts;
     const mozilla::gfx::DrawOptions   *drawOpts;
     DrawMode                 drawMode;
     bool                     isVerticalRun;
     bool                     isRTL;
     bool                     paintSVGGlyphs;
 };
 
-struct FontDrawParams {
+struct MOZ_STACK_CLASS FontDrawParams {
     RefPtr<mozilla::gfx::ScaledFont>            scaledFont;
     RefPtr<mozilla::gfx::GlyphRenderingOptions> renderingOptions;
     mozilla::SVGContextPaint *contextPaint;
     mozilla::gfx::Matrix     *passedInvMatrix;
     mozilla::gfx::Matrix      matInv;
     double                    synBoldOnePixelOffset;
     int32_t                   extraStrikes;
     mozilla::gfx::DrawOptions drawOptions;
     bool                      isVerticalFont;
     bool                      haveSVGGlyphs;
     bool                      haveColorGlyphs;
 };
 
-struct EmphasisMarkDrawParams {
+struct MOZ_STACK_CLASS EmphasisMarkDrawParams {
     gfxContext* context;
     gfxFont::Spacing* spacing;
     gfxTextRun* mark;
     gfxFloat advance;
     gfxFloat direction;
     bool isVertical;
 };
 
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -556,17 +556,17 @@ HasNonOpaqueNonTransparentColor(gfxConte
         if (0.f < aCurrentColorOut.a && aCurrentColorOut.a < 1.f) {
             return true;
         }
     }
     return false;
 }
 
 // helper class for double-buffering drawing with non-opaque color
-struct BufferAlphaColor {
+struct MOZ_STACK_CLASS BufferAlphaColor {
     explicit BufferAlphaColor(gfxContext *aContext)
         : mContext(aContext)
     {
 
     }
 
     ~BufferAlphaColor() {}
 
--- a/gfx/thebes/gfxTextRun.h
+++ b/gfx/thebes/gfxTextRun.h
@@ -236,17 +236,17 @@ public:
         // Only called if the hyphen width is requested.
         virtual already_AddRefed<DrawTarget> GetDrawTarget() const = 0;
 
         // Return the appUnitsPerDevUnit value to be used when measuring.
         // Only called if the hyphen width is requested.
         virtual uint32_t GetAppUnitsPerDevUnit() const = 0;
     };
 
-    struct DrawParams
+    struct MOZ_STACK_CLASS DrawParams
     {
         gfxContext* context;
         DrawMode drawMode = DrawMode::GLYPH_FILL;
         nscolor textStrokeColor = 0;
         gfxPattern* textStrokePattern = nullptr;
         const mozilla::gfx::StrokeOptions *strokeOpts = nullptr;
         const mozilla::gfx::DrawOptions *drawOpts = nullptr;
         PropertyProvider* provider = nullptr;
@@ -459,17 +459,17 @@ public:
     // of cases, a gfxTextRun contains just a single GlyphRun.)
     struct GlyphRun {
         RefPtr<gfxFont> mFont; // never null in a valid GlyphRun
         uint32_t        mCharacterOffset; // into original UTF16 string
         mozilla::gfx::ShapedTextFlags mOrientation; // gfxTextRunFactory::TEXT_ORIENT_* value
         uint8_t         mMatchType;
     };
 
-    class GlyphRunIterator {
+    class MOZ_STACK_CLASS GlyphRunIterator {
     public:
         GlyphRunIterator(const gfxTextRun *aTextRun, Range aRange)
           : mTextRun(aTextRun)
           , mStartOffset(aRange.start)
           , mEndOffset(aRange.end) {
             mNextIndex = mTextRun->FindFirstGlyphRunContaining(aRange.start);
         }
         bool NextRun();
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -166,17 +166,17 @@ gfxUserFontEntry::CreateFontInstance(con
 {
     NS_NOTREACHED("should only be creating a gfxFont"
                   " with an actual platform font entry");
 
     // userfont entry is a container, can't create font from the container
     return nullptr;
 }
 
-class gfxOTSContext : public ots::OTSContext {
+class MOZ_STACK_CLASS gfxOTSContext : public ots::OTSContext {
 public:
     explicit gfxOTSContext(gfxUserFontEntry* aUserFontEntry)
         : mUserFontEntry(aUserFontEntry)
     {
         // Whether to apply OTS validation to OpenType Layout tables
         mCheckOTLTables = gfxPrefs::ValidateOTLTables();
         // Whether to preserve Variation tables in downloaded fonts
         mKeepVariationTables = gfxPrefs::KeepVariationTables();