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

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

Issue 1097773004: Sharing of SharedArrayBuffer via PostMessage transfer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: . Created 5 years, 6 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: Source/core/dom/DOMSharedArrayBuffer.cpp
diff --git a/Source/core/dom/DOMArrayBuffer.cpp b/Source/core/dom/DOMSharedArrayBuffer.cpp
similarity index 70%
copy from Source/core/dom/DOMArrayBuffer.cpp
copy to Source/core/dom/DOMSharedArrayBuffer.cpp
index 41fdae243981748fd6fc8390497f5bd824fe493a..419d76e6e6b32da62be592dade0646eb707d9ecb 100644
--- a/Source/core/dom/DOMArrayBuffer.cpp
+++ b/Source/core/dom/DOMSharedArrayBuffer.cpp
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "config.h"
-#include "core/dom/DOMArrayBuffer.h"
+#include "core/dom/DOMSharedArrayBuffer.h"
#include "bindings/core/v8/DOMDataStore.h"
#include "bindings/core/v8/V8DOMWrapper.h"
@@ -11,28 +11,29 @@
namespace blink {
-v8::Local<v8::Object> DOMArrayBuffer::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
+v8::Local<v8::Object> DOMSharedArrayBuffer::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
{
// It's possible that no one except for the new wrapper owns this object at
// this moment, so we have to prevent GC to collect this object until the
// object gets associated with the wrapper.
- RefPtr<DOMArrayBuffer> protect(this);
+ RefPtr<DOMSharedArrayBuffer> protect(this);
ASSERT(!DOMDataStore::containsWrapper(this, isolate));
const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
- v8::Local<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, data(), byteLength());
+ v8::Local<v8::Object> wrapper = v8::SharedArrayBuffer::New(isolate, data(), byteLength());
// Only when we create a new wrapper, let V8 know that we allocated and
// associated a new memory block with the wrapper. Note that
// setDeallocationObserver implicitly calls
// DOMArrayBufferDeallocationObserver::blinkAllocatedMemory.
+ // TODO(binji): Should this be a different observer? Perhaps we want to track shared memory separately.
haraken 2015/06/11 05:59:29 Help me understand: Can the shared buffer be share
buffer()->setDeallocationObserver(DOMArrayBufferDeallocationObserver::instance());
return associateWithWrapper(isolate, wrapperTypeInfo, wrapper);
}
-v8::Local<v8::Object> DOMArrayBuffer::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper)
+v8::Local<v8::Object> DOMSharedArrayBuffer::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper)
{
// This function does not set a deallocation observer to the underlying
// array buffer. It's a caller's duty.

Powered by Google App Engine
This is Rietveld 408576698