    // Sets the root of the layer tree drawn by this Compositor. The root layer
    // must have no parent. The compositor's root layer is reset if the root layer
    // is destroyed. NULL can be passed to reset the root layer, in which case the
-@@ -379,6 +392,8 @@ class COMPOSITOR_EXPORT Compositor
+@@ -426,6 +439,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
    ui::ContextFactory* context_factory_;
    ui::ContextFactoryPrivate* context_factory_private_;
  

diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 50a66bb..73a9515 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -217,6 +217,12 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {
 std::unique_ptr<cc::SoftwareOutputDevice>
 GpuProcessTransportFactory::CreateSoftwareOutputDevice(
     ui::Compositor* compositor) {
+  if (compositor->delegate()) {
+    std::unique_ptr<cc::SoftwareOutputDevice> output_device =
+      compositor->delegate()->CreateSoftwareOutputDevice(compositor);
+    if (output_device)
+      return output_device;
+  }
   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
   if (command_line->HasSwitch(switches::kHeadless))
     return base::WrapUnique(new cc::SoftwareOutputDevice);
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index a3bc8cafc574..6cca225c2ba2 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -19,6 +19,7 @@
 #include "build/build_config.h"
 #include "cc/trees/layer_tree_host_client.h"
 #include "cc/trees/layer_tree_host_single_thread_client.h"
+#include "cc/output/software_output_device.h"
 #include "components/viz/common/frame_sinks/begin_frame_args.h"
 #include "components/viz/common/surfaces/local_surface_id.h"
 #include "components/viz/common/surfaces/surface_sequence.h"
@@ -168,6 +169,15 @@ class COMPOSITOR_EXPORT CompositorLock
   virtual void RemoveObserver(ContextFactoryObserver* observer) = 0;
 };
 
+class COMPOSITOR_EXPORT CompositorDelegate {
+ public:
+  virtual std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
+      ui::Compositor* compositor) = 0;
+
+ protected:

 // Compositor object to take care of GPU painting.
 // A Browser compositor object is responsible for generating the final
 // displayable form of pixels comprising a single widget's contents. It draws an
@@ -215,6 +225,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
   // Schedules a redraw of the layer tree associated with this compositor.
   void ScheduleDraw();
 
