Bug 1111290 - Part 2: Non-mechanical changes. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Mon, 26 Jan 2015 07:22:08 +0900
changeset 225629 2fab2faa7f9d5778fcb5aa3a733a96f4350de90c
parent 225628 e7d1736f58e1772dced6c6b16f6e5105b1ab9625
child 225630 7f7f003696ad7bccde5ebcaf4cc122cc60e887f4
push id10990
push usercbook@mozilla.com
push dateMon, 26 Jan 2015 14:06:38 +0000
treeherderfx-team@54be9bcdacd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1111290
milestone38.0a1
Bug 1111290 - Part 2: Non-mechanical changes. r=waldo
dom/canvas/CanvasGradient.h
dom/canvas/CanvasPattern.h
dom/canvas/CanvasRenderingContext2D.h
dom/canvas/WebGLTexelConversions.cpp
dom/canvas/WebGLTexelConversions.h
dom/media/MediaDecoderStateMachine.h
gfx/ipc/GfxMessageUtils.h
gfx/layers/client/TextureClient.h
gfx/thebes/gfxPrefs.h
ipc/glue/IPCMessageUtils.h
js/public/ProfilingStack.h
layout/base/nsLayoutUtils.h
mfbt/EnumeratedArray.h
xpcom/base/CycleCollectedJSRuntime.h
xpcom/glue/EnumeratedArrayCycleCollection.h
--- a/dom/canvas/CanvasGradient.h
+++ b/dom/canvas/CanvasGradient.h
@@ -18,20 +18,20 @@ namespace mozilla {
 namespace dom {
 
 class CanvasGradient : public nsWrapperCache
 {
 public:
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasGradient)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasGradient)
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(Type, uint8_t)
+  enum class Type : uint8_t {
     LINEAR = 0,
     RADIAL
-  MOZ_END_NESTED_ENUM_CLASS(Type)
+  };
 
   Type GetType()
   {
     return mType;
   }
 
   mozilla::gfx::GradientStops *
   GetGradientStopsForTarget(mozilla::gfx::DrawTarget *aRT)
@@ -70,14 +70,12 @@ protected:
 
   nsRefPtr<CanvasRenderingContext2D> mContext;
   nsTArray<mozilla::gfx::GradientStop> mRawStops;
   mozilla::RefPtr<mozilla::gfx::GradientStops> mStops;
   Type mType;
   virtual ~CanvasGradient() {}
 };
 
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasGradient::Type)
-
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_CanvasGradient_h
--- a/dom/canvas/CanvasPattern.h
+++ b/dom/canvas/CanvasPattern.h
@@ -24,22 +24,22 @@ class SVGMatrix;
 
 class CanvasPattern MOZ_FINAL : public nsWrapperCache
 {
   ~CanvasPattern() {}
 public:
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t)
+  enum class RepeatMode : uint8_t {
     REPEAT,
     REPEATX,
     REPEATY,
     NOREPEAT
-  MOZ_END_NESTED_ENUM_CLASS(RepeatMode)
+  };
 
   CanvasPattern(CanvasRenderingContext2D* aContext,
                 gfx::SourceSurface* aSurface,
                 RepeatMode aRepeat,
                 nsIPrincipal* principalForSecurityCheck,
                 bool forceWriteOnly,
                 bool CORSUsed)
     : mContext(aContext)
@@ -69,14 +69,12 @@ public:
   RefPtr<gfx::SourceSurface> mSurface;
   nsCOMPtr<nsIPrincipal> mPrincipal;
   mozilla::gfx::Matrix mTransform;
   const bool mForceWriteOnly;
   const bool mCORSUsed;
   const RepeatMode mRepeat;
 };
 
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode)
-
 }
 }
 
 #endif // mozilla_dom_CanvasPattern_h
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -538,27 +538,27 @@ public:
   // this rect is in mTarget's current user space
   void RedrawUser(const gfxRect &r);
 
   // nsISupports interface + CC
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(CanvasRenderingContext2D)
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(CanvasMultiGetterType, uint8_t)
+  enum class CanvasMultiGetterType : uint8_t {
     STRING = 0,
     PATTERN = 1,
     GRADIENT = 2
-  MOZ_END_NESTED_ENUM_CLASS(CanvasMultiGetterType)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(Style, uint8_t)
+  enum class Style : uint8_t {
     STROKE = 0,
     FILL,
     MAX
-  MOZ_END_NESTED_ENUM_CLASS(Style)
+  };
 
   nsINode* GetParentObject()
   {
     return mCanvasElement;
   }
 
   void LineTo(const mozilla::gfx::Point& aPoint)
   {
@@ -886,41 +886,39 @@ protected:
       return mozilla::gfx::CompositionOp::OP_OVER;
     }
 
     return CurrentState().op;
   }
 
   // text
 
-public: // These enums are public only to accomodate non-C++11 legacy path of
-        // MOZ_FINISH_NESTED_ENUM_CLASS. Can move back to protected as soon
-        // as that legacy path is dropped.
-  MOZ_BEGIN_NESTED_ENUM_CLASS(TextAlign, uint8_t)
+protected:
+  enum class TextAlign : uint8_t {
     START,
     END,
     LEFT,
     RIGHT,
     CENTER
-  MOZ_END_NESTED_ENUM_CLASS(TextAlign)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(TextBaseline, uint8_t)
+  enum class TextBaseline : uint8_t {
     TOP,
     HANGING,
     MIDDLE,
     ALPHABETIC,
     IDEOGRAPHIC,
     BOTTOM
-  MOZ_END_NESTED_ENUM_CLASS(TextBaseline)
+  };
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(TextDrawOperation, uint8_t)
+  enum class TextDrawOperation : uint8_t {
     FILL,
     STROKE,
     MEASURE
-  MOZ_END_NESTED_ENUM_CLASS(TextDrawOperation)
+  };
 
 protected:
   gfxFontGroup *GetCurrentFontStyle();
 
   /*
     * Implementation of the fillText, strokeText, and measure functions with
     * the operation abstracted to a flag.
     */
@@ -1099,18 +1097,12 @@ protected:
     if (perCSSPixel)
       *perCSSPixel = cssPixel;
   }
 
   friend struct CanvasBidiProcessor;
   friend class CanvasDrawObserver;
 };
 
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::CanvasMultiGetterType)
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::Style)
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextAlign)
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextBaseline)
-MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextDrawOperation)
-
 }
 }
 
 #endif /* CanvasRenderingContext2D_h */
--- a/dom/canvas/WebGLTexelConversions.cpp
+++ b/dom/canvas/WebGLTexelConversions.cpp
@@ -32,17 +32,17 @@ class WebGLImageConverter
     bool mAlreadyRun;
     bool mSuccess;
 
     /*
      * Returns sizeof(texel)/sizeof(type). The point is that we will iterate over
      * texels with typed pointers and this value will tell us by how much we need
      * to increment these pointers to advance to the next texel.
      */
-    template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+    template<WebGLTexelFormat Format>
     static size_t NumElementsPerTexelForFormat() {
         switch (Format) {
             case WebGLTexelFormat::R8:
             case WebGLTexelFormat::A8:
             case WebGLTexelFormat::R16F:
             case WebGLTexelFormat::A16F:
             case WebGLTexelFormat::R32F:
             case WebGLTexelFormat::A32F:
@@ -73,19 +73,19 @@ class WebGLImageConverter
     /*
      * This is the completely format-specific templatized conversion function,
      * that will be instantiated hundreds of times for all different combinations.
      * It is important to avoid generating useless code here. In particular, many
      * instantiations of this function template will never be called, so we try
      * to return immediately in these cases to allow the compiler to avoid generating
      * useless code.
      */
-    template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat,
-             MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) DstFormat,
-             MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelPremultiplicationOp) PremultiplicationOp>
+    template<WebGLTexelFormat SrcFormat,
+             WebGLTexelFormat DstFormat,
+             WebGLTexelPremultiplicationOp PremultiplicationOp>
     void run()
     {
         // check for never-called cases. We early-return to allow the compiler
         // to avoid generating this code. It would be tempting to abort() instead,
         // as returning early does leave the destination surface with uninitialized
         // data, but that would not allow the compiler to avoid generating this code.
         // So instead, we return early, so Success() will return false, and the caller
         // must check that and abort in that case. See WebGLContext::ConvertImage.
@@ -146,19 +146,19 @@ class WebGLImageConverter
 
         typedef
             typename DataTypeForFormat<SrcFormat>::Type
             SrcType;
         typedef
             typename DataTypeForFormat<DstFormat>::Type
             DstType;
 
-        const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) IntermediateSrcFormat
+        const WebGLTexelFormat IntermediateSrcFormat
             = IntermediateFormat<SrcFormat>::Value;
-        const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) IntermediateDstFormat
+        const WebGLTexelFormat IntermediateDstFormat
             = IntermediateFormat<DstFormat>::Value;
         typedef
             typename DataTypeForFormat<IntermediateSrcFormat>::Type
             IntermediateSrcType;
         typedef
             typename DataTypeForFormat<IntermediateDstFormat>::Type
             IntermediateDstType;
 
@@ -213,18 +213,18 @@ class WebGLImageConverter
             srcRowStart += srcStrideInElements;
             dstRowStart += dstStrideInElements;
         }
 
         mSuccess = true;
         return;
     }
 
-    template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat,
-             MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) DstFormat>
+    template<WebGLTexelFormat SrcFormat,
+             WebGLTexelFormat DstFormat>
     void run(WebGLTexelPremultiplicationOp premultiplicationOp)
     {
         #define WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(PremultiplicationOp) \
             case PremultiplicationOp: \
                 return run<SrcFormat, DstFormat, PremultiplicationOp>();
 
         switch (premultiplicationOp) {
             WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(WebGLTexelPremultiplicationOp::None)
@@ -232,17 +232,17 @@ class WebGLImageConverter
             WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(WebGLTexelPremultiplicationOp::Unpremultiply)
             default:
                 MOZ_ASSERT(false, "unhandled case. Coding mistake?");
         }
 
         #undef WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP
     }
 
-    template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat>
+    template<WebGLTexelFormat SrcFormat>
     void run(WebGLTexelFormat dstFormat,
              WebGLTexelPremultiplicationOp premultiplicationOp)
     {
         #define WEBGLIMAGECONVERTER_CASE_DSTFORMAT(DstFormat) \
             case DstFormat: \
                 return run<SrcFormat, DstFormat>(premultiplicationOp);
 
         switch (dstFormat) {
--- a/dom/canvas/WebGLTexelConversions.h
+++ b/dom/canvas/WebGLTexelConversions.h
@@ -150,78 +150,78 @@ unpackFromFloat16(uint16_t v)
 enum class WebGLTexelPremultiplicationOp : int {
     None,
     Premultiply,
     Unpremultiply
 };
 
 namespace WebGLTexelConversions {
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct IsFloatFormat
 {
     static const bool Value =
         Format == WebGLTexelFormat::RGBA32F ||
         Format == WebGLTexelFormat::RGB32F ||
         Format == WebGLTexelFormat::RA32F ||
         Format == WebGLTexelFormat::R32F ||
         Format == WebGLTexelFormat::A32F;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct IsHalfFloatFormat
 {
     static const bool Value =
         Format == WebGLTexelFormat::RGBA16F ||
         Format == WebGLTexelFormat::RGB16F ||
         Format == WebGLTexelFormat::RA16F ||
         Format == WebGLTexelFormat::R16F ||
         Format == WebGLTexelFormat::A16F;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct Is16bppFormat
 {
     static const bool Value =
         Format == WebGLTexelFormat::RGBA4444 ||
         Format == WebGLTexelFormat::RGBA5551 ||
         Format == WebGLTexelFormat::RGB565;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format,
+template<WebGLTexelFormat Format,
          bool IsFloat = IsFloatFormat<Format>::Value,
          bool Is16bpp = Is16bppFormat<Format>::Value,
          bool IsHalfFloat = IsHalfFloatFormat<Format>::Value>
 struct DataTypeForFormat
 {
     typedef uint8_t Type;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct DataTypeForFormat<Format, true, false, false>
 {
     typedef float Type;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct DataTypeForFormat<Format, false, true, false>
 {
     typedef uint16_t Type;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct DataTypeForFormat<Format, false, false, true>
 {
     typedef uint16_t Type;
 };
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
+template<WebGLTexelFormat Format>
 struct IntermediateFormat
 {
-    static const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Value
+    static const WebGLTexelFormat Value
         = IsFloatFormat<Format>::Value
           ? WebGLTexelFormat::RGBA32F
           : IsHalfFloatFormat<Format>::Value ? WebGLTexelFormat::RGBA16F
                                              : WebGLTexelFormat::RGBA8;
 };
 
 inline GLenum
 GLFormatForTexelFormat(WebGLTexelFormat format) {
@@ -327,17 +327,17 @@ MOZ_ALWAYS_INLINE bool HasColor(WebGLTex
 /****** BEGIN CODE SHARED WITH WEBKIT ******/
 
 // the pack/unpack functions here are originally from this file:
 //   http://trac.webkit.org/browser/trunk/WebCore/platform/graphics/GraphicsContext3D.cpp
 
 //----------------------------------------------------------------------
 // Pixel unpacking routines.
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format, typename SrcType, typename DstType>
+template<WebGLTexelFormat Format, typename SrcType, typename DstType>
 MOZ_ALWAYS_INLINE void
 unpack(const SrcType* __restrict src,
        DstType* __restrict dst)
 {
     MOZ_ASSERT(false, "Unimplemented texture format conversion");
 }
 
 template<> MOZ_ALWAYS_INLINE void
@@ -532,18 +532,18 @@ unpack<WebGLTexelFormat::A16F, uint16_t,
     dst[2] = kFloat16Value_Zero;
     dst[3] = src[0];
 }
 
 //----------------------------------------------------------------------
 // Pixel packing routines.
 //
 
-template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format,
-         MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelPremultiplicationOp) PremultiplicationOp,
+template<WebGLTexelFormat Format,
+         WebGLTexelPremultiplicationOp PremultiplicationOp,
          typename SrcType,
          typename DstType>
 MOZ_ALWAYS_INLINE void
 pack(const SrcType* __restrict src,
      DstType* __restrict dst)
 {
     MOZ_ASSERT(false, "Unimplemented texture format conversion");
 }
--- a/dom/media/MediaDecoderStateMachine.h
+++ b/dom/media/MediaDecoderStateMachine.h
@@ -1020,21 +1020,21 @@ protected:
   // can't keep up with the decode, and cause us to pause playback. So we
   // have a "preroll" stage, where we ignore the results of our "low data"
   // logic during the first few frames of our decode. This occurs during
   // playback. The flags below are true when the corresponding stream is
   // being "prerolled".
   bool mIsAudioPrerolling;
   bool mIsVideoPrerolling;
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(RequestStatus)
+  enum class RequestStatus {
     Idle,
     Pending,
     Waiting
-  MOZ_END_NESTED_ENUM_CLASS(RequestStatus)
+  };
 
   // True when we have dispatched a task to the decode task queue to request
   // decoded audio/video, and/or we are waiting for the requested sample to be
   // returned by callback from the Reader.
   RequestStatus mAudioRequestStatus;
   RequestStatus mVideoRequestStatus;
 
   RequestStatus& RequestStatusRef(MediaData::Type aType)
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -193,119 +193,119 @@ struct ParamTraits<gfxRect>
            ReadParam(aMsg, aIter, &aResult->y) &&
            ReadParam(aMsg, aIter, &aResult->width) &&
            ReadParam(aMsg, aIter, &aResult->height);
   }
 };
 
 template <>
 struct ParamTraits<gfxContentType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              gfxContentType,
              gfxContentType::COLOR,
              gfxContentType::SENTINEL>
 {};
 
 template <>
 struct ParamTraits<gfxSurfaceType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              gfxSurfaceType,
              gfxSurfaceType::Image,
              gfxSurfaceType::Max>
 {};
 
 template <>
 struct ParamTraits<mozilla::GraphicsFilterType>
   : public ContiguousEnumSerializer<
              mozilla::GraphicsFilterType,
              GraphicsFilter::FILTER_FAST,
              GraphicsFilter::FILTER_SENTINEL>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::LayersBackend>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::layers::LayersBackend,
              mozilla::layers::LayersBackend::LAYERS_NONE,
              mozilla::layers::LayersBackend::LAYERS_LAST>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::ScaleMode>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::layers::ScaleMode,
              mozilla::layers::ScaleMode::SCALE_NONE,
              mozilla::layers::ScaleMode::SENTINEL>
 {};
 
 template <>
 struct ParamTraits<gfxImageFormat>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              gfxImageFormat,
              gfxImageFormat::ARGB32,
              gfxImageFormat::Unknown>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::AttributeName>
   : public ContiguousEnumSerializer<
              mozilla::gfx::AttributeName,
              mozilla::gfx::eBlendBlendmode,
              mozilla::gfx::eLastAttributeName>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::AttributeType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::gfx::AttributeType,
              mozilla::gfx::AttributeType::eBool,
              mozilla::gfx::AttributeType::Max>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::PrimitiveType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::gfx::PrimitiveType,
              mozilla::gfx::PrimitiveType::Empty,
              mozilla::gfx::PrimitiveType::Max>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::ColorSpace>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::gfx::ColorSpace,
              mozilla::gfx::ColorSpace::SRGB,
              mozilla::gfx::ColorSpace::Max>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::TextureFlags>
-  : public BitFlagsTypedEnumSerializer<
+  : public BitFlagsEnumSerializer<
             mozilla::layers::TextureFlags,
             mozilla::layers::TextureFlags::ALL_BITS>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::TextureIdentifier>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::layers::TextureIdentifier,
              mozilla::layers::TextureIdentifier::Front,
              mozilla::layers::TextureIdentifier::HighBound>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::DeprecatedTextureHostFlags>
-  : public BitFlagsTypedEnumSerializer<
+  : public BitFlagsEnumSerializer<
              mozilla::layers::DeprecatedTextureHostFlags,
              mozilla::layers::DeprecatedTextureHostFlags::ALL_BITS>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::DiagnosticTypes>
-  : public BitFlagsTypedEnumSerializer<
+  : public BitFlagsEnumSerializer<
              mozilla::layers::DiagnosticTypes,
              mozilla::layers::DiagnosticTypes::ALL_BITS>
 {};
 
 /*
 template <>
 struct ParamTraits<mozilla::PixelFormat>
   : public EnumSerializer<mozilla::PixelFormat,
@@ -849,25 +849,25 @@ struct ParamTraits<mozilla::layers::Text
     return ReadParam(aMsg, aIter, &aResult->mCompositableType) &&
            ReadParam(aMsg, aIter, &aResult->mDeprecatedTextureHostFlags) &&
            ReadParam(aMsg, aIter, &aResult->mTextureFlags);
   }
 };
 
 template <>
 struct ParamTraits<mozilla::layers::CompositableType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::layers::CompositableType,
              mozilla::layers::CompositableType::UNKNOWN,
              mozilla::layers::CompositableType::COUNT>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::SurfaceFormat>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::gfx::SurfaceFormat,
              mozilla::gfx::SurfaceFormat::B8G8R8A8,
              mozilla::gfx::SurfaceFormat::UNKNOWN>
 {};
 
 template <>
 struct ParamTraits<mozilla::layers::ScrollableLayerGuid>
 {
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -84,19 +84,19 @@ typedef uintptr_t SyncHandle;
 class SyncObject : public RefCounted<SyncObject>
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObject)
   virtual ~SyncObject() { }
 
   static TemporaryRef<SyncObject> CreateSyncObject(SyncHandle aHandle);
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(SyncType)
+  enum class SyncType {
     D3D11,
-  MOZ_END_NESTED_ENUM_CLASS(SyncType)
+  };
 
   virtual SyncType GetSyncType() = 0;
   virtual void FinalizeFrame() = 0;
 
 protected:
   SyncObject() { }
 };
 
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -73,24 +73,24 @@ class gfxPrefs;
 class gfxPrefs MOZ_FINAL
 {
 private:
   /// See Logging.h.  This lets Moz2D access preference values it owns.
   PreferenceAccessImpl* mMoz2DPrefAccess;
 
 private:
   // Enums for the update policy.
-  MOZ_BEGIN_NESTED_ENUM_CLASS(UpdatePolicy)
+  enum class UpdatePolicy {
     Skip, // Set the value to default, skip any Preferences calls
     Once, // Evaluate the preference once, unchanged during the session
     Live  // Evaluate the preference and set callback so it stays current/live
-  MOZ_END_NESTED_ENUM_CLASS(UpdatePolicy)
+  };
 
   // Since we cannot use const char*, use a function that returns it.
-  template <MOZ_ENUM_CLASS_ENUM_TYPE(UpdatePolicy) Update, class T, T Default(void), const char* Pref(void)>
+  template <UpdatePolicy Update, class T, T Default(void), const char* Pref(void)>
   class PrefTemplate
   {
   public:
     PrefTemplate()
     : mValue(Default())
     {
       Register(Update, Pref());
     }
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -124,64 +124,41 @@ struct EnumSerializer {
     *aResult = paramType(value);
     return true;
   }
 };
 
 template <typename E,
           E MinLegal,
           E HighBound>
-struct ContiguousEnumValidator
-{
-  static bool IsLegalValue(E e)
-  {
-    return MinLegal <= e && e < HighBound;
-  }
-};
-
-template <typename E,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) MinLegal,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) HighBound>
-class ContiguousTypedEnumValidator
+class ContiguousEnumValidator
 {
   // Silence overzealous -Wtype-limits bug in GCC fixed in GCC 4.8:
   // "comparison of unsigned expression >= 0 is always true"
   // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11856
   template <typename T>
   static bool IsLessThanOrEqual(T a, T b) { return a <= b; }
 
 public:
   static bool IsLegalValue(E e)
   {
-    typedef MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) ActualEnumType;
-    return IsLessThanOrEqual(MinLegal, ActualEnumType(e)) &&
-           ActualEnumType(e) < HighBound;
+    return IsLessThanOrEqual(MinLegal, e) && e < HighBound;
   }
 };
 
 template <typename E,
           E AllBits>
 struct BitFlagsEnumValidator
 {
   static bool IsLegalValue(E e)
   {
     return (e & AllBits) == e;
   }
 };
 
-template <typename E,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) AllBits>
-struct BitFlagsTypedEnumValidator
-{
-  static bool IsLegalValue(E e)
-  {
-    return (e & AllBits) == e;
-  }
-};
-
 /**
  * Specialization of EnumSerializer for enums with contiguous enum values.
  *
  * Provide two values: MinLegal, HighBound. An enum value x will be
  * considered legal if MinLegal <= x < HighBound.
  *
  * For example, following is definition of serializer for enum type FOO.
  * \code
@@ -197,29 +174,16 @@ template <typename E,
           E MinLegal,
           E HighBound>
 struct ContiguousEnumSerializer
   : EnumSerializer<E,
                    ContiguousEnumValidator<E, MinLegal, HighBound>>
 {};
 
 /**
- * Similar to ContiguousEnumSerializer, but for MFBT typed enums
- * as constructed by MOZ_BEGIN_ENUM_CLASS. This can go away when
- * we drop MOZ_BEGIN_ENUM_CLASS and use C++11 enum classes directly.
- */
-template <typename E,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) MinLegal,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) HighBound>
-struct ContiguousTypedEnumSerializer
-  : EnumSerializer<E,
-                   ContiguousTypedEnumValidator<E, MinLegal, HighBound>>
-{};
-
-/**
  * Specialization of EnumSerializer for enums representing bit flags.
  *
  * Provide one value: AllBits. An enum value x will be
  * considered legal if (x & AllBits) == x;
  *
  * Example:
  * \code
  * enum FOO {
@@ -236,28 +200,16 @@ struct ContiguousTypedEnumSerializer
  */
 template <typename E,
           E AllBits>
 struct BitFlagsEnumSerializer
   : EnumSerializer<E,
                    BitFlagsEnumValidator<E, AllBits>>
 {};
 
-/**
- * Similar to BitFlagsEnumSerializer, but for MFBT typed enums
- * as constructed by MOZ_BEGIN_ENUM_CLASS. This can go away when
- * we drop MOZ_BEGIN_ENUM_CLASS and use C++11 enum classes directly.
- */
-template <typename E,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) AllBits>
-struct BitFlagsTypedEnumSerializer
-  : EnumSerializer<E,
-                   BitFlagsTypedEnumValidator<E, AllBits>>
-{};
-
 template <>
 struct ParamTraits<base::ChildPrivileges>
   : public ContiguousEnumSerializer<base::ChildPrivileges,
                                     base::PRIVILEGES_DEFAULT,
                                     base::PRIVILEGES_LAST>
 { };
 
 template<>
--- a/js/public/ProfilingStack.h
+++ b/js/public/ProfilingStack.h
@@ -68,30 +68,30 @@ class ProfileEntry
         // into baseline.
         OSR = 0x08,
 
         // Mask for removing all flags except the category information.
         CATEGORY_MASK = ~IS_CPP_ENTRY & ~FRAME_LABEL_COPY & ~BEGIN_PSEUDO_JS & ~OSR
     };
 
     // Keep these in sync with browser/devtools/profiler/utils/global.js
-    MOZ_BEGIN_NESTED_ENUM_CLASS(Category, uint32_t)
+    enum class Category : uint32_t {
         OTHER    = 0x10,
         CSS      = 0x20,
         JS       = 0x40,
         GC       = 0x80,
         CC       = 0x100,
         NETWORK  = 0x200,
         GRAPHICS = 0x400,
         STORAGE  = 0x800,
         EVENTS   = 0x1000,
 
         FIRST    = OTHER,
         LAST     = EVENTS
-    MOZ_END_NESTED_ENUM_CLASS(Category)
+    };
 
     // All of these methods are marked with the 'volatile' keyword because SPS's
     // representation of the stack is stored such that all ProfileEntry
     // instances are volatile. These methods would not be available unless they
     // were marked as volatile as well.
 
     bool isCpp() const volatile { return hasFlag(IS_CPP_ENTRY); }
     bool isJs() const volatile { return !isCpp(); }
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -158,20 +158,20 @@ public:
    */
   static nsIScrollableFrame* FindScrollableFrameFor(ViewID aId);
 
   /**
    * Get display port for the given element.
    */
   static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult = nullptr);
 
-  MOZ_BEGIN_NESTED_ENUM_CLASS(RepaintMode, uint8_t)
+  enum class RepaintMode : uint8_t {
     Repaint,
     DoNotRepaint
-  MOZ_END_NESTED_ENUM_CLASS(RepaintMode)
+  };
 
   /**
    * Set the display port margins for a content element to be used with a
    * display port base (see SetDisplayPortBase()).
    * See also nsIDOMWindowUtils.setDisplayPortMargins.
    * @param aContent the content element for which to set the margins
    * @param aPresShell the pres shell for the document containing the element
    * @param aMargins the margins to set
@@ -2572,18 +2572,16 @@ private:
   static void DoLogTestDataForPaint(mozilla::layers::LayerManager* aManager,
                                     ViewID aScrollId,
                                     const std::string& aKey,
                                     const std::string& aValue);
 
   static bool IsAPZTestLoggingEnabled();
 };
 
-MOZ_FINISH_NESTED_ENUM_CLASS(nsLayoutUtils::RepaintMode)
-
 template<typename PointType, typename RectType, typename CoordType>
 /* static */ bool
 nsLayoutUtils::PointIsCloserToRect(PointType aPoint, const RectType& aRect,
                                    CoordType& aClosestXDistance,
                                    CoordType& aClosestYDistance)
 {
   CoordType fromLeft = aPoint.x - aRect.x;
   CoordType fromRight = aPoint.x - aRect.XMost();
--- a/mfbt/EnumeratedArray.h
+++ b/mfbt/EnumeratedArray.h
@@ -11,18 +11,17 @@
 
 #include "mozilla/Array.h"
 #include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 
 /**
  * EnumeratedArray is a fixed-size array container for use when an
- * array is indexed by a specific enum class, as currently implemented
- * by MOZ_BEGIN_ENUM_CLASS.
+ * array is indexed by a specific enum class.
  *
  * This provides type safety by guarding at compile time against accidentally
  * indexing such arrays with unrelated values. This also removes the need
  * for manual casting when using a typed enum value to index arrays.
  *
  * Aside from the typing of indices, EnumeratedArray is similar to Array.
  *
  * Example:
@@ -35,17 +34,17 @@ namespace mozilla {
  *
  *   EnumeratedArray<AnimalSpecies, AnimalSpecies::Count, int> headCount;
  *
  *   headCount[AnimalSpecies::Cow] = 17;
  *   headCount[AnimalSpecies::Sheep] = 30;
  *
  */
 template<typename IndexType,
-         MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
+         IndexType SizeAsEnumValue,
          typename ValueType>
 class EnumeratedArray
 {
 public:
   static const size_t kSize = size_t(SizeAsEnumValue);
 
 private:
   Array<ValueType, kSize> mArray;
--- a/xpcom/base/CycleCollectedJSRuntime.h
+++ b/xpcom/base/CycleCollectedJSRuntime.h
@@ -207,17 +207,17 @@ private:
     FinalizeNow,
   };
 
   void FinalizeDeferredThings(DeferredFinalizeType aType);
 
 public:
   // Two conditions, JSOutOfMemory and JSLargeAllocationFailure, are noted in
   // crash reports. Here are the values that can appear in the reports:
-  MOZ_BEGIN_NESTED_ENUM_CLASS(OOMState, uint32_t)
+  enum class OOMState : uint32_t {
     // The condition has never happened. No entry appears in the crash report.
     OK,
 
     // We are currently reporting the given condition.
     // 
     // Suppose a crash report contains "JSLargeAllocationFailure:
     // Reporting". This means we crashed while executing memory-pressure
     // observers, trying to shake loose some memory. The large allocation in
@@ -235,17 +235,17 @@ public:
     // had executed yet.
     Reported,
 
     // The condition has happened, but a GC cycle ended since then.
     //
     // GC is taken as a proxy for "we've been banging on the heap a good bit
     // now and haven't crashed; the OOM was probably handled correctly".
     Recovered
-  MOZ_END_NESTED_ENUM_CLASS(OOMState)
+  };
 
 private:
   void AnnotateAndSetOutOfMemory(OOMState* aStatePtr, OOMState aNewState);
   void OnGC(JSGCStatus aStatus);
   void OnOutOfMemory();
   void OnLargeAllocationFailure();
 
 public:
@@ -311,18 +311,16 @@ private:
   nsCOMPtr<nsIException> mPendingException;
 
   nsTArray<nsRefPtr<nsIRunnable>> mPromiseMicroTaskQueue;
 
   OOMState mOutOfMemoryState;
   OOMState mLargeAllocationFailureState;
 };
 
-MOZ_FINISH_NESTED_ENUM_CLASS(CycleCollectedJSRuntime::OOMState)
-
 void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
 
 // Returns true if the JSGCTraceKind is one the cycle collector cares about.
 inline bool AddToCCKind(JSGCTraceKind aKind)
 {
   return aKind == JSTRACE_OBJECT || aKind == JSTRACE_SCRIPT;
 }
 
--- a/xpcom/glue/EnumeratedArrayCycleCollection.h
+++ b/xpcom/glue/EnumeratedArrayCycleCollection.h
@@ -6,30 +6,30 @@
 
 #ifndef EnumeratedArrayCycleCollection_h_
 #define EnumeratedArrayCycleCollection_h_
 
 #include "mozilla/EnumeratedArray.h"
 #include "nsCycleCollectionTraversalCallback.h"
 
 template<typename IndexType,
-         MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
+         IndexType SizeAsEnumValue,
          typename ValueType>
 inline void
 ImplCycleCollectionUnlink(mozilla::EnumeratedArray<IndexType,
                                                    SizeAsEnumValue,
                                                    ValueType>& aField)
 {
   for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) {
     aField[IndexType(i)] = nullptr;
   }
 }
 
 template<typename IndexType,
-         MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
+         IndexType SizeAsEnumValue,
          typename ValueType>
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             mozilla::EnumeratedArray<IndexType,
                                                      SizeAsEnumValue,
                                                      ValueType>& aField,
                             const char* aName,
                             uint32_t aFlags = 0)