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

Unified Diff: Source/core/dom/DOMTypedArray.cpp

Issue 1179373004: Add DOMSharedArrayBuffer type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: merge master Created 5 years, 5 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
« no previous file with comments | « Source/core/dom/DOMTypedArray.h ('k') | Source/core/dom/SharedArrayBuffer.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMTypedArray.cpp
diff --git a/Source/core/dom/DOMTypedArray.cpp b/Source/core/dom/DOMTypedArray.cpp
index e969a3ac90129eeaf320276d672a4d7e891fe41d..28487305f6628c6ae257140b092801d5eb9e7799 100644
--- a/Source/core/dom/DOMTypedArray.cpp
+++ b/Source/core/dom/DOMTypedArray.cpp
@@ -31,13 +31,19 @@ v8::Local<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::wrap(v8::Isola
ASSERT(!DOMDataStore::containsWrapper(this, isolate));
const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
- RefPtr<DOMArrayBuffer> buffer = this->buffer();
+ RefPtr<DOMArrayBufferBase> buffer = this->bufferBase();
v8::Local<v8::Value> v8Buffer = toV8(buffer.get(), creationContext, isolate);
if (v8Buffer.IsEmpty())
- return v8::Handle<v8::Object>();
- ASSERT(v8Buffer->IsArrayBuffer());
+ return v8::Local<v8::Object>();
+ ASSERT(isShared() == v8Buffer->IsSharedArrayBuffer());
+
+ v8::Local<v8::Object> wrapper;
+ if (isShared()) {
+ wrapper = V8TypedArray::New(v8Buffer.As<v8::SharedArrayBuffer>(), byteOffset(), length());
+ } else {
+ wrapper = V8TypedArray::New(v8Buffer.As<v8::ArrayBuffer>(), byteOffset(), length());
+ }
- v8::Local<v8::Object> wrapper = V8TypedArray::New(v8Buffer.As<v8::ArrayBuffer>(), byteOffset(), length());
// V8TypedArray::New may run an arbitrary script and it may result in
// creating a new wrapper and associating it with |this|. If so, the
// wrapper already created and associated must be used.
« no previous file with comments | « Source/core/dom/DOMTypedArray.h ('k') | Source/core/dom/SharedArrayBuffer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698