Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 920ca8724a95cfd1dcc745c87eab5d5244c1ea3c..ed1e26525aa9a75dfb1f0d3e1731020c607c179f 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -6112,6 +6112,25 @@ void v8::ArrayBuffer::Externalize(ArrayBufferContents* contents) { |
} |
+void v8::ArrayBuffer::Neuter() { |
+ i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); |
+ i::Isolate* isolate = obj->GetIsolate(); |
+ ApiCheck(obj->is_external(), |
+ "v8::ArrayBuffer::Neuter", |
+ "Only externalized ArrayBuffers can be neutered"); |
+ LOG_API(obj->GetIsolate(), "v8::ArrayBuffer::Neuter()"); |
+ ENTER_V8(isolate); |
+ |
+ for (i::Handle<i::Object> array_obj(obj->weak_first_array(), isolate); |
+ *array_obj != i::Smi::FromInt(0);) { |
+ i::Handle<i::JSTypedArray> typed_array(i::JSTypedArray::cast(*array_obj)); |
+ typed_array->Neuter(); |
+ array_obj = i::handle(typed_array->weak_next(), isolate); |
+ } |
+ obj->Neuter(); |
+} |
+ |
+ |
size_t v8::ArrayBuffer::ByteLength() const { |
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
if (IsDeadCheck(isolate, "v8::ArrayBuffer::ByteLength()")) return 0; |