mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibHTML+Browser: Show the number of pending resource loads
For now this is simply a counter+hook exposed by ResourceLoader and shown in the Browser status bar. This is not very nuanced, and it would be nice to expose more info so we could eventually do something like a progress bar.
This commit is contained in:
@@ -35,7 +35,13 @@ void ResourceLoader::load(const URL& url, Function<void(const ByteBuffer&)> call
|
||||
request.set_url(url);
|
||||
request.set_method(CHttpRequest::Method::GET);
|
||||
auto job = request.schedule();
|
||||
job->on_finish = [job, callback = move(callback)](bool success) {
|
||||
++m_pending_loads;
|
||||
if (on_load_counter_change)
|
||||
on_load_counter_change();
|
||||
job->on_finish = [this, job, callback = move(callback)](bool success) {
|
||||
--m_pending_loads;
|
||||
if (on_load_counter_change)
|
||||
on_load_counter_change();
|
||||
if (!success) {
|
||||
dbg() << "HTTP job failed!";
|
||||
ASSERT_NOT_REACHED();
|
||||
|
||||
Reference in New Issue
Block a user