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

Unified Diff: src/d8.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: 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
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 57e0c0424f3ddef31a6d517476c6005f61ea74e6..1d980a9841b1e921154a5e0082797c2d993ccf91 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -1571,6 +1571,13 @@ static void EnableHarmonyTypedArraysViaCommandLine() {
#endif
+class ShellArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
+ public:
+ virtual void* Allocate(size_t length) { return malloc(length); }
+ virtual void Free(void* data) { free(data); }
+};
+
+
int Shell::Main(int argc, char* argv[]) {
if (!SetOptions(argc, argv)) return 1;
#ifndef V8_SHARED
@@ -1579,6 +1586,8 @@ int Shell::Main(int argc, char* argv[]) {
#else
EnableHarmonyTypedArraysViaCommandLine();
#endif
+ static ShellArrayBufferAllocator array_buffer_allocator;
Sven Panne 2013/06/11 09:54:37 Why do we need "static"?
Dmitry Lomov (no reviews) 2013/06/11 10:40:09 Done.
+ v8::V8::SetArrayBufferAllocator(&array_buffer_allocator);
int result = 0;
Isolate* isolate = Isolate::GetCurrent();
DumbLineEditor dumb_line_editor(isolate);

Powered by Google App Engine
This is Rietveld 408576698