1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:57:35 +00:00

LibCore: Put all classes in the Core namespace and remove the leading C

I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
This commit is contained in:
Andreas Kling 2020-02-02 12:34:39 +01:00
parent b7e3810b5c
commit 2d39da5405
265 changed files with 1380 additions and 1167 deletions

View file

@ -52,14 +52,14 @@ private:
};
template<typename Result>
class BackgroundAction final : public CObject
class BackgroundAction final : public Core::Object
, private BackgroundActionBase {
C_OBJECT(BackgroundAction);
public:
static NonnullRefPtr<BackgroundAction<Result>> create(
Function<Result()> action,
Function<void(Result)> on_complete = nullptr
)
Function<void(Result)> on_complete = nullptr)
{
return adopt(*new BackgroundAction(move(action), move(on_complete)));
}
@ -67,9 +67,8 @@ public:
virtual ~BackgroundAction() {}
private:
BackgroundAction(Function<Result()> action, Function<void(Result)> on_complete)
: CObject(&background_thread())
: Core::Object(&background_thread())
, m_action(move(action))
, m_on_complete(move(on_complete))
{
@ -79,11 +78,11 @@ private:
all_actions().resource().enqueue([this] {
m_result = m_action();
if (m_on_complete) {
CEventLoop::main().post_event(*this, make<CDeferredInvocationEvent>([this](CObject&) {
Core::EventLoop::main().post_event(*this, make<Core::DeferredInvocationEvent>([this](auto&) {
m_on_complete(m_result.release_value());
this->unref();
}));
CEventLoop::main().wake();
Core::EventLoop::main().wake();
} else
this->unref();
});

View file

@ -29,7 +29,7 @@
#include <unistd.h>
LibThread::Thread::Thread(Function<int()> action, StringView thread_name)
: CObject(nullptr)
: Core::Object(nullptr)
, m_action(move(action))
, m_thread_name(thread_name.is_null() ? "" : thread_name)
{

View file

@ -32,7 +32,7 @@
namespace LibThread {
class Thread final : public CObject {
class Thread final : public Core::Object {
C_OBJECT(Thread);
public: