Commit graph

24101 commits

Author SHA1 Message Date
Andreas Kling d3cf4cd8f0 Kernel/DevFS: Remove redundant DevFS& member from DevFSInode
All Inode subclasses can get to their FileSystem via Inode::fs().
2021-07-18 02:21:34 +02:00
Andreas Kling bd37840cf5 Kernel/Ext2FS: Surface Vector allocation failures in block allocation 2021-07-18 02:15:56 +02:00
Andreas Kling 1f18558ee2 Kernel: Make FileSystem::root_inode() return a plain Inode&
All file system classes are expected to keep their root Inode object
in memory, so this function can safely return an Inode&.
2021-07-18 01:53:04 +02:00
Andreas Kling 58c6d30f6a Kernel/Ext2FS: Cache the root inode in a member variable
We often get queried for the root inode, and it will always be cached
in memory anyway, so let's make Ext2FS::root_inode() fast by keeping
the root inode in a dedicated member variable.
2021-07-18 01:53:04 +02:00
Andreas Kling 9457d83986 Kernel: Rename Locker => MutexLocker 2021-07-18 01:53:04 +02:00
Andreas Kling ab50a1480f Kernel/USB: Remove unneeded friend declaration in SysFSUSBBusDirectory 2021-07-18 01:53:04 +02:00
Linus Groh 08a303172d LibJS: Extend class 'extends' RHS expression parsing
Instead of only parsing a primary expression, we should also allow
member expressions, call expressions, and tagged template literals (and
optional chains, which we don't have yet).
In the spec, all of this is covered by `LeftHandSideExpression`
(https://tc39.es/ecma262/#prod-LeftHandSideExpression).
2021-07-18 00:17:57 +01:00
Andreas Kling b975a74a1d Kernel/USB: Move USB bus information from /proc to /sys
This patch moves all the USB data from /proc/bus/usb to /sys/bus/usb.
2021-07-18 00:55:16 +02:00
Marcus Nilsson 72a5347f91 LibGUI: Pass path to FileSystemModel when creating FilePicker
This saves a few lstat lookups since otherwise '/' is indexed before
set_path() is called. It also cleans up warnings if '/' is not
unveiled when opening FilePicker, like in WidgetGallery.
2021-07-18 00:55:04 +02:00
Andreas Kling 6fae2a5f9e Kernel/ProcFS: Remove unused ProcFSExposedComponent::entries_count() 2021-07-17 23:50:01 +02:00
Andreas Kling d686d2ef18 Kernel/SysFS: Remove unused SysFSComponent::entries_count() 2021-07-17 23:50:01 +02:00
Andreas Kling 2da0581fd2 Kernel: Replace "folder" => "directory" everywhere
Folders are a GUI concept. File systems have directories.
2021-07-17 23:50:00 +02:00
Marcus Nilsson 22611ca136 WidgetGallery: Pledge thread
This is needed to use the file picker dialog.
2021-07-17 23:30:58 +02:00
Marcus Nilsson 57fc6eb9be WidgetGallery: Remove unused include 2021-07-17 23:30:58 +02:00
Andreas Kling b8d6c3722d Kernel: Remove Inode::directory_entry_count()
This was only used in one place: VirtualFileSystem::rmdir(), and that
has now been converted to a simple directory traversal.
2021-07-17 22:36:04 +02:00
Andreas Kling d1bbe8b652 Kernel: Count remaining children in VirtualFileSystem::rmdir() manually
To count the remaining children, we simply need to traverse the
directory and increment a counter. No need for a custom virtual that
all file systems have to implement. :^)
2021-07-17 22:34:43 +02:00
Andreas Kling a3f58a5003 Kernel/DevFS: Use KString for DevFSDeviceInode::m_name 2021-07-17 22:17:07 +02:00
Andreas Kling 0d89cfcd9a Kernel/DevFS: Use KString for DevFSLinkInode::m_link 2021-07-17 22:11:41 +02:00
Andreas Kling cd4d73e19e Kernel: Add an API for turning a UserOrKernelBuffer into a KString 2021-07-17 22:07:49 +02:00
Andreas Kling dd37d0a327 Kernel/DevFS: Use KString for DevFSLinkInode::m_name 2021-07-17 21:40:32 +02:00
Andreas Kling 61c1937d02 Kernel/DevFS: Make DevFSInode::name() return StringView 2021-07-17 21:36:54 +02:00
Andreas Kling 6766efff9c Kernel: Make Inode::create_child() take the name as a StringView
No sense in forcing callers to construct a String. One more small step
towards not using String in the kernel.
2021-07-17 21:32:59 +02:00
Andreas Kling 9359f7801f Kernel/DevFS: Remove some unnecessary inode locking
Unless we're accessing mutex-guarded metadata, there's no need to
acquire the inode lock.

The file system ID or inode index of a constructed inode will never
change, for example.
2021-07-17 21:26:47 +02:00
Andreas Kling 3b805a57e6 Kernel: Rename Inode::m_lock => m_inode_lock
This makes file system code much easier to read since it was hard when
both the file system and inode locks were called "m_lock".
2021-07-17 21:17:39 +02:00
Andreas Kling 63e1423830 Kernel: Remove unused Inode::is_shared_vmobject() 2021-07-17 21:11:12 +02:00
Andreas Kling cee9528168 Kernel: Rename Lock to Mutex
Let's be explicit about what kind of lock this is meant to be.
2021-07-17 21:10:32 +02:00
Andreas Kling a803c4026c Kernel: Make FileSystem::class_name() return a StringView 2021-07-17 20:59:48 +02:00
Timothy Flynn a2e734d202 LibJS: Report string length as the code point length, not byte length
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-17 16:59:59 +01:00
Timothy Flynn 87848cdf7d AK: Track byte length, rather than code point length, in Utf8View::trim
Utf8View::trim uses Utf8View::substring_view to return its result, which
requires the input to be a byte offset/length rather than code point
length.
2021-07-17 16:59:59 +01:00
Peter Bindels 660a8982e7 LibM: Turn off builtins, fix tests & implementation
While trying to port to Clang we found that the functions as
implemented didn't actually work, and replacing them with a blatantly
broken function also did not break the tests on the GCC build. It
turns out we've been testing GCC's builtins by many tests. This
removes the use of builtins for LibM's tests (so we test the whole
function). It turns off the denormal test for scalbn (which was not
implemented) and comments out the tgamma(0.5) test which is too
inaccurate to be usable (and too complicated for me to fix). The gamma
function was made accurate for all other test cases, and asin received
two more layers of Taylor expansion to bring it within error margin
for the tests.
2021-07-17 17:37:20 +02:00
Brian Gianforcaro c0987453e6 Kernel: Remove double RedBlackTree lookup in VM/Space region removal
We should never request a regions removal that we don't currently
own. We currently assert this everywhere else by all callers.

Instead lets just push the assert down into the RedBlackTree removal
and assume that we will always successfully remove the region.
2021-07-17 16:22:59 +02:00
Brian Gianforcaro d879709ec7 Kernel: Convert the PhysicalPage bool parameter to an enum 2021-07-17 18:38:28 +04:30
Karol Kosek 399be9bcc3 FileManager+Spreadsheet: Unify cut-copy-paste order
File Manager and Spreadsheet had an inconsistent order relative
to other apps (they had a copy-cut-paste order, where every other app
had a cut-copy-paste order).
2021-07-17 18:30:37 +04:30
Brian Gianforcaro cfef3040fb Profiler: Configure the TimelineContainer to be shrink to fit
Today the profile viewer timeline view has a static size, which is
computed as half the height of the window given it has two root widgets.

Instead the timeline view should shrink to only consume the size that
each process timeline consumes.
2021-07-17 18:24:54 +04:30
Brian Gianforcaro a2a5af9745 AK: Restrict timespec comparison operator overloads in AK::Time
The previous implementation was too generic, and would cause conflicting
operator overload errors when included in certain code paths. Fix this
by restricting the template parameters to types which have the same
member names as `struct timespec`.
2021-07-17 17:39:12 +04:30
Max Wipfli ccae0cae45 LibWeb: Rename HTMLToken::doctype_data() => ensure_doctype_data()
This renames the accessor to better reflect what it does, as this will
allocate a DoctypeData struct if there is none.
2021-07-17 16:24:57 +04:30
Max Wipfli 519a1cdc22 LibWeb: Change HTMLToken storage architecture
This completely changes how HTMLTokens store their data. Previously,
space was allocated for all token types separately. Now, the HTMLToken's
data is stored in just a String, two booleans and a Variant.

This change reduces sizeof(HTMLToken) from 68 to 32. Also, this reduces
raw tokenization time by around 20 to 50 percent, depending on the page.
Full document parsing time (with HTMLDocumentParser, on a local HTML
page without any dependency files) is reduced by between 4 and 20
percent, depending on the page.

Since tokenizing HTML pages can easily generated 50'000 tokens and more,
the storage has been designed in a way that avoids heap allocations
where possible, while trying to reduce the size of the tokens. The only
tokens which need to allocate on the heap are thus DOCTYPE tokens (max.
1 per document), and tag tokens (but only if they have attributes). This
way, only around 5 percent of all tokens generated need to allocate on
the heap (except for StringImpl allocations).
2021-07-17 16:24:57 +04:30
Max Wipfli 8a4c44db8c LibWeb: Make HTMLTokens non-copyable 2021-07-17 16:24:57 +04:30
Max Wipfli 7eb294df0d LibWeb: Move HTMLToken in HTMLDocumentParser
This replaces a copy construction of an HTMLToken with a move(). This
allows HTMLToken to be made non-copyable in a further commit.
2021-07-17 16:24:57 +04:30
Max Wipfli b6e995ca3c Tests: Use pointers in TestHTMLTokenizer to avoid copying HTMLTokens 2021-07-17 16:24:57 +04:30
Max Wipfli 2532bdfabf LibWeb: Remove friend class declarations from HTMLToken
Since all interaction with the HTMLToken class now happens over getters
and setters, there is no more need for HTMLTokenizer and
HTMLDocumentParser to have direct access to the members.
2021-07-17 16:24:57 +04:30
Max Wipfli 25cba4387b LibWeb: Add HTMLToken(Type) constructor and use it 2021-07-17 16:24:57 +04:30
Max Wipfli f2e3c770f9 LibWeb: Use setter for HTMLToken::m_{start,end}_position 2021-07-17 16:24:57 +04:30
Max Wipfli 8b31e41692 LibWeb: Change HTMLToken::m_doctype into named DoctypeData struct
This is in preparation for an upcoming storage change of HTMLToken. In
contrast to the other token types, the accessor can hand out a mutable
reference to allow users to change parts of the DoctypeData easily.
2021-07-17 16:24:57 +04:30
Max Wipfli 918bde98b1 LibWeb: Hide implementation details of HTMLToken attribute list
Previously, HTMLToken would expose the Vector<Attribute> directly to
its users. In preparation for a future change, all users now use
implementation-agnostic APIs which do not expose the Vector directly.
2021-07-17 16:24:57 +04:30
Max Wipfli 15d8635afc LibWeb: User getter+setter for HTMLToken tag name and self-closing flag 2021-07-17 16:24:57 +04:30
Max Wipfli 1aeafcc58b LibWeb: Use getter and setter for Character type HTMLTokens
While storing the code point in a UTF-8 encoded String in horrendously
inefficient, this problem will be addressed at a later stage.
2021-07-17 16:24:57 +04:30
Max Wipfli e8e9426b4f LibWeb: User getter and setter for Comment type HTMLTokens 2021-07-17 16:24:57 +04:30
Max Wipfli f886aa15b8 LibWeb: Rename HTMLToken::AttributeBuilder struct to Attribute
This does not contain StringBuilders anymore, so it can do with a
simpler name: Attribute.
2021-07-17 16:24:57 +04:30
Max Wipfli d82f3eb085 LibWeb: Make HTMLToken::{Position,AttributeBuilder} structs public
There was and is no reason for those to be private. Making them public
also allows us to explicitly specify the return type of some getters.
2021-07-17 16:24:57 +04:30