Index: content/browser/renderer_host/image_transport_factory.cc |
diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc |
index e37ea28433836bb2acf8f625fbb23bb29a6d30d5..87a6549b12d9f15a208b17385fbc07dbefc365e8 100644 |
--- a/content/browser/renderer_host/image_transport_factory.cc |
+++ b/content/browser/renderer_host/image_transport_factory.cc |
@@ -19,6 +19,7 @@ |
#include "content/browser/gpu/gpu_data_manager_impl.h" |
#include "content/browser/gpu/gpu_process_host.h" |
#include "content/browser/gpu/gpu_surface_tracker.h" |
+#include "content/browser/renderer_host/software_output_device.h" |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
#include "content/common/gpu/client/gl_helper.h" |
#include "content/common/gpu/client/gpu_channel_host.h" |
@@ -33,6 +34,7 @@ |
#include "third_party/khronos/GLES2/gl2ext.h" |
#include "ui/compositor/compositor.h" |
#include "ui/compositor/compositor_setup.h" |
+#include "ui/compositor/compositor_switches.h" |
#include "ui/compositor/test_web_graphics_context_3d.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/size.h" |
@@ -669,6 +671,16 @@ WebKit::WebGraphicsContext3D* CreateTestContext() { |
return test_context; |
} |
+class SoftwareTransportFactory : public DefaultTransportFactory { |
+ public: |
+ cc::OutputSurface* CreateOutputSurface(ui::Compositor* compositor) { |
+ scoped_ptr<SoftwareOutputDevice> software_device( |
+ new SoftwareOutputDevice(compositor)); |
+ return new cc::OutputSurface( |
+ software_device.PassAs<cc::SoftwareOutputDevice>()); |
+ } |
+}; |
+ |
} // anonymous namespace |
// static |
@@ -677,10 +689,13 @@ void ImageTransportFactory::Initialize() { |
if (command_line->HasSwitch(switches::kTestCompositor)) { |
ui::SetupTestCompositor(); |
} |
- if (ui::IsTestCompositorEnabled()) |
+ if (ui::IsTestCompositorEnabled()) { |
g_factory = new DefaultTransportFactory(); |
- else |
- g_factory = new GpuProcessTransportFactory(); |
+ } else if (command_line->HasSwitch(switches::kUIEnableSoftwareCompositing)) { |
+ g_factory = new SoftwareTransportFactory; |
+ } else { |
+ g_factory = new GpuProcessTransportFactory; |
+ } |
ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); |
} |