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
|
2017-04-25 01:57:53 +02:00
|
|
|
index aab05cd..d1532b6 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
|
2017-03-03 23:37:23 +01:00
|
|
|
@@ -220,6 +220,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {
|
2016-05-25 01:35:43 +02:00
|
|
|
std::unique_ptr<cc::SoftwareOutputDevice>
|
2015-06-06 00:06:48 +02:00
|
|
|
GpuProcessTransportFactory::CreateSoftwareOutputDevice(
|
2015-01-01 17:51:56 +01:00
|
|
|
ui::Compositor* compositor) {
|
|
|
|
+ if (compositor->delegate()) {
|
2016-05-25 01:35:43 +02:00
|
|
|
+ std::unique_ptr<cc::SoftwareOutputDevice> output_device =
|
2015-01-01 17:51:56 +01:00
|
|
|
+ compositor->delegate()->CreateSoftwareOutputDevice(compositor);
|
2016-05-25 01:35:43 +02:00
|
|
|
+ if (output_device)
|
2015-01-01 17:51:56 +01:00
|
|
|
+ return output_device;
|
|
|
|
+ }
|
|
|
|
+
|
2017-01-23 18:36:54 +01:00
|
|
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
|
|
|
if (command_line->HasSwitch(switches::kHeadless))
|
|
|
|
return base::WrapUnique(new cc::SoftwareOutputDevice);
|
2015-01-01 17:51:56 +01:00
|
|
|
diff --git ui/compositor/compositor.h ui/compositor/compositor.h
|
2017-03-03 23:37:23 +01:00
|
|
|
index 92696ad..50aa222 100644
|
2015-01-01 17:51:56 +01:00
|
|
|
--- ui/compositor/compositor.h
|
|
|
|
+++ ui/compositor/compositor.h
|
2016-08-31 13:25:56 +02:00
|
|
|
@@ -18,6 +18,7 @@
|
2015-01-01 17:51:56 +01:00
|
|
|
#include "base/time/time.h"
|
2016-08-31 13:25:56 +02:00
|
|
|
#include "build/build_config.h"
|
2015-04-20 13:11:11 +02:00
|
|
|
#include "cc/output/begin_frame_args.h"
|
2015-01-01 17:51:56 +01:00
|
|
|
+#include "cc/output/software_output_device.h"
|
|
|
|
#include "cc/surfaces/surface_sequence.h"
|
|
|
|
#include "cc/trees/layer_tree_host_client.h"
|
|
|
|
#include "cc/trees/layer_tree_host_single_thread_client.h"
|
2017-03-03 23:37:23 +01:00
|
|
|
@@ -190,6 +191,17 @@ class COMPOSITOR_EXPORT CompositorLock
|
2016-05-25 01:35:43 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CompositorLock);
|
2015-01-01 17:51:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
+class COMPOSITOR_EXPORT CompositorDelegate {
|
|
|
|
+ public:
|
2016-05-25 01:35:43 +02:00
|
|
|
+ virtual std::unique_ptr<cc::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
|
2017-03-03 23:37:23 +01:00
|
|
|
@@ -219,6 +231,9 @@ class COMPOSITOR_EXPORT Compositor
|
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
|
2017-03-03 23:37:23 +01:00
|
|
|
@@ -398,6 +413,8 @@ class COMPOSITOR_EXPORT Compositor
|
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.
|
|
|
|
Layer* root_layer_;
|
|
|
|
|