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

Unified Diff: include/v8.h

Issue 13958007: First cut at API for ES6 ArrayBuffers (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 7 years, 8 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 | « no previous file | src/api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 8efb7c33c532f714277680ab503f4025fe233d80..f7eb10b54c5881d79aeecbd94cd5b088f2131545 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1971,6 +1971,43 @@ class V8EXPORT Function : public Object {
/**
+ * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
+ * This API is experimental and may change significantly.
+ */
+class V8EXPORT ArrayBuffer : public Object {
+ public:
+ /**
+ * Data length in bytes.
+ */
+ size_t ByteLength() const;
+ /**
+ * Raw pointer to the array buffer data
+ */
+ void* Data() const;
+
+ /**
+ * Create a new ArrayBuffer. Allocate |byte_length| bytes.
+ * Allocated memory will be owned by a created ArrayBuffer and
+ * will be deallocated when it is garbage-collected.
+ */
+ static Local<ArrayBuffer> New(size_t byte_length);
+
+ /**
+ * Create a new ArrayBuffer over an existing memory block.
+ * The memory block will not be reclaimed when a created ArrayBuffer
+ * is garbage-collected.
+ */
+ static Local<ArrayBuffer> New(void* data, size_t byte_length);
+
+ V8_INLINE(static ArrayBuffer* Cast(Value* obj));
+
+ private:
+ ArrayBuffer();
+ static void CheckCast(Value* obj);
+};
+
+
+/**
* An instance of the built-in Date constructor (ECMA-262, 15.9).
*/
class V8EXPORT Date : public Object {
@@ -4429,7 +4466,7 @@ class Internals {
static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
static const int kContextHeaderSize = 2 * kApiPointerSize;
- static const int kContextEmbedderDataIndex = 55;
+ static const int kContextEmbedderDataIndex = 56;
static const int kFullStringRepresentationMask = 0x07;
static const int kStringEncodingMask = 0x4;
static const int kExternalTwoByteRepresentationTag = 0x02;
@@ -5102,6 +5139,14 @@ Array* Array::Cast(v8::Value* value) {
}
+ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<ArrayBuffer*>(value);
+}
+
+
Function* Function::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
« no previous file with comments | « no previous file | src/api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698