Bug 987311 - 2/6 - Make TextureFlags a typed enum, auto regex changes - r=nical
☠☠ backed out by 0ecc4193e630 ☠ ☠
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 25 Apr 2014 22:34:05 -0400
changeset 180722 6a2542a5c86588a84cac5aa559ccdcdd2047d4f6
parent 180721 1dfd9a457f340016c9af45501a56578d6ac8d9ca
child 180723 62ba0a377450f00babdc2cd707d453df600c570f
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersnical
bugs987311
milestone31.0a1
Bug 987311 - 2/6 - Make TextureFlags a typed enum, auto regex changes - r=nical
gfx/layers/CompositorTypes.h
gfx/layers/D3D9SurfaceImage.cpp
gfx/layers/ImageContainer.cpp
gfx/layers/LayersLogging.cpp
gfx/layers/MacIOSurfaceImage.cpp
gfx/layers/basic/TextureClientX11.cpp
gfx/layers/basic/TextureClientX11.h
gfx/layers/client/CanvasClient.cpp
gfx/layers/client/ClientCanvasLayer.cpp
gfx/layers/client/ClientImageLayer.cpp
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
gfx/layers/client/ImageClient.cpp
gfx/layers/client/SimpleTextureClientPool.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/client/TextureClientPool.cpp
gfx/layers/composite/ContentHost.cpp
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/composite/X11TextureHost.cpp
gfx/layers/d3d11/TextureD3D11.cpp
gfx/layers/d3d9/TextureD3D9.cpp
gfx/layers/d3d9/TextureD3D9.h
gfx/layers/ipc/ImageBridgeChild.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/GrallocTextureClient.h
gfx/layers/opengl/GrallocTextureHost.cpp
gfx/layers/opengl/TextureClientOGL.cpp
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -90,19 +90,19 @@ MOZ_END_ENUM_CLASS(TextureFlags)
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
 
 static inline bool
 TextureRequiresLocking(TextureFlags aFlags)
 {
   // If we're not double buffered, or uploading
   // within a transaction, then we need to support
   // locking correctly.
-  return !(aFlags & (TEXTURE_IMMEDIATE_UPLOAD |
-                     TEXTURE_DOUBLE_BUFFERED |
-                     TEXTURE_IMMUTABLE));
+  return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
+                     TextureFlags::DOUBLE_BUFFERED |
+                     TextureFlags::IMMUTABLE));
 }
 
 /**
  * The type of debug diagnostic to enable.
  */
 typedef uint32_t DiagnosticTypes;
 const DiagnosticTypes DIAGNOSTIC_NONE             = 0;
 const DiagnosticTypes DIAGNOSTIC_TILE_BORDERS     = 1 << 0;
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -126,17 +126,17 @@ D3D9SurfaceImage::GetSize()
 }
 
 TextureClient*
 D3D9SurfaceImage::GetTextureClient(CompositableClient* aClient)
 {
   EnsureSynchronized();
   if (!mTextureClient) {
     RefPtr<SharedTextureClientD3D9> textureClient =
-      new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TEXTURE_FLAGS_DEFAULT);
+      new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TextureFlags::DEFAULT);
     textureClient->InitWith(mTexture, mShareHandle, mDesc);
     mTextureClient = textureClient;
   }
   return mTextureClient;
 }
 
 TemporaryRef<gfx::SourceSurface>
 D3D9SurfaceImage::GetAsSourceSurface()
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -619,17 +619,17 @@ CairoImage::GetTextureClient(Compositabl
     return textureClient;
   }
 
   RefPtr<SourceSurface> surface = GetAsSourceSurface();
   MOZ_ASSERT(surface);
 
   // gfx::BackendType::NONE means default to content backend
   textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
-                                                         TEXTURE_FLAGS_DEFAULT,
+                                                         TextureFlags::DEFAULT,
                                                          gfx::BackendType::NONE,
                                                          surface->GetSize());
   MOZ_ASSERT(textureClient->CanExposeDrawTarget());
   if (!textureClient->AllocateForSurface(surface->GetSize()) ||
       !textureClient->Lock(OPEN_WRITE_ONLY)) {
     return nullptr;
   }
 
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -190,21 +190,21 @@ AppendToString(nsACString& s, TextureFla
     if (previous) { \
       s += "|"; \
     } \
     s += #test; \
     previous = true; \
   } \
 }
     bool previous = false;
-    AppendFlag(TEXTURE_USE_NEAREST_FILTER);
-    AppendFlag(TEXTURE_NEEDS_Y_FLIP);
-    AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
-    AppendFlag(TEXTURE_ALLOW_REPEAT);
-    AppendFlag(TEXTURE_NEW_TILE);
+    AppendFlag(TextureFlags::USE_NEAREST_FILTER);
+    AppendFlag(TextureFlags::NEEDS_Y_FLIP);
+    AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
+    AppendFlag(TextureFlags::ALLOW_REPEAT);
+    AppendFlag(TextureFlags::NEW_TILE);
 
 #undef AppendFlag
   }
   return s += sfx;
 }
 
 nsACString&
 AppendToString(nsACString& s, mozilla::gfx::SurfaceFormat format,
--- a/gfx/layers/MacIOSurfaceImage.cpp
+++ b/gfx/layers/MacIOSurfaceImage.cpp
@@ -9,17 +9,17 @@
 using namespace mozilla;
 using namespace mozilla::layers;
 
 TextureClient*
 MacIOSurfaceImage::GetTextureClient(CompositableClient* aClient)
 {
   if (!mTextureClient) {
     RefPtr<MacIOSurfaceTextureClientOGL> buffer =
-      new MacIOSurfaceTextureClientOGL(TEXTURE_FLAGS_DEFAULT);
+      new MacIOSurfaceTextureClientOGL(TextureFlags::DEFAULT);
     buffer->InitWith(mSurface);
     mTextureClient = buffer;
   }
   return mTextureClient;
 }
 
 TemporaryRef<gfx::SourceSurface>
 MacIOSurfaceImage::GetAsSourceSurface()
--- a/gfx/layers/basic/TextureClientX11.cpp
+++ b/gfx/layers/basic/TextureClientX11.cpp
@@ -66,17 +66,17 @@ TextureClientX11::ToSurfaceDescriptor(Su
 
   aOutDescriptor = SurfaceDescriptorX11(mSurface);
   return true;
 }
 
 TextureClientData*
 TextureClientX11::DropTextureData()
 {
-  MOZ_ASSERT(!(mFlags & TEXTURE_DEALLOCATE_CLIENT));
+  MOZ_ASSERT(!(mFlags & TextureFlags::DEALLOCATE_CLIENT));
   return nullptr;
 }
 
 bool
 TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aTextureFlags)
 {
   MOZ_ASSERT(IsValid());
   //MOZ_ASSERT(mFormat != gfx::FORMAT_YUV, "This TextureClient cannot use YCbCr data");
--- a/gfx/layers/basic/TextureClientX11.h
+++ b/gfx/layers/basic/TextureClientX11.h
@@ -14,17 +14,17 @@ namespace mozilla {
 namespace layers {
 
 /**
  * A TextureClient implementation based on Xlib.
  */
 class TextureClientX11 : public TextureClient
 {
  public:
-  TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+  TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
 
   ~TextureClientX11();
 
   // TextureClient
 
   virtual bool IsAllocated() const MOZ_OVERRIDE;
 
   virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -38,17 +38,17 @@ CanvasClient::CreateCanvasClient(CanvasC
 #ifndef MOZ_WIDGET_GONK
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     NS_WARNING("Most platforms still need an optimized way to share GL cross process.");
     return new CanvasClient2D(aForwarder, aFlags);
   }
 #endif
   if (aType == CanvasClientGLContext &&
       aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
-    aFlags |= TEXTURE_DEALLOCATE_CLIENT;
+    aFlags |= TextureFlags::DEALLOCATE_CLIENT;
     return new CanvasClientSurfaceStream(aForwarder, aFlags);
   }
   return new CanvasClient2D(aForwarder, aFlags);
 }
 
 void
 CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
 {
@@ -61,19 +61,19 @@ CanvasClient2D::Update(gfx::IntSize aSiz
   bool bufferCreated = false;
   if (!mBuffer) {
     bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
     gfxContentType contentType = isOpaque
                                                 ? gfxContentType::COLOR
                                                 : gfxContentType::COLOR_ALPHA;
     gfxImageFormat format
       = gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
-    uint32_t flags = TEXTURE_FLAGS_DEFAULT;
-    if (mTextureFlags & TEXTURE_NEEDS_Y_FLIP) {
-      flags |= TEXTURE_NEEDS_Y_FLIP;
+    uint32_t flags = TextureFlags::DEFAULT;
+    if (mTextureFlags & TextureFlags::NEEDS_Y_FLIP) {
+      flags |= TextureFlags::NEEDS_Y_FLIP;
     }
     mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
                                         flags,
                                         gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
     MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
     mBuffer->AllocateForSurface(aSize);
 
     bufferCreated = true;
--- a/gfx/layers/client/ClientCanvasLayer.cpp
+++ b/gfx/layers/client/ClientCanvasLayer.cpp
@@ -128,28 +128,28 @@ ClientCanvasLayer::RenderLayer()
     return;
   }
 
   if (GetMaskLayer()) {
     ToClientLayer(GetMaskLayer())->RenderLayer();
   }
   
   if (!mCanvasClient) {
-    TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD;
+    TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD;
     if (mNeedsYFlip) {
-      flags |= TEXTURE_NEEDS_Y_FLIP;
+      flags |= TextureFlags::NEEDS_Y_FLIP;
     }
 
     if (!mGLContext) {
       // We don't support locking for buffer surfaces currently
-      flags |= TEXTURE_IMMEDIATE_UPLOAD;
+      flags |= TextureFlags::IMMEDIATE_UPLOAD;
     } else {
       // GLContext's SurfaceStream handles ownership itself,
       // and doesn't require layers to do any deallocation.
-      flags |= TEXTURE_DEALLOCATE_CLIENT;
+      flags |= TextureFlags::DEALLOCATE_CLIENT;
     }
     mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
                                                      ClientManager()->AsShadowForwarder(), flags);
     if (!mCanvasClient) {
       return;
     }
     if (HasShadow()) {
       mCanvasClient->Connect();
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -138,19 +138,19 @@ ClientImageLayer::RenderLayer()
   }
 
   if (!mImageClient ||
       !mImageClient->UpdateImage(mContainer, GetContentFlags())) {
     CompositableType type = GetImageClientType();
     if (type == BUFFER_UNKNOWN) {
       return;
     }
-    TextureFlags flags = TEXTURE_FRONT;
+    TextureFlags flags = TextureFlags::FRONT;
     if (mDisallowBigImage) {
-      flags |= TEXTURE_DISALLOW_BIGIMAGE;
+      flags |= TextureFlags::DISALLOW_BIGIMAGE;
     }
     mImageClient = ImageClient::CreateImageClient(type,
                                                   ClientManager()->AsShadowForwarder(),
                                                   flags);
     if (type == BUFFER_BRIDGE) {
       static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
     }
 
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -78,17 +78,17 @@ public:
   CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
 
   virtual TextureInfo GetTextureInfo() const = 0;
 
   LayersBackend GetCompositorBackendType() const;
 
   TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
-                            TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
+                            TextureFlags aFlags = TextureFlags::DEFAULT,
                             gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
 
   TemporaryRef<TextureClient>
   CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
                                 TextureFlags aTextureFlags,
                                 gfx::BackendType aMoz2dBackend,
                                 const gfx::IntSize& aSizeHint);
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -38,21 +38,21 @@ using namespace gfx;
 
 namespace layers {
 
 static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFlags)
 {
   TextureFlags result = 0;
 
   if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
-    result |= TEXTURE_COMPONENT_ALPHA;
+    result |= TextureFlags::COMPONENT_ALPHA;
   }
 
   if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
-    result |= TEXTURE_ALLOW_REPEAT;
+    result |= TextureFlags::ALLOW_REPEAT;
   }
 
   return result;
 }
 
 
 /* static */ TemporaryRef<ContentClient>
 ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
@@ -192,17 +192,17 @@ ContentClientRemoteBuffer::CreateAndAllo
                                           gfx::BackendType::NONE,
                                           mSize);
   if (!aClient) {
     return false;
   }
 
   if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
     aClient = CreateTextureClientForDrawing(mSurfaceFormat,
-                mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags,
+                mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK | aFlags,
                 gfx::BackendType::NONE,
                 mSize);
     if (!aClient) {
       return false;
     }
     if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
       NS_WARNING("Could not allocate texture client");
       aClient = nullptr;
@@ -231,29 +231,29 @@ ContentClientRemoteBuffer::BuildTextureC
   mIsNewBuffer = true;
 
   DestroyBuffers();
 
   mSurfaceFormat = aFormat;
   mSize = gfx::IntSize(aRect.width, aRect.height);
   mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
 
-  if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
+  if (!CreateAndAllocateTextureClient(mTextureClient, TextureFlags::ON_BLACK) ||
       !AddTextureClient(mTextureClient)) {
     AbortTextureClientCreation();
     return;
   }
 
   if (aFlags & BUFFER_COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
+    if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TextureFlags::ON_WHITE) ||
         !AddTextureClient(mTextureClientOnWhite)) {
       AbortTextureClientCreation();
       return;
     }
-    mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
+    mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
   }
 
   CreateFrontBuffer(aRect);
 }
 
 void
 ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
                                         const nsIntRect& aRect,
@@ -334,23 +334,23 @@ ContentClientRemoteBuffer::SwapBuffers(c
 {
   MOZ_ASSERT(mTextureClient);
   mFrontAndBackBufferDiffer = true;
 }
 
 void
 ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
 {
-  if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
+  if (!CreateAndAllocateTextureClient(mFrontClient, TextureFlags::ON_BLACK) ||
       !AddTextureClient(mFrontClient)) {
     AbortTextureClientCreation();
     return;
   }
-  if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
+  if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
+    if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TextureFlags::ON_WHITE) ||
         !AddTextureClient(mFrontClientOnWhite)) {
       AbortTextureClientCreation();
       return;
     }
   }
 
   mFrontBufferRect = aBufferRect;
   mFrontBufferRotation = nsIntPoint();
@@ -596,17 +596,17 @@ ContentClientIncremental::BeginPaintBuff
 
   while (true) {
     mode = aLayer->GetSurfaceMode();
     neededRegion = aLayer->GetVisibleRegion();
     // If we're going to resample, we need a buffer that's in clamp mode.
     canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
       mHasBuffer &&
       (!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
-       !(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
+       !(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
 
     if (canReuseBuffer) {
       if (mBufferRect.Contains(neededRegion.GetBounds())) {
         // We don't need to adjust mBufferRect.
         destBufferRect = mBufferRect;
       } else {
         // The buffer's big enough but doesn't contain everything that's
         // going to be visible. We'll move it.
@@ -680,19 +680,19 @@ ContentClientIncremental::BeginPaintBuff
     mBufferRect.SetRect(0, 0, 0, 0);
     mBufferRotation.MoveTo(0, 0);
     canReuseBuffer = false;
   }
 
   nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
   bool createdBuffer = false;
 
-  uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
+  uint32_t bufferFlags = canHaveRotation ? TextureFlags::ALLOW_REPEAT : 0;
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
-    bufferFlags |= TEXTURE_COMPONENT_ALPHA;
+    bufferFlags |= TextureFlags::COMPONENT_ALPHA;
   }
   if (canReuseBuffer) {
     nsIntRect keepArea;
     if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
       // Set mBufferRotation so that the pixels currently in mBuffer
       // will still be rendered in the right place when mBufferRect
       // changes to destBufferRect.
       nsIntPoint newRotation = mBufferRotation +
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -440,17 +440,17 @@ private:
 
   enum BufferType{
     BUFFER_BLACK,
     BUFFER_WHITE
   };
 
   void NotifyBufferCreated(ContentType aType, uint32_t aFlags)
   {
-    mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
+    mTextureInfo.mTextureFlags = aFlags & ~TextureFlags::DEALLOCATE_CLIENT;
     mContentType = aType;
 
     mForwarder->CreatedIncrementalBuffer(this,
                                          mTextureInfo,
                                          mBufferRect);
 
   }
 
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -159,17 +159,17 @@ ImageClientSingle::UpdateImageInternal(I
 
     if (mFrontBuffer && mFrontBuffer->IsImmutable()) {
       GetForwarder()->RemoveTextureFromCompositable(this, mFrontBuffer);
       mFrontBuffer = nullptr;
     }
 
     bool bufferCreated = false;
     if (!mFrontBuffer) {
-      mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TEXTURE_FLAGS_DEFAULT);
+      mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TextureFlags::DEFAULT);
       gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
       gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
       if (!mFrontBuffer->AsTextureClientYCbCr()->AllocateForYCbCr(ySize, cbCrSize, data->mStereoMode)) {
         mFrontBuffer = nullptr;
         return false;
       }
       bufferCreated = true;
     }
--- a/gfx/layers/client/SimpleTextureClientPool.cpp
+++ b/gfx/layers/client/SimpleTextureClientPool.cpp
@@ -67,20 +67,20 @@ SimpleTextureClientPool::GetTextureClien
     textureClient->WaitReleaseFence();
     mAvailableTextureClients.pop();
     RECYCLE_LOG("%s Skip allocate (%i left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), mAvailableTextureClients.size(), textureClient.get());
 
   } else {
     // No unused clients in the pool, create one
     if (gfxPrefs::ForceShmemTiles()) {
       textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
-        mFormat, TEXTURE_IMMEDIATE_UPLOAD | TEXTURE_RECYCLE, gfx::BackendType::NONE);
+        mFormat, TextureFlags::IMMEDIATE_UPLOAD | TextureFlags::RECYCLE, gfx::BackendType::NONE);
     } else {
       textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
-        mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE, gfx::BackendType::NONE, mSize);
+        mFormat, TextureFlags::DEFAULT | TextureFlags::RECYCLE, gfx::BackendType::NONE, mSize);
     }
     if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
       NS_WARNING("TextureClient::AllocateForSurface failed!");
     }
     RECYCLE_LOG("%s Must allocate (0 left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), textureClient.get());
   }
 
   if (aAutoRecycle) {
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -284,51 +284,51 @@ TextureClient::CreateTextureClientForDra
 #ifdef XP_WIN
   LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
   if (parentBackend == LayersBackend::LAYERS_D3D11 &&
       (aMoz2DBackend == gfx::BackendType::DIRECT2D ||
         aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
       gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
       aSizeHint.width <= maxTextureSize &&
       aSizeHint.height <= maxTextureSize &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
+      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
     result = new TextureClientD3D11(aFormat, aTextureFlags);
   }
   if (parentBackend == LayersBackend::LAYERS_D3D9 &&
       aMoz2DBackend == gfx::BackendType::CAIRO &&
       aAllocator->IsSameProcess() &&
       aSizeHint.width <= maxTextureSize &&
       aSizeHint.height <= maxTextureSize &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
+      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
     if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
       result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
     } else {
       result = new CairoTextureClientD3D9(aFormat, aTextureFlags);
     }
   }
 #endif
 
 #ifdef MOZ_X11
   LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
   gfxSurfaceType type =
     gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
 
   if (parentBackend == LayersBackend::LAYERS_BASIC &&
       aMoz2DBackend == gfx::BackendType::CAIRO &&
       type == gfxSurfaceType::Xlib &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK))
+      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK))
   {
     result = new TextureClientX11(aFormat, aTextureFlags);
   }
 #ifdef GL_PROVIDER_GLX
 #if 0
   // Bug 977963: Disabled for black layers
   if (parentBackend == LayersBackend::LAYERS_OPENGL &&
       type == gfxSurfaceType::Xlib &&
-      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK) &&
+      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK) &&
       aFormat != SurfaceFormat::A8 &&
       gl::sGLXLibrary.UseTextureFromPixmap())
   {
     result = new TextureClientX11(aFormat, aTextureFlags);
   }
 #endif
 #endif
 #endif
@@ -456,17 +456,17 @@ TextureClient::~TextureClient()
 {
   // All the destruction code that may lead to virtual method calls must
   // be in Finalize() which is called just before the destructor.
 }
 
 void TextureClient::ForceRemove()
 {
   if (mValid && mActor) {
-    if (GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
+    if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
       mActor->SetTextureData(DropTextureData());
       if (mActor->IPCOpen()) {
         mActor->SendRemoveTextureSync();
       }
       mActor->DeleteTextureData();
     } else {
       if (mActor->IPCOpen()) {
         mActor->SendRemoveTexture();
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -125,17 +125,17 @@ public:
  * responsibility of the compositable (which would use two Texture pairs).
  * In order to send several different buffers to the compositor side, use
  * several TextureClients.
  */
 class TextureClient
   : public AtomicRefCountedWithFinalize<TextureClient>
 {
 public:
-  TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+  TextureClient(TextureFlags aFlags = TextureFlags::DEFAULT);
   virtual ~TextureClient();
 
   static TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
                             gfx::SurfaceFormat aFormat,
                             TextureFlags aTextureFlags,
                             gfx::BackendType aMoz2dBackend);
 
@@ -257,32 +257,32 @@ public:
    * TextureFlags contain important information about various aspects
    * of the texture, like how its liferime is managed, and how it
    * should be displayed.
    * See TextureFlags in CompositorTypes.h.
    */
   TextureFlags GetFlags() const { return mFlags; }
 
   /**
-   * valid only for TEXTURE_RECYCLE TextureClient.
+   * valid only for TextureFlags::RECYCLE TextureClient.
    * When called this texture client will grab a strong reference and release
    * it once the compositor notifies that it is done with the texture.
    * NOTE: In this stage the texture client can no longer be used by the
    * client in a transaction.
    */
   void WaitForCompositorRecycle();
 
   /**
    * After being shared with the compositor side, an immutable texture is never
    * modified, it can only be read. It is safe to not Lock/Unlock immutable
    * textures.
    */
-  bool IsImmutable() const { return mFlags & TEXTURE_IMMUTABLE; }
+  bool IsImmutable() const { return mFlags & TextureFlags::IMMUTABLE; }
 
-  void MarkImmutable() { AddFlags(TEXTURE_IMMUTABLE); }
+  void MarkImmutable() { AddFlags(TextureFlags::IMMUTABLE); }
 
   bool IsSharedWithCompositor() const { return mShared; }
 
   bool ShouldDeallocateInDestructor() const;
 
   /**
    * If this method returns false users of TextureClient are not allowed
    * to access the shared data.
@@ -302,17 +302,17 @@ public:
    * This is to be used with IPDL messages only. Do not store the returned
    * pointer.
    */
   PTextureChild* GetIPDLActor();
 
   /**
    * Triggers the destruction of the shared data and the corresponding TextureHost.
    *
-   * If the texture flags contain TEXTURE_DEALLOCATE_CLIENT, the destruction
+   * If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
    * will be synchronously coordinated with the compositor side, otherwise it
    * will be done asynchronously.
    */
   void ForceRemove();
 
   virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle) {}
 
   const FenceHandle& GetReleaseFenceHandle() const
--- a/gfx/layers/client/TextureClientPool.cpp
+++ b/gfx/layers/client/TextureClientPool.cpp
@@ -52,20 +52,20 @@ TextureClientPool::GetTextureClient()
   // We're increasing the number of outstanding TextureClients without reusing a
   // client, we may need to free a deferred-return TextureClient.
   ShrinkToMaximumSize();
 
   // No unused clients in the pool, create one
   if (gfxPrefs::ForceShmemTiles()) {
     // gfx::BackendType::NONE means use the content backend
     textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
-      mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
+      mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
   } else {
     textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
-      mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
+      mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
   }
   textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);
 
   return textureClient;
 }
 
 void
 TextureClientPool::ReturnTextureClient(TextureClient *aClient)
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -483,17 +483,17 @@ ContentHostIncremental::TextureCreationR
   RefPtr<DataTextureSource> temp =
     compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
   MOZ_ASSERT(temp->AsSourceOGL() &&
              temp->AsSourceOGL()->AsTextureImageTextureSource());
   RefPtr<TextureImageTextureSourceOGL> newSource =
     temp->AsSourceOGL()->AsTextureImageTextureSource();
 
   RefPtr<TextureImageTextureSourceOGL> newSourceOnWhite;
-  if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
+  if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
     temp =
       compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
     MOZ_ASSERT(temp->AsSourceOGL() &&
                temp->AsSourceOGL()->AsTextureImageTextureSource());
     newSourceOnWhite = temp->AsSourceOGL()->AsTextureImageTextureSource();
   }
 
   if (mTextureInfo.mDeprecatedTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -143,17 +143,17 @@ ImageHost::Composite(EffectChain& aEffec
                                     Float(mPictureRect.width) / textureSize.width,
                                     Float(mPictureRect.height) / textureSize.height);
       rect = pictureRect;
     } else {
       effect->mTextureCoords = Rect(0, 0, 1, 1);
       rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
     }
 
-    if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
+    if (mFrontBuffer->GetFlags() & TextureFlags::NEEDS_Y_FLIP) {
       effect->mTextureCoords.y = effect->mTextureCoords.YMost();
       effect->mTextureCoords.height = -effect->mTextureCoords.height;
     }
 
     GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
                               aOpacity, aTransform);
     GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
                                      rect, aClipRect,
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -228,17 +228,17 @@ TextureHost::TextureHost(TextureFlags aF
 {}
 
 TextureHost::~TextureHost()
 {
 }
 
 void TextureHost::Finalize()
 {
-  if (!(GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
+  if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
     DeallocateSharedData();
     DeallocateDeviceData();
   }
 }
 
 void
 TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
@@ -287,17 +287,17 @@ BufferTextureHost::Updated(const nsIntRe
 {
   ++mUpdateSerial;
   if (aRegion) {
     mPartialUpdate = true;
     mMaybeUpdatedRegion = *aRegion;
   } else {
     mPartialUpdate = false;
   }
-  if (GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
+  if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
     DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
     NS_WARN_IF_FALSE(result, "Failed to upload a texture");
   }
 }
 
 void
 BufferTextureHost::SetCompositor(Compositor* aCompositor)
 {
@@ -406,19 +406,19 @@ BufferTextureHost::Upload(nsIntRegion *a
       return true;
     }
 
     RefPtr<DataTextureSource> srcY;
     RefPtr<DataTextureSource> srcU;
     RefPtr<DataTextureSource> srcV;
     if (!mFirstSource) {
       // We don't support BigImages for YCbCr compositing.
-      srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
-      srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
-      srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
+      srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
+      srcU = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
+      srcV = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
       mFirstSource = srcY;
       srcY->SetNextSibling(srcU);
       srcU->SetNextSibling(srcV);
     } else {
       // mFormat never changes so if this was created as a YCbCr host and already
       // contains a source it should already have 3 sources.
       // BufferTextureHost only uses DataTextureSources so it is safe to assume
       // all 3 sources are DataTextureSource.
@@ -564,17 +564,17 @@ MemoryTextureHost::MemoryTextureHost(uin
 , mBuffer(aBuffer)
 {
   MOZ_COUNT_CTOR(MemoryTextureHost);
 }
 
 MemoryTextureHost::~MemoryTextureHost()
 {
   DeallocateDeviceData();
-  NS_ASSERTION(!mBuffer || (mFlags & TEXTURE_DEALLOCATE_CLIENT),
+  NS_ASSERTION(!mBuffer || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
                "Leaking our buffer");
   MOZ_COUNT_DTOR(MemoryTextureHost);
 }
 
 void
 MemoryTextureHost::DeallocateSharedData()
 {
   if (mBuffer) {
@@ -639,17 +639,17 @@ TextureParent::CompositorRecycle()
       // In this case, HWC implicitly handles buffer's fence.
     }
   }
 #endif
   mozilla::unused << SendCompositorRecycle(handle);
 
   // Don't forget to prepare for the next reycle
   // if TextureClient request it.
-  if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
+  if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
     mWaitForClientRecycle = mTextureHost;
   }
 }
 
 bool
 TextureParent::RecvClientRecycle()
 {
   // This will allow the RecycleCallback to be called once the compositor
@@ -666,17 +666,17 @@ bool
 TextureParent::Init(const SurfaceDescriptor& aSharedData,
                     const TextureFlags& aFlags)
 {
   mTextureHost = TextureHost::Create(aSharedData,
                                      mAllocator,
                                      aFlags);
   if (mTextureHost) {
     mTextureHost->mActor = this;
-    if (aFlags & TEXTURE_RECYCLE) {
+    if (aFlags & TextureFlags::RECYCLE) {
       mWaitForClientRecycle = mTextureHost;
       RECYCLE_LOG("Setup recycling for tile %p\n", this);
     }
   }
 
   return !!mTextureHost;
 }
 
@@ -706,21 +706,21 @@ TextureParent::ActorDestroy(ActorDestroy
   case Deletion:
   case NormalShutdown:
   case AbnormalShutdown:
     break;
   case FailedConstructor:
     NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
   }
 
-  if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
+  if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
     RECYCLE_LOG("clear recycling for tile %p\n", this);
     mTextureHost->ClearRecycleCallback();
   }
-  if (mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
+  if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
     mTextureHost->ForgetSharedData();
   }
 
   // Clear recycle callback.
   mTextureHost->ClearRecycleCallback();
   mWaitForClientRecycle = nullptr;
 
   mTextureHost->mActor = nullptr;
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -119,17 +119,17 @@ TiledLayerBufferComposite::ReleaseTextur
 }
 
 void
 TiledLayerBufferComposite::Upload()
 {
   if(!IsValid()) {
     return;
   }
-  // The TextureClients were created with the TEXTURE_IMMEDIATE_UPLOAD flag,
+  // The TextureClients were created with the TextureFlags::IMMEDIATE_UPLOAD flag,
   // so calling Update on all the texture hosts will perform the texture upload.
   Update(mValidRegion, mPaintedRegion);
   ClearPaintedRegion();
 }
 
 TileHost
 TiledLayerBufferComposite::ValidateTile(TileHost aTile,
                                         const nsIntPoint& aTileOrigin,
@@ -140,17 +140,17 @@ TiledLayerBufferComposite::ValidateTile(
     return aTile;
   }
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   printf_stderr("Upload tile %i, %i\n", aTileOrigin.x, aTileOrigin.y);
   long start = PR_IntervalNow();
 #endif
 
-  MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD);
+  MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD);
   // We possibly upload the entire texture contents here. This is a purposeful
   // decision, as sub-image upload can often be slow and/or unreliable, but
   // we may want to reevaluate this in the future.
   // For !HasInternalBuffer() textures, this is likely a no-op.
   aTile.mTextureHost->Updated(nullptr);
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 1) {
--- a/gfx/layers/composite/X11TextureHost.cpp
+++ b/gfx/layers/composite/X11TextureHost.cpp
@@ -20,17 +20,17 @@ using namespace mozilla::gfx;
 X11TextureHost::X11TextureHost(TextureFlags aFlags,
                                const SurfaceDescriptorX11& aDescriptor)
  : TextureHost(aFlags)
 {
   nsRefPtr<gfxXlibSurface> surface = aDescriptor.OpenForeign();
   mSurface = surface.get();
 
   // The host always frees the pixmap.
-  MOZ_ASSERT(!(aFlags & TEXTURE_DEALLOCATE_CLIENT));
+  MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT));
   mSurface->TakePixmap();
 }
 
 bool
 X11TextureHost::Lock()
 {
   if (!mCompositor) {
     return false;
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -356,17 +356,17 @@ DataTextureSourceD3D11::Update(DataSourc
   mFormat = aSurface->GetFormat();
 
   CD3D11_TEXTURE2D_DESC desc(dxgiFormat, mSize.width, mSize.height,
                              1, 1, D3D11_BIND_SHADER_RESOURCE,
                              D3D11_USAGE_IMMUTABLE);
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
+      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
     D3D11_SUBRESOURCE_DATA initData;
     initData.pSysMem = aSurface->GetData();
     initData.SysMemPitch = aSurface->Stride();
 
     mCompositor->GetDevice()->CreateTexture2D(&desc, &initData, byRef(mTexture));
     mIsTiled = false;
     if (!mTexture) {
       Reset();
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -407,17 +407,17 @@ DataTextureSourceD3D9::Update(gfx::DataS
   default:
     NS_WARNING("Bad image format");
     return false;
   }
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
+      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
     mTexture = DataToTexture(deviceManager,
                              aSurface->GetData(), aSurface->Stride(),
                              IntSize(mSize), format, bpp);
     if (!mTexture) {
       NS_WARNING("Could not upload texture");
       Reset();
       return false;
     }
@@ -482,17 +482,17 @@ DataTextureSourceD3D9::Update(gfxWindows
   default:
     NS_WARNING("Bad image format");
     return false;
   }
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
+      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
     mTexture = SurfaceToTexture(deviceManager, aSurface, mSize, format);
 
     if (!mTexture) {
       NS_WARNING("Could not upload texture");
       Reset();
       return false;
     }
     mIsTiled = false;
--- a/gfx/layers/d3d9/TextureD3D9.h
+++ b/gfx/layers/d3d9/TextureD3D9.h
@@ -101,24 +101,24 @@ protected:
  */
 class DataTextureSourceD3D9 : public DataTextureSource
                             , public TextureSourceD3D9
                             , public TileIterator
 {
 public:
   DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
                         CompositorD3D9* aCompositor,
-                        TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
+                        TextureFlags aFlags = TextureFlags::DEFAULT,
                         StereoMode aStereoMode = StereoMode::MONO);
 
   DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
                         gfx::IntSize aSize,
                         CompositorD3D9* aCompositor,
                         IDirect3DTexture9* aTexture,
-                        TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+                        TextureFlags aFlags = TextureFlags::DEFAULT);
 
   virtual ~DataTextureSourceD3D9();
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) MOZ_OVERRIDE;
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -913,17 +913,17 @@ ImageBridgeChild::CreateTexture(const Su
 {
   return SendPTextureConstructor(aSharedData, aFlags);
 }
 
 void
 ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
                                                 TextureClient* aTexture)
 {
-  if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
+  if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
     mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                   nullptr, aTexture->GetIPDLActor()));
   } else {
     mTxn->AddNoSwapEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                         nullptr, aTexture->GetIPDLActor()));
   }
   // Hold texture until transaction complete.
   HoldUntilTransaction(aTexture);
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -362,17 +362,17 @@ ShadowLayerForwarder::UpdatedTexture(Com
                                      nsIntRegion* aRegion)
 {
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aTexture);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   MOZ_ASSERT(aTexture->GetIPDLActor());
   MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
                                : MaybeRegion(null_t());
-  if (aTexture->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
+  if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
     mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
                                    nullptr, aTexture->GetIPDLActor(),
                                    region));
   } else {
     mTxn->AddNoSwapPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
                                          nullptr, aTexture->GetIPDLActor(),
                                          region));
   }
@@ -412,17 +412,17 @@ ShadowLayerForwarder::RemoveTextureFromC
                                                     TextureClient* aTexture)
 {
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aTexture);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   MOZ_ASSERT(aTexture->GetIPDLActor());
   mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                 nullptr, aTexture->GetIPDLActor()));
-  if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
+  if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
     mTxn->MarkSyncTransaction();
   }
   // Hold texture until transaction complete.
   HoldUntilTransaction(aTexture);
 }
 
 void
 ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -229,24 +229,24 @@ GrallocTextureClientOGL::AllocateForSurf
                    android::GraphicBuffer::USAGE_HW_TEXTURE;
 
   switch (mFormat) {
   case gfx::SurfaceFormat::R8G8B8A8:
     format = android::PIXEL_FORMAT_RGBA_8888;
     break;
   case gfx::SurfaceFormat::B8G8R8A8:
      format = android::PIXEL_FORMAT_RGBA_8888;
-     mFlags |= TEXTURE_RB_SWAPPED;
+     mFlags |= TextureFlags::RB_SWAPPED;
     break;
   case gfx::SurfaceFormat::R8G8B8X8:
     format = android::PIXEL_FORMAT_RGBX_8888;
     break;
   case gfx::SurfaceFormat::B8G8R8X8:
      format = android::PIXEL_FORMAT_RGBX_8888;
-     mFlags |= TEXTURE_RB_SWAPPED;
+     mFlags |= TextureFlags::RB_SWAPPED;
     break;
   case gfx::SurfaceFormat::R5G6B5:
     format = android::PIXEL_FORMAT_RGB_565;
     break;
   case gfx::SurfaceFormat::A8:
     NS_WARNING("gralloc does not support gfx::SurfaceFormat::A8");
     return false;
   default:
--- a/gfx/layers/opengl/GrallocTextureClient.h
+++ b/gfx/layers/opengl/GrallocTextureClient.h
@@ -35,21 +35,21 @@ namespace layers {
  * This is only used in Firefox OS
  */
 class GrallocTextureClientOGL : public BufferTextureClient
 {
 public:
   GrallocTextureClientOGL(GrallocBufferActor* aActor,
                           gfx::IntSize aSize,
                           gfx::BackendType aMoz2dBackend,
-                          TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+                          TextureFlags aFlags = TextureFlags::DEFAULT);
   GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
                           gfx::SurfaceFormat aFormat,
                           gfx::BackendType aMoz2dBackend,
-                          TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
+                          TextureFlags aFlags = TextureFlags::DEFAULT);
 
   ~GrallocTextureClientOGL();
 
   virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
 
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual bool ImplementsLocking() const MOZ_OVERRIDE { return true; }
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -285,17 +285,17 @@ GrallocTextureHostOGL::GrallocTextureHos
   if (mGrallocActor) {
     mGrallocActor->AddTextureHost(this);
     graphicBuffer = mGrallocActor->GetGraphicBuffer();
   }
 
   if (graphicBuffer) {
     format =
       SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
-                                         aFlags & TEXTURE_RB_SWAPPED);
+                                         aFlags & TextureFlags::RB_SWAPPED);
   }
   mTextureSource = new GrallocTextureSourceOGL(nullptr,
                                                graphicBuffer,
                                                format);
 }
 
 GrallocTextureHostOGL::~GrallocTextureHostOGL()
 {
@@ -365,20 +365,20 @@ GrallocTextureHostOGL::DeallocateDeviceD
   mTextureSource->DeallocateDeviceData();
 }
 
 LayerRenderState
 GrallocTextureHostOGL::GetRenderState()
 {
   if (IsValid()) {
     uint32_t flags = 0;
-    if (mFlags & TEXTURE_NEEDS_Y_FLIP) {
+    if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
       flags |= LAYER_RENDER_STATE_Y_FLIPPED;
     }
-    if (mFlags & TEXTURE_RB_SWAPPED) {
+    if (mFlags & TextureFlags::RB_SWAPPED) {
       flags |= LAYER_RENDER_STATE_FORMAT_RB_SWAP;
     }
     return LayerRenderState(mTextureSource->mGraphicBuffer.get(),
                             gfx::ThebesIntSize(mSize),
                             flags,
                             this);
   }
 
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -18,17 +18,17 @@ namespace layers {
 class CompositableForwarder;
 
 SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
   : TextureClient(aFlags)
   , mHandle(0)
   , mInverted(false)
 {
   // SharedTextureClient is always owned externally.
-  mFlags |= TEXTURE_DEALLOCATE_CLIENT;
+  mFlags |= TextureFlags::DEALLOCATE_CLIENT;
 }
 
 SharedTextureClientOGL::~SharedTextureClientOGL()
 {
   // the shared data is owned externally.
 }
 
 
@@ -51,17 +51,17 @@ SharedTextureClientOGL::InitWith(gl::Sha
 {
   MOZ_ASSERT(IsValid());
   MOZ_ASSERT(!IsAllocated());
   mHandle = aHandle;
   mSize = aSize;
   mShareType = aShareType;
   mInverted = aInverted;
   if (mInverted) {
-    AddFlags(TEXTURE_NEEDS_Y_FLIP);
+    AddFlags(TextureFlags::NEEDS_Y_FLIP);
   }
 }
 
 bool
 SharedTextureClientOGL::Lock(OpenMode mode)
 {
   MOZ_ASSERT(!mIsLocked);
   if (!IsValid() || !IsAllocated()) {
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -101,21 +101,21 @@ CreateTextureHostOGL(const SurfaceDescri
   return result.forget();
 }
 
 static gl::TextureImage::Flags
 FlagsToGLFlags(TextureFlags aFlags)
 {
   uint32_t result = TextureImage::NoFlags;
 
-  if (aFlags & TEXTURE_USE_NEAREST_FILTER)
+  if (aFlags & TextureFlags::USE_NEAREST_FILTER)
     result |= TextureImage::UseNearestFilter;
-  if (aFlags & TEXTURE_NEEDS_Y_FLIP)
+  if (aFlags & TextureFlags::NEEDS_Y_FLIP)
     result |= TextureImage::NeedsYFlip;
-  if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
+  if (aFlags & TextureFlags::DISALLOW_BIGIMAGE)
     result |= TextureImage::DisallowBigImage;
 
   return static_cast<gl::TextureImage::Flags>(result);
 }
 
 GLenum
 WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
 {
@@ -224,31 +224,31 @@ TextureImageTextureSourceOGL::Update(gfx
     return false;
   }
   MOZ_ASSERT(aSurface);
 
   IntSize size = aSurface->GetSize();
   if (!mTexImage ||
       (mTexImage->GetSize() != size && !aSrcOffset) ||
       mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
-    if (mFlags & TEXTURE_DISALLOW_BIGIMAGE) {
+    if (mFlags & TextureFlags::DISALLOW_BIGIMAGE) {
       mTexImage = CreateBasicTextureImage(mGL, size,
                                           gfx::ContentForFormat(aSurface->GetFormat()),
-                                          WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
+                                          WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
                                           FlagsToGLFlags(mFlags),
                                           SurfaceFormatToImageFormat(aSurface->GetFormat()));
     } else {
       // XXX - clarify which size we want to use. IncrementalContentHost will
       // require the size of the destination surface to be different from
       // the size of aSurface.
       // See bug 893300 (tracks the implementation of ContentHost for new textures).
       mTexImage = CreateTextureImage(mGL,
                                      size,
                                      gfx::ContentForFormat(aSurface->GetFormat()),
-                                     WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
+                                     WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
                                      FlagsToGLFlags(mFlags),
                                      SurfaceFormatToImageFormat(aSurface->GetFormat()));
     }
     ClearCachedFilter();
   }
 
   mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset);
 
@@ -263,17 +263,17 @@ TextureImageTextureSourceOGL::EnsureBuff
                                            gfxContentType aContentType)
 {
   if (!mTexImage ||
       mTexImage->GetSize() != aSize.ToIntSize() ||
       mTexImage->GetContentType() != aContentType) {
     mTexImage = CreateTextureImage(mGL,
                                    aSize.ToIntSize(),
                                    aContentType,
-                                   WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
+                                   WrapMode(mGL, mFlags & TextureFlags::ALLOW_REPEAT),
                                    FlagsToGLFlags(mFlags));
   }
   mTexImage->Resize(aSize.ToIntSize());
 }
 
 void
 TextureImageTextureSourceOGL::CopyTo(const nsIntRect& aSourceRect,
                                      DataTextureSource *aDest,
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -191,17 +191,17 @@ protected:
  * GL texture(s).
  */
 class TextureImageTextureSourceOGL : public DataTextureSource
                                    , public TextureSourceOGL
                                    , public TileIterator
 {
 public:
   TextureImageTextureSourceOGL(gl::GLContext* aGL,
-                               TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT)
+                               TextureFlags aFlags = TextureFlags::DEFAULT)
     : mGL(aGL)
     , mFlags(aFlags)
     , mIterating(false)
   {}
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,