summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kernel/Bus/VirtIO/Device.h6
-rw-r--r--Kernel/CommandLine.cpp4
-rw-r--r--Kernel/CommandLine.h2
-rw-r--r--Kernel/Coredump.cpp4
-rw-r--r--Kernel/FileSystem/ProcFS/ProcessExposed.cpp2
-rw-r--r--Kernel/Memory/MemoryManager.cpp18
-rw-r--r--Kernel/Memory/MemoryManager.h2
-rw-r--r--Kernel/Memory/PhysicalRegion.cpp10
-rw-r--r--Kernel/Memory/PhysicalRegion.h2
-rw-r--r--Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp8
-rw-r--r--Kernel/Net/Realtek/RTL8168NetworkAdapter.h4
-rw-r--r--Kernel/Process.cpp2
-rw-r--r--Kernel/Process.h14
-rw-r--r--Kernel/Syscalls/execve.cpp30
-rw-r--r--Ladybird/BrowserWindow.cpp6
-rw-r--r--Ladybird/BrowserWindow.h2
-rw-r--r--Tests/AK/TestIntrusiveRedBlackTree.cpp4
-rw-r--r--Tests/AK/TestVector.cpp2
-rw-r--r--Userland/Applications/PixelPaint/ToolboxWidget.cpp2
-rw-r--r--Userland/Applications/PixelPaint/ToolboxWidget.h4
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.cpp38
-rw-r--r--Userland/Applications/SystemMonitor/ProcessModel.h8
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp6
-rw-r--r--Userland/DevTools/HackStudio/ClassViewWidget.cpp26
-rw-r--r--Userland/DevTools/HackStudio/ClassViewWidget.h4
-rw-r--r--Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Debugger/VariablesModel.h4
-rw-r--r--Userland/DevTools/Inspector/RemoteObject.h2
-rw-r--r--Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp4
-rw-r--r--Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp16
-rw-r--r--Userland/DevTools/Inspector/RemoteObjectPropertyModel.h2
-rw-r--r--Userland/DevTools/Inspector/RemoteProcess.cpp4
-rw-r--r--Userland/DevTools/Inspector/RemoteProcess.h4
-rw-r--r--Userland/DevTools/Profiler/Profile.cpp10
-rw-r--r--Userland/DevTools/UserspaceEmulator/Emulator.h6
-rw-r--r--Userland/DevTools/UserspaceEmulator/SoftMMU.h2
-rw-r--r--Userland/DevTools/UserspaceEmulator/main.cpp4
-rw-r--r--Userland/Games/GameOfLife/BoardWidget.h4
-rw-r--r--Userland/Libraries/LibCoredump/Inspector.cpp2
-rw-r--r--Userland/Libraries/LibCoredump/Inspector.h2
-rw-r--r--Userland/Libraries/LibDebug/DebugInfo.cpp4
-rw-r--r--Userland/Libraries/LibDebug/DebugInfo.h4
-rw-r--r--Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h4
-rw-r--r--Userland/Libraries/LibGUI/CommandPalette.cpp8
-rw-r--r--Userland/Libraries/LibGUI/EditingEngine.cpp4
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.cpp22
-rw-r--r--Userland/Libraries/LibGUI/FileSystemModel.h2
-rw-r--r--Userland/Libraries/LibGUI/Menu.cpp10
-rw-r--r--Userland/Libraries/LibGUI/Menu.h4
-rw-r--r--Userland/Libraries/LibGUI/RegularEditingEngine.cpp2
-rw-r--r--Userland/Libraries/LibGUI/TextDocument.cpp2
-rw-r--r--Userland/Libraries/LibGUI/TextDocument.h10
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.cpp46
-rw-r--r--Userland/Libraries/LibGUI/TextEditor.h6
-rw-r--r--Userland/Libraries/LibGUI/Toolbar.cpp26
-rw-r--r--Userland/Libraries/LibGUI/Toolbar.h2
-rw-r--r--Userland/Libraries/LibGUI/UndoStack.cpp10
-rw-r--r--Userland/Libraries/LibGUI/UndoStack.h2
-rw-r--r--Userland/Libraries/LibGemini/Document.cpp2
-rw-r--r--Userland/Libraries/LibGemini/Document.h2
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp50
-rw-r--r--Userland/Libraries/LibHTTP/Job.cpp6
-rw-r--r--Userland/Libraries/LibHTTP/Job.h2
-rw-r--r--Userland/Libraries/LibIPC/Connection.cpp8
-rw-r--r--Userland/Libraries/LibIPC/Connection.h2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Executable.cpp2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Executable.h2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Generator.cpp4
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Generator.h4
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Interpreter.cpp2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Pass/LoadElimination.cpp8
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp2
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Pass/UnifySameBlocks.cpp8
-rw-r--r--Userland/Libraries/LibJS/Bytecode/PassManager.h4
-rw-r--r--Userland/Libraries/LibMarkdown/ContainerBlock.cpp18
-rw-r--r--Userland/Libraries/LibMarkdown/ContainerBlock.h6
-rw-r--r--Userland/Libraries/LibMarkdown/List.cpp2
-rw-r--r--Userland/Libraries/LibMarkdown/Text.cpp16
-rw-r--r--Userland/Libraries/LibMarkdown/Text.h2
-rw-r--r--Userland/Libraries/LibVT/Terminal.cpp72
-rw-r--r--Userland/Libraries/LibVT/Terminal.h24
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQuery.cpp12
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQuery.h6
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp10
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.cpp48
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h12
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h2
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp8
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h4
-rw-r--r--Userland/Libraries/LibXML/DOM/Node.cpp2
-rw-r--r--Userland/Libraries/LibXML/DOM/Node.h2
-rw-r--r--Userland/Libraries/LibXML/Parser/Parser.cpp2
-rw-r--r--Userland/Services/ChessEngine/MCTSTree.cpp18
-rw-r--r--Userland/Services/ChessEngine/MCTSTree.h2
-rw-r--r--Userland/Services/RequestServer/ConnectionCache.cpp16
-rw-r--r--Userland/Services/RequestServer/ConnectionCache.h14
-rw-r--r--Userland/Services/WebDriver/Client.cpp8
-rw-r--r--Userland/Services/WebDriver/Client.h2
-rw-r--r--Userland/Services/WindowServer/Menu.cpp54
-rw-r--r--Userland/Services/WindowServer/Menu.h8
-rw-r--r--Userland/Services/WindowServer/WindowFrame.cpp12
-rw-r--r--Userland/Services/WindowServer/WindowFrame.h2
-rw-r--r--Userland/Services/WindowServer/WindowManager.cpp30
-rw-r--r--Userland/Services/WindowServer/WindowManager.h10
-rw-r--r--Userland/Shell/Shell.cpp16
-rw-r--r--Userland/Shell/Shell.h6
-rw-r--r--Userland/Utilities/wasm.cpp6
-rw-r--r--Userland/Utilities/xml.cpp6
111 files changed, 517 insertions, 503 deletions
diff --git a/Kernel/Bus/VirtIO/Device.h b/Kernel/Bus/VirtIO/Device.h
index e185f7a171..f8269aafe0 100644
--- a/Kernel/Bus/VirtIO/Device.h
+++ b/Kernel/Bus/VirtIO/Device.h
@@ -144,13 +144,13 @@ protected:
Queue& get_queue(u16 queue_index)
{
VERIFY(queue_index < m_queue_count);
- return m_queues[queue_index];
+ return *m_queues[queue_index];
}
Queue const& get_queue(u16 queue_index) const
{
VERIFY(queue_index < m_queue_count);
- return m_queues[queue_index];
+ return *m_queues[queue_index];
}
template<typename F>
@@ -190,7 +190,7 @@ private:
u8 isr_status();
virtual bool handle_irq(RegisterState const&) override;
- NonnullOwnPtrVector<Queue> m_queues;
+ Vector<NonnullOwnPtr<Queue>> m_queues;
Vector<Configuration> m_configs;
Configuration const* m_common_cfg { nullptr }; // Cached due to high usage
Configuration const* m_notify_cfg { nullptr }; // Cached due to high usage
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index f234f79250..23245e044f 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -304,9 +304,9 @@ StringView CommandLine::userspace_init() const
return lookup("init"sv).value_or("/bin/SystemServer"sv);
}
-NonnullOwnPtrVector<KString> CommandLine::userspace_init_args() const
+Vector<NonnullOwnPtr<KString>> CommandLine::userspace_init_args() const
{
- NonnullOwnPtrVector<KString> args;
+ Vector<NonnullOwnPtr<KString>> args;
auto init_args = lookup("init_args"sv).value_or(""sv).split_view(';');
if (!init_args.is_empty())
diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h
index 4b015cdf19..748c0595ac 100644
--- a/Kernel/CommandLine.h
+++ b/Kernel/CommandLine.h
@@ -97,7 +97,7 @@ public:
[[nodiscard]] bool is_early_boot_console_disabled() const;
[[nodiscard]] AHCIResetMode ahci_reset_mode() const;
[[nodiscard]] StringView userspace_init() const;
- [[nodiscard]] NonnullOwnPtrVector<KString> userspace_init_args() const;
+ [[nodiscard]] Vector<NonnullOwnPtr<KString>> userspace_init_args() const;
[[nodiscard]] StringView root_device() const;
[[nodiscard]] bool is_nvme_polling_enabled() const;
[[nodiscard]] size_t switch_to_tty() const;
diff --git a/Kernel/Coredump.cpp b/Kernel/Coredump.cpp
index 5794ab7e74..be9d2811ac 100644
--- a/Kernel/Coredump.cpp
+++ b/Kernel/Coredump.cpp
@@ -287,14 +287,14 @@ ErrorOr<void> Coredump::create_notes_process_data(auto& builder) const
{
auto arguments_array = TRY(process_obj.add_array("arguments"sv));
for (auto const& argument : m_process->arguments())
- TRY(arguments_array.add(argument.view()));
+ TRY(arguments_array.add(argument->view()));
TRY(arguments_array.finish());
}
{
auto environment_array = TRY(process_obj.add_array("environment"sv));
for (auto const& variable : m_process->environment())
- TRY(environment_array.add(variable.view()));
+ TRY(environment_array.add(variable->view()));
TRY(environment_array.finish());
}
diff --git a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
index 9e23659d4c..80db1e54e8 100644
--- a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
+++ b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
@@ -348,7 +348,7 @@ ErrorOr<void> Process::procfs_get_command_line(KBufferBuilder& builder) const
{
auto array = TRY(JsonArraySerializer<>::try_create(builder));
for (auto const& arg : arguments()) {
- TRY(array.add(arg.view()));
+ TRY(array.add(arg->view()));
}
TRY(array.finish());
return {};
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp
index 2adc2b9097..6d1c59908c 100644
--- a/Kernel/Memory/MemoryManager.cpp
+++ b/Kernel/Memory/MemoryManager.cpp
@@ -365,7 +365,7 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
}
for (auto& region : global_data.physical_regions)
- global_data.system_memory_info.physical_pages += region.size();
+ global_data.system_memory_info.physical_pages += region->size();
register_reserved_ranges();
for (auto& range : global_data.reserved_memory_ranges) {
@@ -384,8 +384,8 @@ UNMAP_AFTER_INIT void MemoryManager::parse_memory_map()
}
for (auto& region : global_data.physical_regions) {
- dmesgln("MM: User physical region: {} - {} (size {:#x})", region.lower(), region.upper().offset(-1), PAGE_SIZE * region.size());
- region.initialize_zones();
+ dmesgln("MM: User physical region: {} - {} (size {:#x})", region->lower(), region->upper().offset(-1), PAGE_SIZE * region->size());
+ region->initialize_zones();
}
});
}
@@ -425,8 +425,8 @@ UNMAP_AFTER_INIT void MemoryManager::initialize_physical_pages()
Optional<size_t> found_region_index;
for (size_t i = 0; i < global_data.physical_regions.size(); ++i) {
auto& region = global_data.physical_regions[i];
- if (region.size() >= physical_page_array_pages_and_page_tables_count) {
- found_region = &region;
+ if (region->size() >= physical_page_array_pages_and_page_tables_count) {
+ found_region = region;
found_region_index = i;
break;
}
@@ -894,10 +894,10 @@ void MemoryManager::deallocate_physical_page(PhysicalAddress paddr)
return m_global_data.with([&](auto& global_data) {
// Are we returning a user page?
for (auto& region : global_data.physical_regions) {
- if (!region.contains(paddr))
+ if (!region->contains(paddr))
continue;
- region.return_page(paddr);
+ region->return_page(paddr);
--global_data.system_memory_info.physical_pages_used;
// Always return pages to the uncommitted pool. Pages that were
@@ -925,7 +925,7 @@ RefPtr<PhysicalPage> MemoryManager::find_free_physical_page(bool committed)
global_data.system_memory_info.physical_pages_uncommitted--;
}
for (auto& region : global_data.physical_regions) {
- page = region.take_free_page();
+ page = region->take_free_page();
if (!page.is_null()) {
++global_data.system_memory_info.physical_pages_used;
break;
@@ -1020,7 +1020,7 @@ ErrorOr<Vector<NonnullRefPtr<PhysicalPage>>> MemoryManager::allocate_contiguous_
return ENOMEM;
for (auto& physical_region : global_data.physical_regions) {
- auto physical_pages = physical_region.take_contiguous_free_pages(page_count);
+ auto physical_pages = physical_region->take_contiguous_free_pages(page_count);
if (!physical_pages.is_empty()) {
global_data.system_memory_info.physical_pages_uncommitted -= page_count;
global_data.system_memory_info.physical_pages_used += page_count;
diff --git a/Kernel/Memory/MemoryManager.h b/Kernel/Memory/MemoryManager.h
index 8ec09e9786..ddd0f9d7a5 100644
--- a/Kernel/Memory/MemoryManager.h
+++ b/Kernel/Memory/MemoryManager.h
@@ -292,7 +292,7 @@ private:
SystemMemoryInfo system_memory_info;
- NonnullOwnPtrVector<PhysicalRegion> physical_regions;
+ Vector<NonnullOwnPtr<PhysicalRegion>> physical_regions;
OwnPtr<PhysicalRegion> physical_pages_region;
RegionTree region_tree;
diff --git a/Kernel/Memory/PhysicalRegion.cpp b/Kernel/Memory/PhysicalRegion.cpp
index 98f8085866..71cd9d58ea 100644
--- a/Kernel/Memory/PhysicalRegion.cpp
+++ b/Kernel/Memory/PhysicalRegion.cpp
@@ -46,7 +46,7 @@ void PhysicalRegion::initialize_zones()
while (remaining_pages >= pages_per_zone) {
m_zones.append(adopt_nonnull_own_or_enomem(new (nothrow) PhysicalZone(base_address, pages_per_zone)).release_value_but_fixme_should_propagate_errors());
base_address = base_address.offset(pages_per_zone * PAGE_SIZE);
- m_usable_zones.append(m_zones.last());
+ m_usable_zones.append(*m_zones.last());
remaining_pages -= pages_per_zone;
++zone_count;
}
@@ -131,10 +131,10 @@ void PhysicalRegion::return_page(PhysicalAddress paddr)
zone_index = m_large_zones + (paddr.get() - small_zone_base) / small_zone_size;
auto& zone = m_zones[zone_index];
- VERIFY(zone.contains(paddr));
- zone.deallocate_block(paddr, 0);
- if (m_full_zones.contains(zone))
- m_usable_zones.append(zone);
+ VERIFY(zone->contains(paddr));
+ zone->deallocate_block(paddr, 0);
+ if (m_full_zones.contains(*zone))
+ m_usable_zones.append(*zone);
}
}
diff --git a/Kernel/Memory/PhysicalRegion.h b/Kernel/Memory/PhysicalRegion.h
index 0a124b9740..9843a96265 100644
--- a/Kernel/Memory/PhysicalRegion.h
+++ b/Kernel/Memory/PhysicalRegion.h
@@ -43,7 +43,7 @@ private:
static constexpr size_t large_zone_size = 16 * MiB;
static constexpr size_t small_zone_size = 1 * MiB;
- NonnullOwnPtrVector<PhysicalZone> m_zones;
+ Vector<NonnullOwnPtr<PhysicalZone>> m_zones;
size_t m_large_zones { 0 };
diff --git a/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp b/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp
index 4d74da54d8..6020d26d3e 100644
--- a/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp
+++ b/Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp
@@ -1103,7 +1103,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_rx_descriptors()
descriptor.buffer_size = RX_BUFFER_SIZE;
descriptor.flags = RXDescriptor::Ownership; // let the NIC know it can use this descriptor
- auto physical_address = m_rx_buffers_regions[i].physical_page(0)->paddr().get();
+ auto physical_address = m_rx_buffers_regions[i]->physical_page(0)->paddr().get();
descriptor.buffer_address_low = physical_address & 0xFFFFFFFF;
descriptor.buffer_address_high = (u64)physical_address >> 32; // cast to prevent shift count >= with of type warnings in 32 bit systems
}
@@ -1120,7 +1120,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_tx_descriptors()
m_tx_buffers_regions.append(move(region));
descriptor.flags = TXDescriptor::FirstSegment | TXDescriptor::LastSegment;
- auto physical_address = m_tx_buffers_regions[i].physical_page(0)->paddr().get();
+ auto physical_address = m_tx_buffers_regions[i]->physical_page(0)->paddr().get();
descriptor.buffer_address_low = physical_address & 0xFFFFFFFF;
descriptor.buffer_address_high = (u64)physical_address >> 32;
}
@@ -1213,7 +1213,7 @@ void RTL8168NetworkAdapter::send_raw(ReadonlyBytes payload)
}
dbgln_if(RTL8168_DEBUG, "RTL8168: Chose descriptor {}", m_tx_free_index);
- memcpy(m_tx_buffers_regions[m_tx_free_index].vaddr().as_ptr(), payload.data(), payload.size());
+ memcpy(m_tx_buffers_regions[m_tx_free_index]->vaddr().as_ptr(), payload.data(), payload.size());
m_tx_free_index = (m_tx_free_index + 1) % number_of_tx_descriptors;
@@ -1247,7 +1247,7 @@ void RTL8168NetworkAdapter::receive()
// Our maximum received packet size is smaller than the descriptor buffer size, so packets should never be segmented
// if this happens on a real NIC it might not respect that, and we will have to support packet segmentation
} else {
- did_receive({ m_rx_buffers_regions[descriptor_index].vaddr().as_ptr(), length });
+ did_receive({ m_rx_buffers_regions[descriptor_index]->vaddr().as_ptr(), length });
}
descriptor.buffer_size = RX_BUFFER_SIZE;
diff --git a/Kernel/Net/Realtek/RTL8168NetworkAdapter.h b/Kernel/Net/Realtek/RTL8168NetworkAdapter.h
index 2b1c741b08..4e199d9533 100644
--- a/Kernel/Net/Realtek/RTL8168NetworkAdapter.h
+++ b/Kernel/Net/Realtek/RTL8168NetworkAdapter.h
@@ -205,10 +205,10 @@ private:
NonnullOwnPtr<IOWindow> m_registers_io_window;
u32 m_ocp_base_address { 0 };
OwnPtr<Memory::Region> m_rx_descriptors_region;
- NonnullOwnPtrVector<Memory::Region> m_rx_buffers_regions;
+ Vector<NonnullOwnPtr<Memory::Region>> m_rx_buffers_regions;
u16 m_rx_free_index { 0 };
OwnPtr<Memory::Region> m_tx_descriptors_region;
- NonnullOwnPtrVector<Memory::Region> m_tx_buffers_regions;
+ Vector<NonnullOwnPtr<Memory::Region>> m_tx_buffers_regions;
u16 m_tx_free_index { 0 };
bool m_link_up { false };
EntropySource m_entropy_source;
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 2f0d91230d..283dd57f15 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -217,7 +217,7 @@ void Process::register_new(Process& process)
});
}
-ErrorOr<NonnullLockRefPtr<Process>> Process::try_create_user_process(LockRefPtr<Thread>& first_thread, StringView path, UserID uid, GroupID gid, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, TTY* tty)
+ErrorOr<NonnullLockRefPtr<Process>> Process::try_create_user_process(LockRefPtr<Thread>& first_thread, StringView path, UserID uid, GroupID gid, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment, TTY* tty)
{
auto parts = path.split_view('/');
if (arguments.is_empty()) {
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 57dd5c1afa..77cb2b0f31 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -192,7 +192,7 @@ public:
}
static LockRefPtr<Process> create_kernel_process(LockRefPtr<Thread>& first_thread, NonnullOwnPtr<KString> name, void (*entry)(void*), void* entry_data = nullptr, u32 affinity = THREAD_AFFINITY_DEFAULT, RegisterProcess do_register = RegisterProcess::Yes);
- static ErrorOr<NonnullLockRefPtr<Process>> try_create_user_process(LockRefPtr<Thread>& first_thread, StringView path, UserID, GroupID, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, TTY*);
+ static ErrorOr<NonnullLockRefPtr<Process>> try_create_user_process(LockRefPtr<Thread>& first_thread, StringView path, UserID, GroupID, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment, TTY*);
static void register_new(Process&);
~Process();
@@ -471,10 +471,10 @@ public:
static constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
static constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
static constexpr size_t max_auxiliary_size = Thread::default_userspace_stack_size / 8;
- NonnullOwnPtrVector<KString> const& arguments() const { return m_arguments; };
- NonnullOwnPtrVector<KString> const& environment() const { return m_environment; };
+ Vector<NonnullOwnPtr<KString>> const& arguments() const { return m_arguments; };
+ Vector<NonnullOwnPtr<KString>> const& environment() const { return m_environment; };
- ErrorOr<void> exec(NonnullOwnPtr<KString> path, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, int recursion_depth = 0);
+ ErrorOr<void> exec(NonnullOwnPtr<KString> path, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, int recursion_depth = 0);
ErrorOr<LoadResult> load(NonnullLockRefPtr<OpenFileDescription> main_program_description, LockRefPtr<OpenFileDescription> interpreter_description, const ElfW(Ehdr) & main_program_header);
@@ -606,7 +606,7 @@ private:
bool create_perf_events_buffer_if_needed();
void delete_perf_events_buffer();
- ErrorOr<void> do_exec(NonnullLockRefPtr<OpenFileDescription> main_program_description, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, LockRefPtr<OpenFileDescription> interpreter_description, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, const ElfW(Ehdr) & main_program_header);
+ ErrorOr<void> do_exec(NonnullLockRefPtr<OpenFileDescription> main_program_description, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment, LockRefPtr<OpenFileDescription> interpreter_description, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, const ElfW(Ehdr) & main_program_header);
ErrorOr<FlatPtr> do_write(OpenFileDescription&, UserOrKernelBuffer const&, size_t, Optional<off_t> = {});
ErrorOr<FlatPtr> do_statvfs(FileSystem const& path, Custody const*, statvfs* buf);
@@ -846,8 +846,8 @@ private:
SpinlockProtected<RefPtr<Custody>, LockRank::None> m_current_directory;
- NonnullOwnPtrVector<KString> m_arguments;
- NonnullOwnPtrVector<KString> m_environment;
+ Vector<NonnullOwnPtr<KString>> m_arguments;
+ Vector<NonnullOwnPtr<KString>> m_environment;
LockRefPtr<TTY> m_tty;
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 9d8fcf16dc..1cb21d7e7c 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -43,16 +43,16 @@ struct LoadResult {
static constexpr size_t auxiliary_vector_size = 15;
static Array<ELF::AuxiliaryValue, auxiliary_vector_size> generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, UserID uid, UserID euid, GroupID gid, GroupID egid, StringView executable_path, Optional<Process::ScopedDescriptionAllocation> const& main_program_fd_allocation);
-static bool validate_stack_size(NonnullOwnPtrVector<KString> const& arguments, NonnullOwnPtrVector<KString>& environment, Array<ELF::AuxiliaryValue, auxiliary_vector_size> const& auxiliary)
+static bool validate_stack_size(Vector<NonnullOwnPtr<KString>> const& arguments, Vector<NonnullOwnPtr<KString>>& environment, Array<ELF::AuxiliaryValue, auxiliary_vector_size> const& auxiliary)
{
size_t total_arguments_size = 0;
size_t total_environment_size = 0;
size_t total_auxiliary_size = 0;
for (auto const& a : arguments)
- total_arguments_size += a.length() + 1;
+ total_arguments_size += a->length() + 1;
for (auto const& e : environment)
- total_environment_size += e.length() + 1;
+ total_environment_size += e->length() + 1;
for (auto const& v : auxiliary) {
if (!v.optional_string.is_empty())
total_auxiliary_size += round_up_to_power_of_two(v.optional_string.length() + 1, sizeof(FlatPtr));
@@ -77,8 +77,8 @@ static bool validate_stack_size(NonnullOwnPtrVector<KString> const& arguments, N
return true;
}
-static ErrorOr<FlatPtr> make_userspace_context_for_main_thread([[maybe_unused]] ThreadRegisters& regs, Memory::Region& region, NonnullOwnPtrVector<KString> const& arguments,
- NonnullOwnPtrVector<KString> const& environment, Array<ELF::AuxiliaryValue, auxiliary_vector_size> auxiliary_values)
+static ErrorOr<FlatPtr> make_userspace_context_for_main_thread([[maybe_unused]] ThreadRegisters& regs, Memory::Region& region, Vector<NonnullOwnPtr<KString>> const& arguments,
+ Vector<NonnullOwnPtr<KString>> const& environment, Array<ELF::AuxiliaryValue, auxiliary_vector_size> auxiliary_values)
{
FlatPtr new_sp = region.range().end().get();
@@ -108,13 +108,13 @@ static ErrorOr<FlatPtr> make_userspace_context_for_main_thread([[maybe_unused]]
Vector<FlatPtr> argv_entries;
for (auto const& argument : arguments) {
- push_string_on_new_stack(argument.view());
+ push_string_on_new_stack(argument->view());
TRY(argv_entries.try_append(new_sp));
}
Vector<FlatPtr> env_entries;
for (auto const& variable : environment) {
- push_string_on_new_stack(variable.view());
+ push_string_on_new_stack(variable->view());
TRY(env_entries.try_append(new_sp));
}
@@ -471,7 +471,7 @@ void Process::clear_signal_handlers_for_exec()
}
}
-ErrorOr<void> Process::do_exec(NonnullLockRefPtr<OpenFileDescription> main_program_description, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment,
+ErrorOr<void> Process::do_exec(NonnullLockRefPtr<OpenFileDescription> main_program_description, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment,
LockRefPtr<OpenFileDescription> interpreter_description, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, const ElfW(Ehdr) & main_program_header)
{
VERIFY(is_user_process());
@@ -746,12 +746,12 @@ static Array<ELF::AuxiliaryValue, auxiliary_vector_size> generate_auxiliary_vect
} };
}
-static ErrorOr<NonnullOwnPtrVector<KString>> find_shebang_interpreter_for_executable(char const first_page[], size_t nread)
+static ErrorOr<Vector<NonnullOwnPtr<KString>>> find_shebang_interpreter_for_executable(char const first_page[], size_t nread)
{
int word_start = 2;
size_t word_length = 0;
if (nread > 2 && first_page[0] == '#' && first_page[1] == '!') {
- NonnullOwnPtrVector<KString> interpreter_words;
+ Vector<NonnullOwnPtr<KString>> interpreter_words;
for (size_t i = 2; i < nread; ++i) {
if (first_page[i] == '\n') {
@@ -851,7 +851,7 @@ ErrorOr<LockRefPtr<OpenFileDescription>> Process::find_elf_interpreter_for_execu
return nullptr;
}
-ErrorOr<void> Process::exec(NonnullOwnPtr<KString> path, NonnullOwnPtrVector<KString> arguments, NonnullOwnPtrVector<KString> environment, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, int recursion_depth)
+ErrorOr<void> Process::exec(NonnullOwnPtr<KString> path, Vector<NonnullOwnPtr<KString>> arguments, Vector<NonnullOwnPtr<KString>> environment, Thread*& new_main_thread, InterruptsState& previous_interrupts_state, int recursion_depth)
{
if (recursion_depth > 2) {
dbgln("exec({}): SHENANIGANS! recursed too far trying to find #! interpreter", path);
@@ -886,8 +886,8 @@ ErrorOr<void> Process::exec(NonnullOwnPtr<KString> path, NonnullOwnPtrVector<KSt
auto shebang_result = find_shebang_interpreter_for_executable(first_page, nread);
if (!shebang_result.is_error()) {
auto shebang_words = shebang_result.release_value();
- auto shebang_path = TRY(shebang_words.first().try_clone());
- arguments.ptr_at(0) = move(path);
+ auto shebang_path = TRY(shebang_words.first()->try_clone());
+ arguments[0] = move(path);
TRY(arguments.try_prepend(move(shebang_words)));
return exec(move(shebang_path), move(arguments), move(environment), new_main_thread, previous_interrupts_state, ++recursion_depth);
}
@@ -949,10 +949,10 @@ ErrorOr<FlatPtr> Process::sys$execve(Userspace<Syscall::SC_execve_params const*>
return {};
};
- NonnullOwnPtrVector<KString> arguments;
+ Vector<NonnullOwnPtr<KString>> arguments;
TRY(copy_user_strings(params.arguments, arguments));
- NonnullOwnPtrVector<KString> environment;
+ Vector<NonnullOwnPtr<KString>> environment;
TRY(copy_user_strings(params.environment, environment));
TRY(exec(move(path), move(arguments), move(environment), new_main_thread, previous_interrupts_state));
diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp
index 14cc23dfe7..0b03c0eb7f 100644
--- a/Ladybird/BrowserWindow.cpp
+++ b/Ladybird/BrowserWindow.cpp
@@ -456,21 +456,21 @@ void BrowserWindow::open_previous_tab()
void BrowserWindow::enable_auto_color_scheme()
{
for (auto& tab : m_tabs) {
- tab.view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Auto);
+ tab->view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Auto);
}
}
void BrowserWindow::enable_light_color_scheme()
{
for (auto& tab : m_tabs) {
- tab.view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Light);
+ tab->view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Light);
}
}
void BrowserWindow::enable_dark_color_scheme()
{
for (auto& tab : m_tabs) {
- tab.view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Dark);
+ tab->view().set_preferred_color_scheme(Web::CSS::PreferredColorScheme::Dark);
}
}
diff --git a/Ladybird/BrowserWindow.h b/Ladybird/BrowserWindow.h
index 5a5438dc94..c3677a0c3c 100644
--- a/Ladybird/BrowserWindow.h
+++ b/Ladybird/BrowserWindow.h
@@ -61,7 +61,7 @@ private:
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
QTabWidget* m_tabs_container { nullptr };
- NonnullOwnPtrVector<Tab> m_tabs;
+ Vector<NonnullOwnPtr<Tab>> m_tabs;
Tab* m_current_tab { nullptr };
Browser::CookieJar& m_cookie_jar;
diff --git a/Tests/AK/TestIntrusiveRedBlackTree.cpp b/Tests/AK/TestIntrusiveRedBlackTree.cpp
index 6492c57770..587cede591 100644
--- a/Tests/AK/TestIntrusiveRedBlackTree.cpp
+++ b/Tests/AK/TestIntrusiveRedBlackTree.cpp
@@ -72,7 +72,7 @@ TEST_CASE(key_ordered_iteration)
{
constexpr auto amount = 10000;
IntrusiveRBTree test;
- NonnullOwnPtrVector<IntrusiveTest> m_entries;
+ Vector<NonnullOwnPtr<IntrusiveTest>> m_entries;
Array<int, amount> keys {};
// generate random key order
@@ -105,7 +105,7 @@ TEST_CASE(key_ordered_iteration)
TEST_CASE(clear)
{
IntrusiveRBTree test;
- NonnullOwnPtrVector<IntrusiveTest> m_entries;
+ Vector<NonnullOwnPtr<IntrusiveTest>> m_entries;
for (size_t i = 0; i < 1000; i++) {
auto entry = make<IntrusiveTest>(i);
test.insert(i, *entry);
diff --git a/Tests/AK/TestVector.cpp b/Tests/AK/TestVector.cpp
index fafa8f5564..6e6fb38e18 100644
--- a/Tests/AK/TestVector.cpp
+++ b/Tests/AK/TestVector.cpp
@@ -288,7 +288,7 @@ TEST_CASE(nonnullownptrvector)
struct Object {
DeprecatedString string;
};
- NonnullOwnPtrVector<Object> objects;
+ Vector<NonnullOwnPtr<Object>> objects;
objects.append(make<Object>());
EXPECT_EQ(objects.size(), 1u);
diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
index f8bb4341f1..334e71cf97 100644
--- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp
+++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
@@ -71,7 +71,7 @@ void ToolboxWidget::setup_tools()
m_tools.append(move(tool));
if (is_default_tool) {
VERIFY(m_active_tool == nullptr);
- m_active_tool = &m_tools[m_tools.size() - 1];
+ m_active_tool = m_tools[m_tools.size() - 1];
action->set_checked(true);
}
};
diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.h b/Userland/Applications/PixelPaint/ToolboxWidget.h
index 789885802b..1c1632e360 100644
--- a/Userland/Applications/PixelPaint/ToolboxWidget.h
+++ b/Userland/Applications/PixelPaint/ToolboxWidget.h
@@ -27,7 +27,7 @@ public:
void for_each_tool(Callback callback)
{
for (auto& tool : m_tools)
- callback(tool);
+ callback(*tool);
}
Tool* active_tool() const { return m_active_tool; }
@@ -40,7 +40,7 @@ private:
explicit ToolboxWidget();
RefPtr<GUI::Toolbar> m_toolbar;
GUI::ActionGroup m_action_group;
- NonnullOwnPtrVector<Tool> m_tools;
+ Vector<NonnullOwnPtr<Tool>> m_tools;
Tool* m_active_tool { nullptr };
};
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp
index c84da311f0..c38d7f90f2 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp
@@ -350,7 +350,7 @@ GUI::ModelIndex ProcessModel::index(int row, int column, GUI::ModelIndex const&
if (!parent.is_valid()) {
if (row >= static_cast<int>(m_processes.size()))
return {};
- auto corresponding_thread = m_processes[row].main_thread();
+ auto corresponding_thread = m_processes[row]->main_thread();
if (!corresponding_thread.has_value())
return {};
return create_index(row, column, corresponding_thread.release_value().ptr());
@@ -368,8 +368,14 @@ int ProcessModel::thread_model_row(Thread const& thread) const
{
auto const& process = thread.current_state.process;
// A process's main thread uses the global process index.
- if (process.pid == thread.current_state.pid)
- return m_processes.find_first_index(process).value_or(0);
+ if (process.pid == thread.current_state.pid) {
+ auto it = m_processes.find_if([&](auto& entry) {
+ return entry.ptr() == &process;
+ });
+ if (it == m_processes.end())
+ return 0;
+ return it.index();
+ }
return process.threads.find_first_index(thread).value_or(0);
}
@@ -387,7 +393,15 @@ GUI::ModelIndex ProcessModel::parent_index(GUI::ModelIndex const& index) const
if (!parent.main_thread().has_value())
return {};
- return create_index(m_processes.find_first_index(parent).release_value(), index.column(), parent.main_thread().value().ptr());
+ auto process_index = [&]() -> size_t {
+ auto it = m_processes.find_if([&](auto& entry) {
+ return entry.ptr() == &parent;
+ });
+ if (it == m_processes.end())
+ return 0;
+ return it.index();
+ }();
+ return create_index(process_index, index.column(), parent.main_thread().value().ptr());
}
Vector<GUI::ModelIndex> ProcessModel::matches(StringView searching, unsigned flags, GUI::ModelIndex const&)
@@ -444,7 +458,7 @@ void ProcessModel::update()
auto const& process = all_processes.value().processes[i];
NonnullOwnPtr<Process>* process_state = nullptr;
for (size_t i = 0; i < m_processes.size(); ++i) {
- auto* other_process = &m_processes.ptr_at(i);
+ auto* other_process = &m_processes[i];
if ((*other_process)->pid == process.pid) {
process_state = other_process;
break;
@@ -452,7 +466,7 @@ void ProcessModel::update()
}
if (!process_state) {
m_processes.append(make<Process>());
- process_state = &m_processes.ptr_at(m_processes.size() - 1);
+ process_state = &m_processes.last();
}
(*process_state)->pid = process.pid;
for (auto& thread : process.threads) {
@@ -508,8 +522,8 @@ void ProcessModel::update()
}
for (auto& c : m_cpus) {
- c.total_cpu_percent = 0.0;
- c.total_cpu_percent_kernel = 0.0;
+ c->total_cpu_percent = 0.0;
+ c->total_cpu_percent_kernel = 0.0;
}
Vector<int, 16> tids_to_remove;
@@ -526,8 +540,8 @@ void ProcessModel::update()
thread.current_state.cpu_percent_kernel = total_time_scheduled_diff > 0 ? (float)((time_scheduled_diff_kernel * 1000) / total_time_scheduled_diff) / 10.0f : 0;
if (it.value->current_state.pid != 0) {
auto& cpu_info = m_cpus[thread.current_state.cpu];
- cpu_info.total_cpu_percent += thread.current_state.cpu_percent;
- cpu_info.total_cpu_percent_kernel += thread.current_state.cpu_percent_kernel;
+ cpu_info->total_cpu_percent += thread.current_state.cpu_percent;
+ cpu_info->total_cpu_percent_kernel += thread.current_state.cpu_percent_kernel;
}
}
@@ -536,8 +550,8 @@ void ProcessModel::update()
m_threads.remove(tid);
for (size_t i = 0; i < m_processes.size(); ++i) {
auto& process = m_processes[i];
- process.threads.remove_all_matching([&](auto const& thread) { return thread->current_state.tid == tid; });
- if (process.threads.size() == 0) {
+ process->threads.remove_all_matching([&](auto const& thread) { return thread->current_state.tid == tid; });
+ if (process->threads.size() == 0) {
m_processes.remove(i);
--i;
}
diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h
index 3c659538e2..987de29816 100644
--- a/Userland/Applications/SystemMonitor/ProcessModel.h
+++ b/Userland/Applications/SystemMonitor/ProcessModel.h
@@ -85,10 +85,10 @@ public:
}
};
- Function<void(NonnullOwnPtrVector<CpuInfo> const&)> on_cpu_info_change;
+ Function<void(Vector<NonnullOwnPtr<CpuInfo>> const&)> on_cpu_info_change;
Function<void(int process_count, int thread_count)> on_state_update;
- NonnullOwnPtrVector<CpuInfo> const& cpus() const { return m_cpus; }
+ Vector<NonnullOwnPtr<CpuInfo>> const& cpus() const { return m_cpus; }
private:
ProcessModel();
@@ -243,8 +243,8 @@ private:
// The thread list contains the same threads as the Process structs.
HashMap<int, NonnullRefPtr<Thread>> m_threads;
- NonnullOwnPtrVector<Process> m_processes;
- NonnullOwnPtrVector<CpuInfo> m_cpus;
+ Vector<NonnullOwnPtr<Process>> m_processes;
+ Vector<NonnullOwnPtr<CpuInfo>> m_cpus;
RefPtr<Core::DeprecatedFile> m_proc_all;
GUI::Icon m_kernel_process_icon;
u64 m_total_time_scheduled { 0 };
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index 6647943ec1..70e57bcfdb 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -594,11 +594,11 @@ void build_performance_tab(GUI::Widget& graphs_container)
cpu_graphs.append(cpu_graph);
}
}
- ProcessModel::the().on_cpu_info_change = [cpu_graphs](NonnullOwnPtrVector<ProcessModel::CpuInfo> const& cpus) mutable {
+ ProcessModel::the().on_cpu_info_change = [cpu_graphs](Vector<NonnullOwnPtr<ProcessModel::CpuInfo>> const& cpus) mutable {
float sum_cpu = 0;
for (size_t i = 0; i < cpus.size(); ++i) {
- cpu_graphs[i].add_value({ static_cast<size_t>(cpus[i].total_cpu_percent), static_cast<size_t>(cpus[i].total_cpu_percent_kernel) });
- sum_cpu += cpus[i].total_cpu_percent;
+ cpu_graphs[i].add_value({ static_cast<size_t>(cpus[i]->total_cpu_percent), static_cast<size_t>(cpus[i]->total_cpu_percent_kernel) });
+ sum_cpu += cpus[i]->total_cpu_percent;
}
float cpu_usage = sum_cpu / (float)cpus.size();
statusbar->set_text(2, DeprecatedString::formatted("CPU usage: {}%", (int)roundf(cpu_usage)));
diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.cpp b/Userland/DevTools/HackStudio/ClassViewWidget.cpp
index 0a47deb09e..da16e72703 100644
--- a/Userland/DevTools/HackStudio/ClassViewWidget.cpp
+++ b/Userland/DevTools/HackStudio/ClassViewWidget.cpp
@@ -75,13 +75,13 @@ GUI::ModelIndex ClassViewModel::parent_index(const GUI::ModelIndex& index) const
if (parent->parent == nullptr) {
for (size_t row = 0; row < m_root_scope.size(); row++) {
- if (m_root_scope.ptr_at(row).ptr() == parent)
+ if (m_root_scope[row].ptr() == parent)
return create_index(row, 0, parent);
}
VERIFY_NOT_REACHED();
}
for (size_t row = 0; row < parent->parent->children.size(); row++) {
- ClassViewNode* child_at_row = parent->parent->children.ptr_at(row).ptr();
+ ClassViewNode* child_at_row = parent->parent->children[row].ptr();
if (child_at_row == parent)
return create_index(row, 0, parent);
}
@@ -110,7 +110,7 @@ ClassViewModel::ClassViewModel()
});
}
-static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& children, NonnullOwnPtr<ClassViewNode>&& node_ptr, ClassViewNode* parent, CodeComprehension::Declaration const* declaration)
+static ClassViewNode& add_child_node(Vector<NonnullOwnPtr<ClassViewNode>>& children, NonnullOwnPtr<ClassViewNode>&& node_ptr, ClassViewNode* parent, CodeComprehension::Declaration const* declaration)
{
node_ptr->parent = parent;
node_ptr->declaration = declaration;
@@ -124,7 +124,7 @@ static ClassViewNode& add_child_node(NonnullOwnPtrVector<ClassViewNode>& childre
},
0, &inserted_index);
- return children.at(inserted_index);
+ return *children.at(inserted_index);
}
void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
@@ -135,21 +135,21 @@ void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
if (!scope_parts.is_empty()) {
// Traverse declarations tree to the parent of 'decl'
for (auto& node : m_root_scope) {
- if (node.name == scope_parts.first())
- parent = &node;
+ if (node->name == scope_parts.first())
+ parent = node;
}
if (parent == nullptr) {
m_root_scope.append(make<ClassViewNode>(scope_parts.first()));
- parent = &m_root_scope.last();
+ parent = m_root_scope.last();
}
for (size_t i = 1; i < scope_parts.size(); ++i) {
auto& scope = scope_parts[i];
ClassViewNode* next { nullptr };
for (auto& child : parent->children) {
- if (child.name == scope) {
- next = &child;
+ if (child->name == scope) {
+ next = child;
break;
}
}
@@ -163,7 +163,7 @@ void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
}
}
- NonnullOwnPtrVector<ClassViewNode>* children_of_parent = nullptr;
+ Vector<NonnullOwnPtr<ClassViewNode>>* children_of_parent = nullptr;
if (parent) {
children_of_parent = &parent->children;
} else {
@@ -172,10 +172,10 @@ void ClassViewModel::add_declaration(CodeComprehension::Declaration const& decl)
bool already_exists = false;
for (auto& child : *children_of_parent) {
- if (child.name == decl.name) {
+ if (child->name == decl.name) {
already_exists = true;
- if (!child.declaration) {
- child.declaration = &decl;
+ if (!child->declaration) {
+ child->declaration = &decl;
}
break;
}
diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.h b/Userland/DevTools/HackStudio/ClassViewWidget.h
index f0db0e73fb..bd717a67b2 100644
--- a/Userland/DevTools/HackStudio/ClassViewWidget.h
+++ b/Userland/DevTools/HackStudio/ClassViewWidget.h
@@ -32,7 +32,7 @@ private:
struct ClassViewNode {
StringView name;
CodeComprehension::Declaration const* declaration { nullptr };
- NonnullOwnPtrVector<ClassViewNode> children;
+ Vector<NonnullOwnPtr<ClassViewNode>> children;
ClassViewNode* parent { nullptr };
explicit ClassViewNode(StringView name)
@@ -51,7 +51,7 @@ public:
private:
explicit ClassViewModel();
void add_declaration(CodeComprehension::Declaration const&);
- NonnullOwnPtrVector<ClassViewNode> m_root_scope;
+ Vector<NonnullOwnPtr<ClassViewNode>> m_root_scope;
};
}
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
index c97bcaa799..5b4fb0dabf 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp
@@ -35,12 +35,12 @@ GUI::ModelIndex VariablesModel::parent_index(const GUI::ModelIndex& index) const
if (parent->parent == nullptr) {
for (size_t row = 0; row < m_variables.size(); row++)
- if (m_variables.ptr_at(row).ptr() == parent)
+ if (m_variables[row].ptr() == parent)
return create_index(row, 0, parent);
VERIFY_NOT_REACHED();
}
for (size_t row = 0; row < parent->parent->members.size(); row++) {
- Debug::DebugInfo::VariableInfo* child_at_row = parent->parent->members.ptr_at(row).ptr();
+ Debug::DebugInfo::VariableInfo* child_at_row = parent->parent->members[row].ptr();
if (child_at_row == parent)
return create_index(row, 0, parent);
}
diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
index b2fc5a6850..439e8a0a59 100644
--- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
+++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.h
@@ -28,14 +28,14 @@ public:
Debug::ProcessInspector& inspector() { return m_inspector; }
private:
- explicit VariablesModel(Debug::ProcessInspector& inspector, NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo>&& variables, PtraceRegisters const& regs)
+ explicit VariablesModel(Debug::ProcessInspector& inspector, Vector<NonnullOwnPtr<Debug::DebugInfo::VariableInfo>>&& variables, PtraceRegisters const& regs)
: m_variables(move(variables))
, m_regs(regs)
, m_inspector(inspector)
{
m_variable_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
}
- NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
+ Vector<NonnullOwnPtr<Debug::DebugInfo::VariableInfo>> m_variables;
PtraceRegisters m_regs;
GUI::Icon m_variable_icon;
diff --git a/Userland/DevTools/Inspector/RemoteObject.h b/Userland/DevTools/Inspector/RemoteObject.h
index 344e02c1da..025acef369 100644
--- a/Userland/DevTools/Inspector/RemoteObject.h
+++ b/Userland/DevTools/Inspector/RemoteObject.h
@@ -21,7 +21,7 @@ public:
RemoteObjectPropertyModel& property_model();
RemoteObject* parent { nullptr };
- NonnullOwnPtrVector<RemoteObject> children;
+ Vector<NonnullOwnPtr<RemoteObject>> children;
FlatPtr address { 0 };
FlatPtr parent_address { 0 };
diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
index d2aa41244e..97743bf3b9 100644
--- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
@@ -45,7 +45,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
// NOTE: If the parent has no parent, it's a root, so we have to look among the remote roots.
if (!remote_object.parent->parent) {
for (size_t row = 0; row < m_process.roots().size(); ++row) {
- if (&m_process.roots()[row] == remote_object.parent)
+ if (m_process.roots()[row] == remote_object.parent)
return create_index(row, 0, remote_object.parent);
}
VERIFY_NOT_REACHED();
@@ -53,7 +53,7 @@ GUI::ModelIndex RemoteObjectGraphModel::parent_index(const GUI::ModelIndex& inde
}
for (size_t row = 0; row < remote_object.parent->parent->children.size(); ++row) {
- if (&remote_object.parent->parent->children[row] == remote_object.parent)
+ if (remote_object.parent->parent->children[row] == remote_object.parent)
return create_index(row, 0, remote_object.parent);
}
diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
index e5503b849c..02d706de36 100644
--- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp
@@ -111,7 +111,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::index(int row, int column, const GUI:
} else {
return nullptr;
}
- return &m_paths.last();
+ return m_paths.last();
};
if (!parent.is_valid()) {
@@ -176,16 +176,16 @@ JsonPath const* RemoteObjectPropertyModel::cached_path_at(int n, Vector<JsonPath
JsonPath const* index_path = nullptr;
int row_index = n;
for (auto& path : m_paths) {
- if (path.size() != prefix.size() + 1)
+ if (path->size() != prefix.size() + 1)
continue;
for (size_t i = 0; i < prefix.size(); ++i) {
- if (path[i] != prefix[i])
+ if ((*path)[i] != prefix[i])
goto do_continue;
}
if (row_index == 0) {
- index_path = &path;
+ index_path = path;
break;
}
--row_index;
@@ -198,15 +198,15 @@ JsonPath const* RemoteObjectPropertyModel::cached_path_at(int n, Vector<JsonPath
JsonPath const* RemoteObjectPropertyModel::find_cached_path(Vector<JsonPathElement> const& path) const
{
for (auto& cpath : m_paths) {
- if (cpath.size() != path.size())
+ if (cpath->size() != path.size())
continue;
- for (size_t i = 0; i < cpath.size(); ++i) {
- if (cpath[i] != path[i])
+ for (size_t i = 0; i < cpath->size(); ++i) {
+ if ((*cpath)[i] != path[i])
goto do_continue;
}
- return &cpath;
+ return cpath;
do_continue:;
}
diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
index 265a75d358..bc0ff9dbd4 100644
--- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
+++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h
@@ -45,7 +45,7 @@ private:
JsonPath const* find_cached_path(Vector<JsonPathElement> const& path) const;
RemoteObject& m_object;
- mutable NonnullOwnPtrVector<JsonPath> m_paths;
+ mutable Vector<NonnullOwnPtr<JsonPath>> m_paths;
};
}
diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp
index 6cb82e8cd9..5fb6e6dd08 100644
--- a/Userland/DevTools/Inspector/RemoteProcess.cpp
+++ b/Userland/DevTools/Inspector/RemoteProcess.cpp
@@ -42,7 +42,7 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
auto& object_array = response.get_array("objects"sv).value();
- NonnullOwnPtrVector<RemoteObject> remote_objects;
+ Vector<NonnullOwnPtr<RemoteObject>> remote_objects;
HashMap<FlatPtr, RemoteObject*> objects_by_address;
for (auto& value : object_array.values()) {
@@ -59,7 +59,7 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
}
for (size_t i = 0; i < remote_objects.size(); ++i) {
- auto& remote_object = remote_objects.ptr_at(i);
+ auto& remote_object = remote_objects[i];
auto* parent = objects_by_address.get(remote_object->parent_address).value_or(nullptr);
if (!parent) {
m_roots.append(move(remote_object));
diff --git a/Userland/DevTools/Inspector/RemoteProcess.h b/Userland/DevTools/Inspector/RemoteProcess.h
index b8dd5e3299..7a6e3967cb 100644
--- a/Userland/DevTools/Inspector/RemoteProcess.h
+++ b/Userland/DevTools/Inspector/RemoteProcess.h
@@ -25,7 +25,7 @@ public:
DeprecatedString const& process_name() const { return m_process_name; }
RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; }
- NonnullOwnPtrVector<RemoteObject> const& roots() const { return m_roots; }
+ Vector<NonnullOwnPtr<RemoteObject>> const& roots() const { return m_roots; }
void set_inspected_object(FlatPtr);
@@ -42,7 +42,7 @@ private:
pid_t m_pid { -1 };
DeprecatedString m_process_name;
NonnullRefPtr<RemoteObjectGraphModel> m_object_graph_model;
- NonnullOwnPtrVector<RemoteObject> m_roots;
+ Vector<NonnullOwnPtr<RemoteObject>> m_roots;
RefPtr<InspectorServerClient> m_client;
};
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index 5a9c1d412c..9834763c03 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -268,7 +268,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
return Error::from_string_literal("Malformed profile (events is not an array)");
auto const& perf_events = events_value.value();
- NonnullOwnPtrVector<Process> all_processes;
+ Vector<NonnullOwnPtr<Process>> all_processes;
HashMap<pid_t, Process*> current_processes;
Vector<Event> events;
EventSerialNumber next_serial;
@@ -448,15 +448,15 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
return Error::from_string_literal("No events captured (targeted process was never on CPU)");
quick_sort(all_processes, [](auto& a, auto& b) {
- if (a.pid == b.pid)
- return a.start_valid < b.start_valid;
+ if (a->pid == b->pid)
+ return a->start_valid < b->start_valid;
- return a.pid < b.pid;
+ return a->pid < b->pid;
});
Vector<Process> processes;
for (auto& it : all_processes)
- processes.append(move(it));
+ processes.append(move(*it));
return adopt_nonnull_own_or_enomem(new (nothrow) Profile(move(processes), move(events)));
}
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h
index 6a911466db..307015578f 100644
--- a/Userland/DevTools/UserspaceEmulator/Emulator.h
+++ b/Userland/DevTools/UserspaceEmulator/Emulator.h
@@ -32,7 +32,7 @@ public:
Emulator(DeprecatedString const& executable_path, Vector<StringView> const& arguments, Vector<DeprecatedString> const& environment);
- void set_profiling_details(bool should_dump_profile, size_t instruction_interval, Stream* profile_stream, NonnullOwnPtrVector<DeprecatedString>* profiler_strings, Vector<int>* profiler_string_id_map)
+ void set_profiling_details(bool should_dump_profile, size_t instruction_interval, Stream* profile_stream, Vector<NonnullOwnPtr<DeprecatedString>>* profiler_strings, Vector<int>* profiler_string_id_map)
{
m_is_profiling = should_dump_profile;
m_profile_instruction_interval = instruction_interval;
@@ -47,7 +47,7 @@ public:
}
Stream& profile_stream() { return *m_profile_stream; }
- NonnullOwnPtrVector<DeprecatedString>& profiler_strings() { return *m_profiler_strings; }
+ Vector<NonnullOwnPtr<DeprecatedString>>& profiler_strings() { return *m_profiler_strings; }
Vector<int>& profiler_string_id_map() { return *m_profiler_string_id_map; }
bool is_profiling() const { return m_is_profiling; }
@@ -296,7 +296,7 @@ private:
Stream* m_profile_stream { nullptr };
Vector<int>* m_profiler_string_id_map { nullptr };
- NonnullOwnPtrVector<DeprecatedString>* m_profiler_strings { nullptr };
+ Vector<NonnullOwnPtr<DeprecatedString>>* m_profiler_strings { nullptr };
bool m_is_profiling { false };
size_t m_profile_instruction_interval { 0 };
diff --git a/Userland/DevTools/UserspaceEmulator/SoftMMU.h b/Userland/DevTools/UserspaceEmulator/SoftMMU.h
index 781aa4a181..ba379d1a0e 100644
--- a/Userland/DevTools/UserspaceEmulator/SoftMMU.h
+++ b/Userland/DevTools/UserspaceEmulator/SoftMMU.h
@@ -144,7 +144,7 @@ private:
Region* m_page_to_region_map[786432] = { nullptr };
OwnPtr<Region> m_tls_region;
- NonnullOwnPtrVector<Region> m_regions;
+ Vector<NonnullOwnPtr<Region>> m_regions;
};
}
diff --git a/Userland/DevTools/UserspaceEmulator/main.cpp b/Userland/DevTools/UserspaceEmulator/main.cpp
index 097128e798..83498e66e9 100644
--- a/Userland/DevTools/UserspaceEmulator/main.cpp
+++ b/Userland/DevTools/UserspaceEmulator/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char** argv, char** env)
profile_dump_path = DeprecatedString::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid());
OwnPtr<Stream> profile_stream;
- OwnPtr<NonnullOwnPtrVector<DeprecatedString>> profile_strings;
+ OwnPtr<Vector<NonnullOwnPtr<DeprecatedString>>> profile_strings;
OwnPtr<Vector<int>> profile_string_id_map;
if (dump_profile) {
@@ -67,7 +67,7 @@ int main(int argc, char** argv, char** env)
return 1;
}
profile_stream = profile_stream_or_error.release_value();
- profile_strings = make<NonnullOwnPtrVector<DeprecatedString>>();
+ profile_strings = make<Vector<NonnullOwnPtr<DeprecatedString>>>();
profile_string_id_map = make<Vector<int>>();
profile_stream->write_entire_buffer(R"({"events":[)"sv.bytes()).release_value_but_fixme_should_propagate_errors();
diff --git a/Userland/Games/GameOfLife/BoardWidget.h b/Userland/Games/GameOfLife/BoardWidget.h
index ef185cb5b9..1bc8b0006d 100644
--- a/Userland/Games/GameOfLife/BoardWidget.h
+++ b/Userland/Games/GameOfLife/BoardWidget.h
@@ -56,7 +56,7 @@ public:
void for_each_pattern(Callback callback)
{
for (auto& pattern : m_patterns)
- callback(pattern);
+ callback(*pattern);
}
void run_generation();
@@ -78,7 +78,7 @@ private:
Board::RowAndColumn m_last_cell_toggled {};
Board::RowAndColumn m_last_cell_hovered {};
Pattern* m_selected_pattern { nullptr };
- NonnullOwnPtrVector<Pattern> m_patterns;
+ Vector<NonnullOwnPtr<Pattern>> m_patterns;
NonnullOwnPtr<Board> m_board;
diff --git a/Userland/Libraries/LibCoredump/Inspector.cpp b/Userland/Libraries/LibCoredump/Inspector.cpp
index b78795d571..185e881166 100644
--- a/Userland/Libraries/LibCoredump/Inspector.cpp
+++ b/Userland/Libraries/LibCoredump/Inspector.cpp
@@ -73,7 +73,7 @@ void Inspector::set_registers(PtraceRegisters const&) {};
void Inspector::for_each_loaded_library(Function<IterationDecision(Debug::LoadedLibrary const&)> func) const
{
for (auto& library : m_loaded_libraries) {
- if (func(library) == IterationDecision::Break)
+ if (func(*library) == IterationDecision::Break)
break;
}
}
diff --git a/Userland/Libraries/LibCoredump/Inspector.h b/Userland/Libraries/LibCoredump/Inspector.h
index e2714fff19..adc30771a5 100644
--- a/Userland/Libraries/LibCoredump/Inspector.h
+++ b/Userland/Libraries/LibCoredump/Inspector.h
@@ -35,7 +35,7 @@ private:
NonnullOwnPtr<Reader> m_reader;
- NonnullOwnPtrVector<Debug::LoadedLibrary> m_loaded_libraries;
+ Vector<NonnullOwnPtr<Debug::LoadedLibrary>> m_loaded_libraries;
};
}
diff --git a/Userland/Libraries/LibDebug/DebugInfo.cpp b/Userland/Libraries/LibDebug/DebugInfo.cpp
index 0c469b3df5..b437a063f3 100644
--- a/Userland/Libraries/LibDebug/DebugInfo.cpp
+++ b/Userland/Libraries/LibDebug/DebugInfo.cpp
@@ -160,9 +160,9 @@ Optional<DebugInfo::SourcePositionAndAddress> DebugInfo::get_address_from_source
return result;
}
-ErrorOr<NonnullOwnPtrVector<DebugInfo::VariableInfo>> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const
+ErrorOr<Vector<NonnullOwnPtr<DebugInfo::VariableInfo>>> DebugInfo::get_variables_in_current_scope(PtraceRegisters const& regs) const
{
- NonnullOwnPtrVector<DebugInfo::VariableInfo> variables;
+ Vector<NonnullOwnPtr<DebugInfo::VariableInfo>> variables;
// TODO: We can store the scopes in a better data structure
for (auto const& scope : m_scopes) {
diff --git a/Userland/Libraries/LibDebug/DebugInfo.h b/Userland/Libraries/LibDebug/DebugInfo.h
index ffab654318..57cde07dcc 100644
--- a/Userland/Libraries/LibDebug/DebugInfo.h
+++ b/Userland/Libraries/LibDebug/DebugInfo.h
@@ -75,7 +75,7 @@ public:
Dwarf::EntryTag type_tag;
OwnPtr<VariableInfo> type;
- NonnullOwnPtrVector<VariableInfo> members;
+ Vector<NonnullOwnPtr<VariableInfo>> members;
VariableInfo* parent { nullptr };
Vector<u32> dimension_sizes;
@@ -90,7 +90,7 @@ public:
Vector<Dwarf::DIE> dies_of_variables;
};
- ErrorOr<NonnullOwnPtrVector<VariableInfo>> get_variables_in_current_scope(PtraceRegisters const&) const;
+ ErrorOr<Vector<NonnullOwnPtr<VariableInfo>>> get_variables_in_current_scope(PtraceRegisters const&) const;
Optional<SourcePosition> get_source_position(FlatPtr address) const;
diff --git a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
index 24a72e9f75..e0a9c1dcf7 100644
--- a/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
+++ b/Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h
@@ -70,7 +70,7 @@ private:
ReadonlyBytes m_debug_addr_data;
ReadonlyBytes m_debug_ranges_data;
- NonnullOwnPtrVector<Dwarf::CompilationUnit> m_compilation_units;
+ Vector<NonnullOwnPtr<Dwarf::CompilationUnit>> m_compilation_units;
struct DIERange {
FlatPtr start_address { 0 };
@@ -93,7 +93,7 @@ template<typename Callback>
ErrorOr<void> DwarfInfo::for_each_compilation_unit(Callback callback) const
{
for (auto const& unit : m_compilation_units) {
- TRY(callback(unit));
+ TRY(callback(*unit));
}
return {};
}
diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp
index 7f9bf8de60..c18eb3215d 100644
--- a/Userland/Libraries/LibGUI/CommandPalette.cpp
+++ b/Userland/Libraries/LibGUI/CommandPalette.cpp
@@ -243,11 +243,11 @@ void CommandPalette::collect_actions(GUI::Window& parent_window)
};
Function<void(Menu&)> collect_actions_from_menu = [&](Menu& menu) {
- for (auto menu_item : menu.items()) {
- if (menu_item.submenu())
- collect_actions_from_menu(*menu_item.submenu());
+ for (auto& menu_item : menu.items()) {
+ if (menu_item->submenu())
+ collect_actions_from_menu(*menu_item->submenu());
- auto* action = menu_item.action();
+ auto* action = menu_item->action();
if (should_show_action(action))
actions.set(*action);
}
diff --git a/Userland/Libraries/LibGUI/EditingEngine.cpp b/Userland/Libraries/LibGUI/EditingEngine.cpp
index 984690e3ab..6a18ded445 100644
--- a/Userland/Libraries/LibGUI/EditingEngine.cpp
+++ b/Userland/Libraries/LibGUI/EditingEngine.cpp
@@ -171,7 +171,7 @@ void EditingEngine::move_one_left()
m_editor->set_cursor(m_editor->cursor().line(), new_column);
} else if (m_editor->cursor().line() > 0) {
auto new_line = m_editor->cursor().line() - 1;
- auto new_column = m_editor->lines()[new_line].length();
+ auto new_column = m_editor->lines()[new_line]->length();
m_editor->set_cursor(new_line, new_column);
}
}
@@ -362,7 +362,7 @@ void EditingEngine::move_to_first_line()
void EditingEngine::move_to_last_line()
{
- m_editor->set_cursor(m_editor->line_count() - 1, m_editor->lines()[m_editor->line_count() - 1].length());
+ m_editor->set_cursor(m_editor->line_count() - 1, m_editor->lines()[m_editor->line_count() - 1]->length());
};
void EditingEngine::get_selection_line_boundaries(Badge<MoveLineUpOrDownCommand>, size_t& first_line, size_t& last_line)
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp
index d1d2e18e64..ca1027f81e 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.cpp
+++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp
@@ -33,7 +33,7 @@ ModelIndex FileSystemModel::Node::index(int column) const
if (!m_parent)
return {};
for (size_t row = 0; row < m_parent->m_children.size(); ++row) {
- if (&m_parent->m_children[row] == this)
+ if (m_parent->m_children[row] == this)
return m_model.create_index(row, column, const_cast<Node*>(this));
}
VERIFY_NOT_REACHED();
@@ -111,8 +111,8 @@ void FileSystemModel::Node::traverse_if_needed()
}
quick_sort(child_names);
- NonnullOwnPtrVector<Node> directory_children;
- NonnullOwnPtrVector<Node> file_children;
+ Vector<NonnullOwnPtr<Node>> directory_children;
+ Vector<NonnullOwnPtr<Node>> file_children;
for (auto& child_name : child_names) {
auto maybe_child = create_child(child_name);
@@ -229,7 +229,7 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated
resolved_path = path;
LexicalPath lexical_path(resolved_path);
- Node const* node = m_root->m_parent_of_root ? &m_root->m_children.first() : m_root;
+ Node const* node = m_root->m_parent_of_root ? m_root->m_children.first() : m_root.ptr();
if (lexical_path.string() == "/")
return *node;
@@ -238,9 +238,9 @@ Optional<FileSystemModel::Node const&> FileSystemModel::node_for_path(Deprecated
auto& part = parts[i];
bool found = false;
for (auto& child : node->m_children) {
- if (child.name == part) {
- const_cast<Node&>(child).reify_if_needed();
- node = &child;
+ if (child->name == part) {
+ const_cast<Node&>(*child).reify_if_needed();
+ node = child;
found = true;
if (i == parts.size() - 1)
return *node;
@@ -494,7 +494,7 @@ ModelIndex FileSystemModel::index(int row, int column, ModelIndex const& parent)
const_cast<Node&>(node).reify_if_needed();
if (static_cast<size_t>(row) >= node.m_children.size())
return {};
- return create_index(row, column, &node.m_children[row]);
+ return create_index(row, column, node.m_children[row].ptr());
}
ModelIndex FileSystemModel::parent_index(ModelIndex const& index) const
@@ -801,9 +801,9 @@ Vector<ModelIndex> FileSystemModel::matches(StringView searching, unsigned flags
node.reify_if_needed();
Vector<ModelIndex> found_indices;
for (auto& child : node.m_children) {
- if (string_matches(child.name, searching, flags)) {
- const_cast<Node&>(child).reify_if_needed();
- found_indices.append(child.index(Column::Name));
+ if (string_matches(child->name, searching, flags)) {
+ const_cast<Node&>(*child).reify_if_needed();
+ found_indices.append(child->index(Column::Name));
if (flags & FirstMatchOnly)
break;
}
diff --git a/Userland/Libraries/LibGUI/FileSystemModel.h b/Userland/Libraries/LibGUI/FileSystemModel.h
index 6f4ac96f6f..6bf5d48c31 100644
--- a/Userland/Libraries/LibGUI/FileSystemModel.h
+++ b/Userland/Libraries/LibGUI/FileSystemModel.h
@@ -83,7 +83,7 @@ public:
FileSystemModel& m_model;
Node* m_parent { nullptr };
- NonnullOwnPtrVector<Node> m_children;
+ Vector<NonnullOwnPtr<Node>> m_children;
bool m_has_traversed { false };
bool m_selected { false };
diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp
index 3a5869264e..8ba2f57fe4 100644
--- a/Userland/Libraries/LibGUI/Menu.cpp
+++ b/Userland/Libraries/LibGUI/Menu.cpp
@@ -68,7 +68,7 @@ void Menu::add_action(NonnullRefPtr<Action> action)
void Menu::remove_all_actions()
{
for (auto& item : m_items) {
- ConnectionToWindowServer::the().async_remove_menu_item(m_menu_id, item.identifier());
+ ConnectionToWindowServer::the().async_remove_menu_item(m_menu_id, item->identifier());
}
m_items.clear();
}
@@ -142,7 +142,7 @@ int Menu::realize_menu(RefPtr<Action> default_action)
m_current_default_action = default_action;
for (size_t i = 0; i < m_items.size(); ++i) {
- realize_menu_item(m_items[i], i);
+ realize_menu_item(*m_items[i], i);
}
all_menus().set(m_menu_id, this);
@@ -168,14 +168,14 @@ Action* Menu::action_at(size_t index)
{
if (index >= m_items.size())
return nullptr;
- return m_items[index].action();
+ return m_items[index]->action();
}
void Menu::set_children_actions_enabled(bool enabled)
{
for (auto& item : m_items) {
- if (item.action())
- item.action()->set_enabled(enabled);
+ if (item->action())
+ item->action()->set_enabled(enabled);
}
}
diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h
index c3abdb0003..859f8b661a 100644
--- a/Userland/Libraries/LibGUI/Menu.h
+++ b/Userland/Libraries/LibGUI/Menu.h
@@ -61,7 +61,7 @@ public:
bool is_visible() const { return m_visible; }
- NonnullOwnPtrVector<MenuItem> const& items() const { return m_items; }
+ Vector<NonnullOwnPtr<MenuItem>> const& items() const { return m_items; }
private:
friend class Menubar;
@@ -77,7 +77,7 @@ private:
int m_menu_id { -1 };
DeprecatedString m_name;
RefPtr<Gfx::Bitmap const> m_icon;
- NonnullOwnPtrVector<MenuItem> m_items;
+ Vector<NonnullOwnPtr<MenuItem>> m_items;
WeakPtr<Action> m_current_default_action;
bool m_visible { false };
diff --git a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp
index 347e42007b..4e0639088d 100644
--- a/Userland/Libraries/LibGUI/RegularEditingEngine.cpp
+++ b/Userland/Libraries/LibGUI/RegularEditingEngine.cpp
@@ -61,7 +61,7 @@ void RegularEditingEngine::sort_selected_lines()
auto end = lines.begin() + (int)last_line + 1;
quick_sort(start, end, [](auto& a, auto& b) {
- return strcmp_utf32(a.code_points(), b.code_points(), min(a.length(), b.length())) < 0;
+ return strcmp_utf32(a->code_points(), b->code_points(), min(a->length(), b->length())) < 0;
});
m_editor->did_change();
diff --git a/Userland/Libraries/LibGUI/TextDocument.cpp b/Userland/Libraries/LibGUI/TextDocument.cpp
index c29c2e3220..3633c2d0f9 100644
--- a/Userland/Libraries/LibGUI/TextDocument.cpp
+++ b/Userland/Libraries/LibGUI/TextDocument.cpp
@@ -462,7 +462,7 @@ void TextDocument::update_regex_matches(StringView needle)
Vector<RegexStringView> views;
for (size_t line = 0; line < m_lines.size(); ++line) {
- views.append(m_lines.at(line).view());
+ views.append(m_lines[line]->view());
}
re.search(views, m_regex_result);
m_regex_needs_update = false;
diff --git a/Userland/Libraries/LibGUI/TextDocument.h b/Userland/Libraries/LibGUI/TextDocument.h
index a79073b7d9..f6c16f7a74 100644
--- a/Userland/Libraries/LibGUI/TextDocument.h
+++ b/Userland/Libraries/LibGUI/TextDocument.h
@@ -70,15 +70,15 @@ public:
virtual ~TextDocument() = default;
size_t line_count() const { return m_lines.size(); }
- TextDocumentLine const& line(size_t line_index) const { return m_lines[line_index]; }
- TextDocumentLine& line(size_t line_index) { return m_lines[line_index]; }
+ TextDocumentLine const& line(size_t line_index) const { return *m_lines[line_index]; }
+ TextDocumentLine& line(size_t line_index) { return *m_lines[line_index]; }
void set_spans(u32 span_collection_index, Vector<TextDocumentSpan> spans);
bool set_text(StringView, AllowCallback = AllowCallback::Yes);
- NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return m_lines; }
- NonnullOwnPtrVector<TextDocumentLine>& lines() { return m_lines; }
+ Vector<NonnullOwnPtr<TextDocumentLine>> const& lines() const { return m_lines; }
+ Vector<NonnullOwnPtr<TextDocumentLine>>& lines() { return m_lines; }
bool has_spans() const { return !m_spans.is_empty(); }
Vector<TextDocumentSpan>& spans() { return m_spans; }
@@ -163,7 +163,7 @@ protected:
private:
void merge_span_collections();
- NonnullOwnPtrVector<TextDocumentLine> m_lines;
+ Vector<NonnullOwnPtr<TextDocumentLine>> m_lines;
HashMap<u32, Vector<TextDocumentSpan>> m_span_collections;
Vector<TextDocumentSpan> m_spans;
Vector<TextDocumentFoldingRegion> m_folding_regions;
diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp
index 9cb591c8b7..68a47520e5 100644
--- a/Userland/Libraries/LibGUI/TextEditor.cpp
+++ b/Userland/Libraries/LibGUI/TextEditor.cpp
@@ -133,8 +133,8 @@ void TextEditor::update_content_size()
int content_width = 0;
int content_height = 0;
for (auto& line : m_line_visual_data) {
- content_width = max(line.visual_rect.width(), content_width);
- content_height += line.visual_rect.height();
+ content_width = max(line->visual_rect.width(), content_width);
+ content_height += line->visual_rect.height();
}
content_width += m_horizontal_content_padding * 2;
if (is_right_text_alignment(m_text_alignment))
@@ -167,7 +167,7 @@ TextPosition TextEditor::text_position_at_content_position(Gfx::IntPoint content
if (!document().line_is_visible(i))
continue;
- auto& rect = m_line_visual_data[i].visual_rect;
+ auto& rect = m_line_visual_data[i]->visual_rect;
if (position.y() >= rect.top() && position.y() <= rect.bottom()) {
line_index = i;
break;
@@ -634,7 +634,7 @@ void TextEditor::paint_event(PaintEvent& event)
first_visual_line_with_selection = visual_line_containing(line_index, selection.start().column());
if (selection.end().line() > line_index)
- last_visual_line_with_selection = m_line_visual_data[line_index].visual_lines.size();
+ last_visual_line_with_selection = m_line_visual_data[line_index]->visual_lines.size();
else
last_visual_line_with_selection = visual_line_containing(line_index, selection.end().column());
}
@@ -1441,7 +1441,7 @@ Gfx::IntRect TextEditor::line_content_rect(size_t line_index) const
line_rect.center_vertically_within({ {}, frame_inner_rect().size() });
return line_rect;
}
- return m_line_visual_data[line_index].visual_rect;
+ return m_line_visual_data[line_index]->visual_rect;
}
void TextEditor::set_cursor_and_focus_line(size_t line, size_t column)
@@ -1451,8 +1451,8 @@ void TextEditor::set_cursor_and_focus_line(size_t line, size_t column)
if (line > 1 && line < index_max) {
int headroom = frame_inner_rect().height() / 3;
do {
- auto line_data = m_line_visual_data[line];
- headroom -= line_data.visual_rect.height();
+ auto const& line_data = m_line_visual_data[line];
+ headroom -= line_data->visual_rect.height();
line--;
} while (line > 0 && headroom > 0);
@@ -1481,8 +1481,8 @@ void TextEditor::set_cursor(TextPosition const& a_position)
if (position.line() >= line_count())
position.set_line(line_count() - 1);
- if (position.column() > lines()[position.line()].length())
- position.set_column(lines()[position.line()].length());
+ if (position.column() > lines()[position.line()]->length())
+ position.set_column(lines()[position.line()]->length());
if (m_cursor != position && is_visual_data_up_to_date()) {
// NOTE: If the old cursor is no longer valid, repaint everything just in case.
@@ -1972,8 +1972,8 @@ void TextEditor::recompute_all_visual_lines()
auto folded_region_iterator = folded_regions.begin();
for (size_t line_index = 0; line_index < line_count(); ++line_index) {
recompute_visual_lines(line_index, folded_region_iterator);
- m_line_visual_data[line_index].visual_rect.set_y(y_offset);
- y_offset += m_line_visual_data[line_index].visual_rect.height();
+ m_line_visual_data[line_index]->visual_rect.set_y(y_offset);
+ y_offset += m_line_visual_data[line_index]->visual_rect.height();
}
update_content_size();
@@ -2008,7 +2008,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
size_t line_width_so_far = 0;
auto& visual_data = m_line_visual_data[line_index];
- visual_data.visual_lines.clear_with_capacity();
+ visual_data->visual_lines.clear_with_capacity();
auto available_width = visible_text_rect_in_inner_coordinates().width();
auto glyph_spacing = font().glyph_spacing();
@@ -2034,7 +2034,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
if (line_width_so_far + glyph_width + glyph_spacing > available_width) {
auto start_of_next_visual_line = line.view().iterator_offset(it_before_computing_glyph_width);
- visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, start_of_next_visual_line - start_of_visual_line));
+ visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, start_of_next_visual_line - start_of_visual_line));
line_width_so_far = 0;
start_of_visual_line = start_of_next_visual_line;
}
@@ -2042,7 +2042,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
line_width_so_far += glyph_width + glyph_spacing;
}
- visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
+ visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
};
auto wrap_visual_lines_at_words = [&]() {
@@ -2057,7 +2057,7 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
auto word_width = font().width(word);
if (line_width_so_far + word_width + glyph_spacing > available_width) {
- visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, last_boundary - start_of_visual_line));
+ visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, last_boundary - start_of_visual_line));
line_width_so_far = 0;
start_of_visual_line = last_boundary;
}
@@ -2068,13 +2068,13 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
return IterationDecision::Continue;
});
- visual_data.visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
+ visual_data->visual_lines.append(line.view().substring_view(start_of_visual_line, line.view().length() - start_of_visual_line));
};
if (line_is_visible) {
switch (wrapping_mode()) {
case WrappingMode::NoWrap:
- visual_data.visual_lines.append(line.view());
+ visual_data->visual_lines.append(line.view());
break;
case WrappingMode::WrapAnywhere:
wrap_visual_lines_anywhere();
@@ -2086,9 +2086,9 @@ void TextEditor::recompute_visual_lines(size_t line_index, Vector<TextDocumentFo
}
if (is_wrapping_enabled())
- visual_data.visual_rect = { m_horizontal_content_padding, 0, available_width, static_cast<int>(visual_data.visual_lines.size()) * line_height() };
+ visual_data->visual_rect = { m_horizontal_content_padding, 0, available_width, static_cast<int>(visual_data->visual_lines.size()) * line_height() };
else
- visual_data.visual_rect = { m_horizontal_content_padding, 0, text_width_for_font(line.view(), font()), line_height() };
+ visual_data->visual_rect = { m_horizontal_content_padding, 0, text_width_for_font(line.view(), font()), line_height() };
}
template<typename Callback>
@@ -2100,10 +2100,10 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
auto& line = document().line(line_index);
auto& visual_data = m_line_visual_data[line_index];
- for (auto visual_line_view : visual_data.visual_lines) {
+ for (auto visual_line_view : visual_data->visual_lines) {
Gfx::IntRect visual_line_rect {
- visual_data.visual_rect.x(),
- visual_data.visual_rect.y() + ((int)visual_line_index * line_height()),
+ visual_data->visual_rect.x(),
+ visual_data->visual_rect.y() + ((int)visual_line_index * line_height()),
text_width_for_font(visual_line_view, font()) + font().glyph_spacing(),
line_height()
};
@@ -2115,7 +2115,7 @@ void TextEditor::for_each_visual_line(size_t line_index, Callback callback) cons
visual_line_rect.translate_by(icon_size() + icon_padding(), 0);
}
size_t start_of_line = visual_line_view.code_points() - line.code_points();
- if (callback(visual_line_rect, visual_line_view, start_of_line, visual_line_index == visual_data.visual_lines.size() - 1) == IterationDecision::Break)
+ if (callback(visual_line_rect, visual_line_view, start_of_line, visual_line_index == visual_data->visual_lines.size() - 1) == IterationDecision::Break)
break;
++visual_line_index;
}
diff --git a/Userland/Libraries/LibGUI/TextEditor.h b/Userland/Libraries/LibGUI/TextEditor.h
index 54d55cabe9..e6a3b1c846 100644
--- a/Userland/Libraries/LibGUI/TextEditor.h
+++ b/Userland/Libraries/LibGUI/TextEditor.h
@@ -121,8 +121,8 @@ public:
size_t line_count() const { return document().line_count(); }
TextDocumentLine& line(size_t index) { return document().line(index); }
TextDocumentLine const& line(size_t index) const { return document().line(index); }
- NonnullOwnPtrVector<TextDocumentLine>& lines() { return document().lines(); }
- NonnullOwnPtrVector<TextDocumentLine> const& lines() const { return document().lines(); }
+ Vector<NonnullOwnPtr<TextDocumentLine>>& lines() { return document().lines(); }
+ Vector<NonnullOwnPtr<TextDocumentLine>> const& lines() const { return document().lines(); }
int line_height() const;
TextPosition cursor() const { return m_cursor; }
TextRange normalized_selection() const { return m_selection.normalized(); }
@@ -432,7 +432,7 @@ private:
Gfx::IntRect visual_rect;
};
- NonnullOwnPtrVector<LineVisualData> m_line_visual_data;
+ Vector<NonnullOwnPtr<LineVisualData>> m_line_visual_data;
OwnPtr<Syntax::Highlighter> m_highlighter;
OwnPtr<AutocompleteProvider> m_autocomplete_provider;
diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp
index 50c2cd9aed..4947b93e1a 100644
--- a/Userland/Libraries/LibGUI/Toolbar.cpp
+++ b/Userland/Libraries/LibGUI/Toolbar.cpp
@@ -111,7 +111,7 @@ ErrorOr<NonnullRefPtr<GUI::Button>> Toolbar::try_add_action(Action& action)
item->widget->set_fixed_size(m_button_size, m_button_size);
m_items.unchecked_append(move(item));
- return *static_cast<Button*>(m_items.last().widget.ptr());
+ return *static_cast<Button*>(m_items.last()->widget.ptr());
}
GUI::Button& Toolbar::add_action(Action& action)
@@ -196,12 +196,12 @@ ErrorOr<void> Toolbar::update_overflow_menu()
for (size_t i = 0; i < m_items.size() - 1; ++i) {
auto& item = m_items.at(i);
- auto item_size = is_horizontal ? item.widget->width() : item.widget->height();
+ auto item_size = is_horizontal ? item->widget->width() : item->widget->height();
if (position + item_size + margin > toolbar_size) {
marginal_index = i;
break;
}
- item.widget->set_visible(true);
+ item->widget->set_visible(true);
position += item_size + spacing;
}
@@ -216,10 +216,10 @@ ErrorOr<void> Toolbar::update_overflow_menu()
if (marginal_index.value() > 0) {
for (size_t i = marginal_index.value() - 1; i > 0; --i) {
auto& item = m_items.at(i);
- auto item_size = is_horizontal ? item.widget->width() : item.widget->height();
+ auto item_size = is_horizontal ? item->widget->width() : item->widget->height();
if (position + m_button_size + spacing + margin <= toolbar_size)
break;
- item.widget->set_visible(false);
+ item->widget->set_visible(false);
position -= item_size + spacing;
marginal_index = i;
}
@@ -228,9 +228,9 @@ ErrorOr<void> Toolbar::update_overflow_menu()
if (m_grouped) {
for (size_t i = marginal_index.value(); i > 0; --i) {
auto& item = m_items.at(i);
- if (item.type == Item::Type::Separator)
+ if (item->type == Item::Type::Separator)
break;
- item.widget->set_visible(false);
+ item->widget->set_visible(false);
marginal_index = i;
}
}
@@ -247,17 +247,17 @@ ErrorOr<void> Toolbar::update_overflow_menu()
auto& item = m_items.at(i);
Item* peek_item;
if (i > 0) {
- peek_item = &m_items.at(i - 1);
+ peek_item = m_items[i - 1];
if (peek_item->type == Item::Type::Separator)
peek_item->widget->set_visible(false);
}
if (i < m_items.size() - 1) {
- item.widget->set_visible(false);
- peek_item = &m_items.at(i + 1);
- if (item.action)
- TRY(m_overflow_menu->try_add_action(*item.action));
+ item->widget->set_visible(false);
+ peek_item = m_items[i + 1];
+ if (item->action)
+ TRY(m_overflow_menu->try_add_action(*item->action));
}
- if (item.action && peek_item->type == Item::Type::Separator)
+ if (item->action && peek_item->type == Item::Type::Separator)
TRY(m_overflow_menu->try_add_separator());
}
diff --git a/Userland/Libraries/LibGUI/Toolbar.h b/Userland/Libraries/LibGUI/Toolbar.h
index 8a9ec2cf1b..b1f2170975 100644
--- a/Userland/Libraries/LibGUI/Toolbar.h
+++ b/Userland/Libraries/LibGUI/Toolbar.h
@@ -53,7 +53,7 @@ private:
RefPtr<Action> action;
RefPtr<Widget> widget;
};
- NonnullOwnPtrVector<Item> m_items;
+ Vector<NonnullOwnPtr<Item>> m_items;
RefPtr<Menu> m_overflow_menu;
RefPtr<Action> m_overflow_action;
RefPtr<Button> m_overflow_button;
diff --git a/Userland/Libraries/LibGUI/UndoStack.cpp b/Userland/Libraries/LibGUI/UndoStack.cpp
index 34272f7f67..596a94b427 100644
--- a/Userland/Libraries/LibGUI/UndoStack.cpp
+++ b/Userland/Libraries/LibGUI/UndoStack.cpp
@@ -28,7 +28,7 @@ void UndoStack::undo()
return;
auto& command = m_stack[--m_stack_index];
- command.undo();
+ command->undo();
if (on_state_change)
on_state_change();
@@ -40,7 +40,7 @@ void UndoStack::redo()
return;
auto& command = m_stack[m_stack_index++];
- command.redo();
+ command->redo();
if (on_state_change)
on_state_change();
@@ -56,7 +56,7 @@ ErrorOr<void> UndoStack::try_push(NonnullOwnPtr<Command> command)
m_clean_index = {};
if (!m_stack.is_empty() && is_current_modified()) {
- if (m_stack.last().merge_with(*command))
+ if (m_stack.last()->merge_with(*command))
return {};
}
@@ -114,14 +114,14 @@ Optional<DeprecatedString> UndoStack::undo_action_text() const
{
if (!can_undo())
return {};
- return m_stack[m_stack_index - 1].action_text();
+ return m_stack[m_stack_index - 1]->action_text();
}
Optional<DeprecatedString> UndoStack::redo_action_text() const
{
if (!can_redo())
return {};
- return m_stack[m_stack_index].action_text();
+ return m_stack[m_stack_index]->action_text();
}
}
diff --git a/Userland/Libraries/LibGUI/UndoStack.h b/Userland/Libraries/LibGUI/UndoStack.h
index e37a1acce2..02b1658baf 100644
--- a/Userland/Libraries/LibGUI/UndoStack.h
+++ b/Userland/Libraries/LibGUI/UndoStack.h
@@ -41,7 +41,7 @@ public:
Function<void()> on_state_change;
private:
- NonnullOwnPtrVector<Command> m_stack;
+ Vector<NonnullOwnPtr<Command>> m_stack;
size_t m_stack_index { 0 };
Optional<size_t> m_clean_index;
Optional<Time> m_last_unmodified_timestamp;
diff --git a/Userland/Libraries/LibGemini/Document.cpp b/Userland/Libraries/LibGemini/Document.cpp
index 41794cf7d3..be9cdd0b6a 100644
--- a/Userland/Libraries/LibGemini/Document.cpp
+++ b/Userland/Libraries/LibGemini/Document.cpp
@@ -21,7 +21,7 @@ DeprecatedString Document::render_to_html() const
html_builder.append("</title>\n</head>\n"sv);
html_builder.append("<body>\n"sv);
for (auto& line : m_lines) {
- html_builder.append(line.render_to_html());
+ html_builder.append(line->render_to_html());
}
html_builder.append("</body>"sv);
html_builder.append("</html>"sv);
diff --git a/Userland/Libraries/LibGemini/Document.h b/Userland/Libraries/LibGemini/Document.h
index c06fbbbd84..b270f7e8e6 100644
--- a/Userland/Libraries/LibGemini/Document.h
+++ b/Userland/Libraries/LibGemini/Document.h
@@ -44,7 +44,7 @@ private:
void read_lines(StringView);
- NonnullOwnPtrVector<Line> m_lines;
+ Vector<NonnullOwnPtr<Line>> m_lines;
URL m_url;
bool m_inside_preformatted_block { false };
bool m_inside_unordered_list { false };
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 215d5d1d3d..036bf2a32b 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -77,7 +77,7 @@ struct GIFLoadingContext {
size_t data_size { 0 };
LogicalScreen logical_screen {};
u8 background_color_index { 0 };
- NonnullOwnPtrVector<GIFImageDescriptor> images {};
+ Vector<NonnullOwnPtr<GIFImageDescriptor>> images {};
size_t loops { 1 };
RefPtr<Gfx::Bitmap> frame_buffer;
size_t current_frame { 0 };
@@ -284,11 +284,11 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
for (size_t i = start_frame; i <= frame_index; ++i) {
auto& image = context.images.at(i);
- auto const previous_image_disposal_method = i > 0 ? context.images.at(i - 1).disposal_method : GIFImageDescriptor::DisposalMethod::None;
+ auto const previous_image_disposal_method = i > 0 ? context.images.at(i - 1)->disposal_method : GIFImageDescriptor::DisposalMethod::None;
if (i == 0) {
context.frame_buffer->fill(Color::Transparent);
- } else if (i > 0 && image.disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious
+ } else if (i > 0 && image->disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious
&& previous_image_disposal_method != GIFImageDescriptor::DisposalMethod::RestorePrevious) {
// This marks the start of a run of frames that once disposed should be restored to the
// previous underlying image contents. Therefore we make a copy of the current frame
@@ -302,23 +302,23 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
// background color of the GIF itself. It appears that all major browsers and most other
// GIF decoders adhere to the former interpretation, therefore we will do the same by
// clearing the entire frame buffer to transparent.
- clear_rect(*context.frame_buffer, context.images.at(i - 1).rect(), Color::Transparent);
+ clear_rect(*context.frame_buffer, context.images[i - 1]->rect(), Color::Transparent);
} else if (i > 0 && previous_image_disposal_method == GIFImageDescriptor::DisposalMethod::RestorePrevious) {
// Previous frame indicated that once disposed, it should be restored to *its* previous
// underlying image contents, therefore we restore the saved previous frame buffer.
copy_frame_buffer(*context.frame_buffer, *context.prev_frame_buffer);
}
- if (image.lzw_min_code_size > 8)
+ if (image->lzw_min_code_size > 8)
return Error::from_string_literal("LZW minimum code size is greater than 8");
- LZWDecoder decoder(image.lzw_encoded_bytes, image.lzw_min_code_size);
+ LZWDecoder decoder(image->lzw_encoded_bytes, image->lzw_min_code_size);
// Add GIF-specific control codes
int const clear_code = decoder.add_control_code();
int const end_of_information_code = decoder.add_control_code();
- auto const& color_map = image.use_global_color_map ? context.logical_screen.color_map : image.color_map;
+ auto const& color_map = image->use_global_color_map ? context.logical_screen.color_map : image->color_map;
int pixel_index = 0;
int row = 0;
@@ -336,25 +336,25 @@ static ErrorOr<void> decode_frame(GIFLoadingContext& context, size_t frame_index
}
if (code.value() == end_of_information_code)
break;
- if (!image.width)
+ if (!image->width)
continue;
auto colors = decoder.get_output();
for (auto const& color : colors) {
auto c = color_map[color];
- int x = pixel_index % image.width + image.x;
- int y = row + image.y;
+ int x = pixel_index % image->width + image->x;
+ int y = row + image->y;
- if (context.frame_buffer->rect().contains(x, y) && (!image.transparent || color != image.transparency_index)) {
+ if (context.frame_buffer->rect().contains(x, y) && (!image->transparent || color != image->transparency_index)) {
context.frame_buffer->set_pixel(x, y, c);
}
++pixel_index;
- if (pixel_index % image.width == 0) {
- if (image.interlaced) {
+ if (pixel_index % image->width == 0) {
+ if (image->interlaced) {
if (interlace_pass < 4) {
- if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image.height) {
+ if (row + INTERLACE_ROW_STRIDES[interlace_pass] >= image->height) {
++interlace_pass;
if (interlace_pass < 4)
row = INTERLACE_ROW_OFFSETS[interlace_pass];
@@ -471,28 +471,28 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
context.images.append(move(current_image));
auto& image = context.images.last();
- image.x = TRY(stream.read_value<LittleEndian<u16>>());
- image.y = TRY(stream.read_value<LittleEndian<u16>>());
- image.width = TRY(stream.read_value<LittleEndian<u16>>());
- image.height = TRY(stream.read_value<LittleEndian<u16>>());
+ image->x = TRY(stream.read_value<LittleEndian<u16>>());
+ image->y = TRY(stream.read_value<LittleEndian<u16>>());
+ image->width = TRY(stream.read_value<LittleEndian<u16>>());
+ image->height = TRY(stream.read_value<LittleEndian<u16>>());
auto packed_fields = TRY(stream.read_value<u8>());
- image.use_global_color_map = !(packed_fields & 0x80);
- image.interlaced = (packed_fields & 0x40) != 0;
+ image->use_global_color_map = !(packed_fields & 0x80);
+ image->interlaced = (packed_fields & 0x40) != 0;
- if (!image.use_global_color_map) {
+ if (!image->use_global_color_map) {
size_t local_color_table_size = AK::exp2<size_t>((packed_fields & 7) + 1);
for (size_t i = 0; i < local_color_table_size; ++i) {
u8 r = TRY(stream.read_value<u8>());
u8 g = TRY(stream.read_value<u8>());
u8 b = TRY(stream.read_value<u8>());
- image.color_map[i] = { r, g, b };
+ image->color_map[i] = { r, g, b };
}
}
- image.lzw_min_code_size = TRY(stream.read_value<u8>());
+ image->lzw_min_code_size = TRY(stream.read_value<u8>());
u8 lzw_encoded_bytes_expected = 0;
@@ -505,7 +505,7 @@ static ErrorOr<void> load_gif_frame_descriptors(GIFLoadingContext& context)
TRY(stream.read_entire_buffer(buffer.span().trim(lzw_encoded_bytes_expected)));
for (int i = 0; i < lzw_encoded_bytes_expected; ++i) {
- image.lzw_encoded_bytes.append(buffer[i]);
+ image->lzw_encoded_bytes.append(buffer[i]);
}
}
@@ -657,7 +657,7 @@ ErrorOr<ImageFrameDescriptor> GIFImageDecoderPlugin::frame(size_t index)
ImageFrameDescriptor frame {};
frame.image = TRY(m_context->frame_buffer->clone());
- frame.duration = m_context->images.at(index).duration * 10;
+ frame.duration = m_context->images[index]->duration * 10;
if (frame.duration <= 10) {
frame.duration = 100;
diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp
index 2a64ee3354..d5eeae2434 100644
--- a/Userland/Libraries/LibHTTP/Job.cpp
+++ b/Userland/Libraries/LibHTTP/Job.cpp
@@ -122,7 +122,7 @@ void Job::flush_received_buffers()
return;
dbgln_if(JOB_DEBUG, "Job: Flushing received buffers: have {} bytes in {} buffers for {}", m_buffered_size, m_received_buffers.size(), m_request.url());
for (size_t i = 0; i < m_received_buffers.size(); ++i) {
- auto& payload = m_received_buffers[i].pending_flush;
+ auto& payload = m_received_buffers[i]->pending_flush;
auto result = do_write(payload);
if (result.is_error()) {
if (!result.error().is_errno()) {
@@ -591,8 +591,8 @@ void Job::finish_up()
u8* flat_ptr = flattened_buffer.data();
for (auto& received_buffer : m_received_buffers) {
- memcpy(flat_ptr, received_buffer.pending_flush.data(), received_buffer.pending_flush.size());
- flat_ptr += received_buffer.pending_flush.size();
+ memcpy(flat_ptr, received_buffer->pending_flush.data(), received_buffer->pending_flush.size());
+ flat_ptr += received_buffer->pending_flush.size();
}
m_received_buffers.clear();
diff --git a/Userland/Libraries/LibHTTP/Job.h b/Userland/Libraries/LibHTTP/Job.h
index 8792fcfc17..5743416011 100644
--- a/Userland/Libraries/LibHTTP/Job.h
+++ b/Userland/Libraries/LibHTTP/Job.h
@@ -71,7 +71,7 @@ protected:
ReadonlyBytes pending_flush;
};
- NonnullOwnPtrVector<ReceivedBuffer> m_received_buffers;
+ Vector<NonnullOwnPtr<ReceivedBuffer>> m_received_buffers;
size_t m_buffered_size { 0 };
size_t m_received_size { 0 };
diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp
index 84622a7c68..1c94f5ad11 100644
--- a/Userland/Libraries/LibIPC/Connection.cpp
+++ b/Userland/Libraries/LibIPC/Connection.cpp
@@ -128,8 +128,8 @@ void ConnectionBase::handle_messages()
{
auto messages = move(m_unprocessed_messages);
for (auto& message : messages) {
- if (message.endpoint_magic() == m_local_endpoint_magic) {
- auto handler_result = m_local_stub.handle(message);
+ if (message->endpoint_magic() == m_local_endpoint_magic) {
+ auto handler_result = m_local_stub.handle(*message);
if (handler_result.is_error()) {
dbgln("IPC::ConnectionBase::handle_messages: {}", handler_result.error());
continue;
@@ -246,9 +246,9 @@ OwnPtr<IPC::Message> ConnectionBase::wait_for_specific_endpoint_message_impl(u32
// Otherwise we might end up blocked for a while for no reason.
for (size_t i = 0; i < m_unprocessed_messages.size(); ++i) {
auto& message = m_unprocessed_messages[i];
- if (message.endpoint_magic() != endpoint_magic)
+ if (message->endpoint_magic() != endpoint_magic)
continue;
- if (message.message_id() == message_id)
+ if (message->message_id() == message_id)
return m_unprocessed_messages.take(i);
}
diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h
index 3982c2e252..bbd08bf3fe 100644
--- a/Userland/Libraries/LibIPC/Connection.h
+++ b/Userland/Libraries/LibIPC/Connection.h
@@ -75,7 +75,7 @@ protected:
RefPtr<Core::Timer> m_responsiveness_timer;
- NonnullOwnPtrVector<Message> m_unprocessed_messages;
+ Vector<NonnullOwnPtr<Message>> m_unprocessed_messages;
ByteBuffer m_unprocessed_bytes;
u32 m_local_endpoint_magic { 0 };
diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.cpp b/Userland/Libraries/LibJS/Bytecode/Executable.cpp
index d299edceb9..722388e51b 100644
--- a/Userland/Libraries/LibJS/Bytecode/Executable.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Executable.cpp
@@ -12,7 +12,7 @@ void Executable::dump() const
{
dbgln("\033[33;1mJS::Bytecode::Executable\033[0m ({})", name);
for (auto& block : basic_blocks)
- block.dump(*this);
+ block->dump(*this);
if (!string_table->is_empty()) {
outln();
string_table->dump();
diff --git a/Userland/Libraries/LibJS/Bytecode/Executable.h b/Userland/Libraries/LibJS/Bytecode/Executable.h
index f69ed9bd21..8cd9b0edbb 100644
--- a/Userland/Libraries/LibJS/Bytecode/Executable.h
+++ b/Userland/Libraries/LibJS/Bytecode/Executable.h
@@ -16,7 +16,7 @@ namespace JS::Bytecode {
struct Executable {
DeprecatedFlyString name;
- NonnullOwnPtrVector<BasicBlock> basic_blocks;
+ Vector<NonnullOwnPtr<BasicBlock>> basic_blocks;
NonnullOwnPtr<StringTable> string_table;
NonnullOwnPtr<IdentifierTable> identifier_table;
size_t number_of_registers { 0 };
diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.cpp b/Userland/Libraries/LibJS/Bytecode/Generator.cpp
index c08f233319..46d844eff6 100644
--- a/Userland/Libraries/LibJS/Bytecode/Generator.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Generator.cpp
@@ -36,9 +36,9 @@ CodeGenerationErrorOr<NonnullOwnPtr<Executable>> Generator::generate(ASTNode con
if (generator.is_in_generator_or_async_function()) {
// Terminate all unterminated blocks with yield return
for (auto& block : generator.m_root_basic_blocks) {
- if (block.is_terminated())
+ if (block->is_terminated())
continue;
- generator.switch_to_basic_block(block);
+ generator.switch_to_basic_block(*block);
generator.emit<Bytecode::Op::LoadImmediate>(js_undefined());
generator.emit<Bytecode::Op::Yield>(nullptr);
}
diff --git a/Userland/Libraries/LibJS/Bytecode/Generator.h b/Userland/Libraries/LibJS/Bytecode/Generator.h
index c56af24b01..ba8fd65f15 100644
--- a/Userland/Libraries/LibJS/Bytecode/Generator.h
+++ b/Userland/Libraries/LibJS/Bytecode/Generator.h
@@ -104,7 +104,7 @@ public:
if (name.is_empty())
name = DeprecatedString::number(m_next_block++);
m_root_basic_blocks.append(BasicBlock::create(name));
- return m_root_basic_blocks.last();
+ return *m_root_basic_blocks.last();
}
bool is_current_block_terminated() const
@@ -227,7 +227,7 @@ private:
};
BasicBlock* m_current_basic_block { nullptr };
- NonnullOwnPtrVector<BasicBlock> m_root_basic_blocks;
+ Vector<NonnullOwnPtr<BasicBlock>> m_root_basic_blocks;
NonnullOwnPtr<StringTable> m_string_table;
NonnullOwnPtr<IdentifierTable> m_identifier_table;
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
index 1926ef3ed0..27cb3fb596 100644
--- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
@@ -62,7 +62,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e
pushed_execution_context = true;
}
- TemporaryChange restore_current_block { m_current_block, entry_point ?: &executable.basic_blocks.first() };
+ TemporaryChange restore_current_block { m_current_block, entry_point ?: executable.basic_blocks.first() };
if (in_frame)
m_register_windows.append(in_frame);
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp
index f0553cefa7..c8d9ef2473 100644
--- a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp
@@ -164,7 +164,7 @@ void GenerateCFG::perform(PassPipelineExecutable& executable)
unwind_frames.append(&top_level_frame);
- generate_cfg_for_block(executable.executable.basic_blocks.first(), executable);
+ generate_cfg_for_block(*executable.executable.basic_blocks.first(), executable);
finished();
}
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/LoadElimination.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/LoadElimination.cpp
index 71d7426755..10db412cbe 100644
--- a/Userland/Libraries/LibJS/Bytecode/Pass/LoadElimination.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Pass/LoadElimination.cpp
@@ -175,20 +175,20 @@ void EliminateLoads::perform(PassPipelineExecutable& executable)
// save some work between blocks
for (auto it = executable.executable.basic_blocks.begin(); it != executable.executable.basic_blocks.end(); ++it) {
auto const& old_block = *it;
- auto new_block = eliminate_loads(old_block, executable.executable.number_of_registers);
+ auto new_block = eliminate_loads(*old_block, executable.executable.number_of_registers);
// We will replace the old block, with a new one, so we need to replace all references,
// to the old one with the new one
for (auto& block : executable.executable.basic_blocks) {
- InstructionStreamIterator it { block.instruction_stream() };
+ InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;
- const_cast<Instruction&>(instruction).replace_references(old_block, *new_block);
+ const_cast<Instruction&>(instruction).replace_references(*old_block, *new_block);
}
}
- executable.executable.basic_blocks.ptr_at(it.index()) = move(new_block);
+ executable.executable.basic_blocks[it.index()] = move(new_block);
}
finished();
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp
index cbbb27644f..adda052751 100644
--- a/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Pass/MergeBlocks.cpp
@@ -81,7 +81,7 @@ void MergeBlocks::perform(PassPipelineExecutable& executable)
first_successor_position = it.index();
}
for (auto& block : executable.executable.basic_blocks) {
- InstructionStreamIterator it { block.instruction_stream() };
+ InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp
index 017ef191b2..195c46e125 100644
--- a/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Pass/PlaceBlocks.cpp
@@ -35,7 +35,7 @@ void PlaceBlocks::perform(PassPipelineExecutable& executable)
};
// Make sure to visit the entry block first
- visit(&executable.executable.basic_blocks.first());
+ visit(executable.executable.basic_blocks.first());
for (auto& entry : cfg)
visit(entry.key);
diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/UnifySameBlocks.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/UnifySameBlocks.cpp
index 9fcbd00466..bf3841153f 100644
--- a/Userland/Libraries/LibJS/Bytecode/Pass/UnifySameBlocks.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Pass/UnifySameBlocks.cpp
@@ -22,19 +22,19 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
for (size_t i = 0; i < executable.executable.basic_blocks.size(); ++i) {
auto& block = executable.executable.basic_blocks[i];
- auto block_bytes = block.instruction_stream();
+ auto block_bytes = block->instruction_stream();
for (auto& candidate_block : executable.executable.basic_blocks.span().slice(i + 1)) {
if (equal_blocks.contains(&*candidate_block))
continue;
// FIXME: This can probably be relaxed a bit...
- if (candidate_block->size() != block.size())
+ if (candidate_block->size() != block->size())
continue;
auto candidate_bytes = candidate_block->instruction_stream();
// FIXME: NewBigInt's value is not correctly reflected by its encoding in memory,
// this will yield false negatives for blocks containing that
if (memcmp(candidate_bytes.data(), block_bytes.data(), candidate_block->size()) == 0)
- equal_blocks.set(&*candidate_block, &block);
+ equal_blocks.set(candidate_block.ptr(), block);
}
}
@@ -47,7 +47,7 @@ void UnifySameBlocks::perform(PassPipelineExecutable& executable)
first_successor_position = it.index();
for (auto& block : executable.executable.basic_blocks) {
- InstructionStreamIterator it { block.instruction_stream() };
+ InstructionStreamIterator it { block->instruction_stream() };
while (!it.at_end()) {
auto& instruction = *it;
++it;
diff --git a/Userland/Libraries/LibJS/Bytecode/PassManager.h b/Userland/Libraries/LibJS/Bytecode/PassManager.h
index 2be204fae7..3709612dbf 100644
--- a/Userland/Libraries/LibJS/Bytecode/PassManager.h
+++ b/Userland/Libraries/LibJS/Bytecode/PassManager.h
@@ -61,12 +61,12 @@ public:
{
started();
for (auto& pass : m_passes)
- pass.perform(executable);
+ pass->perform(executable);
finished();
}
private:
- NonnullOwnPtrVector<Pass> m_passes;
+ Vector<NonnullOwnPtr<Pass>> m_passes;
};
namespace Passes {
diff --git a/Userland/Libraries/LibMarkdown/ContainerBlock.cpp b/Userland/Libraries/LibMarkdown/ContainerBlock.cpp
index d18fab6b4b..7baf3e1afb 100644
--- a/Userland/Libraries/LibMarkdown/ContainerBlock.cpp
+++ b/Userland/Libraries/LibMarkdown/ContainerBlock.cpp
@@ -22,15 +22,15 @@ DeprecatedString ContainerBlock::render_to_html(bool tight) const
StringBuilder builder;
for (size_t i = 0; i + 1 < m_blocks.size(); ++i) {
- auto s = m_blocks[i].render_to_html(tight);
+ auto s = m_blocks[i]->render_to_html(tight);
builder.append(s);
}
// I don't like this edge case.
if (m_blocks.size() != 0) {
auto& block = m_blocks[m_blocks.size() - 1];
- auto s = block.render_to_html(tight);
- if (tight && dynamic_cast<Paragraph const*>(&block)) {
+ auto s = block->render_to_html(tight);
+ if (tight && dynamic_cast<Paragraph const*>(block.ptr())) {
builder.append(s.substring_view(0, s.length() - 1));
} else {
builder.append(s);
@@ -45,7 +45,7 @@ Vector<DeprecatedString> ContainerBlock::render_lines_for_terminal(size_t view_w
Vector<DeprecatedString> lines;
for (auto& block : m_blocks) {
- for (auto& line : block.render_lines_for_terminal(view_width))
+ for (auto& line : block->render_lines_for_terminal(view_width))
lines.append(move(line));
}
@@ -59,7 +59,7 @@ RecursionDecision ContainerBlock::walk(Visitor& visitor) const
return rd;
for (auto const& block : m_blocks) {
- rd = block.walk(visitor);
+ rd = block->walk(visitor);
if (rd == RecursionDecision::Break)
return rd;
}
@@ -68,7 +68,7 @@ RecursionDecision ContainerBlock::walk(Visitor& visitor) const
}
template<class CodeBlock>
-static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blocks, Heading* current_section)
+static bool try_parse_block(LineIterator& lines, Vector<NonnullOwnPtr<Block>>& blocks, Heading* current_section)
{
OwnPtr<CodeBlock> block = CodeBlock::parse(lines, current_section);
if (!block)
@@ -78,7 +78,7 @@ static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blo
}
template<typename BlockType>
-static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blocks)
+static bool try_parse_block(LineIterator& lines, Vector<NonnullOwnPtr<Block>>& blocks)
{
OwnPtr<BlockType> block = BlockType::parse(lines);
if (!block)
@@ -89,7 +89,7 @@ static bool try_parse_block(LineIterator& lines, NonnullOwnPtrVector<Block>& blo
OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
{
- NonnullOwnPtrVector<Block> blocks;
+ Vector<NonnullOwnPtr<Block>> blocks;
StringBuilder paragraph_text;
Heading* current_section = nullptr;
@@ -121,7 +121,7 @@ OwnPtr<ContainerBlock> ContainerBlock::parse(LineIterator& lines)
bool heading = false;
if ((heading = try_parse_block<Heading>(lines, blocks)))
- current_section = dynamic_cast<Heading*>(&blocks.last());
+ current_section = dynamic_cast<Heading*>(blocks.last().ptr());
bool any = heading
|| try_parse_block<Table>(lines, blocks)
diff --git a/Userland/Libraries/LibMarkdown/ContainerBlock.h b/Userland/Libraries/LibMarkdown/ContainerBlock.h
index c9666685a7..7743562a3a 100644
--- a/Userland/Libraries/LibMarkdown/ContainerBlock.h
+++ b/Userland/Libraries/LibMarkdown/ContainerBlock.h
@@ -17,7 +17,7 @@ namespace Markdown {
class ContainerBlock final : public Block {
public:
- ContainerBlock(NonnullOwnPtrVector<Block> blocks, bool has_blank_lines, bool has_trailing_blank_lines)
+ ContainerBlock(Vector<NonnullOwnPtr<Block>> blocks, bool has_blank_lines, bool has_trailing_blank_lines)
: m_blocks(move(blocks))
, m_has_blank_lines(has_blank_lines)
, m_has_trailing_blank_lines(has_trailing_blank_lines)
@@ -35,10 +35,10 @@ public:
bool has_blank_lines() const { return m_has_blank_lines; }
bool has_trailing_blank_lines() const { return m_has_trailing_blank_lines; }
- NonnullOwnPtrVector<Block> const& blocks() const { return m_blocks; }
+ Vector<NonnullOwnPtr<Block>> const& blocks() const { return m_blocks; }
private:
- NonnullOwnPtrVector<Block> m_blocks;
+ Vector<NonnullOwnPtr<Block>> m_blocks;
bool m_has_blank_lines;
bool m_has_trailing_blank_lines;
};
diff --git a/Userland/Libraries/LibMarkdown/List.cpp b/Userland/Libraries/LibMarkdown/List.cpp
index 75f46d2119..2ac30be699 100644
--- a/Userland/Libraries/LibMarkdown/List.cpp
+++ b/Userland/Libraries/LibMarkdown/List.cpp
@@ -27,7 +27,7 @@ DeprecatedString List::render_to_html(bool) const
for (auto& item : m_items) {
builder.append("<li>"sv);
- if (!m_is_tight || (item->blocks().size() != 0 && !dynamic_cast<Paragraph const*>(&(item->blocks()[0]))))
+ if (!m_is_tight || (item->blocks().size() != 0 && !dynamic_cast<Paragraph const*>(item->blocks()[0].ptr())))
builder.append('\n');
builder.append(item->render_to_html(m_is_tight));
builder.append("</li>\n"sv);
diff --git a/Userland/Libraries/LibMarkdown/Text.cpp b/Userland/Libraries/LibMarkdown/Text.cpp
index c5296ebfaa..e410772d06 100644
--- a/Userland/Libraries/LibMarkdown/Text.cpp
+++ b/Userland/Libraries/LibMarkdown/Text.cpp
@@ -194,14 +194,14 @@ RecursionDecision Text::LinkNode::walk(Visitor& visitor) const
void Text::MultiNode::render_to_html(StringBuilder& builder) const
{
for (auto& child : children) {
- child.render_to_html(builder);
+ child->render_to_html(builder);
}
}
void Text::MultiNode::render_for_terminal(StringBuilder& builder) const
{
for (auto& child : children) {
- child.render_for_terminal(builder);
+ child->render_for_terminal(builder);
}
}
@@ -209,7 +209,7 @@ size_t Text::MultiNode::terminal_length() const
{
size_t length = 0;
for (auto& child : children) {
- length += child.terminal_length();
+ length += child->terminal_length();
}
return length;
}
@@ -221,7 +221,7 @@ RecursionDecision Text::MultiNode::walk(Visitor& visitor) const
return rd;
for (auto const& child : children) {
- rd = child.walk(visitor);
+ rd = child->walk(visitor);
if (rd == RecursionDecision::Break)
return rd;
}
@@ -550,8 +550,8 @@ NonnullOwnPtr<Text::Node> Text::parse_code(Vector<Token>::ConstIterator& tokens)
// Strip first and last space, when appropriate.
if (!is_all_whitespace) {
- auto& first = dynamic_cast<TextNode&>(code->children.first());
- auto& last = dynamic_cast<TextNode&>(code->children.last());
+ auto& first = dynamic_cast<TextNode&>(*code->children.first());
+ auto& last = dynamic_cast<TextNode&>(*code->children.last());
if (first.text.starts_with(' ') && last.text.ends_with(' ')) {
first.text = first.text.substring(1);
last.text = last.text.substring(0, last.text.length() - 1);
@@ -653,8 +653,8 @@ NonnullOwnPtr<Text::Node> Text::parse_strike_through(Vector<Token>::ConstIterato
tokens = iterator;
if (!is_all_whitespace) {
- auto& first = dynamic_cast<TextNode&>(striked_text->children.first());
- auto& last = dynamic_cast<TextNode&>(striked_text->children.last());
+ auto& first = dynamic_cast<TextNode&>(*striked_text->children.first());
+ auto& last = dynamic_cast<TextNode&>(*striked_text->children.last());
if (first.text.starts_with(' ') && last.text.ends_with(' ')) {
first.text = first.text.substring(1);
last.text = last.text.substring(0, last.text.length() - 1);
diff --git a/Userland/Libraries/LibMarkdown/Text.h b/Userland/Libraries/LibMarkdown/Text.h
index e3838c84ec..7dd4863b00 100644
--- a/Userland/Libraries/LibMarkdown/Text.h
+++ b/Userland/Libraries/LibMarkdown/Text.h
@@ -121,7 +121,7 @@ public:
class MultiNode : public Node {
public:
- NonnullOwnPtrVector<Node> children;
+ Vector<NonnullOwnPtr<Node>> children;
virtual void render_to_html(StringBuilder& builder) const override;
virtual void render_for_terminal(StringBuilder& builder) const override;
diff --git a/Userland/Libraries/LibVT/Terminal.cpp b/Userland/Libraries/LibVT/Terminal.cpp
index 39cf984b7c..3ea160f266 100644
--- a/Userland/Libraries/LibVT/Terminal.cpp
+++ b/Userland/Libraries/LibVT/Terminal.cpp
@@ -33,7 +33,7 @@ void Terminal::clear()
{
dbgln_if(TERMINAL_DEBUG, "Clear the entire screen");
for (size_t i = 0; i < rows(); ++i)
- active_buffer()[i].clear();
+ active_buffer()[i]->clear();
set_cursor(0, 0);
}
@@ -715,7 +715,7 @@ void Terminal::linefeed()
u16 new_row = cursor_row();
#ifndef KERNEL
if (!m_controls_are_logically_generated)
- active_buffer()[new_row].set_terminated(m_column_before_carriage_return.value_or(cursor_column()));
+ active_buffer()[new_row]->set_terminated(m_column_before_carriage_return.value_or(cursor_column()));
#endif
if (cursor_row() == m_scroll_region_bottom) {
scroll_up();
@@ -763,26 +763,26 @@ void Terminal::scroll_up(u16 region_top, u16 region_bottom, size_t count)
auto remaining_lines = max_history_size() - history_size();
history_delta = (count > remaining_lines) ? remaining_lines - count : 0;
for (size_t i = 0; i < count; ++i)
- add_line_to_history(move(active_buffer().ptr_at(region_top + i)));
+ add_line_to_history(move(active_buffer().at(region_top + i)));
}
// Move lines into their new place.
for (u16 row = region_top; row + count <= region_bottom; ++row)
- swap(active_buffer().ptr_at(row), active_buffer().ptr_at(row + count));
+ swap(active_buffer().at(row), active_buffer().at(row + count));
// Clear 'new' lines at the bottom.
if (should_move_to_scrollback) {
// Since we moved the previous lines into history, we can't just clear them.
for (u16 row = region_bottom + 1 - count; row <= region_bottom; ++row)
- active_buffer().ptr_at(row) = make<Line>(columns());
+ active_buffer().at(row) = make<Line>(columns());
} else {
// The new lines haven't been moved and we don't want to leak memory.
for (u16 row = region_bottom + 1 - count; row <= region_bottom; ++row)
- active_buffer()[row].clear();
+ active_buffer()[row]->clear();
}
// Set dirty flag on swapped lines.
// The other lines have implicitly been set dirty by being cleared.
for (u16 row = region_top; row + count <= region_bottom; ++row)
- active_buffer()[row].set_dirty(true);
+ active_buffer()[row]->set_dirty(true);
m_client.terminal_history_changed(history_delta);
}
@@ -800,14 +800,14 @@ void Terminal::scroll_down(u16 region_top, u16 region_bottom, size_t count)
// Move lines into their new place.
for (int row = region_bottom; row >= static_cast<int>(region_top + count); --row)
- swap(active_buffer().ptr_at(row), active_buffer().ptr_at(row - count));
+ swap(active_buffer().at(row), active_buffer().at(row - count));
// Clear the 'new' lines at the top.
for (u16 row = region_top; row < region_top + count; ++row)
- active_buffer()[row].clear();
+ active_buffer()[row]->clear();
// Set dirty flag on swapped lines.
// The other lines have implicitly been set dirty by being cleared.
for (u16 row = region_top + count; row <= region_bottom; ++row)
- active_buffer()[row].set_dirty(true);
+ active_buffer()[row]->set_dirty(true);
}
// Insert `count` blank cells at the end of the line. Text moves left.
@@ -820,9 +820,9 @@ void Terminal::scroll_left(u16 row, u16 column, size_t count)
auto& line = active_buffer()[row];
for (size_t i = column; i < columns() - count; ++i)
- swap(line.cell_at(i), line.cell_at(i + count));
+ swap(line->cell_at(i), line->cell_at(i + count));
clear_in_line(row, columns() - count, columns() - 1);
- line.set_dirty(true);
+ line->set_dirty(true);
}
// Insert `count` blank cells after `row`. Text moves right.
@@ -835,9 +835,9 @@ void Terminal::scroll_right(u16 row, u16 column, size_t count)
auto& line = active_buffer()[row];
for (int i = columns() - 1; i >= static_cast<int>(column + count); --i)
- swap(line.cell_at(i), line.cell_at(i - count));
+ swap(line->cell_at(i), line->cell_at(i - count));
clear_in_line(row, column, column + count - 1);
- line.set_dirty(true);
+ line->set_dirty(true);
}
void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
@@ -845,10 +845,10 @@ void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
VERIFY(row < rows());
VERIFY(column < columns());
auto& line = active_buffer()[row];
- line.set_code_point(column, code_point);
- line.attribute_at(column) = m_current_state.attribute;
- line.attribute_at(column).flags |= Attribute::Flags::Touched;
- line.set_dirty(true);
+ line->set_code_point(column, code_point);
+ line->attribute_at(column) = m_current_state.attribute;
+ line->attribute_at(column).flags |= Attribute::Flags::Touched;
+ line->set_dirty(true);
m_last_code_point = code_point;
}
@@ -856,7 +856,7 @@ void Terminal::put_character_at(unsigned row, unsigned column, u32 code_point)
void Terminal::clear_in_line(u16 row, u16 first_column, u16 last_column)
{
VERIFY(row < rows());
- active_buffer()[row].clear_range(first_column, last_column, m_current_state.attribute);
+ active_buffer()[row]->clear_range(first_column, last_column, m_current_state.attribute);
}
#endif
@@ -1504,44 +1504,44 @@ void Terminal::set_size(u16 columns, u16 rows)
if (forwards) {
for (size_t i = 1; i <= buffer.size(); ++i) {
auto is_at_seam = i == 1;
- auto next_line = is_at_seam ? nullptr : &buffer[buffer.size() - i + 1];
- auto& line = buffer[buffer.size() - i];
+ Line* next_line = is_at_seam ? nullptr : buffer[buffer.size() - i + 1].ptr();
+ Line* line = buffer[buffer.size() - i].ptr();
auto next_cursor = cursor_on_line(buffer.size() - i + 1);
- line.rewrap(columns, next_line, next_cursor ?: cursor_on_line(buffer.size() - i), !!next_cursor);
+ line->rewrap(columns, next_line, next_cursor ?: cursor_on_line(buffer.size() - i), !!next_cursor);
}
} else {
for (size_t i = 0; i < buffer.size(); ++i) {
auto is_at_seam = i + 1 == buffer.size();
- auto next_line = is_at_seam ? nullptr : &buffer[i + 1];
+ Line* next_line = is_at_seam ? nullptr : buffer[i + 1].ptr();
auto next_cursor = cursor_on_line(i + 1);
- buffer[i].rewrap(columns, next_line, next_cursor ?: cursor_on_line(i), !!next_cursor);
+ buffer[i]->rewrap(columns, next_line, next_cursor ?: cursor_on_line(i), !!next_cursor);
}
}
Queue<size_t> lines_to_reevaluate;
for (size_t i = 0; i < buffer.size(); ++i) {
- if (buffer[i].length() != columns)
+ if (buffer[i]->length() != columns)
lines_to_reevaluate.enqueue(i);
}
while (!lines_to_reevaluate.is_empty()) {
auto index = lines_to_reevaluate.dequeue();
auto is_at_seam = index + 1 == buffer.size();
- auto next_line = is_at_seam ? nullptr : &buffer[index + 1];
- auto& line = buffer[index];
+ Line* const next_line = is_at_seam ? nullptr : buffer[index + 1].ptr();
+ Line* const line = buffer[index].ptr();
auto next_cursor = cursor_on_line(index + 1);
- line.rewrap(columns, next_line, next_cursor ?: cursor_on_line(index), !!next_cursor);
- if (line.length() > columns) {
+ line->rewrap(columns, next_line, next_cursor ?: cursor_on_line(index), !!next_cursor);
+ if (line->length() > columns) {
auto current_cursor = cursor_on_line(index);
// Split the line into two (or more)
++index;
buffer.insert(index, make<Line>(0));
- VERIFY(buffer[index].length() == 0);
- line.rewrap(columns, &buffer[index], current_cursor, false);
+ VERIFY(buffer[index]->length() == 0);
+ line->rewrap(columns, buffer[index].ptr(), current_cursor, false);
// If we inserted a line and the old cursor was after that line, increment its row
if (!current_cursor && old_cursor.row >= index)
++old_cursor.row;
- if (buffer[index].length() != columns)
+ if (buffer[index]->length() != columns)
lines_to_reevaluate.enqueue(index);
}
if (next_line && next_line->length() != columns)
@@ -1550,7 +1550,7 @@ void Terminal::set_size(u16 columns, u16 rows)
}
for (auto& line : buffer)
- line.set_length(columns);
+ line->set_length(columns);
return old_cursor;
};
@@ -1563,8 +1563,8 @@ void Terminal::set_size(u16 columns, u16 rows)
while (extra_lines > 0) {
if (m_history.size() <= cursor_tracker.row)
break;
- if (m_history.last().is_empty()) {
- if (m_history.size() >= 2 && m_history[m_history.size() - 2].termination_column().has_value())
+ if (m_history.last()->is_empty()) {
+ if (m_history.size() >= 2 && m_history[m_history.size() - 2]->termination_column().has_value())
break;
--extra_lines;
(void)m_history.take_last();
@@ -1635,7 +1635,7 @@ void Terminal::set_size(u16 columns, u16 rows)
void Terminal::invalidate_cursor()
{
if (cursor_row() < active_buffer().size())
- active_buffer()[cursor_row()].set_dirty(true);
+ active_buffer()[cursor_row()]->set_dirty(true);
}
Attribute Terminal::attribute_at(Position const& position) const
diff --git a/Userland/Libraries/LibVT/Terminal.h b/Userland/Libraries/LibVT/Terminal.h
index d9ef5a3d57..41bd41a0dc 100644
--- a/Userland/Libraries/LibVT/Terminal.h
+++ b/Userland/Libraries/LibVT/Terminal.h
@@ -120,11 +120,11 @@ public:
Line& line(size_t index)
{
if (m_use_alternate_screen_buffer) {
- return m_alternate_screen_buffer[index];
+ return *m_alternate_screen_buffer[index];
} else {
if (index < m_history.size())
- return m_history[(m_history_start + index) % m_history.size()];
- return m_normal_screen_buffer[index - m_history.size()];
+ return *m_history[(m_history_start + index) % m_history.size()];
+ return *m_normal_screen_buffer[index - m_history.size()];
}
}
Line const& line(size_t index) const
@@ -134,12 +134,12 @@ public:
Line& visible_line(size_t index)
{
- return active_buffer()[index];
+ return *active_buffer()[index];
}
Line const& visible_line(size_t index) const
{
- return active_buffer()[index];
+ return *active_buffer()[index];
}
size_t max_history_size() const { return m_max_history_lines; }
@@ -155,7 +155,7 @@ public:
}
if (m_max_history_lines > value) {
- NonnullOwnPtrVector<Line> new_history;
+ Vector<NonnullOwnPtr<Line>> new_history;
new_history.ensure_capacity(value);
auto existing_line_count = min(m_history.size(), value);
for (size_t i = m_history.size() - existing_line_count; i < m_history.size(); ++i) {
@@ -381,7 +381,7 @@ protected:
EscapeSequenceParser m_parser;
#ifndef KERNEL
size_t m_history_start = 0;
- NonnullOwnPtrVector<Line> m_history;
+ Vector<NonnullOwnPtr<Line>> m_history;
void add_line_to_history(NonnullOwnPtr<Line>&& line)
{
if (max_history_size() == 0)
@@ -397,14 +397,14 @@ protected:
return;
}
- m_history.ptr_at(m_history_start) = move(line);
+ m_history[m_history_start] = move(line);
m_history_start = (m_history_start + 1) % m_history.size();
}
- NonnullOwnPtrVector<Line>& active_buffer() { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
- NonnullOwnPtrVector<Line> const& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
- NonnullOwnPtrVector<Line> m_normal_screen_buffer;
- NonnullOwnPtrVector<Line> m_alternate_screen_buffer;
+ Vector<NonnullOwnPtr<Line>>& active_buffer() { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
+ Vector<NonnullOwnPtr<Line>> const& active_buffer() const { return m_use_alternate_screen_buffer ? m_alternate_screen_buffer : m_normal_screen_buffer; };
+ Vector<NonnullOwnPtr<Line>> m_normal_screen_buffer;
+ Vector<NonnullOwnPtr<Line>> m_alternate_screen_buffer;
#endif
bool m_use_alternate_screen_buffer { false };
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp
index 1ddd7bcdb9..801141793a 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp
+++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp
@@ -257,7 +257,7 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_not(NonnullOwnPtr<MediaCondit
return adopt_own(*result);
}
-NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(NonnullOwnPtrVector<MediaCondition>&& conditions)
+NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(Vector<NonnullOwnPtr<MediaCondition>>&& conditions)
{
auto result = new MediaCondition;
result->type = Type::And;
@@ -266,7 +266,7 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_and_list(NonnullOwnPtrVector<
return adopt_own(*result);
}
-NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(NonnullOwnPtrVector<MediaCondition>&& conditions)
+NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(Vector<NonnullOwnPtr<MediaCondition>>&& conditions)
{
auto result = new MediaCondition;
result->type = Type::Or;
@@ -285,7 +285,7 @@ ErrorOr<String> MediaCondition::to_string() const
break;
case Type::Not:
builder.append("not "sv);
- builder.append(TRY(conditions.first().to_string()));
+ builder.append(TRY(conditions.first()->to_string()));
break;
case Type::And:
builder.join(" and "sv, conditions);
@@ -307,11 +307,11 @@ MatchResult MediaCondition::evaluate(HTML::Window const& window) const
case Type::Single:
return as_match_result(feature->evaluate(window));
case Type::Not:
- return negate(conditions.first().evaluate(window));
+ return negate(conditions.first()->evaluate(window));
case Type::And:
- return evaluate_and(conditions, [&](auto& child) { return child.evaluate(window); });
+ return evaluate_and(conditions, [&](auto& child) { return child->evaluate(window); });
case Type::Or:
- return evaluate_or(conditions, [&](auto& child) { return child.evaluate(window); });
+ return evaluate_or(conditions, [&](auto& child) { return child->evaluate(window); });
case Type::GeneralEnclosed:
return general_enclosed->evaluate();
}
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.h b/Userland/Libraries/LibWeb/CSS/MediaQuery.h
index 88115a1547..9bc0dc85d9 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQuery.h
+++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.h
@@ -197,8 +197,8 @@ struct MediaCondition {
static NonnullOwnPtr<MediaCondition> from_general_enclosed(GeneralEnclosed&&);
static NonnullOwnPtr<MediaCondition> from_feature(MediaFeature&&);
static NonnullOwnPtr<MediaCondition> from_not(NonnullOwnPtr<MediaCondition>&&);
- static NonnullOwnPtr<MediaCondition> from_and_list(NonnullOwnPtrVector<MediaCondition>&&);
- static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
+ static NonnullOwnPtr<MediaCondition> from_and_list(Vector<NonnullOwnPtr<MediaCondition>>&&);
+ static NonnullOwnPtr<MediaCondition> from_or_list(Vector<NonnullOwnPtr<MediaCondition>>&&);
MatchResult evaluate(HTML::Window const&) const;
ErrorOr<String> to_string() const;
@@ -207,7 +207,7 @@ private:
MediaCondition() = default;
Type type;
Optional<MediaFeature> feature;
- NonnullOwnPtrVector<MediaCondition> conditions;
+ Vector<NonnullOwnPtr<MediaCondition>> conditions;
Optional<GeneralEnclosed> general_enclosed;
};
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index a220855cb9..1021994fe0 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -834,7 +834,7 @@ OwnPtr<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
return maybe_media_in_parens.release_nonnull();
}
- NonnullOwnPtrVector<MediaCondition> child_conditions;
+ Vector<NonnullOwnPtr<MediaCondition>> child_conditions;
child_conditions.append(maybe_media_in_parens.release_nonnull());
// `<media-and>*`
@@ -7091,7 +7091,7 @@ OwnPtr<CalculatedStyleValue::CalcNumberProduct> Parser::parse_calc_number_produc
{
auto calc_number_product = make<CalculatedStyleValue::CalcNumberProduct>(
CalculatedStyleValue::CalcNumberValue { Number {} },
- NonnullOwnPtrVector<CalculatedStyleValue::CalcNumberProductPartWithOperator> {});
+ Vector<NonnullOwnPtr<CalculatedStyleValue::CalcNumberProductPartWithOperator>> {});
auto first_calc_number_value_or_error = parse_calc_number_value(tokens);
if (!first_calc_number_value_or_error.has_value())
@@ -7139,7 +7139,7 @@ OwnPtr<CalculatedStyleValue::CalcNumberSum> Parser::parse_calc_number_sum(TokenS
if (!first_calc_number_product_or_error)
return nullptr;
- NonnullOwnPtrVector<CalculatedStyleValue::CalcNumberSumPartWithOperator> additional {};
+ Vector<NonnullOwnPtr<CalculatedStyleValue::CalcNumberSumPartWithOperator>> additional {};
while (tokens.has_next_token()) {
auto calc_sum_part = parse_calc_number_sum_part_with_operator(tokens);
if (!calc_sum_part)
@@ -7175,7 +7175,7 @@ OwnPtr<CalculatedStyleValue::CalcProduct> Parser::parse_calc_product(TokenStream
{
auto calc_product = make<CalculatedStyleValue::CalcProduct>(
CalculatedStyleValue::CalcValue { Number {} },
- NonnullOwnPtrVector<CalculatedStyleValue::CalcProductPartWithOperator> {});
+ Vector<NonnullOwnPtr<CalculatedStyleValue::CalcProductPartWithOperator>> {});
auto first_calc_value_or_error = parse_calc_value(tokens);
if (!first_calc_value_or_error.has_value())
@@ -7225,7 +7225,7 @@ OwnPtr<CalculatedStyleValue::CalcSum> Parser::parse_calc_sum(TokenStream<Compone
if (!parsed_calc_product)
return nullptr;
- NonnullOwnPtrVector<CalculatedStyleValue::CalcSumPartWithOperator> additional {};
+ Vector<NonnullOwnPtr<CalculatedStyleValue::CalcSumPartWithOperator>> additional {};
while (tokens.has_next_token()) {
auto calc_sum_part = parse_calc_sum_part_with_operator(tokens);
if (!calc_sum_part)
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index 31fc57a78f..661659f3d7 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -602,7 +602,7 @@ ErrorOr<String> CalculatedStyleValue::CalcSum::to_string() const
StringBuilder builder;
TRY(builder.try_append(TRY(first_calc_product->to_string())));
for (auto const& item : zero_or_more_additional_calc_products)
- TRY(builder.try_append(TRY(item.to_string())));
+ TRY(builder.try_append(TRY(item->to_string())));
return builder.to_string();
}
@@ -611,7 +611,7 @@ ErrorOr<String> CalculatedStyleValue::CalcNumberSum::to_string() const
StringBuilder builder;
TRY(builder.try_append(TRY(first_calc_number_product->to_string())));
for (auto const& item : zero_or_more_additional_calc_number_products)
- TRY(builder.try_append(TRY(item.to_string())));
+ TRY(builder.try_append(TRY(item->to_string())));
return builder.to_string();
}
@@ -620,7 +620,7 @@ ErrorOr<String> CalculatedStyleValue::CalcProduct::to_string() const
StringBuilder builder;
TRY(builder.try_append(TRY(first_calc_value.to_string())));
for (auto const& item : zero_or_more_additional_calc_values)
- TRY(builder.try_append(TRY(item.to_string())));
+ TRY(builder.try_append(TRY(item->to_string())));
return builder.to_string();
}
@@ -642,7 +642,7 @@ ErrorOr<String> CalculatedStyleValue::CalcNumberProduct::to_string() const
StringBuilder builder;
TRY(builder.try_append(TRY(first_calc_number_value.to_string())));
for (auto const& item : zero_or_more_additional_calc_number_values)
- TRY(builder.try_append(TRY(item.to_string())));
+ TRY(builder.try_append(TRY(item->to_string())));
return builder.to_string();
}
@@ -790,12 +790,12 @@ static bool is_dimension(CalculatedStyleValue::ResolvedType type)
}
template<typename SumWithOperator>
-static Optional<CalculatedStyleValue::ResolvedType> resolve_sum_type(CalculatedStyleValue::ResolvedType first_type, NonnullOwnPtrVector<SumWithOperator> const& zero_or_more_additional_products)
+static Optional<CalculatedStyleValue::ResolvedType> resolve_sum_type(CalculatedStyleValue::ResolvedType first_type, Vector<NonnullOwnPtr<SumWithOperator>> const& zero_or_more_additional_products)
{
auto type = first_type;
for (auto const& product : zero_or_more_additional_products) {
- auto maybe_product_type = product.resolved_type();
+ auto maybe_product_type = product->resolved_type();
if (!maybe_product_type.has_value())
return {};
auto product_type = maybe_product_type.value();
@@ -869,17 +869,17 @@ Optional<CalculatedStyleValue::ResolvedType> CalculatedStyleValue::CalcNumberSum
}
template<typename ProductWithOperator>
-static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(CalculatedStyleValue::ResolvedType first_type, NonnullOwnPtrVector<ProductWithOperator> const& zero_or_more_additional_values)
+static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(CalculatedStyleValue::ResolvedType first_type, Vector<NonnullOwnPtr<ProductWithOperator>> const& zero_or_more_additional_values)
{
auto type = first_type;
for (auto const& value : zero_or_more_additional_values) {
- auto maybe_value_type = value.resolved_type();
+ auto maybe_value_type = value->resolved_type();
if (!maybe_value_type.has_value())
return {};
auto value_type = maybe_value_type.value();
- if (value.op == CalculatedStyleValue::ProductOperation::Multiply) {
+ if (value->op == CalculatedStyleValue::ProductOperation::Multiply) {
// At *, check that at least one side is <number>.
if (!(is_number(type) || is_number(value_type)))
return {};
@@ -894,7 +894,7 @@ static Optional<CalculatedStyleValue::ResolvedType> resolve_product_type(Calcula
continue;
} else {
- VERIFY(value.op == CalculatedStyleValue::ProductOperation::Divide);
+ VERIFY(value->op == CalculatedStyleValue::ProductOperation::Divide);
// At /, check that the right side is <number>.
if (!is_number(value_type))
return {};
@@ -1005,11 +1005,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcSum::resolve(L
auto value = first_calc_product->resolve(layout_node, percentage_basis);
for (auto& additional_product : zero_or_more_additional_calc_products) {
- auto additional_value = additional_product.resolve(layout_node, percentage_basis);
+ auto additional_value = additional_product->resolve(layout_node, percentage_basis);
- if (additional_product.op == CalculatedStyleValue::SumOperation::Add)
+ if (additional_product->op == CalculatedStyleValue::SumOperation::Add)
value.add(additional_value, layout_node, percentage_basis);
- else if (additional_product.op == CalculatedStyleValue::SumOperation::Subtract)
+ else if (additional_product->op == CalculatedStyleValue::SumOperation::Subtract)
value.subtract(additional_value, layout_node, percentage_basis);
else
VERIFY_NOT_REACHED();
@@ -1023,11 +1023,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSum::res
auto value = first_calc_number_product->resolve(layout_node, percentage_basis);
for (auto& additional_product : zero_or_more_additional_calc_number_products) {
- auto additional_value = additional_product.resolve(layout_node, percentage_basis);
+ auto additional_value = additional_product->resolve(layout_node, percentage_basis);
- if (additional_product.op == CSS::CalculatedStyleValue::SumOperation::Add)
+ if (additional_product->op == CSS::CalculatedStyleValue::SumOperation::Add)
value.add(additional_value, layout_node, percentage_basis);
- else if (additional_product.op == CalculatedStyleValue::SumOperation::Subtract)
+ else if (additional_product->op == CalculatedStyleValue::SumOperation::Subtract)
value.subtract(additional_value, layout_node, percentage_basis);
else
VERIFY_NOT_REACHED();
@@ -1041,14 +1041,14 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcProduct::resol
auto value = first_calc_value.resolve(layout_node, percentage_basis);
for (auto& additional_value : zero_or_more_additional_calc_values) {
- additional_value.value.visit(
+ additional_value->value.visit(
[&](CalculatedStyleValue::CalcValue const& calc_value) {
- VERIFY(additional_value.op == CalculatedStyleValue::ProductOperation::Multiply);
+ VERIFY(additional_value->op == CalculatedStyleValue::ProductOperation::Multiply);
auto resolved_value = calc_value.resolve(layout_node, percentage_basis);
value.multiply_by(resolved_value, layout_node);
},
[&](CalculatedStyleValue::CalcNumberValue const& calc_number_value) {
- VERIFY(additional_value.op == CalculatedStyleValue::ProductOperation::Divide);
+ VERIFY(additional_value->op == CalculatedStyleValue::ProductOperation::Divide);
auto resolved_calc_number_value = calc_number_value.resolve(layout_node, percentage_basis);
// FIXME: Checking for division by 0 should happen during parsing.
VERIFY(resolved_calc_number_value.value().get<Number>().value() != 0.0f);
@@ -1064,11 +1064,11 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberProduct:
auto value = first_calc_number_value.resolve(layout_node, percentage_basis);
for (auto& additional_number_value : zero_or_more_additional_calc_number_values) {
- auto additional_value = additional_number_value.resolve(layout_node, percentage_basis);
+ auto additional_value = additional_number_value->resolve(layout_node, percentage_basis);
- if (additional_number_value.op == CalculatedStyleValue::ProductOperation::Multiply)
+ if (additional_number_value->op == CalculatedStyleValue::ProductOperation::Multiply)
value.multiply_by(additional_value, layout_node);
- else if (additional_number_value.op == CalculatedStyleValue::ProductOperation::Divide)
+ else if (additional_number_value->op == CalculatedStyleValue::ProductOperation::Divide)
value.divide_by(additional_value, layout_node);
else
VERIFY_NOT_REACHED();
@@ -2290,7 +2290,7 @@ bool CalculatedStyleValue::CalcSum::contains_percentage() const
if (first_calc_product->contains_percentage())
return true;
for (auto& part : zero_or_more_additional_calc_products) {
- if (part.contains_percentage())
+ if (part->contains_percentage())
return true;
}
return false;
@@ -2306,7 +2306,7 @@ bool CalculatedStyleValue::CalcProduct::contains_percentage() const
if (first_calc_value.contains_percentage())
return true;
for (auto& part : zero_or_more_additional_calc_values) {
- if (part.contains_percentage())
+ if (part->contains_percentage())
return true;
}
return false;
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index 80980eae39..78e14fafcd 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -821,12 +821,12 @@ public:
// This represents that: https://www.w3.org/TR/css-values-3/#calc-syntax
struct CalcSum {
- CalcSum(NonnullOwnPtr<CalcProduct> first_calc_product, NonnullOwnPtrVector<CalcSumPartWithOperator> additional)
+ CalcSum(NonnullOwnPtr<CalcProduct> first_calc_product, Vector<NonnullOwnPtr<CalcSumPartWithOperator>> additional)
: first_calc_product(move(first_calc_product))
, zero_or_more_additional_calc_products(move(additional)) {};
NonnullOwnPtr<CalcProduct> first_calc_product;
- NonnullOwnPtrVector<CalcSumPartWithOperator> zero_or_more_additional_calc_products;
+ Vector<NonnullOwnPtr<CalcSumPartWithOperator>> zero_or_more_additional_calc_products;
ErrorOr<String> to_string() const;
Optional<ResolvedType> resolved_type() const;
@@ -836,12 +836,12 @@ public:
};
struct CalcNumberSum {
- CalcNumberSum(NonnullOwnPtr<CalcNumberProduct> first_calc_number_product, NonnullOwnPtrVector<CalcNumberSumPartWithOperator> additional)
+ CalcNumberSum(NonnullOwnPtr<CalcNumberProduct> first_calc_number_product, Vector<NonnullOwnPtr<CalcNumberSumPartWithOperator>> additional)
: first_calc_number_product(move(first_calc_number_product))
, zero_or_more_additional_calc_number_products(move(additional)) {};
NonnullOwnPtr<CalcNumberProduct> first_calc_number_product;
- NonnullOwnPtrVector<CalcNumberSumPartWithOperator> zero_or_more_additional_calc_number_products;
+ Vector<NonnullOwnPtr<CalcNumberSumPartWithOperator>> zero_or_more_additional_calc_number_products;
ErrorOr<String> to_string() const;
Optional<ResolvedType> resolved_type() const;
@@ -850,7 +850,7 @@ public:
struct CalcProduct {
CalcValue first_calc_value;
- NonnullOwnPtrVector<CalcProductPartWithOperator> zero_or_more_additional_calc_values;
+ Vector<NonnullOwnPtr<CalcProductPartWithOperator>> zero_or_more_additional_calc_values;
ErrorOr<String> to_string() const;
Optional<ResolvedType> resolved_type() const;
@@ -885,7 +885,7 @@ public:
struct CalcNumberProduct {
CalcNumberValue first_calc_number_value;
- NonnullOwnPtrVector<CalcNumberProductPartWithOperator> zero_or_more_additional_calc_number_values;
+ Vector<NonnullOwnPtr<CalcNumberProductPartWithOperator>> zero_or_more_additional_calc_number_values;
ErrorOr<String> to_string() const;
Optional<ResolvedType> resolved_type() const;
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
index f6a05660e6..e14ba08b84 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyInstanceObject.h
@@ -24,7 +24,7 @@ public:
virtual ~WebAssemblyInstanceObject() override = default;
size_t index() const { return m_index; }
- Wasm::ModuleInstance& instance() const { return WebAssemblyObject::s_instantiated_modules.at(m_index); }
+ Wasm::ModuleInstance& instance() const { return *WebAssemblyObject::s_instantiated_modules[m_index]; }
auto& cache() { return WebAssemblyObject::s_module_caches.at(m_index); }
void visit_edges(Visitor&) override;
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
index 77ed857184..5ed6c3c130 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.h
@@ -22,7 +22,7 @@ public:
virtual ~WebAssemblyModuleObject() override = default;
size_t index() const { return m_index; }
- Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index).module; }
+ Wasm::Module const& module() const { return WebAssemblyObject::s_compiled_modules.at(m_index)->module; }
private:
size_t m_index { 0 };
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index 7a28c17d15..e2800c8624 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -58,8 +58,8 @@ JS::ThrowCompletionOr<void> WebAssemblyObject::initialize(JS::Realm& realm)
return {};
}
-NonnullOwnPtrVector<WebAssemblyObject::CompiledWebAssemblyModule> WebAssemblyObject::s_compiled_modules;
-NonnullOwnPtrVector<Wasm::ModuleInstance> WebAssemblyObject::s_instantiated_modules;
+Vector<NonnullOwnPtr<WebAssemblyObject::CompiledWebAssemblyModule>> WebAssemblyObject::s_compiled_modules;
+Vector<NonnullOwnPtr<Wasm::ModuleInstance>> WebAssemblyObject::s_instantiated_modules;
Vector<WebAssemblyObject::ModuleCache> WebAssemblyObject::s_module_caches;
WebAssemblyObject::GlobalModuleCache WebAssemblyObject::s_global_cache;
Wasm::AbstractMachine WebAssemblyObject::s_abstract_machine;
@@ -101,7 +101,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::validate)
};
// 3 continued - our "compile" step is lazy with validation, explicitly do the validation.
- if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()].module).is_error())
+ if (s_abstract_machine.validate(s_compiled_modules[maybe_module.value()]->module).is_error())
return JS::Value(false);
// 4. Return true.
@@ -331,7 +331,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyObject::instantiate)
promise->reject(*result.release_error().value());
return promise;
}
- module = &WebAssemblyObject::s_compiled_modules.at(result.release_value()).module;
+ module = &WebAssemblyObject::s_compiled_modules.at(result.release_value())->module;
should_return_module = true;
} else if (is<WebAssemblyModuleObject>(buffer)) {
module = &static_cast<WebAssemblyModuleObject*>(buffer)->module();
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
index c3c2f23a32..9171ff46ac 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.h
@@ -54,8 +54,8 @@ public:
HashMap<Wasm::FunctionAddress, JS::NativeFunction*> function_instances;
};
- static NonnullOwnPtrVector<CompiledWebAssemblyModule> s_compiled_modules;
- static NonnullOwnPtrVector<Wasm::ModuleInstance> s_instantiated_modules;
+ static Vector<NonnullOwnPtr<CompiledWebAssemblyModule>> s_compiled_modules;
+ static Vector<NonnullOwnPtr<Wasm::ModuleInstance>> s_instantiated_modules;
static Vector<ModuleCache> s_module_caches;
static GlobalModuleCache s_global_cache;
diff --git a/Userland/Libraries/LibXML/DOM/Node.cpp b/Userland/Libraries/LibXML/DOM/Node.cpp
index df7ec1d297..0afb1287f0 100644
--- a/Userland/Libraries/LibXML/DOM/Node.cpp
+++ b/Userland/Libraries/LibXML/DOM/Node.cpp
@@ -44,7 +44,7 @@ bool Node::operator==(Node const& other) const
if (element.children.size() != other_element->children.size())
return false;
for (size_t i = 0; i < element.children.size(); ++i) {
- if (element.children[i] != other_element->children[i])
+ if (element.children[i].ptr() != other_element->children[i].ptr())
return false;
}
return true;
diff --git a/Userland/Libraries/LibXML/DOM/Node.h b/Userland/Libraries/LibXML/DOM/Node.h
index e1d153287a..48a3a6edb3 100644
--- a/Userland/Libraries/LibXML/DOM/Node.h
+++ b/Userland/Libraries/LibXML/DOM/Node.h
@@ -30,7 +30,7 @@ struct Node {
struct Element {
Name name;
HashMap<Name, DeprecatedString> attributes;
- NonnullOwnPtrVector<Node> children;
+ Vector<NonnullOwnPtr<Node>> children;
};
bool operator==(Node const&) const;
diff --git a/Userland/Libraries/LibXML/Parser/Parser.cpp b/Userland/Libraries/LibXML/Parser/Parser.cpp
index 334b82a61e..4953ef2e67 100644
--- a/Userland/Libraries/LibXML/Parser/Parser.cpp
+++ b/Userland/Libraries/LibXML/Parser/Parser.cpp
@@ -95,7 +95,7 @@ void Parser::append_text(StringView text)
m_entered_node->content.visit(
[&](Node::Element& node) {
if (!node.children.is_empty()) {
- auto* text_node = node.children.last().content.get_pointer<Node::Text>();
+ auto* text_node = node.children.last()->content.get_pointer<Node::Text>();
if (text_node) {
text_node->builder.append(text);
return;
diff --git a/Userland/Services/ChessEngine/MCTSTree.cpp b/Userland/Services/ChessEngine/MCTSTree.cpp
index bd3dfc985f..a23879fe5a 100644
--- a/Userland/Services/ChessEngine/MCTSTree.cpp
+++ b/Userland/Services/ChessEngine/MCTSTree.cpp
@@ -37,10 +37,10 @@ MCTSTree& MCTSTree::select_leaf()
MCTSTree* node = nullptr;
double max_uct = -double(INFINITY);
for (auto& child : m_children) {
- double uct = child.uct(m_turn);
+ double uct = child->uct(m_turn);
if (uct >= max_uct) {
max_uct = uct;
- node = &child;
+ node = child;
}
}
VERIFY(node);
@@ -68,8 +68,8 @@ MCTSTree& MCTSTree::expand()
}
for (auto& child : m_children) {
- if (child.m_simulations == 0) {
- return child;
+ if (child->m_simulations == 0) {
+ return *child;
}
}
VERIFY_NOT_REACHED();
@@ -133,8 +133,8 @@ void MCTSTree::do_round()
Optional<MCTSTree&> MCTSTree::child_with_move(Chess::Move chess_move)
{
for (auto& node : m_children) {
- if (node.last_move() == chess_move)
- return node;
+ if (node->last_move() == chess_move)
+ return *node;
}
return {};
}
@@ -147,9 +147,9 @@ MCTSTree& MCTSTree::best_node()
double best_score = -double(INFINITY);
VERIFY(m_children.size());
for (auto& node : m_children) {
- double node_score = node.expected_value() * score_multiplier;
+ double node_score = node->expected_value() * score_multiplier;
if (node_score >= best_score) {
- best_node_ptr = &node;
+ best_node_ptr = node;
best_score = node_score;
}
}
@@ -187,7 +187,7 @@ bool MCTSTree::expanded() const
return false;
for (auto& child : m_children) {
- if (child.m_simulations == 0)
+ if (child->m_simulations == 0)
return false;
}
diff --git a/Userland/Services/ChessEngine/MCTSTree.h b/Userland/Services/ChessEngine/MCTSTree.h
index 2bf48d6abc..378b70d791 100644
--- a/Userland/Services/ChessEngine/MCTSTree.h
+++ b/Userland/Services/ChessEngine/MCTSTree.h
@@ -46,7 +46,7 @@ private:
// FIXME: Optimize simulations enough for use.
static constexpr EvalMethod s_eval_method { EvalMethod::Heuristic };
- NonnullOwnPtrVector<MCTSTree> m_children;
+ Vector<NonnullOwnPtr<MCTSTree>> m_children;
MCTSTree* m_parent { nullptr };
int m_white_points { 0 };
int m_simulations { 0 };
diff --git a/Userland/Services/RequestServer/ConnectionCache.cpp b/Userland/Services/RequestServer/ConnectionCache.cpp
index 4635cfc08c..1e70788015 100644
--- a/Userland/Services/RequestServer/ConnectionCache.cpp
+++ b/Userland/Services/RequestServer/ConnectionCache.cpp
@@ -11,8 +11,8 @@
namespace RequestServer::ConnectionCache {
-HashMap<ConnectionKey, NonnullOwnPtr<NonnullOwnPtrVector<Connection<Core::TCPSocket, Core::Socket>>>> g_tcp_connection_cache {};
-HashMap<ConnectionKey, NonnullOwnPtr<NonnullOwnPtrVector<Connection<TLS::TLSv12>>>> g_tls_connection_cache {};
+HashMap<ConnectionKey, NonnullOwnPtr<Vector<NonnullOwnPtr<Connection<Core::TCPSocket, Core::Socket>>>>> g_tcp_connection_cache {};
+HashMap<ConnectionKey, NonnullOwnPtr<Vector<NonnullOwnPtr<Connection<TLS::TLSv12>>>>> g_tls_connection_cache {};
void request_did_finish(URL const& url, Core::Socket const* socket)
{
@@ -85,10 +85,10 @@ void dump_jobs()
for (auto& connection : g_tls_connection_cache) {
dbgln(" - {}:{}", connection.key.hostname, connection.key.port);
for (auto& entry : *connection.value) {
- dbgln(" - Connection {} (started={}) (socket={})", &entry, entry.has_started, entry.socket);
- dbgln(" Currently loading {} ({} elapsed)", entry.current_url, entry.timer.is_valid() ? entry.timer.elapsed() : 0);
+ dbgln(" - Connection {} (started={}) (socket={})", &entry, entry->has_started, entry->socket);
+ dbgln(" Currently loading {} ({} elapsed)", entry->current_url, entry->timer.is_valid() ? entry->timer.elapsed() : 0);
dbgln(" Request Queue:");
- for (auto& job : entry.request_queue)
+ for (auto& job : entry->request_queue)
dbgln(" - {}", &job);
}
}
@@ -96,10 +96,10 @@ void dump_jobs()
for (auto& connection : g_tcp_connection_cache) {
dbgln(" - {}:{}", connection.key.hostname, connection.key.port);
for (auto& entry : *connection.value) {
- dbgln(" - Connection {} (started={}) (socket={})", &entry, entry.has_started, entry.socket);
- dbgln(" Currently loading {} ({} elapsed)", entry.current_url, entry.timer.is_valid() ? entry.timer.elapsed() : 0);
+ dbgln(" - Connection {} (started={}) (socket={})", &entry, entry->has_started, entry->socket);
+ dbgln(" Currently loading {} ({} elapsed)", entry->current_url, entry->timer.is_valid() ? entry->timer.elapsed() : 0);
dbgln(" Request Queue:");
- for (auto& job : entry.request_queue)
+ for (auto& job : entry->request_queue)
dbgln(" - {}", &job);
}
}
diff --git a/Userland/Services/RequestServer/ConnectionCache.h b/Userland/Services/RequestServer/ConnectionCache.h
index b7c8dd5c8a..8a9c27cfdb 100644
--- a/Userland/Services/RequestServer/ConnectionCache.h
+++ b/Userland/Services/RequestServer/ConnectionCache.h
@@ -121,8 +121,8 @@ struct AK::Traits<RequestServer::ConnectionCache::ConnectionKey> : public AK::Ge
namespace RequestServer::ConnectionCache {
-extern HashMap<ConnectionKey, NonnullOwnPtr<NonnullOwnPtrVector<Connection<Core::TCPSocket, Core::Socket>>>> g_tcp_connection_cache;
-extern HashMap<ConnectionKey, NonnullOwnPtr<NonnullOwnPtrVector<Connection<TLS::TLSv12>>>> g_tls_connection_cache;
+extern HashMap<ConnectionKey, NonnullOwnPtr<Vector<NonnullOwnPtr<Connection<Core::TCPSocket, Core::Socket>>>>> g_tcp_connection_cache;
+extern HashMap<ConnectionKey, NonnullOwnPtr<Vector<NonnullOwnPtr<Connection<TLS::TLSv12>>>>> g_tls_connection_cache;
void request_did_finish(URL const&, Core::Socket const*);
void dump_jobs();
@@ -178,12 +178,12 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job,
Proxy proxy { proxy_data };
- using ReturnType = decltype(&sockets_for_url[0]);
+ using ReturnType = decltype(sockets_for_url[0].ptr());
auto it = sockets_for_url.find_if([](auto& connection) { return connection->request_queue.is_empty(); });
auto did_add_new_connection = false;
auto failed_to_find_a_socket = it.is_end();
if (failed_to_find_a_socket && sockets_for_url.size() < ConnectionCache::MaxConcurrentConnectionsPerURL) {
- using ConnectionType = RemoveCVReference<decltype(cache.begin()->value->at(0))>;
+ using ConnectionType = RemoveCVReference<decltype(*cache.begin()->value->at(0))>;
auto connection_result = proxy.tunnel<typename ConnectionType::SocketType, typename ConnectionType::StorageType>(url);
if (connection_result.is_error()) {
dbgln("ConnectionCache: Connection to {} failed: {}", url, connection_result.error());
@@ -204,7 +204,7 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job,
socket_result.release_value(),
typename ConnectionType::QueueType {},
Core::Timer::create_single_shot(ConnectionKeepAliveTimeMilliseconds, nullptr).release_value_but_fixme_should_propagate_errors()));
- sockets_for_url.last().proxy = move(proxy);
+ sockets_for_url.last()->proxy = move(proxy);
did_add_new_connection = true;
}
size_t index;
@@ -216,7 +216,7 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job,
index = 0;
auto min_queue_size = (size_t)-1;
for (auto it = sockets_for_url.begin(); it != sockets_for_url.end(); ++it) {
- if (auto queue_size = it->request_queue.size(); min_queue_size > queue_size) {
+ if (auto queue_size = (*it)->request_queue.size(); min_queue_size > queue_size) {
index = it.index();
min_queue_size = queue_size;
}
@@ -232,7 +232,7 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job,
return ReturnType { nullptr };
}
- auto& connection = sockets_for_url[index];
+ auto& connection = *sockets_for_url[index];
if (!connection.has_started) {
if (auto result = recreate_socket_if_needed(connection, url); result.is_error()) {
dbgln("ConnectionCache: request failed to start, failed to make a socket: {}", result.error());
diff --git a/Userland/Services/WebDriver/Client.cpp b/Userland/Services/WebDriver/Client.cpp
index ba352bb2c1..2bd4c15bb3 100644
--- a/Userland/Services/WebDriver/Client.cpp
+++ b/Userland/Services/WebDriver/Client.cpp
@@ -18,7 +18,7 @@
namespace WebDriver {
Atomic<unsigned> Client::s_next_session_id;
-NonnullOwnPtrVector<Session> Client::s_sessions;
+Vector<NonnullOwnPtr<Session>> Client::s_sessions;
ErrorOr<NonnullRefPtr<Client>> Client::try_create(NonnullOwnPtr<Core::BufferedTCPSocket> socket, LaunchBrowserCallbacks callbacks, Core::Object* parent)
{
@@ -44,8 +44,8 @@ ErrorOr<Session*, Web::WebDriver::Error> Client::find_session_with_id(StringView
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSessionId, "Invalid session id");
for (auto& session : Client::s_sessions) {
- if (session.session_id() == session_id_or_error.value())
- return &session;
+ if (session->session_id() == session_id_or_error.value())
+ return session;
}
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSessionId, "Invalid session id");
}
@@ -57,7 +57,7 @@ ErrorOr<NonnullOwnPtr<Session>, Web::WebDriver::Error> Client::take_session_with
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::InvalidSessionId, "Invalid session id");
for (size_t i = 0; i < Client::s_sessions.size(); ++i) {
- if (Client::s_sessions[i].session_id() == session_id_or_error.value()) {
+ if (Client::s_sessions[i]->session_id() == session_id_or_error.value()) {
return Client::s_sessions.take(i);
}
}
diff --git a/Userland/Services/WebDriver/Client.h b/Userland/Services/WebDriver/Client.h
index 81c83770c2..9f1d8288aa 100644
--- a/Userland/Services/WebDriver/Client.h
+++ b/Userland/Services/WebDriver/Client.h
@@ -93,7 +93,7 @@ private:
virtual Web::WebDriver::Response take_element_screenshot(Web::WebDriver::Parameters parameters, JsonValue payload) override;
virtual Web::WebDriver::Response print_page(Web::WebDriver::Parameters parameters, JsonValue payload) override;
- static NonnullOwnPtrVector<Session> s_sessions;
+ static Vector<NonnullOwnPtr<Session>> s_sessions;
static Atomic<unsigned> s_next_session_id;
LaunchBrowserCallbacks m_callbacks;
diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp
index 376009c3f1..3f62e89311 100644
--- a/Userland/Services/WindowServer/Menu.cpp
+++ b/Userland/Services/WindowServer/Menu.cpp
@@ -73,14 +73,14 @@ int Menu::content_width() const
int widest_text = 0;
int widest_shortcut = 0;
for (auto& item : m_items) {
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
- if (item.type() != MenuItem::Text)
+ if (item->type() != MenuItem::Text)
continue;
- auto& use_font = item.is_default() ? font().bold_variant() : font();
- int text_width = use_font.width(Gfx::parse_ampersand_string(item.text()));
- if (!item.shortcut_text().is_empty()) {
- int shortcut_width = use_font.width(item.shortcut_text());
+ auto& use_font = item->is_default() ? font().bold_variant() : font();
+ int text_width = use_font.width(Gfx::parse_ampersand_string(item->text()));
+ if (!item->shortcut_text().is_empty()) {
+ int shortcut_width = use_font.width(item->shortcut_text());
widest_shortcut = max(shortcut_width, widest_shortcut);
}
widest_text = max(widest_text, text_width);
@@ -129,7 +129,7 @@ Window& Menu::ensure_menu_window(Gfx::IntPoint position)
auto calculate_window_rect = [&]() -> Gfx::IntRect {
int window_height_available = screen.height() - frame_thickness() * 2;
int max_window_height = (window_height_available / item_height()) * item_height() + frame_thickness() * 2;
- int content_height = m_items.is_empty() ? 0 : (m_items.last().rect().bottom() + 1) + frame_thickness();
+ int content_height = m_items.is_empty() ? 0 : (m_items.last()->rect().bottom() + 1) + frame_thickness();
int window_height = min(max_window_height, content_height);
if (window_height < content_height) {
m_scrollable = true;
@@ -140,14 +140,14 @@ Window& Menu::ensure_menu_window(Gfx::IntPoint position)
Gfx::IntPoint next_item_location(frame_thickness(), frame_thickness());
for (auto& item : m_items) {
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
int height = 0;
- if (item.type() == MenuItem::Text)
+ if (item->type() == MenuItem::Text)
height = item_height();
- else if (item.type() == MenuItem::Separator)
+ else if (item->type() == MenuItem::Separator)
height = 8;
- item.set_rect({ next_item_location, { width - frame_thickness() * 2, height } });
+ item->set_rect({ next_item_location, { width - frame_thickness() * 2, height } });
next_item_location.translate_by(0, height);
}
@@ -217,7 +217,7 @@ void Menu::draw()
int visible_item_count = this->visible_item_count();
for (int i = 0; i < visible_item_count; ++i)
- draw(m_items.at(m_scroll_offset + i), true);
+ draw(*m_items[m_scroll_offset + i], true);
}
void Menu::draw(MenuItem const& item, bool is_drawing_all)
@@ -407,9 +407,9 @@ void Menu::event(Core::Event& event)
// Default to the last enabled, non-separator item on key press if one has not been selected yet
for (auto i = static_cast<int>(m_items.size()) - 1; i >= 0; i--) {
auto& item = m_items.at(i);
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
- if (item.type() != MenuItem::Separator && item.is_enabled()) {
+ if (item->type() != MenuItem::Separator && item->is_enabled()) {
set_hovered_index(i, key == Key_Right);
break;
}
@@ -418,9 +418,9 @@ void Menu::event(Core::Event& event)
// Default to the first enabled, non-separator item on key press if one has not been selected yet
int counter = 0;
for (auto const& item : m_items) {
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
- if (item.type() != MenuItem::Separator && item.is_enabled()) {
+ if (item->type() != MenuItem::Separator && item->is_enabled()) {
set_hovered_index(counter, key == Key_Right);
break;
}
@@ -562,12 +562,12 @@ void Menu::did_activate(MenuItem& item, bool leave_menu_open)
bool Menu::activate_default()
{
for (auto& item : m_items) {
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
- if (item.type() == MenuItem::Type::Separator)
+ if (item->type() == MenuItem::Type::Separator)
continue;
- if (item.is_enabled() && item.is_default()) {
- did_activate(item, false);
+ if (item->is_enabled() && item->is_default()) {
+ did_activate(*item, false);
return true;
}
}
@@ -577,8 +577,8 @@ bool Menu::activate_default()
MenuItem* Menu::item_with_identifier(unsigned identifier)
{
for (auto& item : m_items) {
- if (item.identifier() == identifier)
- return &item;
+ if (item->identifier() == identifier)
+ return item;
}
return nullptr;
}
@@ -592,9 +592,9 @@ int Menu::item_index_at(Gfx::IntPoint position)
{
for (int i = 0; i < static_cast<int>(m_items.size()); ++i) {
auto const& item = m_items[i];
- if (!item.is_visible())
+ if (!item->is_visible())
continue;
- if (item.rect().contains(position))
+ if (item->rect().contains(position))
return i;
}
return -1;
@@ -684,9 +684,9 @@ void Menu::do_popup(Gfx::IntPoint position, bool make_input, bool as_submenu)
bool Menu::is_menu_ancestor_of(Menu const& other) const
{
for (auto& item : m_items) {
- if (!item.is_submenu())
+ if (!item->is_submenu())
continue;
- auto& submenu = *item.submenu();
+ auto& submenu = *item->submenu();
if (&submenu == &other)
return true;
if (submenu.is_menu_ancestor_of(other))
@@ -711,7 +711,7 @@ void Menu::update_alt_shortcuts_for_items()
m_alt_shortcut_character_to_item_indices.clear();
int i = 0;
for (auto& item : m_items) {
- if (auto alt_shortcut = find_ampersand_shortcut_character(item.text())) {
+ if (auto alt_shortcut = find_ampersand_shortcut_character(item->text())) {
m_alt_shortcut_character_to_item_indices.ensure(to_ascii_lowercase(alt_shortcut)).append(i);
}
++i;
diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h
index 5a2a32c2c5..b15c07624b 100644
--- a/Userland/Services/WindowServer/Menu.h
+++ b/Userland/Services/WindowServer/Menu.h
@@ -40,8 +40,8 @@ public:
bool is_empty() const { return m_items.is_empty(); }
size_t item_count() const { return m_items.size(); }
- MenuItem const& item(size_t index) const { return m_items.at(index); }
- MenuItem& item(size_t index) { return m_items.at(index); }
+ MenuItem const& item(size_t index) const { return *m_items.at(index); }
+ MenuItem& item(size_t index) { return *m_items.at(index); }
MenuItem* item_by_identifier(unsigned identifier)
{
@@ -65,7 +65,7 @@ public:
IterationDecision for_each_item(Callback callback)
{
for (auto& item : m_items) {
- IterationDecision decision = callback(item);
+ IterationDecision decision = callback(*item);
if (decision != IterationDecision::Continue)
return decision;
}
@@ -159,7 +159,7 @@ private:
u32 m_alt_shortcut_character { 0 };
Gfx::IntRect m_rect_in_window_menubar;
Gfx::IntPoint m_unadjusted_position;
- NonnullOwnPtrVector<MenuItem> m_items;
+ Vector<NonnullOwnPtr<MenuItem>> m_items;
RefPtr<Window> m_menu_window;
WeakPtr<Window> m_window_menu_of;
diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp
index 3642f47576..6f5a451eed 100644
--- a/Userland/Services/WindowServer/WindowFrame.cpp
+++ b/Userland/Services/WindowServer/WindowFrame.cpp
@@ -294,7 +294,7 @@ Gfx::WindowTheme::WindowState WindowFrame::window_state_for_theme() const
void WindowFrame::paint_notification_frame(Gfx::Painter& painter)
{
auto palette = WindowManager::the().palette();
- Gfx::WindowTheme::current().paint_notification_frame(painter, to_theme_window_mode(m_window.mode()), m_window.rect(), palette, m_buttons.last().relative_rect());
+ Gfx::WindowTheme::current().paint_notification_frame(painter, to_theme_window_mode(m_window.mode()), m_window.rect(), palette, m_buttons.last()->relative_rect());
}
void WindowFrame::paint_menubar(Gfx::Painter& painter)
@@ -401,7 +401,7 @@ void WindowFrame::render(Screen& screen, Gfx::Painter& painter)
return;
for (auto& button : m_buttons)
- button.paint(screen, painter);
+ button->paint(screen, painter);
}
void WindowFrame::theme_changed()
@@ -585,7 +585,7 @@ Gfx::IntRect WindowFrame::constrained_render_rect_to_screen(Gfx::IntRect const&
Gfx::IntRect WindowFrame::leftmost_titlebar_button_rect() const
{
if (!m_buttons.is_empty())
- return m_buttons.last().relative_rect();
+ return m_buttons.last()->relative_rect();
auto rect = titlebar_rect();
rect.translate_by(rect.width(), 0);
@@ -677,7 +677,7 @@ void WindowFrame::layout_buttons()
{
auto button_rects = Gfx::WindowTheme::current().layout_buttons(to_theme_window_type(m_window.type()), to_theme_window_mode(m_window.mode()), m_window.rect(), WindowManager::the().palette(), m_buttons.size());
for (size_t i = 0; i < m_buttons.size(); i++)
- m_buttons[i].set_relative_rect(button_rects[i]);
+ m_buttons[i]->set_relative_rect(button_rects[i]);
}
Optional<HitTestResult> WindowFrame::hit_test(Gfx::IntPoint position)
@@ -795,8 +795,8 @@ void WindowFrame::handle_titlebar_mouse_event(MouseEvent const& event)
}
for (auto& button : m_buttons) {
- if (button.relative_rect().contains(event.position()))
- return button.on_mouse_event(event.translated(-button.relative_rect().location()));
+ if (button->relative_rect().contains(event.position()))
+ return button->on_mouse_event(event.translated(-button->relative_rect().location()));
}
if (event.type() == Event::MouseDown) {
diff --git a/Userland/Services/WindowServer/WindowFrame.h b/Userland/Services/WindowServer/WindowFrame.h
index 1f5cd91835..f6c42b529d 100644
--- a/Userland/Services/WindowServer/WindowFrame.h
+++ b/Userland/Services/WindowServer/WindowFrame.h
@@ -138,7 +138,7 @@ private:
Gfx::IntRect leftmost_titlebar_button_rect() const;
Window& m_window;
- NonnullOwnPtrVector<Button> m_buttons;
+ Vector<NonnullOwnPtr<Button>> m_buttons;
Button* m_close_button { nullptr };
Button* m_maximize_button { nullptr };
Button* m_minimize_button { nullptr };
diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp
index 97ee24cb86..dee3f2680d 100644
--- a/Userland/Services/WindowServer/WindowManager.cpp
+++ b/Userland/Services/WindowServer/WindowManager.cpp
@@ -44,7 +44,7 @@ WindowManager::WindowManager(Gfx::PaletteImpl& palette)
{
// If we haven't created any window stacks, at least create the stationary/main window stack
- auto row = adopt_own(*new RemoveReference<decltype(m_window_stacks[0])>());
+ auto row = adopt_own(*new RemoveReference<decltype(*m_window_stacks[0])>());
auto main_window_stack = adopt_own(*new WindowStack(0, 0));
main_window_stack->set_stationary_window_stack(*main_window_stack);
m_current_window_stack = main_window_stack.ptr();
@@ -191,9 +191,9 @@ bool WindowManager::apply_workspace_settings(unsigned rows, unsigned columns, bo
// While we have too many rows, merge each row too many into the new bottom row
while (current_rows > rows) {
- auto& row = m_window_stacks[rows];
+ auto& row = *m_window_stacks[rows];
for (size_t column_index = 0; column_index < row.size(); column_index++) {
- merge_window_stack(row[column_index], m_window_stacks[rows - 1][column_index]);
+ merge_window_stack(*row[column_index], *(*m_window_stacks[rows - 1])[column_index]);
if (rows - 1 == current_stack_row && column_index == current_stack_column)
need_rerender = true;
}
@@ -203,8 +203,8 @@ bool WindowManager::apply_workspace_settings(unsigned rows, unsigned columns, bo
// While we have too many columns, merge each column too many into the new right most column
while (current_columns > columns) {
for (size_t row_index = 0; row_index < current_rows; row_index++) {
- auto& row = m_window_stacks[row_index];
- merge_window_stack(row[columns], row[columns - 1]);
+ auto& row = *m_window_stacks[row_index];
+ merge_window_stack(*row[columns], *row[columns - 1]);
if (row_index == current_stack_row && columns - 1 == current_stack_column)
need_rerender = true;
row.remove(columns);
@@ -213,10 +213,10 @@ bool WindowManager::apply_workspace_settings(unsigned rows, unsigned columns, bo
}
// Add more rows if necessary
while (rows > current_rows) {
- auto row = adopt_own(*new RemoveReference<decltype(m_window_stacks[0])>());
+ auto row = adopt_own(*new RemoveReference<decltype(*m_window_stacks[0])>());
for (size_t column_index = 0; column_index < columns; column_index++) {
auto window_stack = adopt_own(*new WindowStack(current_rows, column_index));
- window_stack->set_stationary_window_stack(m_window_stacks[0][0]);
+ window_stack->set_stationary_window_stack(*(*m_window_stacks[0])[0]);
row->append(move(window_stack));
}
m_window_stacks.append(move(row));
@@ -226,10 +226,10 @@ bool WindowManager::apply_workspace_settings(unsigned rows, unsigned columns, bo
while (columns > current_columns) {
for (size_t row_index = 0; row_index < current_rows; row_index++) {
auto& row = m_window_stacks[row_index];
- while (row.size() < columns) {
- auto window_stack = adopt_own(*new WindowStack(row_index, row.size()));
- window_stack->set_stationary_window_stack(m_window_stacks[0][0]);
- row.append(move(window_stack));
+ while (row->size() < columns) {
+ auto window_stack = adopt_own(*new WindowStack(row_index, row->size()));
+ window_stack->set_stationary_window_stack(*(*m_window_stacks[0])[0]);
+ row->append(move(window_stack));
}
}
current_columns++;
@@ -237,7 +237,7 @@ bool WindowManager::apply_workspace_settings(unsigned rows, unsigned columns, bo
if (removing_current_stack) {
// If we're on a window stack that was removed, we need to move...
- m_current_window_stack = &m_window_stacks[new_current_row][new_current_column];
+ m_current_window_stack = (*m_window_stacks[new_current_row])[new_current_column];
Compositor::the().set_current_window_stack_no_transition(*m_current_window_stack);
need_rerender = false; // The compositor already called invalidate_for_window_stack_merge_or_change for us
}
@@ -320,7 +320,7 @@ bool WindowManager::is_natural_scroll() const
WindowStack& WindowManager::window_stack_for_window(Window& window)
{
if (is_stationary_window_type(window.type()))
- return m_window_stacks[0][0];
+ return *(*m_window_stacks[0])[0];
if (auto* parent = window.parent_window(); parent && !is_stationary_window_type(parent->type()))
return parent->window_stack();
return current_window_stack();
@@ -1657,7 +1657,7 @@ void WindowManager::process_key_event(KeyEvent& event)
column--;
return true;
case Key_Right:
- if (column + 1 >= m_window_stacks[0].size())
+ if (column + 1 >= m_window_stacks[0]->size())
return true;
column++;
return true;
@@ -1678,7 +1678,7 @@ void WindowManager::process_key_event(KeyEvent& event)
if (handle_window_stack_switch_key()) {
request_close_fragile_windows();
Window* carry_window = nullptr;
- auto& new_window_stack = m_window_stacks[row][column];
+ auto& new_window_stack = *(*m_window_stacks[row])[column];
if (&new_window_stack != &current_stack) {
if (event.modifiers() == (Mod_Ctrl | Mod_Shift | Mod_Alt))
carry_window = this->active_window();
diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h
index 243a98bcdb..1dd9fc686e 100644
--- a/Userland/Services/WindowServer/WindowManager.h
+++ b/Userland/Services/WindowServer/WindowManager.h
@@ -259,11 +259,11 @@ public:
void switch_to_window_stack(u32 row, u32 col, Window* carry = nullptr, bool show_overlay = true)
{
if (row < window_stack_rows() && col < window_stack_columns())
- switch_to_window_stack(m_window_stacks[row][col], carry, show_overlay);
+ switch_to_window_stack(*(*m_window_stacks[row])[col], carry, show_overlay);
}
size_t window_stack_rows() const { return m_window_stacks.size(); }
- size_t window_stack_columns() const { return m_window_stacks[0].size(); }
+ size_t window_stack_columns() const { return m_window_stacks[0]->size(); }
bool apply_workspace_settings(unsigned rows, unsigned columns, bool save);
@@ -277,8 +277,8 @@ public:
IterationDecision for_each_window_stack(F f)
{
for (auto& row : m_window_stacks) {
- for (auto& stack : row) {
- IterationDecision decision = f(stack);
+ for (auto& stack : *row) {
+ IterationDecision decision = f(*stack);
if (decision != IterationDecision::Continue)
return decision;
}
@@ -397,7 +397,7 @@ private:
RefPtr<MultiScaleBitmaps> m_overlay_rect_shadow;
// Setup 2 rows 1 column by default
- NonnullOwnPtrVector<NonnullOwnPtrVector<WindowStack, default_window_stack_columns>, default_window_stack_rows> m_window_stacks;
+ Vector<NonnullOwnPtr<Vector<NonnullOwnPtr<WindowStack>, default_window_stack_columns>>, default_window_stack_rows> m_window_stacks;
WindowStack* m_current_window_stack { nullptr };
struct DoubleClickInfo {
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp
index 03d1bfb08a..42a02cd58d 100644
--- a/Userland/Shell/Shell.cpp
+++ b/Userland/Shell/Shell.cpp
@@ -346,8 +346,8 @@ Shell::LocalFrame* Shell::find_frame_containing_local_variable(StringView name)
{
for (size_t i = m_local_frames.size(); i > 0; --i) {
auto& frame = m_local_frames[i - 1];
- if (frame.local_variables.contains(name))
- return &frame;
+ if (frame->local_variables.contains(name))
+ return frame;
}
return nullptr;
}
@@ -407,7 +407,7 @@ void Shell::set_local_variable(DeprecatedString const& name, RefPtr<AST::Value>
}
}
- m_local_frames.last().local_variables.set(name, move(value));
+ m_local_frames.last()->local_variables.set(name, move(value));
}
void Shell::unset_local_variable(StringView name, bool only_in_current_frame)
@@ -418,7 +418,7 @@ void Shell::unset_local_variable(StringView name, bool only_in_current_frame)
return;
}
- m_local_frames.last().local_variables.remove(name);
+ m_local_frames.last()->local_variables.remove(name);
}
void Shell::define_function(DeprecatedString name, Vector<DeprecatedString> argnames, RefPtr<AST::Node> body)
@@ -491,7 +491,7 @@ Shell::Frame Shell::push_frame(DeprecatedString name)
{
m_local_frames.append(make<LocalFrame>(name, decltype(LocalFrame::local_variables) {}));
dbgln_if(SH_DEBUG, "New frame '{}' at {:p}", name, &m_local_frames.last());
- return { m_local_frames, m_local_frames.last() };
+ return { m_local_frames, *m_local_frames.last() };
}
void Shell::pop_frame()
@@ -504,11 +504,11 @@ Shell::Frame::~Frame()
{
if (!should_destroy_frame)
return;
- if (&frames.last() != &frame) {
+ if (frames.last() != &frame) {
dbgln("Frame destruction order violation near {:p} (container = {:p}) in '{}'", &frame, this, frame.name);
dbgln("Current frames:");
for (auto& frame : frames)
- dbgln("- {:p}: {}", &frame, frame.name);
+ dbgln("- {:p}: {}", &frame, frame->name);
VERIFY_NOT_REACHED();
}
(void)frames.take_last();
@@ -1607,7 +1607,7 @@ Vector<Line::CompletionSuggestion> Shell::complete_variable(StringView name, siz
// Look at local variables.
for (auto& frame : m_local_frames) {
- for (auto& variable : frame.local_variables) {
+ for (auto& variable : frame->local_variables) {
if (variable.key.starts_with(pattern) && !suggestions.contains_slow(variable.key))
suggestions.append(variable.key);
}
diff --git a/Userland/Shell/Shell.h b/Userland/Shell/Shell.h
index bb4b05bf0e..be20866c60 100644
--- a/Userland/Shell/Shell.h
+++ b/Userland/Shell/Shell.h
@@ -197,7 +197,7 @@ public:
};
struct Frame {
- Frame(NonnullOwnPtrVector<LocalFrame>& frames, LocalFrame const& frame)
+ Frame(Vector<NonnullOwnPtr<LocalFrame>>& frames, LocalFrame const& frame)
: frames(frames)
, frame(frame)
{
@@ -207,7 +207,7 @@ public:
void leak_frame() { should_destroy_frame = false; }
private:
- NonnullOwnPtrVector<LocalFrame>& frames;
+ Vector<NonnullOwnPtr<LocalFrame>>& frames;
LocalFrame const& frame;
bool should_destroy_frame { true };
};
@@ -458,7 +458,7 @@ private:
};
HashMap<DeprecatedString, ShellFunction> m_functions;
- NonnullOwnPtrVector<LocalFrame> m_local_frames;
+ Vector<NonnullOwnPtr<LocalFrame>> m_local_frames;
Promise::List m_active_promises;
Vector<NonnullRefPtr<AST::Redirection>> m_global_redirections;
diff --git a/Userland/Utilities/wasm.cpp b/Userland/Utilities/wasm.cpp
index 3e55df56b5..e02e6dd748 100644
--- a/Userland/Utilities/wasm.cpp
+++ b/Userland/Utilities/wasm.cpp
@@ -359,7 +359,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
}
// First, resolve the linked modules
- NonnullOwnPtrVector<Wasm::ModuleInstance> linked_instances;
+ Vector<NonnullOwnPtr<Wasm::ModuleInstance>> linked_instances;
Vector<Wasm::Module> linked_modules;
for (auto& name : modules_to_link_in) {
auto parse_result = parse(name);
@@ -370,7 +370,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
linked_modules.append(parse_result.release_value());
Wasm::Linker linker { linked_modules.last() };
for (auto& instance : linked_instances)
- linker.link(instance);
+ linker.link(*instance);
auto link_result = linker.finish();
if (link_result.is_error()) {
warnln("Linking imported module '{}' failed", name);
@@ -387,7 +387,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Wasm::Linker linker { parse_result.value() };
for (auto& instance : linked_instances)
- linker.link(instance);
+ linker.link(*instance);
if (export_all_imports) {
HashMap<Wasm::Linker::Name, Wasm::ExternValue> exports;
diff --git a/Userland/Utilities/xml.cpp b/Userland/Utilities/xml.cpp
index 3b042e2fc0..95e5800946 100644
--- a/Userland/Utilities/xml.cpp
+++ b/Userland/Utilities/xml.cpp
@@ -112,7 +112,7 @@ static void dump(XML::Node const& node)
color(ColorRole::Reset);
for (auto& node : element.children)
- dump(node);
+ dump(*node);
color(ColorRole::Tag);
out("</{}>", element.name);
@@ -391,12 +391,12 @@ static void do_run_tests(XML::Document& document)
Queue<XML::Node*> suites;
auto dump_cases = [&](auto& root) {
for (auto& node : root.children) {
- auto element = node.content.template get_pointer<XML::Node::Element>();
+ auto element = node->content.template get_pointer<XML::Node::Element>();
if (!element)
continue;
if (element->name != "TESTCASES" && element->name != "TEST")
continue;
- suites.enqueue(&node);
+ suites.enqueue(node);
}
};