Chromium Code Reviews| Index: Source/modules/webgl/WebGLRenderingContextBase.cpp |
| diff --git a/Source/modules/webgl/WebGLRenderingContextBase.cpp b/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| index cad3a3dbf67478d1a0014cd6ce52133e2abef3f4..49c0f6cceebeeb1824b0e65b61a542ba39fb376a 100644 |
| --- a/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| +++ b/Source/modules/webgl/WebGLRenderingContextBase.cpp |
| @@ -221,249 +221,249 @@ void WebGLRenderingContextBase::willDestroyContext(WebGLRenderingContextBase* co |
| namespace { |
| - // ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2D to read from |
|
Ken Russell (switch to Gerrit)
2015/08/01 00:11:56
Similar issue with indentation in this block. Coul
peria
2015/08/03 09:00:36
Acknowledged.
https://codereview.chromium.org/1258
|
| - // a multisampled DrawingBuffer. In this situation, we need to blit to a single sampled buffer |
| - // for reading, during which the bindings could be changed and need to be recovered. |
| - class ScopedDrawingBufferBinder { |
| - STACK_ALLOCATED(); |
| - public: |
| - ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding) |
| - : m_drawingBuffer(drawingBuffer) |
| - , m_readFramebufferBinding(framebufferBinding) |
| - { |
| - // Commit DrawingBuffer if needed (e.g., for multisampling) |
| - if (!m_readFramebufferBinding && m_drawingBuffer) |
| - m_drawingBuffer->commit(); |
| - } |
| +// ScopedDrawingBufferBinder is used for ReadPixels/CopyTexImage2D/CopySubImage2D to read from |
| +// a multisampled DrawingBuffer. In this situation, we need to blit to a single sampled buffer |
| +// for reading, during which the bindings could be changed and need to be recovered. |
| +class ScopedDrawingBufferBinder { |
| + STACK_ALLOCATED(); |
| +public: |
| + ScopedDrawingBufferBinder(DrawingBuffer* drawingBuffer, WebGLFramebuffer* framebufferBinding) |
| + : m_drawingBuffer(drawingBuffer) |
| + , m_readFramebufferBinding(framebufferBinding) |
| + { |
| + // Commit DrawingBuffer if needed (e.g., for multisampling) |
| + if (!m_readFramebufferBinding && m_drawingBuffer) |
| + m_drawingBuffer->commit(); |
| + } |
| - ~ScopedDrawingBufferBinder() |
| - { |
| - // Restore DrawingBuffer if needed |
| - if (!m_readFramebufferBinding && m_drawingBuffer) |
| - m_drawingBuffer->restoreFramebufferBindings(); |
| - } |
| + ~ScopedDrawingBufferBinder() |
| + { |
| + // Restore DrawingBuffer if needed |
| + if (!m_readFramebufferBinding && m_drawingBuffer) |
| + m_drawingBuffer->restoreFramebufferBindings(); |
| + } |
| - private: |
| - DrawingBuffer* m_drawingBuffer; |
| - RawPtrWillBeMember<WebGLFramebuffer> m_readFramebufferBinding; |
| - }; |
| +private: |
| + DrawingBuffer* m_drawingBuffer; |
| + Member<WebGLFramebuffer> m_readFramebufferBinding; |
| +}; |
| - GLint clamp(GLint value, GLint min, GLint max) |
| +GLint clamp(GLint value, GLint min, GLint max) |
| +{ |
| + if (value < min) |
| + value = min; |
| + if (value > max) |
| + value = max; |
| + return value; |
| +} |
| + |
| +// Return true if a character belongs to the ASCII subset as defined in |
| +// GLSL ES 1.0 spec section 3.1. |
| +bool validateCharacter(unsigned char c) |
| +{ |
| + // Printing characters are valid except " $ ` @ \ ' DEL. |
| + if (c >= 32 && c <= 126 |
| + && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') |
| + return true; |
| + // Horizontal tab, line feed, vertical tab, form feed, carriage return |
| + // are also valid. |
| + if (c >= 9 && c <= 13) |
| + return true; |
| + return false; |
| +} |
| + |
| +bool isPrefixReserved(const String& name) |
| +{ |
| + if (name.startsWith("gl_") || name.startsWith("webgl_") || name.startsWith("_webgl_")) |
| + return true; |
| + return false; |
| +} |
| + |
| +// Strips comments from shader text. This allows non-ASCII characters |
| +// to be used in comments without potentially breaking OpenGL |
| +// implementations not expecting characters outside the GLSL ES set. |
| +class StripComments { |
| +public: |
| + StripComments(const String& str) |
| + : m_parseState(BeginningOfLine) |
| + , m_sourceString(str) |
| + , m_length(str.length()) |
| + , m_position(0) |
| { |
| - if (value < min) |
| - value = min; |
| - if (value > max) |
| - value = max; |
| - return value; |
| + parse(); |
| } |
| - // Return true if a character belongs to the ASCII subset as defined in |
| - // GLSL ES 1.0 spec section 3.1. |
| - bool validateCharacter(unsigned char c) |
| + String result() |
| { |
| - // Printing characters are valid except " $ ` @ \ ' DEL. |
| - if (c >= 32 && c <= 126 |
| - && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') |
| - return true; |
| - // Horizontal tab, line feed, vertical tab, form feed, carriage return |
| - // are also valid. |
| - if (c >= 9 && c <= 13) |
| - return true; |
| - return false; |
| + return m_builder.toString(); |
| } |
| - bool isPrefixReserved(const String& name) |
| +private: |
| + bool hasMoreCharacters() const |
| { |
| - if (name.startsWith("gl_") || name.startsWith("webgl_") || name.startsWith("_webgl_")) |
| - return true; |
| - return false; |
| + return (m_position < m_length); |
| } |
| - // Strips comments from shader text. This allows non-ASCII characters |
| - // to be used in comments without potentially breaking OpenGL |
| - // implementations not expecting characters outside the GLSL ES set. |
| - class StripComments { |
| - public: |
| - StripComments(const String& str) |
| - : m_parseState(BeginningOfLine) |
| - , m_sourceString(str) |
| - , m_length(str.length()) |
| - , m_position(0) |
| - { |
| - parse(); |
| - } |
| - |
| - String result() |
| - { |
| - return m_builder.toString(); |
| - } |
| - |
| - private: |
| - bool hasMoreCharacters() const |
| - { |
| - return (m_position < m_length); |
| - } |
| - |
| - void parse() |
| - { |
| - while (hasMoreCharacters()) { |
| - process(current()); |
| - // process() might advance the position. |
| - if (hasMoreCharacters()) |
| - advance(); |
| - } |
| + void parse() |
| + { |
| + while (hasMoreCharacters()) { |
| + process(current()); |
| + // process() might advance the position. |
| + if (hasMoreCharacters()) |
| + advance(); |
| } |
| + } |
| - void process(UChar); |
| + void process(UChar); |
| - bool peek(UChar& character) const |
| - { |
| - if (m_position + 1 >= m_length) |
| - return false; |
| - character = m_sourceString[m_position + 1]; |
| - return true; |
| - } |
| + bool peek(UChar& character) const |
| + { |
| + if (m_position + 1 >= m_length) |
| + return false; |
| + character = m_sourceString[m_position + 1]; |
| + return true; |
| + } |
| - UChar current() |
| - { |
| - ASSERT_WITH_SECURITY_IMPLICATION(m_position < m_length); |
| - return m_sourceString[m_position]; |
| - } |
| + UChar current() |
| + { |
| + ASSERT_WITH_SECURITY_IMPLICATION(m_position < m_length); |
| + return m_sourceString[m_position]; |
| + } |
| - void advance() |
| - { |
| - ++m_position; |
| - } |
| + void advance() |
| + { |
| + ++m_position; |
| + } |
| - static bool isNewline(UChar character) |
| - { |
| - // Don't attempt to canonicalize newline related characters. |
| - return (character == '\n' || character == '\r'); |
| - } |
| + static bool isNewline(UChar character) |
| + { |
| + // Don't attempt to canonicalize newline related characters. |
| + return (character == '\n' || character == '\r'); |
| + } |
| - void emit(UChar character) |
| - { |
| - m_builder.append(character); |
| - } |
| + void emit(UChar character) |
| + { |
| + m_builder.append(character); |
| + } |
| - enum ParseState { |
| - // Have not seen an ASCII non-whitespace character yet on |
| - // this line. Possible that we might see a preprocessor |
| - // directive. |
| - BeginningOfLine, |
| - |
| - // Have seen at least one ASCII non-whitespace character |
| - // on this line. |
| - MiddleOfLine, |
| - |
| - // Handling a preprocessor directive. Passes through all |
| - // characters up to the end of the line. Disables comment |
| - // processing. |
| - InPreprocessorDirective, |
| - |
| - // Handling a single-line comment. The comment text is |
| - // replaced with a single space. |
| - InSingleLineComment, |
| - |
| - // Handling a multi-line comment. Newlines are passed |
| - // through to preserve line numbers. |
| - InMultiLineComment |
| - }; |
| - |
| - ParseState m_parseState; |
| - String m_sourceString; |
| - unsigned m_length; |
| - unsigned m_position; |
| - StringBuilder m_builder; |
| - }; |
| + enum ParseState { |
| + // Have not seen an ASCII non-whitespace character yet on |
| + // this line. Possible that we might see a preprocessor |
| + // directive. |
| + BeginningOfLine, |
| - void StripComments::process(UChar c) |
| - { |
| - if (isNewline(c)) { |
| - // No matter what state we are in, pass through newlines |
| - // so we preserve line numbers. |
| - emit(c); |
| + // Have seen at least one ASCII non-whitespace character |
| + // on this line. |
| + MiddleOfLine, |
| - if (m_parseState != InMultiLineComment) |
| - m_parseState = BeginningOfLine; |
| + // Handling a preprocessor directive. Passes through all |
| + // characters up to the end of the line. Disables comment |
| + // processing. |
| + InPreprocessorDirective, |
| - return; |
| - } |
| + // Handling a single-line comment. The comment text is |
| + // replaced with a single space. |
| + InSingleLineComment, |
| - UChar temp = 0; |
| - switch (m_parseState) { |
| - case BeginningOfLine: |
| - if (WTF::isASCIISpace(c)) { |
| - emit(c); |
| - break; |
| - } |
| + // Handling a multi-line comment. Newlines are passed |
| + // through to preserve line numbers. |
| + InMultiLineComment |
| + }; |
| - if (c == '#') { |
| - m_parseState = InPreprocessorDirective; |
| - emit(c); |
| - break; |
| - } |
| + ParseState m_parseState; |
| + String m_sourceString; |
| + unsigned m_length; |
| + unsigned m_position; |
| + StringBuilder m_builder; |
| +}; |
| - // Transition to normal state and re-handle character. |
| - m_parseState = MiddleOfLine; |
| - process(c); |
| - break; |
| +void StripComments::process(UChar c) |
| +{ |
| + if (isNewline(c)) { |
| + // No matter what state we are in, pass through newlines |
| + // so we preserve line numbers. |
| + emit(c); |
| - case MiddleOfLine: |
| - if (c == '/' && peek(temp)) { |
| - if (temp == '/') { |
| - m_parseState = InSingleLineComment; |
| - emit(' '); |
| - advance(); |
| - break; |
| - } |
| + if (m_parseState != InMultiLineComment) |
| + m_parseState = BeginningOfLine; |
| - if (temp == '*') { |
| - m_parseState = InMultiLineComment; |
| - // Emit the comment start in case the user has |
| - // an unclosed comment and we want to later |
| - // signal an error. |
| - emit('/'); |
| - emit('*'); |
| - advance(); |
| - break; |
| - } |
| - } |
| + return; |
| + } |
| + UChar temp = 0; |
| + switch (m_parseState) { |
| + case BeginningOfLine: |
| + if (WTF::isASCIISpace(c)) { |
| emit(c); |
| break; |
| + } |
| - case InPreprocessorDirective: |
| - // No matter what the character is, just pass it |
| - // through. Do not parse comments in this state. This |
| - // might not be the right thing to do long term, but it |
| - // should handle the #error preprocessor directive. |
| + if (c == '#') { |
| + m_parseState = InPreprocessorDirective; |
| emit(c); |
| break; |
| + } |
| - case InSingleLineComment: |
| - // The newline code at the top of this function takes care |
| - // of resetting our state when we get out of the |
| - // single-line comment. Swallow all other characters. |
| - break; |
| + // Transition to normal state and re-handle character. |
| + m_parseState = MiddleOfLine; |
| + process(c); |
| + break; |
| - case InMultiLineComment: |
| - if (c == '*' && peek(temp) && temp == '/') { |
| - emit('*'); |
| + case MiddleOfLine: |
| + if (c == '/' && peek(temp)) { |
| + if (temp == '/') { |
| + m_parseState = InSingleLineComment; |
| + emit(' '); |
| + advance(); |
| + break; |
| + } |
| + |
| + if (temp == '*') { |
| + m_parseState = InMultiLineComment; |
| + // Emit the comment start in case the user has |
| + // an unclosed comment and we want to later |
| + // signal an error. |
| emit('/'); |
| - m_parseState = MiddleOfLine; |
| + emit('*'); |
| advance(); |
| break; |
| } |
| + } |
| + |
| + emit(c); |
| + break; |
| + |
| + case InPreprocessorDirective: |
| + // No matter what the character is, just pass it |
| + // through. Do not parse comments in this state. This |
| + // might not be the right thing to do long term, but it |
| + // should handle the #error preprocessor directive. |
| + emit(c); |
| + break; |
| - // Swallow all other characters. Unclear whether we may |
| - // want or need to just emit a space per character to try |
| - // to preserve column numbers for debugging purposes. |
| + case InSingleLineComment: |
| + // The newline code at the top of this function takes care |
| + // of resetting our state when we get out of the |
| + // single-line comment. Swallow all other characters. |
| + break; |
| + |
| + case InMultiLineComment: |
| + if (c == '*' && peek(temp) && temp == '/') { |
| + emit('*'); |
| + emit('/'); |
| + m_parseState = MiddleOfLine; |
| + advance(); |
| break; |
| } |
| + |
| + // Swallow all other characters. Unclear whether we may |
| + // want or need to just emit a space per character to try |
| + // to preserve column numbers for debugging purposes. |
| + break; |
| } |
| +} |
| - static bool shouldFailContextCreationForTesting = false; |
| +static bool shouldFailContextCreationForTesting = false; |
| } // namespace anonymous |
| class ScopedTexture2DRestorer { |
| @@ -500,12 +500,11 @@ private: |
| RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
| }; |
| -class WebGLRenderingContextLostCallback final : public NoBaseWillBeGarbageCollectedFinalized<WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| - WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextLostCallback); |
| +class WebGLRenderingContextLostCallback final : public GarbageCollectedFinalized<WebGLRenderingContextLostCallback>, public WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| public: |
| - static PassOwnPtrWillBeRawPtr<WebGLRenderingContextLostCallback> create(WebGLRenderingContextBase* context) |
| + static WebGLRenderingContextLostCallback* create(WebGLRenderingContextBase* context) |
| { |
| - return adoptPtrWillBeNoop(new WebGLRenderingContextLostCallback(context)); |
| + return new WebGLRenderingContextLostCallback(context); |
| } |
| ~WebGLRenderingContextLostCallback() override { } |
| @@ -524,12 +523,11 @@ private: |
| RawPtrWillBeMember<WebGLRenderingContextBase> m_context; |
| }; |
| -class WebGLRenderingContextErrorMessageCallback final : public NoBaseWillBeGarbageCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraphicsContext3D::WebGraphicsErrorMessageCallback { |
| - WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(WebGLRenderingContextErrorMessageCallback); |
| +class WebGLRenderingContextErrorMessageCallback final : public GarbageCollectedFinalized<WebGLRenderingContextErrorMessageCallback>, public WebGraphicsContext3D::WebGraphicsErrorMessageCallback { |
| public: |
| - static PassOwnPtrWillBeRawPtr<WebGLRenderingContextErrorMessageCallback> create(WebGLRenderingContextBase* context) |
| + static WebGLRenderingContextErrorMessageCallback* create(WebGLRenderingContextBase* context) |
| { |
| - return adoptPtrWillBeNoop(new WebGLRenderingContextErrorMessageCallback(context)); |
| + return new WebGLRenderingContextErrorMessageCallback(context); |
| } |
| ~WebGLRenderingContextErrorMessageCallback() override { } |
| @@ -1917,49 +1915,49 @@ void WebGLRenderingContextBase::copyTexSubImage2D(GLenum target, GLint level, GL |
| webContext()->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer() |
| +WebGLBuffer* WebGLRenderingContextBase::createBuffer() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<WebGLBuffer> o = WebGLBuffer::create(this); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + WebGLBuffer* o = WebGLBuffer::create(this); |
| + addSharedObject(o); |
| + return o; |
| } |
| -PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLRenderingContextBase::createFramebuffer() |
| +WebGLFramebuffer* WebGLRenderingContextBase::createFramebuffer() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this); |
| - addContextObject(o.get()); |
| - return o.release(); |
| + WebGLFramebuffer* o = WebGLFramebuffer::create(this); |
| + addContextObject(o); |
| + return o; |
| } |
| -PassRefPtrWillBeRawPtr<WebGLTexture> WebGLRenderingContextBase::createTexture() |
| +WebGLTexture* WebGLRenderingContextBase::createTexture() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<WebGLTexture> o = WebGLTexture::create(this); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + WebGLTexture* o = WebGLTexture::create(this); |
| + addSharedObject(o); |
| + return o; |
| } |
| -PassRefPtrWillBeRawPtr<WebGLProgram> WebGLRenderingContextBase::createProgram() |
| +WebGLProgram* WebGLRenderingContextBase::createProgram() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<WebGLProgram> o = WebGLProgram::create(this); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + WebGLProgram* o = WebGLProgram::create(this); |
| + addSharedObject(o); |
| + return o; |
| } |
| -PassRefPtrWillBeRawPtr<WebGLRenderbuffer> WebGLRenderingContextBase::createRenderbuffer() |
| +WebGLRenderbuffer* WebGLRenderingContextBase::createRenderbuffer() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + WebGLRenderbuffer* o = WebGLRenderbuffer::create(this); |
| + addSharedObject(o); |
| + return o; |
| } |
| WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum target, WebGLRenderbuffer* renderbuffer) |
| @@ -1974,7 +1972,7 @@ WebGLRenderbuffer* WebGLRenderingContextBase::ensureEmulatedStencilBuffer(GLenum |
| return renderbuffer->emulatedStencilBuffer(); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLenum type) |
| +WebGLShader* WebGLRenderingContextBase::createShader(GLenum type) |
| { |
| if (isContextLost()) |
| return nullptr; |
| @@ -1983,9 +1981,9 @@ PassRefPtrWillBeRawPtr<WebGLShader> WebGLRenderingContextBase::createShader(GLen |
| return nullptr; |
| } |
| - RefPtrWillBeRawPtr<WebGLShader> o = WebGLShader::create(this, type); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + WebGLShader* o = WebGLShader::create(this, type); |
| + addSharedObject(o); |
| + return o; |
| } |
| void WebGLRenderingContextBase::cullFace(GLenum mode) |
| @@ -2441,7 +2439,7 @@ void WebGLRenderingContextBase::generateMipmap(GLenum target) |
| tex->generateMipmapLevelInfo(); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index) |
| +WebGLActiveInfo* WebGLRenderingContextBase::getActiveAttrib(WebGLProgram* program, GLuint index) |
| { |
| if (isContextLost() || !validateWebGLObject("getActiveAttrib", program)) |
| return nullptr; |
| @@ -2451,7 +2449,7 @@ PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveAttr |
| return WebGLActiveInfo::create(info.name, info.type, info.size); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GLuint index) |
| +WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform(WebGLProgram* program, GLuint index) |
| { |
| if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) |
| return nullptr; |
| @@ -2461,12 +2459,12 @@ PassRefPtrWillBeRawPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUnif |
| return WebGLActiveInfo::create(info.name, info.type, info.size); |
| } |
| -Nullable<WillBeHeapVector<RefPtrWillBeMember<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program) |
| +Nullable<HeapVector<Member<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program) |
| { |
| if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) |
| return nullptr; |
| - WillBeHeapVector<RefPtrWillBeMember<WebGLShader>> shaderObjects; |
| + HeapVector<Member<WebGLShader>> shaderObjects; |
| const GLenum shaderType[] = { |
| GL_VERTEX_SHADER, |
| GL_FRAGMENT_SHADER |
| @@ -2592,7 +2590,7 @@ bool WebGLRenderingContextBase::extensionSupportedAndAllowed(const ExtensionTrac |
| ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* scriptState, const String& name) |
| { |
| - RefPtrWillBeRawPtr<WebGLExtension> extension = nullptr; |
| + WebGLExtension* extension = nullptr; |
| if (!isContextLost()) { |
| for (size_t i = 0; i < m_extensions.size(); ++i) { |
| @@ -2637,7 +2635,7 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS |
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| return WebGLAny(scriptState, GL_TEXTURE); |
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(attachmentObject)); |
| + return WebGLAny(scriptState, attachmentObject); |
| case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| { |
| @@ -2662,7 +2660,7 @@ ScriptValue WebGLRenderingContextBase::getFramebufferAttachmentParameter(ScriptS |
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| return WebGLAny(scriptState, GL_RENDERBUFFER); |
| case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(attachmentObject)); |
| + return WebGLAny(scriptState, attachmentObject); |
| case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: |
| if (extensionEnabled(EXTsRGBName) || isWebGL2OrHigher()) { |
| GLint value = 0; |
| @@ -2693,7 +2691,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_ALPHA_BITS: |
| return getIntParameter(scriptState, pname); |
| case GL_ARRAY_BUFFER_BINDING: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_boundArrayBuffer.get())); |
| + return WebGLAny(scriptState, m_boundArrayBuffer.get()); |
| case GL_BLEND: |
| return getBooleanParameter(scriptState, pname); |
| case GL_BLEND_COLOR: |
| @@ -2723,7 +2721,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_CULL_FACE_MODE: |
| return getUnsignedIntParameter(scriptState, pname); |
| case GL_CURRENT_PROGRAM: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_currentProgram.get())); |
| + return WebGLAny(scriptState, m_currentProgram.get()); |
| case GL_DEPTH_BITS: |
| if (!m_framebufferBinding && !m_requestedAttributes.depth()) |
| return WebGLAny(scriptState, intZero); |
| @@ -2741,9 +2739,9 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_DITHER: |
| return getBooleanParameter(scriptState, pname); |
| case GL_ELEMENT_ARRAY_BUFFER_BINDING: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_boundVertexArrayObject->boundElementArrayBuffer())); |
| + return WebGLAny(scriptState, m_boundVertexArrayObject->boundElementArrayBuffer()); |
| case GL_FRAMEBUFFER_BINDING: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_framebufferBinding.get())); |
| + return WebGLAny(scriptState, m_framebufferBinding.get()); |
| case GL_FRONT_FACE: |
| return getUnsignedIntParameter(scriptState, pname); |
| case GL_GENERATE_MIPMAP_HINT: |
| @@ -2792,7 +2790,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_RED_BITS: |
| return getIntParameter(scriptState, pname); |
| case GL_RENDERBUFFER_BINDING: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_renderbufferBinding.get())); |
| + return WebGLAny(scriptState, m_renderbufferBinding.get()); |
| case GL_RENDERER: |
| return WebGLAny(scriptState, String("WebKit WebGL")); |
| case GL_SAMPLE_BUFFERS: |
| @@ -2848,9 +2846,9 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_SUBPIXEL_BITS: |
| return getIntParameter(scriptState, pname); |
| case GL_TEXTURE_BINDING_2D: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get())); |
| + return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_texture2DBinding.get()); |
| case GL_TEXTURE_BINDING_CUBE_MAP: |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get())); |
| + return WebGLAny(scriptState, m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding.get()); |
| case GL_UNPACK_ALIGNMENT: |
| return getIntParameter(scriptState, pname); |
| case GC3D_UNPACK_FLIP_Y_WEBGL: |
| @@ -2883,7 +2881,7 @@ ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* scriptState, GL |
| case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object |
| if (extensionEnabled(OESVertexArrayObjectName) || isWebGL2OrHigher()) { |
| if (!m_boundVertexArrayObject->isDefaultObject()) |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(m_boundVertexArrayObject.get())); |
| + return WebGLAny(scriptState, m_boundVertexArrayObject.get()); |
| return ScriptValue::createNull(scriptState); |
| } |
| synthesizeGLError(GL_INVALID_ENUM, "getParameter", "invalid parameter name, OES_vertex_array_object not enabled"); |
| @@ -3035,7 +3033,7 @@ String WebGLRenderingContextBase::getShaderInfoLog(WebGLShader* shader) |
| return ensureNotNull(webContext()->getShaderInfoLog(objectOrZero(shader))); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLShaderPrecisionFormat> WebGLRenderingContextBase::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
| +WebGLShaderPrecisionFormat* WebGLRenderingContextBase::getShaderPrecisionFormat(GLenum shaderType, GLenum precisionType) |
| { |
| if (isContextLost()) |
| return nullptr; |
| @@ -3331,7 +3329,7 @@ ScriptValue WebGLRenderingContextBase::getUniform(ScriptState* scriptState, WebG |
| return ScriptValue::createNull(scriptState); |
| } |
| -PassRefPtrWillBeRawPtr<WebGLUniformLocation> WebGLRenderingContextBase::getUniformLocation(WebGLProgram* program, const String& name) |
| +WebGLUniformLocation* WebGLRenderingContextBase::getUniformLocation(WebGLProgram* program, const String& name) |
| { |
| if (isContextLost() || !validateWebGLObject("getUniformLocation", program)) |
| return nullptr; |
| @@ -3369,7 +3367,7 @@ ScriptValue WebGLRenderingContextBase::getVertexAttrib(ScriptState* scriptState, |
| case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: |
| if (!state->bufferBinding || !state->bufferBinding->object()) |
| return ScriptValue::createNull(scriptState); |
| - return WebGLAny(scriptState, PassRefPtrWillBeRawPtr<WebGLObject>(state->bufferBinding.get())); |
| + return WebGLAny(scriptState, state->bufferBinding.get()); |
| case GL_VERTEX_ATTRIB_ARRAY_ENABLED: |
| return WebGLAny(scriptState, state->enabled); |
| case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: |
| @@ -3963,13 +3961,13 @@ void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen |
| webContext()->stencilOpSeparate(face, fail, zfail, zpass); |
| } |
| -PassRefPtrWillBeRawPtr<CHROMIUMValuebuffer> WebGLRenderingContextBase::createValuebufferCHROMIUM() |
| +CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM() |
| { |
| if (isContextLost()) |
| return nullptr; |
| - RefPtrWillBeRawPtr<CHROMIUMValuebuffer> o = CHROMIUMValuebuffer::create(this); |
| - addSharedObject(o.get()); |
| - return o.release(); |
| + CHROMIUMValuebuffer* o = CHROMIUMValuebuffer::create(this); |
| + addSharedObject(o); |
| + return o; |
| } |
| void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *valuebuffer) |
| @@ -5145,7 +5143,7 @@ void WebGLRenderingContextBase::addContextObject(WebGLContextObject* object) |
| void WebGLRenderingContextBase::detachAndRemoveAllObjects() |
| { |
| while (m_contextObjects.size() > 0) { |
| - WillBeHeapHashSet<RawPtrWillBeWeakMember<WebGLContextObject>>::iterator it = m_contextObjects.begin(); |
| + auto it = m_contextObjects.begin(); |
| (*it)->detachContext(); |
| } |
| } |
| @@ -6023,7 +6021,7 @@ WebGLBuffer* WebGLRenderingContextBase::validateBufferDataTarget(const char* fun |
| WebGLBuffer* buffer = nullptr; |
| switch (target) { |
| case GL_ELEMENT_ARRAY_BUFFER: |
| - buffer = m_boundVertexArrayObject->boundElementArrayBuffer().get(); |
| + buffer = m_boundVertexArrayObject->boundElementArrayBuffer(); |
| break; |
| case GL_ARRAY_BUFFER: |
| buffer = m_boundArrayBuffer.get(); |
| @@ -6549,7 +6547,6 @@ DEFINE_TRACE(WebGLRenderingContextBase::TextureUnitState) |
| DEFINE_TRACE(WebGLRenderingContextBase) |
| { |
| -#if ENABLE(OILPAN) |
| visitor->trace(m_contextObjects); |
| visitor->trace(m_contextLostCallbackAdapter); |
| visitor->trace(m_errorMessageCallbackAdapter); |
| @@ -6564,9 +6561,7 @@ DEFINE_TRACE(WebGLRenderingContextBase) |
| visitor->trace(m_textureUnits); |
| visitor->trace(m_blackTexture2D); |
| visitor->trace(m_blackTextureCubeMap); |
| - visitor->trace(m_requestedAttributes); |
| visitor->trace(m_extensions); |
| -#endif |
| CanvasRenderingContext::trace(visitor); |
| } |