summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/cctest/node_test_fixture.h20
1 files changed, 3 insertions, 17 deletions
diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h
index 890fe90499..bbc46986eb 100644
--- a/test/cctest/node_test_fixture.h
+++ b/test/cctest/node_test_fixture.h
@@ -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"}) {}
@@ -77,7 +62,6 @@ class NodeTestFixture : public ::testing::Test {
protected:
v8::Isolate::CreateParams params_;
- ArrayBufferAllocator allocator_;
v8::Isolate* isolate_;
~NodeTestFixture() {
@@ -89,7 +73,7 @@ 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 = allocator_.get();
isolate_ = v8::Isolate::New(params_);
}
@@ -107,6 +91,8 @@ class NodeTestFixture : public ::testing::Test {
private:
node::NodePlatform* platform_ = nullptr;
+ std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_{
+ v8::ArrayBuffer::Allocator::NewDefaultAllocator()};
};
#endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_