Bug 1406441 - provide nsSMILCompositor with a move constructor, rather than a copy constructor; r=dholbert
authorNathan Froyd <froydnj@mozilla.com>
Mon, 09 Oct 2017 10:39:38 -0400
changeset 676889 250d1b8ce9c3afdab127e1527de7f48810950623
parent 676888 7fd54747a3b754fd1dfad0be8fd561d78fa23b67
child 676890 1779da025280d3521be05f5c4275095f6224d2f6
push id83658
push userbmo:tchiovoloni@mozilla.com
push dateMon, 09 Oct 2017 20:19:32 +0000
reviewersdholbert
bugs1406441
milestone58.0a1
Bug 1406441 - provide nsSMILCompositor with a move constructor, rather than a copy constructor; r=dholbert Using a copy constructor here means that reallocating hashtables containing nsSMILCompositor does a bunch of unnecessary work; we can use a move constructor to avoid a lot of that unnecessary work.
dom/smil/nsSMILCompositor.h
--- a/dom/smil/nsSMILCompositor.h
+++ b/dom/smil/nsSMILCompositor.h
@@ -29,19 +29,19 @@ public:
   typedef nsSMILTargetIdentifier KeyType;
   typedef const KeyType& KeyTypeRef;
   typedef const KeyType* KeyTypePointer;
 
   explicit nsSMILCompositor(KeyTypePointer aKey)
    : mKey(*aKey),
      mForceCompositing(false)
   { }
-  nsSMILCompositor(const nsSMILCompositor& toCopy)
-    : mKey(toCopy.mKey),
-      mAnimationFunctions(toCopy.mAnimationFunctions),
+  nsSMILCompositor(nsSMILCompositor&& toMove)
+    : mKey(mozilla::Move(toMove.mKey)),
+      mAnimationFunctions(mozilla::Move(toMove.mAnimationFunctions)),
       mForceCompositing(false)
   { }
   ~nsSMILCompositor() { }
 
   // PLDHashEntryHdr methods
   KeyTypeRef GetKey() const { return mKey; }
   bool KeyEquals(KeyTypePointer aKey) const;
   static KeyTypePointer KeyToPointer(KeyTypeRef aKey) { return &aKey; }