3d53d7acad
Split platform into a process-global initialization part and per-heap platform objects. These platform objects still contain allocators and executors. With per-heap platforms GetForegroundTaskRunner() returns by definition the correct runner. In future, when initialized throuhg V8, an adapter can be used to translate between the different platforms, avoiding the needed for V8 embedders to provide additional information. Bug: chromium:1056170 Change-Id: I11bdd15e945687cfbdf38cae4137facb02559e0a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2218030 Commit-Queue: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/master@{#68059}
38 lines
940 B
C++
38 lines
940 B
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 "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_)) {}
|
|
|
|
TestSupportingAllocationOnly::TestSupportingAllocationOnly()
|
|
: no_gc_scope_(internal::Heap::From(GetHeap())) {}
|
|
|
|
} // namespace testing
|
|
} // namespace internal
|
|
} // namespace cppgc
|