Skip to content
Permalink
Browse files
Make GraphicsContext3D::isResourceSafe a function and, on Chromium, d…
…etermine its value lazily

https://bugs.webkit.org/show_bug.cgi?id=66708

Reviewed by Kenneth Russell.

Source/WebCore:

* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::texImage2DResourceSafe):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/gtk/GraphicsContext3DGtk.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::isResourceSafe):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):

Source/WebKit/chromium:

* src/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::isResourceSafe):
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::isResourceSafe):
* src/GraphicsContext3DInternal.h:


Canonical link: https://commits.webkit.org/82543@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93564 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
natduca committed Aug 23, 2011
1 parent e065d46 commit 13824c5720cc2c075c691d83f9d93480de34caf3
Showing 10 changed files with 62 additions and 6 deletions.
@@ -1,3 +1,22 @@
2011-08-22 Nat Duca <nduca@chromium.org>

Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily
https://bugs.webkit.org/show_bug.cgi?id=66708

Reviewed by Kenneth Russell.

* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::texImage2DResourceSafe):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/gtk/GraphicsContext3DGtk.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::isResourceSafe):
* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):

2011-08-22 Adam Barth <abarth@webkit.org>

HTMLSourceTracker crashes when network packets break poorly
@@ -66,7 +66,7 @@ bool GraphicsContext3D::texImage2DResourceSafe(GC3Denum target, GC3Dint level, G
{
ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
OwnArrayPtr<unsigned char> zero;
if (!m_isResourceSafe && width > 0 && height > 0) {
if (!isResourceSafe() && width > 0 && height > 0) {
unsigned int size;
GC3Denum error = computeImageSizeInBytes(format, type, width, height, unpackAlignment, &size, 0);
if (error != GraphicsContext3D::NO_ERROR) {
@@ -905,7 +905,7 @@ class GraphicsContext3D : public RefCounted<GraphicsContext3D> {
#endif

int m_currentWidth, m_currentHeight;
bool m_isResourceSafe;
bool isResourceSafe();

#if PLATFORM(MAC)
CGLContextObj m_contextObj;
@@ -55,7 +55,6 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow*, bool)
: m_currentWidth(0)
, m_currentHeight(0)
, m_isResourceSafe(false)
, m_attrs(attributes)
, m_texture(0)
, m_fbo(0)
@@ -90,7 +90,6 @@ static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBi
GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool)
: m_currentWidth(0)
, m_currentHeight(0)
, m_isResourceSafe(false)
, m_contextObj(0)
, m_attrs(attrs)
, m_texture(0)
@@ -122,6 +122,11 @@ void GraphicsContext3D::readRenderingResults(unsigned char *pixels, int pixelsSi
::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO);
}

bool GraphicsContext3D::isResourceSafe()
{
return false;
}

#if !PLATFORM(QT)
void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context)
{
@@ -293,7 +293,6 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool)
: m_currentWidth(0)
, m_currentHeight(0)
, m_isResourceSafe(false)
, m_attrs(attrs)
, m_texture(0)
, m_compositorTexture(0)
@@ -1,3 +1,17 @@
2011-08-22 Nat Duca <nduca@chromium.org>

Make GraphicsContext3D::isResourceSafe a function and, on Chromium, determine its value lazily
https://bugs.webkit.org/show_bug.cgi?id=66708

Reviewed by Kenneth Russell.

* src/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
(WebCore::GraphicsContext3DInternal::isResourceSafe):
(WebCore::GraphicsContext3D::create):
(WebCore::GraphicsContext3D::isResourceSafe):
* src/GraphicsContext3DInternal.h:

2011-08-22 Adam Klein <adamk@chromium.org>

[chromium] Remove deprecated and unused bits of WebIDB* headers
@@ -87,6 +87,7 @@ GraphicsContext3DInternal::GraphicsContext3DInternal()
: m_webViewImpl(0)
, m_initializedAvailableExtensions(false)
, m_layerComposited(false)
, m_resourceSafety(ResourceSafetyUnknown)
#if USE(SKIA)
, m_grContext(0)
#elif USE(CG)
@@ -758,6 +759,13 @@ Extensions3D* GraphicsContext3DInternal::getExtensions()
return m_extensions.get();
}

bool GraphicsContext3DInternal::isResourceSafe()
{
if (m_resourceSafety == ResourceSafetyUnknown)
m_resourceSafety = getExtensions()->isEnabled("GL_CHROMIUM_resource_safe") ? ResourceSafe : ResourceUnsafe;
return m_resourceSafety == ResourceSafe;
}

namespace {

void splitStringHelper(const String& str, HashSet<String>& set)
@@ -972,7 +980,6 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attri
}
RefPtr<GraphicsContext3D> result = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle == RenderDirectlyToHostWindow));
result->m_internal = internal.release();
result->m_isResourceSafe = result->getExtensions()->isEnabled("GL_CHROMIUM_resource_safe");
return result.release();
}

@@ -1003,6 +1010,11 @@ IntSize GraphicsContext3D::getInternalFramebufferSize() const
return m_internal->getInternalFramebufferSize();
}

bool GraphicsContext3D::isResourceSafe()
{
return m_internal->isResourceSafe();
}

#if USE(ACCELERATED_COMPOSITING)
PlatformLayer* GraphicsContext3D::platformLayer() const
{
@@ -75,6 +75,7 @@ class GraphicsContext3DInternal {

void reshape(int width, int height);
IntSize getInternalFramebufferSize() const;
bool isResourceSafe();

void markContextChanged();
bool layerComposited() const;
@@ -298,6 +299,14 @@ class GraphicsContext3DInternal {
HashSet<String> m_enabledExtensions;
HashSet<String> m_requestableExtensions;
bool m_layerComposited;

enum ResourceSafety {
ResourceSafetyUnknown,
ResourceSafe,
ResourceUnsafe
};
ResourceSafety m_resourceSafety;

#if USE(ACCELERATED_COMPOSITING)
RefPtr<WebGLLayerChromium> m_compositingLayer;
#endif

0 comments on commit 13824c5

Please sign in to comment.