enhance factory method of luajit::Context
This commit is contained in:
parent
b279b02327
commit
117b117dfa
@ -159,7 +159,7 @@ class AsyncContext final :
|
|||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::shared_ptr<Context> Context::Create(Env& env, Kind kind) {
|
std::shared_ptr<Context> Context::Make(Env& env, Kind kind) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case kSync:
|
case kSync:
|
||||||
return std::make_shared<SyncContext>(env);
|
return std::make_shared<SyncContext>(env);
|
||||||
|
@ -147,7 +147,13 @@ class Context :
|
|||||||
kSync,
|
kSync,
|
||||||
kAsync,
|
kAsync,
|
||||||
};
|
};
|
||||||
static std::shared_ptr<Context> Create(Env&, Kind);
|
static std::shared_ptr<Context> Make(Env&, Kind);
|
||||||
|
static std::shared_ptr<Context> MakeAsync(Env& env) {
|
||||||
|
return Make(env, kAsync);
|
||||||
|
}
|
||||||
|
static std::shared_ptr<Context> MakeSync(Env& env) {
|
||||||
|
return Make(env, kSync);
|
||||||
|
}
|
||||||
|
|
||||||
explicit Context(const char* name, Kind kind)
|
explicit Context(const char* name, Kind kind)
|
||||||
: subsys::Interface(name), kind_(kind), state_(nullptr) {
|
: subsys::Interface(name), kind_(kind), state_(nullptr) {
|
||||||
|
@ -30,7 +30,7 @@ class ContextFixture :
|
|||||||
: EnvFixtureWithTasking({
|
: EnvFixtureWithTasking({
|
||||||
{
|
{
|
||||||
typeid(Context), [](auto& env) {
|
typeid(Context), [](auto& env) {
|
||||||
return Context::Create(env, GetParam());
|
return Context::Make(env, GetParam());
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}) { }
|
}) { }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user