Backed out 2 changesets (bug 1473732) for devtools and web platform reftest leaks. CLOSED TREE
authorCosmin Sabou <csabou@mozilla.com>
Mon, 30 Jul 2018 20:52:11 +0300
changeset 429272 1161111168cfbcbac5e92bdab486269cfda505b8
parent 429271 e4f654755cc5cb80fb0a5a91707e8a2eff425e3e
child 429273 fe2acb8f775a787b9027a5b46b59eeb1f73f5c63
child 429301 bae6ef2c3f2214cb1dbdfa5351a327b349559965
push id67094
push userccoroiu@mozilla.com
push dateMon, 30 Jul 2018 22:02:32 +0000
treeherderautoland@397b4d841690 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1473732
milestone63.0a1
backs out7742f4ea046bee56dd0141e7038ea8a1fefe6139
3354b6d032f3a436e6b2d11987b1c315ecf44c5c
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
Backed out 2 changesets (bug 1473732) for devtools and web platform reftest leaks. CLOSED TREE Backed out changeset 7742f4ea046b (bug 1473732) Backed out changeset 3354b6d032f3 (bug 1473732)
gfx/layers/PaintThread.cpp
gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
--- a/gfx/layers/PaintThread.cpp
+++ b/gfx/layers/PaintThread.cpp
@@ -17,17 +17,17 @@
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/SyncObject.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsIPropertyBag2.h"
 #include "nsServiceManagerUtils.h"
-#include "prsystem.h"
+#include "nsSystemInfo.h"
 
 // Uncomment the following line to dispatch sync runnables when
 // painting so that rasterization happens synchronously from
 // the perspective of the main thread
 // #define OMTP_FORCE_SYNC
 
 namespace mozilla {
 namespace layers {
@@ -151,17 +151,25 @@ PaintThread::Release()
 void
 PaintThread::AddRef()
 {
 }
 
 /* static */ int32_t
 PaintThread::CalculatePaintWorkerCount()
 {
-  int32_t cpuCores = PR_GetNumberOfProcessors();
+  int32_t cpuCores = 1;
+  nsCOMPtr<nsIPropertyBag2> systemInfo = do_GetService(NS_SYSTEMINFO_CONTRACTID);
+  if (systemInfo) {
+    nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"), &cpuCores);
+    if (NS_FAILED(rv)) {
+      cpuCores = 1;
+    }
+  }
+
   int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers();
 
   // If not manually specified, default to (cpuCores * 3) / 4, and clamp
   // between 1 and 4. If a user wants more, they can manually specify it
   if (workerCount < 1) {
     workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4);
   }
 
--- a/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
+++ b/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
@@ -8,17 +8,16 @@
 
 #include "cairo.h"
 #include "cairo-ft.h"
 
 #include "SkFontHost_FreeType_common.h"
 
 #include "SkAdvancedTypefaceMetrics.h"
 #include "SkFDot6.h"
-#include "SkMutex.h"
 #include "SkPath.h"
 #include "SkScalerContext.h"
 #include "SkTypefaceCache.h"
 
 #include <cmath>
 
 #include <ft2build.h>
 #include FT_FREETYPE_H
@@ -165,18 +164,16 @@ static bool bothZero(SkScalar a, SkScala
 
 // returns false if there is any non-90-rotation or skew
 static bool isAxisAligned(const SkScalerContextRec& rec) {
     return 0 == rec.fPreSkewX &&
            (bothZero(rec.fPost2x2[0][1], rec.fPost2x2[1][0]) ||
             bothZero(rec.fPost2x2[0][0], rec.fPost2x2[1][1]));
 }
 
-SK_DECLARE_STATIC_MUTEX(gTypefaceMutex);
-
 class SkCairoFTTypeface : public SkTypeface {
 public:
     virtual SkStreamAsset* onOpenStream(int*) const override { return nullptr; }
 
     virtual std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override
     {
         SkDEBUGCODE(SkDebugf("SkCairoFTTypeface::onGetAdvancedMetrics unimplemented\n"));
         return nullptr;
@@ -267,29 +264,19 @@ public:
 #ifdef CAIRO_HAS_FC_FONT
         if (fPattern) {
             FcPatternReference(fPattern);
         }
 #endif
     }
 
 private:
-
-    void internal_dispose() const override
-    {
-        SkAutoMutexAcquire lock(gTypefaceMutex);
-        internal_dispose_restore_refcnt_to_1();
-        delete this;
-    }
-
     ~SkCairoFTTypeface()
     {
-        if (cairo_font_face_get_user_data(fFontFace, &kSkTypefaceKey) == this) {
-            cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, nullptr, nullptr);
-        }
+        cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, nullptr, nullptr);
         cairo_font_face_destroy(fFontFace);
 #ifdef CAIRO_HAS_FC_FONT
         if (fPattern) {
             FcPatternDestroy(fPattern);
         }
 #endif
     }
 
@@ -298,23 +285,22 @@ private:
 };
 
 SkTypeface* SkCreateTypefaceFromCairoFTFontWithFontconfig(cairo_scaled_font_t* scaledFont, FcPattern* pattern)
 {
     cairo_font_face_t* fontFace = cairo_scaled_font_get_font_face(scaledFont);
     SkASSERT(cairo_font_face_status(fontFace) == CAIRO_STATUS_SUCCESS);
     SkASSERT(cairo_font_face_get_type(fontFace) == CAIRO_FONT_TYPE_FT);
 
-    SkAutoMutexAcquire lock(gTypefaceMutex);
-
     SkTypeface* typeface = reinterpret_cast<SkTypeface*>(cairo_font_face_get_user_data(fontFace, &kSkTypefaceKey));
-    if (typeface && typeface->getRefCnt() > 0) {
+    if (typeface) {
         typeface->ref();
     } else {
         typeface = new SkCairoFTTypeface(fontFace, pattern);
+        SkTypefaceCache::Add(typeface);
     }
 
     return typeface;
 }
 
 SkTypeface* SkCreateTypefaceFromCairoFTFont(cairo_scaled_font_t* scaledFont)
 {
     return SkCreateTypefaceFromCairoFTFontWithFontconfig(scaledFont, nullptr);