add LeakDetector feature to luajit::Context, luajit::Thread, and nf7::Lambda

This commit is contained in:
2023-08-06 10:43:50 +09:00
parent 51b550ae26
commit 7a2774b09d
3 changed files with 11 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
// No copyright
#include "core/luajit/context.hh"
#include "iface/common/leak_detector.hh"
#include "iface/subsys/concurrency.hh"
#include "iface/subsys/parallelism.hh"
@@ -52,7 +53,9 @@ void TaskContext::Push(const nf7::Value& v) noexcept {
namespace {
template <typename T>
class ContextImpl final : public Context {
class ContextImpl final :
public Context,
private LeakDetector<ContextImpl<T>> {
public:
ContextImpl(const char* name, Kind kind, Env& env)
: Context(name, kind), tasq_(env.Get<T>()) {

View File

@@ -8,11 +8,15 @@
#include <lua.hpp>
#include "iface/common/leak_detector.hh"
#include "core/luajit/context.hh"
namespace nf7::core::luajit {
class Thread : public std::enable_shared_from_this<Thread> {
class Thread :
public std::enable_shared_from_this<Thread>,
private LeakDetector<Thread> {
public:
struct DoNotCallConstructorDirectly { };

View File

@@ -6,13 +6,14 @@
#include <vector>
#include "iface/common/dealer.hh"
#include "iface/common/leak_detector.hh"
#include "iface/common/exception.hh"
#include "iface/common/observer.hh"
#include "iface/common/value.hh"
namespace nf7 {
class Lambda {
class Lambda : private LeakDetector<Lambda> {
public:
Lambda() = delete;
Lambda(const std::shared_ptr<Taker<Value>>& taker,