| Index: Source/core/html/canvas/WebGLRenderingContextBase.cpp
|
| diff --git a/Source/core/html/canvas/WebGLRenderingContextBase.cpp b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
|
| index a52eb64d68173acf513ef3209fef55b7db695da7..89d5ecbd7d0df4b507cdee955bd535497d2c4ea2 100644
|
| --- a/Source/core/html/canvas/WebGLRenderingContextBase.cpp
|
| +++ b/Source/core/html/canvas/WebGLRenderingContextBase.cpp
|
| @@ -92,6 +92,10 @@ const double secondsBetweenRestoreAttempts = 1.0;
|
| const int maxGLErrorsAllowedToConsole = 256;
|
| const unsigned maxGLActiveContexts = 16;
|
|
|
| +// FIXME: Oilpan: static vectors to heap allocated WebGLRenderingContextBase objects
|
| +// are kept here. This relies on the WebGLRenderingContextBase finalization to
|
| +// explicitly retire themselves from these vectors, but it'd be preferable if
|
| +// the references were traced as per usual.
|
| Vector<WebGLRenderingContextBase*>& WebGLRenderingContextBase::activeContexts()
|
| {
|
| DEFINE_STATIC_LOCAL(Vector<WebGLRenderingContextBase*>, activeContexts, ());
|
| @@ -224,6 +228,7 @@ public:
|
| namespace {
|
|
|
| class ScopedDrawingBufferBinder {
|
| + STACK_ALLOCATED();
|
| public:
|
| ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding)
|
| : m_drawingBuffer(drawingBuffer)
|
| @@ -243,7 +248,7 @@ namespace {
|
|
|
| private:
|
| DrawingBuffer* m_drawingBuffer;
|
| - WebGLFramebuffer* m_framebufferBinding;
|
| + RawPtrWillBeMember<WebGLFramebuffer> m_framebufferBinding;
|
| };
|
|
|
| Platform3DObject objectOrZero(WebGLObject* object)
|
| @@ -468,8 +473,9 @@ namespace {
|
| } // namespace anonymous
|
|
|
| class ScopedTexture2DRestorer {
|
| + STACK_ALLOCATED();
|
| public:
|
| - ScopedTexture2DRestorer(WebGLRenderingContextBase* context)
|
| + explicit ScopedTexture2DRestorer(WebGLRenderingContextBase* context)
|
| : m_context(context)
|
| {
|
| }
|
| @@ -480,32 +486,60 @@ public:
|
| }
|
|
|
| private:
|
| - WebGLRenderingContextBase* m_context;
|
| + RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
|
| };
|
|
|
| -class WebGLRenderingContextLostCallback : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
|
| - WTF_MAKE_FAST_ALLOCATED;
|
| +class WebGLRenderingContextLostCallback FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebGLRenderingContextLostCallback>, public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
|
| + WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
|
| public:
|
| - explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* cb) : m_context(cb) { }
|
| + static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebGLRenderingContextBase* context)
|
| + {
|
| + return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context));
|
| + }
|
| +
|
| + virtual ~WebGLRenderingContextLostCallback() { }
|
| +
|
| virtual void onContextLost() { m_context->forceLostContext(WebGLRenderingContextBase::RealLostContext); }
|
| - virtual ~WebGLRenderingContextLostCallback() {}
|
| +
|
| + void trace(Visitor* visitor)
|
| + {
|
| + visitor->trace(m_context);
|
| + }
|
| +
|
| private:
|
| - WebGLRenderingContextBase* m_context;
|
| + explicit WebGLRenderingContextLostCallback(WebGLRenderingContextBase* context)
|
| + : m_context(context) { }
|
| +
|
| + RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
|
| };
|
|
|
| -class WebGLRenderingContextErrorMessageCallback : public blink::WebGraphicsContext3D::WebGraphicsErrorMessageCallback {
|
| - WTF_MAKE_FAST_ALLOCATED;
|
| +class WebGLRenderingContextErrorMessageCallback FINAL : public NoBaseWillBeGarbageCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public blink::WebGraphicsContext3D::WebGraphicsErrorMessageCallback {
|
| + WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
|
| public:
|
| - explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase* cb) : m_context(cb) { }
|
| + static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> create(WebGLRenderingContextBase* context)
|
| + {
|
| + return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback(context));
|
| + }
|
| +
|
| + virtual ~WebGLRenderingContextErrorMessageCallback() { }
|
| +
|
| virtual void onErrorMessage(const blink::WebString& message, blink::WGC3Dint)
|
| {
|
| if (m_context->m_synthesizedErrorsToConsole)
|
| m_context->printGLErrorToConsole(message);
|
| InspectorInstrumentation::didFireWebGLErrorOrWarning(m_context->canvas(), message);
|
| }
|
| - virtual ~WebGLRenderingContextErrorMessageCallback() { }
|
| +
|
| + void trace(Visitor* visitor)
|
| + {
|
| + visitor->trace(m_context);
|
| + }
|
| +
|
| private:
|
| - WebGLRenderingContextBase* m_context;
|
| + explicit WebGLRenderingContextErrorMessageCallback(WebGLRenderingContextBase* context)
|
| + : m_context(context) { }
|
| +
|
| + RawPtrWillBeMember<WebGLRenderingContextBase> m_context;
|
| };
|
|
|
| WebGLRenderingContextBase::WebGLRenderingContextBase(HTMLCanvasElement* passedCanvas, PassOwnPtr<blink::WebGraphicsContext3D> context, WebGLContextAttributes* requestedAttributes)
|
| @@ -625,8 +659,8 @@ void WebGLRenderingContextBase::initializeNewContext()
|
| webContext()->viewport(0, 0, drawingBufferWidth(), drawingBufferHeight());
|
| webContext()->scissor(0, 0, drawingBufferWidth(), drawingBufferHeight());
|
|
|
| - m_contextLostCallbackAdapter = adoptPtr(new WebGLRenderingContextLostCallback(this));
|
| - m_errorMessageCallbackAdapter = adoptPtr(new WebGLRenderingContextErrorMessageCallback(this));
|
| + m_contextLostCallbackAdapter = WebGLRenderingContextLostCallback::create(this);
|
| + m_errorMessageCallbackAdapter = WebGLRenderingContextErrorMessageCallback::create(this);
|
|
|
| webContext()->setContextLostCallback(m_contextLostCallbackAdapter.get());
|
| webContext()->setErrorMessageCallback(m_errorMessageCallbackAdapter.get());
|
| @@ -678,6 +712,7 @@ unsigned WebGLRenderingContextBase::getWebGLVersion(const CanvasRenderingContext
|
|
|
| WebGLRenderingContextBase::~WebGLRenderingContextBase()
|
| {
|
| +#if !ENABLE(OILPAN)
|
| // Remove all references to WebGLObjects so if they are the last reference
|
| // they will be freed before the last context is removed from the context group.
|
| m_boundArrayBuffer = nullptr;
|
| @@ -689,18 +724,18 @@ WebGLRenderingContextBase::~WebGLRenderingContextBase()
|
| m_renderbufferBinding = nullptr;
|
|
|
| for (size_t i = 0; i < m_textureUnits.size(); ++i) {
|
| - m_textureUnits[i].m_texture2DBinding = nullptr;
|
| - m_textureUnits[i].m_textureCubeMapBinding = nullptr;
|
| + m_textureUnits[i].m_texture2DBinding = nullptr;
|
| + m_textureUnits[i].m_textureCubeMapBinding = nullptr;
|
| }
|
|
|
| m_blackTexture2D = nullptr;
|
| m_blackTextureCubeMap = nullptr;
|
|
|
| detachAndRemoveAllObjects();
|
| +#endif
|
|
|
| - // release all extensions
|
| - for (size_t i = 0; i < m_extensions.size(); ++i)
|
| - delete m_extensions[i];
|
| + // Release all extensions now.
|
| + m_extensions.clear();
|
|
|
| // Context must be removed from the group prior to the destruction of the
|
| // WebGraphicsContext3D, otherwise shared objects may not be properly deleted.
|
| @@ -709,11 +744,9 @@ WebGLRenderingContextBase::~WebGLRenderingContextBase()
|
| destroyContext();
|
|
|
| #if !ENABLE(OILPAN)
|
| - if (m_multisamplingObserverRegistered) {
|
| - Page* page = canvas()->document().page();
|
| - if (page)
|
| + if (m_multisamplingObserverRegistered)
|
| + if (Page* page = canvas()->document().page())
|
| page->removeMultisamplingChangedObserver(this);
|
| - }
|
| #endif
|
|
|
| willDestroyContext(this);
|
| @@ -766,7 +799,7 @@ bool WebGLRenderingContextBase::clearIfComposited(GLbitfield mask)
|
| || m_requestedAttributes->preserveDrawingBuffer() || (mask && m_framebufferBinding))
|
| return false;
|
|
|
| - RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes();
|
| + RefPtrWillBeRawPtr<WebGLContextAttributes> contextAttributes = getContextAttributes();
|
|
|
| // Determine if it's possible to combine the clear the user asked for and this clear.
|
| bool combinedClear = mask && !m_scissorEnabled;
|
| @@ -1493,49 +1526,49 @@ void WebGLRenderingContextBase::copyTexSubImage2D(GLenum target, GLint level, GL
|
| webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
| }
|
|
|
| -PassRefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
|
| +PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| - RefPtr<WebGLBuffer> o = WebGLBuffer::create(this);
|
| + RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this);
|
| addSharedObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| -PassRefPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer()
|
| +PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| - RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
|
| + RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
|
| addContextObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| -PassRefPtr<WebGLTexture> WebGLRenderingContextBase::createTexture()
|
| +PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| - RefPtr<WebGLTexture> o = WebGLTexture::create(this);
|
| + RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this);
|
| addSharedObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| -PassRefPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
|
| +PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| - RefPtr<WebGLProgram> o = WebGLProgram::create(this);
|
| + RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this);
|
| addSharedObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| -PassRefPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer()
|
| +PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| - RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
|
| + RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
|
| addSharedObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer)
|
| @@ -1550,7 +1583,7 @@ WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum
|
| return renderbuffer->emulatedStencilBuffer();
|
| }
|
|
|
| -PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type)
|
| +PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type)
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| @@ -1559,9 +1592,9 @@ PassRefPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type)
|
| return nullptr;
|
| }
|
|
|
| - RefPtr<WebGLShader> o = WebGLShader::create(this, type);
|
| + RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type);
|
| addSharedObject(o.get());
|
| - return o;
|
| + return o.release();
|
| }
|
|
|
| void WebGLRenderingContextBase::cullFace(GLenum mode)
|
| @@ -2007,7 +2040,7 @@ void WebGLRenderingContextBase::generateMipmap(GLenum target)
|
| tex->generateMipmapLevelInfo();
|
| }
|
|
|
| -PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index)
|
| +PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index)
|
| {
|
| if (isContextLost() || !validateWebGLObject("getActiveAttrib", program))
|
| return nullptr;
|
| @@ -2017,7 +2050,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProg
|
| return WebGLActiveInfo::create(info.name, info.type, info.size);
|
| }
|
|
|
| -PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GLuint index)
|
| +PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GLuint index)
|
| {
|
| if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
|
| return nullptr;
|
| @@ -2027,7 +2060,7 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro
|
| return WebGLActiveInfo::create(info.name, info.type, info.size);
|
| }
|
|
|
| -bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader> >& shaderObjects)
|
| +bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, WillBeHeapVector<RefPtrWillBeMember<WebGLShader> >& shaderObjects)
|
| {
|
| shaderObjects.clear();
|
| if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
|
| @@ -2083,14 +2116,14 @@ WebGLGetInfo WebGLRenderingContextBase::getBufferParameter(GLenum target, GLenum
|
| return WebGLGetInfo(static_cast<unsigned>(value));
|
| }
|
|
|
| -PassRefPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes()
|
| +PassRefPtrWillBeRawPtr<WebGLContextAttributes> WebGLRenderingContextBase::getContextAttributes()
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| // We always need to return a new WebGLContextAttributes object to
|
| // prevent the user from mutating any cached version.
|
| blink::WebGraphicsContext3D::Attributes attrs = m_drawingBuffer->getActualAttributes();
|
| - RefPtr<WebGLContextAttributes> attributes = m_requestedAttributes->clone();
|
| + RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = m_requestedAttributes->clone();
|
| // Some requested attributes may not be honored, so we need to query the underlying
|
| // context/drawing buffer and adjust accordingly.
|
| if (m_requestedAttributes->depth() && !attrs.depth)
|
| @@ -2143,18 +2176,18 @@ bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac
|
| }
|
|
|
|
|
| -PassRefPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String& name)
|
| +PassRefPtrWillBeRawPtr<WebGLExtension> WebGLRenderingContextBase::getExtension(const String& name)
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
|
|
| for (size_t i = 0; i < m_extensions.size(); ++i) {
|
| - ExtensionTracker* tracker = m_extensions[i];
|
| + ExtensionTracker* tracker = m_extensions[i].get();
|
| if (tracker->matchesNameWithPrefixes(name)) {
|
| if (!extensionSupportedAndAllowed(tracker))
|
| return nullptr;
|
|
|
| - RefPtr<WebGLExtension> extension = tracker->getExtension(this);
|
| + RefPtrWillBeRawPtr<WebGLExtension> extension = tracker->getExtension(this);
|
| if (extension)
|
| m_extensionEnabled[extension->name()] = true;
|
| return extension.release();
|
| @@ -2190,7 +2223,7 @@ WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum
|
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
| return WebGLGetInfo(GL_TEXTURE);
|
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
|
| - return WebGLGetInfo(PassRefPtr<WebGLTexture>(static_cast<WebGLTexture*>(object)));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(static_cast<WebGLTexture*>(object)));
|
| case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
|
| case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
|
| {
|
| @@ -2207,7 +2240,7 @@ WebGLGetInfo WebGLRenderingContextBase::getFramebufferAttachmentParameter(GLenum
|
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
|
| return WebGLGetInfo(GL_RENDERBUFFER);
|
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
|
| - return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(static_cast<WebGLRenderbuffer*>(object)));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(static_cast<WebGLRenderbuffer*>(object)));
|
| default:
|
| synthesizeGLError(GL_INVALID_ENUM, "getFramebufferAttachmentParameter", "invalid parameter name for renderbuffer attachment");
|
| return WebGLGetInfo();
|
| @@ -2230,7 +2263,7 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_ALPHA_BITS:
|
| return getIntParameter(pname);
|
| case GL_ARRAY_BUFFER_BINDING:
|
| - return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundArrayBuffer));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundArrayBuffer.get()));
|
| case GL_BLEND:
|
| return getBooleanParameter(pname);
|
| case GL_BLEND_COLOR:
|
| @@ -2260,7 +2293,7 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_CULL_FACE_MODE:
|
| return getUnsignedIntParameter(pname);
|
| case GL_CURRENT_PROGRAM:
|
| - return WebGLGetInfo(PassRefPtr<WebGLProgram>(m_currentProgram));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLProgram>(m_currentProgram.get()));
|
| case GL_DEPTH_BITS:
|
| if (!m_framebufferBinding && !m_requestedAttributes->depth())
|
| return WebGLGetInfo(intZero);
|
| @@ -2278,9 +2311,9 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_DITHER:
|
| return getBooleanParameter(pname);
|
| case GL_ELEMENT_ARRAY_BUFFER_BINDING:
|
| - return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundVertexArrayObject->boundElementArrayBuffer()));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(m_boundVertexArrayObject->boundElementArrayBuffer()));
|
| case GL_FRAMEBUFFER_BINDING:
|
| - return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLFramebuffer>(m_framebufferBinding.get()));
|
| case GL_FRONT_FACE:
|
| return getUnsignedIntParameter(pname);
|
| case GL_GENERATE_MIPMAP_HINT:
|
| @@ -2329,7 +2362,7 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_RED_BITS:
|
| return getIntParameter(pname);
|
| case GL_RENDERBUFFER_BINDING:
|
| - return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(m_renderbufferBinding));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLRenderbuffer>(m_renderbufferBinding.get()));
|
| case GL_RENDERER:
|
| return WebGLGetInfo(String("WebKit WebGL"));
|
| case GL_SAMPLE_BUFFERS:
|
| @@ -2385,9 +2418,9 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_SUBPIXEL_BITS:
|
| return getIntParameter(pname);
|
| case GL_TEXTURE_BINDING_2D:
|
| - return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_texture2DBinding));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()));
|
| case GL_TEXTURE_BINDING_CUBE_MAP:
|
| - return WebGLGetInfo(PassRefPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLTexture>(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get()));
|
| case GL_UNPACK_ALIGNMENT:
|
| return getIntParameter(pname);
|
| case GC3D_UNPACK_FLIP_Y_WEBGL:
|
| @@ -2420,7 +2453,7 @@ WebGLGetInfo WebGLRenderingContextBase::getParameter(GLenum pname)
|
| case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object
|
| if (extensionEnabled(OESVertexArrayObjectName)) {
|
| if (!m_boundVertexArrayObject->isDefaultObject())
|
| - return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boundVertexArrayObject));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES>(m_boundVertexArrayObject.get()));
|
| return WebGLGetInfo();
|
| }
|
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_vertex_array_object not enabled");
|
| @@ -2560,7 +2593,7 @@ String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader)
|
| return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader)));
|
| }
|
|
|
| -PassRefPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType)
|
| +PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType)
|
| {
|
| if (isContextLost())
|
| return nullptr;
|
| @@ -2607,7 +2640,7 @@ Vector<String> WebGLRenderingContextBase::getSupportedExtensions()
|
| return result;
|
|
|
| for (size_t i = 0; i < m_extensions.size(); ++i) {
|
| - ExtensionTracker* tracker = m_extensions[i];
|
| + ExtensionTracker* tracker = m_extensions[i].get();
|
| if (extensionSupportedAndAllowed(tracker)) {
|
| const char* const* prefixes = tracker->prefixes();
|
| for (; *prefixes; ++prefixes) {
|
| @@ -2796,7 +2829,7 @@ WebGLGetInfo WebGLRenderingContextBase::getUniform(WebGLProgram* program, const
|
| return WebGLGetInfo();
|
| }
|
|
|
| -PassRefPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(WebGLProgram* program, const String& name)
|
| +PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(WebGLProgram* program, const String& name)
|
| {
|
| if (isContextLost() || !validateWebGLObject("getUniformLocation", program))
|
| return nullptr;
|
| @@ -2833,7 +2866,7 @@ WebGLGetInfo WebGLRenderingContextBase::getVertexAttrib(GLuint index, GLenum pna
|
| case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
|
| if (!state.bufferBinding || !state.bufferBinding->object())
|
| return WebGLGetInfo();
|
| - return WebGLGetInfo(PassRefPtr<WebGLBuffer>(state.bufferBinding));
|
| + return WebGLGetInfo(PassRefPtrWillBeRawPtr<WebGLBuffer>(state.bufferBinding.get()));
|
| case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
|
| return WebGLGetInfo(state.enabled);
|
| case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
|
| @@ -4210,7 +4243,7 @@ void WebGLRenderingContextBase::loseContextImpl(WebGLRenderingContextBase::LostC
|
|
|
| // Lose all the extensions.
|
| for (size_t i = 0; i < m_extensions.size(); ++i) {
|
| - ExtensionTracker* tracker = m_extensions[i];
|
| + ExtensionTracker* tracker = m_extensions[i].get();
|
| tracker->loseExtension();
|
| }
|
|
|
| @@ -4289,7 +4322,7 @@ void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object)
|
| void WebGLRenderingContextBase::detachAndRemoveAllObjects()
|
| {
|
| while (m_contextObjects.size() > 0) {
|
| - HashSet<WebGLContextObject*>::iterator it = m_contextObjects.begin();
|
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject> >::iterator it = m_contextObjects.begin();
|
| (*it)->detachContext();
|
| }
|
| }
|
| @@ -5606,7 +5639,7 @@ void WebGLRenderingContextBase::applyStencilTest()
|
| if (m_framebufferBinding)
|
| haveStencilBuffer = m_framebufferBinding->hasStencilBuffer();
|
| else {
|
| - RefPtr<WebGLContextAttributes> attributes = getContextAttributes();
|
| + RefPtrWillBeRawPtr<WebGLContextAttributes> attributes = getContextAttributes();
|
| haveStencilBuffer = attributes->stencil();
|
| }
|
| enableOrDisable(GL_STENCIL_TEST,
|
| @@ -5700,4 +5733,30 @@ void WebGLRenderingContextBase::findNewMaxNonDefaultTextureUnit()
|
| m_onePlusMaxNonDefaultTextureUnit = 0;
|
| }
|
|
|
| +void WebGLRenderingContextBase::TextureUnitState::trace(Visitor* visitor)
|
| +{
|
| + visitor->trace(m_texture2DBinding);
|
| + visitor->trace(m_textureCubeMapBinding);
|
| +}
|
| +
|
| +void WebGLRenderingContextBase::trace(Visitor* visitor)
|
| +{
|
| + visitor->trace(m_contextObjects);
|
| + visitor->trace(m_contextLostCallbackAdapter);
|
| + visitor->trace(m_errorMessageCallbackAdapter);
|
| + visitor->trace(m_boundArrayBuffer);
|
| + visitor->trace(m_defaultVertexArrayObject);
|
| + visitor->trace(m_boundVertexArrayObject);
|
| + visitor->trace(m_vertexAttrib0Buffer);
|
| + visitor->trace(m_currentProgram);
|
| + visitor->trace(m_framebufferBinding);
|
| + visitor->trace(m_renderbufferBinding);
|
| + visitor->trace(m_textureUnits);
|
| + visitor->trace(m_blackTexture2D);
|
| + visitor->trace(m_blackTextureCubeMap);
|
| + visitor->trace(m_requestedAttributes);
|
| + visitor->trace(m_extensions);
|
| + CanvasRenderingContext::trace(visitor);
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|