about summary refs log tree commit diff stats
path: root/src/io/dynstream.nim
Commit message (Collapse)AuthorAgeFilesLines
* dynstream: fix memory leakbptato2024-10-041-2/+5
| | | | now I know why overloading dealloc felt wrong
* gopher: do not depend on libcurlbptato2024-09-281-1/+7
| | | | | | | | I'm thinking of making libcurl entirely optional; let's start with the easiest part. I've added a SOCKS5 client for ALL_PROXY support; I know curl supported others too, but whatever.
* dynstream: fix mmap bugsbptato2024-09-251-12/+16
| | | | ugh
* Replace std/selectors with pollbptato2024-09-231-0/+9
| | | | | | | | | | | | std/selectors uses OS-specific selector APIs, which sounds good in theory (faster than poll!), but sucks for portability in practice. Sure, you can fix portability bugs, but who knows how many there are on untested platforms... poll is standard, so if it works on one computer it should work on all other ones. (I hope.) As a bonus, I rewrote the timeout API for poll, which incidentally fixes setTimeout across forks. Also, SIGWINCH should now work on all platforms (as we self-pipe instead of signalfd/kqueue magic).
* client, forkserver, dynstream: misc refactorings, fixesbptato2024-09-231-1/+1
| | | | | | * fix broken int conversion in dynstream * fix EPIPE handling in forkserver * merge fdmap and connectingContainers into loader map
* loader: mmap intermediate image files, misc refactoringbptato2024-09-221-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor parseHeader * optimize response blob() * add direct "to cache" mode for loader requests which sets stdout to a file, and use it for image processing * move image resizing into a separate process * mmap cache files in between processing steps when possible At last, resize is no longer a part of image decoding. Also, it feels much nicer to keep encoded image data in the same cache as everything else. The mmap operations *should* be more efficient than copying the whole RGBA data through a pipe. In practice, it only makes a difference for loading (well, now just mmapping) the encoded image into the pager, where it singlehandedly speeds up image display by 10x on my test image. For the other steps, the unfortunate fact that "tocache" must delay the next fork/exec in the pipeline until the entire image is processed seems to equal out any wins we might have gotten from skipping a single raw RGBA copy. I have tried moving the delay before the exec (it's possible with yet another pipe), but it didn't help much and made the code much uglier. (Not that tocache didn't, but I can live with this...)
* loader: fix some fd leaksbptato2024-09-021-0/+9
| | | | + be a bit more paranoid about double closes
* Fixes for Nim 2.2bptato2024-07-291-0/+269
| | | | | | | | | * xmlhttprequest: fix missing import * painter: generic tuple workaround * dynstream: merge module with implementations (so it will work with vtables) Not enabling vtables yet since it doesn't work with refc.
* js: fix various leaks etc.bptato2024-05-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we didn't actually free the main JS runtime, probably because you can't do this without first waiting for JS to unwind the stack. (This has the unfortunate effect that code now *can* run after quit(). TODO: find a fix for this.) This isn't a huge problem per se, we only have one of these and the OS can clean it up. However, it also disabled the JS_FreeRuntime leak check, which resulted in sieve-like behavior (manual refcounting is a pain). So now we choose the other tradeoff: quit no longer runs exitnow, but it waits for the event loop to run to the end and only then exits the browser. Then, before exit we free the JS context & runtime, and also all JS values allocated by config. Fixes: * fix `ad' flag not being set for just one siteconf/omnirule * fix various leaks (since leak check is enabled now) * use ptr UncheckedArray[JSValue] for QJS bindings that take an array * allow JSAtom in jsgetprop etc., also disallow int types other than uint32 * do not set a destructor for globals
* pager: fix broken writeToFilebptato2024-03-291-0/+3
|
* io: derive DynStream from RootObj (not Stream)bptato2024-03-241-44/+26
| | | | | | | | This way they are no longer compatible, but we no longer need them to be compatible anyway. (This also forces us to throw out the old serialize module, and use packet writers everywhere.)
* bufreader: add initPacketReaderbptato2024-03-241-0/+7
|
* io: add bufreaderbptato2024-03-211-0/+7
| | | | analogous to bufwriter
* io: add BuferedWriterbptato2024-03-161-0/+3
| | | | | | | | | | Unsurprisingly enough, calling `write` a million times is never going to be very fast. BufferedWriter basically does the same thing as serialize.swrite did, but queues up writes in batches before sending them. TODO: give sread a similar treatment
* io: add dynstreambptato2024-03-121-0/+82
a new abstraction that we derive posixstream from; hopefully with time we can get rid of std/streams