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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
index fbde1a813b59e4f64d6382e24968e55d773221b6..d0413720b5198e87c859becab42fb499f7298e47 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -26,6 +26,8 @@
#ifndef WebGLRenderingContextBase_h
#define WebGLRenderingContextBase_h
+#include <memory>
+#include <set>
#include "bindings/core/v8/Nullable.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/ScriptValue.h"
@@ -33,6 +35,7 @@
#include "bindings/core/v8/ScriptWrappableVisitor.h"
#include "core/CoreExport.h"
#include "core/dom/DOMTypedArray.h"
+#include "core/dom/MaybeShared.h"
#include "core/dom/TypedFlexibleArrayBufferView.h"
#include "core/html/canvas/CanvasContextCreationAttributes.h"
#include "core/html/canvas/CanvasRenderingContext.h"
@@ -51,8 +54,6 @@
#include "third_party/khronos/GLES2/gl2.h"
#include "wtf/CheckedNumeric.h"
#include "wtf/text/WTFString.h"
-#include <memory>
-#include <set>
namespace blink {
class WebLayer;
@@ -467,19 +468,19 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
void uniform4iv(const WebGLUniformLocation*, Vector<GLint>&);
void uniformMatrix2fv(const WebGLUniformLocation*,
GLboolean transpose,
- DOMFloat32Array* value);
+ const MaybeShared<DOMFloat32Array>& value);
void uniformMatrix2fv(const WebGLUniformLocation*,
GLboolean transpose,
Vector<GLfloat>& value);
void uniformMatrix3fv(const WebGLUniformLocation*,
GLboolean transpose,
- DOMFloat32Array* value);
+ const MaybeShared<DOMFloat32Array>& value);
void uniformMatrix3fv(const WebGLUniformLocation*,
GLboolean transpose,
Vector<GLfloat>& value);
void uniformMatrix4fv(const WebGLUniformLocation*,
GLboolean transpose,
- DOMFloat32Array* value);
+ const MaybeShared<DOMFloat32Array>& value);
void uniformMatrix4fv(const WebGLUniformLocation*,
GLboolean transpose,
Vector<GLfloat>& value);
@@ -488,16 +489,20 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
void validateProgram(WebGLProgram*);
void vertexAttrib1f(GLuint index, GLfloat x);
- void vertexAttrib1fv(GLuint index, const DOMFloat32Array* values);
+ void vertexAttrib1fv(GLuint index,
+ const MaybeShared<const DOMFloat32Array>& values);
void vertexAttrib1fv(GLuint index, const Vector<GLfloat>& values);
void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void vertexAttrib2fv(GLuint index, const DOMFloat32Array* values);
+ void vertexAttrib2fv(GLuint index,
+ const MaybeShared<const DOMFloat32Array>& values);
void vertexAttrib2fv(GLuint index, const Vector<GLfloat>& values);
void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void vertexAttrib3fv(GLuint index, const DOMFloat32Array* values);
+ void vertexAttrib3fv(GLuint index,
+ const MaybeShared<const DOMFloat32Array>& values);
void vertexAttrib3fv(GLuint index, const Vector<GLfloat>& values);
void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void vertexAttrib4fv(GLuint index, const DOMFloat32Array* values);
+ void vertexAttrib4fv(GLuint index,
+ const MaybeShared<const DOMFloat32Array>& values);
void vertexAttrib4fv(GLuint index, const Vector<GLfloat>& values);
void vertexAttribPointer(GLuint index,
GLint size,
@@ -1358,7 +1363,7 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
bool validateUniformMatrixParameters(const char* functionName,
const WebGLUniformLocation*,
GLboolean transpose,
- DOMFloat32Array*,
+ const MaybeShared<DOMFloat32Array>&,
GLsizei mod,
GLuint srcOffset,
GLuint srcLength);
@@ -1388,6 +1393,18 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext,
requiredMinSize, srcOffset, srcLength);
}
+ template <typename TypedArray>
+ bool validateNotSharedArrayBuffer(const char* functionName,
+ const MaybeShared<TypedArray>& v) {
+ // TODO(binji): Disallow for now.
+ if (v.isShared()) {
+ synthesizeGLError(GL_INVALID_VALUE, functionName,
+ "array is backed by SharedArrayBuffer.");
+ return false;
+ }
+ return true;
+ }
+
// Helper function to validate the target for bufferData and
// getBufferParameter.
virtual bool validateBufferTarget(const char* functionName, GLenum target);

Powered by Google App Engine
This is Rietveld 408576698