Backed out 8 changesets (bug 1265824) for bustage in /builds/worker/workspace/build/src/gfx/layers/opengl/CompositorOGL.cpp on a CLOSED TREE
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Thu, 19 Jul 2018 09:33:28 +0300
changeset 427261 0051840a2dd03d4bb9b27649feb54537e5031bde
parent 427260 1099d6f15f9f519af3f525c4a2b0561793b25b97
child 427262 25c83a66f294a9790f2a91691837e94d098bd6b0
push id105426
push userrgurzau@mozilla.com
push dateThu, 19 Jul 2018 10:02:29 +0000
treeherdermozilla-inbound@a1e60967e3c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1265824
milestone63.0a1
backs out1099d6f15f9f519af3f525c4a2b0561793b25b97
b5ba15b1a70f15b37b494bddc92c569799e1f974
51795de4adaf5336217132cad336f15a73306940
be68741ff4ce5db30f1474b1124a538bede50bdd
4731dc56702d56283e2b1b9044afa571347d88e3
984133e9614baa845a6dca7fc2cc6ca50cbb1687
efce316a4425c1e91f9b409806c6df3e6a7df99b
367abce3066851d02ad7433b194fc0bea810d8c1
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
Backed out 8 changesets (bug 1265824) for bustage in /builds/worker/workspace/build/src/gfx/layers/opengl/CompositorOGL.cpp on a CLOSED TREE Backed out changeset 1099d6f15f9f (bug 1265824) Backed out changeset b5ba15b1a70f (bug 1265824) Backed out changeset 51795de4adaf (bug 1265824) Backed out changeset be68741ff4ce (bug 1265824) Backed out changeset 4731dc56702d (bug 1265824) Backed out changeset 984133e9614b (bug 1265824) Backed out changeset efce316a4425 (bug 1265824) Backed out changeset 367abce30668 (bug 1265824)
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextSymbols.h
gfx/layers/BufferTexture.cpp
gfx/layers/BufferTexture.h
gfx/layers/CompositorTypes.h
gfx/layers/TextureSourceProvider.cpp
gfx/layers/TextureSourceProvider.h
gfx/layers/TextureSync.cpp
gfx/layers/TextureSync.h
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ContentClient.cpp
gfx/layers/client/MultiTiledContentClient.cpp
gfx/layers/client/MultiTiledContentClient.h
gfx/layers/client/SingleTiledContentClient.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/client/TextureClient.h
gfx/layers/client/TextureClientPool.cpp
gfx/layers/client/TextureClientPool.h
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/ipc/CompositorBridgeChild.cpp
gfx/layers/ipc/KnowsCompositor.h
gfx/layers/ipc/LayersMessageUtils.h
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
gfx/layers/moz.build
gfx/layers/opengl/CompositorOGL.cpp
gfx/layers/opengl/CompositorOGL.h
gfx/layers/opengl/TextureHostOGL.cpp
gfx/layers/opengl/TextureHostOGL.h
gfx/thebes/gfxPrefs.h
ipc/glue/SharedMemoryBasic_mach.h
ipc/glue/SharedMemoryBasic_mach.mm
xpcom/base/StaticMonitor.h
xpcom/base/moz.build
xpcom/threads/BlockingResourceBase.cpp
xpcom/threads/CondVar.h
xpcom/threads/Mutex.h
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -76,17 +76,16 @@ static const char* const sExtensionNames
     "GL_ANGLE_depth_texture",
     "GL_ANGLE_framebuffer_blit",
     "GL_ANGLE_framebuffer_multisample",
     "GL_ANGLE_instanced_arrays",
     "GL_ANGLE_texture_compression_dxt3",
     "GL_ANGLE_texture_compression_dxt5",
     "GL_ANGLE_timer_query",
     "GL_APPLE_client_storage",
-    "GL_APPLE_fence",
     "GL_APPLE_framebuffer_multisample",
     "GL_APPLE_sync",
     "GL_APPLE_texture_range",
     "GL_APPLE_vertex_array_object",
     "GL_ARB_ES2_compatibility",
     "GL_ARB_ES3_compatibility",
     "GL_ARB_color_buffer_float",
     "GL_ARB_compatibility",
@@ -1076,25 +1075,16 @@ GLContext::LoadMoreSymbols(const char* p
     if (IsExtensionSupported(APPLE_texture_range)) {
         const SymLoadStruct symbols[] = {
             { (PRFuncPtr*) &mSymbols.fTextureRangeAPPLE, { "TextureRangeAPPLE", nullptr } },
             END_SYMBOLS
         };
         fnLoadForExt(symbols, APPLE_texture_range);
     }
 
-    if (IsExtensionSupported(APPLE_fence)) {
-        const SymLoadStruct symbols[] = {
-            { (PRFuncPtr*) &mSymbols.fFinishObjectAPPLE, { "FinishObjectAPPLE", nullptr } },
-            { (PRFuncPtr*) &mSymbols.fTestObjectAPPLE, { "TestObjectAPPLE", nullptr } },
-            END_SYMBOLS
-        };
-        fnLoadForExt(symbols, APPLE_fence);
-    }
-
     if (IsSupported(GLFeature::vertex_array_object)) {
         const SymLoadStruct coreSymbols[] = {
             { (PRFuncPtr*) &mSymbols.fIsVertexArray, { "IsVertexArray", nullptr } },
             { (PRFuncPtr*) &mSymbols.fGenVertexArrays, { "GenVertexArrays", nullptr } },
             { (PRFuncPtr*) &mSymbols.fBindVertexArray, { "BindVertexArray", nullptr } },
             { (PRFuncPtr*) &mSymbols.fDeleteVertexArrays, { "DeleteVertexArrays", nullptr } },
             END_SYMBOLS
         };
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -375,17 +375,16 @@ public:
         ANGLE_depth_texture,
         ANGLE_framebuffer_blit,
         ANGLE_framebuffer_multisample,
         ANGLE_instanced_arrays,
         ANGLE_texture_compression_dxt3,
         ANGLE_texture_compression_dxt5,
         ANGLE_timer_query,
         APPLE_client_storage,
-        APPLE_fence,
         APPLE_framebuffer_multisample,
         APPLE_sync,
         APPLE_texture_range,
         APPLE_vertex_array_object,
         ARB_ES2_compatibility,
         ARB_ES3_compatibility,
         ARB_color_buffer_float,
         ARB_compatibility,
@@ -3299,35 +3298,16 @@ public:
     void fResolveMultisampleFramebufferAPPLE() {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fResolveMultisampleFramebufferAPPLE);
         mSymbols.fResolveMultisampleFramebufferAPPLE();
         AFTER_GL_CALL;
     }
 
 // -----------------------------------------------------------------------------
-// APPLE_fence
-
-    void fFinishObjectAPPLE(GLenum object, GLint name) {
-        BEFORE_GL_CALL;
-        ASSERT_SYMBOL_PRESENT(fFinishObjectAPPLE);
-        mSymbols.fFinishObjectAPPLE(object, name);
-        AFTER_GL_CALL;
-    }
-
-    realGLboolean fTestObjectAPPLE(GLenum object, GLint name) {
-        realGLboolean ret = false;
-        BEFORE_GL_CALL;
-        ASSERT_SYMBOL_PRESENT(fTestObjectAPPLE);
-        ret = mSymbols.fTestObjectAPPLE(object, name);
-        AFTER_GL_CALL;
-        return ret;
-    }
-
-// -----------------------------------------------------------------------------
 // prim_restart
 
     void fPrimitiveRestartIndex(GLuint index) {
         BEFORE_GL_CALL;
         ASSERT_SYMBOL_PRESENT(fPrimitiveRestartIndex);
         mSymbols.fPrimitiveRestartIndex(index);
         AFTER_GL_CALL;
     }
--- a/gfx/gl/GLContextSymbols.h
+++ b/gfx/gl/GLContextSymbols.h
@@ -132,18 +132,16 @@ struct GLContextSymbols final
     void (GLAPIENTRY * fStencilMaskSeparate)(GLenum, GLuint);
     void (GLAPIENTRY * fStencilOp)(GLenum, GLenum, GLenum);
     void (GLAPIENTRY * fStencilOpSeparate)(GLenum, GLenum, GLenum, GLenum);
     void (GLAPIENTRY * fTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint,
                                     GLenum, GLenum, const GLvoid*);
     void (GLAPIENTRY * fTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei,
                                         GLsizei, GLenum, GLenum, const void*);
     void (GLAPIENTRY * fTextureRangeAPPLE)(GLenum, GLsizei, GLvoid*);
-    void (GLAPIENTRY * fFinishObjectAPPLE)(GLenum, GLint);
-    realGLboolean (GLAPIENTRY * fTestObjectAPPLE)(GLenum, GLint);
     void (GLAPIENTRY * fUniform1f)(GLint, GLfloat);
     void (GLAPIENTRY * fUniform1fv)(GLint, GLsizei, const GLfloat*);
     void (GLAPIENTRY * fUniform1i)(GLint, GLint);
     void (GLAPIENTRY * fUniform1iv)(GLint, GLsizei, const GLint*);
     void (GLAPIENTRY * fUniform2f)(GLint, GLfloat, GLfloat);
     void (GLAPIENTRY * fUniform2fv)(GLint, GLsizei, const GLfloat*);
     void (GLAPIENTRY * fUniform2i)(GLint, GLint, GLint);
     void (GLAPIENTRY * fUniform2iv)(GLint, GLsizei, const GLint*);
--- a/gfx/layers/BufferTexture.cpp
+++ b/gfx/layers/BufferTexture.cpp
@@ -100,23 +100,18 @@ static bool UsingX11Compositor()
 {
 #ifdef MOZ_WIDGET_GTK
   return gfx::gfxVars::UseXRender();
 #endif
   return false;
 }
 
 bool ComputeHasIntermediateBuffer(gfx::SurfaceFormat aFormat,
-                                  LayersBackend aLayersBackend,
-                                  bool aSupportsTextureDirectMapping)
+                                  LayersBackend aLayersBackend)
 {
-  if (aSupportsTextureDirectMapping) {
-    return false;
-  }
-
   return aLayersBackend != LayersBackend::LAYERS_BASIC
       || UsingX11Compositor()
       || aFormat == gfx::SurfaceFormat::UNKNOWN;
 }
 
 BufferTextureData*
 BufferTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                           gfx::BackendType aMoz2DBackend,
@@ -168,18 +163,17 @@ BufferTextureData::CreateForYCbCrWithBuf
                                                 uint32_t aBitDepth,
                                                 TextureFlags aTextureFlags)
 {
   if (aBufferSize == 0 || !gfx::Factory::CheckBufferSize(aBufferSize)) {
     return nullptr;
   }
 
   bool hasIntermediateBuffer = aAllocator ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
-                                                                         aAllocator->GetCompositorBackendType(),
-                                                                         aAllocator->SupportsTextureDirectMapping())
+                                                                         aAllocator->GetCompositorBackendType())
                                           : true;
 
   // Initialize the metadata with something, even if it will have to be rewritten
   // afterwards since we don't know the dimensions of the texture at this point.
   BufferDescriptor desc = YCbCrDescriptor(gfx::IntSize(), 0, gfx::IntSize(), 0,
                                           0, 0, 0, StereoMode::MONO,
                                           aYUVColorSpace,
                                           aBitDepth,
@@ -211,18 +205,17 @@ BufferTextureData::CreateForYCbCr(KnowsC
   uint32_t crOffset;
   ImageDataSerializer::ComputeYCbCrOffsets(aYStride, aYSize.height,
                                            aCbCrStride, aCbCrSize.height,
                                            yOffset, cbOffset, crOffset);
 
   bool hasIntermediateBuffer =
     aAllocator
       ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
-                                     aAllocator->GetCompositorBackendType(),
-                                     aAllocator->SupportsTextureDirectMapping())
+                                     aAllocator->GetCompositorBackendType())
       : true;
 
   YCbCrDescriptor descriptor = YCbCrDescriptor(aYSize, aYStride,
                                                aCbCrSize, aCbCrStride,
                                                yOffset, cbOffset, crOffset,
                                                aStereoMode,
                                                aYUVColorSpace,
                                                aBitDepth,
@@ -527,19 +520,17 @@ MemoryTextureData::Create(gfx::IntSize a
     return nullptr;
   }
 
   uint8_t* buf = new (fallible) uint8_t[bufSize];
   if (!InitBuffer(buf, bufSize, aFormat, aAllocFlags, false)) {
     return nullptr;
   }
 
-  bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat,
-                                                            aLayersBackend,
-                                                            aAllocFlags & ALLOC_ALLOW_DIRECT_MAPPING);
+  bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat, aLayersBackend);
 
   GfxMemoryImageReporter::DidAlloc(buf);
 
   BufferDescriptor descriptor = RGBDescriptor(aSize, aFormat, hasIntermediateBuffer);
 
   return new MemoryTextureData(descriptor, aMoz2DBackend, buf, bufSize);
 }
 
@@ -605,19 +596,17 @@ ShmemTextureData::Create(gfx::IntSize aS
     return nullptr;
   }
 
   uint8_t* buf = shm.get<uint8_t>();
   if (!InitBuffer(buf, bufSize, aFormat, aAllocFlags, true)) {
     return nullptr;
   }
 
-  bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat,
-                                                            aLayersBackend,
-                                                            aAllocFlags & ALLOC_ALLOW_DIRECT_MAPPING);
+  bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat, aLayersBackend);
 
   BufferDescriptor descriptor = RGBDescriptor(aSize, aFormat, hasIntermediateBuffer);
 
   return new ShmemTextureData(descriptor, aMoz2DBackend, shm);
 
   return nullptr;
 }
 
--- a/gfx/layers/BufferTexture.h
+++ b/gfx/layers/BufferTexture.h
@@ -12,18 +12,17 @@
 #include "mozilla/gfx/Types.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 
 namespace mozilla {
 namespace layers {
 
 bool ComputeHasIntermediateBuffer(gfx::SurfaceFormat aFormat,
-                                  LayersBackend aLayersBackend,
-                                  bool aSupportsTextureDirectMapping);
+                                  LayersBackend aLayersBackend);
 
 class BufferTextureData : public TextureData
 {
 public:
   static BufferTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
                                    gfx::BackendType aMoz2DBackend,
                                    LayersBackend aLayersBackend,
                                    TextureFlags aFlags,
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -170,56 +170,51 @@ typedef uintptr_t SyncHandle;
  * of the compositor and should (in the future) include information about what
  * kinds of buffer and texture clients to create.
  */
 struct TextureFactoryIdentifier
 {
   LayersBackend mParentBackend;
   GeckoProcessType mParentProcessType;
   int32_t mMaxTextureSize;
-  bool mSupportsTextureDirectMapping;
   bool mCompositorUseANGLE;
   bool mSupportsTextureBlitting;
   bool mSupportsPartialUploads;
   bool mSupportsComponentAlpha;
   bool mUsingAdvancedLayers;
   SyncHandle mSyncHandle;
 
   explicit TextureFactoryIdentifier(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
                                     GeckoProcessType aParentProcessType = GeckoProcessType_Default,
                                     int32_t aMaxTextureSize = 4096,
-                                    bool aSupportsTextureDirectMapping = false,
                                     bool aCompositorUseANGLE = false,
                                     bool aSupportsTextureBlitting = false,
                                     bool aSupportsPartialUploads = false,
                                     bool aSupportsComponentAlpha = true,
                                     SyncHandle aSyncHandle = 0)
     : mParentBackend(aLayersBackend)
     , mParentProcessType(aParentProcessType)
     , mMaxTextureSize(aMaxTextureSize)
-    , mSupportsTextureDirectMapping(aSupportsTextureDirectMapping)
     , mCompositorUseANGLE(aCompositorUseANGLE)
     , mSupportsTextureBlitting(aSupportsTextureBlitting)
     , mSupportsPartialUploads(aSupportsPartialUploads)
     , mSupportsComponentAlpha(aSupportsComponentAlpha)
     , mUsingAdvancedLayers(false)
     , mSyncHandle(aSyncHandle)
   {}
 
   bool operator==(const TextureFactoryIdentifier& aOther) const {
     return
       mParentBackend == aOther.mParentBackend &&
       mParentProcessType == aOther.mParentProcessType &&
       mMaxTextureSize == aOther.mMaxTextureSize &&
-      mSupportsTextureDirectMapping == aOther.mSupportsTextureDirectMapping &&
       mCompositorUseANGLE == aOther.mCompositorUseANGLE &&
       mSupportsTextureBlitting == aOther.mSupportsTextureBlitting &&
       mSupportsPartialUploads == aOther.mSupportsPartialUploads &&
       mSupportsComponentAlpha == aOther.mSupportsComponentAlpha &&
-      mUsingAdvancedLayers == aOther.mUsingAdvancedLayers &&
       mSyncHandle == aOther.mSyncHandle;
   }
 };
 
 /**
  * Information required by the compositor from the content-side for creating or
  * using compositables and textures.
  * XXX - TextureInfo is a bad name: this information is useful for the compositable,
--- a/gfx/layers/TextureSourceProvider.cpp
+++ b/gfx/layers/TextureSourceProvider.cpp
@@ -1,56 +1,31 @@
 /* -*- 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/. */
 
 #include "mozilla/layers/TextureSourceProvider.h"
 #include "mozilla/layers/TextureHost.h"
-#include "mozilla/layers/PTextureParent.h"
-#ifdef XP_DARWIN
-#include "mozilla/layers/TextureSync.h"
-#endif
 
 namespace mozilla {
 namespace layers {
 
 TextureSourceProvider::~TextureSourceProvider()
 {
   ReadUnlockTextures();
 }
 
 void
 TextureSourceProvider::ReadUnlockTextures()
 {
-#ifdef XP_DARWIN
-  nsClassHashtable<nsUint32HashKey, nsTArray<uint64_t>> texturesIdsToUnlockByPid;
-  for (auto& texture : mUnlockAfterComposition) {
-    auto bufferTexture = texture->AsBufferTextureHost();
-    if (bufferTexture && bufferTexture->IsDirectMap()) {
-      texture->ReadUnlock();
-      auto actor = texture->GetIPDLActor();
-      if (actor) {
-        base::ProcessId pid = actor->OtherPid();
-        nsTArray<uint64_t>* textureIds = texturesIdsToUnlockByPid.LookupOrAdd(pid);
-        textureIds->AppendElement(TextureHost::GetTextureSerial(actor));
-      }
-    } else {
-      texture->ReadUnlock();
-    }
-  }
-  for (auto it = texturesIdsToUnlockByPid.ConstIter(); !it.Done(); it.Next()) {
-    TextureSync::SetTexturesUnlocked(it.Key(), *it.UserData());
-  }
-#else
   for (auto& texture : mUnlockAfterComposition) {
     texture->ReadUnlock();
   }
-#endif
   mUnlockAfterComposition.Clear();
 }
 
 void
 TextureSourceProvider::UnlockAfterComposition(TextureHost* aTexture)
 {
   mUnlockAfterComposition.AppendElement(aTexture);
 }
--- a/gfx/layers/TextureSourceProvider.h
+++ b/gfx/layers/TextureSourceProvider.h
@@ -69,19 +69,16 @@ public:
   /// wait for the end of the next composition before NotifyNotUsed() call.
   /// This function provides a convenient way to do this delayed NotifyNotUsed()
   /// call, if the texture itself requires it.
   /// See bug 1260611 and bug 1252835
   ///
   /// Returns true if notified, false otherwise.
   virtual bool NotifyNotUsedAfterComposition(TextureHost* aTextureHost);
 
-  virtual void MaybeUnlockBeforeNextComposition(TextureHost* aTextureHost) {}
-  virtual void TryUnlockTextures() {}
-
   // If overridden, make sure to call the base function.
   virtual void Destroy();
 
   void FlushPendingNotifyNotUsed();
 
   // If this provider is also a Compositor, return the compositor. Otherwise return
   // null.
   virtual Compositor* AsCompositor() {
deleted file mode 100644
--- a/gfx/layers/TextureSync.cpp
+++ /dev/null
@@ -1,287 +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/. */
-
-#include "TextureSync.h"
-
-#include <unordered_set>
-
-#include "chrome/common/mach_ipc_mac.h"
-#include "mozilla/ipc/SharedMemoryBasic.h"
-#include "mozilla/layers/CompositorThread.h"
-#include "mozilla/StaticMonitor.h"
-#include "mozilla/StaticPtr.h"
-
-#ifdef DEBUG
-#define LOG_ERROR(str, args...)                                   \
-  PR_BEGIN_MACRO                                                  \
-  mozilla::SmprintfPointer msg = mozilla::Smprintf(str, ## args); \
-  NS_WARNING(msg.get());                                          \
-  PR_END_MACRO
-#else
-#define LOG_ERROR(str, args...) do { /* nothing */ } while(0)
-#endif
-
-namespace mozilla {
-
-namespace layers {
-
-// Hold raw pointers and trust that TextureSourceProviders will be
-// unregistered in their destructors - we don't want to keep these
-// alive, and destroying them from the main thread will be an
-// error anyway.
-StaticAutoPtr<nsTArray<TextureSourceProvider*>> gTextureSourceProviders;
-
-static std::map<pid_t, std::unordered_set<uint64_t>> gProcessTextureIds;
-static StaticMonitor gTextureLockMonitor;
-
-const int kSendMessageTimeout = 1000;
-const int kTextureLockTimeout = 32; // We really don't want to wait more than
-                                    // two frames for a texture to unlock. This
-                                    // will in any case be very uncommon.
-
-struct WaitForTexturesReply
-{
-  bool success;
-};
-
-struct WaitForTexturesRequest
-{
-  pid_t pid;
-};
-
-std::unordered_set<uint64_t>*
-GetLockedTextureIdsForProcess(pid_t pid)
-{
-  gTextureLockMonitor.AssertCurrentThreadOwns();
-
-  if (gProcessTextureIds.find(pid) == gProcessTextureIds.end()) {
-    gProcessTextureIds[pid] = std::unordered_set<uint64_t>();
-  }
-
-  return &gProcessTextureIds.at(pid);
-}
-
-bool
-WaitForTextureIdsToUnlock(pid_t pid, const Span<const uint64_t>& textureIds)
-{
-  {
-    StaticMonitorAutoLock lock(gTextureLockMonitor);
-    std::unordered_set<uint64_t>* freedTextureIds = GetLockedTextureIdsForProcess(pid);
-
-    TimeStamp start = TimeStamp::Now();
-    while (true) {
-      bool allCleared = true;
-      for (uint64_t textureId : textureIds) {
-        if (freedTextureIds->find(textureId) != freedTextureIds->end()) {
-          allCleared = false;
-        }
-      }
-
-      if (allCleared) {
-        return true;
-      }
-
-      if (lock.Wait(TimeDuration::FromMilliseconds(kTextureLockTimeout)) == CVStatus::Timeout) {
-        return false;
-      }
-
-      // In case the monitor gets signaled multiple times, each less than kTextureLockTimeout.
-      // This ensures that the total time we wait is < 2 * kTextureLockTimeout
-      if ((TimeStamp::Now() - start).ToMilliseconds() > (double)kTextureLockTimeout) {
-        return false;
-      }
-    }
-  }
-}
-
-void
-CheckTexturesForUnlock()
-{
-  if (gTextureSourceProviders) {
-    for (auto it = gTextureSourceProviders->begin(); it != gTextureSourceProviders->end(); ++it) {
-      (*it)->TryUnlockTextures();
-    }
-  }
-}
-
-void
-TextureSync::DispatchCheckTexturesForUnlock()
-{
-  RefPtr<Runnable> task = NS_NewRunnableFunction(
-    "CheckTexturesForUnlock",
-    &CheckTexturesForUnlock);
-  CompositorThreadHolder::Loop()->PostTask(task.forget());
-}
-
-void
-TextureSync::HandleWaitForTexturesMessage(MachReceiveMessage* rmsg, ipc::MemoryPorts* ports)
-{
-  WaitForTexturesRequest* req = reinterpret_cast<WaitForTexturesRequest*>(rmsg->GetData());
-  uint64_t* textureIds = (uint64_t*)(req + 1);
-  uint32_t textureIdsLength = (rmsg->GetDataLength() - sizeof(WaitForTexturesRequest)) / sizeof(uint64_t);
-
-  bool success = WaitForTextureIdsToUnlock(req->pid, MakeSpan<uint64_t>(textureIds, textureIdsLength));
-
-  if (!success) {
-    LOG_ERROR("Waiting for textures to unlock failed.\n");
-  }
-
-  MachSendMessage msg(ipc::kReturnWaitForTexturesMsg);
-  WaitForTexturesReply replydata;
-  replydata.success = success;
-  msg.SetData(&replydata, sizeof(WaitForTexturesReply));
-  kern_return_t err = ports->mSender->SendMessage(msg, kSendMessageTimeout);
-  if (KERN_SUCCESS != err) {
-    LOG_ERROR("SendMessage failed 0x%x %s\n", err, mach_error_string(err));
-  }
-}
-
-void
-TextureSync::RegisterTextureSourceProvider(TextureSourceProvider* textureSourceProvider)
-{
-  if (!gTextureSourceProviders) {
-    gTextureSourceProviders = new nsTArray<TextureSourceProvider*>();
-  }
-  MOZ_RELEASE_ASSERT(!gTextureSourceProviders->Contains(textureSourceProvider));
-  gTextureSourceProviders->AppendElement(textureSourceProvider);
-}
-
-void
-TextureSync::UnregisterTextureSourceProvider(TextureSourceProvider* textureSourceProvider)
-{
-  if (gTextureSourceProviders) {
-    MOZ_ASSERT(gTextureSourceProviders->Contains(textureSourceProvider));
-    gTextureSourceProviders->RemoveElement(textureSourceProvider);
-    if (gTextureSourceProviders->Length() == 0) {
-      gTextureSourceProviders = nullptr;
-    }
-  }
-}
-
-void
-TextureSync::SetTexturesLocked(pid_t pid, const nsTArray<uint64_t>& textureIds)
-{
-  StaticMonitorAutoLock mal(gTextureLockMonitor);
-  std::unordered_set<uint64_t>* lockedTextureIds = GetLockedTextureIdsForProcess(pid);
-  for (uint64_t textureId : textureIds) {
-    lockedTextureIds->insert(textureId);
-  }
-}
-
-void
-TextureSync::SetTexturesUnlocked(pid_t pid, const nsTArray<uint64_t>& textureIds)
-{
-  bool oneErased = false;
-  {
-    StaticMonitorAutoLock mal(gTextureLockMonitor);
-    std::unordered_set<uint64_t>* lockedTextureIds = GetLockedTextureIdsForProcess(pid);
-    for (uint64_t textureId : textureIds) {
-      if (lockedTextureIds->erase(textureId)) {
-        oneErased = true;
-      }
-    }
-  }
-  if (oneErased) {
-    gTextureLockMonitor.NotifyAll();
-  }
-}
-
-void
-TextureSync::Shutdown()
-{
-  {
-    StaticMonitorAutoLock lock(gTextureLockMonitor);
-
-    for (auto& lockedTextureIds : gProcessTextureIds) {
-      lockedTextureIds.second.clear();
-    }
-  }
-
-  gTextureLockMonitor.NotifyAll();
-
-  {
-    StaticMonitorAutoLock lock(gTextureLockMonitor);
-    gProcessTextureIds.clear();
-  }
-}
-
-void
-TextureSync::UpdateTextureLocks(base::ProcessId aProcessId)
-{
-  if (aProcessId == getpid()) {
-    DispatchCheckTexturesForUnlock();
-    return;
-  }
-
-  MachSendMessage smsg(ipc::kUpdateTextureLocksMsg);
-  smsg.SetData(&aProcessId, sizeof(aProcessId));
-  ipc::SharedMemoryBasic::SendMachMessage(aProcessId, smsg, NULL);
-}
-
-bool
-TextureSync::WaitForTextures(base::ProcessId aProcessId, const nsTArray<uint64_t>& textureIds)
-{
-  if (aProcessId == getpid()) {
-    bool success = WaitForTextureIdsToUnlock(aProcessId, MakeSpan<uint64_t>(textureIds));
-    if (!success) {
-      LOG_ERROR("Failed waiting for textures to unlock.\n");
-    }
-
-    return success;
-  }
-
-  MachSendMessage smsg(ipc::kWaitForTexturesMsg);
-  size_t messageSize = sizeof(WaitForTexturesRequest) + textureIds.Length() * sizeof(uint64_t);
-  UniquePtr<uint8_t[]> messageData = MakeUnique<uint8_t[]>(messageSize);
-  WaitForTexturesRequest* req = (WaitForTexturesRequest*)messageData.get();
-  uint64_t* reqTextureIds = (uint64_t*)(req + 1);
-
-  for (uint32_t i = 0; i < textureIds.Length(); ++i) {
-    reqTextureIds[i] = textureIds[i];
-  }
-
-  req->pid = getpid();
-  bool dataWasSet = smsg.SetData(req, messageSize);
-
-  if (!dataWasSet) {
-    LOG_ERROR("Data was too large: %zu\n", messageSize);
-    return false;
-  }
-
-  MachReceiveMessage msg;
-  bool success = ipc::SharedMemoryBasic::SendMachMessage(aProcessId, smsg, &msg);
-  if (!success) {
-    return false;
-  }
-
-  if (msg.GetDataLength() != sizeof(WaitForTexturesReply)) {
-    LOG_ERROR("Improperly formatted reply\n");
-    return false;
-  }
-
-  WaitForTexturesReply* msg_data = reinterpret_cast<WaitForTexturesReply*>(msg.GetData());
-  if (!msg_data->success) {
-    LOG_ERROR("Failed waiting for textures to unlock.\n");
-    return false;
-  }
-
-  return true;
-}
-
-void
-TextureSync::CleanupForPid(base::ProcessId aProcessId)
-{
-  {
-    StaticMonitorAutoLock lock(gTextureLockMonitor);
-    std::unordered_set<uint64_t>* lockedTextureIds = GetLockedTextureIdsForProcess(aProcessId);
-    lockedTextureIds->clear();
-  }
-  gTextureLockMonitor.NotifyAll();
-}
-
-} // namespace layers
-
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/gfx/layers/TextureSync.h
+++ /dev/null
@@ -1,44 +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/. */
-
-#ifndef MOZILLA_LAYERS_TEXTURESYNC_H
-#define MOZILLA_LAYERS_TEXTURESYNC_H
-
-#include "base/process.h"
-
-#include "nsTArray.h"
-#include "mozilla/layers/TextureSourceProvider.h"
-
-#include "SharedMemory.h"
-
-class MachReceiveMessage;
-
-namespace mozilla {
-namespace ipc {
-  struct MemoryPorts;
-} // namespace ipc
-
-namespace layers {
-
-class TextureSync
-{
-public:
-  static void RegisterTextureSourceProvider(layers::TextureSourceProvider* aTextureSourceProvider);
-  static void UnregisterTextureSourceProvider(layers::TextureSourceProvider* aTextureSourceProvider);
-  static void DispatchCheckTexturesForUnlock();
-  static void HandleWaitForTexturesMessage(MachReceiveMessage* rmsg, ipc::MemoryPorts* ports);
-  static void UpdateTextureLocks(base::ProcessId aProcessId);
-  static bool WaitForTextures(base::ProcessId aProcessId, const nsTArray<uint64_t>& aTextureIds);
-  static void SetTexturesLocked(base::ProcessId aProcessId, const nsTArray<uint64_t>& aTextureIds);
-  static void SetTexturesUnlocked(base::ProcessId aProcessId, const nsTArray<uint64_t>& aTextureIds);
-  static void Shutdown();
-  static void CleanupForPid(base::ProcessId aProcessId);
-};
-
-} // namespace layers
-} // namespace mozilla
-
-#endif
\ No newline at end of file
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -312,25 +312,16 @@ ClientLayerManager::BeginTransaction()
   return BeginTransactionWithTarget(nullptr);
 }
 
 bool
 ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                                            void* aCallbackData,
                                            EndTransactionFlags)
 {
-  // This just causes the compositor to check whether the GPU is done with its
-  // textures or not and unlock them if it is. This helps us avoid the case
-  // where we take a long time painting asynchronously, turn IPC back on at
-  // the end of that, and then have to wait for the compositor to to get into
-  // TiledLayerBufferComposite::UseTiles before getting a response.
-  if (mForwarder) {
-    mForwarder->UpdateTextureLocks();
-  }
-
   // Wait for any previous async paints to complete before starting to paint again.
   // Do this outside the profiler and telemetry block so this doesn't count as time
   // spent rasterizing.
   {
     PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::FlushRasterization);
     FlushAsyncPaints();
   }
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -757,24 +757,20 @@ ContentClientRemoteBuffer::CreateBufferI
   );
 
   if (!textureClient || !AddTextureClient(textureClient)) {
     return nullptr;
   }
 
   RefPtr<TextureClient> textureClientOnWhite;
   if (aFlags & TextureFlags::COMPONENT_ALPHA) {
-    TextureAllocationFlags allocFlags = ALLOC_CLEAR_BUFFER_WHITE;
-    if (mForwarder->SupportsTextureDirectMapping()) {
-      allocFlags = TextureAllocationFlags(allocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
-    }
     textureClientOnWhite = textureClient->CreateSimilar(
       mForwarder->GetCompositorBackendType(),
       aFlags | ExtraTextureFlags(),
-      allocFlags
+      TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE
     );
     if (!textureClientOnWhite || !AddTextureClient(textureClientOnWhite)) {
       return nullptr;
     }
     // We don't enable the readlock for the white buffer since we always
     // use them together and waiting on the lock for the black
     // should be sufficient.
   }
--- a/gfx/layers/client/MultiTiledContentClient.cpp
+++ b/gfx/layers/client/MultiTiledContentClient.cpp
@@ -135,52 +135,16 @@ ClientMultiTiledLayerBuffer::PaintThebes
   }
 #endif
 
   mLastPaintContentType = GetContentType(&mLastPaintSurfaceMode);
   mCallback = nullptr;
   mCallbackData = nullptr;
 }
 
-void ClientMultiTiledLayerBuffer::MaybeSyncTextures(const nsIntRegion& aPaintRegion,
-                                                    const TilesPlacement& aNewTiles,
-                                                    const IntSize& aScaledTileSize)
-{
-  if (mManager->AsShadowForwarder()->SupportsTextureDirectMapping()) {
-    AutoTArray<uint64_t, 10> syncTextureSerials;
-    SurfaceMode mode;
-    Unused << GetContentType(&mode);
-
-    // Pre-pass through the tiles (mirroring the filter logic below) to gather
-    // texture IDs that we need to ensure are unused by the GPU before we
-    // continue.
-    if (!aPaintRegion.IsEmpty()) {
-      MOZ_ASSERT(mPaintStates.size() == 0);
-      for (size_t i = 0; i < mRetainedTiles.Length(); ++i) {
-        const TileCoordIntPoint tileCoord = aNewTiles.TileCoord(i);
-
-        IntPoint tileOffset = GetTileOffset(tileCoord);
-        nsIntRegion tileDrawRegion = IntRect(tileOffset, aScaledTileSize);
-        tileDrawRegion.AndWith(aPaintRegion);
-
-        if (tileDrawRegion.IsEmpty()) {
-          continue;
-        }
-
-        TileClient& tile = mRetainedTiles[i];
-        tile.GetSyncTextureSerials(mode, syncTextureSerials);
-      }
-    }
-
-    if (syncTextureSerials.Length() > 0) {
-      mManager->AsShadowForwarder()->SyncTextures(syncTextureSerials);
-    }
-  }
-}
-
 void ClientMultiTiledLayerBuffer::Update(const nsIntRegion& newValidRegion,
                                          const nsIntRegion& aPaintRegion,
                                          const nsIntRegion& aDirtyRegion,
                                          TilePaintFlags aFlags)
 {
   const IntSize scaledTileSize = GetScaledTileSize();
   const gfx::IntRect newBounds = newValidRegion.GetBounds();
 
@@ -212,19 +176,16 @@ void ClientMultiTiledLayerBuffer::Update
       oldRetainedTiles[oldIndex].DiscardBuffers();
     }
   }
 
   oldRetainedTiles.Clear();
 
   nsIntRegion paintRegion = aPaintRegion;
   nsIntRegion dirtyRegion = aDirtyRegion;
-
-  MaybeSyncTextures(paintRegion, newTiles, scaledTileSize);
-
   if (!paintRegion.IsEmpty()) {
     MOZ_ASSERT(mPaintStates.size() == 0);
     for (size_t i = 0; i < newTileCount; ++i) {
       const TileCoordIntPoint tileCoord = newTiles.TileCoord(i);
 
       IntPoint tileOffset = GetTileOffset(tileCoord);
       nsIntRegion tileDrawRegion = IntRect(tileOffset, scaledTileSize);
       tileDrawRegion.AndWith(paintRegion);
--- a/gfx/layers/client/MultiTiledContentClient.h
+++ b/gfx/layers/client/MultiTiledContentClient.h
@@ -151,20 +151,16 @@ private:
    * Returns true if it should be called again, false otherwise. In the case
    * that aRegionToPaint is empty, this will return aIsRepeated for convenience.
    */
   bool ComputeProgressiveUpdateRegion(const nsIntRegion& aInvalidRegion,
                                       const nsIntRegion& aOldValidRegion,
                                       nsIntRegion& aRegionToPaint,
                                       BasicTiledLayerPaintData* aPaintData,
                                       bool aIsRepeated);
-
-  void MaybeSyncTextures(const nsIntRegion& aPaintRegion,
-                         const TilesPlacement& aNewTiles,
-                         const gfx::IntSize& aScaledTileSize);
 };
 
 /**
  * An implementation of TiledContentClient that supports
  * multiple tiles and a low precision buffer.
  */
 class MultiTiledContentClient : public TiledContentClient
 {
--- a/gfx/layers/client/SingleTiledContentClient.cpp
+++ b/gfx/layers/client/SingleTiledContentClient.cpp
@@ -135,25 +135,16 @@ ClientSingleTiledLayerBuffer::PaintThebe
   SurfaceMode mode;
   gfxContentType content = GetContentType(&mode);
   mFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(content);
 
   if (mTile.IsPlaceholderTile()) {
     mTile.SetTextureAllocator(this);
   }
 
-
-  if (mManager->AsShadowForwarder()->SupportsTextureDirectMapping()) {
-    AutoTArray<uint64_t, 2> syncTextureSerials;
-    mTile.GetSyncTextureSerials(mode, syncTextureSerials);
-    if (syncTextureSerials.Length() > 0) {
-      mManager->AsShadowForwarder()->SyncTextures(syncTextureSerials);
-    }
-  }
-
   // The dirty region relative to the top-left of the tile.
   nsIntRegion tileVisibleRegion = aNewValidRegion.MovedBy(-mTilingOrigin);
   nsIntRegion tileDirtyRegion = paintRegion.MovedBy(-mTilingOrigin);
 
   std::vector<RefPtr<TextureClient>> paintClients;
   std::vector<CapturedTiledPaintState::Copy> paintCopies;
   std::vector<CapturedTiledPaintState::Clear> paintClears;
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -655,32 +655,27 @@ TextureClient::UpdateFromSurface(gfx::So
       return;
     }
   }
   NS_WARNING("TextureClient::UpdateFromSurface failed");
 }
 
 
 already_AddRefed<TextureClient>
-TextureClient::CreateSimilar(LayersBackend aLayersBackend,
-                             TextureFlags aFlags,
-                             TextureAllocationFlags aAllocFlags) const
+TextureClient::CreateSimilar(LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
 {
   MOZ_ASSERT(IsValid());
 
   MOZ_ASSERT(!mIsLocked);
   if (mIsLocked) {
     return nullptr;
   }
 
   LockActor();
-  TextureData* data = mData->CreateSimilar(mAllocator,
-                                           aLayersBackend,
-                                           aFlags,
-                                           aAllocFlags);
+  TextureData* data = mData->CreateSimilar(mAllocator, aLayersBackend, aFlags, aAllocFlags);
   UnlockActor();
 
   if (!data) {
     return nullptr;
   }
 
   return MakeAndAddRef<TextureClient>(data, aFlags, mAllocator);
 }
@@ -1060,19 +1055,16 @@ already_AddRefed<TextureClient>
 TextureClient::CreateForDrawing(KnowsCompositor* aAllocator,
                                 gfx::SurfaceFormat aFormat,
                                 gfx::IntSize aSize,
                                 BackendSelector aSelector,
                                 TextureFlags aTextureFlags,
                                 TextureAllocationFlags aAllocFlags)
 {
   LayersBackend layersBackend = aAllocator->GetCompositorBackendType();
-  if (aAllocator->SupportsTextureDirectMapping()) {
-    aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
-  }
   return TextureClient::CreateForDrawing(aAllocator->GetTextureForwarder(),
                                          aFormat, aSize,
                                          layersBackend,
                                          aAllocator->GetMaxTextureSize(),
                                          aSelector,
                                          aTextureFlags,
                                          aAllocFlags);
 }
@@ -1229,26 +1221,16 @@ TextureClient::CreateFromSurface(KnowsCo
 already_AddRefed<TextureClient>
 TextureClient::CreateForRawBufferAccess(KnowsCompositor* aAllocator,
                                         gfx::SurfaceFormat aFormat,
                                         gfx::IntSize aSize,
                                         gfx::BackendType aMoz2DBackend,
                                         TextureFlags aTextureFlags,
                                         TextureAllocationFlags aAllocFlags)
 {
-  // If we exceed the max texture size for the GPU, then just fall back to no
-  // texture direct mapping. If it becomes a problem we can implement tiling
-  // logic inside DirectMapTextureSource to allow this.
-  bool supportsTextureDirectMapping = aAllocator->SupportsTextureDirectMapping() &&
-    std::max(aSize.width, aSize.height) <= aAllocator->GetMaxTextureSize();
-  if (supportsTextureDirectMapping) {
-    aAllocFlags = TextureAllocationFlags(aAllocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
-  } else {
-    aAllocFlags = TextureAllocationFlags(aAllocFlags & ~ALLOC_ALLOW_DIRECT_MAPPING);
-  }
   return CreateForRawBufferAccess(aAllocator->GetTextureForwarder(),
                                   aFormat, aSize, aMoz2DBackend,
                                   aAllocator->GetCompositorBackendType(),
                                   aTextureFlags, aAllocFlags);
 }
 
 // static
 already_AddRefed<TextureClient>
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -89,20 +89,16 @@ enum TextureAllocationFlags {
 
   // Disable any cross-device synchronization. This is also for TextureClientD3D11,
   // and creates a texture without KeyedMutex.
   ALLOC_MANUAL_SYNCHRONIZATION = 1 << 6,
 
   // The texture is going to be updated using UpdateFromSurface and needs to support
   // that call.
   ALLOC_UPDATE_FROM_SURFACE = 1 << 7,
-
-  // In practice, this means we support the APPLE_client_storage extension, meaning
-  // the buffer will not be internally copied by the graphics driver.
-  ALLOC_ALLOW_DIRECT_MAPPING = 1 << 8,
 };
 
 /**
  * This class may be used to asynchronously receive an update when the content
  * drawn to this texture client is available for reading in CPU memory. This
  * can only be used on texture clients that support draw target creation.
  */
 class TextureReadbackSink
--- a/gfx/layers/client/TextureClientPool.cpp
+++ b/gfx/layers/client/TextureClientPool.cpp
@@ -34,17 +34,16 @@ ShrinkCallback(nsITimer *aTimer, void *a
 // at an inopportune time (e.g. mid-animation).
 static void
 ClearCallback(nsITimer *aTimer, void *aClosure)
 {
   static_cast<TextureClientPool*>(aClosure)->Clear();
 }
 
 TextureClientPool::TextureClientPool(LayersBackend aLayersBackend,
-                                     bool aSupportsTextureDirectMapping,
                                      int32_t aMaxTextureSize,
                                      gfx::SurfaceFormat aFormat,
                                      gfx::IntSize aSize,
                                      TextureFlags aFlags,
                                      uint32_t aShrinkTimeoutMsec,
                                      uint32_t aClearTimeoutMsec,
                                      uint32_t aInitialPoolSize,
                                      uint32_t aPoolUnusedSize,
@@ -56,17 +55,16 @@ TextureClientPool::TextureClientPool(Lay
   , mFlags(aFlags)
   , mShrinkTimeoutMsec(aShrinkTimeoutMsec)
   , mClearTimeoutMsec(aClearTimeoutMsec)
   , mInitialPoolSize(aInitialPoolSize)
   , mPoolUnusedSize(aPoolUnusedSize)
   , mOutstandingClients(0)
   , mSurfaceAllocator(aAllocator)
   , mDestroyed(false)
-  , mSupportsTextureDirectMapping(aSupportsTextureDirectMapping)
 {
   TCP_LOG("TexturePool %p created with maximum unused texture clients %u\n",
       this, mInitialPoolSize);
   mShrinkTimer = NS_NewTimer();
   mClearTimer = NS_NewTimer();
   if (aFormat == gfx::SurfaceFormat::UNKNOWN) {
     gfxWarning() << "Creating texture pool for SurfaceFormat::UNKNOWN format";
   }
@@ -146,39 +144,33 @@ TextureClientPool::GetTextureClient()
 }
 
 void
 TextureClientPool::AllocateTextureClient()
 {
   TCP_LOG("TexturePool %p allocating TextureClient, outstanding %u\n",
       this, mOutstandingClients);
 
-  TextureAllocationFlags allocFlags = ALLOC_DEFAULT;
-
-  if (mSupportsTextureDirectMapping) {
-    allocFlags = TextureAllocationFlags(allocFlags | ALLOC_ALLOW_DIRECT_MAPPING);
-  }
-
   RefPtr<TextureClient> newClient;
   if (gfxPrefs::ForceShmemTiles()) {
     // gfx::BackendType::NONE means use the content backend
     newClient =
       TextureClient::CreateForRawBufferAccess(mSurfaceAllocator,
                                               mFormat, mSize,
                                               gfx::BackendType::NONE,
                                               mBackend,
-                                              mFlags, allocFlags);
+                                              mFlags, ALLOC_DEFAULT);
   } else {
     newClient =
       TextureClient::CreateForDrawing(mSurfaceAllocator,
                                       mFormat, mSize,
                                       mBackend,
                                       mMaxTextureSize,
                                       BackendSelector::Content,
-                                      mFlags, allocFlags);
+                                      mFlags);
   }
 
   if (newClient) {
     mTextureClients.push(newClient);
   }
 }
 
 void
--- a/gfx/layers/client/TextureClientPool.h
+++ b/gfx/layers/client/TextureClientPool.h
@@ -41,17 +41,16 @@ public:
 };
 
 class TextureClientPool final : public TextureClientAllocator
 {
   virtual ~TextureClientPool();
 
 public:
   TextureClientPool(LayersBackend aBackend,
-                    bool aSupportsTextureDirectMapping,
                     int32_t aMaxTextureSize,
                     gfx::SurfaceFormat aFormat,
                     gfx::IntSize aSize,
                     TextureFlags aFlags,
                     uint32_t aShrinkTimeoutMsec,
                     uint32_t aClearTimeoutMsec,
                     uint32_t aInitialPoolSize,
                     uint32_t aPoolUnusedSize,
@@ -166,16 +165,14 @@ private:
   RefPtr<nsITimer> mClearTimer;
   // This mSurfaceAllocator owns us, so no need to hold a ref to it
   TextureForwarder* mSurfaceAllocator;
 
   // Keep track of whether this pool has been destroyed or not. If it has,
   // we won't accept returns of TextureClients anymore, and the refcounting
   // should take care of their destruction.
   bool mDestroyed;
-
-  bool mSupportsTextureDirectMapping;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* MOZILLA_GFX_TEXTURECLIENTPOOL_H */
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -659,42 +659,16 @@ CreateBackBufferTexture(TextureClient* a
   if (!aCompositable.AddTextureClient(texture)) {
     gfxCriticalError() << "[Tiling:Client] Failed to connect a TextureClient";
     return nullptr;
   }
 
   return texture.forget();
 }
 
-void
-TileClient::GetSyncTextureSerials(SurfaceMode aMode, nsTArray<uint64_t>& aSerials)
-{
-  if (mFrontBuffer &&
-      mFrontBuffer->HasIntermediateBuffer() &&
-      !mFrontBuffer->IsReadLocked() &&
-      (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA || (
-        mFrontBufferOnWhite && !mFrontBufferOnWhite->IsReadLocked())))
-  {
-    return;
-  }
-
-  if (mBackBuffer &&
-      !mBackBuffer->HasIntermediateBuffer() &&
-      mBackBuffer->IsReadLocked()) {
-    aSerials.AppendElement(mBackBuffer->GetSerial());
-  }
-
-  if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA &&
-      mBackBufferOnWhite &&
-      !mBackBufferOnWhite->HasIntermediateBuffer() &&
-      mBackBufferOnWhite->IsReadLocked()) {
-    aSerials.AppendElement(mBackBufferOnWhite->GetSerial());
-  }
-}
-
 TextureClient*
 TileClient::GetBackBuffer(CompositableClient& aCompositable,
                           const nsIntRegion& aDirtyRegion,
                           const nsIntRegion& aVisibleRegion,
                           gfxContentType aContent,
                           SurfaceMode aMode,
                           nsIntRegion& aAddPaintedRegion,
                           TilePaintFlags aFlags,
@@ -743,28 +717,27 @@ TileClient::GetBackBuffer(CompositableCl
       if (!mBackBuffer) {
         DiscardBackBuffer();
         DiscardFrontBuffer();
         return nullptr;
       }
       mInvalidBack = IntRect(IntPoint(), mBackBuffer->GetSize());
     }
 
-    if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
-      if (!mBackBufferOnWhite || mBackBufferOnWhite->IsReadLocked()) {
-        mBackBufferOnWhite = CreateBackBufferTexture(
-          mBackBufferOnWhite, aCompositable, mAllocator
-        );
-        if (!mBackBufferOnWhite) {
-          DiscardBackBuffer();
-          DiscardFrontBuffer();
-          return nullptr;
-        }
-        mInvalidBack = IntRect(IntPoint(), mBackBufferOnWhite->GetSize());
+    if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA
+        && (!mBackBufferOnWhite || mBackBufferOnWhite->IsReadLocked())) {
+      mBackBufferOnWhite = CreateBackBufferTexture(
+        mBackBufferOnWhite, aCompositable, mAllocator
+      );
+      if (!mBackBufferOnWhite) {
+        DiscardBackBuffer();
+        DiscardFrontBuffer();
+        return nullptr;
       }
+      mInvalidBack = IntRect(IntPoint(), mBackBufferOnWhite->GetSize());
     }
 
     ValidateBackBufferFromFront(aDirtyRegion, aVisibleRegion, aAddPaintedRegion, aFlags, aCopies, aClients);
   }
 
   OpenMode lockMode = aFlags & TilePaintFlags::Async ? OpenMode::OPEN_READ_WRITE_ASYNC
                                                      : OpenMode::OPEN_READ_WRITE;
 
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -109,18 +109,16 @@ struct TileClient
   */
   void Flip();
 
   void DumpTexture(std::stringstream& aStream, TextureDumpMode aCompress) {
     // TODO We should combine the OnWhite/OnBlack here an just output a single image.
     CompositableClient::DumpTextureClient(aStream, mFrontBuffer, aCompress);
   }
 
-  void GetSyncTextureSerials(SurfaceMode aMode, nsTArray<uint64_t>& aSerials);
-
   /**
   * Returns an unlocked TextureClient that can be used for writing new
   * data to the tile. This may flip the front-buffer to the back-buffer if
   * the front-buffer is still locked by the host, or does not have an
   * internal buffer (and so will always be locked).
   *
   * If getting the back buffer required copying pixels from the front buffer
   * then the copied region is stored in aAddPaintedRegion so the host side
@@ -322,19 +320,16 @@ public:
   {}
 
   virtual void PaintThebes(const nsIntRegion& aNewValidRegion,
                    const nsIntRegion& aPaintRegion,
                    const nsIntRegion& aDirtyRegion,
                    LayerManager::DrawPaintedLayerCallback aCallback,
                    void* aCallbackData,
                    TilePaintFlags aFlags) = 0;
-  virtual void GetSyncTextureSerials(const nsIntRegion& aPaintRegion,
-                                     const nsIntRegion& aDirtyRegion,
-                                     nsTArray<uint64_t>& aSerials) { return; }
 
   virtual bool SupportsProgressiveUpdate() = 0;
   virtual bool ProgressiveUpdate(const nsIntRegion& aValidRegion,
                          const nsIntRegion& aInvalidRegion,
                          const nsIntRegion& aOldValidRegion,
                          nsIntRegion& aOutDrawnRegion,
                          BasicTiledLayerPaintData* aPaintData,
                          LayerManager::DrawPaintedLayerCallback aCallback,
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -16,19 +16,16 @@
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/ISurfaceAllocator.h"  // for ISurfaceAllocator
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor, etc
 #include "mozilla/layers/TextureHostBasic.h"
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureHostOGL
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/TextureClient.h"
-#ifdef XP_DARWIN
-#include "mozilla/layers/TextureSync.h"
-#endif
 #include "mozilla/layers/GPUVideoTextureHost.h"
 #include "mozilla/layers/WebRenderTextureHost.h"
 #include "mozilla/webrender/RenderBufferTextureHost.h"
 #include "mozilla/webrender/RenderThread.h"
 #include "mozilla/webrender/WebRenderAPI.h"
 #include "nsAString.h"
 #include "mozilla/RefPtr.h"                   // for nsRefPtr
 #include "nsPrintfCString.h"            // for nsPrintfCString
@@ -368,24 +365,21 @@ TextureHost::TextureHost(TextureFlags aF
     , mCompositableCount(0)
     , mFwdTransactionId(0)
     , mReadLocked(false)
 {
 }
 
 TextureHost::~TextureHost()
 {
-  if (mReadLocked) {
-    // If we still have a ReadLock, unlock it. At this point we don't care about
-    // the texture client being written into on the other side since it should be
-    // destroyed by now. But we will hit assertions if we don't ReadUnlock before
-    // destroying the lock itself.
-    ReadUnlock();
-    MaybeNotifyUnlocked();
-  }
+  // If we still have a ReadLock, unlock it. At this point we don't care about
+  // the texture client being written into on the other side since it should be
+  // destroyed by now. But we will hit assertions if we don't ReadUnlock before
+  // destroying the lock itself.
+  ReadUnlock();
 }
 
 void TextureHost::Finalize()
 {
   if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
     DeallocateSharedData();
     DeallocateDeviceData();
   }
@@ -401,17 +395,16 @@ TextureHost::UnbindTextureSource()
     // composition before calling ReadUnlock. We ask the compositor to take care
     // of that for us.
     if (mProvider) {
       mProvider->UnlockAfterComposition(this);
     } else {
       // GetCompositor returned null which means no compositor can be using this
       // texture. We can ReadUnlock right away.
       ReadUnlock();
-      MaybeNotifyUnlocked();
     }
   }
 }
 
 void
 TextureHost::RecycleTexture(TextureFlags aFlags)
 {
   MOZ_ASSERT(GetFlags() & TextureFlags::RECYCLE);
@@ -703,19 +696,16 @@ TextureHost::SetReadLocked()
 {
   if (!mReadLock) {
     return;
   }
   // If mReadLocked is true it means we haven't read unlocked yet and the content
   // side should not have been able to write into this texture and read lock again!
   MOZ_ASSERT(!mReadLocked);
   mReadLocked = true;
-  if (mProvider) {
-    mProvider->MaybeUnlockBeforeNextComposition(this);
-  }
 }
 
 void
 TextureHost::ReadUnlock()
 {
   if (mReadLock && mReadLocked) {
     mReadLock->ReadUnlock();
     mReadLocked = false;
@@ -892,54 +882,29 @@ BufferTextureHost::AcquireTextureSource(
   if (!UploadIfNeeded()) {
     return false;
   }
   aTexture = mFirstSource;
   return !!mFirstSource;
 }
 
 void
-BufferTextureHost::ReadUnlock()
-{
-  if (mFirstSource) {
-    mFirstSource->Sync(true);
-  }
-
-  TextureHost::ReadUnlock();
-}
-
-void
-BufferTextureHost::MaybeNotifyUnlocked()
-{
-#ifdef XP_DARWIN
-  auto actor = GetIPDLActor();
-  if (actor) {
-    AutoTArray<uint64_t, 1> serials;
-    serials.AppendElement(TextureHost::GetTextureSerial(actor));
-    TextureSync::SetTexturesUnlocked(actor->OtherPid(), serials);
-  }
-#endif
-}
-
-void
 BufferTextureHost::UnbindTextureSource()
 {
   if (mFirstSource && mFirstSource->IsOwnedBy(this)) {
     mFirstSource->Unbind();
   }
-
   // This texture is not used by any layer anymore.
   // If the texture doesn't have an intermediate buffer, it means we are
   // compositing synchronously on the CPU, so we don't need to wait until
   // the end of the next composition to ReadUnlock (which other textures do
   // by default).
   // If the texture has an intermediate buffer we don't care either because
   // texture uploads are also performed synchronously for BufferTextureHost.
   ReadUnlock();
-  MaybeNotifyUnlocked();
 }
 
 gfx::SurfaceFormat
 BufferTextureHost::GetFormat() const
 {
   // mFormat is the format of the data that we share with the content process.
   // GetFormat, on the other hand, expects the format that we present to the
   // Compositor (it is used to choose the effect type).
@@ -996,17 +961,16 @@ BufferTextureHost::MaybeUpload(nsIntRegi
   if (!Upload(aRegion)) {
     return false;
   }
 
   if (mHasIntermediateBuffer) {
     // We just did the texture upload, the content side can now freely write
     // into the shared buffer.
     ReadUnlock();
-    MaybeNotifyUnlocked();
   }
 
   // We no longer have an invalid region.
   mNeedsFullUpdate = false;
   mMaybeUpdatedRegion.SetEmpty();
 
   // If upload returns true we know mFirstSource is not null
   mFirstSource->SetUpdateSerial(mUpdateSerial);
@@ -1026,19 +990,17 @@ BufferTextureHost::Upload(nsIntRegion *a
     return false;
   }
   if (!mProvider) {
     // This can happen if we send textures to a compositable that isn't yet
     // attached to a layer.
     return false;
   }
   if (!mHasIntermediateBuffer && EnsureWrappingTextureSource()) {
-    if (!mFirstSource || !mFirstSource->IsDirectMap()) {
-      return true;
-    }
+    return true;
   }
 
   if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
     NS_WARNING("BufferTextureHost: unsupported format!");
     return false;
   } else if (mFormat == gfx::SurfaceFormat::YUV) {
     const YCbCrDescriptor& desc = mDescriptor.get_YCbCrDescriptor();
 
@@ -1310,22 +1272,19 @@ TextureParent::Init(const SurfaceDescrip
 
 void
 TextureParent::Destroy()
 {
   if (!mTextureHost) {
     return;
   }
 
-  if (mTextureHost->mReadLocked) {
-    // ReadUnlock here to make sure the ReadLock's shmem does not outlive the
-    // protocol that created it.
-    mTextureHost->ReadUnlock();
-    mTextureHost->MaybeNotifyUnlocked();
-  }
+  // ReadUnlock here to make sure the ReadLock's shmem does not outlive the
+  // protocol that created it.
+  mTextureHost->ReadUnlock();
 
   if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
     mTextureHost->ForgetSharedData();
   }
 
   mTextureHost->mActor = nullptr;
   mTextureHost = nullptr;
 }
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -178,26 +178,16 @@ public:
   // individual tiles.
   virtual RefPtr<TextureSource> ExtractCurrentTile() {
     NS_WARNING("Implementation does not expose tile sources");
     return nullptr;
   }
 
   int NumCompositableRefs() const { return mCompositableCount; }
 
-  // Some texture sources could wrap the cpu buffer to gpu directly. Then,
-  // we could get better performance of texture uploading.
-  virtual bool IsDirectMap() { return false; }
-  // The direct-map cpu buffer should be alive when gpu uses it. And it
-  // should not be updated while gpu reads it. This Sync() function
-  // implements this synchronized behavior by allowing us to check if
-  // the GPU is done with the texture, and block on it if aBlocking is
-  // true.
-  virtual bool Sync(bool aBlocking) { return true; }
-
 protected:
 
   RefPtr<TextureSource> mNextSibling;
   int mCompositableCount;
 };
 
 /// Equivalent of a RefPtr<TextureSource>, that calls AddCompositableRef and
 /// ReleaseCompositableRef in addition to the usual AddRef and Release.
@@ -667,25 +657,21 @@ public:
     MOZ_ASSERT_UNREACHABLE("No PushDisplayItems() implementation for this TextureHost type.");
   }
 
   /**
    * Some API's can use the cross-process IOSurface directly, such as OpenVR
    */
   virtual MacIOSurface* GetMacIOSurface() { return nullptr; }
 
-  virtual bool IsDirectMap() { return false; }
-
 protected:
-  virtual void ReadUnlock();
+  void ReadUnlock();
 
   void RecycleTexture(TextureFlags aFlags);
 
-  virtual void MaybeNotifyUnlocked() {}
-
   virtual void UpdatedInternal(const nsIntRegion *Region) {}
 
   /**
    * Called when mCompositableCount becomes 0.
    */
   virtual void NotifyNotUsed();
 
   // for Compositor.
@@ -777,30 +763,23 @@ public:
                                    const wr::ExternalImageId& aExtID) override;
 
   virtual void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
                                 const wr::LayoutRect& aBounds,
                                 const wr::LayoutRect& aClip,
                                 wr::ImageRendering aFilter,
                                 const Range<wr::ImageKey>& aImageKeys) override;
 
-  virtual void ReadUnlock() override;
-  virtual bool IsDirectMap() override { return mFirstSource && mFirstSource->IsDirectMap(); };
-
-  bool CanUnlock() { return !mFirstSource || mFirstSource->Sync(false); }
-
 protected:
   bool Upload(nsIntRegion *aRegion = nullptr);
   bool UploadIfNeeded();
   bool MaybeUpload(nsIntRegion *aRegion);
   bool EnsureWrappingTextureSource();
 
   virtual void UpdatedInternal(const nsIntRegion* aRegion = nullptr) override;
-  virtual void MaybeNotifyUnlocked() override;
-
 
   BufferDescriptor mDescriptor;
   RefPtr<Compositor> mCompositor;
   RefPtr<DataTextureSource> mFirstSource;
   nsIntRegion mMaybeUpdatedRegion;
   gfx::IntSize mSize;
   gfx::SurfaceFormat mFormat;
   uint32_t mUpdateSerial;
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -10,19 +10,16 @@
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/layers/Compositor.h"  // for Compositor
 //#include "mozilla/layers/CompositorBridgeParent.h"  // for CompositorBridgeParent
 #include "mozilla/layers/Effects.h"     // for TexturedEffect, Effect, etc
 #include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureHostOGL
-#ifdef XP_DARWIN
-#include "mozilla/layers/TextureSync.h" // for TextureSync
-#endif
 #include "nsAString.h"
 #include "nsDebug.h"                    // for NS_WARNING
 #include "nsPoint.h"                    // for IntPoint
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "nsRect.h"                     // for IntRect
 #include "mozilla/layers/TextureClient.h"
 
 namespace mozilla {
@@ -296,19 +293,16 @@ TiledLayerBufferComposite::UseTiles(cons
   TilesPlacement newTiles(aTiles.firstTileX(), aTiles.firstTileY(),
                           aTiles.retainedWidth(), aTiles.retainedHeight());
 
   const InfallibleTArray<TileDescriptor>& tileDescriptors = aTiles.tiles();
 
   TextureSourceRecycler oldRetainedTiles(std::move(mRetainedTiles));
   mRetainedTiles.SetLength(tileDescriptors.Length());
 
-  AutoTArray<uint64_t, 10> lockedTextureSerials;
-  base::ProcessId lockedTexturePid = 0;
-
   // Step 1, deserialize the incoming set of tiles into mRetainedTiles, and attempt
   // to recycle the TextureSource for any repeated tiles.
   //
   // Since we don't have any retained 'tile' object, we have to search for instances
   // of the same TextureHost in the old tile set. The cost of binding a TextureHost
   // to a TextureSource for gralloc (binding EGLImage to GL texture) can be really
   // high, so we avoid this whenever possible.
   for (size_t i = 0; i < tileDescriptors.Length(); i++) {
@@ -323,37 +317,24 @@ TiledLayerBufferComposite::UseTiles(cons
       continue;
     }
 
     const TexturedTileDescriptor& texturedDesc = tileDesc.get_TexturedTileDescriptor();
 
     tile.mTextureHost = TextureHost::AsTextureHost(texturedDesc.textureParent());
     if (texturedDesc.readLocked()) {
       tile.mTextureHost->SetReadLocked();
-      auto actor = tile.mTextureHost->GetIPDLActor();
-      if (actor && tile.mTextureHost->IsDirectMap()) {
-        lockedTextureSerials.AppendElement(TextureHost::GetTextureSerial(actor));
-
-        if (lockedTexturePid) {
-          MOZ_ASSERT(lockedTexturePid == actor->OtherPid());
-        }
-        lockedTexturePid = actor->OtherPid();
-      }
     }
 
     if (texturedDesc.textureOnWhite().type() == MaybeTexture::TPTextureParent) {
       tile.mTextureHostOnWhite = TextureHost::AsTextureHost(
         texturedDesc.textureOnWhite().get_PTextureParent()
       );
       if (texturedDesc.readLockedOnWhite()) {
         tile.mTextureHostOnWhite->SetReadLocked();
-        auto actor = tile.mTextureHostOnWhite->GetIPDLActor();
-        if (actor && tile.mTextureHostOnWhite->IsDirectMap()) {
-          lockedTextureSerials.AppendElement(TextureHost::GetTextureSerial(actor));
-        }
       }
     }
 
     tile.mTileCoord = newTiles.TileCoord(i);
 
     // If this same tile texture existed in the old tile set then this will move the texture
     // source into our new tile.
     oldRetainedTiles.RecycleTextureSourceForTile(tile);
@@ -368,22 +349,16 @@ TiledLayerBufferComposite::UseTiles(cons
       // We need to begin fading it in (if enabled via layers.tiles.fade-in.enabled)
       tile.mFadeStart = TimeStamp::Now();
 
       aLayerManager->CompositeUntil(
         tile.mFadeStart + TimeDuration::FromMilliseconds(gfxPrefs::LayerTileFadeInDuration()));
     }
   }
 
-  #ifdef XP_DARWIN
-  if (lockedTextureSerials.Length() > 0) {
-    TextureSync::SetTexturesLocked(lockedTexturePid, lockedTextureSerials);
-  }
-  #endif
-
   // Step 2, attempt to recycle unused texture sources from the old tile set into new tiles.
   //
   // For gralloc, binding a new TextureHost to the existing TextureSource is the fastest way
   // to ensure that any implicit locking on the old gralloc image is released.
   for (TileHost& tile : mRetainedTiles) {
     if (!tile.mTextureHost || tile.mTextureSource) {
       continue;
     }
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -931,17 +931,16 @@ CompositorBridgeChild::GetTexturePool(Kn
         mTexturePools[i]->GetFormat() == aFormat &&
         mTexturePools[i]->GetFlags() == aFlags) {
       return mTexturePools[i];
     }
   }
 
   mTexturePools.AppendElement(
       new TextureClientPool(aAllocator->GetCompositorBackendType(),
-                            aAllocator->SupportsTextureDirectMapping(),
                             aAllocator->GetMaxTextureSize(),
                             aFormat,
                             gfx::gfxVars::TileSize(),
                             aFlags,
                             gfxPrefs::LayersTilePoolShrinkTimeout(),
                             gfxPrefs::LayersTilePoolClearTimeout(),
                             gfxPrefs::LayersTileInitialPoolSize(),
                             gfxPrefs::LayersTilePoolUnusedSize(),
--- a/gfx/layers/ipc/KnowsCompositor.h
+++ b/gfx/layers/ipc/KnowsCompositor.h
@@ -97,21 +97,16 @@ public:
     return mTextureFactoryIdentifier.mSupportsPartialUploads;
   }
 
   bool SupportsComponentAlpha() const
   {
     return mTextureFactoryIdentifier.mSupportsComponentAlpha;
   }
 
-  bool SupportsTextureDirectMapping() const
-  {
-    return mTextureFactoryIdentifier.mSupportsTextureDirectMapping;
-  }
-
   bool SupportsD3D11() const
   {
     return GetCompositorBackendType() == layers::LayersBackend::LAYERS_D3D11 ||
            (GetCompositorBackendType() == layers::LayersBackend::LAYERS_WR && GetCompositorUseANGLE());
   }
 
   bool GetCompositorUseANGLE() const
   {
--- a/gfx/layers/ipc/LayersMessageUtils.h
+++ b/gfx/layers/ipc/LayersMessageUtils.h
@@ -330,31 +330,29 @@ struct ParamTraits<mozilla::layers::Text
 {
   typedef mozilla::layers::TextureFactoryIdentifier paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mParentBackend);
     WriteParam(aMsg, aParam.mParentProcessType);
     WriteParam(aMsg, aParam.mMaxTextureSize);
-    WriteParam(aMsg, aParam.mSupportsTextureDirectMapping);
     WriteParam(aMsg, aParam.mCompositorUseANGLE);
     WriteParam(aMsg, aParam.mSupportsTextureBlitting);
     WriteParam(aMsg, aParam.mSupportsPartialUploads);
     WriteParam(aMsg, aParam.mSupportsComponentAlpha);
     WriteParam(aMsg, aParam.mUsingAdvancedLayers);
     WriteParam(aMsg, aParam.mSyncHandle);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
   {
     bool result = ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
                   ReadParam(aMsg, aIter, &aResult->mParentProcessType) &&
                   ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
-                  ReadParam(aMsg, aIter, &aResult->mSupportsTextureDirectMapping) &&
                   ReadParam(aMsg, aIter, &aResult->mCompositorUseANGLE) &&
                   ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
                   ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads) &&
                   ReadParam(aMsg, aIter, &aResult->mSupportsComponentAlpha) &&
                   ReadParam(aMsg, aIter, &aResult->mUsingAdvancedLayers) &&
                   ReadParam(aMsg, aIter, &aResult->mSyncHandle);
     return result;
   }
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -27,19 +27,16 @@
 #include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/ImageBridgeChild.h"
 #include "mozilla/layers/LayersMessages.h"  // for Edit, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor, etc
 #include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_LOG
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/layers/PTextureChild.h"
 #include "mozilla/layers/SyncObject.h"
-#ifdef XP_DARWIN
-#include "mozilla/layers/TextureSync.h"
-#endif
 #include "ShadowLayerUtils.h"
 #include "mozilla/layers/TextureClient.h"  // for TextureClient
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsTArray.h"                   // for AutoTArray, nsTArray, etc
 #include "nsXULAppAPI.h"                // for XRE_GetProcessType, etc
 #include "mozilla/ReentrantMonitor.h"
 
 namespace mozilla {
@@ -804,48 +801,16 @@ ShadowLayerForwarder::SetLayerObserverEp
 {
   if (!IPCOpen()) {
     return;
   }
   Unused << mShadowManager->SendSetLayerObserverEpoch(aLayerObserverEpoch);
 }
 
 void
-ShadowLayerForwarder::UpdateTextureLocks()
-{
-#ifdef XP_DARWIN
-  if (!IPCOpen()) {
-    return;
-  }
-
-  auto compositorBridge = GetCompositorBridgeChild();
-  if (compositorBridge) {
-    auto pid = compositorBridge->OtherPid();
-    TextureSync::UpdateTextureLocks(pid);
-  }
-#endif
-}
-
-void
-ShadowLayerForwarder::SyncTextures(const nsTArray<uint64_t>& aSerials)
-{
-#ifdef XP_DARWIN
-  if (!IPCOpen()) {
-    return;
-  }
-
-  auto compositorBridge = GetCompositorBridgeChild();
-  if (compositorBridge) {
-    auto pid = compositorBridge->OtherPid();
-    TextureSync::WaitForTextures(pid, aSerials);
-  }
-#endif
-}
-
-void
 ShadowLayerForwarder::ReleaseLayer(const LayerHandle& aHandle)
 {
   if (!IPCOpen()) {
     return;
   }
   Unused << mShadowManager->SendReleaseLayer(aHandle);
 }
 
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -356,19 +356,16 @@ public:
                                               uint32_t aCaps,
                                               SurfaceDescriptor* aBuffer) override;
 
   virtual void DestroySurfaceDescriptor(SurfaceDescriptor* aSurface) override;
 
   virtual void UpdateFwdTransactionId() override;
   virtual uint64_t GetFwdTransactionId() override;
 
-  void UpdateTextureLocks();
-  void SyncTextures(const nsTArray<uint64_t>& aSerials);
-
   void ReleaseLayer(const LayerHandle& aHandle);
 
   bool InForwarderThread() override {
     return NS_IsMainThread();
   }
 
   PaintTiming& GetPaintTiming() {
     return mPaintTiming;
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -110,21 +110,18 @@ SharedPlanarYCbCrImage::AdoptData(const 
   mOrigin = gfx::IntPoint(aData.mPicX, aData.mPicY);
 
   uint8_t *base = GetBuffer();
   uint32_t yOffset = aData.mYChannel - base;
   uint32_t cbOffset = aData.mCbChannel - base;
   uint32_t crOffset = aData.mCrChannel - base;
 
   auto fwd = mCompositable->GetForwarder();
-  bool supportsTextureDirectMapping = fwd->SupportsTextureDirectMapping() &&
-    std::max(mSize.width, mSize.height) <= fwd->GetMaxTextureSize();
   bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(
-    gfx::SurfaceFormat::YUV, fwd->GetCompositorBackendType(),
-    supportsTextureDirectMapping);
+    gfx::SurfaceFormat::YUV, fwd->GetCompositorBackendType());
 
   static_cast<BufferTextureData*>(mTextureClient->GetInternalData())
     ->SetDesciptor(YCbCrDescriptor(aData.mYSize,
                                    aData.mYStride,
                                    aData.mCbCrSize,
                                    aData.mCbCrStride,
                                    yOffset,
                                    cbOffset,
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -269,25 +269,23 @@ if CONFIG['MOZ_X11']:
         'composite/X11TextureHost.cpp',
         'ipc/ShadowLayerUtilsX11.cpp',
         'opengl/X11TextureSourceOGL.cpp',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.mozilla.layers += [
         'opengl/GLManager.h',
-        'TextureSync.h',
     ]
     EXPORTS += [
         'MacIOSurfaceHelpers.h',
         'MacIOSurfaceImage.h',
     ]
     UNIFIED_SOURCES += [
         'opengl/GLManager.cpp',
-        'TextureSync.cpp',
     ]
     SOURCES += [
         'ipc/ShadowLayerUtilsMac.cpp',
         'MacIOSurfaceHelpers.cpp',
         'MacIOSurfaceImage.cpp',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -20,26 +20,21 @@
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxUtils.h"                   // for gfxUtils, etc
 #include "mozilla/ArrayUtils.h"         // for ArrayLength
 #include "mozilla/Preferences.h"        // for Preferences
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4, Matrix
 #include "mozilla/gfx/Triangle.h"       // for Triangle
 #include "mozilla/gfx/gfxVars.h"        // for gfxVars
-#include "mozilla/layers/ImageDataSerializer.h"
 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
 #include "mozilla/layers/CompositingRenderTargetOGL.h"
 #include "mozilla/layers/Effects.h"     // for EffectChain, TexturedEffect, etc
 #include "mozilla/layers/TextureHost.h"  // for TextureSource, etc
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureSourceOGL, etc
-#include "mozilla/layers/PTextureParent.h" // for OtherPid() on PTextureParent
-#ifdef XP_DARWIN
-#include "mozilla/layers/TextureSync.h" // for TextureSync::etc.
-#endif
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsAppRunner.h"
 #include "nsAString.h"
 #include "nsIConsoleService.h"          // for nsIConsoleService, etc
 #include "nsIWidget.h"                  // for nsIWidget
 #include "nsLiteralString.h"            // for NS_LITERAL_STRING
 #include "nsMathUtils.h"                // for NS_roundf
 #include "nsRect.h"                     // for mozilla::gfx::IntRect
@@ -182,27 +177,21 @@ CompositorOGL::CompositorOGL(CompositorB
   , mSurfaceSize(aSurfaceWidth, aSurfaceHeight)
   , mHasBGRA(0)
   , mUseExternalSurfaceSize(aUseExternalSurfaceSize)
   , mFrameInProgress(false)
   , mDestroyed(false)
   , mViewportSize(0, 0)
   , mCurrentProgram(nullptr)
 {
-#ifdef XP_DARWIN
-  TextureSync::RegisterTextureSourceProvider(this);
-#endif
   MOZ_COUNT_CTOR(CompositorOGL);
 }
 
 CompositorOGL::~CompositorOGL()
 {
-#ifdef XP_DARWIN
-  TextureSync::UnregisterTextureSourceProvider(this);
-#endif
   MOZ_COUNT_DTOR(CompositorOGL);
   Destroy();
 }
 
 already_AddRefed<mozilla::gl::GLContext>
 CompositorOGL::CreateContext()
 {
   RefPtr<GLContext> context;
@@ -251,18 +240,16 @@ CompositorOGL::Destroy()
 {
   Compositor::Destroy();
 
   if (mTexturePool) {
     mTexturePool->Clear();
     mTexturePool = nullptr;
   }
 
-  mMaybeUnlockBeforeNextComposition.Clear();
-
   if (!mDestroyed) {
     mDestroyed = true;
     CleanupResources();
   }
 }
 
 void
 CompositorOGL::CleanupResources()
@@ -1881,103 +1868,16 @@ CompositorOGL::Resume()
 }
 
 already_AddRefed<DataTextureSource>
 CompositorOGL::CreateDataTextureSource(TextureFlags aFlags)
 {
   return MakeAndAddRef<TextureImageTextureSourceOGL>(this, aFlags);
 }
 
-already_AddRefed<DataTextureSource>
-CompositorOGL::CreateDataTextureSourceAroundYCbCr(TextureHost* aTexture)
-{
-  BufferTextureHost* bufferTexture = aTexture->AsBufferTextureHost();
-  MOZ_ASSERT(bufferTexture);
-
-  if (!bufferTexture) {
-    return nullptr;
-  }
-
-  uint8_t* buf = bufferTexture->GetBuffer();
-  const BufferDescriptor& buffDesc = bufferTexture->GetBufferDescriptor();
-  const YCbCrDescriptor& desc = buffDesc.get_YCbCrDescriptor();
-
-  RefPtr<gfx::DataSourceSurface> tempY =
-    gfx::Factory::CreateWrappingDataSourceSurface(ImageDataSerializer::GetYChannel(buf, desc),
-                                                  desc.yStride(),
-                                                  desc.ySize(),
-                                                  SurfaceFormatForAlphaBitDepth(desc.bitDepth()));
-  if (!tempY) {
-    return nullptr;
-  }
-  RefPtr<gfx::DataSourceSurface> tempCb =
-    gfx::Factory::CreateWrappingDataSourceSurface(ImageDataSerializer::GetCbChannel(buf, desc),
-                                                  desc.cbCrStride(),
-                                                  desc.cbCrSize(),
-                                                  SurfaceFormatForAlphaBitDepth(desc.bitDepth()));
-  if (!tempCb) {
-    return nullptr;
-  }
-  RefPtr<gfx::DataSourceSurface> tempCr =
-    gfx::Factory::CreateWrappingDataSourceSurface(ImageDataSerializer::GetCrChannel(buf, desc),
-                                                  desc.cbCrStride(),
-                                                  desc.cbCrSize(),
-                                                  SurfaceFormatForAlphaBitDepth(desc.bitDepth()));
-  if (!tempCr) {
-    return nullptr;
-  }
-
-  RefPtr<DirectMapTextureSource> srcY = new DirectMapTextureSource(this, tempY);
-  RefPtr<DirectMapTextureSource> srcU = new DirectMapTextureSource(this, tempCb);
-  RefPtr<DirectMapTextureSource> srcV = new DirectMapTextureSource(this, tempCr);
-
-  srcY->SetNextSibling(srcU);
-  srcU->SetNextSibling(srcV);
-
-  return srcY.forget();
-}
-
-#ifdef XP_DARWIN
-void
-CompositorOGL::MaybeUnlockBeforeNextComposition(TextureHost* aTextureHost)
-{
-  auto bufferTexture = aTextureHost->AsBufferTextureHost();
-  if (bufferTexture) {
-    mMaybeUnlockBeforeNextComposition.AppendElement(bufferTexture);
-  }
-}
-
-void
-CompositorOGL::TryUnlockTextures()
-{
-  nsClassHashtable<nsUint32HashKey, nsTArray<uint64_t>> texturesIdsToUnlockByPid;
-  for (auto& texture : mMaybeUnlockBeforeNextComposition) {
-    if (texture->IsDirectMap() && texture->CanUnlock()) {
-      texture->ReadUnlock();
-      auto actor = texture->GetIPDLActor();
-      if (actor) {
-        base::ProcessId pid = actor->OtherPid();
-        nsTArray<uint64_t>* textureIds = texturesIdsToUnlockByPid.LookupOrAdd(pid);
-        textureIds->AppendElement(TextureHost::GetTextureSerial(actor));
-      }
-    }
-  }
-  mMaybeUnlockBeforeNextComposition.Clear();
-  for (auto it = texturesIdsToUnlockByPid.ConstIter(); !it.Done(); it.Next()) {
-    TextureSync::SetTexturesUnlocked(it.Key(), *it.UserData());
-  }
-}
-#endif
-
-already_AddRefed<DataTextureSource>
-CompositorOGL::CreateDataTextureSourceAround(gfx::DataSourceSurface* aSurface)
-{
-  return MakeAndAddRef<DirectMapTextureSource>(this, aSurface);
-}
-
 bool
 CompositorOGL::SupportsPartialTextureUpdate()
 {
   return CanUploadSubTextures(mGLContext);
 }
 
 int32_t
 CompositorOGL::GetMaxTextureSize() const
@@ -2004,41 +1904,27 @@ CompositorOGL::BlitTextureImageHelper()
 {
     if (!mBlitTextureImageHelper) {
         mBlitTextureImageHelper = MakeUnique<GLBlitTextureImageHelper>(this);
     }
 
     return mBlitTextureImageHelper.get();
 }
 
+
+
 GLuint
 CompositorOGL::GetTemporaryTexture(GLenum aTarget, GLenum aUnit)
 {
   if (!mTexturePool) {
     mTexturePool = new PerUnitTexturePoolOGL(gl());
   }
   return mTexturePool->GetTexture(aTarget, aUnit);
 }
 
-bool
-CompositorOGL::SupportsTextureDirectMapping()
-{
-  if (!gfxPrefs::AllowTextureDirectMapping()) {
-    return false;
-  }
-
-  if (mGLContext) {
-    mGLContext->MakeCurrent();
-    return mGLContext->IsExtensionSupported(gl::GLContext::APPLE_client_storage) &&
-           mGLContext->IsExtensionSupported(gl::GLContext::APPLE_texture_range);
-  }
-
-  return false;
-}
-
 GLuint
 PerUnitTexturePoolOGL::GetTexture(GLenum aTarget, GLenum aTextureUnit)
 {
   if (mTextureTarget == 0) {
     mTextureTarget = aTarget;
   }
   MOZ_ASSERT(mTextureTarget == aTarget);
 
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -39,17 +39,16 @@ namespace mozilla {
 
 namespace layers {
 
 class CompositingRenderTarget;
 class CompositingRenderTargetOGL;
 class DataTextureSource;
 class GLManagerCompositor;
 class TextureSource;
-class BufferTextureHost;
 struct Effect;
 struct EffectChain;
 class GLBlitTextureImageHelper;
 
 /**
  * Interface for pools of temporary gl textures for the compositor.
  * The textures are fully owned by the pool, so the latter is responsible
  * calling fDeleteTextures accordingly.
@@ -127,33 +126,26 @@ protected:
   virtual ~CompositorOGL();
 
 public:
   virtual CompositorOGL* AsCompositorOGL() override { return this; }
 
   virtual already_AddRefed<DataTextureSource>
   CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) override;
 
-  virtual already_AddRefed<DataTextureSource>
-  CreateDataTextureSourceAroundYCbCr(TextureHost* aTexture) override;
-
-  virtual already_AddRefed<DataTextureSource>
-  CreateDataTextureSourceAround(gfx::DataSourceSurface* aSurface) override;
-
   virtual bool Initialize(nsCString* const out_failureReason) override;
 
   virtual void Destroy() override;
 
   virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override
   {
     TextureFactoryIdentifier result =
       TextureFactoryIdentifier(LayersBackend::LAYERS_OPENGL,
                                XRE_GetProcessType(),
                                GetMaxTextureSize(),
-                               SupportsTextureDirectMapping(),
                                false,
                                mFBOTextureTarget == LOCAL_GL_TEXTURE_2D,
                                SupportsPartialTextureUpdate());
     return result;
   }
 
   virtual already_AddRefed<CompositingRenderTarget>
   CreateRenderTarget(const gfx::IntRect &aRect, SurfaceInitMode aInit) override;
@@ -231,21 +223,16 @@ public:
   }
 
   virtual void Pause() override;
   virtual bool Resume() override;
 
   GLContext* gl() const { return mGLContext; }
   GLContext* GetGLContext() const override { return mGLContext; }
 
-#ifdef XP_DARWIN
-  virtual void MaybeUnlockBeforeNextComposition(TextureHost* aTextureHost) override;
-  virtual void TryUnlockTextures() override;
-#endif
-
   /**
    * Clear the program state. This must be called
    * before operating on the GLContext directly. */
   void ResetProgram();
 
   gfx::SurfaceFormat GetFBOFormat() const {
     return gfx::SurfaceFormat::R8G8B8A8;
   }
@@ -281,28 +268,22 @@ private:
                     const gfx::IntRect& aClipRect,
                     const EffectChain& aEffectChain,
                     gfx::Float aOpacity,
                     const gfx::Matrix4x4& aTransform,
                     const gfx::Rect& aVisibleRect);
 
   void PrepareViewport(CompositingRenderTargetOGL *aRenderTarget);
 
-  bool SupportsTextureDirectMapping();
-
   /** Widget associated with this compositor */
   LayoutDeviceIntSize mWidgetSize;
   RefPtr<GLContext> mGLContext;
   UniquePtr<GLBlitTextureImageHelper> mBlitTextureImageHelper;
   gfx::Matrix4x4 mProjMatrix;
 
-#ifdef XP_DARWIN
-  nsTArray<RefPtr<BufferTextureHost>> mMaybeUnlockBeforeNextComposition;
-#endif
-
   /** The size of the surface we are rendering to */
   gfx::IntSize mSurfaceSize;
 
   ScreenPoint mRenderOffset;
 
   already_AddRefed<mozilla::gl::GLContext> CreateContext();
 
   /** Texture target to use for FBOs */
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -237,36 +237,42 @@ TextureImageTextureSourceOGL::BindTextur
 
 ////////////////////////////////////////////////////////////////////////
 // GLTextureSource
 
 GLTextureSource::GLTextureSource(TextureSourceProvider* aProvider,
                                  GLuint aTextureHandle,
                                  GLenum aTarget,
                                  gfx::IntSize aSize,
-                                 gfx::SurfaceFormat aFormat)
+                                 gfx::SurfaceFormat aFormat,
+                                 bool aExternallyOwned)
   : mGL(aProvider->GetGLContext())
   , mTextureHandle(aTextureHandle)
   , mTextureTarget(aTarget)
   , mSize(aSize)
   , mFormat(aFormat)
+  , mExternallyOwned(aExternallyOwned)
 {
   MOZ_COUNT_CTOR(GLTextureSource);
 }
 
 GLTextureSource::~GLTextureSource()
 {
   MOZ_COUNT_DTOR(GLTextureSource);
-  DeleteTextureHandle();
+  if (!mExternallyOwned) {
+    DeleteTextureHandle();
+  }
 }
 
 void
 GLTextureSource::DeallocateDeviceData()
 {
-  DeleteTextureHandle();
+  if (!mExternallyOwned) {
+    DeleteTextureHandle();
+  }
 }
 
 void
 GLTextureSource::DeleteTextureHandle()
 {
   GLContext* gl = this->gl();
   if (mTextureHandle != 0 && gl && gl->MakeCurrent()) {
     gl->fDeleteTextures(1, &mTextureHandle);
@@ -305,108 +311,16 @@ GLTextureSource::SetTextureSourceProvide
 
 bool
 GLTextureSource::IsValid() const
 {
   return !!gl() && mTextureHandle != 0;
 }
 
 ////////////////////////////////////////////////////////////////////////
-// DirectMapTextureSource
-
-DirectMapTextureSource::DirectMapTextureSource(TextureSourceProvider* aProvider,
-                                               gfx::DataSourceSurface* aSurface)
-  : GLTextureSource(aProvider,
-                    0,
-                    LOCAL_GL_TEXTURE_2D,
-                    aSurface->GetSize(),
-                    aSurface->GetFormat())
-{
-  MOZ_ASSERT(aSurface);
-
-  UpdateInternal(aSurface, nullptr, nullptr, true);
-}
-
-bool
-DirectMapTextureSource::Update(gfx::DataSourceSurface* aSurface,
-                               nsIntRegion* aDestRegion,
-                               gfx::IntPoint* aSrcOffset)
-{
-  if (!aSurface) {
-    return false;
-  }
-
-  return UpdateInternal(aSurface, aDestRegion, aSrcOffset, false);
-}
-
-bool
-DirectMapTextureSource::Sync(bool aBlocking)
-{
-  gl()->MakeCurrent();
-  if (!gl()->IsDestroyed()) {
-    if (aBlocking) {
-      gl()->fFinishObjectAPPLE(LOCAL_GL_TEXTURE, mTextureHandle);
-    } else {
-      return gl()->fTestObjectAPPLE(LOCAL_GL_TEXTURE, mTextureHandle);
-    }
-  }
-  return true;
-}
-
-bool
-DirectMapTextureSource::UpdateInternal(gfx::DataSourceSurface* aSurface,
-                                       nsIntRegion* aDestRegion,
-                                       gfx::IntPoint* aSrcOffset,
-                                       bool aInit)
-{
-  gl()->MakeCurrent();
-
-  if (aInit) {
-    gl()->fGenTextures(1, &mTextureHandle);
-    gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTextureHandle);
-
-    gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D,
-                         LOCAL_GL_TEXTURE_STORAGE_HINT_APPLE,
-                         LOCAL_GL_STORAGE_CACHED_APPLE);
-
-    gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D,
-                         LOCAL_GL_TEXTURE_WRAP_S,
-                         LOCAL_GL_CLAMP_TO_EDGE);
-    gl()->fTexParameteri(LOCAL_GL_TEXTURE_2D,
-                         LOCAL_GL_TEXTURE_WRAP_T,
-                         LOCAL_GL_CLAMP_TO_EDGE);
-  }
-
-  MOZ_ASSERT(mTextureHandle);
-
-  // APPLE_client_storage
-  gl()->fPixelStorei(LOCAL_GL_UNPACK_CLIENT_STORAGE_APPLE, LOCAL_GL_TRUE);
-
-  nsIntRegion destRegion = aDestRegion ? *aDestRegion
-                                       : IntRect(0, 0,
-                                                 aSurface->GetSize().width,
-                                                 aSurface->GetSize().height);
-  gfx::IntPoint srcPoint = aSrcOffset ? *aSrcOffset
-                                      : gfx::IntPoint(0, 0);
-  mFormat = gl::UploadSurfaceToTexture(gl(),
-                                       aSurface,
-                                       destRegion,
-                                       mTextureHandle,
-                                       aSurface->GetSize(),
-                                       nullptr,
-                                       aInit,
-                                       srcPoint,
-                                       LOCAL_GL_TEXTURE0,
-                                       LOCAL_GL_TEXTURE_2D);
-
-  gl()->fPixelStorei(LOCAL_GL_UNPACK_CLIENT_STORAGE_APPLE, LOCAL_GL_FALSE);
-  return true;
-}
-
-////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 // SurfaceTextureHost
 
 #ifdef MOZ_WIDGET_ANDROID
 
 SurfaceTextureSource::SurfaceTextureSource(TextureSourceProvider* aProvider,
                                            mozilla::java::GeckoSurfaceTexture::Ref& aSurfTex,
                                            gfx::SurfaceFormat aFormat,
@@ -845,17 +759,18 @@ GLTextureHost::Lock()
 
   if (!mTextureSource) {
     gfx::SurfaceFormat format = mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8
                                           : gfx::SurfaceFormat::R8G8B8X8;
     mTextureSource = new GLTextureSource(mProvider,
                                          mTexture,
                                          mTarget,
                                          mSize,
-                                         format);
+                                         format,
+                                         false /* owned by the client */);
   }
 
   return true;
 }
 
 void
 GLTextureHost::SetTextureSourceProvider(TextureSourceProvider* aProvider)
 {
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -219,27 +219,28 @@ protected:
 /**
  * A texture source for GL textures.
  *
  * It does not own any GL texture, and attaches its shared handle to one of
  * the compositor's temporary textures when binding.
  *
  * The shared texture handle is owned by the TextureHost.
  */
-class GLTextureSource : public DataTextureSource
+class GLTextureSource : public TextureSource
                       , public TextureSourceOGL
 {
 public:
   GLTextureSource(TextureSourceProvider* aProvider,
                   GLuint aTextureHandle,
                   GLenum aTarget,
                   gfx::IntSize aSize,
-                  gfx::SurfaceFormat aFormat);
+                  gfx::SurfaceFormat aFormat,
+                  bool aExternallyOwned = false);
 
-  virtual ~GLTextureSource();
+  ~GLTextureSource();
 
   virtual const char* Name() const override { return "GLTextureSource"; }
 
   virtual GLTextureSource* AsGLTextureSource() override { return this; }
 
   virtual TextureSourceOGL* AsSourceOGL() override { return this; }
 
   virtual void BindTexture(GLenum activetex,
@@ -264,61 +265,28 @@ public:
   void SetFormat(gfx::SurfaceFormat aFormat) { mFormat = aFormat; }
 
   GLuint GetTextureHandle() const { return mTextureHandle; }
 
   gl::GLContext* gl() const {
     return mGL;
   }
 
-  virtual bool Update(gfx::DataSourceSurface* aSurface,
-                      nsIntRegion* aDestRegion = nullptr,
-                      gfx::IntPoint* aSrcOffset = nullptr) override
-  {
-    return false;
-  }
-
 protected:
   void DeleteTextureHandle();
 
   RefPtr<gl::GLContext> mGL;
   RefPtr<CompositorOGL> mCompositor;
   GLuint mTextureHandle;
   GLenum mTextureTarget;
   gfx::IntSize mSize;
   gfx::SurfaceFormat mFormat;
-};
-
-// This texture source try to wrap "aSurface" in ctor for compositor direct
-// access. Since we can't know the timing for gpu buffer access, the surface
-// should be alive until the ~ClientStorageTextureSource(). And if we try to
-// update the surface we mapped before, we need to call Sync() to make sure
-// the surface is not used by compositor.
-class DirectMapTextureSource : public GLTextureSource
-{
-public:
-  DirectMapTextureSource(TextureSourceProvider* aProvider,
-                         gfx::DataSourceSurface* aSurface);
-
-  virtual bool Update(gfx::DataSourceSurface* aSurface,
-                      nsIntRegion* aDestRegion = nullptr,
-                      gfx::IntPoint* aSrcOffset = nullptr) override;
-
-  virtual bool IsDirectMap() override { return true; }
-
-  // If aBlocking is false, check if this texture is no longer being used
-  // by the GPU - if aBlocking is true, this will block until the GPU is
-  // done with it.
-  virtual bool Sync(bool aBlocking) override;
-
-private:
-  bool UpdateInternal(gfx::DataSourceSurface* aSurface,
-                      nsIntRegion* aDestRegion,
-                      gfx::IntPoint* aSrcOffset,
-                      bool aInit);
+  // If the texture is externally owned, the gl handle will not be deleted
+  // in the destructor.
+  bool mExternallyOwned;
 };
 
 class GLTextureHost : public TextureHost
 {
 public:
   GLTextureHost(TextureFlags aFlags,
                 GLuint aTextureHandle,
                 GLenum aTarget,
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -508,22 +508,16 @@ private:
 
   // Disable surface sharing due to issues with compatible FBConfigs on
   // NVIDIA drivers as described in bug 1193015.
   DECL_GFX_PREF(Live, "gfx.use-glx-texture-from-pixmap",       UseGLXTextureFromPixmap, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-iosurface-textures",            UseIOSurfaceTextures, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-mutex-on-present",              UseMutexOnPresent, bool, false);
   DECL_GFX_PREF(Once, "gfx.use-surfacetexture-textures",       UseSurfaceTextureTextures, bool, false);
 
-#if defined(RELEASE_OR_BETA)
-  DECL_GFX_PREF(Once, "gfx.allow-texture-direct-mapping",      AllowTextureDirectMapping, bool, false);
-#else
-  DECL_GFX_PREF(Once, "gfx.allow-texture-direct-mapping",      AllowTextureDirectMapping, bool, true);
-#endif
-
   DECL_GFX_PREF(Live, "gfx.vsync.collect-scroll-transforms",   CollectScrollTransforms, bool, false);
   DECL_GFX_PREF(Once, "gfx.vsync.compositor.unobserve-count",  CompositorUnobserveCount, int32_t, 10);
 
   DECL_GFX_PREF(Once, "gfx.webrender.all",                     WebRenderAll, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.all.qualified",           WebRenderAllQualified, bool, false);
   DECL_GFX_PREF(Live, "gfx.webrender.blob-images",             WebRenderBlobImages, bool, true);
   DECL_GFX_PREF(Live, "gfx.webrender.blob.invalidation",       WebRenderBlobInvalidation, bool, false);
   DECL_GFX_PREF(Once, "gfx.webrender.enabled",                 WebRenderEnabledDoNotUseDirectly, bool, false);
--- a/ipc/glue/SharedMemoryBasic_mach.h
+++ b/ipc/glue/SharedMemoryBasic_mach.h
@@ -7,72 +7,46 @@
 #ifndef mozilla_ipc_SharedMemoryBasic_mach_h
 #define mozilla_ipc_SharedMemoryBasic_mach_h
 
 #include "base/file_descriptor_posix.h"
 #include "base/process.h"
 
 #include "SharedMemory.h"
 #include <mach/port.h>
-#include "chrome/common/mach_ipc_mac.h"
 
 #ifdef FUZZING
 #include "SharedMemoryFuzzer.h"
 #endif
 
 //
 // This is a low-level wrapper around platform shared memory.  Don't
 // use it directly; use Shmem allocated through IPDL interfaces.
 //
 
 class MachPortSender;
 class ReceivePort;
 
 namespace mozilla {
 namespace ipc {
 
-enum {
-  kGetPortsMsg = 1,
-  kSharePortsMsg,
-  kWaitForTexturesMsg,
-  kUpdateTextureLocksMsg,
-  kReturnIdMsg,
-  kReturnWaitForTexturesMsg,
-  kReturnPortsMsg,
-  kShutdownMsg,
-  kCleanupMsg,
-};
-
-struct MemoryPorts {
-  MachPortSender* mSender;
-  ReceivePort* mReceiver;
-
-  MemoryPorts() = default;
-  MemoryPorts(MachPortSender* sender, ReceivePort* receiver)
-   : mSender(sender), mReceiver(receiver) {}
-};
-
 class SharedMemoryBasic final : public SharedMemoryCommon<mach_port_t>
 {
 public:
   static void SetupMachMemory(pid_t pid,
                               ReceivePort* listen_port,
                               MachPortSender* listen_port_ack,
                               MachPortSender* send_port,
                               ReceivePort* send_port_ack,
                               bool pidIsParent);
 
   static void CleanupForPid(pid_t pid);
 
   static void Shutdown();
 
-  static bool SendMachMessage(pid_t pid,
-                              MachSendMessage& message,
-                              MachReceiveMessage* response);
-
   SharedMemoryBasic();
 
   virtual bool SetHandle(const Handle& aHandle, OpenRights aRights) override;
 
   virtual bool Create(size_t aNbytes) override;
 
   virtual bool Map(size_t nBytes) override;
 
--- a/ipc/glue/SharedMemoryBasic_mach.mm
+++ b/ipc/glue/SharedMemoryBasic_mach.mm
@@ -17,21 +17,21 @@
 #define mach_vm_region_recurse vm_region_recurse_64
 #define mach_vm_size_t vm_size_t
 #else
 #include <mach/mach_vm.h>
 #endif
 #include <pthread.h>
 #include <unistd.h>
 #include "SharedMemoryBasic.h"
+#include "chrome/common/mach_ipc_mac.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/Printf.h"
 #include "mozilla/StaticMutex.h"
-#include "mozilla/layers/TextureSync.h"
 
 #ifdef DEBUG
 #define LOG_ERROR(str, args...)                                   \
   PR_BEGIN_MACRO                                                  \
   mozilla::SmprintfPointer msg = mozilla::Smprintf(str, ## args); \
   NS_WARNING(msg.get());                                          \
   PR_END_MACRO
 #else
@@ -77,20 +77,39 @@
  * When a child shuts down, the parent notifies all other children. Those
  * children then have the opportunity to shut down any threads they might have
  * been using to communicate directly with that child.
  */
 
 namespace mozilla {
 namespace ipc {
 
+struct MemoryPorts {
+  MachPortSender* mSender;
+  ReceivePort* mReceiver;
+
+  MemoryPorts() = default;
+  MemoryPorts(MachPortSender* sender, ReceivePort* receiver)
+   : mSender(sender), mReceiver(receiver) {}
+};
+
 // Protects gMemoryCommPorts and gThreads.
 static StaticMutex gMutex;
+
 static std::map<pid_t, MemoryPorts> gMemoryCommPorts;
 
+enum {
+  kGetPortsMsg = 1,
+  kSharePortsMsg,
+  kReturnIdMsg,
+  kReturnPortsMsg,
+  kShutdownMsg,
+  kCleanupMsg,
+};
+
 const int kTimeout = 1000;
 const int kLongTimeout = 60 * kTimeout;
 
 pid_t gParentPid = 0;
 
 struct PIDPair {
   pid_t mRequester;
   pid_t mRequested;
@@ -130,17 +149,16 @@ SetupMachMemory(pid_t pid,
   if (pidIsParent) {
     gParentPid = pid;
   }
   auto* listen_ports = new MemoryPorts(listen_port_ack, listen_port);
   pthread_t thread;
   pthread_attr_t attr;
   pthread_attr_init(&attr);
   pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
   int err = pthread_create(&thread, &attr, PortServerThread, listen_ports);
   if (err) {
     LOG_ERROR("pthread_create failed with %x\n", err);
     return;
   }
 
   gMutex.AssertCurrentThreadOwns();
   gThreads[pid] = ListeningThread(thread, listen_ports);
@@ -382,46 +400,40 @@ PortServerThread(void *argument)
       continue;
     }
     if (rmsg.GetMessageID() == kShutdownMsg) {
       delete ports->mSender;
       delete ports->mReceiver;
       delete ports;
       return nullptr;
     }
-    if (rmsg.GetMessageID() == kWaitForTexturesMsg) {
-      layers::TextureSync::HandleWaitForTexturesMessage(&rmsg, ports);
-    } else if (rmsg.GetMessageID() == kUpdateTextureLocksMsg) {
-      layers::TextureSync::DispatchCheckTexturesForUnlock();
-    } else {
-      StaticMutexAutoLock smal(gMutex);
-      switch (rmsg.GetMessageID()) {
-      case kSharePortsMsg:
-        HandleSharePortsMessage(&rmsg, ports);
-        break;
-      case kGetPortsMsg:
-        HandleGetPortsMessage(&rmsg, ports);
-        break;
-      case kCleanupMsg:
-       if (gParentPid == 0) {
-         LOG_ERROR("Cleanup message not valid for parent process");
-         continue;
-       }
+    StaticMutexAutoLock smal(gMutex);
+    switch (rmsg.GetMessageID()) {
+    case kSharePortsMsg:
+      HandleSharePortsMessage(&rmsg, ports);
+      break;
+    case kGetPortsMsg:
+      HandleGetPortsMessage(&rmsg, ports);
+      break;
+    case kCleanupMsg:
+     if (gParentPid == 0) {
+       LOG_ERROR("Cleanup message not valid for parent process");
+       continue;
+     }
 
-        pid_t* pid;
-        if (rmsg.GetDataLength() != sizeof(pid_t)) {
-          LOG_ERROR("Improperly formatted message\n");
-          continue;
-        }
-        pid = reinterpret_cast<pid_t*>(rmsg.GetData());
-        SharedMemoryBasic::CleanupForPid(*pid);
-        break;
-      default:
-        LOG_ERROR("Unknown message\n");
+      pid_t* pid;
+      if (rmsg.GetDataLength() != sizeof(pid_t)) {
+        LOG_ERROR("Improperly formatted message\n");
+        continue;
       }
+      pid = reinterpret_cast<pid_t*>(rmsg.GetData());
+      SharedMemoryBasic::CleanupForPid(*pid);
+      break;
+    default:
+      LOG_ERROR("Unknown message\n");
     }
   }
 }
 
 void
 SharedMemoryBasic::SetupMachMemory(pid_t pid,
                                    ReceivePort* listen_port,
                                    MachPortSender* listen_port_ack,
@@ -433,18 +445,16 @@ SharedMemoryBasic::SetupMachMemory(pid_t
   mozilla::ipc::SetupMachMemory(pid, listen_port, listen_port_ack, send_port, send_port_ack, pidIsParent);
 }
 
 void
 SharedMemoryBasic::Shutdown()
 {
   StaticMutexAutoLock smal(gMutex);
 
-  layers::TextureSync::Shutdown();
-
   for (auto& thread : gThreads) {
     MachSendMessage shutdownMsg(kShutdownMsg);
     thread.second.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout);
   }
   gThreads.clear();
 
   for (auto& memoryCommPort : gMemoryCommPorts) {
     delete memoryCommPort.second.mSender;
@@ -454,19 +464,16 @@ SharedMemoryBasic::Shutdown()
 }
 
 void
 SharedMemoryBasic::CleanupForPid(pid_t pid)
 {
   if (gThreads.find(pid) == gThreads.end()) {
     return;
   }
-
-  layers::TextureSync::CleanupForPid(pid);
-
   const ListeningThread& listeningThread = gThreads[pid];
   MachSendMessage shutdownMsg(kShutdownMsg);
   kern_return_t ret = listeningThread.mPorts->mReceiver->SendMessageToSelf(shutdownMsg, kTimeout);
   if (ret != KERN_SUCCESS) {
     LOG_ERROR("sending shutdown msg failed %s %x\n", mach_error_string(ret), ret);
   }
   gThreads.erase(pid);
 
@@ -481,50 +488,16 @@ SharedMemoryBasic::CleanupForPid(pid_t p
   }
 
   MemoryPorts& ports = gMemoryCommPorts[pid];
   delete ports.mSender;
   delete ports.mReceiver;
   gMemoryCommPorts.erase(pid);
 }
 
-bool
-SharedMemoryBasic::SendMachMessage(pid_t pid,
-                                   MachSendMessage& message,
-                                   MachReceiveMessage* response)
-{
-  StaticMutexAutoLock smal(gMutex);
-  ipc::MemoryPorts* ports = GetMemoryPortsForPid(pid);
-  if (!ports) {
-    LOG_ERROR("Unable to get ports for process.\n");
-    return false;
-  }
-
-  kern_return_t err = ports->mSender->SendMessage(message, kTimeout);
-  if (err != KERN_SUCCESS) {
-    LOG_ERROR("Failed updating texture locks.\n");
-    return false;
-  }
-
-  if (response) {
-    err = ports->mReceiver->WaitForMessage(response, kTimeout);
-    if (err != KERN_SUCCESS) {
-      LOG_ERROR("short timeout didn't get an id %s %x\n", mach_error_string(err), err);
-      err = ports->mReceiver->WaitForMessage(response, kLongTimeout);
-
-      if (err != KERN_SUCCESS) {
-        LOG_ERROR("long timeout didn't get an id %s %x\n", mach_error_string(err), err);
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
 SharedMemoryBasic::SharedMemoryBasic()
   : mPort(MACH_PORT_NULL)
   , mMemory(nullptr)
   , mOpenRights(RightsReadWrite)
 {
 }
 
 SharedMemoryBasic::~SharedMemoryBasic()
deleted file mode 100644
--- a/xpcom/base/StaticMonitor.h
+++ /dev/null
@@ -1,129 +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/. */
-
-#ifndef mozilla_StaticMonitor_h
-#define mozilla_StaticMonitor_h
-
-#include "mozilla/Atomics.h"
-#include "mozilla/CondVar.h"
-
-namespace mozilla {
-
-class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS StaticMonitor
-{
-public:
-  // In debug builds, check that mMutex is initialized for us as we expect by
-  // the compiler.  In non-debug builds, don't declare a constructor so that
-  // the compiler can see that the constructor is trivial.
-#ifdef DEBUG
-  StaticMonitor()
-  {
-    MOZ_ASSERT(!mMutex);
-  }
-#endif
-
-  void Lock()
-  {
-    Mutex()->Lock();
-  }
-
-  void Unlock()
-  {
-    Mutex()->Unlock();
-  }
-
-  void Wait() { CondVar()->Wait(); }
-  CVStatus Wait(TimeDuration aDuration) { return CondVar()->Wait(aDuration); }
-
-  nsresult Notify() { return CondVar()->Notify(); }
-  nsresult NotifyAll() { return CondVar()->NotifyAll(); }
-
-  void AssertCurrentThreadOwns()
-  {
-#ifdef DEBUG
-    Mutex()->AssertCurrentThreadOwns();
-#endif
-  }
-
-private:
-  OffTheBooksMutex* Mutex()
-  {
-    if (mMutex) {
-      return mMutex;
-    }
-
-    OffTheBooksMutex* mutex = new OffTheBooksMutex("StaticMutex");
-    if (!mMutex.compareExchange(nullptr, mutex)) {
-      delete mutex;
-    }
-
-    return mMutex;
-  }
-
-  OffTheBooksCondVar* CondVar()
-  {
-    if (mCondVar) {
-      return mCondVar;
-    }
-
-    OffTheBooksCondVar* condvar = new OffTheBooksCondVar(*Mutex(), "StaticCondVar");
-    if (!mCondVar.compareExchange(nullptr, condvar)) {
-      delete condvar;
-    }
-
-    return mCondVar;
-  }
-
-  Atomic<OffTheBooksMutex*> mMutex;
-  Atomic<OffTheBooksCondVar*> mCondVar;
-
-
-  // Disallow copy constructor, but only in debug mode.  We only define
-  // a default constructor in debug mode (see above); if we declared
-  // this constructor always, the compiler wouldn't generate a trivial
-  // default constructor for us in non-debug mode.
-#ifdef DEBUG
-  StaticMonitor(const StaticMonitor& aOther);
-#endif
-
-  // Disallow these operators.
-  StaticMonitor& operator=(const StaticMonitor& aRhs);
-  static void* operator new(size_t) CPP_THROW_NEW;
-  static void operator delete(void*);
-};
-
-class MOZ_STACK_CLASS StaticMonitorAutoLock
-{
-public:
-  explicit StaticMonitorAutoLock(StaticMonitor& aMonitor)
-    : mMonitor(&aMonitor)
-  {
-    mMonitor->Lock();
-  }
-
-  ~StaticMonitorAutoLock()
-  {
-    mMonitor->Unlock();
-  }
-
-  void Wait() { mMonitor->Wait(); }
-  CVStatus Wait(TimeDuration aDuration) { return mMonitor->Wait(aDuration); }
-
-  nsresult Notify() { return mMonitor->Notify(); }
-  nsresult NotifyAll() { return mMonitor->NotifyAll(); }
-
-private:
-  StaticMonitorAutoLock();
-  StaticMonitorAutoLock(const StaticMonitorAutoLock&);
-  StaticMonitorAutoLock& operator=(const StaticMonitorAutoLock&);
-  static void* operator new(size_t) CPP_THROW_NEW;
-
-  StaticMonitor* mMonitor;
-};
-
-} // namespace mozilla
-
-#endif
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -112,17 +112,16 @@ EXPORTS.mozilla += [
     'IntentionalCrash.h',
     'JSObjectHolder.h',
     'Logging.h',
     'MemoryReportingProcess.h',
     'nsMemoryInfoDumper.h',
     'NSPRLogModulesParser.h',
     'OwningNonNull.h',
     'SizeOfState.h',
-    'StaticMonitor.h',
     'StaticMutex.h',
     'StaticPtr.h',
 ]
 
 # nsDebugImpl isn't unified because we disable PGO so that NS_ABORT_OOM isn't
 # optimized away oddly.
 SOURCES += [
     'nsDebugImpl.cpp',
--- a/xpcom/threads/BlockingResourceBase.cpp
+++ b/xpcom/threads/BlockingResourceBase.cpp
@@ -582,25 +582,25 @@ void
 RecursiveMutex::AssertCurrentThreadIn()
 {
   MOZ_ASSERT(IsAcquired() && mOwningThread == PR_GetCurrentThread());
 }
 
 //
 // Debug implementation of CondVar
 void
-OffTheBooksCondVar::Wait()
+CondVar::Wait()
 {
-  // Forward to the timed version of OffTheBooksCondVar::Wait to avoid code duplication.
+  // Forward to the timed version of CondVar::Wait to avoid code duplication.
   CVStatus status = Wait(TimeDuration::Forever());
   MOZ_ASSERT(status == CVStatus::NoTimeout);
 }
 
 CVStatus
-OffTheBooksCondVar::Wait(TimeDuration aDuration)
+CondVar::Wait(TimeDuration aDuration)
 {
   AssertCurrentThreadOwnsMutex();
 
   // save mutex state and reset to empty
   AcquisitionState savedAcquisitionState = mLock->GetAcquisitionState();
   BlockingResourceBase* savedChainPrev = mLock->mChainPrev;
   PRThread* savedOwningThread = mLock->mOwningThread;
   mLock->ClearAcquisitionState();
--- a/xpcom/threads/CondVar.h
+++ b/xpcom/threads/CondVar.h
@@ -12,48 +12,50 @@
 #include "mozilla/Mutex.h"
 
 #ifdef MOZILLA_INTERNAL_API
 #include "GeckoProfiler.h"
 #endif //MOZILLA_INTERNAL_API
 
 namespace mozilla {
 
+
 /**
- * Similarly to OffTheBooksMutex, OffTheBooksCondvar is identical to CondVar,
- * except that OffTheBooksCondVar doesn't include leak checking.  Sometimes
- * you want to intentionally "leak" a CondVar until shutdown; in these cases,
- * OffTheBooksCondVar is for you.
+ * CondVar
+ * Vanilla condition variable.  Please don't use this unless you have a
+ * compelling reason --- Monitor provides a simpler API.
  */
-class OffTheBooksCondVar : BlockingResourceBase
+class CondVar : BlockingResourceBase
 {
 public:
   /**
-   * OffTheBooksCondVar
+   * CondVar
    *
    * The CALLER owns |aLock|.
    *
    * @param aLock A Mutex to associate with this condition variable.
    * @param aName A name which can reference this monitor
    * @returns If failure, nullptr.
    *          If success, a valid Monitor* which must be destroyed
    *          by Monitor::DestroyMonitor()
    **/
-  OffTheBooksCondVar(OffTheBooksMutex& aLock, const char* aName)
+  CondVar(Mutex& aLock, const char* aName)
     : BlockingResourceBase(aName, eCondVar)
     , mLock(&aLock)
   {
+    MOZ_COUNT_CTOR(CondVar);
   }
 
   /**
-   * ~OffTheBooksCondVar
-   * Clean up after this OffTheBooksCondVar, but NOT its associated Mutex.
+   * ~CondVar
+   * Clean up after this CondVar, but NOT its associated Mutex.
    **/
-  ~OffTheBooksCondVar()
+  ~CondVar()
   {
+    MOZ_COUNT_DTOR(CondVar);
   }
 
   /**
    * Wait
    * @see prcvar.h
    **/
 #ifndef DEBUG
   void Wait()
@@ -118,45 +120,20 @@ public:
 
 #else
   void AssertCurrentThreadOwnsMutex() {}
   void AssertNotCurrentThreadOwnsMutex() {}
 
 #endif  // ifdef DEBUG
 
 private:
-  OffTheBooksCondVar();
-  OffTheBooksCondVar(const OffTheBooksCondVar&) = delete;
-  OffTheBooksCondVar& operator=(const OffTheBooksCondVar&) = delete;
-
-  OffTheBooksMutex* mLock;
-  detail::ConditionVariableImpl mImpl;
-};
+  CondVar();
+  CondVar(const CondVar&) = delete;
+  CondVar& operator=(const CondVar&) = delete;
 
-/**
- * CondVar
- * Vanilla condition variable.  Please don't use this unless you have a
- * compelling reason --- Monitor provides a simpler API.
- */
-class CondVar : public OffTheBooksCondVar
-{
-public:
-  CondVar(OffTheBooksMutex& aLock, const char* aName)
-    : OffTheBooksCondVar(aLock, aName)
-  {
-    MOZ_COUNT_CTOR(CondVar);
-  }
-
-  ~CondVar()
-  {
-    MOZ_COUNT_DTOR(CondVar);
-  }
-
-private:
-  CondVar();
-  CondVar(const CondVar&);
-  CondVar& operator=(const CondVar&);
+  Mutex* mLock;
+  detail::ConditionVariableImpl mImpl;
 };
 
 } // namespace mozilla
 
 
 #endif  // ifndef mozilla_CondVar_h
--- a/xpcom/threads/Mutex.h
+++ b/xpcom/threads/Mutex.h
@@ -99,17 +99,17 @@ public:
 
 #endif  // ifndef DEBUG
 
 private:
   OffTheBooksMutex();
   OffTheBooksMutex(const OffTheBooksMutex&);
   OffTheBooksMutex& operator=(const OffTheBooksMutex&);
 
-  friend class OffTheBooksCondVar;
+  friend class CondVar;
 
 #ifdef DEBUG
   PRThread* mOwningThread;
 #endif
 };
 
 /**
  * Mutex