Backed out bug 1083101 for build bustage CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Thu, 24 Sep 2015 11:14:50 -0700
changeset 264257 5ce02bfa5d374e42553aa6712e7e24e4f578987d
parent 264256 e39dfd9e05cbdead9a9b7c9120fabb2c3be98270
child 264258 e22824771c7f6e72980fd6a2fee9bc49dfbc2c31
push id29431
push userkwierso@gmail.com
push dateThu, 24 Sep 2015 23:46:41 +0000
treeherdermozilla-central@eee426604698 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1083101
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out bug 1083101 for build bustage CLOSED TREE changesets backed out: e39dfd9e05cb, cd54e93993b4, 61db1a51a7c4, c20fd7506bb7, b5e97b0facb7, cdf356cb817e, b058a918f443, d421e79326a2, 34a0be9af3f3, bba6f89ab775, 2fd5cfcea4e5
gfx/2d/DrawCommand.h
gfx/2d/DrawTargetCapture.cpp
gfx/2d/DrawingJob.cpp
gfx/2d/DrawingJob.h
gfx/2d/IterableArena.h
gfx/2d/JobScheduler.cpp
gfx/2d/JobScheduler.h
gfx/2d/JobScheduler_posix.cpp
gfx/2d/JobScheduler_posix.h
gfx/2d/JobScheduler_win32.h
gfx/2d/Types.h
gfx/2d/moz.build
gfx/tests/gtest/TestArena.cpp
gfx/tests/gtest/TestJobScheduler.cpp
gfx/tests/gtest/moz.build
--- a/gfx/2d/DrawCommand.h
+++ b/gfx/2d/DrawCommand.h
@@ -1,20 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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_GFX_DRAWCOMMAND_H_
 #define MOZILLA_GFX_DRAWCOMMAND_H_
 
-
-#define _USE_MATH_DEFINES
-#include <math.h>
-
 #include "2D.h"
 #include "Filters.h"
 #include <vector>
 
 namespace mozilla {
 namespace gfx {
 
 enum class CommandType : int8_t {
@@ -30,28 +26,25 @@ enum class CommandType : int8_t {
   STROKE,
   FILL,
   FILLGLYPHS,
   MASK,
   MASKSURFACE,
   PUSHCLIP,
   PUSHCLIPRECT,
   POPCLIP,
-  SETTRANSFORM,
-  FLUSH
+  SETTRANSFORM
 };
 
 class DrawingCommand
 {
 public:
   virtual ~DrawingCommand() {}
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix* aTransform = nullptr) const = 0;
-
-  virtual bool GetAffectedRect(Rect& aDeviceRect, const Matrix& aTransform) const { return false; }
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix& aTransform) = 0;
 
 protected:
   explicit DrawingCommand(CommandType aType)
     : mType(aType)
   {
   }
 
   CommandType GetType() { return mType; }
@@ -132,17 +125,17 @@ public:
                      const DrawOptions& aOptions)
     : DrawingCommand(CommandType::DRAWSURFACE)
     , mSurface(aSurface), mDest(aDest)
     , mSource(aSource), mSurfOptions(aSurfOptions)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->DrawSurface(mSurface, mDest, mSource, mSurfOptions, mOptions);
   }
 
 private:
   RefPtr<SourceSurface> mSurface;
   Rect mDest;
   Rect mSource;
@@ -156,17 +149,17 @@ public:
   DrawFilterCommand(FilterNode* aFilter, const Rect& aSourceRect,
                     const Point& aDestPoint, const DrawOptions& aOptions)
     : DrawingCommand(CommandType::DRAWSURFACE)
     , mFilter(aFilter), mSourceRect(aSourceRect)
     , mDestPoint(aDestPoint), mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->DrawFilter(mFilter, mSourceRect, mDestPoint, mOptions);
   }
 
 private:
   RefPtr<FilterNode> mFilter;
   Rect mSourceRect;
   Point mDestPoint;
@@ -177,17 +170,17 @@ class ClearRectCommand : public DrawingC
 {
 public:
   explicit ClearRectCommand(const Rect& aRect)
     : DrawingCommand(CommandType::CLEARRECT)
     , mRect(aRect)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->ClearRect(mRect);
   }
 
 private:
   Rect mRect;
 };
 
@@ -199,23 +192,21 @@ public:
                      const IntPoint& aDestination)
     : DrawingCommand(CommandType::COPYSURFACE)
     , mSurface(aSurface)
     , mSourceRect(aSourceRect)
     , mDestination(aDestination)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix* aTransform) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix& aTransform)
   {
-    MOZ_ASSERT(!aTransform || !aTransform->HasNonIntegerTranslation());
+    MOZ_ASSERT(!aTransform.HasNonIntegerTranslation());
     Point dest(Float(mDestination.x), Float(mDestination.y));
-    if (aTransform) {
-      dest = (*aTransform) * dest;
-    }
+    dest = aTransform * dest;
     aDT->CopySurface(mSurface, mSourceRect, IntPoint(uint32_t(dest.x), uint32_t(dest.y)));
   }
 
 private:
   RefPtr<SourceSurface> mSurface;
   IntRect mSourceRect;
   IntPoint mDestination;
 };
@@ -228,27 +219,21 @@ public:
                   const DrawOptions& aOptions)
     : DrawingCommand(CommandType::FILLRECT)
     , mRect(aRect)
     , mPattern(aPattern)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->FillRect(mRect, mPattern, mOptions);
   }
 
-  bool GetAffectedRect(Rect& aDeviceRect, const Matrix& aTransform) const
-  {
-    aDeviceRect = aTransform.TransformBounds(mRect);
-    return true;
-  }
-
 private:
   Rect mRect;
   StoredPattern mPattern;
   DrawOptions mOptions;
 };
 
 class StrokeRectCommand : public DrawingCommand
 {
@@ -258,34 +243,28 @@ public:
                     const StrokeOptions& aStrokeOptions,
                     const DrawOptions& aOptions)
     : DrawingCommand(CommandType::STROKERECT)
     , mRect(aRect)
     , mPattern(aPattern)
     , mStrokeOptions(aStrokeOptions)
     , mOptions(aOptions)
   {
-    if (aStrokeOptions.mDashLength) {
-      mDashes.resize(aStrokeOptions.mDashLength);
-      mStrokeOptions.mDashPattern = &mDashes.front();
-      memcpy(&mDashes.front(), aStrokeOptions.mDashPattern, mStrokeOptions.mDashLength * sizeof(Float));
-    }
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->StrokeRect(mRect, mPattern, mStrokeOptions, mOptions);
   }
 
 private:
   Rect mRect;
   StoredPattern mPattern;
   StrokeOptions mStrokeOptions;
   DrawOptions mOptions;
-  std::vector<Float> mDashes;
 };
 
 class StrokeLineCommand : public DrawingCommand
 {
 public:
   StrokeLineCommand(const Point& aStart,
                     const Point& aEnd,
                     const Pattern& aPattern,
@@ -295,17 +274,17 @@ public:
     , mStart(aStart)
     , mEnd(aEnd)
     , mPattern(aPattern)
     , mStrokeOptions(aStrokeOptions)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->StrokeLine(mStart, mEnd, mPattern, mStrokeOptions, mOptions);
   }
 
 private:
   Point mStart;
   Point mEnd;
   StoredPattern mPattern;
@@ -321,105 +300,52 @@ public:
               const DrawOptions& aOptions)
     : DrawingCommand(CommandType::FILL)
     , mPath(const_cast<Path*>(aPath))
     , mPattern(aPattern)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->Fill(mPath, mPattern, mOptions);
   }
 
-  bool GetAffectedRect(Rect& aDeviceRect, const Matrix& aTransform) const
-  {
-    aDeviceRect = mPath->GetBounds(aTransform);
-    return true;
-  }
-
 private:
   RefPtr<Path> mPath;
   StoredPattern mPattern;
   DrawOptions mOptions;
 };
 
-#ifndef M_SQRT2
-#define M_SQRT2 1.41421356237309504880
-#endif
-
-#ifndef M_SQRT1_2
-#define M_SQRT1_2 0.707106781186547524400844362104849039
-#endif
-
-// The logic for this comes from _cairo_stroke_style_max_distance_from_path
-static Rect
-PathExtentsToMaxStrokeExtents(const StrokeOptions &aStrokeOptions,
-                              const Rect &aRect,
-                              const Matrix &aTransform)
-{
-  double styleExpansionFactor = 0.5f;
-
-  if (aStrokeOptions.mLineCap == CapStyle::SQUARE) {
-    styleExpansionFactor = M_SQRT1_2;
-  }
-
-  if (aStrokeOptions.mLineJoin == JoinStyle::MITER &&
-      styleExpansionFactor < M_SQRT2 * aStrokeOptions.mMiterLimit) {
-    styleExpansionFactor = M_SQRT2 * aStrokeOptions.mMiterLimit;
-  }
-
-  styleExpansionFactor *= aStrokeOptions.mLineWidth;
-
-  double dx = styleExpansionFactor * hypot(aTransform._11, aTransform._21);
-  double dy = styleExpansionFactor * hypot(aTransform._22, aTransform._12);
-
-  Rect result = aRect;
-  result.Inflate(dx, dy);
-  return result;
-}
-
 class StrokeCommand : public DrawingCommand
 {
 public:
   StrokeCommand(const Path* aPath,
                 const Pattern& aPattern,
                 const StrokeOptions& aStrokeOptions,
                 const DrawOptions& aOptions)
     : DrawingCommand(CommandType::STROKE)
     , mPath(const_cast<Path*>(aPath))
     , mPattern(aPattern)
     , mStrokeOptions(aStrokeOptions)
     , mOptions(aOptions)
   {
-    if (aStrokeOptions.mDashLength) {
-      mDashes.resize(aStrokeOptions.mDashLength);
-      mStrokeOptions.mDashPattern = &mDashes.front();
-      memcpy(&mDashes.front(), aStrokeOptions.mDashPattern, mStrokeOptions.mDashLength * sizeof(Float));
-    }
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->Stroke(mPath, mPattern, mStrokeOptions, mOptions);
   }
 
-  bool GetAffectedRect(Rect& aDeviceRect, const Matrix& aTransform) const
-  {
-    aDeviceRect = PathExtentsToMaxStrokeExtents(mStrokeOptions, mPath->GetBounds(aTransform), aTransform);
-    return true;
-  }
-
 private:
   RefPtr<Path> mPath;
   StoredPattern mPattern;
   StrokeOptions mStrokeOptions;
   DrawOptions mOptions;
-  std::vector<Float> mDashes;
 };
 
 class FillGlyphsCommand : public DrawingCommand
 {
 public:
   FillGlyphsCommand(ScaledFont* aFont,
                     const GlyphBuffer& aBuffer,
                     const Pattern& aPattern,
@@ -430,17 +356,17 @@ public:
     , mPattern(aPattern)
     , mOptions(aOptions)
     , mRenderingOptions(const_cast<GlyphRenderingOptions*>(aRenderingOptions))
   {
     mGlyphs.resize(aBuffer.mNumGlyphs);
     memcpy(&mGlyphs.front(), aBuffer.mGlyphs, sizeof(Glyph) * aBuffer.mNumGlyphs);
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     GlyphBuffer buf;
     buf.mNumGlyphs = mGlyphs.size();
     buf.mGlyphs = &mGlyphs.front();
     aDT->FillGlyphs(mFont, buf, mPattern, mOptions, mRenderingOptions);
   }
 
 private:
@@ -459,17 +385,17 @@ public:
               const DrawOptions& aOptions)
     : DrawingCommand(CommandType::MASK)
     , mSource(aSource)
     , mMask(aMask)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->Mask(mSource, mMask, mOptions);
   }
 
 private:
   StoredPattern mSource;
   StoredPattern mMask;
   DrawOptions mOptions;
@@ -485,17 +411,17 @@ public:
     : DrawingCommand(CommandType::MASKSURFACE)
     , mSource(aSource)
     , mMask(const_cast<SourceSurface*>(aMask))
     , mOffset(aOffset)
     , mOptions(aOptions)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->MaskSurface(mSource, mMask, mOffset, mOptions);
   }
 
 private:
   StoredPattern mSource;
   RefPtr<SourceSurface> mMask;
   Point mOffset;
@@ -506,17 +432,17 @@ class PushClipCommand : public DrawingCo
 {
 public:
   explicit PushClipCommand(const Path* aPath)
     : DrawingCommand(CommandType::PUSHCLIP)
     , mPath(const_cast<Path*>(aPath))
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->PushClip(mPath);
   }
 
 private:
   RefPtr<Path> mPath;
 };
 
@@ -524,73 +450,57 @@ class PushClipRectCommand : public Drawi
 {
 public:
   explicit PushClipRectCommand(const Rect& aRect)
     : DrawingCommand(CommandType::PUSHCLIPRECT)
     , mRect(aRect)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->PushClipRect(mRect);
   }
 
 private:
   Rect mRect;
 };
 
 class PopClipCommand : public DrawingCommand
 {
 public:
   PopClipCommand()
     : DrawingCommand(CommandType::POPCLIP)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix&)
   {
     aDT->PopClip();
   }
 };
 
 class SetTransformCommand : public DrawingCommand
 {
 public:
   explicit SetTransformCommand(const Matrix& aTransform)
     : DrawingCommand(CommandType::SETTRANSFORM)
     , mTransform(aTransform)
   {
   }
 
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix* aMatrix) const
+  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix& aMatrix)
   {
-    if (aMatrix) {
-      aDT->SetTransform(mTransform * (*aMatrix));
-    } else {
-      aDT->SetTransform(mTransform);
-    }
+    Matrix transform = mTransform;
+    transform *= aMatrix;
+    aDT->SetTransform(transform);
   }
 
 private:
   Matrix mTransform;
 };
 
-class FlushCommand : public DrawingCommand
-{
-public:
-  explicit FlushCommand()
-    : DrawingCommand(CommandType::FLUSH)
-  {
-  }
-
-  virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix*) const
-  {
-    aDT->Flush();
-  }
-};
-
 } // namespace gfx
 
 } // namespace mozilla
 
 
 #endif /* MOZILLA_GFX_DRAWCOMMAND_H_ */
--- a/gfx/2d/DrawTargetCapture.cpp
+++ b/gfx/2d/DrawTargetCapture.cpp
@@ -183,15 +183,15 @@ DrawTargetCaptureImpl::SetTransform(cons
 void
 DrawTargetCaptureImpl::ReplayToDrawTarget(DrawTarget* aDT, const Matrix& aTransform)
 {
   uint8_t* start = &mDrawCommandStorage.front();
 
   uint8_t* current = start;
 
   while (current < start + mDrawCommandStorage.size()) {
-    reinterpret_cast<DrawingCommand*>(current + sizeof(uint32_t))->ExecuteOnDT(aDT, &aTransform);
+    reinterpret_cast<DrawingCommand*>(current + sizeof(uint32_t))->ExecuteOnDT(aDT, aTransform);
     current += *(uint32_t*)current;
   }
 }
 
 } // namespace gfx
 } // namespace mozilla
deleted file mode 100644
--- a/gfx/2d/DrawingJob.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 "DrawingJob.h"
-#include "JobScheduler.h"
-#include "mozilla/gfx/2D.h"
-
-namespace mozilla {
-namespace gfx {
-
-DrawingJobBuilder::DrawingJobBuilder()
-{}
-
-DrawingJobBuilder::~DrawingJobBuilder()
-{
-  MOZ_ASSERT(!mDrawTarget);
-}
-
-void
-DrawingJob::Clear()
-{
-  mCommandBuffer = nullptr;
-  mCursor = 0;
-}
-
-void
-DrawingJobBuilder::BeginDrawingJob(DrawTarget* aTarget, IntPoint aOffset,
-                                     SyncObject* aStart)
-{
-  MOZ_ASSERT(mCommandOffsets.empty());
-  MOZ_ASSERT(aTarget);
-  mDrawTarget = aTarget;
-  mOffset = aOffset;
-  mStart = aStart;
-}
-
-DrawingJob*
-DrawingJobBuilder::EndDrawingJob(CommandBuffer* aCmdBuffer,
-                                   SyncObject* aCompletion,
-                                   WorkerThread* aPinToWorker)
-{
-  MOZ_ASSERT(mDrawTarget);
-  DrawingJob* task = new DrawingJob(mDrawTarget, mOffset, mStart, aCompletion, aPinToWorker);
-  task->mCommandBuffer = aCmdBuffer;
-  task->mCommandOffsets = Move(mCommandOffsets);
-
-  mDrawTarget = nullptr;
-  mOffset = IntPoint();
-  mStart = nullptr;
-
-  return task;
-}
-
-DrawingJob::DrawingJob(DrawTarget* aTarget, IntPoint aOffset,
-                         SyncObject* aStart, SyncObject* aCompletion,
-                         WorkerThread* aPinToWorker)
-: Job(aStart, aCompletion, aPinToWorker)
-, mCommandBuffer(nullptr)
-, mCursor(0)
-, mDrawTarget(aTarget)
-, mOffset(aOffset)
-{
-  mCommandOffsets.reserve(64);
-}
-
-JobStatus
-DrawingJob::Run()
-{
-  while (mCursor < mCommandOffsets.size()) {
-
-    const DrawingCommand* cmd = mCommandBuffer->GetDrawingCommand(mCommandOffsets[mCursor]);
-
-    if (!cmd) {
-      return JobStatus::Error;
-    }
-
-    cmd->ExecuteOnDT(mDrawTarget);
-
-    ++mCursor;
-  }
-
-  return JobStatus::Complete;
-}
-
-DrawingJob::~DrawingJob()
-{
-  Clear();
-}
-
-const DrawingCommand*
-CommandBuffer::GetDrawingCommand(ptrdiff_t aId)
-{
-  return static_cast<DrawingCommand*>(mStorage.GetStorage(aId));
-}
-
-CommandBuffer::~CommandBuffer()
-{
-  mStorage.ForEach([](void* item){
-    static_cast<DrawingCommand*>(item)->~DrawingCommand();
-  });
-  mStorage.Clear();
-}
-
-void
-CommandBufferBuilder::BeginCommandBuffer(size_t aBufferSize)
-{
-  MOZ_ASSERT(!mCommands);
-  mCommands = new CommandBuffer(aBufferSize);
-}
-
-already_AddRefed<CommandBuffer>
-CommandBufferBuilder::EndCommandBuffer()
-{
-  return mCommands.forget();
-}
-
-} // namespace
-} // namespace
deleted file mode 100644
--- a/gfx/2d/DrawingJob.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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_GFX_COMMANDBUFFER_H_
-#define MOZILLA_GFX_COMMANDBUFFER_H_
-
-#include <stdint.h>
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/Assertions.h"
-#include "mozilla/gfx/Matrix.h"
-#include "mozilla/gfx/JobScheduler.h"
-#include "mozilla/gfx/IterableArena.h"
-#include "DrawCommand.h"
-
-namespace mozilla {
-namespace gfx {
-
-class DrawingCommand;
-class PrintCommand;
-class SignalCommand;
-class DrawingJob;
-class WaitCommand;
-
-class SyncObject;
-class MultiThreadedJobQueue;
-
-class DrawTarget;
-
-class DrawingJobBuilder;
-class CommandBufferBuilder;
-
-/// Contains a sequence of immutable drawing commands that are typically used by
-/// several DrawingJobs.
-///
-/// CommandBuffer objects are built using CommandBufferBuilder.
-class CommandBuffer : public external::AtomicRefCounted<CommandBuffer>
-{
-public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(CommandBuffer)
-
-  ~CommandBuffer();
-
-  const DrawingCommand* GetDrawingCommand(ptrdiff_t aId);
-
-protected:
-  explicit CommandBuffer(size_t aSize = 256)
-  : mStorage(IterableArena::GROWABLE, aSize)
-  {}
-
-  IterableArena mStorage;
-  friend class CommandBufferBuilder;
-};
-
-/// Generates CommandBuffer objects.
-///
-/// The builder is a separate object to ensure that commands are not added to a
-/// submitted CommandBuffer.
-class CommandBufferBuilder
-{
-public:
-  void BeginCommandBuffer(size_t aBufferSize = 256);
-
-  already_AddRefed<CommandBuffer> EndCommandBuffer();
-
-  /// Build the CommandBuffer, command after command.
-  /// This must be used between BeginCommandBuffer and EndCommandBuffer.
-  template<typename T, typename... Args>
-  ptrdiff_t AddCommand(Args&&... aArgs)
-  {
-    static_assert(IsBaseOf<DrawingCommand, T>::value,
-                  "T must derive from DrawingCommand");
-    return mCommands->mStorage.Alloc<T>(Forward<Args>(aArgs)...);
-  }
-
-  bool HasCommands() const { return !!mCommands; }
-
-protected:
-  RefPtr<CommandBuffer> mCommands;
-};
-
-/// Stores multiple commands to be executed sequencially.
-class DrawingJob : public Job {
-public:
-  ~DrawingJob();
-
-  virtual JobStatus Run() override;
-
-protected:
-  DrawingJob(DrawTarget* aTarget,
-              IntPoint aOffset,
-              SyncObject* aStart,
-              SyncObject* aCompletion,
-              WorkerThread* aPinToWorker = nullptr);
-
-  /// Runs the tasks's destructors and resets the buffer.
-  void Clear();
-
-  std::vector<ptrdiff_t> mCommandOffsets;
-  RefPtr<CommandBuffer> mCommandBuffer;
-  uint32_t mCursor;
-
-  RefPtr<DrawTarget> mDrawTarget;
-  IntPoint mOffset;
-
-  friend class DrawingJobBuilder;
-};
-
-/// Generates DrawingJob objects.
-///
-/// The builder is a separate object to ensure that commands are not added to a
-/// submitted DrawingJob.
-class DrawingJobBuilder {
-public:
-  DrawingJobBuilder();
-
-  ~DrawingJobBuilder();
-
-  /// Allocates a DrawingJob.
-  ///
-  /// call this method before starting to add commands.
-  void BeginDrawingJob(DrawTarget* aTarget, IntPoint aOffset,
-                        SyncObject* aStart = nullptr);
-
-  /// Build the DrawingJob, command after command.
-  /// This must be used between BeginDrawingJob and EndDrawingJob.
-  void AddCommand(ptrdiff_t offset)
-  {
-    mCommandOffsets.push_back(offset);
-  }
-
-  /// Finalizes and returns the drawing task.
-  ///
-  /// If aCompletion is not null, the sync object will be signaled after the
-  /// task buffer is destroyed (and after the destructor of the tasks have run).
-  /// In most cases this means after the completion of all tasks in the task buffer,
-  /// but also when the task buffer is destroyed due to an error.
-  DrawingJob* EndDrawingJob(CommandBuffer* aCmdBuffer,
-                              SyncObject* aCompletion = nullptr,
-                              WorkerThread* aPinToWorker = nullptr);
-
-  /// Returns true between BeginDrawingJob and EndDrawingJob, false otherwise.
-  bool HasDrawingJob() const { return !!mDrawTarget; }
-
-protected:
-  std::vector<ptrdiff_t> mCommandOffsets;
-  RefPtr<DrawTarget> mDrawTarget;
-  IntPoint mOffset;
-  RefPtr<SyncObject> mStart;
-};
-
-} // namespace
-} // namespace
-
-#endif
deleted file mode 100644
--- a/gfx/2d/IterableArena.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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_GFX_ITERABLEARENA_H_
-#define MOZILLA_GFX_ITERABLEARENA_H_
-
-#include "mozilla/Move.h"
-#include "mozilla/Assertions.h"
-#include "mozilla/gfx/Logging.h"
-
-#include <string.h>
-#include <vector>
-#include <stdint.h>
-#include <stdio.h>
-
-namespace mozilla {
-namespace gfx {
-
-/// A simple pool allocator for plain data structures.
-///
-/// Beware that the pool will not attempt to run the destructors. It is the
-/// responsibility of the user of this class to either use objects with no
-/// destructor or to manually call the allocated objects destructors.
-/// If the pool is growable, its allocated objects must be safely moveable in
-/// in memory (through memcpy).
-class IterableArena {
-protected:
-  struct Header
-  {
-    size_t mBlocSize;
-  };
-public:
-  enum ArenaType {
-    FIXED_SIZE,
-    GROWABLE
-  };
-
-  IterableArena(ArenaType aType, size_t aStorageSize)
-  : mSize(aStorageSize)
-  , mCursor(0)
-  , mIsGrowable(aType == GROWABLE)
-  {
-    if (mSize == 0) {
-      mSize = 128;
-    }
-
-    mStorage = (uint8_t*)malloc(mSize);
-    if (mStorage == nullptr) {
-      gfxCriticalError() << "Not enough Memory allocate a memory pool of size " << aStorageSize;
-      MOZ_CRASH();
-    }
-  }
-
-  ~IterableArena()
-  {
-    free(mStorage);
-  }
-
-  /// Constructs a new item in the pool and returns a positive offset in case of
-  /// success.
-  ///
-  /// The offset never changes even if the storage is reallocated, so users
-  /// of this class should prefer storing offsets rather than direct pointers
-  /// to the allocated objects.
-  /// Alloc can cause the storage to be reallocated if the pool was initialized
-  /// with IterableArena::GROWABLE.
-  /// If for any reason the pool fails to allocate enough space for the new item
-  /// Alloc returns a negative offset and the object's constructor is not called.
-  template<typename T, typename... Args>
-  ptrdiff_t
-  Alloc(Args&&... aArgs)
-  {
-    void* storage = nullptr;
-    auto offset = AllocRaw(sizeof(T), &storage);
-    if (offset < 0) {
-      return offset;
-    }
-    new (storage) T(Forward<Args>(aArgs)...);
-    return offset;
-  }
-
-  ptrdiff_t AllocRaw(size_t aSize, void** aOutPtr = nullptr)
-  {
-    const size_t blocSize = AlignedSize(sizeof(Header) + aSize);
-
-    if (AlignedSize(mCursor + blocSize) > mSize) {
-      if (!mIsGrowable) {
-        return -1;
-      }
-
-      size_t newSize = mSize * 2;
-      while (AlignedSize(mCursor + blocSize) > newSize) {
-        newSize *= 2;
-      }
-
-      uint8_t* newStorage = (uint8_t*)realloc(mStorage, newSize);
-      if (!newStorage) {
-         gfxCriticalError() << "Not enough Memory to grow the memory pool, size: " << newSize;
-        return -1;
-      }
-
-      mStorage = newStorage;
-      mSize = newSize;
-    }
-    ptrdiff_t offset = mCursor;
-    GetHeader(offset)->mBlocSize = blocSize;
-    mCursor += blocSize;
-    if (aOutPtr) {
-        *aOutPtr = GetStorage(offset);
-    }
-    return offset;
-  }
-
-  /// Get access to an allocated item at a given offset (only use offsets returned
-  /// by Alloc or AllocRaw).
-  ///
-  /// If the pool is growable, the returned pointer is only valid temporarily. The
-  /// underlying storage can be reallocated in Alloc or AllocRaw, so do not keep
-  /// these pointers around and store the offset instead.
-  void* GetStorage(ptrdiff_t offset = 0)
-  {
-    MOZ_ASSERT(offset >= 0);
-    MOZ_ASSERT(offset < mCursor);
-    return offset >= 0 ? mStorage + offset + sizeof(Header) : nullptr;
-  }
-
-  /// Clears the storage without running any destructor and without deallocating it.
-  void Clear()
-  {
-    mCursor = 0;
-  }
-
-  /// Iterate over the elements allocated in this pool.
-  ///
-  /// Takes a lambda or function object accepting a void* as parameter.
-  template<typename Func>
-  void ForEach(Func cb)
-  {
-    Iterator it;
-    while (void* ptr = it.Next(this)) {
-      cb(ptr);
-    }
-  }
-
-  /// A simple iterator over an arena.
-  class Iterator {
-  public:
-    Iterator()
-    : mCursor(0)
-    {}
-
-    void* Next(IterableArena* aArena)
-    {
-      if (mCursor >= aArena->mCursor) {
-        return nullptr;
-      }
-      void* result = aArena->GetStorage(mCursor);
-      const size_t blocSize = aArena->GetHeader(mCursor)->mBlocSize;
-      MOZ_ASSERT(blocSize != 0);
-      mCursor += blocSize;
-      return result;
-    }
-
-  private:
-    ptrdiff_t mCursor;
-  };
-
-protected:
-  Header* GetHeader(ptrdiff_t offset)
-  {
-    return (Header*) (mStorage + offset);
-  }
-
-  size_t AlignedSize(size_t aSize) const
-  {
-    const size_t alignment = sizeof(uintptr_t);
-    return aSize + (alignment - (aSize % alignment)) % alignment;
-  }
-
-  uint8_t* mStorage;
-  uint32_t mSize;
-  ptrdiff_t mCursor;
-  bool mIsGrowable;
-
-  friend class Iterator;
-};
-
-} // namespace
-} // namespace
-
-#endif
deleted file mode 100644
--- a/gfx/2d/JobScheduler.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 "JobScheduler.h"
-
-namespace mozilla {
-namespace gfx {
-
-JobScheduler* JobScheduler::sSingleton = nullptr;
-
-bool JobScheduler::Init(uint32_t aNumThreads, uint32_t aNumQueues)
-{
-  MOZ_ASSERT(!sSingleton);
-  MOZ_ASSERT(aNumThreads >= aNumQueues);
-
-  sSingleton = new JobScheduler();
-  sSingleton->mNextQueue = 0;
-
-  for (uint32_t i = 0; i < aNumQueues; ++i) {
-    sSingleton->mDrawingQueues.push_back(new MultiThreadedJobQueue());
-  }
-
-  for (uint32_t i = 0; i < aNumThreads; ++i) {
-    sSingleton->mWorkerThreads.push_back(new WorkerThread(sSingleton->mDrawingQueues[i%aNumQueues]));
-  }
-  return true;
-}
-
-void JobScheduler::ShutDown()
-{
-  MOZ_ASSERT(IsEnabled());
-  if (!IsEnabled()) {
-    return;
-  }
-
-  for (auto queue : sSingleton->mDrawingQueues) {
-    queue->ShutDown();
-    delete queue;
-  }
-
-  for (WorkerThread* thread : sSingleton->mWorkerThreads) {
-    // this will block until the thread is joined.
-    delete thread;
-  }
-
-  sSingleton->mWorkerThreads.clear();
-  delete sSingleton;
-  sSingleton = nullptr;
-}
-
-JobStatus
-JobScheduler::ProcessJob(Job* aJob)
-{
-  MOZ_ASSERT(aJob);
-  auto status = aJob->Run();
-  if (status == JobStatus::Error || status == JobStatus::Complete) {
-    delete aJob;
-  }
-  return status;
-}
-
-void
-JobScheduler::SubmitJob(Job* aJob)
-{
-  MOZ_ASSERT(aJob);
-  RefPtr<SyncObject> start = aJob->GetStartSync();
-  if (start && start->Register(aJob)) {
-    // The Job buffer starts with a non-signaled sync object, it
-    // is now registered in the list of task buffers waiting on the
-    // sync object, so we should not place it in the queue.
-    return;
-  }
-
-  GetQueueForJob(aJob)->SubmitJob(aJob);
-}
-
-MultiThreadedJobQueue*
-JobScheduler::GetQueueForJob(Job* aJob)
-{
-  return aJob->IsPinnedToAThread() ? aJob->GetWorkerThread()->GetJobQueue()
-                                    : GetDrawingQueue();
-}
-
-Job::Job(SyncObject* aStart, SyncObject* aCompletion, WorkerThread* aThread)
-: mStartSync(aStart)
-, mCompletionSync(aCompletion)
-, mPinToThread(aThread)
-{
-  if (mStartSync) {
-    mStartSync->AddSubsequent(this);
-  }
-  if (mCompletionSync) {
-    mCompletionSync->AddPrerequisite(this);
-  }
-}
-
-Job::~Job()
-{
-  if (mCompletionSync) {
-    //printf(" -- Job %p dtor completion %p\n", this, mCompletionSync);
-    mCompletionSync->Signal();
-    mCompletionSync = nullptr;
-  }
-}
-
-JobStatus
-SetEventJob::Run()
-{
-  mEvent->Set();
-  return JobStatus::Complete;
-}
-
-SetEventJob::SetEventJob(EventObject* aEvent,
-                           SyncObject* aStart, SyncObject* aCompletion,
-                           WorkerThread* aWorker)
-: Job(aStart, aCompletion, aWorker)
-, mEvent(aEvent)
-{}
-
-SetEventJob::~SetEventJob()
-{}
-
-SyncObject::SyncObject(uint32_t aNumPrerequisites)
-: mSignals(aNumPrerequisites)
-#ifdef DEBUG
-, mNumPrerequisites(aNumPrerequisites)
-, mAddedPrerequisites(0)
-#endif
-{}
-
-SyncObject::~SyncObject()
-{
-  MOZ_ASSERT(mWaitingJobs.size() == 0);
-}
-
-bool
-SyncObject::Register(Job* aJob)
-{
-  MOZ_ASSERT(aJob);
-
-  // For now, ensure that when we schedule the first subsequent, we have already
-  // created all of the prerequisites. This is an arbitrary restriction because
-  // we specify the number of prerequisites in the constructor, but in the typical
-  // scenario, if the assertion FreezePrerequisite blows up here it probably means
-  // we got the initial nmber of prerequisites wrong. We can decide to remove
-  // this restriction if needed.
-  FreezePrerequisites();
-
-  int32_t signals = mSignals;
-
-  if (signals > 0) {
-    AddWaitingJob(aJob);
-    // Since Register and Signal can be called concurrently, it can happen that
-    // reading mSignals in Register happens before decrementing mSignals in Signal,
-    // but SubmitWaitingJobs happens before AddWaitingJob. This ordering means
-    // the SyncObject ends up in the signaled state with a task sitting in the
-    // waiting list. To prevent that we check mSignals a second time and submit
-    // again if signals reached zero in the mean time.
-    // We do this instead of holding a mutex around mSignals+mJobs to reduce
-    // lock contention.
-    int32_t signals2 = mSignals;
-    if (signals2 == 0) {
-      SubmitWaitingJobs();
-    }
-    return true;
-  }
-
-  return false;
-}
-
-void
-SyncObject::Signal()
-{
-  int32_t signals = --mSignals;
-  MOZ_ASSERT(signals >= 0);
-
-  if (signals == 0) {
-    SubmitWaitingJobs();
-  }
-}
-
-void
-SyncObject::AddWaitingJob(Job* aJob)
-{
-  MutexAutoLock lock(&mMutex);
-  mWaitingJobs.push_back(aJob);
-}
-
-void SyncObject::SubmitWaitingJobs()
-{
-  std::vector<Job*> tasksToSubmit;
-  {
-    // Scheduling the tasks can cause code that modifies <this>'s reference
-    // count to run concurrently, and cause the caller of this function to
-    // be owned by another thread. We need to make sure the reference count
-    // does not reach 0 on another thread before mWaitingJobs.clear(), so
-    // hold a strong ref to prevent that!
-    RefPtr<SyncObject> kungFuDeathGrip(this);
-
-    MutexAutoLock lock(&mMutex);
-    tasksToSubmit = Move(mWaitingJobs);
-    mWaitingJobs.clear();
-  }
-
-  for (Job* task : tasksToSubmit) {
-    JobScheduler::GetQueueForJob(task)->SubmitJob(task);
-  }
-}
-
-bool
-SyncObject::IsSignaled()
-{
-  return mSignals == 0;
-}
-
-void
-SyncObject::FreezePrerequisites()
-{
-  MOZ_ASSERT(mAddedPrerequisites == mNumPrerequisites);
-}
-
-void
-SyncObject::AddPrerequisite(Job* aJob)
-{
-  MOZ_ASSERT(++mAddedPrerequisites <= mNumPrerequisites);
-}
-
-void
-SyncObject::AddSubsequent(Job* aJob)
-{
-}
-
-} //namespace
-} //namespace
deleted file mode 100644
--- a/gfx/2d/JobScheduler.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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_GFX_TASKSCHEDULER_H_
-#define MOZILLA_GFX_TASKSCHEDULER_H_
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/gfx/Types.h"
-
-#ifdef WIN32
-#include "mozilla/gfx/JobScheduler_win32.h"
-#else
-#include "mozilla/gfx/JobScheduler_posix.h"
-#endif
-
-namespace mozilla {
-namespace gfx {
-
-class MultiThreadedJobQueue;
-class SyncObject;
-
-class JobScheduler {
-public:
-  /// Return one of the queues that the drawing worker threads pull from, chosen
-  /// pseudo-randomly.
-  static MultiThreadedJobQueue* GetDrawingQueue()
-  {
-    return sSingleton->mDrawingQueues[
-      sSingleton->mNextQueue++ % sSingleton->mDrawingQueues.size()
-    ];
-  }
-
-  /// Return one of the queues that the drawing worker threads pull from with a
-  /// hash to choose the queue.
-  ///
-  /// Calling this function several times with the same hash will yield the same queue.
-  static MultiThreadedJobQueue* GetDrawingQueue(uint32_t aHash)
-  {
-    return sSingleton->mDrawingQueues[
-      aHash % sSingleton->mDrawingQueues.size()
-    ];
-  }
-
-  /// Return the task queue associated to the worker the task is pinned to if
-  /// the task is pinned to a worker, or a random queue.
-  static MultiThreadedJobQueue* GetQueueForJob(Job* aJob);
-
-  /// Initialize the task scheduler with aNumThreads worker threads for drawing
-  /// and aNumQueues task queues.
-  ///
-  /// The number of threads must be superior or equal to the number of queues
-  /// (since for now a worker thread only pulls from one queue).
-  static bool Init(uint32_t aNumThreads, uint32_t aNumQueues);
-
-  /// Shut the scheduler down.
-  ///
-  /// This will block until worker threads are joined and deleted.
-  static void ShutDown();
-
-  /// Returns true if there is a successfully initialized JobScheduler singleton.
-  static bool IsEnabled() { return !!sSingleton; }
-
-  /// Submit a task buffer to its associated queue.
-  ///
-  /// The caller looses ownership of the task buffer.
-  static void SubmitJob(Job* aJobs);
-
-  /// Process commands until the command buffer needs to block on a sync object,
-  /// completes, yields, or encounters an error.
-  ///
-  /// Can be used on any thread. Worker threads basically loop over this, but the
-  /// main thread can also dequeue pending task buffers and process them alongside
-  /// the worker threads if it is about to block until completion anyway.
-  ///
-  /// The caller looses ownership of the task buffer.
-  static JobStatus ProcessJob(Job* aJobs);
-
-protected:
-  static JobScheduler* sSingleton;
-
-  // queues of Job that are ready to be processed
-  std::vector<MultiThreadedJobQueue*> mDrawingQueues;
-  std::vector<WorkerThread*> mWorkerThreads;
-  Atomic<uint32_t> mNextQueue;
-};
-
-/// Jobs are not reference-counted because they don't have shared ownership.
-/// The ownership of tasks can change when they are passed to certain methods
-/// of JobScheduler and SyncObject. See the docuumentaion of these classes.
-class Job {
-public:
-  Job(SyncObject* aStart, SyncObject* aCompletion, WorkerThread* aThread = nullptr);
-
-  virtual ~Job();
-
-  virtual JobStatus Run() = 0;
-
-  /// For use in JobScheduler::SubmitJob. Don't use it anywhere else.
-  //already_AddRefed<SyncObject> GetAndResetStartSync();
-  SyncObject* GetStartSync() { return mStartSync; }
-
-  bool IsPinnedToAThread() const { return !!mPinToThread; }
-
-  WorkerThread* GetWorkerThread() { return mPinToThread; }
-
-protected:
-  RefPtr<SyncObject> mStartSync;
-  RefPtr<SyncObject> mCompletionSync;
-  WorkerThread* mPinToThread;
-};
-
-class EventObject;
-
-/// This task will set an EventObject.
-///
-/// Typically used as the final task, so that the main thread can block on the
-/// corresponfing EventObject until all of the tasks are processed.
-class SetEventJob : public Job
-{
-public:
-  explicit SetEventJob(EventObject* aEvent,
-                        SyncObject* aStart, SyncObject* aCompletion = nullptr,
-                        WorkerThread* aPinToWorker = nullptr);
-
-  ~SetEventJob();
-
-  JobStatus Run() override;
-
-  EventObject* GetEvent() { return mEvent; }
-
-protected:
-  RefPtr<EventObject> mEvent;
-};
-
-/// A synchronization object that can be used to express dependencies and ordering between
-/// tasks.
-///
-/// Jobs can register to SyncObjects in order to asynchronously wait for a signal.
-/// In practice, Job objects usually start with a sync object (startSyc) and end
-/// with another one (completionSync).
-/// a Job never gets processed before its startSync is in the signaled state, and
-/// signals its completionSync as soon as it finishes. This is how dependencies
-/// between tasks is expressed.
-class SyncObject final : public external::AtomicRefCounted<SyncObject> {
-public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(SyncObject)
-
-  /// Create a synchronization object.
-  ///
-  /// aNumPrerequisites represents the number of times the object must be signaled
-  /// before actually entering the signaled state (in other words, it means the
-  /// number of dependencies of this sync object).
-  ///
-  /// Explicitly specifying the number of prerequisites when creating sync objects
-  /// makes it easy to start scheduling some of the prerequisite tasks while
-  /// creating the others, which is how we typically use the task scheduler.
-  /// Automatically determining the number of prerequisites using Job's constructor
-  /// brings the risk that the sync object enters the signaled state while we
-  /// are still adding prerequisites which is hard to fix without using muteces.
-  explicit SyncObject(uint32_t aNumPrerequisites = 1);
-
-  ~SyncObject();
-
-  /// Attempt to register a task.
-  ///
-  /// If the sync object is already in the signaled state, the buffer is *not*
-  /// registered and the sync object does not take ownership of the task.
-  /// If the object is not yet in the signaled state, it takes ownership of
-  /// the task and places it in a list of pending tasks.
-  /// Pending tasks will not be processed by the worker thread.
-  /// When the SyncObject reaches the signaled state, it places the pending
-  /// tasks back in the available buffer queue, so that they can be
-  /// scheduled again.
-  ///
-  /// Returns true if the SyncOject is not already in the signaled state.
-  /// This means that if this method returns true, the SyncObject has taken
-  /// ownership of the Job.
-  bool Register(Job* aJob);
-
-  /// Signal the SyncObject.
-  ///
-  /// This decrements an internal counter. The sync object reaches the signaled
-  /// state when the counter gets to zero.
-  void Signal();
-
-  /// Returns true if mSignals is equal to zero. In other words, returns true
-  /// if all prerequisite tasks have already signaled the sync object.
-  bool IsSignaled();
-
-  /// Asserts that the number of added prerequisites is equal to the number
-  /// specified in the constructor (does nothin in release builds).
-  void FreezePrerequisites();
-
-private:
-  // Called by Job's constructor
-  void AddSubsequent(Job* aJob);
-  void AddPrerequisite(Job* aJob);
-
-  void AddWaitingJob(Job* aJob);
-
-  void SubmitWaitingJobs();
-
-  std::vector<Job*> mWaitingJobs;
-  Mutex mMutex; // for concurrent access to mWaintingJobs
-  Atomic<int32_t> mSignals;
-
-#ifdef DEBUG
-  uint32_t mNumPrerequisites;
-  Atomic<uint32_t> mAddedPrerequisites;
-#endif
-
-  friend class Job;
-  friend class JobScheduler;
-};
-
-
-/// RAII helper.
-struct MutexAutoLock {
-    MutexAutoLock(Mutex* aMutex) : mMutex(aMutex) { mMutex->Lock(); }
-    ~MutexAutoLock() { mMutex->Unlock(); }
-protected:
-    Mutex* mMutex;
-};
-
-
-} // namespace
-} // namespace
-
-#endif
\ No newline at end of file
deleted file mode 100644
--- a/gfx/2d/JobScheduler_posix.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 "JobScheduler.h"
-#include "mozilla/gfx/Logging.h"
-
-using namespace std;
-
-namespace mozilla {
-namespace gfx {
-
-MultiThreadedJobQueue::MultiThreadedJobQueue()
-: mThreadsCount(0)
-, mShuttingDown(false)
-{}
-
-MultiThreadedJobQueue::~MultiThreadedJobQueue()
-{
-  MOZ_ASSERT(mJobs.empty());
-}
-
-bool
-MultiThreadedJobQueue::WaitForJob(Job*& aOutJob)
-{
-  return PopJob(aOutJob, BLOCKING);
-}
-
-bool
-MultiThreadedJobQueue::PopJob(Job*& aOutJobs, AccessType aAccess)
-{
-  for (;;) {
-    MutexAutoLock lock(&mMutex);
-
-    while (aAccess == BLOCKING && !mShuttingDown && mJobs.empty()) {
-      mAvailableCondvar.Wait(&mMutex);
-    }
-
-    if (mShuttingDown) {
-      return false;
-    }
-
-    if (mJobs.empty()) {
-      if (aAccess == NON_BLOCKING) {
-        return false;
-      }
-      continue;
-    }
-
-    Job* task = mJobs.front();
-    MOZ_ASSERT(task);
-
-    mJobs.pop_front();
-
-    aOutJobs = task;
-    return true;
-  }
-}
-
-void
-MultiThreadedJobQueue::SubmitJob(Job* aJobs)
-{
-  MOZ_ASSERT(aJobs);
-  MutexAutoLock lock(&mMutex);
-  mJobs.push_back(aJobs);
-  mAvailableCondvar.Broadcast();
-}
-
-size_t
-MultiThreadedJobQueue::NumJobs()
-{
-  MutexAutoLock lock(&mMutex);
-  return mJobs.size();
-}
-
-bool
-MultiThreadedJobQueue::IsEmpty()
-{
-  MutexAutoLock lock(&mMutex);
-  return mJobs.empty();
-}
-
-void
-MultiThreadedJobQueue::ShutDown()
-{
-  MutexAutoLock lock(&mMutex);
-  mShuttingDown = true;
-  while (mThreadsCount) {
-    mAvailableCondvar.Broadcast();
-    mShutdownCondvar.Wait(&mMutex);
-  }
-}
-
-void
-MultiThreadedJobQueue::RegisterThread()
-{
-  mThreadsCount += 1;
-}
-
-void
-MultiThreadedJobQueue::UnregisterThread()
-{
-  MutexAutoLock lock(&mMutex);
-  mThreadsCount -= 1;
-  if (mThreadsCount == 0) {
-    mShutdownCondvar.Broadcast();
-  }
-}
-
-void* ThreadCallback(void* threadData)
-{
-  WorkerThread* thread = (WorkerThread*)threadData;
-  thread->Run();
-  return nullptr;
-}
-
-WorkerThread::WorkerThread(MultiThreadedJobQueue* aJobQueue)
-: mQueue(aJobQueue)
-{
-  aJobQueue->RegisterThread();
-  pthread_create(&mThread, nullptr, ThreadCallback, this);
-}
-
-WorkerThread::~WorkerThread()
-{
-  pthread_join(mThread, nullptr);
-}
-
-void
-WorkerThread::SetName(const char* aName)
-{
-  // Call this from the thread itself because of Mac.
-#ifdef XP_MACOSX
-  pthread_setname_np(aName);
-#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
-  pthread_set_name_np(mThread, aName);
-#elif defined(__NetBSD__)
-  pthread_setname_np(mThread, "%s", (void*)aName);
-#else
-  pthread_setname_np(mThread, aName);
-#endif
-}
-
-void
-WorkerThread::Run()
-{
-  SetName("gfx worker");
-
-  for (;;) {
-    Job* commands = nullptr;
-    if (!mQueue->WaitForJob(commands)) {
-      mQueue->UnregisterThread();
-      return;
-    }
-
-    JobStatus status = JobScheduler::ProcessJob(commands);
-
-    if (status == JobStatus::Error) {
-      // Don't try to handle errors for now, but that's open to discussions.
-      // I expect errors to be mostly OOM issues.
-      MOZ_CRASH();
-    }
-  }
-}
-
-EventObject::EventObject()
-: mIsSet(false)
-{}
-
-EventObject::~EventObject()
-{}
-
-bool
-EventObject::Peak()
-{
-  MutexAutoLock lock(&mMutex);
-  return mIsSet;
-}
-
-void
-EventObject::Set()
-{
-  MutexAutoLock lock(&mMutex);
-  if (!mIsSet) {
-    mIsSet = true;
-    mCond.Broadcast();
-  }
-}
-
-void
-EventObject::Wait()
-{
-  MutexAutoLock lock(&mMutex);
-  if (mIsSet) {
-    return;
-  }
-  mCond.Wait(&mMutex);
-}
-
-} // namespce
-} // namespce
deleted file mode 100644
--- a/gfx/2d/JobScheduler_posix.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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 WIN32
-#ifndef MOZILLA_GFX_TASKSCHEDULER_POSIX_H_
-#define MOZILLA_GFX_TASKSCHEDULER_POSIX_H_
-
-#include <string>
-#include <vector>
-#include <list>
-#include <pthread.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#include "mozilla/RefPtr.h"
-#include "mozilla/DebugOnly.h"
-
-namespace mozilla {
-namespace gfx {
-
-class Job;
-class PosixCondVar;
-
-class Mutex {
-public:
-  Mutex() {
-    DebugOnly<int> err = pthread_mutex_init(&mMutex, nullptr);
-    MOZ_ASSERT(!err);
-  }
-
-  ~Mutex() {
-    DebugOnly<int> err = pthread_mutex_destroy(&mMutex);
-    MOZ_ASSERT(!err);
-  }
-
-  void Lock() {
-    DebugOnly<int> err = pthread_mutex_lock(&mMutex);
-    MOZ_ASSERT(!err);
-  }
-
-  void Unlock() {
-    DebugOnly<int> err = pthread_mutex_unlock(&mMutex);
-    MOZ_ASSERT(!err);
-  }
-
-protected:
-  pthread_mutex_t mMutex;
-  friend class PosixCondVar;
-};
-
-// posix platforms only!
-class PosixCondVar {
-public:
-  PosixCondVar() {
-    DebugOnly<int> err = pthread_cond_init(&mCond, nullptr);
-    MOZ_ASSERT(!err);
-  }
-
-  ~PosixCondVar() {
-    DebugOnly<int> err = pthread_cond_destroy(&mCond);
-    MOZ_ASSERT(!err);
-  }
-
-  void Wait(Mutex* aMutex) {
-    DebugOnly<int> err = pthread_cond_wait(&mCond, &aMutex->mMutex);
-    MOZ_ASSERT(!err);
-  }
-
-  void Broadcast() {
-    DebugOnly<int> err = pthread_cond_broadcast(&mCond);
-    MOZ_ASSERT(!err);
-  }
-
-protected:
-  pthread_cond_t mCond;
-};
-
-
-/// A simple and naive multithreaded task queue
-///
-/// The public interface of this class must remain identical to its equivalent
-/// in JobScheduler_win32.h
-class MultiThreadedJobQueue {
-public:
-  enum AccessType {
-    BLOCKING,
-    NON_BLOCKING
-  };
-
-  // Producer thread
-  MultiThreadedJobQueue();
-
-  // Producer thread
-  ~MultiThreadedJobQueue();
-
-  // Worker threads
-  bool WaitForJob(Job*& aOutJob);
-
-  // Any thread
-  bool PopJob(Job*& aOutJob, AccessType aAccess);
-
-  // Any threads
-  void SubmitJob(Job* aJob);
-
-  // Producer thread
-  void ShutDown();
-
-  // Any thread
-  size_t NumJobs();
-
-  // Any thread
-  bool IsEmpty();
-
-  // Producer thread
-  void RegisterThread();
-
-  // Worker threads
-  void UnregisterThread();
-
-protected:
-
-  std::list<Job*> mJobs;
-  Mutex mMutex;
-  PosixCondVar mAvailableCondvar;
-  PosixCondVar mShutdownCondvar;
-  int32_t mThreadsCount;
-  bool mShuttingDown;
-
-  friend class WorkerThread;
-};
-
-/// Worker thread that continuously dequeues Jobs from a MultiThreadedJobQueue
-/// and process them.
-///
-/// The public interface of this class must remain identical to its equivalent
-/// in JobScheduler_win32.h
-class WorkerThread {
-public:
-  explicit WorkerThread(MultiThreadedJobQueue* aJobQueue);
-
-  ~WorkerThread();
-
-  void Run();
-
-  MultiThreadedJobQueue* GetJobQueue() { return mQueue; }
-protected:
-  void SetName(const char* name);
-
-  MultiThreadedJobQueue* mQueue;
-  pthread_t mThread;
-};
-
-/// An object that a thread can synchronously wait on.
-/// Usually set by a SetEventJob.
-class EventObject : public external::AtomicRefCounted<EventObject>
-{
-public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(EventObject)
-
-  EventObject();
-
-  ~EventObject();
-
-  /// Synchronously wait until the event is set.
-  void Wait();
-
-  /// Return true if the event is set, without blocking.
-  bool Peak();
-
-  /// Set the event.
-  void Set();
-
-protected:
-  Mutex mMutex;
-  PosixCondVar mCond;
-  bool mIsSet;
-};
-
-} // namespace
-} // namespace
-
-#include "JobScheduler.h"
-
-#endif
-#endif
deleted file mode 100644
--- a/gfx/2d/JobScheduler_win32.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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/. */
-
-#ifdef WIN32
-#ifndef MOZILLA_GFX_TASKSCHEDULER_WIN32_H_
-#define MOZILLA_GFX_TASKSCHEDULER_WIN32_H_
-
-#define NOT_IMPLEMENTED MOZ_CRASH("Not implemented")
-
-#include "mozilla/RefPtr.h"
-
-namespace mozilla {
-namespace gfx {
-
-class WorkerThread;
-class Job;
-
-class Mutex {
-public:
-  Mutex() { NOT_IMPLEMENTED; }
-  ~Mutex() { NOT_IMPLEMENTED; }
-  void Lock() { NOT_IMPLEMENTED; }
-  void Unlock() { NOT_IMPLEMENTED; }
-};
-
-// The public interface of this class must remain identical to its equivalent
-// in JobScheduler_posix.h
-class MultiThreadedJobQueue {
-public:
-  enum AccessType {
-    BLOCKING,
-    NON_BLOCKING
-  };
-
-  bool WaitForJob(Job*& aOutCommands) { NOT_IMPLEMENTED; }
-  bool PopJob(Job*& aOutCommands, AccessType aAccess) { NOT_IMPLEMENTED; }
-  void SubmitJob(Job* aCommands) { NOT_IMPLEMENTED; }
-  void ShutDown() { NOT_IMPLEMENTED; }
-  size_t NumJobs() { NOT_IMPLEMENTED;  }
-  bool IsEmpty() { NOT_IMPLEMENTED; }
-  void RegisterThread() { NOT_IMPLEMENTED; }
-  void UnregisterThread() { NOT_IMPLEMENTED; }
-
-  friend class WorkerThread;
-};
-
-
-// The public interface of this class must remain identical to its equivalent
-// in JobScheduler_posix.h
-class EventObject : public external::AtomicRefCounted<EventObject>
-{
-public:
-  MOZ_DECLARE_REFCOUNTED_TYPENAME(EventObject)
-
-  EventObject() { NOT_IMPLEMENTED; }
-  ~EventObject() { NOT_IMPLEMENTED; }
-  void Wait() { NOT_IMPLEMENTED; }
-  bool Peak() { NOT_IMPLEMENTED; }
-  void Set() { NOT_IMPLEMENTED; }
-};
-
-// The public interface of this class must remain identical to its equivalent
-// in JobScheduler_posix.h
-class WorkerThread {
-public:
-  explicit WorkerThread(MultiThreadedJobQueue* aJobQueue) { NOT_IMPLEMENTED; }
-  void Run();
-};
-
-} // namespace
-} // namespace
-
-#endif
-#endif
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -284,23 +284,16 @@ struct GradientStop
   bool operator<(const GradientStop& aOther) const {
     return offset < aOther.offset;
   }
 
   Float offset;
   Color color;
 };
 
-enum class JobStatus {
-    Complete,
-    Wait,
-    Yield,
-    Error
-};
-
 } // namespace gfx
 } // namespace mozilla
 
 #if defined(XP_WIN) && defined(MOZ_GFX)
 #ifdef GFX2D_INTERNAL
 #define GFX2D_API __declspec(dllexport)
 #else
 #define GFX2D_API __declspec(dllimport)
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -20,20 +20,16 @@ EXPORTS.mozilla.gfx += [
     'Blur.h',
     'BorrowedContext.h',
     'Coord.h',
     'DataSurfaceHelpers.h',
     'DrawTargetTiled.h',
     'Filters.h',
     'Helpers.h',
     'HelpersCairo.h',
-    'IterableArena.h',
-    'JobScheduler.h',
-    'JobScheduler_posix.h',
-    'JobScheduler_win32.h',
     'Logging.h',
     'Matrix.h',
     'NumericTools.h',
     'PathHelpers.h',
     'PatternHelpers.h',
     'Point.h',
     'Quaternion.h',
     'Rect.h',
@@ -69,21 +65,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wi
         'ScaledFontDWrite.cpp',
         'ScaledFontWin.cpp',
         'SourceSurfaceD2D.cpp',
         'SourceSurfaceD2D1.cpp',
         'SourceSurfaceD2DTarget.cpp',
     ]
     DEFINES['WIN32'] = True
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'windows':
-    SOURCES += [
-        'JobScheduler_posix.cpp',
-    ]
-
 if CONFIG['MOZ_ENABLE_SKIA']:
     UNIFIED_SOURCES += [
         'convolver.cpp',
         'DrawTargetSkia.cpp',
         'PathSkia.cpp',
         'SourceSurfaceSkia.cpp',
     ]
     SOURCES += [
@@ -122,29 +113,27 @@ elif CONFIG['CPU_ARCH'].startswith('mips
             'convolverLS3.cpp',
         ]
 
 UNIFIED_SOURCES += [
     'Blur.cpp',
     'DataSourceSurface.cpp',
     'DataSurfaceHelpers.cpp',
     'DrawEventRecorder.cpp',
-    'DrawingJob.cpp',
     'DrawTarget.cpp',
     'DrawTargetCairo.cpp',
     'DrawTargetCapture.cpp',
     'DrawTargetDual.cpp',
     'DrawTargetRecording.cpp',
     'DrawTargetTiled.cpp',
     'Factory.cpp',
     'FilterNodeSoftware.cpp',
     'FilterProcessing.cpp',
     'FilterProcessingScalar.cpp',
     'ImageScaling.cpp',
-    'JobScheduler.cpp',
     'Matrix.cpp',
     'Path.cpp',
     'PathCairo.cpp',
     'PathRecording.cpp',
     'Quaternion.cpp',
     'RecordedEvent.cpp',
     'Scale.cpp',
     'ScaledFontBase.cpp',
deleted file mode 100644
--- a/gfx/tests/gtest/TestArena.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#include "mozilla/gfx/IterableArena.h"
-#include <string>
-
-using namespace mozilla;
-using namespace mozilla::gfx;
-
-#ifdef A
-#undef A
-#endif
-
-#ifdef B
-#undef B
-#endif
-
-// to avoid having symbols that collide easily like A and B in the global namespace
-namespace test_arena {
-
-class A;
-class B;
-
-class Base {
-public:
-  virtual ~Base() {}
-  virtual A* AsA() { return nullptr; }
-  virtual B* AsB() { return nullptr; }
-};
-
-static int sDtorItemA = 0;
-static int sDtorItemB = 0;
-
-class A : public Base {
-public:
-  virtual A* AsA() override { return this; }
-
-  explicit A(uint64_t val) : mVal(val) {}
-  ~A() { ++sDtorItemA; }
-
-  uint64_t mVal;
-};
-
-class B : public Base {
-public:
-  virtual B* AsB() override { return this; }
-
-  explicit B(const string& str) : mVal(str) {}
-  ~B() { ++sDtorItemB; }
-
-  std::string mVal;
-};
-
-struct BigStruct {
-  uint64_t mVal;
-  uint8_t data[120];
-
-  explicit BigStruct(uint64_t val) : mVal(val) {}
-};
-
-void TestArenaAlloc(IterableArena::ArenaType aType)
-{
-  sDtorItemA = 0;
-  sDtorItemB = 0;
-  IterableArena arena(aType, 256);
-
-  // An empty arena has no items to iterate over.
-  {
-    int iterations = 0;
-    arena.ForEach([&](void* item){
-      iterations++;
-    });
-    ASSERT_EQ(iterations, 0);
-  }
-
-  auto a1 = arena.Alloc<A>(42);
-  auto b1 = arena.Alloc<B>("Obladi oblada");
-  auto a2 = arena.Alloc<A>(1337);
-  auto b2 = arena.Alloc<B>("Yellow submarine");
-  auto b3 = arena.Alloc<B>("She's got a ticket to ride");
-
-  // Alloc returns a non-negative offset if the allocation succeeded.
-  ASSERT_TRUE(a1 >= 0);
-  ASSERT_TRUE(a2 >= 0);
-  ASSERT_TRUE(b1 >= 0);
-  ASSERT_TRUE(b2 >= 0);
-  ASSERT_TRUE(b3 >= 0);
-
-  ASSERT_TRUE(arena.GetStorage(a1) != nullptr);
-  ASSERT_TRUE(arena.GetStorage(a2) != nullptr);
-  ASSERT_TRUE(arena.GetStorage(b1) != nullptr);
-  ASSERT_TRUE(arena.GetStorage(b2) != nullptr);
-  ASSERT_TRUE(arena.GetStorage(b3) != nullptr);
-
-  ASSERT_TRUE(((Base*)arena.GetStorage(a1))->AsA() != nullptr);
-  ASSERT_TRUE(((Base*)arena.GetStorage(a2))->AsA() != nullptr);
-
-  ASSERT_TRUE(((Base*)arena.GetStorage(b1))->AsB() != nullptr);
-  ASSERT_TRUE(((Base*)arena.GetStorage(b2))->AsB() != nullptr);
-  ASSERT_TRUE(((Base*)arena.GetStorage(b3))->AsB() != nullptr);
-
-  ASSERT_EQ(((Base*)arena.GetStorage(a1))->AsA()->mVal, (uint64_t)42);
-  ASSERT_EQ(((Base*)arena.GetStorage(a2))->AsA()->mVal, (uint64_t)1337);
-
-  ASSERT_EQ(((Base*)arena.GetStorage(b1))->AsB()->mVal, std::string("Obladi oblada"));
-  ASSERT_EQ(((Base*)arena.GetStorage(b2))->AsB()->mVal, std::string("Yellow submarine"));
-  ASSERT_EQ(((Base*)arena.GetStorage(b3))->AsB()->mVal, std::string("She's got a ticket to ride"));
-
-  {
-    int iterations = 0;
-    arena.ForEach([&](void* item){
-      iterations++;
-    });
-    ASSERT_EQ(iterations, 5);
-  }
-
-  // Typically, running the destructors of the elements in the arena will is done
-  // manually like this:
-  arena.ForEach([](void* item){
-    ((Base*)item)->~Base();
-  });
-  arena.Clear();
-  ASSERT_EQ(sDtorItemA, 2);
-  ASSERT_EQ(sDtorItemB, 3);
-
-  // An empty arena has no items to iterate over (we just cleared it).
-  {
-    int iterations = 0;
-    arena.ForEach([&](void* item){
-      iterations++;
-    });
-    ASSERT_EQ(iterations, 0);
-  }
-
-}
-
-void TestArenaLimit(IterableArena::ArenaType aType, bool aShouldReachLimit)
-{
-  IterableArena arena(aType, 128);
-
-  // A non-growable arena should return a negative offset when running out
-  // of space, without crashing.
-  // We should not run out of space with a growable arena (unless the os is
-  // running out of memory but this isn't expected for this test).
-  bool reachedLimit = false;
-  for (int i = 0; i < 100; ++i) {
-    auto offset = arena.Alloc<A>(42);
-    if (offset < 0) {
-      reachedLimit = true;
-      break;
-    }
-  }
-  ASSERT_EQ(reachedLimit, aShouldReachLimit);
-}
-
-} // namespace test_arena
-
-using namespace test_arena;
-
-TEST(Moz2D, FixedArena) {
-  TestArenaAlloc(IterableArena::FIXED_SIZE);
-  TestArenaLimit(IterableArena::FIXED_SIZE, true);
-}
-
-TEST(Moz2D, GrowableArena) {
-  TestArenaAlloc(IterableArena::GROWABLE);
-  TestArenaLimit(IterableArena::GROWABLE, false);
-
-  IterableArena arena(IterableArena::GROWABLE, 16);
-  // sizeof(BigStruct) is more than twice the initial capacity, make sure that
-  // this doesn't blow everything up, since the arena doubles its storage size each
-  // time it grows (until it finds a size that fits).
-  auto a = arena.Alloc<BigStruct>(1);
-  auto b = arena.Alloc<BigStruct>(2);
-  auto c = arena.Alloc<BigStruct>(3);
-
-  // Offsets should also still point to the appropriate values after reallocation.
-  ASSERT_EQ(((BigStruct*)arena.GetStorage(a))->mVal, (uint64_t)1);
-  ASSERT_EQ(((BigStruct*)arena.GetStorage(b))->mVal, (uint64_t)2);
-  ASSERT_EQ(((BigStruct*)arena.GetStorage(c))->mVal, (uint64_t)3);
-
-  arena.Clear();
-}
deleted file mode 100644
--- a/gfx/tests/gtest/TestJobScheduler.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-#ifndef WIN32
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-#include "mozilla/gfx/JobScheduler.h"
-
-#include <pthread.h>
-#include <sched.h>
-#include <stdlib.h>
-#include <time.h>
-
-namespace test_scheduler {
-
-using namespace mozilla::gfx;
-using namespace mozilla;
-
-// Artificially cause threads to yield randomly in an attempt to make racy
-// things more apparent (if any).
-void MaybeYieldThread()
-{
-  if (rand() % 5 == 0) {
-    sched_yield();
-  }
-}
-
-/// Used by the TestCommand to check that tasks are processed in the right order.
-struct SanityChecker {
-  std::vector<uint64_t> mAdvancements;
-  mozilla::gfx::Mutex mMutex;
-
-  explicit SanityChecker(uint64_t aNumCmdBuffers)
-  {
-    for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
-      mAdvancements.push_back(0);
-    }
-  }
-
-  virtual void Check(uint64_t aJobId, uint64_t aCmdId)
-  {
-    MaybeYieldThread();
-    MutexAutoLock lock(&mMutex);
-    ASSERT_EQ(mAdvancements[aJobId], aCmdId-1);
-    mAdvancements[aJobId] = aCmdId;
-  }
-};
-
-/// Run checks that are specific to TestSchulerJoin.
-struct JoinTestSanityCheck : public SanityChecker {
-  bool mSpecialJobHasRun;
-
-  explicit JoinTestSanityCheck(uint64_t aNumCmdBuffers)
-  : SanityChecker(aNumCmdBuffers)
-  , mSpecialJobHasRun(false)
-  {}
-
-  virtual void Check(uint64_t aJobId, uint64_t aCmdId) override
-  {
-    // Job 0 is the special task executed when everything is joined after task 1
-    if (aCmdId == 0) {
-      ASSERT_FALSE(mSpecialJobHasRun);
-      mSpecialJobHasRun = true;
-      for (auto advancement : mAdvancements) {
-        // Because of the synchronization point (beforeFilter), all
-        // task buffers should have run task 1 when task 0 is run.
-        ASSERT_EQ(advancement, (uint32_t)1);
-      }
-    } else {
-      // This check does not apply to task 0.
-      SanityChecker::Check(aJobId, aCmdId);
-    }
-
-    if (aCmdId == 2) {
-      ASSERT_TRUE(mSpecialJobHasRun);
-    }
-  }
-};
-
-class TestJob : public Job
-{
-public:
-  TestJob(uint64_t aCmdId, uint64_t aJobId, SanityChecker* aChecker,
-           SyncObject* aStart, SyncObject* aCompletion)
-  : Job(aStart, aCompletion, nullptr)
-  , mCmdId(aCmdId)
-  , mCmdBufferId(aJobId)
-  , mSanityChecker(aChecker)
-  {}
-
-  JobStatus Run()
-  {
-    MaybeYieldThread();
-    mSanityChecker->Check(mCmdBufferId, mCmdId);
-    MaybeYieldThread();
-    return JobStatus::Complete;
-  }
-
-  uint64_t mCmdId;
-  uint64_t mCmdBufferId;
-  SanityChecker* mSanityChecker;
-};
-
-/// This test creates aNumCmdBuffers task buffers with sync objects set up
-/// so that all tasks will join after command 5 before a task buffer runs
-/// a special task (task 0) after which all task buffers fork again.
-/// This simulates the kind of scenario where all tiles must join at
-/// a certain point to execute, say, a filter, and fork again after the filter
-/// has been processed.
-/// The main thread is only blocked when waiting for the completion of the entire
-/// task stream (it doesn't have to wait at the filter's sync points to orchestrate it).
-void TestSchedulerJoin(uint32_t aNumThreads, uint32_t aNumCmdBuffers)
-{
-  JoinTestSanityCheck check(aNumCmdBuffers);
-
-  RefPtr<SyncObject> beforeFilter = new SyncObject(aNumCmdBuffers);
-  RefPtr<SyncObject> afterFilter = new SyncObject();
-  RefPtr<SyncObject> completion = new SyncObject(aNumCmdBuffers);
-
-
-  for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
-    Job* t1 = new TestJob(1, i, &check, nullptr, beforeFilter);
-    JobScheduler::SubmitJob(t1);
-    MaybeYieldThread();
-  }
-  beforeFilter->FreezePrerequisites();
-
-  // This task buffer is executed when all other tasks have joined after task 1
-  JobScheduler::SubmitJob(
-    new TestJob(0, 0, &check, beforeFilter, afterFilter)
-  );
-  afterFilter->FreezePrerequisites();
-
-  for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
-    Job* t2 = new TestJob(2, i, &check, afterFilter, completion);
-    JobScheduler::SubmitJob(t2);
-    MaybeYieldThread();
-  }
-  completion->FreezePrerequisites();
-
-  RefPtr<EventObject> waitForCompletion = new EventObject();
-  auto evtJob = new SetEventJob(waitForCompletion, completion);
-  JobScheduler::SubmitJob(evtJob);
-
-  MaybeYieldThread();
-
-  waitForCompletion->Wait();
-
-  MaybeYieldThread();
-
-  for (auto advancement : check.mAdvancements) {
-    ASSERT_TRUE(advancement == 2);
-  }
-}
-
-/// This test creates several chains of 10 task, tasks of a given chain are executed
-/// sequentially, and chains are exectuted in parallel.
-/// This simulates the typical scenario where we want to process sequences of drawing
-/// commands for several tiles in parallel.
-void TestSchedulerChain(uint32_t aNumThreads, uint32_t aNumCmdBuffers)
-{
-  SanityChecker check(aNumCmdBuffers);
-
-  RefPtr<SyncObject> completion = new SyncObject(aNumCmdBuffers);
-
-  uint32_t numJobs = 10;
-
-  for (uint32_t i = 0; i < aNumCmdBuffers; ++i) {
-
-    std::vector<RefPtr<SyncObject>> syncs;
-    std::vector<Job*> tasks;
-    syncs.reserve(numJobs);
-    tasks.reserve(numJobs);
-
-    for (uint32_t t = 0; t < numJobs-1; ++t) {
-      syncs.push_back(new SyncObject());
-      tasks.push_back(new TestJob(t+1, i, &check, t == 0 ? nullptr
-                                                          : syncs[t-1].get(),
-                                   syncs[t]));
-      syncs.back()->FreezePrerequisites();
-    }
-
-    tasks.push_back(new TestJob(numJobs, i, &check, syncs.back(), completion));
-
-    if (i % 2 == 0) {
-      // submit half of the tasks in order
-      for (Job* task : tasks) {
-        JobScheduler::SubmitJob(task);
-        MaybeYieldThread();
-      }
-    } else {
-      // ... and submit the other half in reverse order
-      for (int32_t reverse = numJobs-1; reverse >= 0; --reverse) {
-        JobScheduler::SubmitJob(tasks[reverse]);
-        MaybeYieldThread();
-      }
-    }
-  }
-  completion->FreezePrerequisites();
-
-  RefPtr<EventObject> waitForCompletion = new EventObject();
-  auto evtJob = new SetEventJob(waitForCompletion, completion);
-  JobScheduler::SubmitJob(evtJob);
-
-  MaybeYieldThread();
-
-  waitForCompletion->Wait();
-
-  for (auto advancement : check.mAdvancements) {
-    ASSERT_TRUE(advancement == numJobs);
-  }
-}
-
-} // namespace test_scheduler
-
-TEST(Moz2D, JobScheduler_Join) {
-  srand(time(nullptr));
-  for (uint32_t threads = 1; threads < 8; ++threads) {
-    for (uint32_t queues = 1; queues < threads; ++queues) {
-      for (uint32_t buffers = 1; buffers < 100; buffers += 3) {
-        mozilla::gfx::JobScheduler::Init(threads, queues);
-        test_scheduler::TestSchedulerJoin(threads, buffers);
-        mozilla::gfx::JobScheduler::ShutDown();
-      }
-    }
-  }
-}
-
-TEST(Moz2D, JobScheduler_Chain) {
-  srand(time(nullptr));
-  for (uint32_t threads = 1; threads < 8; ++threads) {
-    for (uint32_t queues = 1; queues < threads; ++queues) {
-      for (uint32_t buffers = 1; buffers < 100; buffers += 3) {
-        mozilla::gfx::JobScheduler::Init(threads, queues);
-        test_scheduler::TestSchedulerChain(threads, buffers);
-        mozilla::gfx::JobScheduler::ShutDown();
-      }
-    }
-  }
-}
-
-#endif
--- a/gfx/tests/gtest/moz.build
+++ b/gfx/tests/gtest/moz.build
@@ -3,23 +3,21 @@
 # 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/.
 
 UNIFIED_SOURCES += [
     'gfxSurfaceRefCountTest.cpp',
     # Disabled on suspicion of causing bug 904227
     #'gfxWordCacheTest.cpp',
-    'TestArena.cpp',
     'TestBufferRotation.cpp',
     'TestColorNames.cpp',
     'TestCompositor.cpp',
     'TestGfxPrefs.cpp',
     'TestGfxWidgets.cpp',
-    'TestJobScheduler.cpp',
     'TestLayers.cpp',
     'TestMoz2D.cpp',
     'TestQcms.cpp',
     'TestRect.cpp',
     'TestRegion.cpp',
     'TestSkipChars.cpp',
     # Hangs on linux in ApplyGdkScreenFontOptions
     #'gfxFontSelectionTest.cpp',