14c5b0ae67
Scopes in V8 are used to guarantee one or more properties during its lifetimes. If a scope is not named e.g MyClassScope(args) instead of MyClassScope scope(args) it will get created and automatically destroyed and therefore, being useless as a scope. This CL would produce a compiling warning when that happens to ward off this developer error. Follow-up to ccrev.com/2552415 in which it was introduced and implemented for Guard classes. Change-Id: Ifa0fb89cc3d9bdcdee0fd8150a2618af5ef45cbf Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555001 Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#71425}
48 lines
1.2 KiB
C++
48 lines
1.2 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.
|
|
|
|
#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);
|
|
|
|
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_
|