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

Unified Diff: include/v8.h

Issue 1111413006: Version 4.3.61.17 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.3
Patch Set: Created 5 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 | include/v8-version.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 0c320fb64c682c28827b8bab0dda2e335fe6a37b..19de92fa8c45b0d0d8146e8c6d81dfd0066301ea 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3294,6 +3294,10 @@ class V8_EXPORT Promise : public Object {
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
#endif
+
+enum class ArrayBufferCreationMode { kInternalized, kExternalized };
+
+
/**
* An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
* This API is experimental and may change significantly.
@@ -3369,12 +3373,13 @@ class V8_EXPORT ArrayBuffer : public Object {
/**
* Create a new ArrayBuffer over an existing memory block.
- * The created array buffer is immediately in externalized state.
+ * The created array buffer is by default immediately in externalized state.
* The memory block will not be reclaimed when a created ArrayBuffer
* is garbage-collected.
*/
- static Local<ArrayBuffer> New(Isolate* isolate, void* data,
- size_t byte_length);
+ static Local<ArrayBuffer> New(
+ Isolate* isolate, void* data, size_t byte_length,
+ ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
/**
* Returns true if ArrayBuffer is extrenalized, that is, does not
@@ -3406,6 +3411,18 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
Contents Externalize();
+ /**
+ * Get a pointer to the ArrayBuffer's underlying memory block without
+ * externalizing it. If the ArrayBuffer is not externalized, this pointer
+ * will become invalid as soon as the ArrayBuffer became garbage collected.
+ *
+ * The embedder should make sure to hold a strong reference to the
+ * ArrayBuffer while accessing this pointer.
+ *
+ * The memory block is guaranteed to be allocated with |Allocator::Allocate|.
+ */
+ Contents GetContents();
+
V8_INLINE static ArrayBuffer* Cast(Value* obj);
static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
« no previous file with comments | « no previous file | include/v8-version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698