Bug 1407700 Part1: Revise CoalescedInputData interfaces. r=smaug.
authorStone Shih <sshih@mozilla.com>
Thu, 12 Oct 2017 11:22:36 +0800
changeset 437892 78041b59b1a19f5ba9653bcc7b750059ce858fb3
parent 437891 14cfc090780e0da71712fbbc0267dd94166d75b8
child 437893 9b9629c68575006ca1bded6c279040ecb05802e8
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1407700
milestone58.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 1407700 Part1: Revise CoalescedInputData interfaces. r=smaug. MozReview-Commit-ID: 75AsFBM4qr
dom/ipc/CoalescedInputData.h
dom/ipc/TabChild.cpp
--- a/dom/ipc/CoalescedInputData.h
+++ b/dom/ipc/CoalescedInputData.h
@@ -24,33 +24,28 @@ protected:
   uint64_t mInputBlockId;
 
 public:
   CoalescedInputData()
     : mInputBlockId(0)
   {
   }
 
-  void Reset()
-  {
-    mCoalescedInputEvent = nullptr;
-  }
-
   bool IsEmpty()
   {
     return !mCoalescedInputEvent;
   }
 
   bool CanCoalesce(const InputEventType& aEvent,
                    const ScrollableLayerGuid& aGuid,
                    const uint64_t& aInputBlockId);
 
-  const InputEventType* GetCoalescedEvent()
+  UniquePtr<InputEventType> TakeCoalescedEvent()
   {
-    return mCoalescedInputEvent.get();
+    return Move(mCoalescedInputEvent);
   }
 
   ScrollableLayerGuid GetScrollableLayerGuid()
   {
     return mGuid;
   }
 
   uint64_t GetInputBlockId()
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1596,24 +1596,23 @@ TabChild::MaybeDispatchCoalescedMouseMov
   if (!mCoalesceMouseMoveEvents) {
     return;
   }
   for (auto iter = mCoalescedMouseData.Iter(); !iter.Done(); iter.Next()) {
     CoalescedMouseData* data = iter.UserData();
     if (!data || data->IsEmpty()) {
       continue;
     }
-    const WidgetMouseEvent* event = data->GetCoalescedEvent();
+    UniquePtr<WidgetMouseEvent> event = data->TakeCoalescedEvent();
     MOZ_ASSERT(event);
     // Dispatch the coalesced mousemove event. Using RecvRealMouseButtonEvent to
     // bypass the coalesce handling in RecvRealMouseMoveEvent.
     RecvRealMouseButtonEvent(*event,
                              data->GetScrollableLayerGuid(),
                              data->GetInputBlockId());
-    data->Reset();
   }
   if (mCoalescedMouseEventFlusher) {
     mCoalescedMouseEventFlusher->RemoveObserver();
   }
 }
 
 mozilla::ipc::IPCResult
 TabChild::RecvRealMouseMoveEvent(const WidgetMouseEvent& aEvent,
@@ -1774,23 +1773,22 @@ TabChild::DispatchWidgetEventViaAPZ(Widg
 }
 
 void
 TabChild::MaybeDispatchCoalescedWheelEvent()
 {
   if (mCoalescedWheelData.IsEmpty()) {
     return;
   }
-  const WidgetWheelEvent* wheelEvent =
-    mCoalescedWheelData.GetCoalescedEvent();
+  UniquePtr<WidgetWheelEvent> wheelEvent =
+    mCoalescedWheelData.TakeCoalescedEvent();
   MOZ_ASSERT(wheelEvent);
   DispatchWheelEvent(*wheelEvent,
                      mCoalescedWheelData.GetScrollableLayerGuid(),
                      mCoalescedWheelData.GetInputBlockId());
-  mCoalescedWheelData.Reset();
 }
 
 void
 TabChild::DispatchWheelEvent(const WidgetWheelEvent& aEvent,
                                   const ScrollableLayerGuid& aGuid,
                                   const uint64_t& aInputBlockId)
 {
   WidgetWheelEvent localEvent(aEvent);