Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGL2RenderingContextBase.h" | 5 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/WebGLAny.h" | 7 #include "bindings/modules/v8/WebGLAny.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/frame/ImageBitmap.h" | 9 #include "core/frame/ImageBitmap.h" |
| 10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
| (...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2808 | 2808 |
| 2809 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) { | 2809 GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query) { |
| 2810 if (isContextLost() || !query) | 2810 if (isContextLost() || !query) |
| 2811 return 0; | 2811 return 0; |
| 2812 | 2812 |
| 2813 return contextGL()->IsQueryEXT(query->object()); | 2813 return contextGL()->IsQueryEXT(query->object()); |
| 2814 } | 2814 } |
| 2815 | 2815 |
| 2816 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) { | 2816 void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) { |
| 2817 bool deleted; | 2817 bool deleted; |
| 2818 if (!query) { | 2818 DCHECK(query); |
| 2819 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", | |
| 2820 "query object is null"); | |
| 2821 return; | |
| 2822 } | |
| 2823 | |
| 2824 if (!checkObjectToBeBound("beginQuery", query, deleted)) | 2819 if (!checkObjectToBeBound("beginQuery", query, deleted)) |
| 2825 return; | 2820 return; |
| 2826 if (deleted) { | 2821 if (deleted) { |
| 2827 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", | 2822 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", |
| 2828 "attempted to begin a deleted query object"); | 2823 "attempted to begin a deleted query object"); |
| 2829 return; | 2824 return; |
| 2830 } | 2825 } |
| 2831 | 2826 |
| 2832 if (query->getTarget() && query->getTarget() != target) { | 2827 if (query->getTarget() && query->getTarget() != target) { |
| 2833 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", | 2828 synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2973 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); | 2968 synthesizeGLError(GL_INVALID_ENUM, "getQuery", "invalid target"); |
| 2974 return ScriptValue::createNull(scriptState); | 2969 return ScriptValue::createNull(scriptState); |
| 2975 } | 2970 } |
| 2976 return ScriptValue::createNull(scriptState); | 2971 return ScriptValue::createNull(scriptState); |
| 2977 } | 2972 } |
| 2978 | 2973 |
| 2979 ScriptValue WebGL2RenderingContextBase::getQueryParameter( | 2974 ScriptValue WebGL2RenderingContextBase::getQueryParameter( |
| 2980 ScriptState* scriptState, | 2975 ScriptState* scriptState, |
| 2981 WebGLQuery* query, | 2976 WebGLQuery* query, |
| 2982 GLenum pname) { | 2977 GLenum pname) { |
| 2978 DCHECK(query); | |
|
Ken Russell (switch to Gerrit)
2016/11/05 05:14:52
It's pretty cool and interesting that because the
| |
| 2983 bool deleted; | 2979 bool deleted; |
| 2984 if (!query) { | |
| 2985 synthesizeGLError(GL_INVALID_OPERATION, "getQueryParameter", | |
| 2986 "query object is null"); | |
| 2987 return ScriptValue::createNull(scriptState); | |
| 2988 } | |
| 2989 if (!checkObjectToBeBound("getQueryParameter", query, deleted)) | 2980 if (!checkObjectToBeBound("getQueryParameter", query, deleted)) |
| 2990 return ScriptValue::createNull(scriptState); | 2981 return ScriptValue::createNull(scriptState); |
| 2991 if (deleted) { | 2982 if (deleted) { |
| 2992 synthesizeGLError(GL_INVALID_OPERATION, "getQueryParameter", | 2983 synthesizeGLError(GL_INVALID_OPERATION, "getQueryParameter", |
| 2993 "attempted to access to a deleted query object"); | 2984 "attempted to access to a deleted query object"); |
| 2994 return ScriptValue::createNull(scriptState); | 2985 return ScriptValue::createNull(scriptState); |
| 2995 } | 2986 } |
| 2996 | 2987 |
| 2997 // Query is non-null at this point. | 2988 // Query is non-null at this point. |
| 2998 if (!query->getTarget()) { | 2989 if (!query->getTarget()) { |
| (...skipping 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4961 | 4952 |
| 4962 void WebGL2RenderingContextBase:: | 4953 void WebGL2RenderingContextBase:: |
| 4963 DrawingBufferClientRestorePixelUnpackBufferBinding() { | 4954 DrawingBufferClientRestorePixelUnpackBufferBinding() { |
| 4964 if (!contextGL()) | 4955 if (!contextGL()) |
| 4965 return; | 4956 return; |
| 4966 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, | 4957 contextGL()->BindBuffer(GL_PIXEL_UNPACK_BUFFER, |
| 4967 objectOrZero(m_boundPixelUnpackBuffer.get())); | 4958 objectOrZero(m_boundPixelUnpackBuffer.get())); |
| 4968 } | 4959 } |
| 4969 | 4960 |
| 4970 } // namespace blink | 4961 } // namespace blink |
| OLD | NEW |