Commit Graph

20621 Commits

Author SHA1 Message Date
Brian Gianforcaro
1415b2cfc3 Kernel: Do not allocate AnonymousVMObject's under spin lock
Spinlocks guard short regions, with hopefully no other locks being taken
in the process. Violating constraints usually had detrimental effects on
platform stability as well as performance and scalability. Allocating
memory takes it own locks, and can in some cases even allocate new
regions, and thus violates these tenants.

Move the AnonymousVMObject creation outside of the spinlock as
creation does not modify any shared state.
2021-05-20 08:10:07 +02:00
Brian Gianforcaro
a43bccfc3c Meta: Mark the other image file formats as binary in .gitattributes
We had rules for .png and .jpg files, but we have not maintained the
list as support for other file formats has been added. To test these
changes test files have been committed for each of these formats.

This change updates the list with all of the binary image file types I
was able to find in the tree at the time of writing.
2021-05-20 08:04:28 +02:00
Brian Gianforcaro
d58263497b Meta: Cleanup stale rules from .gitignore
The wild card rules at the top of the .gitignore came from a time when
the build wrote back to the git repository and placed files right next
to the source. (Original commit that introduced them 37c27e2e, they were
later consolidated into the root .gitignore in 802d4dc) We have since
moved to cmake, and these rules have become obsolete, and they just
cause issues where we need to go and add negations for these rules in
order for things to work.

A previous change attempted to remove the top wild card rules (PR #4565)
but it was later reverted, as they forgot to remove the top ignore
everything rule '*', so all files were ignored. This change just removes
all of these rules that no longer make sense, restoring a bit of sanity.

*.o,*.d,*.a rules were also from when the build wrote to the repository,
they are now defunct. The same goes for the *Endpoint.h and CMakeFiles
rules.

The lowercase build directory can be removed as we've standardized on
the uppercase 'Build' directory as the root of the build output dir.
2021-05-20 08:04:28 +02:00
Lenny Maiorani
d25d4ec0ee Bitmap: De-duplicate bitmasks
Problem:
- Bitmasks are duplicated.
- Bitmasks are C-style arrays.

Solution:
- Move bitmasks to BitmapView.h.
- Change C-style arrays to be AK::Array for added safety.
2021-05-19 23:37:10 +01:00
Linus Groh
9c19e62675 LibMarkdown: Wrap code block language string in escape_html_entities()
This would allow HTML injection as the string was inserted into the HTML
output with no sanitation whatsoever.

Fixes #7123.
2021-05-19 23:31:00 +01:00
Andreas Kling
0a70e1728a DisplaySettings: Fix broken path to MonitorSettingsWidget's GML 2021-05-20 00:25:15 +02:00
Linus Groh
c2fb252ebf LibWeb: Use -libweb-palette-base-text for text color in default CSS
This makes un-styled text readable when using a dark system theme,
previously such text would be black, regardless of the theme background
color.

Fixes #7274.
2021-05-19 23:23:48 +01:00
Andreas Kling
6394ea00d8 DisplaySettings: Remove icon from browse-for-wallpaper button
The icon on this button looked out of place.
2021-05-20 00:13:56 +02:00
Andreas Kling
7f206ca6de DisplaySettings: Select the currently used wallpaper on startup 2021-05-20 00:03:30 +02:00
Andreas Kling
7ba644456e LibGUI: Don't invalidate FileSystemModel indices on thumbnail update
Finishing a thumbnail generation doesn't affect indices at all.
2021-05-20 00:03:30 +02:00
Andreas Kling
bb9e955ef8 DisplaySettings: Make MonitorWidget update itself on property changes 2021-05-20 00:03:30 +02:00
Andreas Kling
c79e33d00c DisplaySettings: Rename DisplaySettingsWidget => MonitorSettingsWidget 2021-05-20 00:03:30 +02:00
Andreas Kling
540acc1a32 DisplaySettings: Give the UI a facelift :^)
- Split the main UI into two tabs: "Background" and "Monitor".
- Use a GUI::IconView for selecting background pictures.
- Tweak layout, spacing, etc.
2021-05-20 00:03:30 +02:00
Andreas Kling
ff519e5421 LibGUI: Add widget registration for GUI::IconView 2021-05-20 00:03:30 +02:00
Andreas Kling
c14ffdef00 DisplaySettings: Tweak main window layout & setup code
Get rid of the menu and put some padding around the main tab widget.
2021-05-20 00:03:30 +02:00
Andreas Kling
83f43b6464 DisplaySettings: Replace the monitor image with something more thematic
This is a drawing of my own monitor in a familiar style. :^)
2021-05-20 00:03:30 +02:00
Ali Mohammad Pur
a57f152ec7 LibHTTP: Relax the assertion on extra reads after transfer is finished
This was added in #4831, but it didn't account for extra newlines after
the response (seems like some servers like to do this).
2021-05-19 23:57:04 +02:00
Itamar
832e9c6e02 LibCpp: Add regression tests for the parser
For each .cpp file in the test suite data, there is a .ast file that
represents the "known good" baseline of the parser result.

Each .cpp file goes through the parser, and the result of
invoking `ASTNode::dump()` on the root node is compared to the
baseline to find regressions.

We also check that there were no parser errors when parsing the .cpp
files.
2021-05-19 23:19:07 +02:00
Itamar
fbf796cd9f LibCpp: Fix "NumricLiteral" => "NumericLiteral" typo 2021-05-19 23:19:07 +02:00
Itamar
402483ec1f LibCpp: Generalize ASTNode::dump() to support redirecting its output
Previously, ASTNode::dump() used outln() for output, which meant it
always wrote its output to stdout.

After this commit, ASTNode::dump() receives an 'output' argument (which
is stdout by default). This enables writing the output to somewhere
else.

This will be useful for testing the LibCpp Parser with the output of
ASTNode::dump.
2021-05-19 23:19:07 +02:00
Itamar
463a91c4a2 Utilities: Rename CppParserTest => cpp-parser
This is a utility program that runs the LibCpp parser on a program and
dumps out the AST.
2021-05-19 23:19:07 +02:00
Itamar
ef95ddcbfa LibCpp: Fix match_expression()
match_expression() will now return true if there's a match for a Name
node.
2021-05-19 23:19:07 +02:00
Itamar
f28d944122 LibCpp: Support 'auto' Type 2021-05-19 23:19:07 +02:00
Itamar
eeb98335d5 CppLanguageServer: Put cpp test files in /home/anon/cpp-tests/
This is similar to the LibJS test data that resides in
/home/anon/js-tests.
It's more convenient than storing the test programs as raw strings
in the code.
2021-05-19 23:19:07 +02:00
Stephan Unverwerth
28ed518142 LibGL: Implement all of glVertex{2,3,4}{d,dv,f,fv,i,iv,s,sv} 2021-05-19 23:18:13 +02:00
Marcus Nilsson
41e74d4d31 CatDog: Don't show context menu when clicking outside of widget
The context menu for CatDog was shown when right clicking anywhere on
the screen because of global cursor tracking being enabled.
Also fix event not being passed by reference.

Fixes #7285
2021-05-19 23:14:07 +02:00
Brian Gianforcaro
83fc591cea Kernel: Generate page fault events from the kernel profiler
Hook the kernel page fault handler and capture page fault events when
the fault has a current thread attached in TLS. We capture the eip and
ebp so we can unwind the stack and locate which pieces of code are
generating the most page faults.

Co-authored-by: Gunnar Beutner <gbeutner@serenityos.org>
2021-05-19 22:51:42 +02:00
Gunnar Beutner
6ac1ca5a9a Profiler: Remove ability to filter Kernel::Scheduler::yield() frames
Hiding those frames doesn't really make sense. They're a major
contributor to a process' spent CPU time and show up in a lot of
profiles. That however is because those processes really do spend
quite a bit of time in the scheduler by doing lots of context
switches, like WindowServer when responding to IPC calls.

Instead of hiding these for aesthetic reasons we should instead
improve the scheduler.
2021-05-19 22:51:42 +02:00
Gunnar Beutner
7dc77bd833 Kernel: Avoid an allocation in sys$poll 2021-05-19 22:51:42 +02:00
Gunnar Beutner
277f333b2b Kernel: Add support for profiling kmalloc()/kfree() 2021-05-19 22:51:42 +02:00
Gunnar Beutner
572bbf28cc Kernel+LibC: Add support for filtering profiling events
This adds the -t command-line argument for the profile tool. Using this
argument you can filter which event types you want in your profile.
2021-05-19 22:51:42 +02:00
Gunnar Beutner
8b2ace0326 Kernel: Track performance events for context switches 2021-05-19 22:51:42 +02:00
Ali Mohammad Pur
c94440860e LibCrypto: Use the new return-from-Variant::visit() mechanism
And simplify the code _even further_!
2021-05-19 22:45:34 +02:00
Gunnar Beutner
cdb0a08946 Ports: Build shared libraries for the GnuPG libraries
This builds all the GnuPG libraries as shared libraries so that -lintl
is linked when building the final GnuPG executable.
2021-05-19 22:45:02 +02:00
Lenny Maiorani
5751327195 Kernel: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-19 21:21:47 +01:00
Lenny Maiorani
2b64d163cd Tests: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-19 21:21:03 +01:00
Maciej Zygmanowski
4aaf8df865 Browser: Do not use AK::Format for search engine formatting
It is too complex because it supports many options that are not
used by the search engine. It just makes format validation more
complicated.

Additionaly, now it's possible to have { } characters in search
engine URL (although they are not valid URL characters) :)
2021-05-19 20:51:51 +01:00
Maciej Zygmanowski
78bc6c09ba Browser: Add support for custom search engines 2021-05-19 20:51:51 +01:00
Maciej Zygmanowski
80077cea86 AK: Add String::find_all() and String::count() 2021-05-19 20:51:51 +01:00
Gunnar Beutner
e9898a6031 Kernel: Use plain Function objects for the WorkQueue
The WorkQueue class previously had its own inline storage functionality
for function pointers. With the recent changes to the Function class
this is no longer necessary.
2021-05-19 21:36:57 +02:00
Gunnar Beutner
661d1aa8d1 AK: Add inline storage support for the Function class
This allows us to allocate most Function objects on the stack or as
part of other objects and gets rid of quite a few allocations.
2021-05-19 21:36:57 +02:00
Ali Mohammad Pur
fdfa5c0bc7 Shell: Avoid moving AK::Function instances while inside them 2021-05-19 21:36:57 +02:00
Gunnar Beutner
d954c11f66 Everywhere: Add missing includes for <AK/OwnPtr.h>
Previously <AK/Function.h> also included <AK/OwnPtr.h>. That's about to
change though. This patch fixes a few build problems that will occur
when that change happens.
2021-05-19 21:36:57 +02:00
Justin
45a1a7e1e6 LibC: Add functions for the new statvfs syscalls
This commit adds the statvfs() and fstatvfs() functions into LibC.
2021-05-19 21:33:29 +02:00
Justin
1c3badede3 Kernel: Add statvfs & fstatvfs Syscalls
These syscalls fill a statvfs struct with various data
about the mount on the VFS.
2021-05-19 21:33:29 +02:00
Justin
721a867c65 Kernel: Expose FileSystem's fragment size
This commit will add a fragment_size() function similar to the
block_size() function.
2021-05-19 21:33:29 +02:00
Timothy Flynn
145e246a5e AK: Allow AK::Variant::visit to return a value
This changes Variant::visit() to forward the value returned by the
selected visitor invocation. By perfectly forwarding the returned value,
this allows for the visitor to return by value or reference.

Note that all provided visitors must return the same type - the compiler
will otherwise fail with the message: "inconsistent deduction for auto
return type".
2021-05-19 20:41:09 +02:00
Erik Biederstadt
585e7890cd 3DFileViewer: Move Demos/GLTeapot to Applications/3DFileViewer
Also changes the category to `Graphics`
2021-05-19 19:34:12 +01:00
Erik Biederstadt
132ecfc47b GLTeapot: Adds a help menu to the GLTeapot demo
Having a help menu maintains better consistency with the other GUI apps
 on the system.
2021-05-19 19:34:12 +01:00
Erik Biederstadt
d9dc42fab5 GLTeapot: Adds additional error checking when loading files
- If the 3D file contains no vertices then an error is raised
- If the file is not an OBJ file then an error is raised
2021-05-19 19:34:12 +01:00