Conversation
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
ckim1346
pushed a commit
that referenced
this pull request
Jul 7, 2026
…:ThreadPool (youtube#11184) CobaltPerformance memory measurement APIs (MeasureAvailableCpuMemory, MeasureUsedCpuMemory, MeasureUsedSwapMemory, MeasureReservedVirtualMemory) were executing synchronous system metrics queries and file reads on the Renderer thread sequence, causing UI thread stalls of up to 2.37 ms per invocation (11.04 ms total during trace analysis). This change wraps the system queries using base::ThreadPool::PostTaskAndReplyWithResult, ensuring system file reads run on a background thread pool without blocking the main Renderer message loop. ### Quantitative Performance Metrics (Optimization #1) 1. Invocation Frequency & Call Count: • MeasureUsedSwapMemory : Called 3 times during the trace period. • MeasureUsedCpuMemory : Called 2 times. • MeasureAvailableCpuMemory : Called 1 time. • MeasureReservedVirtualMemory : Called 1 time. • Total synchronous calls on Renderer thread sequence: 7 calls. 2. Main Thread Blocking Duration (CPU / IO Stall Savings): • MeasureUsedSwapMemory : 7.11 ms total (avg 2.37 ms per call). • MeasureUsedCpuMemory : 1.91 ms total (avg 0.96 ms per call). • MeasureAvailableCpuMemory : 1.24 ms total (1.24 ms per call). • MeasureReservedVirtualMemory : 0.78 ms total (0.78 ms per call). • Total direct Renderer thread blocking time saved: 11.04 ms (over 7 invocations). 3. Impact Summary for CL Description: • Before Change: Every call to window.performance memory metrics / H5VCC settings triggered synchronous system calls ( /proc file reads & system stats) on the Renderer message loop, blocking JavaScript execution by up to 2.37 ms per invocation (total 11.04 ms stall during the trace). • After Change: Memory metrics are queried off-thread via base::ThreadPool , reducing Chrome_InProcRendererThread blocking time to 0.00 ms for memory measurement API calls. Bug: 530222962
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.
This PR decouples Cobalt's dependency on WebXR, which is important in pruning Dawn/WebGPU. This is Step 2 of 3 to safely remove the heavy Dawn/WebGPU dependencies and achieve a significant binary size reduction on Android (~800 KB total). Pruning WebXR on top of WebNN shows an additional binary size decrease of ~278.5 KB (93,093,829 to 92,815,301 bytes), bringing total cumulative savings to ~557 KB.
Key Changes:
• Subtracted //third_party/blink/renderer/modules/xr from sub_modules in modules/BUILD.gn .
• Gated the xr dependency behind !is_cobalt in third_party/blink/renderer/modules/video_rvfc/BUILD.
• Subtracted the xr dependency in third_party/blink/renderer/modules/webgl/BUILD.gn for Cobalt builds
to ensure WebGL remains fully functional without WebXR.
• Added cobalt_webxr_exclude_patterns to bindings.gni to target v8_xr. and v8_xr_ .
• Filtered out generated WebXR V8 bindings in bindings/modules/v8/BUILD.gn (concatenated with
cobalt_webnn_exclude_patterns ) to prevent their compilation into libv8.a .
• Appended WebXR stubs (V8 wrappers and C++ entry points like XRSystem::From() returning nullptr ) to
cobalt_modules_stubs.cc .
Bug: 512589073