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

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

Issue 1179373004: Add DOMSharedArrayBuffer type (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
« no previous file with comments | « Source/core/dom/DOMSharedArrayBuffer.h ('k') | Source/core/dom/DOMTypedArray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMSharedArrayBuffer.cpp
diff --git a/Source/core/dom/DOMSharedArrayBuffer.cpp b/Source/core/dom/DOMSharedArrayBuffer.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..95c6366ee308ee6ab397110b3866122c16a2783f
--- /dev/null
+++ b/Source/core/dom/DOMSharedArrayBuffer.cpp
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
haraken 2015/07/01 00:16:08 2015
binji 2015/07/01 16:25:51 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/dom/DOMSharedArrayBuffer.h"
+
+#include "bindings/core/v8/DOMDataStore.h"
+#include "bindings/core/v8/V8DOMWrapper.h"
+
+namespace blink {
+
+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<DOMSharedArrayBuffer> protect(this);
+
+ ASSERT(!DOMDataStore::containsWrapper(this, isolate));
+
+ const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
+ v8::Local<v8::Object> wrapper = v8::SharedArrayBuffer::New(isolate, data(), byteLength());
haraken 2015/07/01 00:16:09 We added more code here yesterday. See DOMArrayBuf
binji 2015/07/01 16:25:51 Done.
+
+ return associateWithWrapper(isolate, wrapperTypeInfo, wrapper);
+}
+
+v8::Local<v8::Object> DOMSharedArrayBuffer::associateWithWrapper(v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Object> wrapper)
+{
+ return V8DOMWrapper::associateObjectWithWrapper(isolate, this, wrapperTypeInfo, wrapper);
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/dom/DOMSharedArrayBuffer.h ('k') | Source/core/dom/DOMTypedArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698