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

Unified Diff: src/runtime.cc

Issue 15855012: Change ArrayBuffer API and implementation to use embedder-provided allocator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback 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 | « src/d8.cc ('k') | src/v8.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 074d8dc59ddf6d12569904bcf9bc4ca227ee724f..a1f465f400c552f1d9e1209c28f8739b8eb2bb8e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -663,7 +663,8 @@ static void ArrayBufferWeakCallback(v8::Isolate* external_isolate,
isolate, array_buffer->byte_length());
isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
-static_cast<intptr_t>(allocated_length));
- free(data);
+ CHECK(V8::ArrayBufferAllocator() != NULL);
+ V8::ArrayBufferAllocator()->Free(data);
}
object->Dispose(external_isolate);
}
@@ -699,8 +700,9 @@ bool Runtime::SetupArrayBufferAllocatingData(
Handle<JSArrayBuffer> array_buffer,
size_t allocated_length) {
void* data;
+ CHECK(V8::ArrayBufferAllocator() != NULL);
if (allocated_length != 0) {
- data = malloc(allocated_length);
+ data = V8::ArrayBufferAllocator()->Allocate(allocated_length);
if (data == NULL) return false;
memset(data, 0, allocated_length);
} else {
« no previous file with comments | « src/d8.cc ('k') | src/v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698