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

Unified Diff: third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h

Issue 2617073002: Additional DCHECKs when accessing SharedArrayBuffer (Closed)
Patch Set: Created 3 years, 11 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/wtf/typed_arrays/ArrayBuffer.h
diff --git a/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h b/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
index d3c061b41e047a5bc7d966f11e5d0186f5b58501..d9011cf552868091aa0cbec6f8fb5fee7d2a2680 100644
--- a/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
+++ b/third_party/WebKit/Source/wtf/typed_arrays/ArrayBuffer.h
@@ -63,6 +63,10 @@ class WTF_EXPORT ArrayBuffer : public RefCounted<ArrayBuffer> {
inline void* data();
inline const void* data() const;
+ inline void* dataShared();
+ inline const void* dataShared() const;
+ inline void* dataMaybeShared();
+ inline const void* dataMaybeShared() const;
inline unsigned byteLength() const;
// Creates a new ArrayBuffer object with copy of bytes in this object
@@ -140,7 +144,7 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::create(const void* source,
}
PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBufferContents& contents) {
- RELEASE_ASSERT(contents.data());
+ RELEASE_ASSERT(contents.dataMaybeShared());
return adoptRef(new ArrayBuffer(contents));
}
@@ -188,9 +192,9 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::createShared(const void* source,
unsigned byteLength) {
ArrayBufferContents contents(byteLength, 1, ArrayBufferContents::Shared,
ArrayBufferContents::DontInitialize);
- RELEASE_ASSERT(contents.data());
+ RELEASE_ASSERT(contents.dataShared());
RefPtr<ArrayBuffer> buffer = adoptRef(new ArrayBuffer(contents));
- memcpy(buffer->data(), source, byteLength);
+ memcpy(buffer->dataShared(), source, byteLength);
return buffer.release();
}
@@ -200,7 +204,7 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::createShared(
ArrayBufferContents::InitializationPolicy policy) {
ArrayBufferContents contents(numElements, elementByteSize,
ArrayBufferContents::Shared, policy);
- RELEASE_ASSERT(contents.data());
+ RELEASE_ASSERT(contents.dataShared());
return adoptRef(new ArrayBuffer(contents));
}
@@ -220,6 +224,22 @@ const void* ArrayBuffer::data() const {
return m_contents.data();
}
+void* ArrayBuffer::dataShared() {
+ return m_contents.dataShared();
+}
+
+const void* ArrayBuffer::dataShared() const {
+ return m_contents.dataShared();
+}
+
+void* ArrayBuffer::dataMaybeShared() {
+ return m_contents.dataMaybeShared();
+}
+
+const void* ArrayBuffer::dataMaybeShared() const {
+ return m_contents.dataMaybeShared();
+}
+
unsigned ArrayBuffer::byteLength() const {
return m_contents.sizeInBytes();
}

Powered by Google App Engine
This is Rietveld 408576698