dom: move the native fetch() to RuntimeContext to decrease the async handles#149
Merged
dom: move the native fetch() to RuntimeContext to decrease the async handles#149
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the resource fetching mechanism by moving fetch functionality from individual HTMLElements to a centralized RuntimeContext, eliminating redundant async handles and improving thread safety for resource loading operations.
Key changes include:
- Consolidation of thread-safe fetch operations into RuntimeContext
- Removal of individual async handles from HTMLElement instances
- Simplification of image loading methods
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/client/layout/layout_object.cpp | Updates method call to use new unified fetch API |
| src/client/layout/layout_image.cpp | Simplifies image loading by removing async variant |
| src/client/html/html_image_element.hpp | Removes async image loading method declaration |
| src/client/html/html_image_element.cpp | Consolidates image loading logic into single method |
| src/client/html/html_element.hpp | Removes thread-safe fetch methods and related infrastructure |
| src/client/html/html_element.cpp | Removes async handle management and processing logic |
| src/client/dom/runtime_context.hpp | Adds centralized fetch request management |
| src/client/dom/runtime_context.cpp | Implements unified fetch request handling with thread safety |
|
|
||
| void RuntimeContext::execFetchRequests() | ||
| { | ||
| unique_lock<shared_mutex> lock(pending_fetch_requests_mutex_); |
There was a problem hiding this comment.
Same issue as above - using unique_lock with shared_mutex may be overly restrictive. Since this method modifies the deque, unique_lock is correct here, but consider if a regular mutex would be more appropriate for this use case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.