Bug 1433008 - Make WidgetEvent movable. r=masayuki
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 30 Jan 2018 09:26:48 +0900
changeset 456342 59ae8c3043e832687eee02de7ce66c50cdb5aea3
parent 456341 ced1881a5daa06c9a001619c4e818b86320d4caa
child 456343 374419fd9b2ee1bfa737a7d290aa4f5e7a2ac655
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1433008
milestone60.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 1433008 - Make WidgetEvent movable. r=masayuki The copy-assignment in this patch is used in the copy-constructor. Note that we can't simply use '= default' implementation since we need to use MOZ_COUNT_CTOR() in the move constructor. MozReview-Commit-ID: 8HTMaTONBuN
widget/BasicEvents.h
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -545,16 +545,37 @@ public:
   }
 
   WidgetEvent(const WidgetEvent& aOther)
     : WidgetEventTime()
   {
     MOZ_COUNT_CTOR(WidgetEvent);
     *this = aOther;
   }
+  WidgetEvent& operator=(const WidgetEvent& aOther) = default;
+
+  WidgetEvent(WidgetEvent&& aOther)
+    : WidgetEventTime(Move(aOther))
+    , mClass(aOther.mClass)
+    , mMessage(aOther.mMessage)
+    , mRefPoint(Move(aOther.mRefPoint))
+    , mLastRefPoint(Move(aOther.mLastRefPoint))
+    , mFocusSequenceNumber(aOther.mFocusSequenceNumber)
+    , mFlags(Move(aOther.mFlags))
+    , mSpecifiedEventType(Move(aOther.mSpecifiedEventType))
+    , mSpecifiedEventTypeString(Move(aOther.mSpecifiedEventTypeString))
+    , mTarget(Move(aOther.mTarget))
+    , mCurrentTarget(Move(aOther.mCurrentTarget))
+    , mOriginalTarget(Move(aOther.mOriginalTarget))
+    , mRelatedTarget(Move(aOther.mRelatedTarget))
+    , mPath(Move(aOther.mPath))
+  {
+    MOZ_COUNT_CTOR(WidgetEvent);
+  }
+  WidgetEvent& operator=(WidgetEvent&& aOther) = default;
 
   virtual WidgetEvent* Duplicate() const
   {
     MOZ_ASSERT(mClass == eBasicEventClass,
                "Duplicate() must be overridden by sub class");
     WidgetEvent* result = new WidgetEvent(false, mMessage);
     result->AssignEventData(*this, true);
     result->mFlags = mFlags;