Bug 1035595 Use strictly same type variable at reading length of nsTArray derived classes in nsGUIEventIPC.h r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 09 Jul 2014 05:48:18 +0900
changeset 214898 c45fdb6a9e358f7192659edc02bb95a179824ae4
parent 214897 7f6cbfe1a68b95787ceedf1e98b951f8f9a157de
child 214899 c175c61ec0860deabfe686af5f0af11799599ee9
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1035595
milestone33.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 1035595 Use strictly same type variable at reading length of nsTArray derived classes in nsGUIEventIPC.h r=roc
widget/TouchEvents.h
widget/nsGUIEventIPC.h
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -150,16 +150,18 @@ public:
 
 /******************************************************************************
  * mozilla::WidgetTouchEvent
  ******************************************************************************/
 
 class WidgetTouchEvent : public WidgetInputEvent
 {
 public:
+  typedef nsTArray<nsRefPtr<mozilla::dom::Touch>> TouchArray;
+
   virtual WidgetTouchEvent* AsTouchEvent() MOZ_OVERRIDE { return this; }
 
   WidgetTouchEvent()
   {
   }
 
   WidgetTouchEvent(const WidgetTouchEvent& aOther) :
     WidgetInputEvent(aOther.mFlags.mIsTrusted, aOther.message, aOther.widget,
@@ -191,17 +193,17 @@ public:
                "Duplicate() must be overridden by sub class");
     // Not copying widget, it is a weak reference.
     WidgetTouchEvent* result = new WidgetTouchEvent(false, message, nullptr);
     result->AssignTouchEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
-  nsTArray<nsRefPtr<mozilla::dom::Touch>> touches;
+  TouchArray touches;
 
   void AssignTouchEventData(const WidgetTouchEvent& aEvent, bool aCopyTargets)
   {
     AssignInputEventData(aEvent, aCopyTargets);
 
     // Assign*EventData() assume that they're called only new instance.
     MOZ_ASSERT(touches.IsEmpty());
     touches.AppendElements(aEvent.touches);
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -243,31 +243,31 @@ struct ParamTraits<mozilla::WidgetTouchE
 {
   typedef mozilla::WidgetTouchEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<const mozilla::WidgetInputEvent&>(aParam));
     // Sigh, Touch bites us again!  We want to be able to do
     //   WriteParam(aMsg, aParam.touches);
-    const nsTArray< nsRefPtr<mozilla::dom::Touch> >& touches = aParam.touches;
+    const paramType::TouchArray& touches = aParam.touches;
     WriteParam(aMsg, touches.Length());
     for (uint32_t i = 0; i < touches.Length(); ++i) {
       mozilla::dom::Touch* touch = touches[i];
       WriteParam(aMsg, touch->mIdentifier);
       WriteParam(aMsg, touch->mRefPoint);
       WriteParam(aMsg, touch->mRadius);
       WriteParam(aMsg, touch->mRotationAngle);
       WriteParam(aMsg, touch->mForce);
     }
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    size_t numTouches;
+    paramType::TouchArray::size_type numTouches;
     if (!ReadParam(aMsg, aIter,
                    static_cast<mozilla::WidgetInputEvent*>(aResult)) ||
         !ReadParam(aMsg, aIter, &numTouches)) {
       return false;
     }
     for (uint32_t i = 0; i < numTouches; ++i) {
         int32_t identifier;
         mozilla::LayoutDeviceIntPoint refPoint;
@@ -396,17 +396,17 @@ struct ParamTraits<mozilla::TextRangeArr
     WriteParam(aMsg, aParam.Length());
     for (uint32_t index = 0; index < aParam.Length(); index++) {
       WriteParam(aMsg, aParam[index]);
     }
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
-    uint32_t length;
+    paramType::size_type length;
     if (!ReadParam(aMsg, aIter, &length)) {
       return false;
     }
     for (uint32_t index = 0; index < length; index++) {
       mozilla::TextRange textRange;
       if (!ReadParam(aMsg, aIter, &textRange)) {
         aResult->Clear();
         return false;