+2012-02-23 Adrienne Walker <enne@google.com>
+
+ Unreviewed, rolling out r108666.
+ http://trac.webkit.org/changeset/108666
+ https://bugs.webkit.org/show_bug.cgi?id=79321
+
+ Breaks webplugin tests: http://goo.gl/CoHIi
+
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+ (WebCore):
+ (WebCore::GraphicsContext3DPrivate::create):
+ (WebCore::GraphicsContext3DPrivate::createGraphicsContextFromWebContext):
+ (WebCore::GraphicsContext3DPrivate::createGraphicsContextForAnotherThread):
+ (WebCore::GraphicsContext3DPrivate::platformTexture):
+ (WebCore::GraphicsContext3D::create):
+ * src/GraphicsContext3DPrivate.h:
+ (WebKit):
+ (GraphicsContext3DPrivate):
+ * src/WebLayerTreeViewImpl.cpp:
+ (WebKit::WebLayerTreeViewImpl::createLayerTreeHostContext3D):
+ * src/WebViewImpl.cpp:
+ (std::getCompositorContextAttributes):
+ (WebKit::WebViewImpl::createLayerTreeHostContext3D):
+ (WebKit::WebViewImpl::graphicsContext3D):
+ * tests/CCLayerTreeHostImplTest.cpp:
+ (CCLayerTreeHostImplTest):
+ (WebKit::TEST_F):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::MockLayerTreeHostClient::createLayerTreeHostContext3D):
+ * tests/Canvas2DLayerChromiumTest.cpp:
+ (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest):
+ * tests/CompositorFakeGraphicsContext3D.h:
+ (WebCore::createCompositorMockGraphicsContext3D):
+ * tests/FakeGraphicsContext3DTest.cpp:
+ (TEST):
+
2012-02-23 Daniel Sievers <sievers@chromium.org>
[Chromium] Add video stream texture support
//----------------------------------------------------------------------
// GraphicsContext3DPrivate
-GraphicsContext3DPrivate::GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, bool preserveDrawingBuffer)
+GraphicsContext3DPrivate::GraphicsContext3DPrivate(WebKit::WebViewImpl* webViewImpl, PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::Attributes attrs)
: m_impl(webContext)
+ , m_webViewImpl(webViewImpl)
, m_initializedAvailableExtensions(false)
, m_layerComposited(false)
- , m_preserveDrawingBuffer(preserveDrawingBuffer)
+ , m_preserveDrawingBuffer(attrs.preserveDrawingBuffer)
, m_resourceSafety(ResourceSafetyUnknown)
#if USE(SKIA)
, m_grContext(0)
#endif
}
-PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::RenderStyle renderStyle, bool preserveDrawingBuffer)
+
+PassOwnPtr<GraphicsContext3DPrivate> GraphicsContext3DPrivate::create(WebKit::WebViewImpl* webViewImpl, PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::Attributes attrs)
{
- bool renderDirectlyToHostWindow = renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow;
+ return adoptPtr(new GraphicsContext3DPrivate(webViewImpl, webContext, attrs));
+}
- RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(GraphicsContext3D::Attributes(), 0, renderDirectlyToHostWindow));
+PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D> webContext, GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle, ThreadUsage threadUsage)
+{
+ Chrome* chrome = static_cast<Chrome*>(hostWindow);
+ WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0;
+
+ OwnPtr<GraphicsContext3DPrivate> priv = GraphicsContext3DPrivate::create(webViewImpl, webContext, attrs);
+ if (!priv)
+ return 0;
- OwnPtr<GraphicsContext3DPrivate> priv = adoptPtr(new GraphicsContext3DPrivate(webContext, preserveDrawingBuffer));
- context->m_private = priv.release();
- return context.release();
+ bool renderDirectlyToHostWindow = renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow;
+ RefPtr<GraphicsContext3D> result = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderDirectlyToHostWindow));
+ result->m_private = priv.release();
+ return result.release();
}
namespace {
+PassRefPtr<GraphicsContext3D> createGraphicsContext(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle, GraphicsContext3DPrivate::ThreadUsage threadUsage)
+{
+ bool renderDirectlyToHostWindow = renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow;
+
+ WebKit::WebGraphicsContext3D::Attributes webAttributes;
+ webAttributes.alpha = attrs.alpha;
+ webAttributes.depth = attrs.depth;
+ webAttributes.stencil = attrs.stencil;
+ webAttributes.antialias = attrs.antialias;
+ webAttributes.premultipliedAlpha = attrs.premultipliedAlpha;
+ webAttributes.canRecoverFromContextLoss = attrs.canRecoverFromContextLoss;
+ webAttributes.noExtensions = attrs.noExtensions;
+ webAttributes.shareResources = attrs.shareResources;
+ webAttributes.forUseOnAnotherThread = threadUsage == GraphicsContext3DPrivate::ForUseOnAnotherThread;
+
+ Chrome* chrome = static_cast<Chrome*>(hostWindow);
+ WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0;
+ OwnPtr<WebKit::WebGraphicsContext3D> webContext;
+ if (!webViewImpl || !webViewImpl->client()) {
+ if (renderDirectlyToHostWindow)
+ return 0;
+ webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes));
+ } else
+ webContext = adoptPtr(webViewImpl->client()->createGraphicsContext3D(webAttributes, renderDirectlyToHostWindow));
+ if (!webContext)
+ return 0;
+
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attrs, hostWindow, renderStyle, threadUsage);
+}
+
void getDrawingParameters(DrawingBuffer* drawingBuffer, WebKit::WebGraphicsContext3D* graphicsContext3D,
Platform3DObject* frameBufferId, int* width, int* height)
{
} // anonymous namespace
+PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+{
+ return createGraphicsContext(attrs, hostWindow, renderStyle, ForUseOnAnotherThread);
+}
+
WebKit::WebGraphicsContext3D* GraphicsContext3DPrivate::extractWebGraphicsContext3D(GraphicsContext3D* context)
{
if (!context)
Platform3DObject GraphicsContext3DPrivate::platformTexture() const
{
+ ASSERT(m_webViewImpl);
+ m_impl->setParentContext(m_webViewImpl->graphicsContext3D());
return m_impl->getPlatformTextureId();
}
m_private->setGpuMemoryAllocationChangedCallbackCHROMIUM(nullptr);
}
-PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow*, GraphicsContext3D::RenderStyle renderStyle)
+PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
{
- ASSERT(renderStyle != GraphicsContext3D::RenderDirectlyToHostWindow);
-
- WebKit::WebGraphicsContext3D::Attributes webAttributes;
- webAttributes.alpha = attrs.alpha;
- webAttributes.depth = attrs.depth;
- webAttributes.stencil = attrs.stencil;
- webAttributes.antialias = attrs.antialias;
- webAttributes.premultipliedAlpha = attrs.premultipliedAlpha;
- webAttributes.canRecoverFromContextLoss = attrs.canRecoverFromContextLoss;
- webAttributes.noExtensions = attrs.noExtensions;
- webAttributes.shareResources = attrs.shareResources;
-
- OwnPtr<WebKit::WebGraphicsContext3D> webContext = adoptPtr(WebKit::webKitPlatformSupport()->createOffscreenGraphicsContext3D(webAttributes));
- if (!webContext)
- return 0;
-
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), renderStyle, attrs.preserveDrawingBuffer);
+ return createGraphicsContext(attrs, hostWindow, renderStyle, GraphicsContext3DPrivate::ForUseOnThisThread);
}
PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const
namespace WebKit {
class WebGraphicsContext3D;
-}
+class WebViewImpl;
+} // namespace WebKit
namespace WebCore {
class GraphicsContext3DPrivate {
public:
- // Callers must make the context current before using it AND check that the context was created successfully
- // via ContextLost before using the context in any way. Once made current on a thread, the context cannot
- // be used on any other thread.
- static PassRefPtr<GraphicsContext3D> createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::RenderStyle, bool preserveDrawingBuffer = false);
+ static PassOwnPtr<GraphicsContext3DPrivate> create(WebKit::WebViewImpl*, PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::Attributes);
+
+ enum ThreadUsage {
+ ForUseOnThisThread,
+ ForUseOnAnotherThread,
+ };
+
+ // createGraphicsContextForAnotherThread is equivalent to
+ // GraphicsContext3D::create, but will skip making the context
+ // current. Callers must make the context current before using it AND check
+ // that the context was created successfully via ContextLost. Once made
+ // current on a thread, the context cannot be used on any other thread.
+ static PassRefPtr<GraphicsContext3D> createGraphicsContextForAnotherThread(GraphicsContext3D::Attributes, HostWindow*, GraphicsContext3D::RenderStyle);
+
+ // Used in tests to create a GraphicsContext3D from a mocked WebGraphicsContext3D.
+ static PassRefPtr<GraphicsContext3D> createGraphicsContextFromWebContext(PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::Attributes, HostWindow*, GraphicsContext3D::RenderStyle, ThreadUsage);
~GraphicsContext3DPrivate();
void texStorage2DEXT(GC3Denum target, GC3Dint levels, GC3Duint internalformat, GC3Dint width, GC3Dint height);
private:
- GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D>, bool preserveDrawingBuffer);
+ GraphicsContext3DPrivate(WebKit::WebViewImpl*, PassOwnPtr<WebKit::WebGraphicsContext3D>, GraphicsContext3D::Attributes);
OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
OwnPtr<Extensions3DChromium> m_extensions;
OwnPtr<GraphicsErrorMessageCallbackAdapter> m_errorMessageCallbackAdapter;
OwnPtr<GraphicsContext3DSwapBuffersCompleteCallbackAdapter> m_swapBuffersCompleteCallbackAdapter;
OwnPtr<GraphicsContext3DMemoryAllocationChangedCallbackAdapter> m_memoryAllocationChangedCallbackAdapter;
+ WebKit::WebViewImpl* m_webViewImpl;
bool m_initializedAvailableExtensions;
HashSet<String> m_enabledExtensions;
HashSet<String> m_requestableExtensions;
if (!webContext)
return 0;
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ );
+ WebGraphicsContext3D::Attributes webAttributes = webContext->getContextAttributes();
+ GraphicsContext3D::Attributes attributes;
+ attributes.alpha = webAttributes.alpha;
+ attributes.depth = webAttributes.depth;
+ attributes.stencil = webAttributes.stencil;
+ attributes.antialias = webAttributes.antialias;
+ attributes.premultipliedAlpha = webAttributes.premultipliedAlpha;
+ attributes.canRecoverFromContextLoss = webAttributes.canRecoverFromContextLoss;
+ attributes.noExtensions = webAttributes.noExtensions;
+ attributes.shareResources = webAttributes.shareResources;
+ attributes.preserveDrawingBuffer = false;
+
+ GraphicsContext3D::RenderStyle style = GraphicsContext3D::RenderDirectlyToHostWindow;
+ GraphicsContext3DPrivate::ThreadUsage usage = CCProxy::hasImplThread() ? GraphicsContext3DPrivate::ForUseOnAnotherThread : GraphicsContext3DPrivate::ForUseOnThisThread;
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attributes, 0, style, usage);
}
void WebLayerTreeViewImpl::didCommitAndDrawFrame()
namespace {
-WebKit::WebGraphicsContext3D::Attributes getCompositorContextAttributes(bool threaded)
+GraphicsContext3D::Attributes getCompositorContextAttributes()
{
// Explicitly disable antialiasing for the compositor. As of the time of
// this writing, the only platform that supported antialiasing for the
// be optimized to resolve directly into the IOSurface shared between the
// GPU and browser processes. For these reasons and to avoid platform
// disparities we explicitly disable antialiasing.
- WebKit::WebGraphicsContext3D::Attributes attributes;
+ GraphicsContext3D::Attributes attributes;
attributes.antialias = false;
attributes.shareResources = true;
- attributes.forUseOnAnotherThread = threaded;
return attributes;
}
{
RefPtr<GraphicsContext3D> context = m_temporaryOnscreenGraphicsContext3D.release();
if (!context) {
- WebKit::WebGraphicsContext3D::Attributes attributes = getCompositorContextAttributes(CCProxy::hasImplThread());
- OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(client()->createGraphicsContext3D(attributes, true /* renderDirectlyToHostWindow */));
- if (!webContext)
- return context;
-
- context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ if (CCProxy::hasImplThread())
+ context = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ else
+ context = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
}
return context;
}
if (webContext && !webContext->isContextLost())
return webContext;
}
- return GraphicsContext3DPrivate::extractWebGraphicsContext3D(createLayerTreeHostContext3D().get());
+ if (m_temporaryOnscreenGraphicsContext3D) {
+ WebGraphicsContext3D* webContext = GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_temporaryOnscreenGraphicsContext3D.get());
+ if (webContext && !webContext->isContextLost())
+ return webContext;
+ }
+ if (CCProxy::hasImplThread())
+ m_temporaryOnscreenGraphicsContext3D = GraphicsContext3DPrivate::createGraphicsContextForAnotherThread(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ else
+ m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(getCompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostWindow);
+
+ return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_temporaryOnscreenGraphicsContext3D.get());
}
#endif
return 0;
}
protected:
- PassRefPtr<GraphicsContext3D> createContext()
- {
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), GraphicsContext3D::RenderDirectlyToHostWindow);
- }
-
DebugScopedSetImplThread m_alwaysImplThread;
OwnPtr<CCLayerTreeHostImpl> m_hostImpl;
bool m_didRequestCommit;
TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
{
- RefPtr<GraphicsContext3D> context = createContext();
+GraphicsContext3D::Attributes attrs;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
m_hostImpl->initializeLayerRenderer(context);
// Ensure visibleLayerRect for root layer is empty
TEST_F(CCLayerTreeHostImplTest, didDrawCalledOnAllLayers)
{
- RefPtr<GraphicsContext3D> context = createContext();
+ GraphicsContext3D::Attributes attrs;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FakeWebGraphicsContext3D()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
m_hostImpl->initializeLayerRenderer(context);
m_hostImpl->setViewportSize(IntSize(10, 10));
// https://bugs.webkit.org/show_bug.cgi?id=75783
TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
{
- RefPtr<GraphicsContext3D> context = createContext();
+ GraphicsContext3D::Attributes attrs;
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new BlendStateTrackerContext()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
m_hostImpl->initializeLayerRenderer(context);
m_hostImpl->setViewportSize(IntSize(10, 10));
// viewport size is never set.
TEST_F(CCLayerTreeHostImplTest, reshapeNotCalledUntilDraw)
{
+ GraphicsContext3D::Attributes attrs;
ReshapeTrackerContext* reshapeTracker = new ReshapeTrackerContext();
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(reshapeTracker), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
m_hostImpl->initializeLayerRenderer(context);
m_hostImpl->setViewportSize(IntSize(10, 10));
// where it should request to swap only the subBuffer that is damaged.
TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect)
{
+ GraphicsContext3D::Attributes attrs;
PartialSwapTrackerContext* partialSwapTracker = new PartialSwapTrackerContext();
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(partialSwapTracker), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
// This test creates its own CCLayerTreeHostImpl, so
// that we can force partial swap enabled.
webAttrs.alpha = attrs.alpha;
OwnPtr<WebGraphicsContext3D> webContext = CompositorFakeWebGraphicsContext3DWithTextureTracking::create(webAttrs);
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(
+ webContext.release(), attrs, 0,
+ GraphicsContext3D::RenderDirectlyToHostWindow,
+ GraphicsContext3DPrivate::ForUseOnAnotherThread);
}
virtual void didCommitAndDrawFrame()
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
- RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> mainContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
+ RefPtr<GraphicsContext3D> implContext = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new MockCanvasContext()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
MockCanvasContext& mainMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(mainContext.get()));
MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get()));
webAttrs.alpha = attrs.alpha;
OwnPtr<WebKit::WebGraphicsContext3D> webContext = WebKit::CompositorFakeWebGraphicsContext3D::create(webAttrs);
- return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
+ return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(
+ webContext.release(), attrs, 0,
+ GraphicsContext3D::RenderDirectlyToHostWindow,
+ GraphicsContext3DPrivate::ForUseOnAnotherThread);
}
}
TEST(FakeGraphicsContext3DTest, CanOverrideManually)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new FrameCountingContext()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
FrameCountingContext& mockContext = *static_cast<FrameCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
for (int i = 0; i < 10; i++) {
TEST(FakeGraphicsContext3DTest, CanUseGMock)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new GMockContext()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new GMockContext()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
GMockContext& mockContext = *static_cast<GMockContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
EXPECT_CALL(mockContext, getError())
TEST(FakeGraphicsContext3DTest, ContextForThisThreadShouldNotMakeCurrent)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread);
EXPECT_TRUE(context);
ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
EXPECT_EQ(0, mockContext.makeCurrentCount());
TEST(FakeGraphicsContext3DTest, ContextForAnotherThreadShouldNotMakeCurrent)
{
GraphicsContext3D::Attributes attrs;
- RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), GraphicsContext3D::RenderDirectlyToHostWindow);
+ RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnAnotherThread);
EXPECT_TRUE(context);
ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()));
EXPECT_EQ(0, mockContext.makeCurrentCount());