Skip to content

dom: move the native fetch() to RuntimeContext to decrease the async handles#149

Merged
yorkie merged 1 commit intomainfrom
fix/native-fetch
Jul 28, 2025
Merged

dom: move the native fetch() to RuntimeContext to decrease the async handles#149
yorkie merged 1 commit intomainfrom
fix/native-fetch

Conversation

@yorkie
Copy link
Copy Markdown
Collaborator

@yorkie yorkie commented Jul 28, 2025

No description provided.

@yorkie yorkie requested a review from Copilot July 28, 2025 12:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/client/dom/runtime_context.cpp
Comment thread src/client/dom/runtime_context.cpp

void RuntimeContext::execFetchRequests()
{
unique_lock<shared_mutex> lock(pending_fetch_requests_mutex_);
Copy link

Copilot AI Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/client/dom/runtime_context.cpp
@yorkie yorkie merged commit 817d30d into main Jul 28, 2025
2 checks passed
@yorkie yorkie deleted the fix/native-fetch branch July 28, 2025 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants