340c545875
Introduce HeapBase as an internal base implementation for concrete heaps (unified, stand-alone). Change-Id: I0aa7185e23f83e01e4e2ca23d983b28e32bb610e Bug: chromium:1056170 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2238573 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/master@{#68338}
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "test/unittests/heap/cppgc/tests.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "src/heap/cppgc/object-allocator.h"
|
|
#include "test/unittests/heap/cppgc/test-platform.h"
|
|
|
|
namespace cppgc {
|
|
namespace internal {
|
|
namespace testing {
|
|
|
|
// static
|
|
std::shared_ptr<TestPlatform> TestWithPlatform::platform_;
|
|
|
|
// static
|
|
void TestWithPlatform::SetUpTestSuite() {
|
|
platform_ = std::make_unique<TestPlatform>();
|
|
cppgc::InitializeProcess(platform_->GetPageAllocator());
|
|
}
|
|
|
|
// static
|
|
void TestWithPlatform::TearDownTestSuite() {
|
|
cppgc::ShutdownProcess();
|
|
platform_.reset();
|
|
}
|
|
|
|
TestWithHeap::TestWithHeap()
|
|
: heap_(Heap::Create(platform_)),
|
|
allocation_handle_(heap_->GetAllocationHandle()) {}
|
|
|
|
void TestWithHeap::ResetLinearAllocationBuffers() {
|
|
Heap::From(GetHeap())->object_allocator().ResetLinearAllocationBuffers();
|
|
}
|
|
|
|
TestSupportingAllocationOnly::TestSupportingAllocationOnly()
|
|
: no_gc_scope_(*internal::Heap::From(GetHeap())) {}
|
|
|
|
} // namespace testing
|
|
} // namespace internal
|
|
} // namespace cppgc
|