Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@
#include "v8.h"
#include "libplatform/libplatform.h"

class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
public:
virtual void* Allocate(size_t length) {
return AllocateUninitialized(length);
}

virtual void* AllocateUninitialized(size_t length) {
return calloc(length, 1);
}

virtual void Free(void* data, size_t) {
free(data);
}
};

struct Argv {
public:
Argv() : Argv({"node", "-p", "process.version"}) {}
Expand Down Expand Up @@ -77,7 +62,6 @@ class NodeTestFixture : public ::testing::Test {

protected:
v8::Isolate::CreateParams params_;
ArrayBufferAllocator allocator_;
v8::Isolate* isolate_;

~NodeTestFixture() {
Expand All @@ -89,7 +73,8 @@ class NodeTestFixture : public ::testing::Test {
platform_ = new node::NodePlatform(8, nullptr);
v8::V8::InitializePlatform(platform_);
v8::V8::Initialize();
params_.array_buffer_allocator = &allocator_;
params_.array_buffer_allocator =
v8::ArrayBuffer::Allocator::NewDefaultAllocator();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure it matters, but should we free the allocator instance at some point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll take a look and see. Thanks

isolate_ = v8::Isolate::New(params_);
}

Expand Down