| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1e34a0e commit ca81d4b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,21 +9,6 @@ | |||
| 9 | 9 | #include "v8.h" | |
| 10 | 10 | #include "libplatform/libplatform.h" | |
| 11 | 11 | ||
| 12 | - class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | ||
| 13 | - public: | ||
| 14 | - virtual void* Allocate(size_t length) { | ||
| 15 | - return AllocateUninitialized(length); | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - virtual void* AllocateUninitialized(size_t length) { | ||
| 19 | - return calloc(length, 1); | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - virtual void Free(void* data, size_t) { | ||
| 23 | - free(data); | ||
| 24 | - } | ||
| 25 | - }; | ||
| 26 | - | ||
| 27 | 12 | struct Argv { | |
| 28 | 13 | public: | |
| 29 | 14 | Argv() : Argv({"node", "-p", "process.version"}) {} | |
@@ -77,7 +62,6 @@ class NodeTestFixture : public ::testing::Test { | |||
| 77 | 62 | ||
| 78 | 63 | protected: | |
| 79 | 64 | v8::Isolate::CreateParams params_; | |
| 80 | - ArrayBufferAllocator allocator_; | ||
| 81 | 65 | v8::Isolate* isolate_; | |
| 82 | 66 | ||
| 83 | 67 | ~NodeTestFixture() { | |
@@ -89,7 +73,7 @@ class NodeTestFixture : public ::testing::Test { | |||
| 89 | 73 | platform_ = new node::NodePlatform(8, nullptr); | |
| 90 | 74 | v8::V8::InitializePlatform(platform_); | |
| 91 | 75 | v8::V8::Initialize(); | |
| 92 | - params_.array_buffer_allocator = &allocator_; | ||
| 76 | + params_.array_buffer_allocator = allocator_.get(); | ||
| 93 | 77 | isolate_ = v8::Isolate::New(params_); | |
| 94 | 78 | } | |
| 95 | 79 | ||
@@ -107,6 +91,8 @@ class NodeTestFixture : public ::testing::Test { | |||
| 107 | 91 | ||
| 108 | 92 | private: | |
| 109 | 93 | node::NodePlatform* platform_ = nullptr; | |
| 94 | + std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_{ | ||
| 95 | + v8::ArrayBuffer::Allocator::NewDefaultAllocator()}; | ||
| 110 | 96 | }; | |
| 111 | 97 | ||
| 112 | 98 | #endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments