2015-01-01 17:51:56 +01:00
|
|
|
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
|
2018-06-19 00:08:20 +02:00
|
|
|
index ef785207cd5b..bafbce4fdfd4 100644
|
2015-01-01 17:51:56 +01:00
|
|
|
--- content/browser/compositor/gpu_process_transport_factory.cc
|
|
|
|
+++ content/browser/compositor/gpu_process_transport_factory.cc
|
2018-06-08 18:53:10 +02:00
|
|
|
@@ -494,10 +494,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel(
|
2017-12-07 22:44:24 +01: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-05-21 14:54:08 +02:00
|
|
|
+ output_device = CreateSoftwareOutputDevice(compositor->widget(),
|
|
|
|
+ compositor->task_runner());
|
2017-12-07 22:44:24 +01:00
|
|
|
+ }
|
2015-01-01 17:51:56 +01:00
|
|
|
+
|
2017-12-07 22:44:24 +01:00
|
|
|
display_output_surface =
|
|
|
|
std::make_unique<SoftwareBrowserCompositorOutputSurface>(
|
2018-05-21 14:54:08 +02:00
|
|
|
- CreateSoftwareOutputDevice(compositor->widget(),
|
|
|
|
- compositor->task_runner()),
|
2018-04-19 17:44:42 +02:00
|
|
|
+ std::move(output_device),
|
2018-05-21 14:54:08 +02:00
|
|
|
std::move(vsync_callback));
|
2017-12-07 22:44:24 +01:00
|
|
|
} else {
|
|
|
|
DCHECK(context_provider);
|
2015-01-01 17:51:56 +01:00
|
|
|
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
|
2018-06-19 00:08:20 +02:00
|
|
|
index 7efccc23d777..f355c678027b 100644
|
2015-01-01 17:51:56 +01:00
|
|
|
--- ui/compositor/compositor.h
|
|
|
|
+++ ui/compositor/compositor.h
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -24,6 +24,7 @@
|
2018-03-20 21:15:08 +01:00
|
|
|
#include "components/viz/common/surfaces/frame_sink_id.h"
|
2017-10-20 19:45:20 +02:00
|
|
|
#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"
|
2018-02-15 01:12:09 +01:00
|
|
|
#include "third_party/skia/include/core/SkMatrix44.h"
|
2017-10-20 19:45:20 +02:00
|
|
|
#include "ui/compositor/compositor_animation_observer.h"
|
2018-06-19 00:08:20 +02:00
|
|
|
@@ -191,6 +192,17 @@ class COMPOSITOR_EXPORT ContextFactory {
|
2018-06-08 18:53:10 +02:00
|
|
|
virtual bool SyncTokensRequiredForDisplayCompositor() = 0;
|
2015-01-01 17:51:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
+class COMPOSITOR_EXPORT CompositorDelegate {
|
|
|
|
+ public:
|
2017-10-20 19:45:20 +02:00
|
|
|
+ virtual std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
2015-01-01 17:51:56 +01:00
|
|
|
+ ui::Compositor* compositor) {
|
2016-05-25 01:35:43 +02:00
|
|
|
+ return nullptr;
|
2015-01-01 17:51:56 +01:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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
|
2018-06-19 00:08:20 +02:00
|
|
|
@@ -231,6 +243,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
|
2015-01-01 17:51:56 +01: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
|
2018-06-19 00:08:20 +02:00
|
|
|
@@ -455,6 +470,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
|
2015-01-01 17:51:56 +01:00
|
|
|
ui::ContextFactory* context_factory_;
|
2017-01-23 18:36:54 +01:00
|
|
|
ui::ContextFactoryPrivate* context_factory_private_;
|
2015-01-01 17:51:56 +01:00
|
|
|
|
|
|
|
+ CompositorDelegate* delegate_ = nullptr;
|
|
|
|
+
|
|
|
|
// The root of the Layer tree drawn by this compositor.
|
2017-04-20 21:28:17 +02:00
|
|
|
Layer* root_layer_ = nullptr;
|
2015-01-01 17:51:56 +01:00
|
|
|
|