summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-21 18:37:47 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-21 18:37:47 +0200
commit90b1354688e988ba1311a5645f631d353fa7ff80 (patch)
tree5619e16c34d3f2f9142c270e2a906614a6d598a6
parent77b9fa89dd36fcd56d956667a956ef7f2ee8f963 (diff)
downloadserenity-90b1354688e988ba1311a5645f631d353fa7ff80.zip
AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.
-rw-r--r--AK/AKString.h8
-rw-r--r--AK/ByteBuffer.h28
-rw-r--r--AK/RetainPtr.h64
-rw-r--r--AK/Retained.h42
-rw-r--r--AK/StringImpl.cpp10
-rw-r--r--AK/StringImpl.h10
-rw-r--r--AK/WeakPtr.h4
-rw-r--r--AK/Weakable.h2
-rw-r--r--Applications/FileManager/DirectoryView.h2
-rw-r--r--Applications/FileManager/main.cpp4
-rw-r--r--Applications/FontEditor/FontEditor.cpp2
-rw-r--r--Applications/FontEditor/FontEditor.h4
-rw-r--r--Applications/FontEditor/GlyphEditorWidget.h2
-rw-r--r--Applications/FontEditor/GlyphMapWidget.h2
-rw-r--r--Applications/FontEditor/main.cpp2
-rw-r--r--Applications/IRCClient/IRCAppWindow.h12
-rw-r--r--Applications/IRCClient/IRCChannel.cpp2
-rw-r--r--Applications/IRCClient/IRCChannel.h6
-rw-r--r--Applications/IRCClient/IRCChannelMemberListModel.h2
-rw-r--r--Applications/IRCClient/IRCClient.h10
-rw-r--r--Applications/IRCClient/IRCLogBuffer.cpp2
-rw-r--r--Applications/IRCClient/IRCLogBuffer.h4
-rw-r--r--Applications/IRCClient/IRCLogBufferModel.cpp2
-rw-r--r--Applications/IRCClient/IRCLogBufferModel.h6
-rw-r--r--Applications/IRCClient/IRCQuery.cpp2
-rw-r--r--Applications/IRCClient/IRCQuery.h4
-rw-r--r--Applications/IRCClient/IRCWindow.h2
-rw-r--r--Applications/IRCClient/IRCWindowListModel.h2
-rw-r--r--Applications/PaintBrush/PaintableWidget.h2
-rw-r--r--Applications/ProcessManager/ProcessModel.h10
-rw-r--r--Applications/Taskbar/WindowList.h2
-rw-r--r--Applications/Terminal/Terminal.cpp2
-rw-r--r--Applications/Terminal/Terminal.h6
-rw-r--r--Applications/Terminal/main.cpp4
-rw-r--r--Demos/Fire/Fire.cpp2
-rw-r--r--Demos/PaintTest/main.cpp4
-rw-r--r--DevTools/VisualBuilder/VBForm.h2
-rw-r--r--DevTools/VisualBuilder/VBWidget.h4
-rw-r--r--DevTools/VisualBuilder/VBWidgetPropertyModel.h2
-rw-r--r--Games/Minesweeper/Field.h16
-rw-r--r--Games/Snake/SnakeGame.h2
-rw-r--r--Kernel/Devices/DiskPartition.cpp4
-rw-r--r--Kernel/Devices/DiskPartition.h6
-rw-r--r--Kernel/Devices/FileBackedDiskDevice.cpp2
-rw-r--r--Kernel/Devices/FileBackedDiskDevice.h2
-rw-r--r--Kernel/Devices/IDEDiskDevice.cpp2
-rw-r--r--Kernel/Devices/IDEDiskDevice.h4
-rw-r--r--Kernel/Devices/MBRPartitionTable.cpp4
-rw-r--r--Kernel/Devices/MBRPartitionTable.h6
-rw-r--r--Kernel/File.cpp2
-rw-r--r--Kernel/File.h2
-rw-r--r--Kernel/FileSystem/Custody.cpp4
-rw-r--r--Kernel/FileSystem/Custody.h8
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp4
-rw-r--r--Kernel/FileSystem/DevPtsFS.h4
-rw-r--r--Kernel/FileSystem/DiskBackedFileSystem.cpp2
-rw-r--r--Kernel/FileSystem/DiskBackedFileSystem.h4
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp10
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.h12
-rw-r--r--Kernel/FileSystem/FIFO.cpp6
-rw-r--r--Kernel/FileSystem/FIFO.h6
-rw-r--r--Kernel/FileSystem/FileDescription.cpp10
-rw-r--r--Kernel/FileSystem/FileDescription.h16
-rw-r--r--Kernel/FileSystem/FileSystem.cpp2
-rw-r--r--Kernel/FileSystem/FileSystem.h6
-rw-r--r--Kernel/FileSystem/Inode.cpp2
-rw-r--r--Kernel/FileSystem/Inode.h2
-rw-r--r--Kernel/FileSystem/InodeFile.cpp2
-rw-r--r--Kernel/FileSystem/InodeFile.h6
-rw-r--r--Kernel/FileSystem/ProcFS.cpp10
-rw-r--r--Kernel/FileSystem/ProcFS.h14
-rw-r--r--Kernel/FileSystem/SyntheticFileSystem.cpp18
-rw-r--r--Kernel/FileSystem/SyntheticFileSystem.h20
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.cpp36
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.h26
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
-rw-r--r--Kernel/Net/IPv4Socket.h4
-rw-r--r--Kernel/Net/LocalSocket.cpp2
-rw-r--r--Kernel/Net/LocalSocket.h4
-rw-r--r--Kernel/Net/NetworkTask.cpp2
-rw-r--r--Kernel/Net/Socket.cpp4
-rw-r--r--Kernel/Net/Socket.h10
-rw-r--r--Kernel/Net/TCPSocket.cpp4
-rw-r--r--Kernel/Net/TCPSocket.h4
-rw-r--r--Kernel/Net/UDPSocket.cpp4
-rw-r--r--Kernel/Net/UDPSocket.h4
-rw-r--r--Kernel/Process.cpp14
-rw-r--r--Kernel/Process.h22
-rw-r--r--Kernel/ProcessTracer.h2
-rw-r--r--Kernel/SharedMemory.cpp8
-rw-r--r--Kernel/SharedMemory.h4
-rw-r--r--Kernel/TTY/MasterPTY.h2
-rw-r--r--Kernel/TTY/PTYMultiplexer.cpp2
-rw-r--r--Kernel/TTY/PTYMultiplexer.h2
-rw-r--r--Kernel/TTY/SlavePTY.h2
-rw-r--r--Kernel/Thread.h6
-rw-r--r--Kernel/VM/MemoryManager.cpp14
-rw-r--r--Kernel/VM/MemoryManager.h14
-rw-r--r--Kernel/VM/PageDirectory.h8
-rw-r--r--Kernel/VM/PhysicalPage.cpp2
-rw-r--r--Kernel/VM/PhysicalPage.h2
-rw-r--r--Kernel/VM/PhysicalRegion.cpp4
-rw-r--r--Kernel/VM/PhysicalRegion.h4
-rw-r--r--Kernel/VM/Region.cpp6
-rw-r--r--Kernel/VM/Region.h10
-rw-r--r--Kernel/VM/VMObject.cpp10
-rw-r--r--Kernel/VM/VMObject.h18
-rw-r--r--Kernel/init.cpp4
-rw-r--r--LibC/SharedBuffer.cpp4
-rw-r--r--LibC/SharedBuffer.h4
-rw-r--r--LibCore/CConfigFile.cpp4
-rw-r--r--LibCore/CConfigFile.h4
-rw-r--r--LibCore/CHttpResponse.h2
-rw-r--r--LibCore/CNetworkJob.cpp2
-rw-r--r--LibCore/CNetworkJob.h4
-rw-r--r--LibGUI/GAbstractView.cpp2
-rw-r--r--LibGUI/GAbstractView.h4
-rw-r--r--LibGUI/GAction.cpp4
-rw-r--r--LibGUI/GAction.h16
-rw-r--r--LibGUI/GButton.cpp2
-rw-r--r--LibGUI/GButton.h4
-rw-r--r--LibGUI/GDirectoryModel.cpp6
-rw-r--r--LibGUI/GDirectoryModel.h4
-rw-r--r--LibGUI/GFilePicker.h2
-rw-r--r--LibGUI/GFileSystemModel.h2
-rw-r--r--LibGUI/GFontDatabase.cpp2
-rw-r--r--LibGUI/GFontDatabase.h2
-rw-r--r--LibGUI/GIcon.cpp6
-rw-r--r--LibGUI/GIcon.h14
-rw-r--r--LibGUI/GLabel.cpp2
-rw-r--r--LibGUI/GLabel.h4
-rw-r--r--LibGUI/GMenu.cpp2
-rw-r--r--LibGUI/GMenu.h2
-rw-r--r--LibGUI/GMenuItem.cpp2
-rw-r--r--LibGUI/GMenuItem.h4
-rw-r--r--LibGUI/GMessageBox.cpp2
-rw-r--r--LibGUI/GMessageBox.h2
-rw-r--r--LibGUI/GRadioButton.cpp8
-rw-r--r--LibGUI/GResizeCorner.h2
-rw-r--r--LibGUI/GSortingProxyModel.cpp2
-rw-r--r--LibGUI/GSortingProxyModel.h6
-rw-r--r--LibGUI/GTableView.h2
-rw-r--r--LibGUI/GTextEditor.h12
-rw-r--r--LibGUI/GToolBar.cpp2
-rw-r--r--LibGUI/GToolBar.h4
-rw-r--r--LibGUI/GTreeView.h4
-rw-r--r--LibGUI/GWidget.cpp2
-rw-r--r--LibGUI/GWidget.h4
-rw-r--r--LibGUI/GWindow.cpp2
-rw-r--r--LibGUI/GWindow.h6
-rw-r--r--LibHTML/CSS/StyleDeclaration.h2
-rw-r--r--LibHTML/DOM/Document.cpp2
-rw-r--r--LibHTML/DOM/Document.h2
-rw-r--r--LibHTML/DOM/Element.cpp2
-rw-r--r--LibHTML/DOM/Element.h2
-rw-r--r--LibHTML/DOM/Node.cpp4
-rw-r--r--LibHTML/DOM/Node.h6
-rw-r--r--LibHTML/DOM/ParentNode.cpp2
-rw-r--r--LibHTML/DOM/ParentNode.h2
-rw-r--r--LibHTML/DOM/Text.cpp2
-rw-r--r--LibHTML/DOM/Text.h2
-rw-r--r--LibHTML/Frame.h2
-rw-r--r--LibHTML/Layout/LayoutNode.cpp2
-rw-r--r--LibHTML/Layout/LayoutNode.h2
-rw-r--r--LibHTML/Parser/Parser.cpp6
-rw-r--r--LibHTML/Parser/Parser.h2
-rw-r--r--Servers/WindowServer/WSButton.cpp2
-rw-r--r--Servers/WindowServer/WSButton.h4
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp2
-rw-r--r--Servers/WindowServer/WSClientConnection.h2
-rw-r--r--Servers/WindowServer/WSClipboard.cpp2
-rw-r--r--Servers/WindowServer/WSClipboard.h4
-rw-r--r--Servers/WindowServer/WSCompositor.cpp6
-rw-r--r--Servers/WindowServer/WSCompositor.h8
-rw-r--r--Servers/WindowServer/WSCursor.cpp8
-rw-r--r--Servers/WindowServer/WSCursor.h10
-rw-r--r--Servers/WindowServer/WSWindow.h14
-rw-r--r--Servers/WindowServer/WSWindowManager.cpp4
-rw-r--r--Servers/WindowServer/WSWindowManager.h24
-rw-r--r--SharedGraphics/CharacterBitmap.cpp2
-rw-r--r--SharedGraphics/CharacterBitmap.h2
-rw-r--r--SharedGraphics/Font.cpp6
-rw-r--r--SharedGraphics/Font.h6
-rw-r--r--SharedGraphics/GraphicsBitmap.cpp12
-rw-r--r--SharedGraphics/GraphicsBitmap.h14
-rw-r--r--SharedGraphics/PNGLoader.cpp8
-rw-r--r--SharedGraphics/PNGLoader.h2
-rw-r--r--SharedGraphics/Painter.h2
188 files changed, 562 insertions, 562 deletions
diff --git a/AK/AKString.h b/AK/AKString.h
index 7784c9252f..453a67dd35 100644
--- a/AK/AKString.h
+++ b/AK/AKString.h
@@ -12,7 +12,7 @@ namespace AK {
// String is a convenience wrapper around StringImpl, suitable for passing
// around as a value type. It's basically the same as passing around a
-// RetainPtr<StringImpl>, with a bit of syntactic sugar.
+// RefPtr<StringImpl>, with a bit of syntactic sugar.
//
// Note that StringImpl is an immutable object that cannot shrink or grow.
// Its allocation size is snugly tailored to the specific string it contains.
@@ -74,12 +74,12 @@ public:
{
}
- String(RetainPtr<StringImpl>&& impl)
+ String(RefPtr<StringImpl>&& impl)
: m_impl(move(impl))
{
}
- String(Retained<StringImpl>&& impl)
+ String(NonnullRefPtr<StringImpl>&& impl)
: m_impl(move(impl))
{
}
@@ -186,7 +186,7 @@ public:
private:
bool match_helper(const StringView& mask) const;
- RetainPtr<StringImpl> m_impl;
+ RefPtr<StringImpl> m_impl;
};
inline bool StringView::operator==(const String& string) const
diff --git a/AK/ByteBuffer.h b/AK/ByteBuffer.h
index ffd39b834a..6b2f2d394c 100644
--- a/AK/ByteBuffer.h
+++ b/AK/ByteBuffer.h
@@ -10,12 +10,12 @@ namespace AK {
class ByteBufferImpl : public RefCounted<ByteBufferImpl> {
public:
- static Retained<ByteBufferImpl> create_uninitialized(int size);
- static Retained<ByteBufferImpl> create_zeroed(int);
- static Retained<ByteBufferImpl> copy(const void*, int);
- static Retained<ByteBufferImpl> wrap(void*, int);
- static Retained<ByteBufferImpl> wrap(const void*, int);
- static Retained<ByteBufferImpl> adopt(void*, int);
+ static NonnullRefPtr<ByteBufferImpl> create_uninitialized(int size);
+ static NonnullRefPtr<ByteBufferImpl> create_zeroed(int);
+ static NonnullRefPtr<ByteBufferImpl> copy(const void*, int);
+ static NonnullRefPtr<ByteBufferImpl> wrap(void*, int);
+ static NonnullRefPtr<ByteBufferImpl> wrap(const void*, int);
+ static NonnullRefPtr<ByteBufferImpl> adopt(void*, int);
~ByteBufferImpl() { clear(); }
@@ -180,12 +180,12 @@ public:
}
private:
- explicit ByteBuffer(RetainPtr<ByteBufferImpl>&& impl)
+ explicit ByteBuffer(RefPtr<ByteBufferImpl>&& impl)
: m_impl(move(impl))
{
}
- RetainPtr<ByteBufferImpl> m_impl;
+ RefPtr<ByteBufferImpl> m_impl;
};
inline ByteBufferImpl::ByteBufferImpl(int size)
@@ -227,34 +227,34 @@ inline void ByteBufferImpl::grow(int size)
kfree(old_data);
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::create_uninitialized(int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::create_uninitialized(int size)
{
return ::adopt(*new ByteBufferImpl(size));
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::create_zeroed(int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::create_zeroed(int size)
{
auto buffer = ::adopt(*new ByteBufferImpl(size));
memset(buffer->pointer(), 0, size);
return buffer;
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::copy(const void* data, int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::copy(const void* data, int size)
{
return ::adopt(*new ByteBufferImpl(data, size, Copy));
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(void* data, int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::wrap(void* data, int size)
{
return ::adopt(*new ByteBufferImpl(data, size, Wrap));
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(const void* data, int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::wrap(const void* data, int size)
{
return ::adopt(*new ByteBufferImpl(const_cast<void*>(data), size, Wrap));
}
-inline Retained<ByteBufferImpl> ByteBufferImpl::adopt(void* data, int size)
+inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::adopt(void* data, int size)
{
return ::adopt(*new ByteBufferImpl(data, size, Adopt));
}
diff --git a/AK/RetainPtr.h b/AK/RetainPtr.h
index b11870d8fa..f19ffb35a8 100644
--- a/AK/RetainPtr.h
+++ b/AK/RetainPtr.h
@@ -6,65 +6,65 @@
namespace AK {
template<typename T>
-class RetainPtr {
+class RefPtr {
public:
enum AdoptTag {
Adopt
};
- RetainPtr() {}
- RetainPtr(const T* ptr)
+ RefPtr() {}
+ RefPtr(const T* ptr)
: m_ptr(const_cast<T*>(ptr))
{
ref_if_not_null(m_ptr);
}
- RetainPtr(T* ptr)
+ RefPtr(T* ptr)
: m_ptr(ptr)
{
ref_if_not_null(m_ptr);
}
- RetainPtr(T& object)
+ RefPtr(T& object)
: m_ptr(&object)
{
m_ptr->ref();
}
- RetainPtr(const T& object)
+ RefPtr(const T& object)
: m_ptr(const_cast<T*>(&object))
{
m_ptr->ref();
}
- RetainPtr(AdoptTag, T& object)
+ RefPtr(AdoptTag, T& object)
: m_ptr(&object)
{
}
- RetainPtr(RetainPtr& other)
+ RefPtr(RefPtr& other)
: m_ptr(other.copy_ref().leak_ref())
{
}
- RetainPtr(RetainPtr&& other)
+ RefPtr(RefPtr&& other)
: m_ptr(other.leak_ref())
{
}
template<typename U>
- RetainPtr(Retained<U>&& other)
+ RefPtr(NonnullRefPtr<U>&& other)
: m_ptr(static_cast<T*>(&other.leak_ref()))
{
}
template<typename U>
- RetainPtr(RetainPtr<U>&& other)
+ RefPtr(RefPtr<U>&& other)
: m_ptr(static_cast<T*>(other.leak_ref()))
{
}
- RetainPtr(const RetainPtr& other)
- : m_ptr(const_cast<RetainPtr&>(other).copy_ref().leak_ref())
+ RefPtr(const RefPtr& other)
+ : m_ptr(const_cast<RefPtr&>(other).copy_ref().leak_ref())
{
}
template<typename U>
- RetainPtr(const RetainPtr<U>& other)
- : m_ptr(const_cast<RetainPtr<U>&>(other).copy_ref().leak_ref())
+ RefPtr(const RefPtr<U>& other)
+ : m_ptr(const_cast<RefPtr<U>&>(other).copy_ref().leak_ref())
{
}
- ~RetainPtr()
+ ~RefPtr()
{
clear();
#ifdef SANITIZE_PTRS
@@ -74,9 +74,9 @@ public:
m_ptr = (T*)(0xe0e0e0e0);
#endif
}
- RetainPtr(std::nullptr_t) {}
+ RefPtr(std::nullptr_t) {}
- RetainPtr& operator=(RetainPtr&& other)
+ RefPtr& operator=(RefPtr&& other)
{
if (this != &other) {
deref_if_not_null(m_ptr);
@@ -86,7 +86,7 @@ public:
}
template<typename U>
- RetainPtr& operator=(RetainPtr<U>&& other)
+ RefPtr& operator=(RefPtr<U>&& other)
{
if (this != static_cast<void*>(&other)) {
deref_if_not_null(m_ptr);
@@ -96,7 +96,7 @@ public:
}
template<typename U>
- RetainPtr& operator=(Retained<U>&& other)
+ RefPtr& operator=(NonnullRefPtr<U>&& other)
{
deref_if_not_null(m_ptr);
m_ptr = &other.leak_ref();
@@ -104,7 +104,7 @@ public:
}
template<typename U>
- RetainPtr& operator=(const Retained<U>& other)
+ RefPtr& operator=(const NonnullRefPtr<U>& other)
{
if (m_ptr != other.ptr())
deref_if_not_null(m_ptr);
@@ -115,7 +115,7 @@ public:
}
template<typename U>
- RetainPtr& operator=(const RetainPtr<U>& other)
+ RefPtr& operator=(const RefPtr<U>& other)
{
if (m_ptr != other.ptr())
deref_if_not_null(m_ptr);
@@ -124,7 +124,7 @@ public:
return *this;
}
- RetainPtr& operator=(const T* ptr)
+ RefPtr& operator=(const T* ptr)
{
if (m_ptr != ptr)
deref_if_not_null(m_ptr);
@@ -133,7 +133,7 @@ public:
return *this;
}
- RetainPtr& operator=(const T& object)
+ RefPtr& operator=(const T& object)
{
if (m_ptr != &object)
deref_if_not_null(m_ptr);
@@ -142,15 +142,15 @@ public:
return *this;
}
- RetainPtr& operator=(std::nullptr_t)
+ RefPtr& operator=(std::nullptr_t)
{
clear();
return *this;
}
- RetainPtr copy_ref() const
+ RefPtr copy_ref() const
{
- return RetainPtr(m_ptr);
+ return RefPtr(m_ptr);
}
void clear()
@@ -185,11 +185,11 @@ public:
bool operator==(std::nullptr_t) const { return !m_ptr; }
bool operator!=(std::nullptr_t) const { return m_ptr; }
- bool operator==(const RetainPtr& other) const { return m_ptr == other.m_ptr; }
- bool operator!=(const RetainPtr& other) const { return m_ptr != other.m_ptr; }
+ bool operator==(const RefPtr& other) const { return m_ptr == other.m_ptr; }
+ bool operator!=(const RefPtr& other) const { return m_ptr != other.m_ptr; }
- bool operator==(RetainPtr& other) { return m_ptr == other.m_ptr; }
- bool operator!=(RetainPtr& other) { return m_ptr != other.m_ptr; }
+ bool operator==(RefPtr& other) { return m_ptr == other.m_ptr; }
+ bool operator!=(RefPtr& other) { return m_ptr != other.m_ptr; }
bool operator==(const T* other) const { return m_ptr == other; }
bool operator!=(const T* other) const { return m_ptr != other; }
@@ -205,4 +205,4 @@ private:
}
-using AK::RetainPtr;
+using AK::RefPtr;
diff --git a/AK/Retained.h b/AK/Retained.h
index ba86036a27..ca8f22b1ef 100644
--- a/AK/Retained.h
+++ b/AK/Retained.h
@@ -32,58 +32,58 @@ inline void deref_if_not_null(T* ptr)
}
template<typename T>
-class CONSUMABLE(unconsumed) Retained {
+class CONSUMABLE(unconsumed) NonnullRefPtr {
public:
enum AdoptTag {
Adopt
};
RETURN_TYPESTATE(unconsumed)
- Retained(const T& object)
+ NonnullRefPtr(const T& object)
: m_ptr(const_cast<T*>(&object))
{
m_ptr->ref();
}
template<typename U>
RETURN_TYPESTATE(unconsumed)
- Retained(const U& object)
+ NonnullRefPtr(const U& object)
: m_ptr(&const_cast<T&>(static_cast<const T&>(object)))
{
m_ptr->ref();
}
RETURN_TYPESTATE(unconsumed)
- Retained(AdoptTag, T& object)
+ NonnullRefPtr(AdoptTag, T& object)
: m_ptr(&object)
{
}
RETURN_TYPESTATE(unconsumed)
- Retained(Retained& other)
+ NonnullRefPtr(NonnullRefPtr& other)
: m_ptr(&other.copy_ref().leak_ref())
{
}
RETURN_TYPESTATE(unconsumed)
- Retained(Retained&& other)
+ NonnullRefPtr(NonnullRefPtr&& other)
: m_ptr(&other.leak_ref())
{
}
template<typename U>
RETURN_TYPESTATE(unconsumed)
- Retained(Retained<U>&& other)
+ NonnullRefPtr(NonnullRefPtr<U>&& other)
: m_ptr(static_cast<T*>(&other.leak_ref()))
{
}
RETURN_TYPESTATE(unconsumed)
- Retained(const Retained& other)
- : m_ptr(&const_cast<Retained&>(other).copy_ref().leak_ref())
+ NonnullRefPtr(const NonnullRefPtr& other)
+ : m_ptr(&const_cast<NonnullRefPtr&>(other).copy_ref().leak_ref())
{
}
template<typename U>
RETURN_TYPESTATE(unconsumed)
- Retained(const Retained<U>& other)
- : m_ptr(&const_cast<Retained<U>&>(other).copy_ref().leak_ref())
+ NonnullRefPtr(const NonnullRefPtr<U>& other)
+ : m_ptr(&const_cast<NonnullRefPtr<U>&>(other).copy_ref().leak_ref())
{
}
- ~Retained()
+ ~NonnullRefPtr()
{
deref_if_not_null(m_ptr);
m_ptr = nullptr;
@@ -96,7 +96,7 @@ public:
}
CALLABLE_WHEN(unconsumed)
- Retained& operator=(Retained&& other)
+ NonnullRefPtr& operator=(NonnullRefPtr&& other)
{
if (this != &other) {
deref_if_not_null(m_ptr);
@@ -107,7 +107,7 @@ public:
template<typename U>
CALLABLE_WHEN(unconsumed)
- Retained& operator=(Retained<U>&& other)
+ NonnullRefPtr& operator=(NonnullRefPtr<U>&& other)
{
if (this != static_cast<void*>(&other)) {
deref_if_not_null(m_ptr);
@@ -117,7 +117,7 @@ public:
}
CALLABLE_WHEN(unconsumed)
- Retained& operator=(T& object)
+ NonnullRefPtr& operator=(T& object)
{
if (m_ptr != &object)
deref_if_not_null(m_ptr);
@@ -127,9 +127,9 @@ public:
}
CALLABLE_WHEN(unconsumed)
- Retained copy_ref() const
+ NonnullRefPtr copy_ref() const
{
- return Retained(*m_ptr);
+ return NonnullRefPtr(*m_ptr);
}
CALLABLE_WHEN(unconsumed)
@@ -208,18 +208,18 @@ public:
}
private:
- Retained() {}
+ NonnullRefPtr() {}
T* m_ptr { nullptr };
};
template<typename T>
-inline Retained<T> adopt(T& object)
+inline NonnullRefPtr<T> adopt(T& object)
{
- return Retained<T>(Retained<T>::Adopt, object);
+ return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, object);
}
}
using AK::adopt;
-using AK::Retained;
+using AK::NonnullRefPtr;
diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp
index cf15329fdb..6ccb481075 100644
--- a/AK/StringImpl.cpp
+++ b/AK/StringImpl.cpp
@@ -60,7 +60,7 @@ static inline int allocation_size_for_stringimpl(int length)
return sizeof(StringImpl) + (sizeof(char) * length) + sizeof(char);
}
-Retained<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer)
+NonnullRefPtr<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer)
{
ASSERT(length);
void* slot = kmalloc(allocation_size_for_stringimpl(length));
@@ -71,7 +71,7 @@ Retained<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer)
return new_stringimpl;
}
-RetainPtr<StringImpl> StringImpl::create(const char* cstring, int length, ShouldChomp should_chomp)
+RefPtr<StringImpl> StringImpl::create(const char* cstring, int length, ShouldChomp should_chomp)
{
if (!cstring)
return nullptr;
@@ -99,7 +99,7 @@ RetainPtr<StringImpl> StringImpl::create(const char* cstring, int length, Should
return new_stringimpl;
}
-RetainPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldChomp)
+RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldChomp)
{
if (!cstring)
return nullptr;
@@ -131,7 +131,7 @@ static inline char to_ascii_uppercase(char c)
return c;
}
-Retained<StringImpl> StringImpl::to_lowercase() const
+NonnullRefPtr<StringImpl> StringImpl::to_lowercase() const
{
for (int i = 0; i < m_length; ++i) {
if (!is_ascii_lowercase(characters()[i]))
@@ -147,7 +147,7 @@ slow_path:
return lowercased;
}
-Retained<StringImpl> StringImpl::to_uppercase() const
+NonnullRefPtr<StringImpl> StringImpl::to_uppercase() const
{
for (int i = 0; i < m_length; ++i) {
if (!is_ascii_uppercase(characters()[i]))
diff --git a/AK/StringImpl.h b/AK/StringImpl.h
index 5eb0a27962..01e70f3135 100644
--- a/AK/StringImpl.h
+++ b/AK/StringImpl.h
@@ -14,11 +14,11 @@ enum ShouldChomp {
class StringImpl : public RefCounted<StringImpl> {
public:
- static Retained<StringImpl> create_uninitialized(int length, char*& buffer);
- static RetainPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp);
- static RetainPtr<StringImpl> create(const char* cstring, int length, ShouldChomp = NoChomp);
- Retained<StringImpl> to_lowercase() const;
- Retained<StringImpl> to_uppercase() const;
+ static NonnullRefPtr<StringImpl> create_uninitialized(int length, char*& buffer);
+ static RefPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp);
+ static RefPtr<StringImpl> create(const char* cstring, int length, ShouldChomp = NoChomp);
+ NonnullRefPtr<StringImpl> to_lowercase() const;
+ NonnullRefPtr<StringImpl> to_uppercase() const;
void operator delete(void* ptr)
{
diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h
index 30d118e178..7715589ea7 100644
--- a/AK/WeakPtr.h
+++ b/AK/WeakPtr.h
@@ -50,12 +50,12 @@ public:
bool operator==(const OwnPtr<T>& other) const { return ptr() == other.ptr(); }
private:
- WeakPtr(RetainPtr<WeakLink<T>>&& link)
+ WeakPtr(RefPtr<WeakLink<T>>&& link)
: m_link(move(link))
{
}
- RetainPtr<WeakLink<T>> m_link;
+ RefPtr<WeakLink<T>> m_link;
};
template<typename T>
diff --git a/AK/Weakable.h b/AK/Weakable.h
index ba9a428ffb..3985e974a1 100644
--- a/AK/Weakable.h
+++ b/AK/Weakable.h
@@ -45,7 +45,7 @@ protected:
}
private:
- RetainPtr<WeakLink<T>> m_link;
+ RefPtr<WeakLink<T>> m_link;
};
}
diff --git a/Applications/FileManager/DirectoryView.h b/Applications/FileManager/DirectoryView.h
index c7e2f08bc5..3c082ff36e 100644
--- a/Applications/FileManager/DirectoryView.h
+++ b/Applications/FileManager/DirectoryView.h
@@ -44,7 +44,7 @@ private:
ViewMode m_view_mode { Invalid };
- Retained<GDirectoryModel> m_model;
+ NonnullRefPtr<GDirectoryModel> m_model;
int m_path_history_position { 0 };
Vector<String> m_path_history;
void add_path_to_history(const StringView& path);
diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp
index 4f8f1cbc01..4817444b17 100644
--- a/Applications/FileManager/main.cpp
+++ b/Applications/FileManager/main.cpp
@@ -103,8 +103,8 @@ int main(int argc, char** argv)
}
});
- RetainPtr<GAction> view_as_table_action;
- RetainPtr<GAction> view_as_icons_action;
+ RefPtr<GAction> view_as_table_action;
+ RefPtr<GAction> view_as_icons_action;
view_as_table_action = GAction::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GAction&) {
directory_view->set_view_mode(DirectoryView::ViewMode::List);
diff --git a/Applications/FontEditor/FontEditor.cpp b/Applications/FontEditor/FontEditor.cpp
index 247e17d276..28dc2e6366 100644
--- a/Applications/FontEditor/FontEditor.cpp
+++ b/Applications/FontEditor/FontEditor.cpp
@@ -10,7 +10,7 @@
#include <LibGUI/GTextBox.h>
#include <stdlib.h>
-FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent)
+FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GWidget* parent)
: GWidget(parent)
, m_edited_font(move(edited_font))
{
diff --git a/Applications/FontEditor/FontEditor.h b/Applications/FontEditor/FontEditor.h
index 9132c5029a..e6777c4b46 100644
--- a/Applications/FontEditor/FontEditor.h
+++ b/Applications/FontEditor/FontEditor.h
@@ -9,11 +9,11 @@ class GTextBox;
class FontEditorWidget final : public GWidget {
public:
- FontEditorWidget(const String& path, RetainPtr<Font>&&, GWidget* parent = nullptr);
+ FontEditorWidget(const String& path, RefPtr<Font>&&, GWidget* parent = nullptr);
virtual ~FontEditorWidget() override;
private:
- RetainPtr<Font> m_edited_font;
+ RefPtr<Font> m_edited_font;
GlyphMapWidget* m_glyph_map_widget { nullptr };
GlyphEditorWidget* m_glyph_editor_widget { nullptr };
diff --git a/Applications/FontEditor/GlyphEditorWidget.h b/Applications/FontEditor/GlyphEditorWidget.h
index 3784c054b5..9fd05a322e 100644
--- a/Applications/FontEditor/GlyphEditorWidget.h
+++ b/Applications/FontEditor/GlyphEditorWidget.h
@@ -24,7 +24,7 @@ private:
void draw_at_mouse(const GMouseEvent&);
- RetainPtr<Font> m_font;
+ RefPtr<Font> m_font;
byte m_glyph { 0 };
int m_scale { 10 };
};
diff --git a/Applications/FontEditor/GlyphMapWidget.h b/Applications/FontEditor/GlyphMapWidget.h
index e5746aff0b..521c0f7c2f 100644
--- a/Applications/FontEditor/GlyphMapWidget.h
+++ b/Applications/FontEditor/GlyphMapWidget.h
@@ -30,7 +30,7 @@ private:
Rect get_outer_rect(byte glyph) const;
- RetainPtr<Font> m_font;
+ RefPtr<Font> m_font;
int m_rows { 8 };
int m_horizontal_spacing { 2 };
int m_vertical_spacing { 2 };
diff --git a/Applications/FontEditor/main.cpp b/Applications/FontEditor/main.cpp
index 9f80a5962f..d2bc0967ce 100644
--- a/Applications/FontEditor/main.cpp
+++ b/Applications/FontEditor/main.cpp
@@ -7,7 +7,7 @@ int main(int argc, char** argv)
{
GApplication app(argc, argv);
- RetainPtr<Font> edited_font;
+ RefPtr<Font> edited_font;
String path;
if (argc == 2) {
diff --git a/Applications/IRCClient/IRCAppWindow.h b/Applications/IRCClient/IRCAppWindow.h
index 96e0867a67..1d376f164a 100644
--- a/Applications/IRCClient/IRCAppWindow.h
+++ b/Applications/IRCClient/IRCAppWindow.h
@@ -24,10 +24,10 @@ private:
IRCClient m_client;
GStackWidget* m_container { nullptr };
GTableView* m_window_list { nullptr };
- RetainPtr<GAction> m_join_action;
- RetainPtr<GAction> m_part_action;
- RetainPtr<GAction> m_whois_action;
- RetainPtr<GAction> m_open_query_action;
- RetainPtr<GAction> m_close_query_action;
- RetainPtr<GAction> m_change_nick_action;
+ RefPtr<GAction> m_join_action;
+ RefPtr<GAction> m_part_action;
+ RefPtr<GAction> m_whois_action;
+ RefPtr<GAction> m_open_query_action;
+ RefPtr<GAction> m_close_query_action;
+ RefPtr<GAction> m_change_nick_action;
};
diff --git a/Applications/IRCClient/IRCChannel.cpp b/Applications/IRCClient/IRCChannel.cpp
index 8e18b558b3..75bf4c7d76 100644
--- a/Applications/IRCClient/IRCChannel.cpp
+++ b/Applications/IRCClient/IRCChannel.cpp
@@ -18,7 +18,7 @@ IRCChannel::~IRCChannel()
{
}
-Retained<IRCChannel> IRCChannel::create(IRCClient& client, const String& name)
+NonnullRefPtr<IRCChannel> IRCChannel::create(IRCClient& client, const String& name)
{
return adopt(*new IRCChannel(client, name));
}
diff --git a/Applications/IRCClient/IRCChannel.h b/Applications/IRCClient/IRCChannel.h
index fe219c2534..816bd108c5 100644
--- a/Applications/IRCClient/IRCChannel.h
+++ b/Applications/IRCClient/IRCChannel.h
@@ -13,7 +13,7 @@ class IRCWindow;
class IRCChannel : public RefCounted<IRCChannel> {
public:
- static Retained<IRCChannel> create(IRCClient&, const String&);
+ static NonnullRefPtr<IRCChannel> create(IRCClient&, const String&);
~IRCChannel();
bool is_open() const { return m_open; }
@@ -64,7 +64,7 @@ private:
Vector<Member> m_members;
bool m_open { false };
- Retained<IRCLogBuffer> m_log;
- Retained<IRCChannelMemberListModel> m_member_model;
+ NonnullRefPtr<IRCLogBuffer> m_log;
+ NonnullRefPtr<IRCChannelMemberListModel> m_member_model;
IRCWindow* m_window { nullptr };
};
diff --git a/Applications/IRCClient/IRCChannelMemberListModel.h b/Applications/IRCClient/IRCChannelMemberListModel.h
index df0e762264..deca6347e6 100644
--- a/Applications/IRCClient/IRCChannelMemberListModel.h
+++ b/Applications/IRCClient/IRCChannelMemberListModel.h
@@ -10,7 +10,7 @@ public:
enum Column {
Name
};
- static Retained<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }
+ static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }
virtual ~IRCChannelMemberListModel() override;
virtual int row_count(const GModelIndex&) const override;
diff --git a/Applications/IRCClient/IRCClient.h b/Applications/IRCClient/IRCClient.h
index ac02b9e9fc..d591f4b527 100644
--- a/Applications/IRCClient/IRCClient.h
+++ b/Applications/IRCClient/IRCClient.h
@@ -120,14 +120,14 @@ private:
String m_nickname;
OwnPtr<CNotifier> m_notifier;
- HashMap<String, RetainPtr<IRCChannel>> m_channels;
- HashMap<String, RetainPtr<IRCQuery>> m_queries;
+ HashMap<String, RefPtr<IRCChannel>> m_channels;
+ HashMap<String, RefPtr<IRCQuery>> m_queries;
Vector<IRCWindow*> m_windows;
IRCWindow* m_server_subwindow { nullptr };
- Retained<IRCWindowListModel> m_client_window_list_model;
- Retained<IRCLogBuffer> m_log;
- Retained<CConfigFile> m_config;
+ NonnullRefPtr<IRCWindowListModel> m_client_window_list_model;
+ NonnullRefPtr<IRCLogBuffer> m_log;
+ NonnullRefPtr<CConfigFile> m_config;
};
diff --git a/Applications/IRCClient/IRCLogBuffer.cpp b/Applications/IRCClient/IRCLogBuffer.cpp
index bfa8736306..fb5934b071 100644
--- a/Applications/IRCClient/IRCLogBuffer.cpp
+++ b/Applications/IRCClient/IRCLogBuffer.cpp
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <time.h>
-Retained<IRCLogBuffer> IRCLogBuffer::create()
+NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create()
{
return adopt(*new IRCLogBuffer);
}
diff --git a/Applications/IRCClient/IRCLogBuffer.h b/Applications/IRCClient/IRCLogBuffer.h
index 0720b5b32d..c442afbf98 100644
--- a/Applications/IRCClient/IRCLogBuffer.h
+++ b/Applications/IRCClient/IRCLogBuffer.h
@@ -10,7 +10,7 @@ class IRCLogBufferModel;
class IRCLogBuffer : public RefCounted<IRCLogBuffer> {
public:
- static Retained<IRCLogBuffer> create();
+ static NonnullRefPtr<IRCLogBuffer> create();
~IRCLogBuffer();
struct Message {
@@ -32,6 +32,6 @@ public:
private:
IRCLogBuffer();
- Retained<IRCLogBufferModel> m_model;
+ NonnullRefPtr<IRCLogBufferModel> m_model;
CircularQueue<Message, 1000> m_messages;
};
diff --git a/Applications/IRCClient/IRCLogBufferModel.cpp b/Applications/IRCClient/IRCLogBufferModel.cpp
index 6c3874b476..8805b10918 100644
--- a/Applications/IRCClient/IRCLogBufferModel.cpp
+++ b/Applications/IRCClient/IRCLogBufferModel.cpp
@@ -4,7 +4,7 @@
#include <stdio.h>
#include <time.h>
-IRCLogBufferModel::IRCLogBufferModel(Retained<IRCLogBuffer>&& log_buffer)
+IRCLogBufferModel::IRCLogBufferModel(NonnullRefPtr<IRCLogBuffer>&& log_buffer)
: m_log_buffer(move(log_buffer))
{
}
diff --git a/Applications/IRCClient/IRCLogBufferModel.h b/Applications/IRCClient/IRCLogBufferModel.h
index 5be8237d07..d0685f4637 100644
--- a/Applications/IRCClient/IRCLogBufferModel.h
+++ b/Applications/IRCClient/IRCLogBufferModel.h
@@ -13,7 +13,7 @@ public:
__Count,
};
- static Retained<IRCLogBufferModel> create(Retained<IRCLogBuffer>&& log_buffer) { return adopt(*new IRCLogBufferModel(move(log_buffer))); }
+ static NonnullRefPtr<IRCLogBufferModel> create(NonnullRefPtr<IRCLogBuffer>&& log_buffer) { return adopt(*new IRCLogBufferModel(move(log_buffer))); }
virtual ~IRCLogBufferModel() override;
virtual int row_count(const GModelIndex&) const override;
@@ -24,7 +24,7 @@ public:
virtual void update() override;
private:
- explicit IRCLogBufferModel(Retained<IRCLogBuffer>&&);
+ explicit IRCLogBufferModel(NonnullRefPtr<IRCLogBuffer>&&);
- Retained<IRCLogBuffer> m_log_buffer;
+ NonnullRefPtr<IRCLogBuffer> m_log_buffer;
};
diff --git a/Applications/IRCClient/IRCQuery.cpp b/Applications/IRCClient/IRCQuery.cpp
index a592c01012..3d6f4d2778 100644
--- a/Applications/IRCClient/IRCQuery.cpp
+++ b/Applications/IRCClient/IRCQuery.cpp
@@ -16,7 +16,7 @@ IRCQuery::~IRCQuery()
{
}
-Retained<IRCQuery> IRCQuery::create(IRCClient& client, const String& name)
+NonnullRefPtr<IRCQuery> IRCQuery::create(IRCClient& client, const String& name)
{
return adopt(*new IRCQuery(client, name));
}
diff --git a/Applications/IRCClient/IRCQuery.h b/Applications/IRCClient/IRCQuery.h
index e7e52a1a8e..d94ef37007 100644
--- a/Applications/IRCClient/IRCQuery.h
+++ b/Applications/IRCClient/IRCQuery.h
@@ -12,7 +12,7 @@ class IRCWindow;
class IRCQuery : public RefCounted<IRCQuery> {
public:
- static Retained<IRCQuery> create(IRCClient&, const String& name);
+ static NonnullRefPtr<IRCQuery> create(IRCClient&, const String& name);
~IRCQuery();
String name() const { return m_name; }
@@ -35,5 +35,5 @@ private:
String m_name;
IRCWindow* m_window { nullptr };
- Retained<IRCLogBuffer> m_log;
+ NonnullRefPtr<IRCLogBuffer> m_log;
};
diff --git a/Applications/IRCClient/IRCWindow.h b/Applications/IRCClient/IRCWindow.h
index 2fce542fe5..8ea9fca189 100644
--- a/Applications/IRCClient/IRCWindow.h
+++ b/Applications/IRCClient/IRCWindow.h
@@ -49,6 +49,6 @@ private:
String m_name;
GTableView* m_table_view { nullptr };
GTextEditor* m_text_editor { nullptr };
- RetainPtr<IRCLogBuffer> m_log_buffer;
+ RefPtr<IRCLogBuffer> m_log_buffer;
int m_unread_count { 0 };
};
diff --git a/Applications/IRCClient/IRCWindowListModel.h b/Applications/IRCClient/IRCWindowListModel.h
index 47e4621c96..2828722840 100644
--- a/Applications/IRCClient/IRCWindowListModel.h
+++ b/Applications/IRCClient/IRCWindowListModel.h
@@ -12,7 +12,7 @@ public:
Name,
};
- static Retained<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); }
+ static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); }
virtual ~IRCWindowListModel() override;
virtual int row_count(const GModelIndex&) const override;
diff --git a/Applications/PaintBrush/PaintableWidget.h b/Applications/PaintBrush/PaintableWidget.h
index bd6cd4455b..81df54c9ec 100644
--- a/Applications/PaintBrush/PaintableWidget.h
+++ b/Applications/PaintBrush/PaintableWidget.h
@@ -32,7 +32,7 @@ private:
virtual void mouseup_event(GMouseEvent&) override;
virtual void mousemove_event(GMouseEvent&) override;
- RetainPtr<GraphicsBitmap> m_bitmap;
+ RefPtr<GraphicsBitmap> m_bitmap;
Color m_primary_color { Color::Black };
Color m_secondary_color { Color::White };
diff --git a/Applications/ProcessManager/ProcessModel.h b/Applications/ProcessManager/ProcessModel.h
index cebe524d26..6f74609dc4 100644
--- a/Applications/ProcessManager/ProcessModel.h
+++ b/Applications/ProcessManager/ProcessModel.h
@@ -25,7 +25,7 @@ public:
__Count
};
- static Retained<ProcessModel> create(GraphWidget& graph) { return adopt(*new ProcessModel(graph)); }
+ static NonnullRefPtr<ProcessModel> create(GraphWidget& graph) { return adopt(*new ProcessModel(graph)); }
virtual ~ProcessModel() override;
virtual int row_count(const GModelIndex&) const override;
@@ -61,9 +61,9 @@ private:
HashMap<uid_t, String> m_usernames;
HashMap<pid_t, OwnPtr<Process>> m_processes;
Vector<pid_t> m_pids;
- RetainPtr<GraphicsBitmap> m_generic_process_icon;
- RetainPtr<GraphicsBitmap> m_high_priority_icon;
- RetainPtr<GraphicsBitmap> m_low_priority_icon;
- RetainPtr<GraphicsBitmap> m_normal_priority_icon;
+ RefPtr<GraphicsBitmap> m_generic_process_icon;
+ RefPtr<GraphicsBitmap> m_high_priority_icon;
+ RefPtr<GraphicsBitmap> m_low_priority_icon;
+ RefPtr<GraphicsBitmap> m_normal_priority_icon;
CFile m_proc_all;
};
diff --git a/Applications/Taskbar/WindowList.h b/Applications/Taskbar/WindowList.h
index 12cefb52ab..406ec52e87 100644
--- a/Applications/Taskbar/WindowList.h
+++ b/Applications/Taskbar/WindowList.h
@@ -55,7 +55,7 @@ private:
Rect m_rect;
GButton* m_button { nullptr };
String m_icon_path;
- RetainPtr<GraphicsBitmap> m_icon;
+ RefPtr<GraphicsBitmap> m_icon;
bool m_active { false };
bool m_minimized { false };
};
diff --git a/Applications/Terminal/Terminal.cpp b/Applications/Terminal/Terminal.cpp
index 94720d8f62..3ba514fe73 100644
--- a/Applications/Terminal/Terminal.cpp
+++ b/Applications/Terminal/Terminal.cpp
@@ -19,7 +19,7 @@
byte Terminal::Attribute::default_foreground_color = 7;
byte Terminal::Attribute::default_background_color = 0;
-Terminal::Terminal(int ptm_fd, RetainPtr<CConfigFile> config)
+Terminal::Terminal(int ptm_fd, RefPtr<CConfigFile> config)
: m_ptm_fd(ptm_fd)
, m_notifier(ptm_fd, CNotifier::Read)
, m_config(config)
diff --git a/Applications/Terminal/Terminal.h b/Applications/Terminal/Terminal.h
index d631416bf6..388570589b 100644
--- a/Applications/Terminal/Terminal.h
+++ b/Applications/Terminal/Terminal.h
@@ -14,7 +14,7 @@ class Font;
class Terminal final : public GFrame {
public:
- explicit Terminal(int ptm_fd, RetainPtr<CConfigFile> config);
+ explicit Terminal(int ptm_fd, RefPtr<CConfigFile> config);
virtual ~Terminal() override;
void create_window();
@@ -30,7 +30,7 @@ public:
bool should_beep() { return m_should_beep; }
void set_should_beep(bool sb) { m_should_beep = sb; };
- RetainPtr<CConfigFile> config() const { return m_config; }
+ RefPtr<CConfigFile> config() const { return m_config; }
private:
typedef Vector<unsigned, 4> ParamVector;
@@ -205,7 +205,7 @@ private:
CTimer m_cursor_blink_timer;
CTimer m_visual_beep_timer;
- RetainPtr<CConfigFile> m_config;
+ RefPtr<CConfigFile> m_config;
byte m_last_char { 0 };
};
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp
index e78eb11332..eb94315263 100644
--- a/Applications/Terminal/main.cpp
+++ b/Applications/Terminal/main.cpp
@@ -81,7 +81,7 @@ static void make_shell(int ptm_fd)
}
}
-GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> config)
+GWindow* create_settings_window(Terminal& terminal, RefPtr<CConfigFile> config)
{
auto* window = new GWindow;
window->set_title("Terminal Settings");
@@ -149,7 +149,7 @@ int main(int argc, char** argv)
window->set_double_buffering_enabled(false);
window->set_should_exit_event_loop_on_close(true);
- RetainPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
+ RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal");
Terminal terminal(ptm_fd, config);
window->set_has_alpha_channel(true);
window->set_main_widget(&terminal);
diff --git a/Demos/Fire/Fire.cpp b/Demos/Fire/Fire.cpp
index 0407b9ffc3..f04f4c8d4b 100644
--- a/Demos/Fire/Fire.cpp
+++ b/Demos/Fire/Fire.cpp
@@ -69,7 +69,7 @@ public:
void set_stat_label(GLabel* l) { stats = l; };
private:
- RetainPtr<GraphicsBitmap> bitmap;
+ RefPtr<GraphicsBitmap> bitmap;
GLabel* stats;
virtual void paint_event(GPaintEvent&) override;
diff --git a/Demos/PaintTest/main.cpp b/Demos/PaintTest/main.cpp
index 4a2f9fd860..4914258943 100644
--- a/Demos/PaintTest/main.cpp
+++ b/Demos/PaintTest/main.cpp
@@ -12,7 +12,7 @@ public:
}
virtual ~TestWidget() override {}
- void set_bitmap(RetainPtr<GraphicsBitmap>&& bitmap)
+ void set_bitmap(RefPtr<GraphicsBitmap>&& bitmap)
{
m_bitmap = move(bitmap);
update();
@@ -31,7 +31,7 @@ private:
painter.blit_tiled({ 160, 160, 160, 160 }, *m_bitmap, m_bitmap->rect());
}
- RetainPtr<GraphicsBitmap> m_bitmap;
+ RefPtr<GraphicsBitmap> m_bitmap;
};
int main(int argc, char** argv)
diff --git a/DevTools/VisualBuilder/VBForm.h b/DevTools/VisualBuilder/VBForm.h
index 37ced0a651..8e610052a3 100644
--- a/DevTools/VisualBuilder/VBForm.h
+++ b/DevTools/VisualBuilder/VBForm.h
@@ -52,7 +52,7 @@ private:
String m_name;
int m_grid_size { 5 };
bool m_should_snap_to_grid { true };
- Vector<Retained<VBWidget>> m_widgets;
+ Vector<NonnullRefPtr<VBWidget>> m_widgets;
HashMap<GWidget*, VBWidget*> m_gwidget_map;
HashTable<VBWidget*> m_selected_widgets;
Point m_transform_event_origin;
diff --git a/DevTools/VisualBuilder/VBWidget.h b/DevTools/VisualBuilder/VBWidget.h
index e71e82efa8..2b6e43dc09 100644
--- a/DevTools/VisualBuilder/VBWidget.h
+++ b/DevTools/VisualBuilder/VBWidget.h
@@ -44,7 +44,7 @@ class VBWidget : public RefCounted<VBWidget>
friend class VBWidgetPropertyModel;
public:
- static Retained<VBWidget> create(VBWidgetType type, VBForm& form) { return adopt(*new VBWidget(type, form)); }
+ static NonnullRefPtr<VBWidget> create(VBWidgetType type, VBForm& form) { return adopt(*new VBWidget(type, form)); }
~VBWidget();
bool is_selected() const;
@@ -80,6 +80,6 @@ private:
VBForm& m_form;
GWidget* m_gwidget { nullptr };
Vector<OwnPtr<VBProperty>> m_properties;
- Retained<VBWidgetPropertyModel> m_property_model;
+ NonnullRefPtr<VBWidgetPropertyModel> m_property_model;
Rect m_transform_origin_rect;
};
diff --git a/DevTools/VisualBuilder/VBWidgetPropertyModel.h b/DevTools/VisualBuilder/VBWidgetPropertyModel.h
index b84bffc697..0653e818ae 100644
--- a/DevTools/VisualBuilder/VBWidgetPropertyModel.h
+++ b/DevTools/VisualBuilder/VBWidgetPropertyModel.h
@@ -13,7 +13,7 @@ public:
__Count
};
- static Retained<VBWidgetPropertyModel> create(VBWidget& widget) { return adopt(*new VBWidgetPropertyModel(widget)); }
+ static NonnullRefPtr<VBWidgetPropertyModel> create(VBWidget& widget) { return adopt(*new VBWidgetPropertyModel(widget)); }
virtual ~VBWidgetPropertyModel() override;
virtual int row_count(const GModelIndex&) const override;
diff --git a/Games/Minesweeper/Field.h b/Games/Minesweeper/Field.h
index 1725ceefda..cd557a2d97 100644
--- a/Games/Minesweeper/Field.h
+++ b/Games/Minesweeper/Field.h
@@ -83,14 +83,14 @@ private:
int m_mine_count { 10 };
int m_unswept_empties { 0 };
Vector<OwnPtr<Square>> m_squares;
- RetainPtr<GraphicsBitmap> m_mine_bitmap;
- RetainPtr<GraphicsBitmap> m_flag_bitmap;
- RetainPtr<GraphicsBitmap> m_badflag_bitmap;
- RetainPtr<GraphicsBitmap> m_consider_bitmap;
- RetainPtr<GraphicsBitmap> m_default_face_bitmap;
- RetainPtr<GraphicsBitmap> m_good_face_bitmap;
- RetainPtr<GraphicsBitmap> m_bad_face_bitmap;
- RetainPtr<GraphicsBitmap> m_number_bitmap[8];
+ RefPtr<GraphicsBitmap> m_mine_bitmap;
+ RefPtr<GraphicsBitmap> m_flag_bitmap;
+ RefPtr<GraphicsBitmap> m_badflag_bitmap;
+ RefPtr<GraphicsBitmap> m_consider_bitmap;
+ RefPtr<GraphicsBitmap> m_default_face_bitmap;
+ RefPtr<GraphicsBitmap> m_good_face_bitmap;
+ RefPtr<GraphicsBitmap> m_bad_face_bitmap;
+ RefPtr<GraphicsBitmap> m_number_bitmap[8];
GButton& m_face_button;
GLabel& m_flag_label;
GLabel& m_time_label;
diff --git a/Games/Snake/SnakeGame.h b/Games/Snake/SnakeGame.h
index 704e80c0d3..19cb36e722 100644
--- a/Games/Snake/SnakeGame.h
+++ b/Games/Snake/SnakeGame.h
@@ -59,5 +59,5 @@ private:
unsigned m_high_score { 0 };
String m_high_score_text;
- Vector<Retained<GraphicsBitmap>> m_fruit_bitmaps;
+ Vector<NonnullRefPtr<GraphicsBitmap>> m_fruit_bitmaps;
};
diff --git a/Kernel/Devices/DiskPartition.cpp b/Kernel/Devices/DiskPartition.cpp
index 34ebf00ea5..7fc60c733d 100644
--- a/Kernel/Devices/DiskPartition.cpp
+++ b/Kernel/Devices/DiskPartition.cpp
@@ -2,12 +2,12 @@
// #define OFFD_DEBUG
-Retained<DiskPartition> DiskPartition::create(Retained<DiskDevice>&& device, unsigned block_offset)
+NonnullRefPtr<DiskPartition> DiskPartition::create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset)
{
return adopt(*new DiskPartition(move(device), block_offset));
}
-DiskPartition::DiskPartition(Retained<DiskDevice>&& device, unsigned block_offset)
+DiskPartition::DiskPartition(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset)
: m_device(move(device))
, m_block_offset(block_offset)
{
diff --git a/Kernel/Devices/DiskPartition.h b/Kernel/Devices/DiskPartition.h
index c4e1b39ee9..7db12eefc2 100644
--- a/Kernel/Devices/DiskPartition.h
+++ b/Kernel/Devices/DiskPartition.h
@@ -5,7 +5,7 @@
class DiskPartition final : public DiskDevice {
public:
- static Retained<DiskPartition> create(Retained<DiskDevice>&& device, unsigned block_offset);
+ static NonnullRefPtr<DiskPartition> create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset);
virtual ~DiskPartition();
virtual unsigned block_size() const override;
@@ -17,8 +17,8 @@ public:
private:
virtual const char* class_name() const override;
- DiskPartition(Retained<DiskDevice>&&, unsigned);
+ DiskPartition(NonnullRefPtr<DiskDevice>&&, unsigned);
- Retained<DiskDevice> m_device;
+ NonnullRefPtr<DiskDevice> m_device;
unsigned m_block_offset;
};
diff --git a/Kernel/Devices/FileBackedDiskDevice.cpp b/Kernel/Devices/FileBackedDiskDevice.cpp
index b56aaff6d6..8b05e6e697 100644
--- a/Kernel/Devices/FileBackedDiskDevice.cpp
+++ b/Kernel/Devices/FileBackedDiskDevice.cpp
@@ -7,7 +7,7 @@
//#define FBBD_DEBUG
#define IGNORE_FILE_LENGTH // Useful for e.g /dev/hda2
-RetainPtr<FileBackedDiskDevice> FileBackedDiskDevice::create(String&& image_path, unsigned block_size)
+RefPtr<FileBackedDiskDevice> FileBackedDiskDevice::create(String&& image_path, unsigned block_size)
{
return adopt(*new FileBackedDiskDevice(move(image_path), block_size));
}
diff --git a/Kernel/Devices/FileBackedDiskDevice.h b/Kernel/Devices/FileBackedDiskDevice.h
index 667f3af427..580f3b531d 100644
--- a/Kernel/Devices/FileBackedDiskDevice.h
+++ b/Kernel/Devices/FileBackedDiskDevice.h
@@ -8,7 +8,7 @@
class FileBackedDiskDevice final : public DiskDevice {
public:
- static RetainPtr<FileBackedDiskDevice> create(String&& image_path, unsigned block_size);
+ static RefPtr<FileBackedDiskDevice> create(String&& image_path, unsigned block_size);
virtual ~FileBackedDiskDevice() override;
bool is_valid() const { return m_file; }
diff --git a/Kernel/Devices/IDEDiskDevice.cpp b/Kernel/Devices/IDEDiskDevice.cpp
index 4c50915e61..5778805981 100644
--- a/Kernel/Devices/IDEDiskDevice.cpp
+++ b/Kernel/Devices/IDEDiskDevice.cpp
@@ -78,7 +78,7 @@
#define ATA_REG_ALTSTATUS 0x0C
#define ATA_REG_DEVADDRESS 0x0D
-Retained<IDEDiskDevice> IDEDiskDevice::create()
+NonnullRefPtr<IDEDiskDevice> IDEDiskDevice::create()
{
return adopt(*new IDEDiskDevice);
}
diff --git a/Kernel/Devices/IDEDiskDevice.h b/Kernel/Devices/IDEDiskDevice.h
index 7f5cfbd99e..da5f491516 100644
--- a/Kernel/Devices/IDEDiskDevice.h
+++ b/Kernel/Devices/IDEDiskDevice.h
@@ -18,7 +18,7 @@ class IDEDiskDevice final : public IRQHandler
, public DiskDevice {
AK_MAKE_ETERNAL
public:
- static Retained<IDEDiskDevice> create();
+ static NonnullRefPtr<IDEDiskDevice> create();
virtual ~IDEDiskDevice() override;
// ^DiskDevice
@@ -55,7 +55,7 @@ private:
PCI::Address m_pci_address;
PhysicalRegionDescriptor m_prdt;
- RetainPtr<PhysicalPage> m_dma_buffer_page;
+ RefPtr<PhysicalPage> m_dma_buffer_page;
word m_bus_master_base { 0 };
Lockable<bool> m_dma_enabled;
};
diff --git a/Kernel/Devices/MBRPartitionTable.cpp b/Kernel/Devices/MBRPartitionTable.cpp
index b194855b3e..2d4f733c93 100644
--- a/Kernel/Devices/MBRPartitionTable.cpp
+++ b/Kernel/Devices/MBRPartitionTable.cpp
@@ -3,7 +3,7 @@
#define MBR_DEBUG
-MBRPartitionTable::MBRPartitionTable(Retained<DiskDevice>&& device)
+MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device)
: m_device(move(device))
{
}
@@ -37,7 +37,7 @@ bool MBRPartitionTable::initialize()
return true;
}
-RetainPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
+RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index)
{
ASSERT(index >= 1 && index <= 4);
diff --git a/Kernel/Devices/MBRPartitionTable.h b/Kernel/Devices/MBRPartitionTable.h
index a3ad937b2c..d5ca9b138f 100644
--- a/Kernel/Devices/MBRPartitionTable.h
+++ b/Kernel/Devices/MBRPartitionTable.h
@@ -31,14 +31,14 @@ class MBRPartitionTable {
AK_MAKE_ETERNAL
public:
- MBRPartitionTable(Retained<DiskDevice>&& device);
+ MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device);
~MBRPartitionTable();
bool initialize();
- RetainPtr<DiskPartition> partition(unsigned index);
+ RefPtr<DiskPartition> partition(unsigned index);
private:
- Retained<DiskDevice> m_device;
+ NonnullRefPtr<DiskDevice> m_device;
ByteBuffer read_header() const;
const MBRPartitionHeader& header() const;
diff --git a/Kernel/File.cpp b/Kernel/File.cpp
index b366c523b1..693b21ee74 100644
--- a/Kernel/File.cpp
+++ b/Kernel/File.cpp
@@ -9,7 +9,7 @@ File::~File()
{
}
-KResultOr<Retained<FileDescription>> File::open(int options)
+KResultOr<NonnullRefPtr<FileDescription>> File::open(int options)
{
UNUSED_PARAM(options);
return FileDescription::create(this);
diff --git a/Kernel/File.h b/Kernel/File.h
index ec81adbdf4..cc42cb2a44 100644
--- a/Kernel/File.h
+++ b/Kernel/File.h
@@ -43,7 +43,7 @@ class File : public RefCounted<File> {
public:
virtual ~File();
- virtual KResultOr<Retained<FileDescription>> open(int options);
+ virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options);
virtual void close();
virtual bool can_read(FileDescription&) const = 0;
diff --git a/Kernel/FileSystem/Custody.cpp b/Kernel/FileSystem/Custody.cpp
index 769d4c0de8..6e64359bfa 100644
--- a/Kernel/FileSystem/Custody.cpp
+++ b/Kernel/FileSystem/Custody.cpp
@@ -26,9 +26,9 @@ Custody* Custody::get_if_cached(Custody* parent, const String& name)
return nullptr;
}
-Retained<Custody> Custody::get_or_create(Custody* parent, const String& name, Inode& inode)
+NonnullRefPtr<Custody> Custody::get_or_create(Custody* parent, const String& name, Inode& inode)
{
- if (RetainPtr<Custody> cached_custody = get_if_cached(parent, name)) {
+ if (RefPtr<Custody> cached_custody = get_if_cached(parent, name)) {
if (&cached_custody->inode() != &inode) {
dbgprintf("WTF! cached custody for name '%s' has inode=%s, new inode=%s\n",
name.characters(),
diff --git a/Kernel/FileSystem/Custody.h b/Kernel/FileSystem/Custody.h
index 03c6fabdff..cc2ca004f1 100644
--- a/Kernel/FileSystem/Custody.h
+++ b/Kernel/FileSystem/Custody.h
@@ -13,8 +13,8 @@ class VFS;
class Custody : public RefCounted<Custody> {
public:
static Custody* get_if_cached(Custody* parent, const String& name);
- static Retained<Custody> get_or_create(Custody* parent, const String& name, Inode&);
- static Retained<Custody> create(Custody* parent, const String& name, Inode& inode)
+ static NonnullRefPtr<Custody> get_or_create(Custody* parent, const String& name, Inode&);
+ static NonnullRefPtr<Custody> create(Custody* parent, const String& name, Inode& inode)
{
return adopt(*new Custody(parent, name, inode));
}
@@ -38,9 +38,9 @@ public:
private:
Custody(Custody* parent, const String& name, Inode&);
- RetainPtr<Custody> m_parent;
+ RefPtr<Custody> m_parent;
String m_name;
- Retained<Inode> m_inode;
+ NonnullRefPtr<Inode> m_inode;
bool m_deleted { false };
bool m_mounted_on { false };
};
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index be3a0d6968..d376192511 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -11,7 +11,7 @@ DevPtsFS& DevPtsFS::the()
return *s_the;
}
-Retained<DevPtsFS> DevPtsFS::create()
+NonnullRefPtr<DevPtsFS> DevPtsFS::create()
{
return adopt(*new DevPtsFS);
}
@@ -36,7 +36,7 @@ const char* DevPtsFS::class_name() const
return "DevPtsFS";
}
-Retained<SynthFSInode> DevPtsFS::create_slave_pty_device_file(unsigned index)
+NonnullRefPtr<SynthFSInode> DevPtsFS::create_slave_pty_device_file(unsigned index)
{
auto file = adopt(*new SynthFSInode(*this, generate_inode_index()));
diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h
index fc638bd580..b285814cf5 100644
--- a/Kernel/FileSystem/DevPtsFS.h
+++ b/Kernel/FileSystem/DevPtsFS.h
@@ -11,7 +11,7 @@ public:
[[gnu::pure]] static DevPtsFS& the();
virtual ~DevPtsFS() override;
- static Retained<DevPtsFS> create();
+ static NonnullRefPtr<DevPtsFS> create();
virtual bool initialize() override;
virtual const char* class_name() const override;
@@ -22,7 +22,7 @@ public:
private:
DevPtsFS();
- Retained<SynthFSInode> create_slave_pty_device_file(unsigned index);
+ NonnullRefPtr<SynthFSInode> create_slave_pty_device_file(unsigned index);
HashTable<SlavePTY*> m_slave_ptys;
};
diff --git a/Kernel/FileSystem/DiskBackedFileSystem.cpp b/Kernel/FileSystem/DiskBackedFileSystem.cpp
index 413e4931ed..afb4a8cc5f 100644
--- a/Kernel/FileSystem/DiskBackedFileSystem.cpp
+++ b/Kernel/FileSystem/DiskBackedFileSystem.cpp
@@ -45,7 +45,7 @@ Lockable<InlineLRUCache<BlockIdentifier, CachedBlock>>& block_cache()
return *s_cache;
}
-DiskBackedFS::DiskBackedFS(Retained<DiskDevice>&& device)
+DiskBackedFS::DiskBackedFS(NonnullRefPtr<DiskDevice>&& device)
: m_device(move(device))
{
}
diff --git a/Kernel/FileSystem/DiskBackedFileSystem.h b/Kernel/FileSystem/DiskBackedFileSystem.h
index b115eb6d12..8f75435e71 100644
--- a/Kernel/FileSystem/DiskBackedFileSystem.h
+++ b/Kernel/FileSystem/DiskBackedFileSystem.h
@@ -15,7 +15,7 @@ public:
virtual void flush_writes() override;
protected:
- explicit DiskBackedFS(Retained<DiskDevice>&&);
+ explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
void set_block_size(unsigned);
@@ -27,7 +27,7 @@ protected:
private:
int m_block_size { 0 };
- Retained<DiskDevice> m_device;
+ NonnullRefPtr<DiskDevice> m_device;
HashMap<unsigned, ByteBuffer> m_write_cache;
};
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index c9ea7b06bc..ce7cefcc48 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -31,12 +31,12 @@ static byte to_ext2_file_type(mode_t mode)
return EXT2_FT_UNKNOWN;
}
-Retained<Ext2FS> Ext2FS::create(Retained<DiskDevice>&& device)
+NonnullRefPtr<Ext2FS> Ext2FS::create(NonnullRefPtr<DiskDevice>&& device)
{
return adopt(*new Ext2FS(move(device)));
}
-Ext2FS::Ext2FS(Retained<DiskDevice>&& device)
+Ext2FS::Ext2FS(NonnullRefPtr<DiskDevice>&& device)
: DiskBackedFS(move(device))
{
}
@@ -448,7 +448,7 @@ void Ext2FSInode::flush_metadata()
set_metadata_dirty(false);
}
-RetainPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const
+RefPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const
{
LOCKER(m_lock);
ASSERT(inode.fsid() == fsid());
@@ -1085,7 +1085,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state)
return true;
}
-RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const String& name, mode_t mode, int& error)
+RefPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const String& name, mode_t mode, int& error)
{
LOCKER(m_lock);
ASSERT(parent_id.fsid() == fsid());
@@ -1125,7 +1125,7 @@ RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const Strin
return inode;
}
-RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, dev_t dev, int& error)
+RefPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, dev_t dev, int& error)
{
LOCKER(m_lock);
ASSERT(parent_id.fsid() == fsid());
diff --git a/Kernel/FileSystem/Ext2FileSystem.h b/Kernel/FileSystem/Ext2FileSystem.h
index 7ef3d10240..64349ee1a2 100644
--- a/Kernel/FileSystem/Ext2FileSystem.h
+++ b/Kernel/FileSystem/Ext2FileSystem.h
@@ -60,7 +60,7 @@ class Ext2FS final : public DiskBackedFS {
friend class Ext2FSInode;
public:
- static Retained<Ext2FS> create(Retained<DiskDevice>&&);
+ static NonnullRefPtr<Ext2FS> create(NonnullRefPtr<DiskDevice>&&);
virtual ~Ext2FS() override;
virtual bool initialize() override;
@@ -73,7 +73,7 @@ private:
typedef unsigned BlockIndex;
typedef unsigned GroupIndex;
typedef unsigned InodeIndex;
- explicit Ext2FS(Retained<DiskDevice>&&);
+ explicit Ext2FS(NonnullRefPtr<DiskDevice>&&);
const ext2_super_block& super_block() const;
const ext2_group_desc& group_descriptor(unsigned groupIndex) const;
@@ -92,9 +92,9 @@ private:
virtual const char* class_name() const override;
virtual InodeIdentifier root_inode() const override;
- virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override;
- virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override;
- virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override;
+ virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override;
+ virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override;
+ virtual RefPtr<Inode> get_inode(InodeIdentifier) const override;
InodeIndex allocate_inode(GroupIndex preferred_group, off_t expected_size);
Vector<BlockIndex> allocate_blocks(GroupIndex, int count);
@@ -126,7 +126,7 @@ private:
mutable ByteBuffer m_cached_super_block;
mutable ByteBuffer m_cached_group_descriptor_table;
- mutable HashMap<BlockIndex, RetainPtr<Ext2FSInode>> m_inode_cache;
+ mutable HashMap<BlockIndex, RefPtr<Ext2FSInode>> m_inode_cache;
};
inline Ext2FS& Ext2FSInode::fs()
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index 6e1f081848..c2d0184377 100644
--- a/Kernel/FileSystem/FIFO.cpp
+++ b/Kernel/FileSystem/FIFO.cpp
@@ -16,7 +16,7 @@ Lockable<HashTable<FIFO*>>& all_fifos()
return *s_table;
}
-RetainPtr<FIFO> FIFO::from_fifo_id(dword id)
+RefPtr<FIFO> FIFO::from_fifo_id(dword id)
{
auto* ptr = reinterpret_cast<FIFO*>(id);
LOCKER(all_fifos().lock());
@@ -25,12 +25,12 @@ RetainPtr<FIFO> FIFO::from_fifo_id(dword id)
return ptr;
}
-Retained<FIFO> FIFO::create(uid_t uid)
+NonnullRefPtr<FIFO> FIFO::create(uid_t uid)
{
return adopt(*new FIFO(uid));
}
-Retained<FileDescription> FIFO::open_direction(FIFO::Direction direction)
+NonnullRefPtr<FileDescription> FIFO::open_direction(FIFO::Direction direction)
{
auto description = FileDescription::create(this);
attach(direction);
diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h
index baad9bd8a1..73a3915ba0 100644
--- a/Kernel/FileSystem/FIFO.h
+++ b/Kernel/FileSystem/FIFO.h
@@ -14,14 +14,14 @@ public:
Writer
};
- static RetainPtr<FIFO> from_fifo_id(dword);
+ static RefPtr<FIFO> from_fifo_id(dword);
- static Retained<FIFO> create(uid_t);
+ static NonnullRefPtr<FIFO> create(uid_t);
virtual ~FIFO() override;
uid_t uid() const { return m_uid; }
- Retained<FileDescription> open_direction(Direction);
+ NonnullRefPtr<FileDescription> open_direction(Direction);
void attach(Direction);
void detach(Direction);
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index a75ec14259..d6c75a8fb6 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -15,19 +15,19 @@
#include <Kernel/VM/MemoryManager.h>
#include <LibC/errno_numbers.h>
-Retained<FileDescription> FileDescription::create(RetainPtr<Custody>&& custody)
+NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<Custody>&& custody)
{
auto description = adopt(*new FileDescription(InodeFile::create(custody->inode())));
description->m_custody = move(custody);
return description;
}
-Retained<FileDescription> FileDescription::create(RetainPtr<File>&& file, SocketRole role)
+NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<File>&& file, SocketRole role)
{
return adopt(*new FileDescription(move(file), role));
}
-FileDescription::FileDescription(RetainPtr<File>&& file, SocketRole role)
+FileDescription::FileDescription(RefPtr<File>&& file, SocketRole role)
: m_file(move(file))
{
if (m_file->is_inode())
@@ -58,9 +58,9 @@ void FileDescription::set_socket_role(SocketRole role)
socket()->attach(*this);
}
-Retained<FileDescription> FileDescription::clone()
+NonnullRefPtr<FileDescription> FileDescription::clone()
{
- RetainPtr<FileDescription> description;
+ RefPtr<FileDescription> description;
if (is_fifo()) {
description = fifo()->open_direction(m_fifo_direction);
} else {
diff --git a/Kernel/FileSystem/FileDescription.h b/Kernel/FileSystem/FileDescription.h
index 2cffc5169a..b856eff045 100644
--- a/Kernel/FileSystem/FileDescription.h
+++ b/Kernel/FileSystem/FileDescription.h
@@ -21,11 +21,11 @@ class SharedMemory;
class FileDescription : public RefCounted<FileDescription> {
public:
- static Retained<FileDescription> create(RetainPtr<Custody>&&);
- static Retained<FileDescription> create(RetainPtr<File>&&, SocketRole = SocketRole::None);
+ static NonnullRefPtr<FileDescription> create(RefPtr<Custody>&&);
+ static NonnullRefPtr<FileDescription> create(RefPtr<File>&&, SocketRole = SocketRole::None);
~FileDescription();
- Retained<FileDescription> clone();
+ NonnullRefPtr<FileDescription> clone();
int close();
@@ -92,7 +92,7 @@ public:
ByteBuffer& generator_cache() { return m_generator_cache; }
- void set_original_inode(Badge<VFS>, Retained<Inode>&& inode) { m_inode = move(inode); }
+ void set_original_inode(Badge<VFS>, NonnullRefPtr<Inode>&& inode) { m_inode = move(inode); }
SocketRole socket_role() const { return m_socket_role; }
void set_socket_role(SocketRole);
@@ -105,12 +105,12 @@ public:
private:
friend class VFS;
- FileDescription(RetainPtr<File>&&, SocketRole = SocketRole::None);
+ FileDescription(RefPtr<File>&&, SocketRole = SocketRole::None);
FileDescription(FIFO&, FIFO::Direction);
- RetainPtr<Custody> m_custody;
- RetainPtr<Inode> m_inode;
- RetainPtr<File> m_file;
+ RefPtr<Custody> m_custody;
+ RefPtr<Inode> m_inode;
+ RefPtr<File> m_file;
off_t m_current_offset { 0 };
diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp
index 95a4f47093..885087fbef 100644
--- a/Kernel/FileSystem/FileSystem.cpp
+++ b/Kernel/FileSystem/FileSystem.cpp
@@ -58,7 +58,7 @@ void FS::sync()
{
Inode::sync();
- Vector<Retained<FS>, 32> fses;
+ Vector<NonnullRefPtr<FS>, 32> fses;
{
InterruptDisabler disabler;
for (auto& it : all_fses())
diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h
index 3e9fcc6314..c9ad4b5dcb 100644
--- a/Kernel/FileSystem/FileSystem.h
+++ b/Kernel/FileSystem/FileSystem.h
@@ -54,10 +54,10 @@ public:
byte file_type { 0 };
};
- virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) = 0;
- virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) = 0;
+ virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) = 0;
+ virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) = 0;
- virtual RetainPtr<Inode> get_inode(InodeIdentifier) const = 0;
+ virtual RefPtr<Inode> get_inode(InodeIdentifier) const = 0;
virtual void flush_writes() {}
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index ef4fbe8207..57cd4af8e1 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -13,7 +13,7 @@ HashTable<Inode*>& all_inodes()
void Inode::sync()
{
- Vector<Retained<Inode>, 32> inodes;
+ Vector<NonnullRefPtr<Inode>, 32> inodes;
{
InterruptDisabler disabler;
for (auto* inode : all_inodes()) {
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index c7d3baf274..f3b769710f 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -85,6 +85,6 @@ private:
FS& m_fs;
unsigned m_index { 0 };
WeakPtr<VMObject> m_vmo;
- RetainPtr<LocalSocket> m_socket;
+ RefPtr<LocalSocket> m_socket;
bool m_metadata_dirty { false };
};
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index 5dee202e68..7617636486 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -4,7 +4,7 @@
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Process.h>
-InodeFile::InodeFile(Retained<Inode>&& inode)
+InodeFile::InodeFile(NonnullRefPtr<Inode>&& inode)
: m_inode(move(inode))
{
}
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index 73f1f2444f..f4bbe7b48d 100644
--- a/Kernel/FileSystem/InodeFile.h
+++ b/Kernel/FileSystem/InodeFile.h
@@ -6,7 +6,7 @@ class Inode;
class InodeFile final : public File {
public:
- static Retained<InodeFile> create(Retained<Inode>&& inode)
+ static NonnullRefPtr<InodeFile> create(NonnullRefPtr<Inode>&& inode)
{
return adopt(*new InodeFile(move(inode)));
}
@@ -33,6 +33,6 @@ public:
virtual bool is_inode() const override { return true; }
private:
- explicit InodeFile(Retained<Inode>&&);
- Retained<Inode> m_inode;
+ explicit InodeFile(NonnullRefPtr<Inode>&&);
+ NonnullRefPtr<Inode> m_inode;
};
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index 95ad22096b..06f6cb3f1d 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -174,7 +174,7 @@ ProcFS& ProcFS::the()
return *s_the;
}
-Retained<ProcFS> ProcFS::create()
+NonnullRefPtr<ProcFS> ProcFS::create()
{
return adopt(*new ProcFS);
}
@@ -614,7 +614,7 @@ ByteBuffer procfs$inodes(InodeIdentifier)
extern HashTable<Inode*>& all_inodes();
StringBuilder builder;
for (auto it : all_inodes()) {
- RetainPtr<Inode> inode = *it;
+ RefPtr<Inode> inode = *it;
builder.appendf("Inode{K%x} %02u:%08u (%u)\n", inode.ptr(), inode->fsid(), inode->index(), inode->ref_count());
}
return builder.to_byte_buffer();
@@ -747,13 +747,13 @@ const char* ProcFS::class_name() const
return "ProcFS";
}
-RetainPtr<Inode> ProcFS::create_inode(InodeIdentifier, const String&, mode_t, off_t, dev_t, int&)
+RefPtr<Inode> ProcFS::create_inode(InodeIdentifier, const String&, mode_t, off_t, dev_t, int&)
{
kprintf("FIXME: Implement ProcFS::create_inode()?\n");
return {};
}
-RetainPtr<Inode> ProcFS::create_directory(InodeIdentifier, const String&, mode_t, int& error)
+RefPtr<Inode> ProcFS::create_directory(InodeIdentifier, const String&, mode_t, int& error)
{
error = -EROFS;
return nullptr;
@@ -764,7 +764,7 @@ InodeIdentifier ProcFS::root_inode() const
return { fsid(), FI_Root };
}
-RetainPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const
+RefPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const
{
#ifdef PROCFS_DEBUG
dbgprintf("ProcFS::get_inode(%u)\n", inode_id.index());
diff --git a/Kernel/FileSystem/ProcFS.h b/Kernel/FileSystem/ProcFS.h
index 5b3e82969c..2976253556 100644
--- a/Kernel/FileSystem/ProcFS.h
+++ b/Kernel/FileSystem/ProcFS.h
@@ -16,16 +16,16 @@ public:
[[gnu::pure]] static ProcFS& the();
virtual ~ProcFS() override;
- static Retained<ProcFS> create();
+ static NonnullRefPtr<ProcFS> create();
virtual bool initialize() override;
virtual const char* class_name() const override;
virtual InodeIdentifier root_inode() const override;
- virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override;
+ virtual RefPtr<Inode> get_inode(InodeIdentifier) const override;
- virtual RetainPtr<Inode> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, int& error) override;
- virtual RetainPtr<Inode> create_directory(InodeIdentifier parent_id, const String& name, mode_t, int& error) override;
+ virtual RefPtr<Inode> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, int& error) override;
+ virtual RefPtr<Inode> create_directory(InodeIdentifier parent_id, const String& name, mode_t, int& error) override;
void add_sys_file(String&&, Function<ByteBuffer(ProcFSInode&)>&& read_callback, Function<ssize_t(ProcFSInode&, const ByteBuffer&)>&& write_callback);
void add_sys_bool(String&&, Lockable<bool>&, Function<void()>&& notify_callback = nullptr);
@@ -36,7 +36,7 @@ private:
struct ProcFSDirectoryEntry {
ProcFSDirectoryEntry() {}
- ProcFSDirectoryEntry(const char* a_name, unsigned a_proc_file_type, Function<ByteBuffer(InodeIdentifier)>&& a_read_callback = nullptr, Function<ssize_t(InodeIdentifier, const ByteBuffer&)>&& a_write_callback = nullptr, RetainPtr<ProcFSInode>&& a_inode = nullptr)
+ ProcFSDirectoryEntry(const char* a_name, unsigned a_proc_file_type, Function<ByteBuffer(InodeIdentifier)>&& a_read_callback = nullptr, Function<ssize_t(InodeIdentifier, const ByteBuffer&)>&& a_write_callback = nullptr, RefPtr<ProcFSInode>&& a_inode = nullptr)
: name(a_name)
, proc_file_type(a_proc_file_type)
, read_callback(move(a_read_callback))
@@ -49,7 +49,7 @@ private:
unsigned proc_file_type { 0 };
Function<ByteBuffer(InodeIdentifier)> read_callback;
Function<ssize_t(InodeIdentifier, const ByteBuffer&)> write_callback;
- RetainPtr<ProcFSInode> inode;
+ RefPtr<ProcFSInode> inode;
InodeIdentifier identifier(unsigned fsid) const;
};
@@ -60,7 +60,7 @@ private:
mutable Lock m_inodes_lock;
mutable HashMap<unsigned, ProcFSInode*> m_inodes;
- RetainPtr<ProcFSInode> m_root_inode;
+ RefPtr<ProcFSInode> m_root_inode;
Lockable<bool> m_kmalloc_stack_helper;
};
diff --git a/Kernel/FileSystem/SyntheticFileSystem.cpp b/Kernel/FileSystem/SyntheticFileSystem.cpp
index 62ea9c55fd..d884fd0e3d 100644
--- a/Kernel/FileSystem/SyntheticFileSystem.cpp
+++ b/Kernel/FileSystem/SyntheticFileSystem.cpp
@@ -5,7 +5,7 @@
//#define SYNTHFS_DEBUG
-Retained<SynthFS> SynthFS::create()
+NonnullRefPtr<SynthFS> SynthFS::create()
{
return adopt(*new SynthFS);
}
@@ -33,7 +33,7 @@ bool SynthFS::initialize()
return true;
}
-Retained<SynthFSInode> SynthFS::create_directory(String&& name)
+NonnullRefPtr<SynthFSInode> SynthFS::create_directory(String&& name)
{
auto file = adopt(*new SynthFSInode(*this, generate_inode_index()));
file->m_name = move(name);
@@ -45,7 +45,7 @@ Retained<SynthFSInode> SynthFS::create_directory(String&& name)
return file;
}
-Retained<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& contents, mode_t mode)
+NonnullRefPtr<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& contents, mode_t mode)
{
auto file = adopt(*new SynthFSInode(*this, generate_inode_index()));
file->m_data = contents;
@@ -58,7 +58,7 @@ Retained<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& con
return file;
}
-Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& generator, mode_t mode)
+NonnullRefPtr<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& generator, mode_t mode)
{
auto file = adopt(*new SynthFSInode(*this, generate_inode_index()));
file->m_generator = move(generator);
@@ -71,7 +71,7 @@ Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<By
return file;
}
-Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& read_callback, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&& write_callback, mode_t mode)
+NonnullRefPtr<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& read_callback, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&& write_callback, mode_t mode)
{
auto file = adopt(*new SynthFSInode(*this, generate_inode_index()));
file->m_generator = move(read_callback);
@@ -85,7 +85,7 @@ Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<By
return file;
}
-InodeIdentifier SynthFS::add_file(RetainPtr<SynthFSInode>&& file, InodeIndex parent)
+InodeIdentifier SynthFS::add_file(RefPtr<SynthFSInode>&& file, InodeIndex parent)
{
LOCKER(m_lock);
ASSERT(file);
@@ -138,7 +138,7 @@ InodeIdentifier SynthFS::root_inode() const
return { fsid(), 1 };
}
-RetainPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String& name, mode_t mode, off_t size, dev_t, int& error)
+RefPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String& name, mode_t mode, off_t size, dev_t, int& error)
{
(void)parentInode;
(void)name;
@@ -149,7 +149,7 @@ RetainPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String
return {};
}
-RetainPtr<Inode> SynthFS::create_directory(InodeIdentifier, const String&, mode_t, int& error)
+RefPtr<Inode> SynthFS::create_directory(InodeIdentifier, const String&, mode_t, int& error)
{
error = -EROFS;
return nullptr;
@@ -161,7 +161,7 @@ auto SynthFS::generate_inode_index() -> InodeIndex
return m_next_inode_index++;
}
-RetainPtr<Inode> SynthFS::get_inode(InodeIdentifier inode) const
+RefPtr<Inode> SynthFS::get_inode(InodeIdentifier inode) const
{
LOCKER(m_lock);
auto it = m_inodes.find(inode.index());
diff --git a/Kernel/FileSystem/SyntheticFileSystem.h b/Kernel/FileSystem/SyntheticFileSystem.h
index 5a46f85a87..15e5dc9a21 100644
--- a/Kernel/FileSystem/SyntheticFileSystem.h
+++ b/Kernel/FileSystem/SyntheticFileSystem.h
@@ -10,14 +10,14 @@ class SynthFSInode;
class SynthFS : public FS {
public:
virtual ~SynthFS() override;
- static Retained<SynthFS> create();
+ static NonnullRefPtr<SynthFS> create();
virtual bool initialize() override;
virtual const char* class_name() const override;
virtual InodeIdentifier root_inode() const override;
- virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override;
- virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override;
- virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override;
+ virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override;
+ virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override;
+ virtual RefPtr<Inode> get_inode(InodeIdentifier) const override;
protected:
typedef unsigned InodeIndex;
@@ -27,17 +27,17 @@ protected:
SynthFS();
- Retained<SynthFSInode> create_directory(String&& name);
- Retained<SynthFSInode> create_text_file(String&& name, ByteBuffer&&, mode_t = 0010644);
- Retained<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, mode_t = 0100644);
- Retained<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&&, mode_t = 0100644);
+ NonnullRefPtr<SynthFSInode> create_directory(String&& name);
+ NonnullRefPtr<SynthFSInode> create_text_file(String&& name, ByteBuffer&&, mode_t = 0010644);
+ NonnullRefPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, mode_t = 0100644);
+ NonnullRefPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&&, mode_t = 0100644);
- InodeIdentifier add_file(RetainPtr<SynthFSInode>&&, InodeIndex parent = RootInodeIndex);
+ InodeIdentifier add_file(RefPtr<SynthFSInode>&&, InodeIndex parent = RootInodeIndex);
bool remove_file(InodeIndex);
private:
InodeIndex m_next_inode_index { 2 };
- HashMap<InodeIndex, RetainPtr<SynthFSInode>> m_inodes;
+ HashMap<InodeIndex, RefPtr<SynthFSInode>> m_inodes;
};
struct SynthFSInodeCustomData {
diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp
index 296821094e..9d0b126813 100644
--- a/Kernel/FileSystem/VirtualFileSystem.cpp
+++ b/Kernel/FileSystem/VirtualFileSystem.cpp
@@ -36,7 +36,7 @@ InodeIdentifier VFS::root_inode_id() const
return m_root_inode->identifier();
}
-bool VFS::mount(Retained<FS>&& file_system, StringView path)
+bool VFS::mount(NonnullRefPtr<FS>&& file_system, StringView path)
{
auto result = resolve_path(path, root_custody());
if (result.is_error()) {
@@ -53,7 +53,7 @@ bool VFS::mount(Retained<FS>&& file_system, StringView path)
return true;
}
-bool VFS::mount_root(Retained<FS>&& file_system)
+bool VFS::mount_root(NonnullRefPtr<FS>&& file_system)
{
if (m_root_inode) {
kprintf("VFS: mount_root can't mount another root\n");
@@ -149,9 +149,9 @@ KResult VFS::stat(StringView path, int options, Custody& base, struct stat& stat
return custody_or_error.value()->inode().metadata().stat(statbuf);
}
-KResultOr<Retained<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base)
+KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base)
{
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto custody_or_error = resolve_path(path, base, &parent_custody, options);
if (options & O_CREAT) {
if (!parent_custody)
@@ -208,7 +208,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
if (!is_regular_file(mode) && !is_block_device(mode) && !is_character_device(mode) && !is_fifo(mode) && !is_socket(mode))
return KResult(-EINVAL);
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto existing_file_or_error = resolve_path(path, base, &parent_custody);
if (!existing_file_or_error.is_error())
return KResult(-EEXIST);
@@ -230,7 +230,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
return KSuccess;
}
-KResultOr<Retained<FileDescription>> VFS::create(StringView path, int options, mode_t mode, Custody& parent_custody)
+KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int options, mode_t mode, Custody& parent_custody)
{
(void)options;
@@ -255,7 +255,7 @@ KResultOr<Retained<FileDescription>> VFS::create(StringView path, int options, m
KResult VFS::mkdir(StringView path, mode_t mode, Custody& base)
{
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto result = resolve_path(path, base, &parent_custody);
if (!result.is_error())
return KResult(-EEXIST);
@@ -300,7 +300,7 @@ KResult VFS::access(StringView path, int mode, Custody& base)
return KSuccess;
}
-KResultOr<Retained<Custody>> VFS::open_directory(StringView path, Custody& base)
+KResultOr<NonnullRefPtr<Custody>> VFS::open_directory(StringView path, Custody& base)
{
auto inode_or_error = resolve_path(path, base);
if (inode_or_error.is_error())
@@ -339,14 +339,14 @@ KResult VFS::chmod(StringView path, mode_t mode, Custody& base)
KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
{
- RetainPtr<Custody> old_parent_custody;
+ RefPtr<Custody> old_parent_custody;
auto old_custody_or_error = resolve_path(old_path, base, &old_parent_custody);
if (old_custody_or_error.is_error())
return old_custody_or_error.error();
auto& old_custody = *old_custody_or_error.value();
auto& old_inode = old_custody.inode();
- RetainPtr<Custody> new_parent_custody;
+ RefPtr<Custody> new_parent_custody;
auto new_custody_or_error = resolve_path(new_path, base, &new_parent_custody);
if (new_custody_or_error.is_error()) {
if (new_custody_or_error.error() != -ENOENT)
@@ -445,7 +445,7 @@ KResult VFS::link(StringView old_path, StringView new_path, Custody& base)
auto& old_custody = *old_custody_or_error.value();
auto& old_inode = old_custody.inode();
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto new_custody_or_error = resolve_path(new_path, base, &parent_custody);
if (!new_custody_or_error.is_error())
return KResult(-EEXIST);
@@ -469,7 +469,7 @@ KResult VFS::link(StringView old_path, StringView new_path, Custody& base)
KResult VFS::unlink(StringView path, Custody& base)
{
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto custody_or_error = resolve_path(path, base, &parent_custody);
if (custody_or_error.is_error())
return custody_or_error.error();
@@ -498,7 +498,7 @@ KResult VFS::unlink(StringView path, Custody& base)
KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
{
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto existing_custody_or_error = resolve_path(linkpath, base, &parent_custody);
if (!existing_custody_or_error.is_error())
return KResult(-EEXIST);
@@ -524,7 +524,7 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
KResult VFS::rmdir(StringView path, Custody& base)
{
- RetainPtr<Custody> parent_custody;
+ RefPtr<Custody> parent_custody;
auto custody_or_error = resolve_path(path, base, &parent_custody);
if (custody_or_error.is_error())
return KResult(custody_or_error.error());
@@ -559,14 +559,14 @@ KResult VFS::rmdir(StringView path, Custody& base)
return parent_inode.remove_child(FileSystemPath(path).basename());
}
-RetainPtr<Inode> VFS::get_inode(InodeIdentifier inode_id)
+RefPtr<Inode> VFS::get_inode(InodeIdentifier inode_id)
{
if (!inode_id.is_valid())
return nullptr;
return inode_id.fs()->get_inode(inode_id);
}
-VFS::Mount::Mount(RetainPtr<Custody>&& host_custody, Retained<FS>&& guest_fs)
+VFS::Mount::Mount(RefPtr<Custody>&& host_custody, NonnullRefPtr<FS>&& guest_fs)
: m_guest(guest_fs->root_inode())
, m_guest_fs(move(guest_fs))
, m_host_custody(move(host_custody))
@@ -624,7 +624,7 @@ Custody& VFS::root_custody()
return *m_root_custody;
}
-KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, RetainPtr<Custody>* parent_custody, int options)
+KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& base, RefPtr<Custody>* parent_custody, int options)
{
if (path.is_empty())
return KResult(-EINVAL);
@@ -632,7 +632,7 @@ KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, R
auto parts = path.split_view('/');
InodeIdentifier crumb_id;
- Vector<Retained<Custody>, 32> custody_chain;
+ Vector<NonnullRefPtr<Custody>, 32> custody_chain;
if (path[0] == '/') {
custody_chain.append(root_custody());
diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h
index c1f2e20860..595e75cb86 100644
--- a/Kernel/FileSystem/VirtualFileSystem.h
+++ b/Kernel/FileSystem/VirtualFileSystem.h
@@ -35,7 +35,7 @@ class VFS {
public:
class Mount {
public:
- Mount(RetainPtr<Custody>&&, Retained<FS>&&);
+ Mount(RefPtr<Custody>&&, NonnullRefPtr<FS>&&);
InodeIdentifier host() const;
InodeIdentifier guest() const { return m_guest; }
@@ -47,8 +47,8 @@ public:
private:
InodeIdentifier m_host;
InodeIdentifier m_guest;
- Retained<FS> m_guest_fs;
- RetainPtr<Custody> m_host_custody;
+ NonnullRefPtr<FS> m_guest_fs;
+ RefPtr<Custody> m_host_custody;
};
[[gnu::pure]] static VFS& the();
@@ -56,12 +56,12 @@ public:
VFS();
~VFS();
- bool mount_root(Retained<FS>&&);
- bool mount(Retained<FS>&&, StringView path);
+ bool mount_root(NonnullRefPtr<FS>&&);
+ bool mount(NonnullRefPtr<FS>&&, StringView path);
- KResultOr<Retained<FileDescription>> open(RetainPtr<Device>&&, int options);
- KResultOr<Retained<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base);
- KResultOr<Retained<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody);
+ KResultOr<NonnullRefPtr<FileDescription>> open(RefPtr<Device>&&, int options);
+ KResultOr<NonnullRefPtr<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base);
+ KResultOr<NonnullRefPtr<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody);
KResult mkdir(StringView path, mode_t mode, Custody& base);
KResult link(StringView old_path, StringView new_path, Custody& base);
KResult unlink(StringView path, Custody& base);
@@ -76,7 +76,7 @@ public:
KResult utime(StringView path, Custody& base, time_t atime, time_t mtime);
KResult rename(StringView oldpath, StringView newpath, Custody& base);
KResult mknod(StringView path, mode_t, dev_t, Custody& base);
- KResultOr<Retained<Custody>> open_directory(StringView path, Custody& base);
+ KResultOr<NonnullRefPtr<Custody>> open_directory(StringView path, Custody& base);
void register_device(Badge<Device>, Device&);
void unregister_device(Badge<Device>, Device&);
@@ -91,12 +91,12 @@ public:
Device* get_device(unsigned major, unsigned minor);
Custody& root_custody();
- KResultOr<Retained<Custody>> resolve_path(StringView path, Custody& base, RetainPtr<Custody>* parent = nullptr, int options = 0);
+ KResultOr<NonnullRefPtr<Custody>> resolve_path(StringView path, Custody& base, RefPtr<Custody>* parent = nullptr, int options = 0);
private:
friend class FileDescription;
- RetainPtr<Inode> get_inode(InodeIdentifier);
+ RefPtr<Inode> get_inode(InodeIdentifier);
bool is_vfs_root(InodeIdentifier) const;
@@ -105,9 +105,9 @@ private:
Mount* find_mount_for_host(InodeIdentifier);
Mount* find_mount_for_guest(InodeIdentifier);
- RetainPtr<Inode> m_root_inode;
+ RefPtr<Inode> m_root_inode;
Vector<OwnPtr<Mount>> m_mounts;
HashMap<dword, Device*> m_devices;
- RetainPtr<Custody> m_root_custody;
+ RefPtr<Custody> m_root_custody;
};
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 0b205b191a..95ea2a4d19 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -23,7 +23,7 @@ Lockable<HashTable<IPv4Socket*>>& IPv4Socket::all_sockets()
return *s_table;
}
-Retained<IPv4Socket> IPv4Socket::create(int type, int protocol)
+NonnullRefPtr<IPv4Socket> IPv4Socket::create(int type, int protocol)
{
if (type == SOCK_STREAM)
return TCPSocket::create(protocol);
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index dea6b5c171..e983bf8bc3 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -15,7 +15,7 @@ class TCPSocket;
class IPv4Socket : public Socket {
public:
- static Retained<IPv4Socket> create(int type, int protocol);
+ static NonnullRefPtr<IPv4Socket> create(int type, int protocol);
virtual ~IPv4Socket() override;
static Lockable<HashTable<IPv4Socket*>>& all_sockets();
@@ -88,7 +88,7 @@ class IPv4SocketHandle : public SocketHandle {
public:
IPv4SocketHandle() {}
- IPv4SocketHandle(RetainPtr<IPv4Socket>&& socket)
+ IPv4SocketHandle(RefPtr<IPv4Socket>&& socket)
: SocketHandle(move(socket))
{
}
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 95fcc6b940..57e13a4a3a 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -7,7 +7,7 @@
//#define DEBUG_LOCAL_SOCKET
-Retained<LocalSocket> LocalSocket::create(int type)
+NonnullRefPtr<LocalSocket> LocalSocket::create(int type)
{
return adopt(*new LocalSocket(type));
}
diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h
index f1ac23719b..4d348e8435 100644
--- a/Kernel/Net/LocalSocket.h
+++ b/Kernel/Net/LocalSocket.h
@@ -7,7 +7,7 @@ class FileDescription;
class LocalSocket final : public Socket {
public:
- static Retained<LocalSocket> create(int type);
+ static NonnullRefPtr<LocalSocket> create(int type);
virtual ~LocalSocket() override;
virtual KResult bind(const sockaddr*, socklen_t) override;
@@ -28,7 +28,7 @@ private:
virtual bool is_local() const override { return true; }
bool has_attached_peer(const FileDescription&) const;
- RetainPtr<FileDescription> m_file;
+ RefPtr<FileDescription> m_file;
bool m_bound { false };
int m_accepted_fds_open { 0 };
diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp
index 6113d241dd..0a12ffd5b7 100644
--- a/Kernel/Net/NetworkTask.cpp
+++ b/Kernel/Net/NetworkTask.cpp
@@ -209,7 +209,7 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size)
{
LOCKER(IPv4Socket::all_sockets().lock());
- for (RetainPtr<IPv4Socket> socket : IPv4Socket::all_sockets().resource()) {
+ for (RefPtr<IPv4Socket> socket : IPv4Socket::all_sockets().resource()) {
LOCKER(socket->lock());
if (socket->protocol() != (unsigned)IPv4Protocol::ICMP)
continue;
diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp
index 6164cbe783..d15bd5d09b 100644
--- a/Kernel/Net/Socket.cpp
+++ b/Kernel/Net/Socket.cpp
@@ -6,7 +6,7 @@
#include <Kernel/UnixTypes.h>
#include <LibC/errno_numbers.h>
-KResultOr<Retained<Socket>> Socket::create(int domain, int type, int protocol)
+KResultOr<NonnullRefPtr<Socket>> Socket::create(int domain, int type, int protocol)
{
(void)protocol;
switch (domain) {
@@ -41,7 +41,7 @@ KResult Socket::listen(int backlog)
return KSuccess;
}
-RetainPtr<Socket> Socket::accept()
+RefPtr<Socket> Socket::accept()
{
LOCKER(m_lock);
if (m_pending.is_empty())
diff --git a/Kernel/Net/Socket.h b/Kernel/Net/Socket.h
index ff129f8e54..af9e257a37 100644
--- a/Kernel/Net/Socket.h
+++ b/Kernel/Net/Socket.h
@@ -25,7 +25,7 @@ class FileDescription;
class Socket : public File {
public:
- static KResultOr<Retained<Socket>> create(int domain, int type, int protocol);
+ static KResultOr<NonnullRefPtr<Socket>> create(int domain, int type, int protocol);
virtual ~Socket() override;
int domain() const { return m_domain; }
@@ -33,7 +33,7 @@ public:
int protocol() const { return m_protocol; }
bool can_accept() const { return !m_pending.is_empty(); }
- RetainPtr<Socket> accept();
+ RefPtr<Socket> accept();
bool is_connected() const { return m_connected; }
KResult listen(int backlog);
@@ -89,14 +89,14 @@ private:
timeval m_receive_deadline { 0, 0 };
timeval m_send_deadline { 0, 0 };
- Vector<RetainPtr<Socket>> m_pending;
+ Vector<RefPtr<Socket>> m_pending;
};
class SocketHandle {
public:
SocketHandle() {}
- SocketHandle(RetainPtr<Socket>&& socket)
+ SocketHandle(RefPtr<Socket>&& socket)
: m_socket(move(socket))
{
if (m_socket)
@@ -126,5 +126,5 @@ public:
const Socket& socket() const { return *m_socket; }
private:
- RetainPtr<Socket> m_socket;
+ RefPtr<Socket> m_socket;
};
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index c38f3c3cd6..595958dd02 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -15,7 +15,7 @@ Lockable<HashMap<word, TCPSocket*>>& TCPSocket::sockets_by_port()
TCPSocketHandle TCPSocket::from_port(word port)
{
- RetainPtr<TCPSocket> socket;
+ RefPtr<TCPSocket> socket;
{
LOCKER(sockets_by_port().lock());
auto it = sockets_by_port().resource().find(port);
@@ -38,7 +38,7 @@ TCPSocket::~TCPSocket()
sockets_by_port().resource().remove(local_port());
}
-Retained<TCPSocket> TCPSocket::create(int protocol)
+NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
{
return adopt(*new TCPSocket(protocol));
}
diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h
index a54d04417d..905089abba 100644
--- a/Kernel/Net/TCPSocket.h
+++ b/Kernel/Net/TCPSocket.h
@@ -4,7 +4,7 @@
class TCPSocket final : public IPv4Socket {
public:
- static Retained<TCPSocket> create(int protocol);
+ static NonnullRefPtr<TCPSocket> create(int protocol);
virtual ~TCPSocket() override;
enum class State {
@@ -49,7 +49,7 @@ class TCPSocketHandle : public SocketHandle {
public:
TCPSocketHandle() {}
- TCPSocketHandle(RetainPtr<TCPSocket>&& socket)
+ TCPSocketHandle(RefPtr<TCPSocket>&& socket)
: SocketHandle(move(socket))
{
}
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index 6ae66cfb09..0d1b815d37 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -15,7 +15,7 @@ Lockable<HashMap<word, UDPSocket*>>& UDPSocket::sockets_by_port()
UDPSocketHandle UDPSocket::from_port(word port)
{
- RetainPtr<UDPSocket> socket;
+ RefPtr<UDPSocket> socket;
{
LOCKER(sockets_by_port().lock());
auto it = sockets_by_port().resource().find(port);
@@ -38,7 +38,7 @@ UDPSocket::~UDPSocket()
sockets_by_port().resource().remove(local_port());
}
-Retained<UDPSocket> UDPSocket::create(int protocol)
+NonnullRefPtr<UDPSocket> UDPSocket::create(int protocol)
{
return adopt(*new UDPSocket(protocol));
}
diff --git a/Kernel/Net/UDPSocket.h b/Kernel/Net/UDPSocket.h
index 80ef09b7bf..3cd147d7e5 100644
--- a/Kernel/Net/UDPSocket.h
+++ b/Kernel/Net/UDPSocket.h
@@ -6,7 +6,7 @@ class UDPSocketHandle;
class UDPSocket final : public IPv4Socket {
public:
- static Retained<UDPSocket> create(int protocol);
+ static NonnullRefPtr<UDPSocket> create(int protocol);
virtual ~UDPSocket() override;
static UDPSocketHandle from_port(word);
@@ -27,7 +27,7 @@ class UDPSocketHandle : public SocketHandle {
public:
UDPSocketHandle() {}
- UDPSocketHandle(RetainPtr<UDPSocket>&& socket)
+ UDPSocketHandle(RefPtr<UDPSocket>&& socket)
: SocketHandle(move(socket))
{
}
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index d671d177df..52ff29dcca 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -105,7 +105,7 @@ Region* Process::allocate_region(VirtualAddress vaddr, size_t size, const String
return m_regions.last().ptr();
}
-Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, RetainPtr<Inode>&& inode, const String& name, int prot)
+Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, RefPtr<Inode>&& inode, const String& name, int prot)
{
auto range = allocate_range(vaddr, size);
if (!range.is_valid())
@@ -115,7 +115,7 @@ Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size,
return m_regions.last().ptr();
}
-Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, Retained<VMObject>&& vmo, size_t offset_in_vmo, const String& name, int prot)
+Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, NonnullRefPtr<VMObject>&& vmo, size_t offset_in_vmo, const String& name, int prot)
{
auto range = allocate_range(vaddr, size);
if (!range.is_valid())
@@ -334,7 +334,7 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir
auto vmo = VMObject::create_file_backed(description->inode());
vmo->set_name(description->absolute_path());
- RetainPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo.copy_ref(), 0, vmo->name(), PROT_READ);
+ RefPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo.copy_ref(), 0, vmo->name(), PROT_READ);
ASSERT(region);
if (this != &current->process()) {
@@ -516,7 +516,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid,
if (arguments.is_empty()) {
arguments.append(parts.last());
}
- RetainPtr<Custody> cwd;
+ RefPtr<Custody> cwd;
{
InterruptDisabler disabler;
if (auto* parent = Process::from_pid(parent_pid))
@@ -562,7 +562,7 @@ Process* Process::create_kernel_process(String&& name, void (*e)())
return process;
}
-Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RetainPtr<Custody>&& cwd, RetainPtr<Custody>&& executable, TTY* tty, Process* fork_parent)
+Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody>&& cwd, RefPtr<Custody>&& executable, TTY* tty, Process* fork_parent)
: m_name(move(name))
, m_pid(next_pid++) // FIXME: RACE: This variable looks racy!
, m_uid(uid)
@@ -2445,7 +2445,7 @@ struct SharedBuffer {
Region* m_pid2_region { nullptr };
bool m_pid1_writable { false };
bool m_pid2_writable { false };
- Retained<VMObject> m_vmo;
+ NonnullRefPtr<VMObject> m_vmo;
};
static int s_next_shared_buffer_id;
@@ -2734,7 +2734,7 @@ void Process::FileDescriptionAndFlags::clear()
flags = 0;
}
-void Process::FileDescriptionAndFlags::set(Retained<FileDescription>&& d, dword f)
+void Process::FileDescriptionAndFlags::set(NonnullRefPtr<FileDescription>&& d, dword f)
{
description = move(d);
flags = f;
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 46f5b895a1..c8c7583603 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -211,7 +211,7 @@ public:
void set_tty(TTY* tty) { m_tty = tty; }
size_t region_count() const { return m_regions.size(); }
- const Vector<Retained<Region>>& regions() const { return m_regions; }
+ const Vector<NonnullRefPtr<Region>>& regions() const { return m_regions; }
void dump_regions();
ProcessTracer* tracer() { return m_tracer.ptr(); }
@@ -248,8 +248,8 @@ public:
bool is_superuser() const { return m_euid == 0; }
- Region* allocate_region_with_vmo(VirtualAddress, size_t, Retained<VMObject>&&, size_t offset_in_vmo, const String& name, int prot);
- Region* allocate_file_backed_region(VirtualAddress, size_t, RetainPtr<Inode>&&, const String& name, int prot);
+ Region* allocate_region_with_vmo(VirtualAddress, size_t, NonnullRefPtr<VMObject>&&, size_t offset_in_vmo, const String& name, int prot);
+ Region* allocate_file_backed_region(VirtualAddress, size_t, RefPtr<Inode>&&, const String& name, int prot);
Region* allocate_region(VirtualAddress, size_t, const String& name, int prot = PROT_READ | PROT_WRITE, bool commit = true);
bool deallocate_region(Region& region);
@@ -273,7 +273,7 @@ private:
friend class Scheduler;
friend class Region;
- Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RetainPtr<Custody>&& cwd = nullptr, RetainPtr<Custody>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
+ Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody>&& cwd = nullptr, RefPtr<Custody>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
Range allocate_range(VirtualAddress, size_t);
@@ -287,7 +287,7 @@ private:
Thread* m_main_thread { nullptr };
- RetainPtr<PageDirectory> m_page_directory;
+ RefPtr<PageDirectory> m_page_directory;
Process* m_prev { nullptr };
Process* m_next { nullptr };
@@ -307,8 +307,8 @@ private:
struct FileDescriptionAndFlags {
operator bool() const { return !!description; }
void clear();
- void set(Retained<FileDescription>&& d, dword f = 0);
- RetainPtr<FileDescription> description;
+ void set(NonnullRefPtr<FileDescription>&& d, dword f = 0);
+ RefPtr<FileDescription> description;
dword flags { 0 };
};
Vector<FileDescriptionAndFlags> m_fds;
@@ -319,14 +319,14 @@ private:
byte m_termination_status { 0 };
byte m_termination_signal { 0 };
- RetainPtr<Custody> m_executable;
- RetainPtr<Custody> m_cwd;
+ RefPtr<Custody> m_executable;
+ RefPtr<Custody> m_cwd;
TTY* m_tty { nullptr };
Region* region_from_range(VirtualAddress, size_t);
- Vector<Retained<Region>> m_regions;
+ Vector<NonnullRefPtr<Region>> m_regions;
VirtualAddress m_return_to_ring3_from_signal_trampoline;
VirtualAddress m_return_to_ring0_from_signal_trampoline;
@@ -345,7 +345,7 @@ private:
unsigned m_syscall_count { 0 };
- RetainPtr<ProcessTracer> m_tracer;
+ RefPtr<ProcessTracer> m_tracer;
OwnPtr<ELFLoader> m_elf_loader;
Lock m_big_lock { "Process" };
diff --git a/Kernel/ProcessTracer.h b/Kernel/ProcessTracer.h
index 0b71b0ba0a..8733c0a813 100644
--- a/Kernel/ProcessTracer.h
+++ b/Kernel/ProcessTracer.h
@@ -6,7 +6,7 @@
class ProcessTracer : public File {
public:
- static Retained<ProcessTracer> create(pid_t pid) { return adopt(*new ProcessTracer(pid)); }
+ static NonnullRefPtr<ProcessTracer> create(pid_t pid) { return adopt(*new ProcessTracer(pid)); }
virtual ~ProcessTracer() override;
bool is_dead() const { return m_dead; }
diff --git a/Kernel/SharedMemory.cpp b/Kernel/SharedMemory.cpp
index 6100aee70c..fec48ce082 100644
--- a/Kernel/SharedMemory.cpp
+++ b/Kernel/SharedMemory.cpp
@@ -4,15 +4,15 @@
#include <Kernel/SharedMemory.h>
#include <Kernel/VM/VMObject.h>
-Lockable<HashMap<String, RetainPtr<SharedMemory>>>& shared_memories()
+Lockable<HashMap<String, RefPtr<SharedMemory>>>& shared_memories()
{
- static Lockable<HashMap<String, RetainPtr<SharedMemory>>>* map;
+ static Lockable<HashMap<String, RefPtr<SharedMemory>>>* map;
if (!map)
- map = new Lockable<HashMap<String, RetainPtr<SharedMemory>>>;
+ map = new Lockable<HashMap<String, RefPtr<SharedMemory>>>;
return *map;
}
-KResultOr<Retained<SharedMemory>> SharedMemory::open(const String& name, int flags, mode_t mode)
+KResultOr<NonnullRefPtr<SharedMemory>> SharedMemory::open(const String& name, int flags, mode_t mode)
{
UNUSED_PARAM(flags);
LOCKER(shared_memories().lock());
diff --git a/Kernel/SharedMemory.h b/Kernel/SharedMemory.h
index f7ec96f495..7ab7d7497a 100644
--- a/Kernel/SharedMemory.h
+++ b/Kernel/SharedMemory.h
@@ -11,7 +11,7 @@ class VMObject;
class SharedMemory : public File {
public:
- static KResultOr<Retained<SharedMemory>> open(const String& name, int flags, mode_t);
+ static KResultOr<NonnullRefPtr<SharedMemory>> open(const String& name, int flags, mode_t);
static KResult unlink(const String& name);
virtual ~SharedMemory() override;
@@ -39,5 +39,5 @@ private:
uid_t m_uid { 0 };
gid_t m_gid { 0 };
mode_t m_mode { 0 };
- RetainPtr<VMObject> m_vmo;
+ RefPtr<VMObject> m_vmo;
};
diff --git a/Kernel/TTY/MasterPTY.h b/Kernel/TTY/MasterPTY.h
index accb6902bc..d4965cd76a 100644
--- a/Kernel/TTY/MasterPTY.h
+++ b/Kernel/TTY/MasterPTY.h
@@ -29,7 +29,7 @@ private:
virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override;
virtual const char* class_name() const override { return "MasterPTY"; }
- RetainPtr<SlavePTY> m_slave;
+ RefPtr<SlavePTY> m_slave;
unsigned m_index;
bool m_closed { false };
DoubleBuffer m_buffer;
diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp
index 3b8b596502..6a9b645e0c 100644
--- a/Kernel/TTY/PTYMultiplexer.cpp
+++ b/Kernel/TTY/PTYMultiplexer.cpp
@@ -28,7 +28,7 @@ PTYMultiplexer::~PTYMultiplexer()
{
}
-KResultOr<Retained<FileDescription>> PTYMultiplexer::open(int options)
+KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
{
UNUSED_PARAM(options);
LOCKER(m_lock);
diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h
index b25a5674fc..5a5e8f51b5 100644
--- a/Kernel/TTY/PTYMultiplexer.h
+++ b/Kernel/TTY/PTYMultiplexer.h
@@ -15,7 +15,7 @@ public:
static PTYMultiplexer& the();
// ^CharacterDevice
- virtual KResultOr<Retained<FileDescription>> open(int options) override;
+ virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options) override;
virtual ssize_t read(FileDescription&, byte*, ssize_t) override { return 0; }
virtual ssize_t write(FileDescription&, const byte*, ssize_t) override { return 0; }
virtual bool can_read(FileDescription&) const override { return true; }
diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h
index 83387d8731..71c79371fc 100644
--- a/Kernel/TTY/SlavePTY.h
+++ b/Kernel/TTY/SlavePTY.h
@@ -30,7 +30,7 @@ private:
friend class MasterPTY;
SlavePTY(MasterPTY&, unsigned index);
- RetainPtr<MasterPTY> m_master;
+ RefPtr<MasterPTY> m_master;
unsigned m_index;
InodeIdentifier m_devpts_inode_id;
String m_tty_name;
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index 91cd852e5e..bc00eb630f 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -176,10 +176,10 @@ private:
dword m_pending_signals { 0 };
dword m_signal_mask { 0 };
dword m_kernel_stack_base { 0 };
- RetainPtr<Region> m_kernel_stack_region;
- RetainPtr<Region> m_kernel_stack_for_signal_handler_region;
+ RefPtr<Region> m_kernel_stack_region;
+ RefPtr<Region> m_kernel_stack_for_signal_handler_region;
pid_t m_waitee_pid { -1 };
- RetainPtr<FileDescription> m_blocked_description;
+ RefPtr<FileDescription> m_blocked_description;
timeval m_select_timeout;
SignalActionData m_signal_action_data[32];
Region* m_signal_stack_user_region { nullptr };
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index bcc97d1b35..dd0f0f9ef0 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -81,7 +81,7 @@ void MemoryManager::initialize_paging()
#endif
m_quickmap_addr = VirtualAddress((1 * MB) - PAGE_SIZE);
- RetainPtr<PhysicalRegion> region = nullptr;
+ RefPtr<PhysicalRegion> region = nullptr;
bool region_is_super = false;
for (auto* mmap = (multiboot_memory_map_t*)multiboot_info_ptr->mmap_addr; (unsigned long)mmap < multiboot_info_ptr->mmap_addr + multiboot_info_ptr->mmap_length; mmap = (multiboot_memory_map_t*)((unsigned long)mmap + mmap->size + sizeof(mmap->size))) {
@@ -151,7 +151,7 @@ void MemoryManager::initialize_paging()
#endif
}
-RetainPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_directory, unsigned index)
+RefPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_directory, unsigned index)
{
ASSERT(!page_directory.m_physical_pages.contains(index));
auto physical_page = allocate_supervisor_physical_page();
@@ -444,7 +444,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
return PageFaultResponse::ShouldCrash;
}
-RetainPtr<Region> MemoryManager::allocate_kernel_region(size_t size, String&& name)
+RefPtr<Region> MemoryManager::allocate_kernel_region(size_t size, String&& name)
{
InterruptDisabler disabler;
@@ -478,11 +478,11 @@ void MemoryManager::deallocate_user_physical_page(PhysicalPage&& page)
ASSERT_NOT_REACHED();
}
-RetainPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill should_zero_fill)
+RefPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill should_zero_fill)
{
InterruptDisabler disabler;
- RetainPtr<PhysicalPage> page = nullptr;
+ RefPtr<PhysicalPage> page = nullptr;
for (auto& region : m_user_physical_regions) {
page = region->take_free_page(false);
@@ -535,11 +535,11 @@ void MemoryManager::deallocate_supervisor_physical_page(PhysicalPage&& page)
ASSERT_NOT_REACHED();
}
-RetainPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
+RefPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page()
{
InterruptDisabler disabler;
- RetainPtr<PhysicalPage> page = nullptr;
+ RefPtr<PhysicalPage> page = nullptr;
for (auto& region : m_super_physical_regions) {
page = region->take_free_page(true);
diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h
index efa291e41c..605f35dd95 100644
--- a/Kernel/VM/MemoryManager.h
+++ b/Kernel/VM/MemoryManager.h
@@ -61,8 +61,8 @@ public:
Yes
};
- RetainPtr<PhysicalPage> allocate_user_physical_page(ShouldZeroFill);
- RetainPtr<PhysicalPage> allocate_supervisor_physical_page();
+ RefPtr<PhysicalPage> allocate_user_physical_page(ShouldZeroFill);
+ RefPtr<PhysicalPage> allocate_supervisor_physical_page();
void deallocate_user_physical_page(PhysicalPage&&);
void deallocate_supervisor_physical_page(PhysicalPage&&);
@@ -70,7 +70,7 @@ public:
void map_for_kernel(VirtualAddress, PhysicalAddress);
- RetainPtr<Region> allocate_kernel_region(size_t, String&& name);
+ RefPtr<Region> allocate_kernel_region(size_t, String&& name);
void map_region_at_address(PageDirectory&, Region&, VirtualAddress, bool user_accessible);
unsigned user_physical_pages() const { return m_user_physical_pages; }
@@ -93,7 +93,7 @@ private:
void flush_entire_tlb();
void flush_tlb(VirtualAddress);
- RetainPtr<PhysicalPage> allocate_page_table(PageDirectory&, unsigned index);
+ RefPtr<PhysicalPage> allocate_page_table(PageDirectory&, unsigned index);
void map_protected(VirtualAddress, size_t length);
@@ -214,7 +214,7 @@ private:
PageTableEntry ensure_pte(PageDirectory&, VirtualAddress);
- RetainPtr<PageDirectory> m_kernel_page_directory;
+ RefPtr<PageDirectory> m_kernel_page_directory;
dword* m_page_table_zero { nullptr };
dword* m_page_table_one { nullptr };
@@ -225,8 +225,8 @@ private:
unsigned m_super_physical_pages { 0 };
unsigned m_super_physical_pages_used { 0 };
- Vector<Retained<PhysicalRegion>> m_user_physical_regions {};
- Vector<Retained<PhysicalRegion>> m_super_physical_regions {};
+ Vector<NonnullRefPtr<PhysicalRegion>> m_user_physical_regions {};
+ Vector<NonnullRefPtr<PhysicalRegion>> m_super_physical_regions {};
HashTable<VMObject*> m_vmos;
HashTable<Region*> m_user_regions;
diff --git a/Kernel/VM/PageDirectory.h b/Kernel/VM/PageDirectory.h
index cf0876e438..fcf8ea83dc 100644
--- a/Kernel/VM/PageDirectory.h
+++ b/Kernel/VM/PageDirectory.h
@@ -10,8 +10,8 @@ class PageDirectory : public RefCounted<PageDirectory> {
friend class MemoryManager;
public:
- static Retained<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr) { return adopt(*new PageDirectory(parent_range_allocator)); }
- static Retained<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
+ static NonnullRefPtr<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr) { return adopt(*new PageDirectory(parent_range_allocator)); }
+ static NonnullRefPtr<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
~PageDirectory();
dword cr3() const { return m_directory_page->paddr().get(); }
@@ -26,6 +26,6 @@ private:
explicit PageDirectory(PhysicalAddress);
RangeAllocator m_range_allocator;
- RetainPtr<PhysicalPage> m_directory_page;
- HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages;
+ RefPtr<PhysicalPage> m_directory_page;
+ HashMap<unsigned, RefPtr<PhysicalPage>> m_physical_pages;
};
diff --git a/Kernel/VM/PhysicalPage.cpp b/Kernel/VM/PhysicalPage.cpp
index adc64e870b..49436a22af 100644
--- a/Kernel/VM/PhysicalPage.cpp
+++ b/Kernel/VM/PhysicalPage.cpp
@@ -2,7 +2,7 @@
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/kmalloc.h>
-Retained<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist)
+NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist)
{
void* slot = kmalloc(sizeof(PhysicalPage));
new (slot) PhysicalPage(paddr, supervisor, may_return_to_freelist);
diff --git a/Kernel/VM/PhysicalPage.h b/Kernel/VM/PhysicalPage.h
index e4422d14a0..a36200f266 100644
--- a/Kernel/VM/PhysicalPage.h
+++ b/Kernel/VM/PhysicalPage.h
@@ -28,7 +28,7 @@ public:
}
}
- static Retained<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
+ static NonnullRefPtr<PhysicalPage> create(PhysicalAddress, bool supervisor, bool may_return_to_freelist = true);
word ref_count() const { return m_retain_count; }
diff --git a/Kernel/VM/PhysicalRegion.cpp b/Kernel/VM/PhysicalRegion.cpp
index fd7021d977..436f17d144 100644
--- a/Kernel/VM/PhysicalRegion.cpp
+++ b/Kernel/VM/PhysicalRegion.cpp
@@ -6,7 +6,7 @@
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/VM/PhysicalRegion.h>
-Retained<PhysicalRegion> PhysicalRegion::create(PhysicalAddress lower, PhysicalAddress upper)
+NonnullRefPtr<PhysicalRegion> PhysicalRegion::create(PhysicalAddress lower, PhysicalAddress upper)
{
return adopt(*new PhysicalRegion(lower, upper));
}
@@ -36,7 +36,7 @@ unsigned PhysicalRegion::finalize_capacity()
return size();
}
-RetainPtr<PhysicalPage> PhysicalRegion::take_free_page(bool supervisor)
+RefPtr<PhysicalPage> PhysicalRegion::take_free_page(bool supervisor)
{
ASSERT(m_pages);
diff --git a/Kernel/VM/PhysicalRegion.h b/Kernel/VM/PhysicalRegion.h
index 7cecc4b365..425a5900a7 100644
--- a/Kernel/VM/PhysicalRegion.h
+++ b/Kernel/VM/PhysicalRegion.h
@@ -10,7 +10,7 @@ class PhysicalRegion : public RefCounted<PhysicalRegion> {
AK_MAKE_ETERNAL
public:
- static Retained<PhysicalRegion> create(PhysicalAddress lower, PhysicalAddress upper);
+ static NonnullRefPtr<PhysicalRegion> create(PhysicalAddress lower, PhysicalAddress upper);
~PhysicalRegion() {}
void expand(PhysicalAddress lower, PhysicalAddress upper);
@@ -23,7 +23,7 @@ public:
unsigned free() const { return m_pages - m_used; }
bool contains(PhysicalPage& page) const { return page.paddr() >= m_lower && page.paddr() <= m_upper; }
- RetainPtr<PhysicalPage> take_free_page(bool supervisor);
+ RefPtr<PhysicalPage> take_free_page(bool supervisor);
void return_page_at(PhysicalAddress addr);
void return_page(PhysicalPage&& page) { return_page_at(page.paddr()); }
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp
index 234fc4710b..e191ce2e25 100644
--- a/Kernel/VM/Region.cpp
+++ b/Kernel/VM/Region.cpp
@@ -15,7 +15,7 @@ Region::Region(const Range& range, const String& name, byte access, bool cow)
MM.register_region(*this);
}
-Region::Region(const Range& range, RetainPtr<Inode>&& inode, const String& name, byte access)
+Region::Region(const Range& range, RefPtr<Inode>&& inode, const String& name, byte access)
: m_range(range)
, m_vmo(VMObject::create_file_backed(move(inode)))
, m_name(name)
@@ -25,7 +25,7 @@ Region::Region(const Range& range, RetainPtr<Inode>&& inode, const String& name,
MM.register_region(*this);
}
-Region::Region(const Range& range, Retained<VMObject>&& vmo, size_t offset_in_vmo, const String& name, byte access, bool cow)
+Region::Region(const Range& range, NonnullRefPtr<VMObject>&& vmo, size_t offset_in_vmo, const String& name, byte access, bool cow)
: m_range(range)
, m_offset_in_vmo(offset_in_vmo)
, m_vmo(move(vmo))
@@ -66,7 +66,7 @@ bool Region::page_in()
return true;
}
-Retained<Region> Region::clone()
+NonnullRefPtr<Region> Region::clone()
{
ASSERT(current);
if (m_shared || (is_readable() && !is_writable())) {
diff --git a/Kernel/VM/Region.h b/Kernel/VM/Region.h
index 1e0d374b17..9079280d2f 100644
--- a/Kernel/VM/Region.h
+++ b/Kernel/VM/Region.h
@@ -19,8 +19,8 @@ public:
};
Region(const Range&, const String&, byte access, bool cow = false);
- Region(const Range&, Retained<VMObject>&&, size_t offset_in_vmo, const String&, byte access, bool cow = false);
- Region(const Range&, RetainPtr<Inode>&&, const String&, byte access);
+ Region(const Range&, NonnullRefPtr<VMObject>&&, size_t offset_in_vmo, const String&, byte access, bool cow = false);
+ Region(const Range&, RefPtr<Inode>&&, const String&, byte access);
~Region();
VirtualAddress vaddr() const { return m_range.base(); }
@@ -38,7 +38,7 @@ public:
bool is_shared() const { return m_shared; }
void set_shared(bool shared) { m_shared = shared; }
- Retained<Region> clone();
+ NonnullRefPtr<Region> clone();
bool contains(VirtualAddress vaddr) const
{
@@ -97,10 +97,10 @@ public:
}
private:
- RetainPtr<PageDirectory> m_page_directory;
+ RefPtr<PageDirectory> m_page_directory;
Range m_range;
size_t m_offset_in_vmo { 0 };
- Retained<VMObject> m_vmo;
+ NonnullRefPtr<VMObject> m_vmo;
String m_name;
byte m_access { 0 };
bool m_shared { false };
diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp
index 34a8a2cf55..9bcd6875eb 100644
--- a/Kernel/VM/VMObject.cpp
+++ b/Kernel/VM/VMObject.cpp
@@ -3,7 +3,7 @@
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/VMObject.h>
-Retained<VMObject> VMObject::create_file_backed(RetainPtr<Inode>&& inode)
+NonnullRefPtr<VMObject> VMObject::create_file_backed(RefPtr<Inode>&& inode)
{
InterruptDisabler disabler;
if (inode->vmo())
@@ -13,13 +13,13 @@ Retained<VMObject> VMObject::create_file_backed(RetainPtr<Inode>&& inode)
return vmo;
}
-Retained<VMObject> VMObject::create_anonymous(size_t size)
+NonnullRefPtr<VMObject> VMObject::create_anonymous(size_t size)
{
size = ceil_div(size, PAGE_SIZE) * PAGE_SIZE;
return adopt(*new VMObject(size));
}
-Retained<VMObject> VMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
+NonnullRefPtr<VMObject> VMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
{
size = ceil_div(size, PAGE_SIZE) * PAGE_SIZE;
auto vmo = adopt(*new VMObject(paddr, size));
@@ -27,7 +27,7 @@ Retained<VMObject> VMObject::create_for_physical_range(PhysicalAddress paddr, si
return vmo;
}
-Retained<VMObject> VMObject::clone()
+NonnullRefPtr<VMObject> VMObject::clone()
{
return adopt(*new VMObject(*this));
}
@@ -59,7 +59,7 @@ VMObject::VMObject(PhysicalAddress paddr, size_t size)
ASSERT(m_physical_pages.size() == page_count());
}
-VMObject::VMObject(RetainPtr<Inode>&& inode)
+VMObject::VMObject(RefPtr<Inode>&& inode)
: m_inode(move(inode))
{
ASSERT(m_inode);
diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h
index 5713d54395..ca6403f58e 100644
--- a/Kernel/VM/VMObject.h
+++ b/Kernel/VM/VMObject.h
@@ -18,10 +18,10 @@ class VMObject : public RefCounted<VMObject>
friend class MemoryManager;
public:
- static Retained<VMObject> create_file_backed(RetainPtr<Inode>&&);
- static Retained<VMObject> create_anonymous(size_t);
- static Retained<VMObject> create_for_physical_range(PhysicalAddress, size_t);
- Retained<VMObject> clone();
+ static NonnullRefPtr<VMObject> create_file_backed(RefPtr<Inode>&&);
+ static NonnullRefPtr<VMObject> create_anonymous(size_t);
+ static NonnullRefPtr<VMObject> create_for_physical_range(PhysicalAddress, size_t);
+ NonnullRefPtr<VMObject> clone();
~VMObject();
bool is_anonymous() const { return !m_inode; }
@@ -34,8 +34,8 @@ public:
void set_name(const String& name) { m_name = name; }
size_t page_count() const { return m_size / PAGE_SIZE; }
- const Vector<RetainPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
- Vector<RetainPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }
+ const Vector<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
+ Vector<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }
void inode_contents_changed(Badge<Inode>, off_t, ssize_t, const byte*);
void inode_size_changed(Badge<Inode>, size_t old_size, size_t new_size);
@@ -43,7 +43,7 @@ public:
size_t size() const { return m_size; }
private:
- VMObject(RetainPtr<Inode>&&);
+ VMObject(RefPtr<Inode>&&);
explicit VMObject(VMObject&);
explicit VMObject(size_t);
VMObject(PhysicalAddress, size_t);
@@ -55,7 +55,7 @@ private:
bool m_allow_cpu_caching { true };
off_t m_inode_offset { 0 };
size_t m_size { 0 };
- RetainPtr<Inode> m_inode;
- Vector<RetainPtr<PhysicalPage>> m_physical_pages;
+ RefPtr<Inode> m_inode;
+ Vector<RefPtr<PhysicalPage>> m_physical_pages;
Lock m_paging_lock { "VMObject" };
};
diff --git a/Kernel/init.cpp b/Kernel/init.cpp
index cde76f94e2..d1b9e381f8 100644
--- a/Kernel/init.cpp
+++ b/Kernel/init.cpp
@@ -86,7 +86,7 @@ VFS* vfs;
auto dev_hd0 = IDEDiskDevice::create();
- Retained<DiskDevice> root_dev = dev_hd0.copy_ref();
+ NonnullRefPtr<DiskDevice> root_dev = dev_hd0.copy_ref();
root = root.substring(strlen("/dev/hda"), root.length() - strlen("/dev/hda"));
@@ -199,7 +199,7 @@ extern "C" [[noreturn]] void init()
auto e1000 = E1000NetworkAdapter::autodetect();
- Retained<ProcFS> new_procfs = ProcFS::create();
+ NonnullRefPtr<ProcFS> new_procfs = ProcFS::create();
new_procfs->initialize();
auto devptsfs = DevPtsFS::create();
diff --git a/LibC/SharedBuffer.cpp b/LibC/SharedBuffer.cpp
index 58537a0094..cc61d6a25f 100644
--- a/LibC/SharedBuffer.cpp
+++ b/LibC/SharedBuffer.cpp
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <unistd.h>
-RetainPtr<SharedBuffer> SharedBuffer::create(pid_t peer, int size)
+RefPtr<SharedBuffer> SharedBuffer::create(pid_t peer, int size)
{
void* data;
int shared_buffer_id = create_shared_buffer(peer, size, &data);
@@ -14,7 +14,7 @@ RetainPtr<SharedBuffer> SharedBuffer::create(pid_t peer, int size)
return adopt(*new SharedBuffer(shared_buffer_id, size, data));
}
-RetainPtr<SharedBuffer> SharedBuffer::create_from_shared_buffer_id(int shared_buffer_id)
+RefPtr<SharedBuffer> SharedBuffer::create_from_shared_buffer_id(int shared_buffer_id)
{
void* data = get_shared_buffer(shared_buffer_id);
if (data == (void*)-1) {
diff --git a/LibC/SharedBuffer.h b/LibC/SharedBuffer.h
index 09c5b83f3a..588ba1821b 100644
--- a/LibC/SharedBuffer.h
+++ b/LibC/SharedBuffer.h
@@ -5,8 +5,8 @@
class SharedBuffer : public RefCounted<SharedBuffer> {
public:
- static RetainPtr<SharedBuffer> create(pid_t peer, int);
- static RetainPtr<SharedBuffer> create_from_shared_buffer_id(int);
+ static RefPtr<SharedBuffer> create(pid_t peer, int);
+ static RefPtr<SharedBuffer> create_from_shared_buffer_id(int);
~SharedBuffer();
int shared_buffer_id() const { return m_shared_buffer_id; }
diff --git a/LibCore/CConfigFile.cpp b/LibCore/CConfigFile.cpp
index d39d4505a0..39151d24c9 100644
--- a/LibCore/CConfigFile.cpp
+++ b/LibCore/CConfigFile.cpp
@@ -6,7 +6,7 @@
#include <stdio.h>
#include <unistd.h>
-Retained<CConfigFile> CConfigFile::get_for_app(const String& app_name)
+NonnullRefPtr<CConfigFile> CConfigFile::get_for_app(const String& app_name)
{
String home_path = get_current_user_home_path();
if (home_path == "/")
@@ -15,7 +15,7 @@ Retained<CConfigFile> CConfigFile::get_for_app(const String& app_name)
return adopt(*new CConfigFile(path));
}
-Retained<CConfigFile> CConfigFile::get_for_system(const String& app_name)
+NonnullRefPtr<CConfigFile> CConfigFile::get_for_system(const String& app_name)
{
auto path = String::format("/etc/%s.ini", app_name.characters());
return adopt(*new CConfigFile(path));
diff --git a/LibCore/CConfigFile.h b/LibCore/CConfigFile.h
index f771702776..4e5e4fa5e0 100644
--- a/LibCore/CConfigFile.h
+++ b/LibCore/CConfigFile.h
@@ -9,8 +9,8 @@
class CConfigFile : public RefCounted<CConfigFile> {
public:
- static Retained<CConfigFile> get_for_app(const String& app_name);
- static Retained<CConfigFile> get_for_system(const String& app_name);
+ static NonnullRefPtr<CConfigFile> get_for_app(const String& app_name);
+ static NonnullRefPtr<CConfigFile> get_for_system(const String& app_name);
~CConfigFile();
bool has_group(const String&) const;
diff --git a/LibCore/CHttpResponse.h b/LibCore/CHttpResponse.h
index 851f77d3a0..3feaa6bfd2 100644
--- a/LibCore/CHttpResponse.h
+++ b/LibCore/CHttpResponse.h
@@ -7,7 +7,7 @@
class CHttpResponse : public CNetworkResponse {
public:
virtual ~CHttpResponse() override;
- static Retained<CHttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
+ static NonnullRefPtr<CHttpResponse> create(int code, HashMap<String, String>&& headers, ByteBuffer&& payload)
{
return adopt(*new CHttpResponse(code, move(headers), move(payload)));
}
diff --git a/LibCore/CNetworkJob.cpp b/LibCore/CNetworkJob.cpp
index 8ff758a3a4..f6905ed11d 100644
--- a/LibCore/CNetworkJob.cpp
+++ b/LibCore/CNetworkJob.cpp
@@ -10,7 +10,7 @@ CNetworkJob::~CNetworkJob()
{
}
-void CNetworkJob::did_finish(Retained<CNetworkResponse>&& response)
+void CNetworkJob::did_finish(NonnullRefPtr<CNetworkResponse>&& response)
{
m_response = move(response);
printf("%s{%p} job did_finish!\n", class_name(), this);
diff --git a/LibCore/CNetworkJob.h b/LibCore/CNetworkJob.h
index eaae27c464..faf2e370ed 100644
--- a/LibCore/CNetworkJob.h
+++ b/LibCore/CNetworkJob.h
@@ -28,10 +28,10 @@ public:
protected:
CNetworkJob();
- void did_finish(Retained<CNetworkResponse>&&);
+ void did_finish(NonnullRefPtr<CNetworkResponse>&&);
void did_fail(Error);
private:
- RetainPtr<CNetworkResponse> m_response;
+ RefPtr<CNetworkResponse> m_response;
Error m_error { Error::None };
};
diff --git a/LibGUI/GAbstractView.cpp b/LibGUI/GAbstractView.cpp
index 36b10818ad..2f7c410592 100644
--- a/LibGUI/GAbstractView.cpp
+++ b/LibGUI/GAbstractView.cpp
@@ -15,7 +15,7 @@ GAbstractView::~GAbstractView()
delete m_edit_widget;
}
-void GAbstractView::set_model(RetainPtr<GModel>&& model)
+void GAbstractView::set_model(RefPtr<GModel>&& model)
{
if (model == m_model)
return;
diff --git a/LibGUI/GAbstractView.h b/LibGUI/GAbstractView.h
index 7709c0cae8..1a517c0c16 100644
--- a/LibGUI/GAbstractView.h
+++ b/LibGUI/GAbstractView.h
@@ -13,7 +13,7 @@ public:
explicit GAbstractView(GWidget* parent);
virtual ~GAbstractView() override;
- void set_model(RetainPtr<GModel>&&);
+ void set_model(RefPtr<GModel>&&);
GModel* model() { return m_model.ptr(); }
const GModel* model() const { return m_model.ptr(); }
@@ -48,6 +48,6 @@ protected:
Rect m_edit_widget_content_rect;
private:
- RetainPtr<GModel> m_model;
+ RefPtr<GModel> m_model;
bool m_activates_on_selection { false };
};
diff --git a/LibGUI/GAction.cpp b/LibGUI/GAction.cpp
index 3e701d485a..8d9d023f87 100644
--- a/LibGUI/GAction.cpp
+++ b/LibGUI/GAction.cpp
@@ -16,7 +16,7 @@ GAction::GAction(const StringView& text, Function<void(GAction&)> on_activation_
{
}
-GAction::GAction(const StringView& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, GWidget* widget)
+GAction::GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, GWidget* widget)
: on_activation(move(on_activation_callback))
, m_text(text)
, m_icon(move(icon))
@@ -29,7 +29,7 @@ GAction::GAction(const StringView& text, const GShortcut& shortcut, Function<voi
{
}
-GAction::GAction(const StringView& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, GWidget* widget)
+GAction::GAction(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> on_activation_callback, GWidget* widget)
: on_activation(move(on_activation_callback))
, m_text(text)
, m_icon(move(icon))
diff --git a/LibGUI/GAction.h b/LibGUI/GAction.h
index 7f6f8d8d9f..590ea57578 100644
--- a/LibGUI/GAction.h
+++ b/LibGUI/GAction.h
@@ -23,23 +23,23 @@ public:
ApplicationGlobal,
WidgetLocal,
};
- static Retained<GAction> create(const StringView& text, Function<void(GAction&)> callback, GWidget* widget = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, Function<void(GAction&)> callback, GWidget* widget = nullptr)
{
return adopt(*new GAction(text, move(callback), widget));
}
- static Retained<GAction> create(const StringView& text, const StringView& custom_data, Function<void(GAction&)> callback, GWidget* widget = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, const StringView& custom_data, Function<void(GAction&)> callback, GWidget* widget = nullptr)
{
return adopt(*new GAction(text, custom_data, move(callback), widget));
}
- static Retained<GAction> create(const StringView& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, GWidget* widget = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, GWidget* widget = nullptr)
{
return adopt(*new GAction(text, move(icon), move(callback), widget));
}
- static Retained<GAction> create(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> callback, GWidget* widget = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, Function<void(GAction&)> callback, GWidget* widget = nullptr)
{
return adopt(*new GAction(text, shortcut, move(callback), widget));
}
- static Retained<GAction> create(const StringView& text, const GShortcut& shortcut, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, GWidget* widget = nullptr)
+ static NonnullRefPtr<GAction> create(const StringView& text, const GShortcut& shortcut, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> callback, GWidget* widget = nullptr)
{
return adopt(*new GAction(text, shortcut, move(icon), move(callback), widget));
}
@@ -78,8 +78,8 @@ public:
private:
GAction(const StringView& text, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
GAction(const StringView& text, const GShortcut&, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
- GAction(const StringView& text, const GShortcut&, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
- GAction(const StringView& text, RetainPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
+ GAction(const StringView& text, const GShortcut&, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
+ GAction(const StringView& text, RefPtr<GraphicsBitmap>&& icon, Function<void(GAction&)> = nullptr, GWidget* = nullptr);
GAction(const StringView& text, const StringView& custom_data = StringView(), Function<void(GAction&)> = nullptr, GWidget* = nullptr);
template<typename Callback>
@@ -89,7 +89,7 @@ private:
String m_text;
String m_custom_data;
- RetainPtr<GraphicsBitmap> m_icon;
+ RefPtr<GraphicsBitmap> m_icon;
GShortcut m_shortcut;
bool m_enabled { true };
bool m_checkable { false };
diff --git a/LibGUI/GButton.cpp b/LibGUI/GButton.cpp
index c9c4e119f2..364ab4677c 100644
--- a/LibGUI/GButton.cpp
+++ b/LibGUI/GButton.cpp
@@ -81,7 +81,7 @@ void GButton::set_action(GAction& action)
set_checked(action.is_checked());
}
-void GButton::set_icon(RetainPtr<GraphicsBitmap>&& icon)
+void GButton::set_icon(RefPtr<GraphicsBitmap>&& icon)
{
if (m_icon == icon)
return;
diff --git a/LibGUI/GButton.h b/LibGUI/GButton.h
index 2e12b8f3e1..ecb93aa024 100644
--- a/LibGUI/GButton.h
+++ b/LibGUI/GButton.h
@@ -15,7 +15,7 @@ public:
explicit GButton(GWidget* parent);
virtual ~GButton() override;
- void set_icon(RetainPtr<GraphicsBitmap>&&);
+ void set_icon(RefPtr<GraphicsBitmap>&&);
const GraphicsBitmap* icon() const { return m_icon.ptr(); }
GraphicsBitmap* icon() { return m_icon.ptr(); }
@@ -39,7 +39,7 @@ protected:
virtual void paint_event(GPaintEvent&) override;
private:
- RetainPtr<GraphicsBitmap> m_icon;
+ RefPtr<GraphicsBitmap> m_icon;
ButtonStyle m_button_style { ButtonStyle::Normal };
TextAlignment m_text_alignment { TextAlignment::Center };
WeakPtr<GAction> m_action;
diff --git a/LibGUI/GDirectoryModel.cpp b/LibGUI/GDirectoryModel.cpp
index ee5ddcd39b..b4cc311632 100644
--- a/LibGUI/GDirectoryModel.cpp
+++ b/LibGUI/GDirectoryModel.cpp
@@ -11,11 +11,11 @@
#include <stdio.h>
#include <unistd.h>
-static CLockable<HashMap<String, RetainPtr<GraphicsBitmap>>>& thumbnail_cache()
+static CLockable<HashMap<String, RefPtr<GraphicsBitmap>>>& thumbnail_cache()
{
- static CLockable<HashMap<String, RetainPtr<GraphicsBitmap>>>* s_map;
+ static CLockable<HashMap<String, RefPtr<GraphicsBitmap>>>* s_map;
if (!s_map)
- s_map = new CLockable<HashMap<String, RetainPtr<GraphicsBitmap>>>();
+ s_map = new CLockable<HashMap<String, RefPtr<GraphicsBitmap>>>();
return *s_map;
}
diff --git a/LibGUI/GDirectoryModel.h b/LibGUI/GDirectoryModel.h
index 41ad4c4a18..05ad88cd28 100644
--- a/LibGUI/GDirectoryModel.h
+++ b/LibGUI/GDirectoryModel.h
@@ -8,7 +8,7 @@ class GDirectoryModel final : public GModel {
friend int thumbnail_thread(void*);
public:
- static Retained<GDirectoryModel> create() { return adopt(*new GDirectoryModel); }
+ static NonnullRefPtr<GDirectoryModel> create() { return adopt(*new GDirectoryModel); }
virtual ~GDirectoryModel() override;
enum Column {
@@ -42,7 +42,7 @@ public:
uid_t uid { 0 };
uid_t gid { 0 };
ino_t inode { 0 };
- mutable RetainPtr<GraphicsBitmap> thumbnail;
+ mutable RefPtr<GraphicsBitmap> thumbnail;
bool is_directory() const { return S_ISDIR(mode); }
bool is_executable() const { return mode & S_IXUSR; }
String full_path(const GDirectoryModel& model) const { return String::format("%s/%s", model.path().characters(), name.characters()); }
diff --git a/LibGUI/GFilePicker.h b/LibGUI/GFilePicker.h
index 12af7e3941..b091edb2e7 100644
--- a/LibGUI/GFilePicker.h
+++ b/LibGUI/GFilePicker.h
@@ -19,7 +19,7 @@ private:
void clear_preview();
GTableView* m_view { nullptr };
- Retained<GDirectoryModel> m_model;
+ NonnullRefPtr<GDirectoryModel> m_model;
FileSystemPath m_selected_file;
GLabel* m_preview_image_label { nullptr };
diff --git a/LibGUI/GFileSystemModel.h b/LibGUI/GFileSystemModel.h
index 5e7c7545e7..80b2f17ddd 100644
--- a/LibGUI/GFileSystemModel.h
+++ b/LibGUI/GFileSystemModel.h
@@ -12,7 +12,7 @@ public:
FilesAndDirectories
};
- static Retained<GFileSystemModel> create(const StringView& root_path = "/", Mode mode = Mode::FilesAndDirectories)
+ static NonnullRefPtr<GFileSystemModel> create(const StringView& root_path = "/", Mode mode = Mode::FilesAndDirectories)
{
return adopt(*new GFileSystemModel(root_path, mode));
}
diff --git a/LibGUI/GFontDatabase.cpp b/LibGUI/GFontDatabase.cpp
index b676c71016..6bd3887707 100644
--- a/LibGUI/GFontDatabase.cpp
+++ b/LibGUI/GFontDatabase.cpp
@@ -53,7 +53,7 @@ void GFontDatabase::for_each_fixed_width_font(Function<void(const StringView&)>
}
}
-RetainPtr<Font> GFontDatabase::get_by_name(const StringView& name)
+RefPtr<Font> GFontDatabase::get_by_name(const StringView& name)
{
auto it = m_name_to_metadata.find(name);
if (it == m_name_to_metadata.end())
diff --git a/LibGUI/GFontDatabase.h b/LibGUI/GFontDatabase.h
index 7b22bc4d10..46d4f26ace 100644
--- a/LibGUI/GFontDatabase.h
+++ b/LibGUI/GFontDatabase.h
@@ -16,7 +16,7 @@ class GFontDatabase {
public:
static GFontDatabase& the();
- RetainPtr<Font> get_by_name(const StringView&);
+ RefPtr<Font> get_by_name(const StringView&);
void for_each_font(Function<void(const StringView&)>);
void for_each_fixed_width_font(Function<void(const StringView&)>);
diff --git a/LibGUI/GIcon.cpp b/LibGUI/GIcon.cpp
index 17c34e8356..fa63b9d986 100644
--- a/LibGUI/GIcon.cpp
+++ b/LibGUI/GIcon.cpp
@@ -15,7 +15,7 @@ GIcon::GIcon(const GIcon& other)
{
}
-GIcon::GIcon(RetainPtr<GraphicsBitmap>&& bitmap)
+GIcon::GIcon(RefPtr<GraphicsBitmap>&& bitmap)
: GIcon()
{
if (bitmap) {
@@ -25,7 +25,7 @@ GIcon::GIcon(RetainPtr<GraphicsBitmap>&& bitmap)
}
}
-GIcon::GIcon(RetainPtr<GraphicsBitmap>&& bitmap1, RetainPtr<GraphicsBitmap>&& bitmap2)
+GIcon::GIcon(RefPtr<GraphicsBitmap>&& bitmap1, RefPtr<GraphicsBitmap>&& bitmap2)
: GIcon(move(bitmap1))
{
if (bitmap2) {
@@ -53,7 +53,7 @@ const GraphicsBitmap* GIconImpl::bitmap_for_size(int size) const
return best_fit;
}
-void GIconImpl::set_bitmap_for_size(int size, RetainPtr<GraphicsBitmap>&& bitmap)
+void GIconImpl::set_bitmap_for_size(int size, RefPtr<GraphicsBitmap>&& bitmap)
{
if (!bitmap) {
m_bitmaps.remove(size);
diff --git a/LibGUI/GIcon.h b/LibGUI/GIcon.h
index a509f9db18..b8222ae7f3 100644
--- a/LibGUI/GIcon.h
+++ b/LibGUI/GIcon.h
@@ -5,22 +5,22 @@
class GIconImpl : public RefCounted<GIconImpl> {
public:
- static Retained<GIconImpl> create() { return adopt(*new GIconImpl); }
+ static NonnullRefPtr<GIconImpl> create() { return adopt(*new GIconImpl); }
~GIconImpl() {}
const GraphicsBitmap* bitmap_for_size(int) const;
- void set_bitmap_for_size(int, RetainPtr<GraphicsBitmap>&&);
+ void set_bitmap_for_size(int, RefPtr<GraphicsBitmap>&&);
private:
GIconImpl() {}
- HashMap<int, RetainPtr<GraphicsBitmap>> m_bitmaps;
+ HashMap<int, RefPtr<GraphicsBitmap>> m_bitmaps;
};
class GIcon {
public:
GIcon();
- explicit GIcon(RetainPtr<GraphicsBitmap>&&);
- explicit GIcon(RetainPtr<GraphicsBitmap>&&, RetainPtr<GraphicsBitmap>&&);
+ explicit GIcon(RefPtr<GraphicsBitmap>&&);
+ explicit GIcon(RefPtr<GraphicsBitmap>&&, RefPtr<GraphicsBitmap>&&);
explicit GIcon(const GIconImpl&);
GIcon(const GIcon&);
~GIcon() {}
@@ -34,10 +34,10 @@ public:
}
const GraphicsBitmap* bitmap_for_size(int size) const { return m_impl->bitmap_for_size(size); }
- void set_bitmap_for_size(int size, RetainPtr<GraphicsBitmap>&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); }
+ void set_bitmap_for_size(int size, RefPtr<GraphicsBitmap>&& bitmap) { m_impl->set_bitmap_for_size(size, move(bitmap)); }
const GIconImpl& impl() const { return *m_impl; }
private:
- Retained<GIconImpl> m_impl;
+ NonnullRefPtr<GIconImpl> m_impl;
};
diff --git a/LibGUI/GLabel.cpp b/LibGUI/GLabel.cpp
index abab0ac09a..cc1ac3e4a3 100644
--- a/LibGUI/GLabel.cpp
+++ b/LibGUI/GLabel.cpp
@@ -17,7 +17,7 @@ GLabel::~GLabel()
{
}
-void GLabel::set_icon(RetainPtr<GraphicsBitmap>&& icon)
+void GLabel::set_icon(RefPtr<GraphicsBitmap>&& icon)
{
m_icon = move(icon);
}
diff --git a/LibGUI/GLabel.h b/LibGUI/GLabel.h
index 406595756b..dffd0b70bd 100644
--- a/LibGUI/GLabel.h
+++ b/LibGUI/GLabel.h
@@ -14,7 +14,7 @@ public:
String text() const { return m_text; }
void set_text(const StringView&);
- void set_icon(RetainPtr<GraphicsBitmap>&&);
+ void set_icon(RefPtr<GraphicsBitmap>&&);
const GraphicsBitmap* icon() const { return m_icon.ptr(); }
GraphicsBitmap* icon() { return m_icon.ptr(); }
@@ -32,7 +32,7 @@ private:
virtual void paint_event(GPaintEvent&) override;
String m_text;
- RetainPtr<GraphicsBitmap> m_icon;
+ RefPtr<GraphicsBitmap> m_icon;
TextAlignment m_text_alignment { TextAlignment::Center };
bool m_should_stretch_icon { false };
};
diff --git a/LibGUI/GMenu.cpp b/LibGUI/GMenu.cpp
index cb5902adba..048ac38e67 100644
--- a/LibGUI/GMenu.cpp
+++ b/LibGUI/GMenu.cpp
@@ -31,7 +31,7 @@ GMenu::~GMenu()
unrealize_menu();
}
-void GMenu::add_action(Retained<GAction> action)
+void GMenu::add_action(NonnullRefPtr<GAction> action)
{
m_items.append(make<GMenuItem>(m_menu_id, move(action)));
#ifdef GMENU_DEBUG
diff --git a/LibGUI/GMenu.h b/LibGUI/GMenu.h
index 61b11c0692..37680f6d6b 100644
--- a/LibGUI/GMenu.h
+++ b/LibGUI/GMenu.h
@@ -18,7 +18,7 @@ public:
GAction* action_at(int);
- void add_action(Retained<GAction>);
+ void add_action(NonnullRefPtr<GAction>);
void add_separator();
void popup(const Point& screen_position);
diff --git a/LibGUI/GMenuItem.cpp b/LibGUI/GMenuItem.cpp
index cfd38e778d..c07333c514 100644
--- a/LibGUI/GMenuItem.cpp
+++ b/LibGUI/GMenuItem.cpp
@@ -9,7 +9,7 @@ GMenuItem::GMenuItem(unsigned menu_id, Type type)
{
}
-GMenuItem::GMenuItem(unsigned menu_id, Retained<GAction>&& action)
+GMenuItem::GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&& action)
: m_type(Action)
, m_menu_id(menu_id)
, m_action(move(action))
diff --git a/LibGUI/GMenuItem.h b/LibGUI/GMenuItem.h
index 61ec355179..092b2c9fe0 100644
--- a/LibGUI/GMenuItem.h
+++ b/LibGUI/GMenuItem.h
@@ -15,7 +15,7 @@ public:
};
GMenuItem(unsigned menu_id, Type);
- GMenuItem(unsigned menu_id, Retained<GAction>&&);
+ GMenuItem(unsigned menu_id, NonnullRefPtr<GAction>&&);
~GMenuItem();
Type type() const { return m_type; }
@@ -45,5 +45,5 @@ private:
bool m_enabled { true };
bool m_checkable { false };
bool m_checked { false };
- RetainPtr<GAction> m_action;
+ RefPtr<GAction> m_action;
};
diff --git a/LibGUI/GMessageBox.cpp b/LibGUI/GMessageBox.cpp
index c628997069..33fa96b3a5 100644
--- a/LibGUI/GMessageBox.cpp
+++ b/LibGUI/GMessageBox.cpp
@@ -23,7 +23,7 @@ GMessageBox::~GMessageBox()
{
}
-RetainPtr<GraphicsBitmap> GMessageBox::icon() const
+RefPtr<GraphicsBitmap> GMessageBox::icon() const
{
switch (m_type) {
case Type::Information:
diff --git a/LibGUI/GMessageBox.h b/LibGUI/GMessageBox.h
index e05e0d2e06..3b7a0f9e19 100644
--- a/LibGUI/GMessageBox.h
+++ b/LibGUI/GMessageBox.h
@@ -20,7 +20,7 @@ public:
private:
void build();
- RetainPtr<GraphicsBitmap> icon() const;
+ RefPtr<GraphicsBitmap> icon() const;
String m_text;
Type m_type { Type::None };
diff --git a/LibGUI/GRadioButton.cpp b/LibGUI/GRadioButton.cpp
index 59cab6d904..377b3000ae 100644
--- a/LibGUI/GRadioButton.cpp
+++ b/LibGUI/GRadioButton.cpp
@@ -2,10 +2,10 @@
#include <LibGUI/GRadioButton.h>
#include <SharedGraphics/GraphicsBitmap.h>
-static RetainPtr<GraphicsBitmap> s_unfilled_circle_bitmap;
-static RetainPtr<GraphicsBitmap> s_filled_circle_bitmap;
-static RetainPtr<GraphicsBitmap> s_changing_filled_circle_bitmap;
-static RetainPtr<GraphicsBitmap> s_changing_unfilled_circle_bitmap;
+static RefPtr<GraphicsBitmap> s_unfilled_circle_bitmap;
+static RefPtr<GraphicsBitmap> s_filled_circle_bitmap;
+static RefPtr<GraphicsBitmap> s_changing_filled_circle_bitmap;
+static RefPtr<GraphicsBitmap> s_changing_unfilled_circle_bitmap;
GRadioButton::GRadioButton(const StringView& text, GWidget* parent)
: GAbstractButton(text, parent)
diff --git a/LibGUI/GResizeCorner.h b/LibGUI/GResizeCorner.h
index 2d6ae0c670..ac73703879 100644
--- a/LibGUI/GResizeCorner.h
+++ b/LibGUI/GResizeCorner.h
@@ -14,5 +14,5 @@ protected:
virtual void leave_event(CEvent&) override;
private:
- RetainPtr<GraphicsBitmap> m_bitmap;
+ RefPtr<GraphicsBitmap> m_bitmap;
};
diff --git a/LibGUI/GSortingProxyModel.cpp b/LibGUI/GSortingProxyModel.cpp
index 7897503ffd..5bf379695b 100644
--- a/LibGUI/GSortingProxyModel.cpp
+++ b/LibGUI/GSortingProxyModel.cpp
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
-GSortingProxyModel::GSortingProxyModel(Retained<GModel>&& target)
+GSortingProxyModel::GSortingProxyModel(NonnullRefPtr<GModel>&& target)
: m_target(move(target))
, m_key_column(-1)
{
diff --git a/LibGUI/GSortingProxyModel.h b/LibGUI/GSortingProxyModel.h
index 334878bcc5..d9f64a1ac1 100644
--- a/LibGUI/GSortingProxyModel.h
+++ b/LibGUI/GSortingProxyModel.h
@@ -4,7 +4,7 @@
class GSortingProxyModel final : public GModel {
public:
- static Retained<GSortingProxyModel> create(Retained<GModel>&& model) { return adopt(*new GSortingProxyModel(move(model))); }
+ static NonnullRefPtr<GSortingProxyModel> create(NonnullRefPtr<GModel>&& model) { return adopt(*new GSortingProxyModel(move(model))); }
virtual ~GSortingProxyModel() override;
virtual int row_count(const GModelIndex& = GModelIndex()) const override;
@@ -22,14 +22,14 @@ public:
GModelIndex map_to_target(const GModelIndex&) const;
private:
- explicit GSortingProxyModel(Retained<GModel>&&);
+ explicit GSortingProxyModel(NonnullRefPtr<GModel>&&);
GModel& target() { return *m_target; }
const GModel& target() const { return *m_target; }
void resort();
- Retained<GModel> m_target;
+ NonnullRefPtr<GModel> m_target;
Vector<int> m_row_mappings;
int m_key_column { -1 };
GSortOrder m_sort_order { GSortOrder::Ascending };
diff --git a/LibGUI/GTableView.h b/LibGUI/GTableView.h
index 9db2e68eaa..3f63f94aab 100644
--- a/LibGUI/GTableView.h
+++ b/LibGUI/GTableView.h
@@ -60,7 +60,7 @@ private:
int width { 0 };
bool has_initialized_width { false };
bool visibility { true };
- RetainPtr<GAction> visibility_action;
+ RefPtr<GAction> visibility_action;
};
ColumnData& column_data(int column) const;
diff --git a/LibGUI/GTextEditor.h b/LibGUI/GTextEditor.h
index 124f82b8ca..fc7b387cac 100644
--- a/LibGUI/GTextEditor.h
+++ b/LibGUI/GTextEditor.h
@@ -221,11 +221,11 @@ private:
int m_horizontal_content_padding { 2 };
GTextRange m_selection;
OwnPtr<GMenu> m_context_menu;
- RetainPtr<GAction> m_undo_action;
- RetainPtr<GAction> m_redo_action;
- RetainPtr<GAction> m_cut_action;
- RetainPtr<GAction> m_copy_action;
- RetainPtr<GAction> m_paste_action;
- RetainPtr<GAction> m_delete_action;
+ RefPtr<GAction> m_undo_action;
+ RefPtr<GAction> m_redo_action;
+ RefPtr<GAction> m_cut_action;
+ RefPtr<GAction> m_copy_action;
+ RefPtr<GAction> m_paste_action;
+ RefPtr<GAction> m_delete_action;
CElapsedTimer m_triple_click_timer;
};
diff --git a/LibGUI/GToolBar.cpp b/LibGUI/GToolBar.cpp
index 5aa6f469c2..72e95e2620 100644
--- a/LibGUI/GToolBar.cpp
+++ b/LibGUI/GToolBar.cpp
@@ -18,7 +18,7 @@ GToolBar::~GToolBar()
{
}
-void GToolBar::add_action(Retained<GAction>&& action)
+void GToolBar::add_action(NonnullRefPtr<GAction>&& action)
{
GAction* raw_action_ptr = action.ptr();
auto item = make<Item>();
diff --git a/LibGUI/GToolBar.h b/LibGUI/GToolBar.h
index ec0c654bb0..375734e586 100644
--- a/LibGUI/GToolBar.h
+++ b/LibGUI/GToolBar.h
@@ -9,7 +9,7 @@ public:
explicit GToolBar(GWidget* parent);
virtual ~GToolBar() override;
- void add_action(Retained<GAction>&&);
+ void add_action(NonnullRefPtr<GAction>&&);
void add_separator();
bool has_frame() const { return m_has_frame; }
@@ -27,7 +27,7 @@ private:
Action
};
Type type { Invalid };
- RetainPtr<GAction> action;
+ RefPtr<GAction> action;
};
Vector<OwnPtr<Item>> m_items;
bool m_has_frame { true };
diff --git a/LibGUI/GTreeView.h b/LibGUI/GTreeView.h
index 3cd62d8782..6fe0df6e69 100644
--- a/LibGUI/GTreeView.h
+++ b/LibGUI/GTreeView.h
@@ -37,6 +37,6 @@ private:
mutable HashMap<void*, OwnPtr<MetadataForIndex>> m_view_metadata;
- RetainPtr<GraphicsBitmap> m_expand_bitmap;
- RetainPtr<GraphicsBitmap> m_collapse_bitmap;
+ RefPtr<GraphicsBitmap> m_expand_bitmap;
+ RefPtr<GraphicsBitmap> m_collapse_bitmap;
};
diff --git a/LibGUI/GWidget.cpp b/LibGUI/GWidget.cpp
index d0ac2161b0..814cda4c86 100644
--- a/LibGUI/GWidget.cpp
+++ b/LibGUI/GWidget.cpp
@@ -371,7 +371,7 @@ void GWidget::set_focus(bool focus)
}
}
-void GWidget::set_font(RetainPtr<Font>&& font)
+void GWidget::set_font(RefPtr<Font>&& font)
{
if (!font)
m_font = Font::default_font();
diff --git a/LibGUI/GWidget.h b/LibGUI/GWidget.h
index 36d2d025f5..ff23613c22 100644
--- a/LibGUI/GWidget.h
+++ b/LibGUI/GWidget.h
@@ -161,7 +161,7 @@ public:
bool fill_with_background_color() const { return m_fill_with_background_color; }
const Font& font() const { return *m_font; }
- void set_font(RetainPtr<Font>&&);
+ void set_font(RefPtr<Font>&&);
void set_global_cursor_tracking(bool);
bool global_cursor_tracking() const;
@@ -221,7 +221,7 @@ private:
Rect m_relative_rect;
Color m_background_color;
Color m_foreground_color;
- RetainPtr<Font> m_font;
+ RefPtr<Font> m_font;
String m_tooltip;
SizePolicy m_horizontal_size_policy { SizePolicy::Fill };
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index 1f2e0b1682..b404480f87 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -593,7 +593,7 @@ void GWindow::flip(const Vector<Rect, 32>& dirty_rects)
painter.blit(dirty_rect.location(), *m_front_bitmap, dirty_rect);
}
-Retained<GraphicsBitmap> GWindow::create_backing_bitmap(const Size& size)
+NonnullRefPtr<GraphicsBitmap> GWindow::create_backing_bitmap(const Size& size)
{
ASSERT(GEventLoop::server_pid());
ASSERT(!size.is_empty());
diff --git a/LibGUI/GWindow.h b/LibGUI/GWindow.h
index f83fded8a5..48cee884a2 100644
--- a/LibGUI/GWindow.h
+++ b/LibGUI/GWindow.h
@@ -135,12 +135,12 @@ private:
void collect_keyboard_activation_targets();
- Retained<GraphicsBitmap> create_backing_bitmap(const Size&);
+ NonnullRefPtr<GraphicsBitmap> create_backing_bitmap(const Size&);
void set_current_backing_bitmap(GraphicsBitmap&, bool flush_immediately = false);
void flip(const Vector<Rect, 32>& dirty_rects);
- RetainPtr<GraphicsBitmap> m_front_bitmap;
- RetainPtr<GraphicsBitmap> m_back_bitmap;
+ RefPtr<GraphicsBitmap> m_front_bitmap;
+ RefPtr<GraphicsBitmap> m_back_bitmap;
int m_window_id { 0 };
float m_opacity_when_windowless { 1.0f };
GWidget* m_main_widget { nullptr };
diff --git a/LibHTML/CSS/StyleDeclaration.h b/LibHTML/CSS/StyleDeclaration.h
index 558e084925..b93769e193 100644
--- a/LibHTML/CSS/StyleDeclaration.h
+++ b/LibHTML/CSS/StyleDeclaration.h
@@ -13,5 +13,5 @@ public:
public:
String m_property_name;
- RetainPtr<StyleValue> m_value;
+ RefPtr<StyleValue> m_value;
};
diff --git a/LibHTML/DOM/Document.cpp b/LibHTML/DOM/Document.cpp
index e1ca034b16..f642ad55c4 100644
--- a/LibHTML/DOM/Document.cpp
+++ b/LibHTML/DOM/Document.cpp
@@ -36,7 +36,7 @@ void Document::build_layout_tree()
create_layout_tree_for_node(*this);
}
-RetainPtr<LayoutNode> Document::create_layout_node()
+RefPtr<LayoutNode> Document::create_layout_node()
{
return adopt(*new LayoutDocument(*this));
}
diff --git a/LibHTML/DOM/Document.h b/LibHTML/DOM/Document.h
index 2b2f697f51..86846cfeb8 100644
--- a/LibHTML/DOM/Document.h
+++ b/LibHTML/DOM/Document.h
@@ -10,7 +10,7 @@ public:
Document();
virtual ~Document() override;
- virtual RetainPtr<LayoutNode> create_layout_node() override;
+ virtual RefPtr<LayoutNode> create_layout_node() override;
void build_layout_tree();
diff --git a/LibHTML/DOM/Element.cpp b/LibHTML/DOM/Element.cpp
index d6128cc9f2..e291fc3dd0 100644
--- a/LibHTML/DOM/Element.cpp
+++ b/LibHTML/DOM/Element.cpp
@@ -50,7 +50,7 @@ void Element::set_attributes(Vector<Attribute>&& attributes)
m_attributes = move(attributes);
}
-RetainPtr<LayoutNode> Element::create_layout_node()
+RefPtr<LayoutNode> Element::create_layout_node()
{
if (m_tag_name == "html")
return adopt(*new LayoutBlock(*this));
diff --git a/LibHTML/DOM/Element.h b/LibHTML/DOM/Element.h
index 416e59e424..1331d20c7e 100644
--- a/LibHTML/DOM/Element.h
+++ b/LibHTML/DOM/Element.h
@@ -40,7 +40,7 @@ public:
callback(attribute.name(), attribute.value());
}
- virtual RetainPtr<LayoutNode> create_layout_node() override;
+ virtual RefPtr<LayoutNode> create_layout_node() override;
private:
Attribute* find_attribute(const String& name);
diff --git a/LibHTML/DOM/Node.cpp b/LibHTML/DOM/Node.cpp
index c528dc2543..cdf160797e 100644
--- a/LibHTML/DOM/Node.cpp
+++ b/LibHTML/DOM/Node.cpp
@@ -23,12 +23,12 @@ void Node::deref()
delete this;
}
-RetainPtr<LayoutNode> Node::create_layout_node()
+RefPtr<LayoutNode> Node::create_layout_node()
{
return nullptr;
}
-void Node::set_layout_node(Retained<LayoutNode> layout_node)
+void Node::set_layout_node(NonnullRefPtr<LayoutNode> layout_node)
{
m_layout_node = move(layout_node);
}
diff --git a/LibHTML/DOM/Node.h b/LibHTML/DOM/Node.h
index a021225f9e..50fede6403 100644
--- a/LibHTML/DOM/Node.h
+++ b/LibHTML/DOM/Node.h
@@ -41,12 +41,12 @@ public:
void set_next_sibling(Node* node) { m_next_sibling = node; }
void set_previous_sibling(Node* node) { m_previous_sibling = node; }
- virtual RetainPtr<LayoutNode> create_layout_node();
+ virtual RefPtr<LayoutNode> create_layout_node();
const LayoutNode* layout_node() const { return m_layout_node; }
LayoutNode* layout_node() { return m_layout_node; }
- void set_layout_node(Retained<LayoutNode>);
+ void set_layout_node(NonnullRefPtr<LayoutNode>);
protected:
explicit Node(NodeType);
@@ -56,5 +56,5 @@ protected:
ParentNode* m_parent_node { nullptr };
Node* m_next_sibling { nullptr };
Node* m_previous_sibling { nullptr };
- RetainPtr<LayoutNode> m_layout_node;
+ RefPtr<LayoutNode> m_layout_node;
};
diff --git a/LibHTML/DOM/ParentNode.cpp b/LibHTML/DOM/ParentNode.cpp
index 7eb2a950c8..278e7a4c07 100644
--- a/LibHTML/DOM/ParentNode.cpp
+++ b/LibHTML/DOM/ParentNode.cpp
@@ -1,6 +1,6 @@
#include <LibHTML/DOM/ParentNode.h>
-void ParentNode::append_child(Retained<Node> node)
+void ParentNode::append_child(NonnullRefPtr<Node> node)
{
if (m_last_child)
m_last_child->set_next_sibling(node.ptr());
diff --git a/LibHTML/DOM/ParentNode.h b/LibHTML/DOM/ParentNode.h
index 9bdc1e3668..8bcd59adda 100644
--- a/LibHTML/DOM/ParentNode.h
+++ b/LibHTML/DOM/ParentNode.h
@@ -4,7 +4,7 @@
class ParentNode : public Node {
public:
- void append_child(Retained<Node>);
+ void append_child(NonnullRefPtr<Node>);
Node* first_child() { return m_first_child; }
Node* last_child() { return m_last_child; }
diff --git a/LibHTML/DOM/Text.cpp b/LibHTML/DOM/Text.cpp
index 1f13e37092..8bb807270c 100644
--- a/LibHTML/DOM/Text.cpp
+++ b/LibHTML/DOM/Text.cpp
@@ -11,7 +11,7 @@ Text::~Text()
{
}
-RetainPtr<LayoutNode> Text::create_layout_node()
+RefPtr<LayoutNode> Text::create_layout_node()
{
return adopt(*new LayoutText(*this));
}
diff --git a/LibHTML/DOM/Text.h b/LibHTML/DOM/Text.h
index 37742b8063..e7ce724026 100644
--- a/LibHTML/DOM/Text.h
+++ b/LibHTML/DOM/Text.h
@@ -10,7 +10,7 @@ public:
const String& data() const { return m_data; }
- virtual RetainPtr<LayoutNode> create_layout_node() override;
+ virtual RefPtr<LayoutNode> create_layout_node() override;
private:
String m_data;
diff --git a/LibHTML/Frame.h b/LibHTML/Frame.h
index 3007a02fbf..9fd4467dc0 100644
--- a/LibHTML/Frame.h
+++ b/LibHTML/Frame.h
@@ -16,6 +16,6 @@ public:
void layout();
private:
- RetainPtr<Document> m_document;
+ RefPtr<Document> m_document;
Size m_size;
};
diff --git a/LibHTML/Layout/LayoutNode.cpp b/LibHTML/Layout/LayoutNode.cpp
index e6d858868a..6e36a971ee 100644
--- a/LibHTML/Layout/LayoutNode.cpp
+++ b/LibHTML/Layout/LayoutNode.cpp
@@ -22,7 +22,7 @@ void LayoutNode::deref()
delete this;
}
-void LayoutNode::append_child(Retained<LayoutNode> node)
+void LayoutNode::append_child(NonnullRefPtr<LayoutNode> node)
{
if (m_last_child)
m_last_child->set_next_sibling(node.ptr());
diff --git a/LibHTML/Layout/LayoutNode.h b/LibHTML/Layout/LayoutNode.h
index 3aa31e8f2a..75c21a176d 100644
--- a/LibHTML/Layout/LayoutNode.h
+++ b/LibHTML/Layout/LayoutNode.h
@@ -38,7 +38,7 @@ public:
bool has_children() const { return m_first_child; }
- void append_child(Retained<LayoutNode>);
+ void append_child(NonnullRefPtr<LayoutNode>);
void set_next_sibling(LayoutNode* node) { m_next_sibling = node; }
void set_previous_sibling(LayoutNode* node) { m_previous_sibling = node; }
diff --git a/LibHTML/Parser/Parser.cpp b/LibHTML/Parser/Parser.cpp
index db16fe28b5..63f1ffb45b 100644
--- a/LibHTML/Parser/Parser.cpp
+++ b/LibHTML/Parser/Parser.cpp
@@ -4,7 +4,7 @@
#include <ctype.h>
#include <stdio.h>
-static Retained<Element> create_element(const String& tag_name)
+static NonnullRefPtr<Element> create_element(const String& tag_name)
{
return adopt(*new Element(tag_name));
}
@@ -32,9 +32,9 @@ static bool is_self_closing_tag(const String& tag_name)
|| tag_name == "wbr";
}
-Retained<Document> parse(const String& html)
+NonnullRefPtr<Document> parse(const String& html)
{
- Vector<Retained<ParentNode>> node_stack;
+ Vector<NonnullRefPtr<ParentNode>> node_stack;
auto doc = adopt(*new Document);
node_stack.append(doc);
diff --git a/LibHTML/Parser/Parser.h b/LibHTML/Parser/Parser.h
index 453f9833fa..577ebf5f69 100644
--- a/LibHTML/Parser/Parser.h
+++ b/LibHTML/Parser/Parser.h
@@ -3,5 +3,5 @@
#include <AK/Retained.h>
#include <LibHTML/DOM/Document.h>
-Retained<Document> parse(const String& html);
+NonnullRefPtr<Document> parse(const String& html);
diff --git a/Servers/WindowServer/WSButton.cpp b/Servers/WindowServer/WSButton.cpp
index f4dfb9f5da..10b635fb68 100644
--- a/Servers/WindowServer/WSButton.cpp
+++ b/Servers/WindowServer/WSButton.cpp
@@ -5,7 +5,7 @@
#include <WindowServer/WSEvent.h>
#include <WindowServer/WSWindowManager.h>
-WSButton::WSButton(WSWindowFrame& frame, Retained<CharacterBitmap>&& bitmap, Function<void(WSButton&)>&& on_click_handler)
+WSButton::WSButton(WSWindowFrame& frame, NonnullRefPtr<CharacterBitmap>&& bitmap, Function<void(WSButton&)>&& on_click_handler)
: on_click(move(on_click_handler))
, m_frame(frame)
, m_bitmap(move(bitmap))
diff --git a/Servers/WindowServer/WSButton.h b/Servers/WindowServer/WSButton.h
index 780e55aaa3..b2f0147ce1 100644
--- a/Servers/WindowServer/WSButton.h
+++ b/Servers/WindowServer/WSButton.h
@@ -12,7 +12,7 @@ class WSWindowFrame;
class WSButton : public Weakable<WSButton> {
public:
- WSButton(WSWindowFrame&, Retained<CharacterBitmap>&&, Function<void(WSButton&)>&& on_click_handler);
+ WSButton(WSWindowFrame&, NonnullRefPtr<CharacterBitmap>&&, Function<void(WSButton&)>&& on_click_handler);
~WSButton();
Rect relative_rect() const { return m_relative_rect; }
@@ -34,7 +34,7 @@ public:
private:
WSWindowFrame& m_frame;
Rect m_relative_rect;
- Retained<CharacterBitmap> m_bitmap;
+ NonnullRefPtr<CharacterBitmap> m_bitmap;
bool m_pressed { false };
bool m_visible { true };
bool m_hovered { false };
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index dd3efeedd3..7b326a14e4 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -483,7 +483,7 @@ void WSClientConnection::handle_request(const WSAPIGetClipboardContentsRequest&)
// FIXME: Optimize case where an app is copy/pasting within itself.
// We can just reuse the SharedBuffer then, since it will have the same peer PID.
// It would be even nicer if a SharedBuffer could have an arbitrary number of clients..
- RetainPtr<SharedBuffer> shared_buffer = SharedBuffer::create(m_pid, WSClipboard::the().size());
+ RefPtr<SharedBuffer> shared_buffer = SharedBuffer::create(m_pid, WSClipboard::the().size());
ASSERT(shared_buffer);
memcpy(shared_buffer->data(), WSClipboard::the().data(), WSClipboard::the().size());
shared_buffer->seal();
diff --git a/Servers/WindowServer/WSClientConnection.h b/Servers/WindowServer/WSClientConnection.h
index 1313295799..7032a5e186 100644
--- a/Servers/WindowServer/WSClientConnection.h
+++ b/Servers/WindowServer/WSClientConnection.h
@@ -98,7 +98,7 @@ private:
int m_next_menu_id { 20000 };
int m_next_window_id { 1982 };
- RetainPtr<SharedBuffer> m_last_sent_clipboard_content;
+ RefPtr<SharedBuffer> m_last_sent_clipboard_content;
};
template<typename Matching, typename Callback>
diff --git a/Servers/WindowServer/WSClipboard.cpp b/Servers/WindowServer/WSClipboard.cpp
index 6b4dc8e9d4..113a3dd692 100644
--- a/Servers/WindowServer/WSClipboard.cpp
+++ b/Servers/WindowServer/WSClipboard.cpp
@@ -36,7 +36,7 @@ void WSClipboard::clear()
m_contents_size = 0;
}
-void WSClipboard::set_data(Retained<SharedBuffer>&& data, int contents_size)
+void WSClipboard::set_data(NonnullRefPtr<SharedBuffer>&& data, int contents_size)
{
dbgprintf("WSClipboard::set_data <- %p (%u bytes)\n", data->data(), contents_size);
m_shared_buffer = move(data);
diff --git a/Servers/WindowServer/WSClipboard.h b/Servers/WindowServer/WSClipboard.h
index 7b12598c3b..1f53137ba5 100644
--- a/Servers/WindowServer/WSClipboard.h
+++ b/Servers/WindowServer/WSClipboard.h
@@ -17,11 +17,11 @@ public:
int size() const;
void clear();
- void set_data(Retained<SharedBuffer>&&, int contents_size);
+ void set_data(NonnullRefPtr<SharedBuffer>&&, int contents_size);
private:
WSClipboard();
- RetainPtr<SharedBuffer> m_shared_buffer;
+ RefPtr<SharedBuffer> m_shared_buffer;
int m_contents_size { 0 };
};
diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp
index e21beaf3ff..647a44f5b4 100644
--- a/Servers/WindowServer/WSCompositor.cpp
+++ b/Servers/WindowServer/WSCompositor.cpp
@@ -117,7 +117,7 @@ void WSCompositor::compose()
return IterationDecision::Continue;
PainterStateSaver saver(*m_back_painter);
m_back_painter->add_clip_rect(window.frame().rect());
- RetainPtr<GraphicsBitmap> backing_store = window.backing_store();
+ RefPtr<GraphicsBitmap> backing_store = window.backing_store();
for (auto& dirty_rect : dirty_rects.rects()) {
if (wm.any_opaque_window_above_this_one_contains_rect(window, dirty_rect))
continue;
@@ -226,7 +226,7 @@ bool WSCompositor::set_wallpaper(const String& path, Function<void(bool)>&& call
{
struct Context {
String path;
- RetainPtr<GraphicsBitmap> bitmap;
+ RefPtr<GraphicsBitmap> bitmap;
Function<void(bool)> callback;
};
auto context = make<Context>();
@@ -254,7 +254,7 @@ bool WSCompositor::set_wallpaper(const String& path, Function<void(bool)>&& call
return true;
}
-void WSCompositor::finish_setting_wallpaper(const String& path, Retained<GraphicsBitmap>&& bitmap)
+void WSCompositor::finish_setting_wallpaper(const String& path, NonnullRefPtr<GraphicsBitmap>&& bitmap)
{
m_wallpaper_path = path;
m_wallpaper = move(bitmap);
diff --git a/Servers/WindowServer/WSCompositor.h b/Servers/WindowServer/WSCompositor.h
index 8f9c15f6da..6002bfd4ca 100644
--- a/Servers/WindowServer/WSCompositor.h
+++ b/Servers/WindowServer/WSCompositor.h
@@ -43,7 +43,7 @@ private:
void draw_cursor();
void draw_geometry_label();
void draw_menubar();
- void finish_setting_wallpaper(const String& path, Retained<GraphicsBitmap>&&);
+ void finish_setting_wallpaper(const String& path, NonnullRefPtr<GraphicsBitmap>&&);
unsigned m_compose_count { 0 };
unsigned m_flush_count { 0 };
@@ -52,8 +52,8 @@ private:
bool m_flash_flush { false };
bool m_buffers_are_flipped { false };
- RetainPtr<GraphicsBitmap> m_front_bitmap;
- RetainPtr<GraphicsBitmap> m_back_bitmap;
+ RefPtr<GraphicsBitmap> m_front_bitmap;
+ RefPtr<GraphicsBitmap> m_back_bitmap;
OwnPtr<Painter> m_back_painter;
OwnPtr<Painter> m_front_painter;
@@ -64,5 +64,5 @@ private:
String m_wallpaper_path;
WallpaperMode m_wallpaper_mode { WallpaperMode::Unchecked };
- RetainPtr<GraphicsBitmap> m_wallpaper;
+ RefPtr<GraphicsBitmap> m_wallpaper;
};
diff --git a/Servers/WindowServer/WSCursor.cpp b/Servers/WindowServer/WSCursor.cpp
index 1923908513..54f8bc8271 100644
--- a/Servers/WindowServer/WSCursor.cpp
+++ b/Servers/WindowServer/WSCursor.cpp
@@ -1,7 +1,7 @@
#include <WindowServer/WSCursor.h>
#include <WindowServer/WSWindowManager.h>
-WSCursor::WSCursor(Retained<GraphicsBitmap>&& bitmap, const Point& hotspot)
+WSCursor::WSCursor(NonnullRefPtr<GraphicsBitmap>&& bitmap, const Point& hotspot)
: m_bitmap(move(bitmap))
, m_hotspot(hotspot)
{
@@ -11,17 +11,17 @@ WSCursor::~WSCursor()
{
}
-Retained<WSCursor> WSCursor::create(Retained<GraphicsBitmap>&& bitmap)
+NonnullRefPtr<WSCursor> WSCursor::create(NonnullRefPtr<GraphicsBitmap>&& bitmap)
{
return adopt(*new WSCursor(move(bitmap), bitmap->rect().center()));
}
-Retained<WSCursor> WSCursor::create(Retained<GraphicsBitmap>&& bitmap, const Point& hotspot)
+NonnullRefPtr<WSCursor> WSCursor::create(NonnullRefPtr<GraphicsBitmap>&& bitmap, const Point& hotspot)
{
return adopt(*new WSCursor(move(bitmap), hotspot));
}
-RetainPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor)
+RefPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor)
{
switch (standard_cursor) {
case WSStandardCursor::None:
diff --git a/Servers/WindowServer/WSCursor.h b/Servers/WindowServer/WSCursor.h
index e8437c808a..76640da4a7 100644
--- a/Servers/WindowServer/WSCursor.h
+++ b/Servers/WindowServer/WSCursor.h
@@ -14,9 +14,9 @@ enum class WSStandardCursor {
class WSCursor : public RefCounted<WSCursor> {
public:
- static Retained<WSCursor> create(Retained<GraphicsBitmap>&&, const Point& hotspot);
- static Retained<WSCursor> create(Retained<GraphicsBitmap>&&);
- static RetainPtr<WSCursor> create(WSStandardCursor);
+ static NonnullRefPtr<WSCursor> create(NonnullRefPtr<GraphicsBitmap>&&, const Point& hotspot);
+ static NonnullRefPtr<WSCursor> create(NonnullRefPtr<GraphicsBitmap>&&);
+ static RefPtr<WSCursor> create(WSStandardCursor);
~WSCursor();
Point hotspot() const { return m_hotspot; }
@@ -26,8 +26,8 @@ public:
Size size() const { return m_bitmap->size(); }
private:
- WSCursor(Retained<GraphicsBitmap>&&, const Point&);
+ WSCursor(NonnullRefPtr<GraphicsBitmap>&&, const Point&);
- RetainPtr<GraphicsBitmap> m_bitmap;
+ RefPtr<GraphicsBitmap> m_bitmap;
Point m_hotspot;
};
diff --git a/Servers/WindowServer/WSWindow.h b/Servers/WindowServer/WSWindow.h
index 46fbee3132..8f55adb23c 100644
--- a/Servers/WindowServer/WSWindow.h
+++ b/Servers/WindowServer/WSWindow.h
@@ -102,7 +102,7 @@ public:
virtual void event(CEvent&) override;
GraphicsBitmap* backing_store() { return m_backing_store.ptr(); }
- void set_backing_store(RetainPtr<GraphicsBitmap>&& backing_store)
+ void set_backing_store(RefPtr<GraphicsBitmap>&& backing_store)
{
m_last_backing_store = move(m_backing_store);
m_backing_store = move(backing_store);
@@ -129,7 +129,7 @@ public:
const GraphicsBitmap& icon() const { return *m_icon; }
String icon_path() const { return m_icon_path; }
- void set_icon(const String& path, Retained<GraphicsBitmap>&& icon)
+ void set_icon(const String& path, NonnullRefPtr<GraphicsBitmap>&& icon)
{
m_icon_path = path;
m_icon = move(icon);
@@ -137,7 +137,7 @@ public:
void set_default_icon();
const WSCursor* override_cursor() const { return m_override_cursor.ptr(); }
- void set_override_cursor(RetainPtr<WSCursor>&& cursor) { m_override_cursor = move(cursor); }
+ void set_override_cursor(RefPtr<WSCursor>&& cursor) { m_override_cursor = move(cursor); }
void request_update(const Rect&);
DisjointRectSet take_pending_paint_rects() { return move(m_pending_paint_rects); }
@@ -166,15 +166,15 @@ private:
bool m_maximized { false };
bool m_fullscreen { false };
bool m_show_titlebar { true };
- RetainPtr<GraphicsBitmap> m_backing_store;
- RetainPtr<GraphicsBitmap> m_last_backing_store;
+ RefPtr<GraphicsBitmap> m_backing_store;
+ RefPtr<GraphicsBitmap> m_last_backing_store;
int m_window_id { -1 };
float m_opacity { 1 };
Size m_size_increment;
Size m_base_size;
- Retained<GraphicsBitmap> m_icon;
+ NonnullRefPtr<GraphicsBitmap> m_icon;
String m_icon_path;
- RetainPtr<WSCursor> m_override_cursor;
+ RefPtr<WSCursor> m_override_cursor;
WSWindowFrame m_frame;
Color m_background_color { Color::LightGray };
unsigned m_wm_event_mask { 0 };
diff --git a/Servers/WindowServer/WSWindowManager.cpp b/Servers/WindowServer/WSWindowManager.cpp
index 541379ecfa..9129f4c226 100644
--- a/Servers/WindowServer/WSWindowManager.cpp
+++ b/Servers/WindowServer/WSWindowManager.cpp
@@ -109,7 +109,7 @@ WSWindowManager::~WSWindowManager()
{
}
-Retained<WSCursor> WSWindowManager::get_cursor(const String& name, const Point& hotspot)
+NonnullRefPtr<WSCursor> WSWindowManager::get_cursor(const String& name, const Point& hotspot)
{
auto path = m_wm_config->read_entry("Cursor", name, "/res/cursors/arrow.png");
auto gb = GraphicsBitmap::load_from_file(path);
@@ -118,7 +118,7 @@ Retained<WSCursor> WSWindowManager::get_cursor(const String& name, const Point&
return WSCursor::create(*GraphicsBitmap::load_from_file("/res/cursors/arrow.png"));
}
-Retained<WSCursor> WSWindowManager::get_cursor(const String& name)
+NonnullRefPtr<WSCursor> WSWindowManager::get_cursor(const String& name)
{
auto path = m_wm_config->read_entry("Cursor", name, "/res/cursors/arrow.png");
auto gb = GraphicsBitmap::load_from_file(path);
diff --git a/Servers/WindowServer/WSWindowManager.h b/Servers/WindowServer/WSWindowManager.h
index d73fffb971..2dad80a4df 100644
--- a/Servers/WindowServer/WSWindowManager.h
+++ b/Servers/WindowServer/WSWindowManager.h
@@ -52,7 +52,7 @@ public:
WSWindowManager();
virtual ~WSWindowManager() override;
- RetainPtr<CConfigFile> wm_config() const { return m_wm_config; }
+ RefPtr<CConfigFile> wm_config() const { return m_wm_config; }
void reload_config(bool);
void add_window(WSWindow&);
@@ -142,8 +142,8 @@ public:
}
private:
- Retained<WSCursor> get_cursor(const String& name);
- Retained<WSCursor> get_cursor(const String& name, const Point& hotspot);
+ NonnullRefPtr<WSCursor> get_cursor(const String& name);
+ NonnullRefPtr<WSCursor> get_cursor(const String& name, const Point& hotspot);
void process_mouse_event(WSMouseEvent&, WSWindow*& hovered_window);
void process_event_for_doubleclick(WSWindow& window, WSMouseEvent& event);
@@ -175,14 +175,14 @@ private:
void tell_wm_listener_about_window_rect(WSWindow& listener, WSWindow&);
void pick_new_active_window();
- RetainPtr<WSCursor> m_arrow_cursor;
- RetainPtr<WSCursor> m_resize_horizontally_cursor;
- RetainPtr<WSCursor> m_resize_vertically_cursor;
- RetainPtr<WSCursor> m_resize_diagonally_tlbr_cursor;
- RetainPtr<WSCursor> m_resize_diagonally_bltr_cursor;
- RetainPtr<WSCursor> m_i_beam_cursor;
- RetainPtr<WSCursor> m_disallowed_cursor;
- RetainPtr<WSCursor> m_move_cursor;
+ RefPtr<WSCursor> m_arrow_cursor;
+ RefPtr<WSCursor> m_resize_horizontally_cursor;
+ RefPtr<WSCursor> m_resize_vertically_cursor;
+ RefPtr<WSCursor> m_resize_diagonally_tlbr_cursor;
+ RefPtr<WSCursor> m_resize_diagonally_bltr_cursor;
+ RefPtr<WSCursor> m_i_beam_cursor;
+ RefPtr<WSCursor> m_disallowed_cursor;
+ RefPtr<WSCursor> m_move_cursor;
Color m_background_color;
Color m_active_window_border_color;
@@ -245,7 +245,7 @@ private:
WeakPtr<WSButton> m_cursor_tracking_button;
WeakPtr<WSButton> m_hovered_button;
- RetainPtr<CConfigFile> m_wm_config;
+ RefPtr<CConfigFile> m_wm_config;
};
template<typename Callback>
diff --git a/SharedGraphics/CharacterBitmap.cpp b/SharedGraphics/CharacterBitmap.cpp
index ecfc550d19..3a3805f3ac 100644
--- a/SharedGraphics/CharacterBitmap.cpp
+++ b/SharedGraphics/CharacterBitmap.cpp
@@ -10,7 +10,7 @@ CharacterBitmap::~CharacterBitmap()
{
}
-Retained<CharacterBitmap> CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height)
+NonnullRefPtr<CharacterBitmap> CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height)
{
return adopt(*new CharacterBitmap(asciiData, width, height));
}
diff --git a/SharedGraphics/CharacterBitmap.h b/SharedGraphics/CharacterBitmap.h
index bc8edac764..d7b90f97d7 100644
--- a/SharedGraphics/CharacterBitmap.h
+++ b/SharedGraphics/CharacterBitmap.h
@@ -6,7 +6,7 @@
class CharacterBitmap : public RefCounted<CharacterBitmap> {
public:
- static Retained<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height);
+ static NonnullRefPtr<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height);
~CharacterBitmap();
bool bit_at(unsigned x, unsigned y) const { return m_bits[y * width() + x] == '#'; }
diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp
index 47baaa7163..9f58f55d5c 100644
--- a/SharedGraphics/Font.cpp
+++ b/SharedGraphics/Font.cpp
@@ -53,7 +53,7 @@ Font& Font::default_bold_font()
return *s_default_bold_font;
}
-RetainPtr<Font> Font::clone() const
+RefPtr<Font> Font::clone() const
{
size_t bytes_per_glyph = sizeof(dword) * glyph_height();
// FIXME: This is leaked!
@@ -93,7 +93,7 @@ Font::~Font()
{
}
-RetainPtr<Font> Font::load_from_memory(const byte* data)
+RefPtr<Font> Font::load_from_memory(const byte* data)
{
auto& header = *reinterpret_cast<const FontFileHeader*>(data);
if (memcmp(header.magic, "!Fnt", 4)) {
@@ -114,7 +114,7 @@ RetainPtr<Font> Font::load_from_memory(const byte* data)
return adopt(*new Font(String(header.name), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height));
}
-RetainPtr<Font> Font::load_from_file(const StringView& path)
+RefPtr<Font> Font::load_from_file(const StringView& path)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
diff --git a/SharedGraphics/Font.h b/SharedGraphics/Font.h
index f491ca1a6e..c182b38931 100644
--- a/SharedGraphics/Font.h
+++ b/SharedGraphics/Font.h
@@ -47,9 +47,9 @@ public:
static Font& default_fixed_width_font();
- RetainPtr<Font> clone() const;
+ RefPtr<Font> clone() const;
- static RetainPtr<Font> load_from_file(const StringView& path);
+ static RefPtr<Font> load_from_file(const StringView& path);
bool write_to_file(const StringView& path);
~Font();
@@ -78,7 +78,7 @@ public:
private:
Font(const StringView& name, unsigned* rows, byte* widths, bool is_fixed_width, byte glyph_width, byte glyph_height);
- static RetainPtr<Font> load_from_memory(const byte*);
+ static RefPtr<Font> load_from_memory(const byte*);
String m_name;
diff --git a/SharedGraphics/GraphicsBitmap.cpp b/SharedGraphics/GraphicsBitmap.cpp
index 5d9b85b382..7b87555ee0 100644
--- a/SharedGraphics/GraphicsBitmap.cpp
+++ b/SharedGraphics/GraphicsBitmap.cpp
@@ -7,7 +7,7 @@
#include <sys/mman.h>
#include <unistd.h>
-Retained<GraphicsBitmap> GraphicsBitmap::create(Format format, const Size& size)
+NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create(Format format, const Size& size)
{
return adopt(*new GraphicsBitmap(format, size));
}
@@ -24,17 +24,17 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size)
m_needs_munmap = true;
}
-Retained<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
+NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create_wrapper(Format format, const Size& size, RGBA32* data)
{
return adopt(*new GraphicsBitmap(format, size, data));
}
-RetainPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(const StringView& path)
+RefPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(const StringView& path)
{
return load_png(path);
}
-RetainPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(Format format, const StringView& path, const Size& size)
+RefPtr<GraphicsBitmap> GraphicsBitmap::load_from_file(Format format, const StringView& path, const Size& size)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
@@ -61,12 +61,12 @@ GraphicsBitmap::GraphicsBitmap(Format format, const Size& size, MappedFile&& map
ASSERT(format != Format::Indexed8);
}
-Retained<GraphicsBitmap> GraphicsBitmap::create_with_shared_buffer(Format format, Retained<SharedBuffer>&& shared_buffer, const Size& size)
+NonnullRefPtr<GraphicsBitmap> GraphicsBitmap::create_with_shared_buffer(Format format, NonnullRefPtr<SharedBuffer>&& shared_buffer, const Size& size)
{
return adopt(*new GraphicsBitmap(format, move(shared_buffer), size));
}
-GraphicsBitmap::GraphicsBitmap(Format format, Retained<SharedBuffer>&& shared_buffer, const Size& size)
+GraphicsBitmap::GraphicsBitmap(Format format, NonnullRefPtr<SharedBuffer>&& shared_buffer, const Size& size)
: m_size(size)
, m_data((RGBA32*)shared_buffer->data())
, m_pitch(round_up_to_power_of_two(size.width() * sizeof(RGBA32), 16))
diff --git a/SharedGraphics/GraphicsBitmap.h b/SharedGraphics/GraphicsBitmap.h
index c011bb715e..bf859bdbca 100644
--- a/SharedGraphics/GraphicsBitmap.h
+++ b/SharedGraphics/GraphicsBitmap.h
@@ -19,11 +19,11 @@ public:
Indexed8
};
- static Retained<GraphicsBitmap> create(Format, const Size&);
- static Retained<GraphicsBitmap> create_wrapper(Format, const Size&, RGBA32*);
- static RetainPtr<GraphicsBitmap> load_from_file(const StringView& path);
- static RetainPtr<GraphicsBitmap> load_from_file(Format, const StringView& path, const Size&);
- static Retained<GraphicsBitmap> create_with_shared_buffer(Format, Retained<SharedBuffer>&&, const Size&);
+ static NonnullRefPtr<GraphicsBitmap> create(Format, const Size&);
+ static NonnullRefPtr<GraphicsBitmap> create_wrapper(Format, const Size&, RGBA32*);
+ static RefPtr<GraphicsBitmap> load_from_file(const StringView& path);
+ static RefPtr<GraphicsBitmap> load_from_file(Format, const StringView& path, const Size&);
+ static NonnullRefPtr<GraphicsBitmap> create_with_shared_buffer(Format, NonnullRefPtr<SharedBuffer>&&, const Size&);
~GraphicsBitmap();
RGBA32* scanline(int y);
@@ -81,7 +81,7 @@ private:
GraphicsBitmap(Format, const Size&);
GraphicsBitmap(Format, const Size&, RGBA32*);
GraphicsBitmap(Format, const Size&, MappedFile&&);
- GraphicsBitmap(Format, Retained<SharedBuffer>&&, const Size&);
+ GraphicsBitmap(Format, NonnullRefPtr<SharedBuffer>&&, const Size&);
Size m_size;
RGBA32* m_data { nullptr };
@@ -90,7 +90,7 @@ private:
Format m_format { Format::Invalid };
bool m_needs_munmap { false };
MappedFile m_mapped_file;
- RetainPtr<SharedBuffer> m_shared_buffer;
+ RefPtr<SharedBuffer> m_shared_buffer;
};
inline RGBA32* GraphicsBitmap::scanline(int y)
diff --git a/SharedGraphics/PNGLoader.cpp b/SharedGraphics/PNGLoader.cpp
index 5f67149906..2560966b39 100644
--- a/SharedGraphics/PNGLoader.cpp
+++ b/SharedGraphics/PNGLoader.cpp
@@ -42,7 +42,7 @@ struct PNGLoadingContext {
bool has_seen_zlib_header { false };
bool has_alpha() const { return color_type & 4; }
Vector<Scanline> scanlines;
- RetainPtr<GraphicsBitmap> bitmap;
+ RefPtr<GraphicsBitmap> bitmap;
byte* decompression_buffer { nullptr };
int decompression_buffer_size { 0 };
Vector<byte> compressed_data;
@@ -98,10 +98,10 @@ private:
int m_size_remaining;
};
-static RetainPtr<GraphicsBitmap> load_png_impl(const byte*, int);
+static RefPtr<GraphicsBitmap> load_png_impl(const byte*, int);
static bool process_chunk(Streamer&, PNGLoadingContext& context);
-RetainPtr<GraphicsBitmap> load_png(const StringView& path)
+RefPtr<GraphicsBitmap> load_png(const StringView& path)
{
MappedFile mapped_file(path);
if (!mapped_file.is_valid())
@@ -302,7 +302,7 @@ template<bool has_alpha, byte filter_type>
}
}
-static RetainPtr<GraphicsBitmap> load_png_impl(const byte* data, int data_size)
+static RefPtr<GraphicsBitmap> load_png_impl(const byte* data, int data_size)
{
#ifdef PNG_STOPWATCH_DEBUG
Stopwatch sw("load_png_impl: total");
diff --git a/SharedGraphics/PNGLoader.h b/SharedGraphics/PNGLoader.h
index 7365977ce7..3fa06bd927 100644
--- a/SharedGraphics/PNGLoader.h
+++ b/SharedGraphics/PNGLoader.h
@@ -2,4 +2,4 @@
#include <SharedGraphics/GraphicsBitmap.h>
-RetainPtr<GraphicsBitmap> load_png(const StringView& path);
+RefPtr<GraphicsBitmap> load_png(const StringView& path);
diff --git a/SharedGraphics/Painter.h b/SharedGraphics/Painter.h
index ac92a2fe34..94dd2c4eea 100644
--- a/SharedGraphics/Painter.h
+++ b/SharedGraphics/Painter.h
@@ -80,7 +80,7 @@ protected:
const State& state() const { return m_state_stack.last(); }
Rect m_clip_origin;
- Retained<GraphicsBitmap> m_target;
+ NonnullRefPtr<GraphicsBitmap> m_target;
Vector<State, 4> m_state_stack;
};