Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 386953002: Make WebGLRenderingContext.getAttachedShaders() return type nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix additional test expectations Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro gram* program, GLuint index) 2020 PassRefPtr<WebGLActiveInfo> WebGLRenderingContextBase::getActiveUniform(WebGLPro gram* program, GLuint index)
2021 { 2021 {
2022 if (isContextLost() || !validateWebGLObject("getActiveUniform", program)) 2022 if (isContextLost() || !validateWebGLObject("getActiveUniform", program))
2023 return nullptr; 2023 return nullptr;
2024 blink::WebGraphicsContext3D::ActiveInfo info; 2024 blink::WebGraphicsContext3D::ActiveInfo info;
2025 if (!webContext()->getActiveUniform(objectOrZero(program), index, info)) 2025 if (!webContext()->getActiveUniform(objectOrZero(program), index, info))
2026 return nullptr; 2026 return nullptr;
2027 return WebGLActiveInfo::create(info.name, info.type, info.size); 2027 return WebGLActiveInfo::create(info.name, info.type, info.size);
2028 } 2028 }
2029 2029
2030 bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector <RefPtr<WebGLShader> >& shaderObjects) 2030 Nullable<Vector<RefPtr<WebGLShader> > > WebGLRenderingContextBase::getAttachedSh aders(WebGLProgram* program)
2031 { 2031 {
2032 shaderObjects.clear();
2033 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program)) 2032 if (isContextLost() || !validateWebGLObject("getAttachedShaders", program))
2034 return false; 2033 return Nullable<Vector<RefPtr<WebGLShader> > >();
2035 2034
2035 Vector<RefPtr<WebGLShader> > shaderObjects;
2036 const GLenum shaderType[] = { 2036 const GLenum shaderType[] = {
2037 GL_VERTEX_SHADER, 2037 GL_VERTEX_SHADER,
2038 GL_FRAGMENT_SHADER 2038 GL_FRAGMENT_SHADER
2039 }; 2039 };
2040 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) { 2040 for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GLenum); ++i) {
2041 WebGLShader* shader = program->getAttachedShader(shaderType[i]); 2041 WebGLShader* shader = program->getAttachedShader(shaderType[i]);
2042 if (shader) 2042 if (shader)
2043 shaderObjects.append(shader); 2043 shaderObjects.append(shader);
2044 } 2044 }
2045 return true; 2045 return shaderObjects;
2046 } 2046 }
2047 2047
2048 GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name) 2048 GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name)
2049 { 2049 {
2050 if (isContextLost() || !validateWebGLObject("getAttribLocation", program)) 2050 if (isContextLost() || !validateWebGLObject("getAttribLocation", program))
2051 return -1; 2051 return -1;
2052 if (!validateLocationLength("getAttribLocation", name)) 2052 if (!validateLocationLength("getAttribLocation", name))
2053 return -1; 2053 return -1;
2054 if (!validateString("getAttribLocation", name)) 2054 if (!validateString("getAttribLocation", name))
2055 return -1; 2055 return -1;
(...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after
5695 if (m_textureUnits[i].m_texture2DBinding 5695 if (m_textureUnits[i].m_texture2DBinding
5696 || m_textureUnits[i].m_textureCubeMapBinding) { 5696 || m_textureUnits[i].m_textureCubeMapBinding) {
5697 m_onePlusMaxNonDefaultTextureUnit = i + 1; 5697 m_onePlusMaxNonDefaultTextureUnit = i + 1;
5698 return; 5698 return;
5699 } 5699 }
5700 } 5700 }
5701 m_onePlusMaxNonDefaultTextureUnit = 0; 5701 m_onePlusMaxNonDefaultTextureUnit = 0;
5702 } 5702 }
5703 5703
5704 } // namespace WebCore 5704 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | Source/core/html/canvas/WebGLRenderingContextBase.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698