Bug 1175485 part 3 - Remove unused operators, typedefs and IteratorTraits. r=waldo
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 02 Jul 2015 13:31:07 +1000
changeset 251093 685a87f8677c2ba9208f5ef927545d3d9f72f5d5
parent 251092 addb5b05538307ed1d2c75497ed469e393e6791d
child 251094 61cae4c32db5a04398e0549a83299986df8e6b2b
push id28980
push usercbook@mozilla.com
push dateThu, 02 Jul 2015 13:44:32 +0000
treeherdermozilla-central@f1b3144fed94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1175485
milestone42.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 1175485 part 3 - Remove unused operators, typedefs and IteratorTraits. r=waldo
layout/generic/nsFrameList.h
mfbt/EnumeratedRange.h
mfbt/IntegerRange.h
mfbt/IteratorTraits.h
mfbt/ReverseIterator.h
mfbt/moz.build
--- a/layout/generic/nsFrameList.h
+++ b/layout/generic/nsFrameList.h
@@ -446,21 +446,16 @@ public:
 
   protected:
     nsIFrame* mPrev;
   };
 
   class Iterator
   {
   public:
-    typedef nsIFrame* ValueType;
-    // Though we don't support +/- a integer currently,
-    // iterators have to have a DifferenceType.
-    typedef ptrdiff_t DifferenceType;
-
     Iterator(const nsFrameList& aList, nsIFrame* aCurrent)
       : mList(aList)
       , mCurrent(aCurrent)
     {}
 
     Iterator(const Iterator& aOther)
       : mList(aOther.mList)
       , mCurrent(aOther.mCurrent)
--- a/mfbt/EnumeratedRange.h
+++ b/mfbt/EnumeratedRange.h
@@ -26,19 +26,16 @@
 namespace mozilla {
 
 namespace detail {
 
 template<typename IntTypeT, typename EnumTypeT>
 class EnumeratedIterator
 {
 public:
-  typedef EnumTypeT ValueType;
-  typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
-
   template<typename EnumType>
   explicit EnumeratedIterator(EnumType aCurrent)
     : mCurrent(aCurrent) { }
 
   template<typename IntType, typename EnumType>
   EnumeratedIterator(const EnumeratedIterator<IntType, EnumType>& aOther)
     : mCurrent(aOther.mCurrent) { }
 
@@ -64,35 +61,16 @@ public:
   }
   EnumeratedIterator operator--(int)
   {
     auto ret = *this;
     mCurrent = EnumTypeT(IntTypeT(mCurrent) - IntTypeT(1));
     return ret;
   }
 
-  EnumeratedIterator operator+(DifferenceType aN) const
-  {
-    return EnumeratedIterator(EnumTypeT(IntTypeT(mCurrent) + aN));
-  }
-  EnumeratedIterator operator-(DifferenceType aN) const
-  {
-    return EnumeratedIterator(EnumTypeT(IntTypeT(mCurrent) - aN));
-  }
-  EnumeratedIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent = EnumTypeT(IntTypeT(mCurrent) + aN);
-    return *this;
-  }
-  EnumeratedIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent = EnumTypeT(IntTypeT(mCurrent) - aN);
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename IntType, typename EnumType>
   friend bool operator==(const EnumeratedIterator<IntType, EnumType>& aIter1,
                          const EnumeratedIterator<IntType, EnumType>& aIter2);
   template<typename IntType, typename EnumType>
   friend bool operator!=(const EnumeratedIterator<IntType, EnumType>& aIter1,
                          const EnumeratedIterator<IntType, EnumType>& aIter2);
--- a/mfbt/IntegerRange.h
+++ b/mfbt/IntegerRange.h
@@ -16,19 +16,16 @@
 namespace mozilla {
 
 namespace detail {
 
 template<typename IntTypeT>
 class IntegerIterator
 {
 public:
-  typedef IntTypeT ValueType;
-  typedef typename MakeSigned<IntTypeT>::Type DifferenceType;
-
   template<typename IntType>
   explicit IntegerIterator(IntType aCurrent)
     : mCurrent(aCurrent) { }
 
   template<typename IntType>
   IntegerIterator(const IntegerIterator<IntType>& aOther)
     : mCurrent(aOther.mCurrent) { }
 
@@ -36,35 +33,16 @@ public:
 
   /* Increment and decrement operators */
 
   IntegerIterator& operator++() { ++mCurrent; return *this; }
   IntegerIterator& operator--() { --mCurrent; return *this; }
   IntegerIterator operator++(int) { auto ret = *this; ++mCurrent; return ret; }
   IntegerIterator operator--(int) { auto ret = *this; --mCurrent; return ret; }
 
-  IntegerIterator operator+(DifferenceType aN) const
-  {
-    return IntegerIterator(mCurrent + aN);
-  }
-  IntegerIterator operator-(DifferenceType aN) const
-  {
-    return IntegerIterator(mCurrent - aN);
-  }
-  IntegerIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent += aN;
-    return *this;
-  }
-  IntegerIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent -= aN;
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename IntType1, typename IntType2>
   friend bool operator==(const IntegerIterator<IntType1>& aIter1,
                          const IntegerIterator<IntType2>& aIter2);
   template<typename IntType1, typename IntType2>
   friend bool operator!=(const IntegerIterator<IntType1>& aIter1,
                          const IntegerIterator<IntType2>& aIter2);
deleted file mode 100644
--- a/mfbt/IteratorTraits.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* Iterator traits to expose a value type and a difference type */
-
-#ifndef mozilla_IteratorTraits_h
-#define mozilla_IteratorTraits_h
-
-#include <stddef.h>
-
-namespace mozilla {
-
-template<typename Iterator>
-struct IteratorTraits
-{
-  typedef typename Iterator::ValueType ValueType;
-  typedef typename Iterator::DifferenceType DifferenceType;
-};
-
-template<typename T>
-struct IteratorTraits<T*>
-{
-  typedef T ValueType;
-  typedef ptrdiff_t DifferenceType;
-};
-
-template<typename T>
-struct IteratorTraits<const T*>
-{
-  typedef const T ValueType;
-  typedef ptrdiff_t DifferenceType;
-};
-
-} // namespace mozilla
-
-#endif // mozilla_IteratorTraits_h
--- a/mfbt/ReverseIterator.h
+++ b/mfbt/ReverseIterator.h
@@ -7,28 +7,24 @@
 /* An iterator that acts like another iterator, but iterating in
  * the negative direction. (Note that not all iterators can iterate
  * in the negative direction.) */
 
 #ifndef mozilla_ReverseIterator_h
 #define mozilla_ReverseIterator_h
 
 #include "mozilla/Attributes.h"
-#include "mozilla/IteratorTraits.h"
 #include "mozilla/TypeTraits.h"
 
 namespace mozilla {
 
 template<typename IteratorT>
 class ReverseIterator
 {
 public:
-  typedef typename IteratorTraits<IteratorT>::ValueType ValueType;
-  typedef typename IteratorTraits<IteratorT>::DifferenceType DifferenceType;
-
   template<typename Iterator>
   explicit ReverseIterator(Iterator aIter)
     : mCurrent(aIter) { }
 
   template<typename Iterator>
   MOZ_IMPLICIT ReverseIterator(const ReverseIterator<Iterator>& aOther)
     : mCurrent(aOther.mCurrent) { }
 
@@ -40,35 +36,16 @@ public:
 
   /* Increments and decrements operators */
 
   ReverseIterator& operator++() { --mCurrent; return *this; }
   ReverseIterator& operator--() { ++mCurrent; return *this; }
   ReverseIterator operator++(int) { auto ret = *this; mCurrent--; return ret; }
   ReverseIterator operator--(int) { auto ret = *this; mCurrent++; return ret; }
 
-  ReverseIterator operator+(DifferenceType aN) const
-  {
-    return ReverseIterator(mCurrent - aN);
-  }
-  ReverseIterator operator-(DifferenceType aN) const
-  {
-    return ReverseIterator(mCurrent + aN);
-  }
-  ReverseIterator& operator+=(DifferenceType aN)
-  {
-    mCurrent -= aN;
-    return *this;
-  }
-  ReverseIterator& operator-=(DifferenceType aN)
-  {
-    mCurrent += aN;
-    return *this;
-  }
-
   /* Comparison operators */
 
   template<typename Iterator1, typename Iterator2>
   friend bool operator==(const ReverseIterator<Iterator1>& aIter1,
                          const ReverseIterator<Iterator2>& aIter2);
   template<typename Iterator1, typename Iterator2>
   friend bool operator!=(const ReverseIterator<Iterator1>& aIter1,
                          const ReverseIterator<Iterator2>& aIter2);
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -41,17 +41,16 @@ EXPORTS.mozilla = [
     'EnumSet.h',
     'FloatingPoint.h',
     'GuardObjects.h',
     'HashFunctions.h',
     'IndexSequence.h',
     'IntegerPrintfMacros.h',
     'IntegerRange.h',
     'IntegerTypeTraits.h',
-    'IteratorTraits.h',
     'JSONWriter.h',
     'Likely.h',
     'LinkedList.h',
     'MacroArgs.h',
     'MacroForEach.h',
     'MathAlgorithms.h',
     'Maybe.h',
     'MaybeOneOf.h',