Bug 1385029 - get rid of gfxFontconfigUtils.h since gfxFontconfigFontBase is unnecessary. r=jfkthame
authorLee Salzman <lsalzman@mozilla.com>
Mon, 07 Aug 2017 16:20:37 -0400
changeset 422811 de5db6588684d33ee0e053241748148137488162
parent 422810 3f43ef75f6d27d66e1436c3a5a38b7764870a0c5
child 422812 24c8d3ee219f1aa582a16fb702c0e6376297fe1c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1385029
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 1385029 - get rid of gfxFontconfigUtils.h since gfxFontconfigFontBase is unnecessary. r=jfkthame MozReview-Commit-ID: FTXjgmRYBxI
gfx/thebes/gfxFcPlatformFontList.cpp
gfx/thebes/gfxFcPlatformFontList.h
gfx/thebes/gfxFontconfigUtils.h
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPlatformGtk.h
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -50,16 +50,30 @@ using namespace mozilla::unicode;
                                LogLevel::Debug, args)
 #define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \
                                    gfxPlatform::GetLog(eGfxLog_fontlist), \
                                    LogLevel::Debug)
 #define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \
                                    gfxPlatform::GetLog(eGfxLog_cmapdata), \
                                    LogLevel::Debug)
 
+template <>
+class nsAutoRefTraits<FcFontSet> : public nsPointerRefTraits<FcFontSet>
+{
+public:
+    static void Release(FcFontSet *ptr) { FcFontSetDestroy(ptr); }
+};
+
+template <>
+class nsAutoRefTraits<FcObjectSet> : public nsPointerRefTraits<FcObjectSet>
+{
+public:
+    static void Release(FcObjectSet *ptr) { FcObjectSetDestroy(ptr); }
+};
+
 static const FcChar8*
 ToFcChar8Ptr(const char* aStr)
 {
     return reinterpret_cast<const FcChar8*>(aStr);
 }
 
 static const char*
 ToCharPtr(const FcChar8 *aStr)
@@ -1176,18 +1190,19 @@ gfxFontconfigFontFamily::~gfxFontconfigF
 }
 
 gfxFontconfigFont::gfxFontconfigFont(const RefPtr<UnscaledFontFontconfig>& aUnscaledFont,
                                      cairo_scaled_font_t *aScaledFont,
                                      FcPattern *aPattern,
                                      gfxFloat aAdjustedSize,
                                      gfxFontEntry *aFontEntry,
                                      const gfxFontStyle *aFontStyle,
-                                     bool aNeedsBold) :
-    gfxFontconfigFontBase(aUnscaledFont, aScaledFont, aPattern, aFontEntry, aFontStyle)
+                                     bool aNeedsBold)
+    : gfxFT2FontBase(aUnscaledFont, aScaledFont, aFontEntry, aFontStyle)
+    , mPattern(aPattern)
 {
     mAdjustedSize = aAdjustedSize;
 }
 
 gfxFontconfigFont::~gfxFontconfigFont()
 {
 }
 
--- a/gfx/thebes/gfxFcPlatformFontList.h
+++ b/gfx/thebes/gfxFcPlatformFontList.h
@@ -6,32 +6,32 @@
 #ifndef GFXFCPLATFORMFONTLIST_H_
 #define GFXFCPLATFORMFONTLIST_H_
 
 #include "gfxFont.h"
 #include "gfxFontEntry.h"
 #include "gfxFT2FontBase.h"
 #include "gfxPlatformFontList.h"
 #include "mozilla/mozalloc.h"
+#include "nsAutoRef.h"
 #include "nsClassHashtable.h"
 
 #include <fontconfig/fontconfig.h>
 #include "ft2build.h"
 #include FT_FREETYPE_H
 #include FT_TRUETYPE_TABLES_H
 #include <cairo.h>
 #include <cairo-ft.h>
 
-#include "gfxFontconfigUtils.h" // xxx - only for nsAutoRefTraits<FcPattern>, etc.
-
 template <>
-class nsAutoRefTraits<FcObjectSet> : public nsPointerRefTraits<FcObjectSet>
+class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
 {
 public:
-    static void Release(FcObjectSet *ptr) { FcObjectSetDestroy(ptr); }
+    static void Release(FcPattern *ptr) { FcPatternDestroy(ptr); }
+    static void AddRef(FcPattern *ptr) { FcPatternReference(ptr); }
 };
 
 template <>
 class nsAutoRefTraits<FcConfig> : public nsPointerRefTraits<FcConfig>
 {
 public:
     static void Release(FcConfig *ptr) { FcConfigDestroy(ptr); }
     static void AddRef(FcConfig *ptr) { FcConfigReference(ptr); }
@@ -204,28 +204,33 @@ protected:
 
     nsTArray<nsCountedRef<FcPattern> > mFontPatterns;
 
     bool      mContainsAppFonts;
     bool      mHasNonScalableFaces;
     bool      mForceScalable;
 };
 
-class gfxFontconfigFont : public gfxFontconfigFontBase {
+class gfxFontconfigFont : public gfxFT2FontBase {
 public:
     gfxFontconfigFont(const RefPtr<mozilla::gfx::UnscaledFontFontconfig> &aUnscaledFont,
                       cairo_scaled_font_t *aScaledFont,
                       FcPattern *aPattern,
                       gfxFloat aAdjustedSize,
                       gfxFontEntry *aFontEntry,
                       const gfxFontStyle *aFontStyle,
                       bool aNeedsBold);
 
-protected:
+    virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; }
+    virtual FcPattern *GetPattern() const { return mPattern; }
+
+private:
     virtual ~gfxFontconfigFont();
+
+    nsCountedRef<FcPattern> mPattern;
 };
 
 class gfxFcPlatformFontList : public gfxPlatformFontList {
 public:
     gfxFcPlatformFontList();
 
     static gfxFcPlatformFontList* PlatformFontList() {
         return static_cast<gfxFcPlatformFontList*>(sPlatformFontList);
deleted file mode 100644
--- a/gfx/thebes/gfxFontconfigUtils.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-#ifndef GFX_FONTCONFIG_UTILS_H
-#define GFX_FONTCONFIG_UTILS_H
-
-#include "gfxPlatform.h"
-
-#include "nsAutoRef.h"
-#include "gfxFT2FontBase.h"
-
-#include <fontconfig/fontconfig.h>
-
-
-template <>
-class nsAutoRefTraits<FcPattern> : public nsPointerRefTraits<FcPattern>
-{
-public:
-    static void Release(FcPattern *ptr) { FcPatternDestroy(ptr); }
-    static void AddRef(FcPattern *ptr) { FcPatternReference(ptr); }
-};
-
-template <>
-class nsAutoRefTraits<FcFontSet> : public nsPointerRefTraits<FcFontSet>
-{
-public:
-    static void Release(FcFontSet *ptr) { FcFontSetDestroy(ptr); }
-};
-
-template <>
-class nsAutoRefTraits<FcCharSet> : public nsPointerRefTraits<FcCharSet>
-{
-public:
-    static void Release(FcCharSet *ptr) { FcCharSetDestroy(ptr); }
-};
-
-class gfxFontconfigFontBase : public gfxFT2FontBase {
-public:
-    gfxFontconfigFontBase(const RefPtr<mozilla::gfx::UnscaledFontFontconfig>& aUnscaledFont,
-                          cairo_scaled_font_t *aScaledFont,
-                          FcPattern *aPattern,
-                          gfxFontEntry *aFontEntry,
-                          const gfxFontStyle *aFontStyle)
-      : gfxFT2FontBase(aUnscaledFont, aScaledFont, aFontEntry, aFontStyle)
-      , mPattern(aPattern) { }
-
-    virtual FontType GetType() const override { return FONT_TYPE_FONTCONFIG; }
-    virtual FcPattern *GetPattern() const { return mPattern; }
-
-private:
-    nsCountedRef<FcPattern> mPattern;
-};
-
-#endif /* GFX_FONTCONFIG_UTILS_H */
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -8,17 +8,16 @@
 
 #include "gfxPlatformGtk.h"
 #include "prenv.h"
 
 #include "nsUnicharUtils.h"
 #include "nsUnicodeProperties.h"
 #include "gfx2DGlue.h"
 #include "gfxFcPlatformFontList.h"
-#include "gfxFontconfigUtils.h"
 #include "gfxFontconfigFonts.h"
 #include "gfxConfig.h"
 #include "gfxContext.h"
 #include "gfxUserFontSet.h"
 #include "gfxUtils.h"
 #include "gfxFT2FontBase.h"
 #include "gfxPrefs.h"
 #include "VsyncSource.h"
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -17,18 +17,16 @@ extern "C" {
 }
 #endif
 
 #ifdef MOZ_X11
 struct _XDisplay;
 typedef struct _XDisplay Display;
 #endif // MOZ_X11
 
-class gfxFontconfigUtils;
-
 class gfxPlatformGtk : public gfxPlatform {
 public:
     gfxPlatformGtk();
     virtual ~gfxPlatformGtk();
 
     static gfxPlatformGtk *GetPlatform() {
         return (gfxPlatformGtk*) gfxPlatform::GetPlatform();
     }
@@ -133,18 +131,16 @@ public:
 
 #ifdef MOZ_X11
     Display* GetCompositorDisplay() {
       return mCompositorDisplay;
     }
 #endif // MOZ_X11
 
 protected:
-    static gfxFontconfigUtils *sFontconfigUtils;
-
     int8_t mMaxGenericSubstitutions;
 
 private:
     virtual void GetPlatformCMSOutputProfile(void *&mem,
                                              size_t &size) override;
 
 #ifdef MOZ_X11
     Display* mCompositorDisplay;