Bug 1377575 - No need to explicitly print 'this' from MemoryBlockCache logging - r?cpearce draft
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 30 Jun 2017 15:17:39 -0700
changeset 603371 f47d5c801f1c18912a8cd8fcc93b4e238e655272
parent 603312 a3b192dc8344679ce208af42b6246c3c0d42cab3
child 603372 f63a5e33b83381ee53bd034cd67ac41fc4509091
push id66784
push usergsquelart@mozilla.com
push dateMon, 03 Jul 2017 23:58:00 +0000
reviewerscpearce
bugs1377575
milestone56.0a1
Bug 1377575 - No need to explicitly print 'this' from MemoryBlockCache logging - r?cpearce Because it is already printed by LOG() itself. MozReview-Commit-ID: 6dBESWQtNkQ
dom/media/MemoryBlockCache.cpp
--- a/dom/media/MemoryBlockCache.cpp
+++ b/dom/media/MemoryBlockCache.cpp
@@ -41,19 +41,17 @@ enum MemoryBlockCacheTelemetryErrors
 
 MemoryBlockCache::MemoryBlockCache(int64_t aContentLength)
   // Buffer whole blocks.
   : mInitialContentLength((aContentLength >= 0) ? size_t(aContentLength) : 0)
   , mMutex("MemoryBlockCache")
   , mHasGrown(false)
 {
   if (aContentLength <= 0) {
-    LOG("@%p MemoryBlockCache() "
-        "MEMORYBLOCKCACHE_ERRORS='InitUnderuse'",
-        this);
+    LOG("MemoryBlockCache() MEMORYBLOCKCACHE_ERRORS='InitUnderuse'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           InitUnderuse);
   }
 }
 
 MemoryBlockCache::~MemoryBlockCache()
 {
   size_t sizes = static_cast<size_t>(mCombinedSizes -= mBuffer.Length());
@@ -138,26 +136,26 @@ MemoryBlockCache::EnsureBufferCanContain
   return true;
 }
 
 nsresult
 MemoryBlockCache::Init()
 {
   MutexAutoLock lock(mMutex);
   if (mBuffer.IsEmpty()) {
-    LOG("@%p Init()", this);
+    LOG("Init()");
     // Attempt to pre-allocate buffer for expected content length.
     if (!EnsureBufferCanContain(mInitialContentLength)) {
-      LOG("@%p Init() MEMORYBLOCKCACHE_ERRORS='InitAllocation'", this);
+      LOG("Init() MEMORYBLOCKCACHE_ERRORS='InitAllocation'");
       Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                             InitAllocation);
       return NS_ERROR_FAILURE;
     }
   } else {
-    LOG("@%p Init() again", this);
+    LOG("Init() again");
     // Re-initialization - Just erase data.
     MOZ_ASSERT(mBuffer.Length() >= mInitialContentLength);
     memset(mBuffer.Elements(), 0, mBuffer.Length());
   }
   // Ignore initial growth.
   mHasGrown = false;
   return NS_OK;
 }
@@ -167,26 +165,22 @@ MemoryBlockCache::WriteBlock(uint32_t aB
                              Span<const uint8_t> aData1,
                              Span<const uint8_t> aData2)
 {
   MutexAutoLock lock(mMutex);
 
   size_t offset = BlockIndexToOffset(aBlockIndex);
   if (offset + aData1.Length() + aData2.Length() > mBuffer.Length() &&
       !mHasGrown) {
-    LOG("@%p WriteBlock() "
-        "MEMORYBLOCKCACHE_ERRORS='WriteBlockOverflow'",
-        this);
+    LOG("WriteBlock() MEMORYBLOCKCACHE_ERRORS='WriteBlockOverflow'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           WriteBlockOverflow);
   }
   if (!EnsureBufferCanContain(offset + aData1.Length() + aData2.Length())) {
-    LOG("%p WriteBlock() "
-        "MEMORYBLOCKCACHE_ERRORS='WriteBlockCannotGrow'",
-        this);
+    LOG("WriteBlock() MEMORYBLOCKCACHE_ERRORS='WriteBlockCannotGrow'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           WriteBlockCannotGrow);
     return NS_ERROR_FAILURE;
   }
 
   memcpy(mBuffer.Elements() + offset, aData1.Elements(), aData1.Length());
   if (aData2.Length() > 0) {
     memcpy(mBuffer.Elements() + offset + aData1.Length(),
@@ -202,17 +196,17 @@ MemoryBlockCache::Read(int64_t aOffset,
                        uint8_t* aData,
                        int32_t aLength,
                        int32_t* aBytes)
 {
   MutexAutoLock lock(mMutex);
 
   MOZ_ASSERT(aOffset >= 0);
   if (aOffset + aLength > int64_t(mBuffer.Length())) {
-    LOG("@%p Read() MEMORYBLOCKCACHE_ERRORS='ReadOverrun'", this);
+    LOG("Read() MEMORYBLOCKCACHE_ERRORS='ReadOverrun'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           ReadOverrun);
     return NS_ERROR_FAILURE;
   }
 
   memcpy(aData, mBuffer.Elements() + aOffset, aLength);
   *aBytes = aLength;
 
@@ -222,34 +216,28 @@ MemoryBlockCache::Read(int64_t aOffset,
 nsresult
 MemoryBlockCache::MoveBlock(int32_t aSourceBlockIndex, int32_t aDestBlockIndex)
 {
   MutexAutoLock lock(mMutex);
 
   size_t sourceOffset = BlockIndexToOffset(aSourceBlockIndex);
   size_t destOffset = BlockIndexToOffset(aDestBlockIndex);
   if (sourceOffset + BLOCK_SIZE > mBuffer.Length()) {
-    LOG("@%p MoveBlock() "
-        "MEMORYBLOCKCACHE_ERRORS='MoveBlockSourceOverrun'",
-        this);
+    LOG("MoveBlock() MEMORYBLOCKCACHE_ERRORS='MoveBlockSourceOverrun'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           MoveBlockSourceOverrun);
     return NS_ERROR_FAILURE;
   }
   if (destOffset + BLOCK_SIZE > mBuffer.Length() && !mHasGrown) {
-    LOG("@%p MoveBlock() "
-        "MEMORYBLOCKCACHE_ERRORS='MoveBlockDestOverflow'",
-        this);
+    LOG("MoveBlock() MEMORYBLOCKCACHE_ERRORS='MoveBlockDestOverflow'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           MoveBlockDestOverflow);
   }
   if (!EnsureBufferCanContain(destOffset + BLOCK_SIZE)) {
-    LOG("@%p MoveBlock() "
-        "MEMORYBLOCKCACHE_ERRORS='MoveBlockCannotGrow'",
-        this);
+    LOG("MoveBlock() MEMORYBLOCKCACHE_ERRORS='MoveBlockCannotGrow'");
     Telemetry::Accumulate(Telemetry::HistogramID::MEMORYBLOCKCACHE_ERRORS,
                           MoveBlockCannotGrow);
     return NS_ERROR_FAILURE;
   }
 
   memcpy(mBuffer.Elements() + destOffset,
          mBuffer.Elements() + sourceOffset,
          BLOCK_SIZE);