mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-28 01:20:58 +01:00
meso: use macro to refactor auto obj declaration
This commit is contained in:
parent
86c43331eb
commit
eb7e4153d1
@ -12,47 +12,29 @@ virtual ushort GetClassToken() const\
|
|||||||
return KAutoObject::GenerateClassToken<K##DerivedId >();\
|
return KAutoObject::GenerateClassToken<K##DerivedId >();\
|
||||||
}\
|
}\
|
||||||
|
|
||||||
|
#define MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseId)\
|
||||||
|
class K##BaseId;\
|
||||||
|
void intrusive_ptr_add_ref(K##BaseId *obj);\
|
||||||
|
void intrusive_ptr_release(K##BaseId *obj);
|
||||||
|
|
||||||
|
|
||||||
|
#define MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseId)\
|
||||||
|
inline void intrusive_ptr_add_ref(K##BaseId *obj) { intrusive_ptr_add_ref((KAutoObject *)obj); }\
|
||||||
|
inline void intrusive_ptr_release(K##BaseId *obj) { intrusive_ptr_release((KAutoObject *)obj); }
|
||||||
|
|
||||||
namespace mesosphere
|
namespace mesosphere
|
||||||
{
|
{
|
||||||
|
|
||||||
// Foward declarations for intrusive_ptr
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(Process);
|
||||||
class KProcess;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(ResourceLimit);
|
||||||
class KResourceLimit;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(Thread);
|
||||||
class KThread;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(Event);
|
||||||
class KEvent;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(ReadableEvent);
|
||||||
class KReadableEvent;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(WritableEvent);
|
||||||
class KWritableEvent;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(InterruptEvent);
|
||||||
class KInterruptEvent;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseSession);
|
||||||
class KBaseSession;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseClientSession);
|
||||||
class KBaseClientSession;
|
MESOSPHERE_AUTO_OBJECT_FW_DECL(BaseServerSession);
|
||||||
class KBaseServerSession;
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KProcess *obj);
|
|
||||||
void intrusive_ptr_release(KProcess *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KResourceLimit *obj);
|
|
||||||
void intrusive_ptr_release(KResourceLimit *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KEvent *obj);
|
|
||||||
void intrusive_ptr_release(KEvent *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KReadableEvent *obj);
|
|
||||||
void intrusive_ptr_release(KReadableEvent *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KWritableEvent *obj);
|
|
||||||
void intrusive_ptr_release(KWritableEvent *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KInterruptEvent *obj);
|
|
||||||
void intrusive_ptr_release(KInterruptEvent *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KBaseSession *obj);
|
|
||||||
void intrusive_ptr_release(KBaseSession *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KBaseClientSession *obj);
|
|
||||||
void intrusive_ptr_release(KBaseClientSession *obj);
|
|
||||||
|
|
||||||
void intrusive_ptr_add_ref(KBaseClientSession *obj);
|
|
||||||
void intrusive_ptr_release(KBaseServerSession *obj);
|
|
||||||
|
|
||||||
class KAutoObject {
|
class KAutoObject {
|
||||||
public:
|
public:
|
||||||
|
@ -23,4 +23,6 @@ class KSynchronizationObject : public KAutoObject {
|
|||||||
KLinkedList<KThread *> waiters{};
|
KLinkedList<KThread *> waiters{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(SynchronizationObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,7 @@
|
|||||||
namespace mesosphere
|
namespace mesosphere
|
||||||
{
|
{
|
||||||
|
|
||||||
class KThread;
|
|
||||||
class KEvent;
|
|
||||||
class KTransferMemory;
|
class KTransferMemory;
|
||||||
class KSession;
|
|
||||||
|
|
||||||
class KResourceLimit final :
|
class KResourceLimit final :
|
||||||
public KAutoObject,
|
public KAutoObject,
|
||||||
@ -71,13 +68,6 @@ class KResourceLimit final :
|
|||||||
mutable KConditionVariable condvar{};
|
mutable KConditionVariable condvar{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KResourceLimit *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ResourceLimit);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KResourceLimit *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,6 @@ class KBaseClientSession : public KAutoObject, public IClient<KBaseSession, KBas
|
|||||||
KClientPort *parentPort = nullptr;
|
KClientPort *parentPort = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KBaseClientSession *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseClientSession);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KBaseClientSession *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,6 @@ class KBaseServerSession :
|
|||||||
KBaseServerSession() = default;
|
KBaseServerSession() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KBaseServerSession *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseServerSession);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KBaseServerSession *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,6 @@ class KBaseSession : public KAutoObject, public IClientServerParent<KBaseSession
|
|||||||
KBaseSession() = default;
|
KBaseSession() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KBaseSession *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(BaseSession);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KBaseSession *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,6 @@ class KEvent final :
|
|||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KEvent *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(Event);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KEvent *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,14 +33,6 @@ class KProcess final : public KAutoObject {
|
|||||||
KHandleTable handleTable{};
|
KHandleTable handleTable{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KProcess *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(Process);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KProcess *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,6 @@ class KReadableEvent : public KSynchronizationObject, public IClient<KEvent, KRe
|
|||||||
bool isSignaled = false;
|
bool isSignaled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KReadableEvent *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(ReadableEvent);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KReadableEvent *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,14 +28,6 @@ class KWritableEvent final : public KAutoObject, public IServer<KEvent, KReadabl
|
|||||||
SharedPtr<KReadableEvent> client{};
|
SharedPtr<KReadableEvent> client{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KWritableEvent *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(WritableEvent);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KWritableEvent *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -309,14 +309,6 @@ private:
|
|||||||
u64 lastScheduledTime = 0;
|
u64 lastScheduledTime = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void intrusive_ptr_add_ref(KThread *obj)
|
MESOSPHERE_AUTO_OBJECT_DEFINE_INCREF(Thread);
|
||||||
{
|
|
||||||
intrusive_ptr_add_ref((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void intrusive_ptr_release(KThread *obj)
|
|
||||||
{
|
|
||||||
intrusive_ptr_release((KAutoObject *)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user