Commit e33c4dd0 authored by piman@chromium.org's avatar piman@chromium.org

aura: use TestWebGraphicsContext3D for the shared contexts

Previously, we would use a regular command buffer context for the shared
offscreen contexts, which is unable to share resources with the
TestWebGraphicsContext3D, raising asserts if for example filters are used in
layers.
This change makes us use TestWebGraphicsContext3D for all contexts when using
--test-compositor

BUG=139300


Review URL: https://chromiumcodereview.appspot.com/10828088

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149357 0039d316-1c4b-4281-b951-d872f2087c98
parent e9a360b0
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/client/gpu_channel_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/common/gpu/gpu_process_launch_causes.h" #include "content/common/gpu/gpu_process_launch_causes.h"
#include "content/common/webkitplatformsupport_impl.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "gpu/ipc/command_buffer_proxy.h" #include "gpu/ipc/command_buffer_proxy.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
#include "ui/compositor/compositor.h" #include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_setup.h" #include "ui/compositor/compositor_setup.h"
#include "ui/compositor/test_web_graphics_context_3d.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h" #include "ui/gfx/size.h"
...@@ -374,6 +376,13 @@ void CompositorSwapClient::OnLostContext() { ...@@ -374,6 +376,13 @@ void CompositorSwapClient::OnLostContext() {
// Note: previous line destroyed this. Don't access members from now on. // Note: previous line destroyed this. Don't access members from now on.
} }
WebKit::WebGraphicsContext3D* CreateTestContext() {
ui::TestWebGraphicsContext3D* test_context =
new ui::TestWebGraphicsContext3D();
test_context->Initialize();
return test_context;
}
} // anonymous namespace } // anonymous namespace
// static // static
...@@ -384,6 +393,8 @@ void ImageTransportFactory::Initialize() { ...@@ -384,6 +393,8 @@ void ImageTransportFactory::Initialize() {
} }
if (ui::IsTestCompositorEnabled()) { if (ui::IsTestCompositorEnabled()) {
g_factory = new DefaultTransportFactory(); g_factory = new DefaultTransportFactory();
content::WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest(
CreateTestContext);
} else { } else {
#if defined(OS_WIN) #if defined(OS_WIN)
g_factory = new DefaultTransportFactory(); g_factory = new DefaultTransportFactory();
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
namespace content { namespace content {
namespace {
WebKitPlatformSupportImpl::OffscreenContextFactory* g_context_factory = NULL;
}
WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() { WebKitPlatformSupportImpl::WebKitPlatformSupportImpl() {
} }
...@@ -55,6 +59,8 @@ WebKitPlatformSupportImpl::CreateWebSocketBridge( ...@@ -55,6 +59,8 @@ WebKitPlatformSupportImpl::CreateWebSocketBridge(
WebKit::WebGraphicsContext3D* WebKit::WebGraphicsContext3D*
WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
const WebGraphicsContext3D::Attributes& attributes) { const WebGraphicsContext3D::Attributes& attributes) {
if (g_context_factory)
return g_context_factory();
// The WebGraphicsContext3DInProcessImpl code path is used for // The WebGraphicsContext3DInProcessImpl code path is used for
// layout tests (though not through this code) as well as for // layout tests (though not through this code) as well as for
// debugging and bringing up new ports. // debugging and bringing up new ports.
...@@ -69,6 +75,12 @@ WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D( ...@@ -69,6 +75,12 @@ WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
} }
} }
// static
void WebKitPlatformSupportImpl::SetOffscreenContextFactoryForTest(
OffscreenContextFactory factory) {
g_context_factory = factory;
}
GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() { GpuChannelHostFactory* WebKitPlatformSupportImpl::GetGpuChannelHostFactory() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
......
...@@ -19,6 +19,8 @@ namespace content { ...@@ -19,6 +19,8 @@ namespace content {
class CONTENT_EXPORT WebKitPlatformSupportImpl class CONTENT_EXPORT WebKitPlatformSupportImpl
: NON_EXPORTED_BASE(public webkit_glue::WebKitPlatformSupportImpl) { : NON_EXPORTED_BASE(public webkit_glue::WebKitPlatformSupportImpl) {
public: public:
typedef WebKit::WebGraphicsContext3D* (OffscreenContextFactory)();
WebKitPlatformSupportImpl(); WebKitPlatformSupportImpl();
virtual ~WebKitPlatformSupportImpl(); virtual ~WebKitPlatformSupportImpl();
...@@ -37,6 +39,9 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl ...@@ -37,6 +39,9 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl
virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D( virtual WebKit::WebGraphicsContext3D* createOffscreenGraphicsContext3D(
const WebKit::WebGraphicsContext3D::Attributes& attributes); const WebKit::WebGraphicsContext3D::Attributes& attributes);
static void SetOffscreenContextFactoryForTest(
OffscreenContextFactory factory);
protected: protected:
virtual GpuChannelHostFactory* GetGpuChannelHostFactory(); virtual GpuChannelHostFactory* GetGpuChannelHostFactory();
}; };
...@@ -44,4 +49,3 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl ...@@ -44,4 +49,3 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl
} // namespace content } // namespace content
#endif // CONTENT_COMMON_CONTENT_WEBKITPLATFORMSUPPORT_IMPL_H_ #endif // CONTENT_COMMON_CONTENT_WEBKITPLATFORMSUPPORT_IMPL_H_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "ui/compositor/compositor_export.h"
namespace gfx { namespace gfx {
class GLContext; class GLContext;
...@@ -18,7 +19,8 @@ class GLSurface; ...@@ -18,7 +19,8 @@ class GLSurface;
namespace ui { namespace ui {
// WebGraphicsContext3D that does nothing. Suitable for testing. // WebGraphicsContext3D that does nothing. Suitable for testing.
class TestWebGraphicsContext3D : public WebKit::WebGraphicsContext3D { class COMPOSITOR_EXPORT TestWebGraphicsContext3D :
public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) {
public: public:
TestWebGraphicsContext3D(); TestWebGraphicsContext3D();
virtual ~TestWebGraphicsContext3D(); virtual ~TestWebGraphicsContext3D();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment