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

Unified Diff: Source/core/dom/DOMArrayBufferBase.h

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/DOMArrayBuffer.cpp ('k') | Source/core/dom/DOMArrayBufferView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMArrayBufferBase.h
diff --git a/Source/core/dom/DOMArrayBufferBase.h b/Source/core/dom/DOMArrayBufferBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..65a768046d76d5516bedc6bf290d57587a7488f1
--- /dev/null
+++ b/Source/core/dom/DOMArrayBufferBase.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DOMArrayBufferBase_h
+#define DOMArrayBufferBase_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/CoreExport.h"
+#include "wtf/ArrayBuffer.h"
+#include "wtf/RefCounted.h"
+
+namespace blink {
+
+class CORE_EXPORT DOMArrayBufferBase : public RefCounted<DOMArrayBufferBase>, public ScriptWrappable {
+public:
+ virtual ~DOMArrayBufferBase() { }
+
+ const WTF::ArrayBuffer* buffer() const { return m_buffer.get(); }
+ WTF::ArrayBuffer* buffer() { return m_buffer.get(); }
+
+ const void* data() const { return buffer()->data(); }
+ void* data() { return buffer()->data(); }
+ unsigned byteLength() const { return buffer()->byteLength(); }
+ bool transfer(WTF::ArrayBufferContents& result) { return buffer()->transfer(result); }
+ bool isNeutered() const { return buffer()->isNeutered(); }
+ bool isShared() const { return buffer()->isShared(); }
+
+ v8::Local<v8::Object> wrap(v8::Isolate*, v8::Local<v8::Object> creationContext) override
+ {
+ ASSERT_NOT_REACHED();
+ return v8::Local<v8::Object>();
+ }
+
+ v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeInfo*, v8::Local<v8::Object> wrapper) override
+ {
+ ASSERT_NOT_REACHED();
+ return v8::Local<v8::Object>();
+ }
+
+protected:
+ explicit DOMArrayBufferBase(PassRefPtr<WTF::ArrayBuffer> buffer)
+ : m_buffer(buffer)
+ {
+ ASSERT(m_buffer);
+ }
+
+ RefPtr<WTF::ArrayBuffer> m_buffer;
+};
+
+} // namespace blink
+
+#endif // DOMArrayBuffer_h
+
« no previous file with comments | « Source/core/dom/DOMArrayBuffer.cpp ('k') | Source/core/dom/DOMArrayBufferView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698