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

Unified Diff: src/api.cc

Issue 16562005: Neutering API for v8::ArrayBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Style Created 7 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 | « include/v8.h ('k') | src/objects.h » ('j') | test/cctest/test-api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « include/v8.h ('k') | src/objects.h » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698