Bug 1286170 - Handle move-assignment of SourceBufferIterators correctly. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Tue, 12 Jul 2016 00:45:01 -0700
changeset 347275 8033580f6a1d20abe8635ad724866475631263e6
parent 347274 a5c17d3e26c6316d407221e38cd529101cd449b5
child 347276 ab4ae8b37941493a3ec12506d28fc82ec3bf5c34
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1286170
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 1286170 - Handle move-assignment of SourceBufferIterators correctly. r=edwin
image/SourceBuffer.cpp
image/SourceBuffer.h
--- a/image/SourceBuffer.cpp
+++ b/image/SourceBuffer.cpp
@@ -25,16 +25,32 @@ namespace image {
 
 SourceBufferIterator::~SourceBufferIterator()
 {
   if (mOwner) {
     mOwner->OnIteratorRelease();
   }
 }
 
+SourceBufferIterator&
+SourceBufferIterator::operator=(SourceBufferIterator&& aOther)
+{
+  if (mOwner) {
+    mOwner->OnIteratorRelease();
+  }
+
+  mOwner = Move(aOther.mOwner);
+  mState = aOther.mState;
+  mData = aOther.mData;
+  mChunkCount = aOther.mChunkCount;
+  mByteCount = aOther.mByteCount;
+
+  return *this;
+}
+
 SourceBufferIterator::State
 SourceBufferIterator::AdvanceOrScheduleResume(IResumable* aConsumer)
 {
   MOZ_ASSERT(mOwner);
   return mOwner->AdvanceIteratorOrScheduleResume(*this, aConsumer);
 }
 
 bool
--- a/image/SourceBuffer.h
+++ b/image/SourceBuffer.h
@@ -95,25 +95,17 @@ public:
     , mState(aOther.mState)
     , mData(aOther.mData)
     , mChunkCount(aOther.mChunkCount)
     , mByteCount(aOther.mByteCount)
   { }
 
   ~SourceBufferIterator();
 
-  SourceBufferIterator& operator=(SourceBufferIterator&& aOther)
-  {
-    mOwner = Move(aOther.mOwner);
-    mState = aOther.mState;
-    mData = aOther.mData;
-    mChunkCount = aOther.mChunkCount;
-    mByteCount = aOther.mByteCount;
-    return *this;
-  }
+  SourceBufferIterator& operator=(SourceBufferIterator&& aOther);
 
   /**
    * Returns true if there are no more than @aBytes remaining in the
    * SourceBuffer. If the SourceBuffer is not yet complete, returns false.
    */
   bool RemainingBytesIsNoMoreThan(size_t aBytes) const;
 
   /**