Bug 1356317: Part 1 - Mark SurfaceMemoryReporter refcounting as threadsafe. r=njn
authorKris Maglione <maglione.k@gmail.com>
Mon, 29 May 2017 22:04:30 -0700
changeset 361217 03f5cefeae50760e32505de29136c8cee65eba43
parent 361216 916250167bc8300c141c771690da98eb9ea211d8
child 361218 a54f3cba5c24d4a12fe3029282fcab8a7b32a3e8
push id31918
push usercbook@mozilla.com
push dateTue, 30 May 2017 09:39:11 +0000
treeherdermozilla-central@286f71223256 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1356317
milestone55.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 1356317: Part 1 - Mark SurfaceMemoryReporter refcounting as threadsafe. r=njn MozReview-Commit-ID: 9U5KLMyKSbk
gfx/thebes/gfxASurface.cpp
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -467,17 +467,20 @@ public:
     static void AdjustUsedMemory(gfxSurfaceType aType, int32_t aBytes)
     {
         // A read-modify-write operation like += would require a memory barrier
         // here, which would defeat the purpose of using relaxed memory
         // ordering.  So separate out the read and write operations.
         sSurfaceMemoryUsed[size_t(aType)] = sSurfaceMemoryUsed[size_t(aType)] + aBytes;
     };
 
-    NS_DECL_ISUPPORTS
+    // This memory reporter is sometimes allocated on the compositor thread,
+    // but always released on the main thread, so its refcounting needs to be
+    // threadsafe.
+    NS_DECL_THREADSAFE_ISUPPORTS
 
     NS_IMETHOD CollectReports(nsIHandleReportCallback *aHandleReport,
                               nsISupports *aData, bool aAnonymize) override
     {
         const size_t len = ArrayLength(sSurfaceMemoryReporterAttrs);
         for (size_t i = 0; i < len; i++) {
             int64_t amount = sSurfaceMemoryUsed[i];