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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2485443002: Change WebGL API arg nullable behavior. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index 315e80768d1de323d0e2993d446b716e27601ea7..f330e26c4c680ecbbfcf2a99e80fe3b217f15f46 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -1859,10 +1859,7 @@ void WebGLRenderingContextBase::bufferData(GLenum target,
GLenum usage) {
if (isContextLost())
return;
- if (!data) {
- synthesizeGLError(GL_INVALID_VALUE, "bufferData", "no data");
- return;
- }
+ DCHECK(data);
bufferDataImpl(target, data->byteLength(), data->baseAddress(), usage);
}
@@ -1890,10 +1887,7 @@ void WebGLRenderingContextBase::bufferSubData(GLenum target,
DOMArrayBuffer* data) {
if (isContextLost())
return;
- if (!data) {
- synthesizeGLError(GL_INVALID_VALUE, "bufferSubData", "no data");
- return;
- }
+ DCHECK(data);
bufferSubDataImpl(target, offset, data->byteLength(), data->data());
}
@@ -1903,10 +1897,7 @@ void WebGLRenderingContextBase::bufferSubData(
const FlexibleArrayBufferView& data) {
if (isContextLost())
return;
- if (!data) {
- synthesizeGLError(GL_INVALID_VALUE, "bufferSubData", "no data");
- return;
- }
+ DCHECK(data);
bufferSubDataImpl(target, offset, data.byteLength(),
data.baseAddressMaybeOnStack());
}
@@ -2397,7 +2388,8 @@ bool WebGLRenderingContextBase::validateRenderingState(
bool WebGLRenderingContextBase::validateWebGLObject(const char* functionName,
WebGLObject* object) {
- if (!object || !object->hasObject()) {
+ DCHECK(object);
+ if (!object->hasObject()) {
synthesizeGLError(GL_INVALID_VALUE, functionName,
"no object or object deleted");
return false;
@@ -3421,7 +3413,8 @@ ScriptValue WebGLRenderingContextBase::getUniform(
const WebGLUniformLocation* uniformLocation) {
if (isContextLost() || !validateWebGLObject("getUniform", program))
return ScriptValue::createNull(scriptState);
- if (!uniformLocation || uniformLocation->program() != program) {
+ DCHECK(uniformLocation);
+ if (uniformLocation->program() != program) {
synthesizeGLError(GL_INVALID_OPERATION, "getUniform",
"no uniformlocation or not valid for this program");
return ScriptValue::createNull(scriptState);
@@ -4692,10 +4685,7 @@ void WebGLRenderingContextBase::texImageHelperImageData(
const char* funcName = getTexImageFunctionName(functionID);
if (isContextLost())
return;
- if (!pixels) {
- synthesizeGLError(GL_INVALID_VALUE, funcName, "no image data");
- return;
- }
+ DCHECK(pixels);
if (pixels->data()->bufferBase()->isNeutered()) {
synthesizeGLError(GL_INVALID_VALUE, funcName,
"The source data has been neutered.");

Powered by Google App Engine
This is Rietveld 408576698