Title: [145004] trunk/Source/WebCore
- Revision
- 145004
- Author
- [email protected]
- Date
- 2013-03-06 16:29:35 -0800 (Wed, 06 Mar 2013)
Log Message
[chromium] Don't get callbacks or create GrContext from unowned WebGraphicsContext3D
https://bugs.webkit.org/show_bug.cgi?id=111638
Reviewed by James Robinson.
If the context is not owned, it's lifetime is not guaranteed, and by the time
the GraphicsContext3D is destroyed, the WGC3D can already be deleted.
When the context is not owned by the GraphicsContext3D, then don't clean it up
in the destructor or set up callbacks, as these are the owner's responsibility.
* platform/chromium/support/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::grContext):
(WebCore::GraphicsContext3DPrivate::setContextLostCallback):
(WebCore::GraphicsContext3DPrivate::setErrorMessageCallback):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (145003 => 145004)
--- trunk/Source/WebCore/ChangeLog 2013-03-07 00:27:59 UTC (rev 145003)
+++ trunk/Source/WebCore/ChangeLog 2013-03-07 00:29:35 UTC (rev 145004)
@@ -1,3 +1,22 @@
+2013-03-06 Dana Jansens <[email protected]>
+
+ [chromium] Don't get callbacks or create GrContext from unowned WebGraphicsContext3D
+ https://bugs.webkit.org/show_bug.cgi?id=111638
+
+ Reviewed by James Robinson.
+
+ If the context is not owned, it's lifetime is not guaranteed, and by the time
+ the GraphicsContext3D is destroyed, the WGC3D can already be deleted.
+
+ When the context is not owned by the GraphicsContext3D, then don't clean it up
+ in the destructor or set up callbacks, as these are the owner's responsibility.
+
+ * platform/chromium/support/GraphicsContext3DPrivate.cpp:
+ (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
+ (WebCore::GraphicsContext3DPrivate::grContext):
+ (WebCore::GraphicsContext3DPrivate::setContextLostCallback):
+ (WebCore::GraphicsContext3DPrivate::setErrorMessageCallback):
+
2013-02-22 Jer Noble <[email protected]>
Default mouse cursor behavior should be auto-hide for full screen video with custom controls
Modified: trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp (145003 => 145004)
--- trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp 2013-03-07 00:27:59 UTC (rev 145003)
+++ trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DPrivate.cpp 2013-03-07 00:29:35 UTC (rev 145004)
@@ -80,9 +80,9 @@
GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
{
- if (m_grContext) {
- m_impl->setMemoryAllocationChangedCallbackCHROMIUM(0);
- m_grContext->contextDestroyed();
+ if (m_ownedGrContext) {
+ m_ownedWebContext->setMemoryAllocationChangedCallbackCHROMIUM(0);
+ m_ownedGrContext->contextDestroyed();
}
}
@@ -145,13 +145,15 @@
{
if (m_grContext)
return m_grContext;
+ if (!m_ownedWebContext)
+ return 0;
- SkAutoTUnref<GrGLInterface> interface(m_impl->createGrGLInterface());
+ SkAutoTUnref<GrGLInterface> interface(m_ownedWebContext->createGrGLInterface());
if (!interface)
return 0;
interface->fCallback = bindWebGraphicsContext3DGLContextCallback;
- interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(m_impl);
+ interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(m_ownedWebContext.get());
m_ownedGrContext.reset(GrContext::Create(kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
m_grContext = m_ownedGrContext;
@@ -160,7 +162,7 @@
m_grContext->setTextureCacheLimits(maxGaneshTextureCacheCount, maxGaneshTextureCacheBytes);
m_grContextMemoryAllocationCallbackAdapter = adoptPtr(new GrMemoryAllocationChangedCallbackAdapter(m_grContext));
- m_impl->setMemoryAllocationChangedCallbackCHROMIUM(m_grContextMemoryAllocationCallbackAdapter.get());
+ m_ownedWebContext->setMemoryAllocationChangedCallbackCHROMIUM(m_grContextMemoryAllocationCallbackAdapter.get());
return m_grContext;
}
@@ -248,8 +250,10 @@
void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback> callback)
{
- m_contextLostCallbackAdapter = adoptPtr(new GraphicsContext3DContextLostCallbackAdapter(callback));
- m_impl->setContextLostCallback(m_contextLostCallbackAdapter.get());
+ if (m_ownedWebContext) {
+ m_contextLostCallbackAdapter = adoptPtr(new GraphicsContext3DContextLostCallbackAdapter(callback));
+ m_ownedWebContext->setContextLostCallback(m_contextLostCallbackAdapter.get());
+ }
}
class GraphicsContext3DErrorMessageCallbackAdapter : public WebKit::WebGraphicsContext3D::WebGraphicsErrorMessageCallback {
@@ -269,8 +273,10 @@
void GraphicsContext3DPrivate::setErrorMessageCallback(PassOwnPtr<GraphicsContext3D::ErrorMessageCallback> callback)
{
- m_errorMessageCallbackAdapter = adoptPtr(new GraphicsContext3DErrorMessageCallbackAdapter(callback));
- m_impl->setErrorMessageCallback(m_errorMessageCallbackAdapter.get());
+ if (m_ownedWebContext) {
+ m_errorMessageCallbackAdapter = adoptPtr(new GraphicsContext3DErrorMessageCallbackAdapter(callback));
+ m_ownedWebContext->setErrorMessageCallback(m_errorMessageCallbackAdapter.get());
+ }
}
Extensions3D* GraphicsContext3DPrivate::getExtensions()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes