Commit Graph

1039 Commits

Author SHA1 Message Date
Andrew Kaster
824bbc7462 LibC: Support exit time destructors per the Itanium C++ ABI
Implement __cxa_atexit and __cxa_finalize per the Itanium spec,
and convert stdlib's atexit and exit() to to call them instead of
a custom 'C-only' atexit implementation.
2019-12-22 10:47:39 +01:00
Andreas Kling
270beb5165 LibC: Always install as part of the default target
We always want to put crt0.o in the location where it can get picked
up by the i686-pc-serenity toolchain.

This feels a bit hackish but should get the build working again. :^)
2019-12-20 21:13:53 +01:00
Andreas Kling
842716a0b5 Kernel+LibC: Build with basic -fstack-protector support
Use simple stack cookies to try to provoke an assertion failure on
stack overflow.

This is far from perfect, since we use a constant cookie instead of
generating a random one on startup, but it can still help us catch
bugs, which is the primary concern right now. :^)
2019-12-20 21:03:32 +01:00
Andreas Kling
6ec46aad66 LibC: Make sure we build crt0.o 2019-12-20 20:36:53 +01:00
joshua stein
ac25438d54 Build: clean up build system, use one shared Makefile
Allow everything to be built from the top level directory with just
'make', cleaned with 'make clean', and installed with 'make
install'.  Also support these in any particular subdirectory.

Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as
it runs.

Kernel and early host tools (IPCCompiler, etc.) are built as
object.host.o so that they don't conflict with other things built
with the cross-compiler.
2019-12-20 20:20:54 +01:00
Sergey Bugaev
d91c40de3b LibC: Make empty malloc blocks purgeable 2019-12-20 20:19:46 +01:00
Andreas Kling
cfcb38dff1 WindowServer+LibGUI: Add data_type and data fields to drag operations
These fields are intended to carry the real meat of a drag operation,
and the "text" is just for what we show on screen (alongside the cursor
during the actual drag.)

The data field is just a String for now, but in the future we should
make it something more flexible.
2019-12-20 20:07:10 +01:00
Andreas Kling
af7cb7ce1b LibGUI: GWidget::drop_event() should ignore the event by default
This will cause the event to bubble up the widget tree.
2019-12-20 20:07:10 +01:00
Andreas Kling
c0e81b26b6 LibHTML: Ignore layout repaints outside the visible viewport
Now that Frame knows the visible viewport rect, it can easily ignore
repaint requests from e.g <blink> elements that are not currently
scrolled into view. :^)
2019-12-18 22:16:27 +01:00
Andreas Kling
1aea8f116b LibHTML: Add TreeNode::for_each_in_subtree_of_type<T>()
This allows you to iterate a subtree and get a callback for every node
where is<T>(node) == true. This makes for quite pleasant DOM traversal.
2019-12-18 21:34:03 +01:00
Andreas Kling
54bd322881 LibHTML: Mark image bitmaps outside the visible viewport as volatile
When the visible viewport rect changes, we walk the layout tree and
check where each LayoutImage is in relation to the viewport rect.
Images outside have their bitmaps marked as volatile.

Note that the bitmaps are managed by ImageDecoder objects. If a bitmap
is purged by the kernel while volatile, we construct a new ImageDecoder
next time we need pixels for the image.
2019-12-18 21:19:04 +01:00
Andreas Kling
7e068565bc LibHTML: Push the visible viewport rect from HtmlView to Frame
This will allow various mechanisms and optimizations based on the
currently visible viewport rect.
2019-12-18 20:54:23 +01:00
Andreas Kling
85ac9705ba LibHTML: Add LayoutNode::is_image() and is<LayoutImage> helper 2019-12-18 20:52:36 +01:00
Andreas Kling
7cc4b90b16 LibDraw: Create purgeable GraphicsBitmap in the PNG decoder
Also add ImageDecoder APIs for controlling the volatile flag.
2019-12-18 20:50:58 +01:00
Andreas Kling
77ae98a9b6 LibDraw: Add GraphicsBitmap::create_purgeable()
This allows you to create a process-private purgeable GraphicsBitmap.
The volatile flag is controlled via set_volatile() / set_nonvolatile().
2019-12-18 20:50:05 +01:00
Andreas Kling
487f9b373b Kernel: Add MADV_GET_VOLATILE for checking the volatile flag
Sometimes you might want to know if a purgeable region is volatile.
2019-12-18 20:48:24 +01:00
Sergey Bugaev
1ad5568759 LibC: Store empty malloc blocks in an array instead of a linked list 2019-12-18 19:02:25 +01:00
Andreas Kling
0d6f186397 LibHTML: Insert a new linebox for every newline in "white-space: pre" 2019-12-18 12:44:16 +01:00
Andreas Kling
1fda417f4f LibHTML: Ignore case of presentation attribute names 2019-12-18 12:44:13 +01:00
Andreas Kling
4d81bc20d8 LibHTML: Don't insert line breaks between multiple <pre>'s on a line
When iterating lines for "white-space: pre", we should only break when
there is an actual line break character.
2019-12-18 12:44:09 +01:00
Andreas Kling
152c31c5c6 LibHTML: Let's display <basefont> as block-level elements for now 2019-12-18 12:44:06 +01:00
Andreas Kling
33daa80bf0 LibHTML: Use a fixed-width font for <pre> tags, duh! 2019-12-18 12:44:02 +01:00
Andreas Kling
7301db4f9a GTextEditor: Fix broken rendering of selection on wrapped lines
This logic broke when converting String::length() to return size_t.
2019-12-17 21:15:10 +01:00
Andreas Kling
91ba94fbd4 LibHTML: Support the :only-child pseudo class 2019-12-16 19:52:11 +01:00
Andreas Kling
085cafd80a LibHTML: Support the :empty pseudo class 2019-12-16 19:46:02 +01:00
Andreas Kling
a32cae4c3b LibDraw: Parse the color name "pink" to #ffc0cb 2019-12-16 19:45:21 +01:00
Andreas Kling
c1474e594e LibHTML: Support the :first-child and :last-child pseudo classes 2019-12-16 19:34:52 +01:00
Andreas Kling
870df4a8c6 LibGUI: Fix GTreeView crash on pressing Left/Right without selection 2019-12-16 18:26:26 +01:00
Andreas Kling
72bdf595cc LibIPC: Make sure we always process unhandled messages
A client that only ever does synchronous IPC calls from its side would
never actually process incoming asynchronous messages since they would
arrive while waiting for a synchronous response and then end up sitting
forever in the "unhandled messages" queue.

We now always handle unhandled messages using a deferred invocation.

This fixes the bug where Audio.MenuApplet didn't learn that the muted
state changed in response to its own request to change it. :^)
2019-12-16 17:45:57 +01:00
Andreas Kling
df129bbe0e WindowServer+CPUGraph: Make menu applets be "regular" windows
Instead of implementing menu applets as their own thing, they are now
WSWindows of WSWindowType::MenuApplet.

This makes it much easier to work with them on the client side, since
you can just create a GWindow with the right type and you're in the
menubar doing applet stuff :^)
2019-12-16 15:05:45 +01:00
Andreas Kling
77cf607cda Kernel+LibC: Publish a "kernel info page" and use it for gettimeofday()
This patch adds a single "kernel info page" that is mappable read-only
by any process and contains the current time of day.

This is then used to implement a version of gettimeofday() that doesn't
have to make a syscall.

To protect against race condition issues, the info page also has a
serial number which is incremented whenever the kernel updates the
contents of the page. Make sure to verify that the serial number is the
same before and after reading the information you want from the page.
2019-12-15 21:29:26 +01:00
Andreas Kling
5292f6e78f Kernel+FileManager: Disallow watch_file() in unsupported file systems
Currently only Ext2FS and TmpFS supports InodeWatchers. We now fail
with ENOTSUPP if watch_file() is called on e.g ProcFS.

This fixes an issue with FileManager chewing up all the CPU when /proc
was opened. Watchers don't keep the watched Inode open, and when they
close, the watcher FD will EOF.

Since nothing else kept /proc open in FileManager, the watchers created
for it would EOF immediately, causing a refresh over and over.

Fixes #879.
2019-12-15 19:33:39 +01:00
Andreas Kling
7fea25943d LibGUI: Fix GTreeView column headers incorrectly scrolling with content 2019-12-15 18:17:02 +01:00
Andreas Kling
d4a570d576 LibGUI: Fix GTreeView not showing the context menu
This logic is all taken care of by GAbstractColumnView now, so we can
simply delete GTreeView::context_menu_event(). :^)

Fixes an issue mentioned in #826
2019-12-15 17:02:44 +01:00
Andreas Kling
6b71250d1a LibCore: Silence some aggressive CSocket and CHttpJob debug spam 2019-12-14 11:30:18 +01:00
Andreas Kling
bcffe31d3a LibCore: Bump the CHttpJob receive buffer size from 4KB to 64KB
4KB gets pretty mmap/munmap heavy when downloading larger files,
so bump this a bit to reduce time spent in memory allocation.

This can be improved in various ways, but I'm not sure what the
best way forward is at the moment.
2019-12-14 10:01:20 +01:00
Andreas Kling
4d406d5c6d LibGUI: GAbstractColumnModel should never claim to hit a toggle box
Only GTreeView can hit a toggle box in index_at_event_position().
2019-12-14 00:21:51 +01:00
Andreas Kling
561718d88b LibGUI: Improve GTreeView column auto-sizing
Rerun the column auto-sizing algorithm when opening/closing nodes.
Also use the column name as the minimum column width for the tree
column as well.
2019-12-13 23:51:16 +01:00
Andreas Kling
0ac74d3778 LibGUI: Make GTreeView inherit from GAbstractColumnView
This makes GTreeView able to support multi-column models!

Only one column can be the "tree column", this is column 0 by default
but can be changed by overriding GModel::tree_column().
2019-12-13 23:36:36 +01:00
Andreas Kling
b909d991f1 LibDraw: Add a way to check for horizontal/vertical Rect intersections 2019-12-13 23:36:17 +01:00
Andreas Kling
2d39bce3f6 LibGUI: Add a GAbstractColumnView base class for GTableView
Almost everything in GTableView moves up to GAbstractColumnView.
This is in preparation for sharing a base class between GTableView
and GTreeView :^)
2019-12-13 20:54:40 +01:00
Tommy Nguyen
d8b7cd940f TreeView: Clear metadata after model update
When the filesystem model is updated, it is rebuilt. This means dangling
indexes inside the TreeView metadata table will have old information and random
directories will toggle open. Clearing the table alleviates this issue.
2019-12-12 22:41:28 +01:00
Tommy Nguyen
2bd640277e LibGUI: Add missing call to did_update() when updating GFileSystemModel 2019-12-12 22:41:28 +01:00
Andreas Kling
0f393148da Kernel: Separate out the symbol offsets in profile output
Instead of saying "main +39" and "main +57" etc, we now have a separate
field in /proc/profile for the offset-into-the-symbol.
2019-12-12 21:59:47 +01:00
Tommy Nguyen
f26548395e LibGUI: Add context_menu_event to GTreeView 2019-12-12 11:19:02 +01:00
Andreas Kling
b32e961a84 Kernel: Implement a simple process time profiler
The kernel now supports basic profiling of all the threads in a process
by calling profiling_enable(pid_t). You finish the profiling by calling
profiling_disable(pid_t).

This all works by recording thread stacks when the timer interrupt
fires and the current thread is in a process being profiled.
Note that symbolication is deferred until profiling_disable() to avoid
adding more noise than necessary to the profile.

A simple "/bin/profile" command is included here that can be used to
start/stop profiling like so:

    $ profile 10 on
    ... wait ...
    $ profile 10 off

After a profile has been recorded, it can be fetched in /proc/profile

There are various limits (or "bugs") on this mechanism at the moment:

- Only one process can be profiled at a time.
- We allocate 8MB for the samples, if you use more space, things will
  not work, and probably break a bit.
- Things will probably fall apart if the profiled process dies during
  profiling, or while extracing /proc/profile
2019-12-11 20:36:56 +01:00
Andreas Kling
adb1870628 LibHTML: Rename HTMLImageElement::m_image_data => m_encoded_data 2019-12-11 18:30:42 +01:00
Andreas Kling
150090c742 LibGUI: Add GTextDocument::range_for_entire_line() 2019-12-10 22:06:31 +01:00
Andreas Kling
40b7d814c3 LibCore: Make CHttpJob::response() return a CHttpResponse*
We know that the CNetworkResponse inside a CHttpJob is always going to
be a CHttpResponse, so we can return a casted pointer to be nice. :^)
2019-12-10 20:46:33 +01:00
Valtteri Koskivuori
fe1df9e9fb LibC: Implement strtod() 2019-12-10 16:24:47 +01:00