2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Anonymous <anonymous@electronjs.org>
|
|
|
|
Date: Thu, 20 Sep 2018 17:45:36 -0700
|
|
|
|
Subject: compositor_delegate.patch
|
|
|
|
|
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
|
2019-01-24 09:42:21 +00:00
|
|
|
index 5aeda7bd9caf6b5b9e2a95293e4409dc7f9a6d2d..d15e1462babe97b5d68014f4d67236653046aa5f 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/browser/compositor/gpu_process_transport_factory.cc
|
|
|
|
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
|
2019-01-24 09:42:21 +00:00
|
|
|
@@ -485,10 +485,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
|
2018-09-14 05:02:16 +00:00
|
|
|
// surfaces as they are not following the correct mode.
|
|
|
|
DisableGpuCompositing(compositor.get());
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ std::unique_ptr<viz::SoftwareOutputDevice> output_device;
|
|
|
|
+ if (compositor->delegate()) {
|
|
|
|
+ output_device = compositor->delegate()->CreateSoftwareOutputDevice(
|
|
|
|
+ compositor.get());
|
|
|
|
+ }
|
|
|
|
+ if (!output_device) {
|
2018-09-14 18:03:43 +00:00
|
|
|
+ output_device = CreateSoftwareOutputDevice(compositor->widget(),
|
|
|
|
+ compositor->task_runner());
|
2018-09-14 05:02:16 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
display_output_surface =
|
|
|
|
std::make_unique<SoftwareBrowserCompositorOutputSurface>(
|
2018-09-14 18:03:43 +00:00
|
|
|
- CreateSoftwareOutputDevice(compositor->widget(),
|
|
|
|
- compositor->task_runner()),
|
2018-09-14 05:02:16 +00:00
|
|
|
+ std::move(output_device),
|
2018-09-14 18:03:43 +00:00
|
|
|
std::move(vsync_callback));
|
2018-09-14 05:02:16 +00:00
|
|
|
} else {
|
|
|
|
DCHECK(context_provider);
|
|
|
|
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
|
2019-01-16 18:07:52 +00:00
|
|
|
index a445b569ede1cd9331003e21b0427971d98ef924..087802fc0d47276c1449b4d9153756f6beb39bad 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/ui/compositor/compositor.h
|
|
|
|
+++ b/ui/compositor/compositor.h
|
2019-01-16 18:07:52 +00:00
|
|
|
@@ -25,6 +25,7 @@
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "components/viz/common/surfaces/frame_sink_id.h"
|
|
|
|
#include "components/viz/common/surfaces/local_surface_id.h"
|
|
|
|
#include "components/viz/host/host_frame_sink_client.h"
|
|
|
|
+#include "components/viz/service/display/software_output_device.h"
|
|
|
|
#include "third_party/skia/include/core/SkColor.h"
|
|
|
|
#include "third_party/skia/include/core/SkMatrix44.h"
|
|
|
|
#include "ui/compositor/compositor_animation_observer.h"
|
2019-01-16 18:07:52 +00:00
|
|
|
@@ -193,6 +194,15 @@ class COMPOSITOR_EXPORT ContextFactory {
|
2018-09-21 00:30:26 +00:00
|
|
|
virtual bool SyncTokensRequiredForDisplayCompositor() = 0;
|
2018-09-14 05:02:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
+class COMPOSITOR_EXPORT CompositorDelegate {
|
|
|
|
+ public:
|
|
|
|
+ virtual std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
|
|
|
+ ui::Compositor* compositor) = 0;
|
|
|
|
+
|
|
|
|
+ protected:
|
|
|
|
+ virtual ~CompositorDelegate() {}
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
// 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
|
2019-01-16 18:07:52 +00:00
|
|
|
@@ -232,6 +242,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
|
2018-09-14 05:02:16 +00:00
|
|
|
// Schedules a redraw of the layer tree associated with this compositor.
|
|
|
|
void ScheduleDraw();
|
|
|
|
|
|
|
|
+ CompositorDelegate* delegate() const { return delegate_; }
|
|
|
|
+ void SetDelegate(CompositorDelegate* delegate) { delegate_ = delegate; }
|
|
|
|
+
|
|
|
|
// 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
|
2019-01-16 18:07:52 +00:00
|
|
|
@@ -440,6 +453,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
|
2018-09-14 05:02:16 +00:00
|
|
|
ui::ContextFactory* context_factory_;
|
|
|
|
ui::ContextFactoryPrivate* context_factory_private_;
|
|
|
|
|
|
|
|
+ CompositorDelegate* delegate_ = nullptr;
|
|
|
|
+
|
|
|
|
// The root of the Layer tree drawn by this compositor.
|
|
|
|
Layer* root_layer_ = nullptr;
|
|
|
|
|