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

Unified Diff: third_party/WebKit/Source/core/html/ImageData.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/core/html/ImageData.h
diff --git a/third_party/WebKit/Source/core/html/ImageData.h b/third_party/WebKit/Source/core/html/ImageData.h
index 246a4cf85b0998060150d1977261f9bc0692c9b4..134ddd3f96fcb74c9c49043a0d605be3d707b9df 100644
--- a/third_party/WebKit/Source/core/html/ImageData.h
+++ b/third_party/WebKit/Source/core/html/ImageData.h
@@ -33,6 +33,7 @@
#include "core/CoreExport.h"
#include "core/dom/DOMArrayBufferView.h"
#include "core/dom/DOMTypedArray.h"
+#include "core/dom/MaybeShared.h"
#include "core/imagebitmap/ImageBitmapSource.h"
#include "platform/geometry/IntRect.h"
#include "platform/geometry/IntSize.h"
@@ -77,15 +78,16 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
public:
static ImageData* create(const IntSize&);
- static ImageData* create(const IntSize&, DOMUint8ClampedArray*);
static ImageData* create(const IntSize&,
- DOMUint8ClampedArray*,
+ const MaybeShared<DOMUint8ClampedArray>&);
+ static ImageData* create(const IntSize&,
+ const MaybeShared<DOMUint8ClampedArray>&,
const String&);
static ImageData* create(unsigned width, unsigned height, ExceptionState&);
- static ImageData* create(DOMUint8ClampedArray*,
+ static ImageData* create(const MaybeShared<DOMUint8ClampedArray>&,
unsigned width,
ExceptionState&);
- static ImageData* create(DOMUint8ClampedArray*,
+ static ImageData* create(const MaybeShared<DOMUint8ClampedArray>&,
unsigned width,
unsigned height,
ExceptionState&);
@@ -96,11 +98,11 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
unsigned height,
String colorSpace,
ExceptionState&);
- ImageData* createImageData(DOMUint8ClampedArray*,
+ ImageData* createImageData(const MaybeShared<DOMUint8ClampedArray>&,
unsigned width,
String colorSpace,
ExceptionState&);
- ImageData* createImageData(DOMUint8ClampedArray*,
+ ImageData* createImageData(const MaybeShared<DOMUint8ClampedArray>&,
unsigned width,
unsigned height,
String colorSpace,
@@ -146,6 +148,19 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
ExceptionState* = nullptr,
ImageDataType = kUint8ClampedImageData);
+ template <typename T>
+ static bool validateDataArgumentIsNotShared(const MaybeShared<T>& maybeShared,
+ ExceptionState* exceptionState) {
+ if (maybeShared.isShared()) {
+ if (exceptionState) {
+ exceptionState->throwTypeError(
+ "The data is backed by a SharedArrayBuffer.");
+ }
+ return false;
+ }
+ return true;
+ }
+
private:
ImageData(const IntSize&,
DOMUint8ClampedArray*,

Powered by Google App Engine
This is Rietveld 408576698