v8/test/unittests/heap/cppgc/test-platform.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.2 KiB
C
Raw Normal View History

// 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.
#ifndef V8_UNITTESTS_HEAP_CPPGC_TEST_PLATFORM_H_
#define V8_UNITTESTS_HEAP_CPPGC_TEST_PLATFORM_H_
#include "include/cppgc/default-platform.h"
#include "src/base/compiler-specific.h"
namespace cppgc {
namespace internal {
namespace testing {
class TestPlatform : public DefaultPlatform {
public:
class V8_NODISCARD DisableBackgroundTasksScope {
public:
explicit DisableBackgroundTasksScope(TestPlatform*);
~DisableBackgroundTasksScope() V8_NOEXCEPT;
private:
TestPlatform* platform_;
};
TestPlatform(
std::unique_ptr<v8::TracingController> tracing_controller = nullptr);
Reland "cppgc: Provide jobs support through DefaultPlatform and TestPlatform" This reverts commit 2221f0909b4aff18a6dc51f694d877122001aed0. Reason for revert: fix in patchset 2 Original change's description: > Revert "cppgc: Provide jobs support through DefaultPlatform and TestPlatform" > > This reverts commit 22c0fc8f2ed93e911351b652674c488c02454f3d. > > Reason for revert: https://ci.chromium.org/p/v8/builders/ci/V8%20Linux%20gcc/8712? > > Original change's description: > > cppgc: Provide jobs support through DefaultPlatform and TestPlatform > > > > This CL extends cppgc::DefaultPlatform and TestPlatform to emulate > > jobs using std::thread and v8::base::Thread respectively. > > Jobs using these platform do not yield unless the job as been > > cancelled. Additionally, the job priority is ignored. > > > > Bug: chromium:1056170 > > Change-Id: I72db1eef410d2be3d3e5ea7d4ece9e5584a451f2 > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2416378 > > Commit-Queue: Omer Katz <omerkatz@chromium.org> > > Reviewed-by: Anton Bikineev <bikineev@chromium.org> > > Reviewed-by: Michael Lippautz <mlippautz@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#70139} > > TBR=mlippautz@chromium.org,bikineev@chromium.org,omerkatz@chromium.org > > Change-Id: Ic29235e3ab78a1b515a5b14b808e116a1ccffc0f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: chromium:1056170 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2432087 > Reviewed-by: Francis McCabe <fgm@chromium.org> > Commit-Queue: Francis McCabe <fgm@chromium.org> > Cr-Commit-Position: refs/heads/master@{#70142} # Not skipping CQ checks because this is a reland. Bug: chromium:1056170 Change-Id: Iaa8312da759ab97f646a9fb6144462a115393b5f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2431666 Reviewed-by: Anton Bikineev <bikineev@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Omer Katz <omerkatz@chromium.org> Cr-Commit-Position: refs/heads/master@{#70150}
2020-09-25 18:04:34 +00:00
std::unique_ptr<cppgc::JobHandle> PostJob(
cppgc::TaskPriority priority,
std::unique_ptr<cppgc::JobTask> job_task) final;
void RunAllForegroundTasks();
private:
bool AreBackgroundTasksDisabled() const {
return disabled_background_tasks_ > 0;
}
size_t disabled_background_tasks_ = 0;
};
} // namespace testing
} // namespace internal
} // namespace cppgc
#endif // V8_UNITTESTS_HEAP_CPPGC_TEST_PLATFORM_H_