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 ba45309f8d990cfe0539c320d0291f8b06491df1..6b6ff401c74481efa4643ac972b00ca6e8837b08 100644 |
--- a/content/browser/renderer_host/image_transport_factory.cc |
+++ b/content/browser/renderer_host/image_transport_factory.cc |
@@ -13,12 +13,13 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
#include "base/threading/non_thread_safe.h" |
-#include "cc/output_surface.h" |
#include "cc/output_surface_client.h" |
+#include "cc/output_surface_impl.h" |
#include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
#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/gl_helper.h" |
#include "content/common/gpu/client/gpu_channel_host.h" |
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.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" |
@@ -613,6 +615,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::OutputSurfaceImpl( |
+ software_device.PassAs<cc::SoftwareOutputDevice>()); |
+ } |
+}; |
+ |
} // anonymous namespace |
// static |
@@ -622,11 +634,13 @@ void ImageTransportFactory::Initialize() { |
ui::SetupTestCompositor(); |
} |
if (ui::IsTestCompositorEnabled()) { |
- g_factory = new DefaultTransportFactory(); |
+ g_factory = new DefaultTransportFactory; |
WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest( |
CreateTestContext); |
+ } else if (command_line->HasSwitch(switches::kUIEnableSoftwareCompositing)) { |
+ g_factory = new SoftwareTransportFactory; |
} else { |
- g_factory = new GpuProcessTransportFactory(); |
+ g_factory = new GpuProcessTransportFactory; |
} |
ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); |
} |