mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Remove some no longer used files.
This commit is contained in:
parent
9f2b9c82bf
commit
52d502e11f
Notes:
sideshowbarker
2024-07-19 18:33:18 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/52d502e11f3
4 changed files with 0 additions and 170 deletions
|
@ -1,48 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Assertions.h"
|
||||
#include "VGA.h"
|
||||
|
||||
#define DEBUG_REFCOUNTED
|
||||
|
||||
class RefCountedBase {
|
||||
|
||||
protected:
|
||||
bool derefBase() const
|
||||
{
|
||||
return !--m_refCount;
|
||||
}
|
||||
mutable size_t m_refCount { 1 };
|
||||
#ifdef DEBUG_REFCOUNTED
|
||||
//mutable bool m_adopted { false };
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class RefCounted : public RefCountedBase {
|
||||
public:
|
||||
size_t refCount() const { return m_refCount; }
|
||||
|
||||
void ref() const
|
||||
{
|
||||
#ifdef DEBUG_REFCOUNTED
|
||||
ASSERT(m_refCount);
|
||||
//ASSERT(m_adopted);
|
||||
#endif
|
||||
++m_refCount;
|
||||
}
|
||||
|
||||
void deref() const
|
||||
{
|
||||
#ifdef DEBUG_REFCOUNTED
|
||||
ASSERT(m_refCount);
|
||||
//ASSERT(m_adopted);
|
||||
#endif
|
||||
if (derefBase())
|
||||
delete static_cast<const T*>(this);
|
||||
}
|
||||
|
||||
protected:
|
||||
RefCounted() { }
|
||||
~RefCounted() { }
|
||||
};
|
100
Kernel/RefPtr.h
100
Kernel/RefPtr.h
|
@ -1,100 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#define SANITIZE_REFPTR
|
||||
|
||||
template<typename T> class RefPtr;
|
||||
template<typename T> RefPtr<T> adoptRef(T*);
|
||||
|
||||
template<typename T>
|
||||
class RefPtr {
|
||||
public:
|
||||
RefPtr() { }
|
||||
RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(m_ptr); }
|
||||
|
||||
~RefPtr()
|
||||
{
|
||||
derefIfNotNull(m_ptr);
|
||||
#ifdef SANITIZE_REFPTR
|
||||
m_ptr = (T*)(0xeeeeeeee);
|
||||
#endif
|
||||
}
|
||||
|
||||
RefPtr(RefPtr&& other)
|
||||
: m_ptr(other.leakPtr())
|
||||
{
|
||||
}
|
||||
|
||||
RefPtr& operator=(RefPtr&& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
m_ptr = other.leakPtr();
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
RefPtr(RefPtr<U>&& other)
|
||||
: m_ptr(static_cast<T*>(other.leakPtr()))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
RefPtr& operator=(RefPtr<U>&& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
m_ptr = static_cast<T*>(other.leakPtr());
|
||||
return *this;
|
||||
}
|
||||
|
||||
RefPtr(const RefPtr& other)
|
||||
: m_ptr(other.m_ptr)
|
||||
{
|
||||
refIfNotNull(m_ptr);
|
||||
}
|
||||
|
||||
RefPtr& operator=(const RefPtr& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
m_ptr = other.m_ptr;
|
||||
refIfNotNull(m_ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
T* ptr() { return m_ptr; }
|
||||
const T* ptr() const { return m_ptr; }
|
||||
T* operator->() { return m_ptr; }
|
||||
const T* operator->() const { return m_ptr; }
|
||||
T& operator*() { return *m_ptr; }
|
||||
const T& operator*() const { return *m_ptr; }
|
||||
operator bool() const { return m_ptr; }
|
||||
|
||||
T* leakPtr()
|
||||
{
|
||||
T* ptr = m_ptr;
|
||||
m_ptr = nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename U> friend class RefPtr;
|
||||
friend RefPtr adoptRef<T>(T*);
|
||||
|
||||
enum AdoptTag { Adopt };
|
||||
RefPtr(AdoptTag, T* ptr) : m_ptr(ptr) { }
|
||||
|
||||
inline void refIfNotNull(T* ptr) { if (ptr) ptr->ref(); }
|
||||
inline void derefIfNotNull(T* ptr) { if (ptr) ptr->deref(); }
|
||||
|
||||
T* m_ptr { nullptr };
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline RefPtr<T> adoptRef(T* ptr)
|
||||
{
|
||||
ASSERT(ptr->refCount() == 1);
|
||||
return RefPtr<T>(RefPtr<T>::Adopt, ptr);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
extern "C" int puts(const char*);
|
||||
|
||||
extern "C" int elf_entry()
|
||||
{
|
||||
puts("Home, where you are supposed to be...");
|
||||
return 0;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#include "Userspace.cpp"
|
||||
|
||||
using namespace Userspace;
|
||||
|
||||
extern "C" int elf_entry()
|
||||
{
|
||||
int fd = open("/Banner.txt");
|
||||
char buf[2048];
|
||||
int nread = read(fd, buf, sizeof(buf));
|
||||
buf[nread] = '\0';
|
||||
for (int i = 0; i < nread; ++i) {
|
||||
putch(buf[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue