Bug 1289668 - FrameStatistics style - r=kamidphish
authorGerald Squelart <gsquelart@mozilla.com>
Fri, 15 Jul 2016 16:48:56 +1000
changeset 347094 442f122200745ef96d1f4a220a6fb422001a351f
parent 347093 32a2d4eb59416851c4aa556e3c217f82c7a1bdcd
child 347095 86cec74f5da677e7960ad18545242f4bec8a4368
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1289668
milestone50.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 1289668 - FrameStatistics style - r=kamidphish MozReview-Commit-ID: B9yEd7tqfAN
dom/media/FrameStatistics.h
--- a/dom/media/FrameStatistics.h
+++ b/dom/media/FrameStatistics.h
@@ -6,91 +6,102 @@
 
 #ifndef FrameStatistics_h_
 #define FrameStatistics_h_
 
 namespace mozilla {
 
 // Frame decoding/painting related performance counters.
 // Threadsafe.
-class FrameStatistics {
+class FrameStatistics
+{
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FrameStatistics);
 
-  FrameStatistics() :
-      mReentrantMonitor("FrameStats"),
-      mParsedFrames(0),
-      mDecodedFrames(0),
-      mPresentedFrames(0),
-      mDroppedFrames(0) {}
+  FrameStatistics()
+    : mReentrantMonitor("FrameStats")
+    , mParsedFrames(0)
+    , mDecodedFrames(0)
+    , mPresentedFrames(0)
+    , mDroppedFrames(0)
+  {}
 
   // Returns number of frames which have been parsed from the media.
   // Can be called on any thread.
-  uint32_t GetParsedFrames() {
+  uint32_t GetParsedFrames() const
+  {
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     return mParsedFrames;
   }
 
   // Returns the number of parsed frames which have been decoded.
   // Can be called on any thread.
-  uint32_t GetDecodedFrames() {
+  uint32_t GetDecodedFrames() const
+  {
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     return mDecodedFrames;
   }
 
   // Returns the number of decoded frames which have been sent to the rendering
   // pipeline for painting ("presented").
   // Can be called on any thread.
-  uint32_t GetPresentedFrames() {
+  uint32_t GetPresentedFrames() const
+  {
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     return mPresentedFrames;
   }
 
-  // Number of frames that have been skipped because they have missed their
-  // compoisition deadline.
-  uint32_t GetDroppedFrames() {
+  // Returns the number of frames that have been skipped because they have
+  // missed their composition deadline.
+  uint32_t GetDroppedFrames() const
+  {
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     return mDroppedFrames;
   }
 
   // Increments the parsed and decoded frame counters by the passed in counts.
   // Can be called on any thread.
   void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded,
-                           uint32_t aDropped) {
-    if (aParsed == 0 && aDecoded == 0 && aDropped == 0)
+                           uint32_t aDropped)
+  {
+    if (aParsed == 0 && aDecoded == 0 && aDropped == 0) {
       return;
+    }
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     mParsedFrames += aParsed;
     mDecodedFrames += aDecoded;
     mDroppedFrames += aDropped;
   }
 
   // Increments the presented frame counters.
   // Can be called on any thread.
-  void NotifyPresentedFrame() {
+  void NotifyPresentedFrame()
+  {
     ReentrantMonitorAutoEnter mon(mReentrantMonitor);
     ++mPresentedFrames;
   }
 
 private:
   ~FrameStatistics() {}
 
   // ReentrantMonitor to protect access of playback statistics.
-  ReentrantMonitor mReentrantMonitor;
+  mutable ReentrantMonitor mReentrantMonitor;
 
   // Number of frames parsed and demuxed from media.
   // Access protected by mReentrantMonitor.
   uint32_t mParsedFrames;
 
   // Number of parsed frames which were actually decoded.
   // Access protected by mReentrantMonitor.
   uint32_t mDecodedFrames;
 
   // Number of decoded frames which were actually sent down the rendering
   // pipeline to be painted ("presented"). Access protected by mReentrantMonitor.
   uint32_t mPresentedFrames;
 
+  // Number of frames that have been skipped because they have missed their
+  // composition deadline.
   uint32_t mDroppedFrames;
 };
 
 } // namespace mozilla
 
-#endif
+#endif // FrameStatistics_h_