Bug 1368952: P1. Fix coding style. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 31 May 2017 10:45:51 +0200
changeset 409603 fd2758cb931e285cbd13b262581aedd089a59ab5
parent 409602 928bbb8a26663119a9b4253efc6b760a53ccf936
child 409604 7b2c68611d9d45dec647255f647816ef86fa769e
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1368952
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 1368952: P1. Fix coding style. r=gerald MozReview-Commit-ID: HfkAegyhKW7
dom/media/mediasource/SourceBufferResource.cpp
dom/media/mediasource/SourceBufferResource.h
--- a/dom/media/mediasource/SourceBufferResource.cpp
+++ b/dom/media/mediasource/SourceBufferResource.cpp
@@ -32,26 +32,33 @@ SourceBufferResource::Close()
   SBR_DEBUG("Close");
   //MOZ_ASSERT(!mClosed);
   mClosed = true;
   mon.NotifyAll();
   return NS_OK;
 }
 
 nsresult
-SourceBufferResource::ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes)
+SourceBufferResource::ReadAt(int64_t aOffset,
+                             char* aBuffer,
+                             uint32_t aCount,
+                             uint32_t* aBytes)
 {
   SBR_DEBUG("ReadAt(aOffset=%" PRId64 ", aBuffer=%p, aCount=%u, aBytes=%p)",
             aOffset, aBytes, aCount, aBytes);
   ReentrantMonitorAutoEnter mon(mMonitor);
-  return ReadAtInternal(aOffset, aBuffer, aCount, aBytes, /* aMayBlock = */ true);
+  return ReadAtInternal(
+    aOffset, aBuffer, aCount, aBytes, /* aMayBlock = */ true);
 }
 
 nsresult
-SourceBufferResource::ReadAtInternal(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes,
+SourceBufferResource::ReadAtInternal(int64_t aOffset,
+                                     char* aBuffer,
+                                     uint32_t aCount,
+                                     uint32_t* aBytes,
                                      bool aMayBlock)
 {
   mMonitor.AssertCurrentThreadIn();
 
   MOZ_ASSERT_IF(!aMayBlock, aBytes);
 
   if (mClosed ||
       aOffset < 0 ||
@@ -74,46 +81,55 @@ SourceBufferResource::ReadAtInternal(int
 
   uint32_t available = GetLength() - aOffset;
   uint32_t count = std::min(aCount, available);
 
   // Keep the position of the last read to have Tell() approximately give us
   // the position we're up to in the stream.
   mOffset = aOffset + count;
 
-  SBR_DEBUGV("offset=%" PRId64 " GetLength()=%" PRId64 " available=%u count=%u mEnded=%d",
-             aOffset, GetLength(), available, count, mEnded);
+  SBR_DEBUGV("offset=%" PRId64 " GetLength()=%" PRId64
+             " available=%u count=%u mEnded=%d",
+             aOffset,
+             GetLength(),
+             available,
+             count,
+             mEnded);
   if (available == 0) {
     SBR_DEBUGV("reached EOF");
     *aBytes = 0;
     return NS_OK;
   }
 
   mInputBuffer.CopyData(aOffset, count, aBuffer);
   *aBytes = count;
 
   return NS_OK;
 }
 
 nsresult
-SourceBufferResource::ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount)
+SourceBufferResource::ReadFromCache(char* aBuffer,
+                                    int64_t aOffset,
+                                    uint32_t aCount)
 {
   SBR_DEBUG("ReadFromCache(aBuffer=%p, aOffset=%" PRId64 ", aCount=%u)",
             aBuffer, aOffset, aCount);
   ReentrantMonitorAutoEnter mon(mMonitor);
   uint32_t bytesRead;
-  nsresult rv = ReadAtInternal(aOffset, aBuffer, aCount, &bytesRead, /* aMayBlock = */ false);
+  nsresult rv = ReadAtInternal(
+    aOffset, aBuffer, aCount, &bytesRead, /* aMayBlock = */ false);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // ReadFromCache return failure if not all the data is cached.
   return bytesRead == aCount ? NS_OK : NS_ERROR_FAILURE;
 }
 
 uint32_t
-SourceBufferResource::EvictData(uint64_t aPlaybackOffset, int64_t aThreshold,
+SourceBufferResource::EvictData(uint64_t aPlaybackOffset,
+                                int64_t aThreshold,
                                 ErrorResult& aRv)
 {
   SBR_DEBUG("EvictData(aPlaybackOffset=%" PRIu64 ","
             "aThreshold=%" PRId64 ")", aPlaybackOffset, aThreshold);
   ReentrantMonitorAutoEnter mon(mMonitor);
   uint32_t result = mInputBuffer.Evict(aPlaybackOffset, aThreshold, aRv);
   if (result > 0) {
     // Wake up any waiting threads in case a ReadInternal call
--- a/dom/media/mediasource/SourceBufferResource.h
+++ b/dom/media/mediasource/SourceBufferResource.h
@@ -36,43 +36,85 @@ class SourceBuffer;
 
 class SourceBufferResource final : public MediaResource
 {
 public:
   explicit SourceBufferResource(const MediaContainerType& aType);
   nsresult Close() override;
   void Suspend(bool aCloseImmediately) override { UNIMPLEMENTED(); }
   void Resume() override { UNIMPLEMENTED(); }
-  already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override { UNIMPLEMENTED(); return nullptr; }
-  already_AddRefed<MediaResource> CloneData(MediaResourceCallback*) override { UNIMPLEMENTED(); return nullptr; }
-  void SetReadMode(MediaCacheStream::ReadMode aMode) override { UNIMPLEMENTED(); }
+  already_AddRefed<nsIPrincipal> GetCurrentPrincipal() override
+  {
+    UNIMPLEMENTED();
+    return nullptr;
+  }
+  already_AddRefed<MediaResource> CloneData(MediaResourceCallback*) override
+  {
+    UNIMPLEMENTED();
+    return nullptr;
+  }
+  void SetReadMode(MediaCacheStream::ReadMode aMode) override
+  {
+    UNIMPLEMENTED();
+  }
   void SetPlaybackRate(uint32_t aBytesPerSecond) override { UNIMPLEMENTED(); }
-  nsresult ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes) override;
+  nsresult ReadAt(int64_t aOffset,
+                  char* aBuffer,
+                  uint32_t aCount,
+                  uint32_t* aBytes) override;
   int64_t Tell() override { return mOffset; }
   void Pin() override { UNIMPLEMENTED(); }
   void Unpin() override { UNIMPLEMENTED(); }
-  double GetDownloadRate(bool* aIsReliable) override { UNIMPLEMENTED(); *aIsReliable = false; return 0; }
+  double GetDownloadRate(bool* aIsReliable) override
+  {
+    UNIMPLEMENTED();
+    *aIsReliable = false;
+    return 0;
+  }
   int64_t GetLength() override { return mInputBuffer.GetLength(); }
-  int64_t GetNextCachedData(int64_t aOffset) override {
+  int64_t GetNextCachedData(int64_t aOffset) override
+  {
     ReentrantMonitorAutoEnter mon(mMonitor);
     MOZ_ASSERT(aOffset >= 0);
     if (uint64_t(aOffset) < mInputBuffer.GetOffset()) {
       return mInputBuffer.GetOffset();
     } else if (aOffset == GetLength()) {
       return -1;
     }
     return aOffset;
   }
-  int64_t GetCachedDataEnd(int64_t aOffset) override { UNIMPLEMENTED(); return -1; }
+  int64_t GetCachedDataEnd(int64_t aOffset) override
+  {
+    UNIMPLEMENTED();
+    return -1;
+  }
   bool IsDataCachedToEndOfResource(int64_t aOffset) override { return false; }
-  bool IsSuspendedByCache() override { UNIMPLEMENTED(); return false; }
-  bool IsSuspended() override { UNIMPLEMENTED(); return false; }
-  nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) override;
-  bool IsTransportSeekable() override { UNIMPLEMENTED(); return true; }
-  nsresult Open(nsIStreamListener** aStreamListener) override { UNIMPLEMENTED(); return NS_ERROR_FAILURE; }
+  bool IsSuspendedByCache() override
+  {
+    UNIMPLEMENTED();
+    return false;
+  }
+  bool IsSuspended() override
+  {
+    UNIMPLEMENTED();
+    return false;
+  }
+  nsresult ReadFromCache(char* aBuffer,
+                         int64_t aOffset,
+                         uint32_t aCount) override;
+  bool IsTransportSeekable() override
+  {
+    UNIMPLEMENTED();
+    return true;
+  }
+  nsresult Open(nsIStreamListener** aStreamListener) override
+  {
+    UNIMPLEMENTED();
+    return NS_ERROR_FAILURE;
+  }
 
   nsresult GetCachedRanges(MediaByteRangeSet& aRanges) override
   {
     ReentrantMonitorAutoEnter mon(mMonitor);
     if (mInputBuffer.GetLength()) {
       aRanges += MediaByteRange(mInputBuffer.GetOffset(),
                                 mInputBuffer.GetLength());
     }
@@ -117,30 +159,36 @@ public:
 
   // Remove data from resource before the given offset.
   void EvictBefore(uint64_t aOffset, ErrorResult& aRv);
 
   // Remove all data from the resource
   uint32_t EvictAll();
 
   // Returns the amount of data currently retained by this resource.
-  int64_t GetSize() {
+  int64_t GetSize()
+  {
     ReentrantMonitorAutoEnter mon(mMonitor);
     return mInputBuffer.GetLength() - mInputBuffer.GetOffset();
   }
 
 #if defined(DEBUG)
-  void Dump(const char* aPath) {
+  void Dump(const char* aPath)
+  {
     mInputBuffer.Dump(aPath);
   }
 #endif
 
 private:
   virtual ~SourceBufferResource();
-  nsresult ReadAtInternal(int64_t aOffset, char* aBuffer, uint32_t aCount, uint32_t* aBytes, bool aMayBlock);
+  nsresult ReadAtInternal(int64_t aOffset,
+                          char* aBuffer,
+                          uint32_t aCount,
+                          uint32_t* aBytes,
+                          bool aMayBlock);
 
   const MediaContainerType mType;
 
   // Provides synchronization between SourceBuffers and InputAdapters.
   // Protects all of the member variables below.  Read() will await a
   // Notify() (from Seek, AppendData, Ended, or Close) when insufficient
   // data is available in mData.
   mutable ReentrantMonitor mMonitor;