[SVG] Introduce a registry for managing `AgentGroupScheduler` and `SVGDocumentResourceTracker` [chromium/src : main]

0 views
Skip to first unread message

Divyansh Mangal (Gerrit)

unread,
Feb 3, 2026, 3:30:51 AMFeb 3
to Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Vinay Singh and Virali Purbey

Divyansh Mangal added 2 comments

Commit Message
Line 8, Patchset 16:`SVGDocumentResourcTracker`
Virali Purbey . resolved

nit: `SVGDocumentResourceTracker`

Divyansh Mangal

Done

Line 35, Patchset 16:3) Cleanup of `SVGDocumentResourcTracker` is now the responsibility
Virali Purbey . resolved

nit: `SVGDocumentResourceTracker`

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 17
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 08:30:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Virali Purbey <virali...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 3, 2026, 7:47:21 AMFeb 3
to Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Vinay Singh and Virali Purbey

Divyansh Mangal added 8 comments

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.h
Line 44, Patchset 16: // TODO(dmangal): Below constructor with cache identifier can be removed when
// feature `SvgPartitionSVGDocumentResourcesInMemoryCache` is fully launched.
Virali Purbey . resolved

The feature flag is marked as stable and still we mention we will remove this once feature is fully launched. Can you please add more details about this in the description?

Divyansh Mangal

Apologies for the confusion, I meant it would be safe to remove the constructor during feature flag removal (after two releases). There's a similar TODO at
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/svg_document_resource_tracker.h;drc=0047c18af00c7f8cb2e93d6084158e70720b5ed5;l=71

(I don't think this is needed to be mentioned in the description for this CL, but I have rephrased the comment to better reflect this understanding)

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
Line 36, Patchset 16:String GenerateGUID() {
Virali Purbey . resolved

Can we rename it as `GenerateCacheIdentifier()`?

Divyansh Mangal

Sounds good

Line 99, Patchset 16:void SVGDocumentResourceTracker::ClearTracker() {
Virali Purbey . unresolved

Can we add a DCHECK to see if `entries_` are empty?

Divyansh Mangal

`entries_` member will eventually be removed (during feature flag removal), and it will definitely be empty when feature flag is on, so I think this check will be redundant, but let me know if you think otherwise.

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 296, Patchset 16: if (!registry->HasTrackerForScheduler(agent_group_scheduler)) {
Virali Purbey . unresolved

We always have to check if the scheduler has tracker, return it otherwise create it. Can we move this logic to registry itself to avoid duplicate code and call it `GetOrCreateTrackerForScheduler()`?

Divyansh Mangal

This was a little tricky due to the dependency problem discussed in https://chromium-review.googlesource.com/c/chromium/src/+/7239586/comment/b75d9fdf_5a3d4509/

but a template function came handy here, let me know what you think of this?

File third_party/blink/renderer/core/svg/svg_resource_document_content_test.cc
Line 34, Patchset 16: *SVGResourceSchedulerRegistry::Get()->GetTrackerForScheduler(
Virali Purbey . unresolved

Since this is a singleton class, can we have `ClearForTesting()` to clear scheduler_tracker_map_ (guarded under test build flags) or provide a way to destroy/recreate the singleton in tests.

Divyansh Mangal

`SVGResourceSchedulerRegistry` is garbage collected so I believe it should clear the memory during destruction,

The main reason I don't want to create explicit `ClearForTesting` was to make sure that we are clearing/unregistring the tracker at the correct place. Currently the unregistration is done at `AgentGroupScheduler::Dispose()`, if the tests require such clearing explicitly they can be added but for now i believe it should be ok to have this as-is. Let me know if you want to discuss on this further.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.cc
Line 16, Patchset 16:SVGResourceSchedulerRegistry* SVGResourceSchedulerRegistry::Get() {
Virali Purbey . resolved

Can we add a `DCHECK(IsMainThread())` in these functions (`Get()`, `RegisterSchedulerTracker()`, `UnregisterScheduler()`, `GetTrackerForScheduler()`) as we will be calling these from main thread?

Divyansh Mangal

Done

Line 33, Patchset 16:void SVGResourceSchedulerRegistry::RegisterSchedulerTracker(
Virali Purbey . resolved

I know we are checking if `scheduler_tracker_map_` contains has any tracker for scheduler but can we add a DCHECK ` DCHECK(!scheduler_tracker_map_.Contains(scheduler))` to make sure that we are never overridding the value?

Divyansh Mangal

Done

File third_party/blink/renderer/platform/scheduler/public/svg_document_resource_tracker_base.h
Line 13, Patchset 16:class PLATFORM_EXPORT SVGDocumentResourceTrackerBase
Virali Purbey . unresolved

Was there a specific need to create a base class here?

Divyansh Mangal

`svg_dcoument_resource_tracker` is in `core` directory whereas our new class `svg_resource_scheduler_registry` is at `platform` directory, by design
no class of `core` can be used in `platform` (it ends up created cyclic dependencies and linking errors). But vice-versa, that is classes in `platform` can be freely used in `core`.

As such to go around this problem, I created this base class, and made the already exisiting `svg_document_resource_tracker` inherited from it, so that
`AgentGroupScheduler` and `SVGDocumentResourceTrackerBase` can instead be used as key-value pair in registry without any linking errors.


This was one way to go around the dependency issue that I could think of, let me know if you want to discuss on this.

Open in Gerrit

Related details

Attention is currently required from:
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 18
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 12:46:47 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Vinay Singh (Gerrit)

unread,
Feb 4, 2026, 5:16:07 AMFeb 4
to Divyansh Mangal, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal and Virali Purbey

Vinay Singh added 5 comments

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 297, Patchset 19 (Latest): registry->GetOrCreateTrackerForScheduler(
agent_group_scheduler, [&page]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(
page->GetPageScheduler()
->GetAgentGroupScheduler()
.DefaultTaskRunner());
Vinay Singh . unresolved
```
auto task_runner = page->GetPageScheduler()
->GetAgentGroupScheduler()
.DefaultTaskRunner();
registry->GetOrCreateTrackerForScheduler(
agent_group_scheduler,
[task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
});
```

Looks slightly cleaner.
Also, `GetOrCreateTrackerForScheduler` is no longer susceptible to hold a lamba with page reference param.

Line 308, Patchset 19 (Latest): auto& cache = *tracker;
Vinay Singh . unresolved

Let's keep the `tracker` only. No need of additional `cache` variable.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Line 61, Patchset 19 (Latest): if (SVGDocumentResourceTrackerBase* tracker =
GetTrackerForScheduler(scheduler)) {
return tracker;
}
SVGDocumentResourceTrackerBase* new_tracker = create_tracker();
RegisterSchedulerTracker(scheduler, new_tracker);
return new_tracker;
Vinay Singh . unresolved
```suggestion
SVGDocumentResourceTrackerBase* tracker = GetTrackerForScheduler(scheduler)
if (!tracker) {
tracker = create_tracker();
RegisterSchedulerTracker(scheduler, tracker );
}

return tracker;
```
Line 20, Patchset 19 (Latest):// SVGDocumentResourceTracker instances. This enables coordinated resource
// loading and scheduling for SVG documents within each agent group.
Vinay Singh . unresolved

Consider "This ties the SVG resource lifecycle with the AgentGroupScheduler."
Feel free to use your judgement though.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.cc
Line 63, Patchset 19 (Latest): return it != scheduler_tracker_map_.end() ? it->value : nullptr;
Vinay Singh . unresolved

Make sure the code has enough defensive checks in case this returns `nullptr`

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 19
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Wed, 04 Feb 2026 10:15:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 5, 2026, 7:59:11 AMFeb 5
to Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Fredrik Söderquist, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Vinay Singh and Virali Purbey

Divyansh Mangal added 5 comments

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 297, Patchset 19: registry->GetOrCreateTrackerForScheduler(

agent_group_scheduler, [&page]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(
page->GetPageScheduler()
->GetAgentGroupScheduler()
.DefaultTaskRunner());
Vinay Singh . resolved
```
auto task_runner = page->GetPageScheduler()
->GetAgentGroupScheduler()
.DefaultTaskRunner();
registry->GetOrCreateTrackerForScheduler(
agent_group_scheduler,
[task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
});
```

Looks slightly cleaner.
Also, `GetOrCreateTrackerForScheduler` is no longer susceptible to hold a lamba with page reference param.

Divyansh Mangal

Done

Line 308, Patchset 19: auto& cache = *tracker;
Vinay Singh . resolved

Let's keep the `tracker` only. No need of additional `cache` variable.

Divyansh Mangal

Done

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Line 61, Patchset 19: if (SVGDocumentResourceTrackerBase* tracker =

GetTrackerForScheduler(scheduler)) {
return tracker;
}
SVGDocumentResourceTrackerBase* new_tracker = create_tracker();
RegisterSchedulerTracker(scheduler, new_tracker);
return new_tracker;
Vinay Singh . resolved
```suggestion
SVGDocumentResourceTrackerBase* tracker = GetTrackerForScheduler(scheduler)
if (!tracker) {
tracker = create_tracker();
RegisterSchedulerTracker(scheduler, tracker );
}

return tracker;
```
Divyansh Mangal

Done

Line 20, Patchset 19:// SVGDocumentResourceTracker instances. This enables coordinated resource

// loading and scheduling for SVG documents within each agent group.
Vinay Singh . resolved

Consider "This ties the SVG resource lifecycle with the AgentGroupScheduler."
Feel free to use your judgement though.

Divyansh Mangal

Done

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.cc
Line 63, Patchset 19: return it != scheduler_tracker_map_.end() ? it->value : nullptr;
Vinay Singh . resolved

Make sure the code has enough defensive checks in case this returns `nullptr`

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 21
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Fredrik Söderquist <f...@opera.com>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Comment-Date: Thu, 05 Feb 2026 12:58:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Vinay Singh <vinay...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 6, 2026, 6:45:06 AMFeb 6
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 21
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Fri, 06 Feb 2026 11:44:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Feb 6, 2026, 8:01:11 AMFeb 6
to Divyansh Mangal, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 4 comments

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 290, Patchset 21 (Latest): if (RuntimeEnabledFeatures::
SvgPartitionSVGDocumentResourcesInMemoryCacheEnabled()) {
AgentGroupScheduler* agent_group_scheduler =
&page->GetAgentGroupScheduler();
auto* registry = SVGResourceSchedulerRegistry::Get();
auto task_runner =
page->GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

tracker = static_cast<SVGDocumentResourceTracker*>(

registry->GetOrCreateTrackerForScheduler(
agent_group_scheduler, [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(
task_runner);
}));
} else {
tracker = &page->GetSVGDocumentResourceTracker();
}
Fredrik Söderquist . unresolved

You could use a technique similar to what you do in the test here as well. To allow keeping it a reference.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
File-level comment, Patchset 21 (Latest):
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.cc
Line 13, Patchset 21 (Latest):static Persistent<SVGResourceSchedulerRegistry>*
g_svg_resource_scheduler_registry;
Fredrik Söderquist . unresolved

Use `DEFINE_STATIC_LOCAL` in function scope instead if you need a global like this.

Line 49, Patchset 21 (Latest): if (!HasTrackerForScheduler(scheduler)) {
return;
}

GetTrackerForScheduler(scheduler)->ClearTracker();
scheduler_tracker_map_.erase(scheduler);
Fredrik Söderquist . unresolved

This has three hash-lookups when it could have one.

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Fri, 06 Feb 2026 13:00:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 6, 2026, 5:31:08 PMFeb 6
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1755067b710000

Gerrit-Comment-Date: Fri, 06 Feb 2026 22:30:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 8, 2026, 6:17:50 AM (14 days ago) Feb 8
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12b9a960f10000

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 23
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Sun, 08 Feb 2026 11:17:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 8, 2026, 6:19:20 AM (14 days ago) Feb 8
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/11c4a3ad710000

Gerrit-Comment-Date: Sun, 08 Feb 2026 11:19:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 8, 2026, 6:21:10 AM (14 days ago) Feb 8
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/12909d64f10000

Gerrit-Comment-Date: Sun, 08 Feb 2026 11:20:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 8, 2026, 6:23:45 AM (14 days ago) Feb 8
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/173c99ad710000

Gerrit-Comment-Date: Sun, 08 Feb 2026 11:23:32 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
Feb 8, 2026, 6:23:47 AM (14 days ago) Feb 8
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Message from chrom...@appspot.gserviceaccount.com

📍 Job mac-m1_mini_2020-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/17f48e54f10000

Gerrit-Comment-Date: Sun, 08 Feb 2026 11:23:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 8, 2026, 7:05:11 AM (14 days ago) Feb 8
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 3 comments

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 290, Patchset 21: if (RuntimeEnabledFeatures::

SvgPartitionSVGDocumentResourcesInMemoryCacheEnabled()) {
AgentGroupScheduler* agent_group_scheduler =
&page->GetAgentGroupScheduler();
auto* registry = SVGResourceSchedulerRegistry::Get();
auto task_runner =
page->GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

tracker = static_cast<SVGDocumentResourceTracker*>(
registry->GetOrCreateTrackerForScheduler(
agent_group_scheduler, [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(
task_runner);
}));
} else {
tracker = &page->GetSVGDocumentResourceTracker();
}
Fredrik Söderquist . resolved

You could use a technique similar to what you do in the test here as well. To allow keeping it a reference.

Divyansh Mangal

Done

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.cc
Line 13, Patchset 21:static Persistent<SVGResourceSchedulerRegistry>*
g_svg_resource_scheduler_registry;
Fredrik Söderquist . resolved

Use `DEFINE_STATIC_LOCAL` in function scope instead if you need a global like this.

Divyansh Mangal

Done

Line 49, Patchset 21: if (!HasTrackerForScheduler(scheduler)) {
return;
}

GetTrackerForScheduler(scheduler)->ClearTracker();
scheduler_tracker_map_.erase(scheduler);
Fredrik Söderquist . resolved

This has three hash-lookups when it could have one.

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 24
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Sun, 08 Feb 2026 12:04:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 9, 2026, 12:59:07 AM (13 days ago) Feb 9
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/platform/scheduler/public/svg_document_resource_tracker_base.h
Line 13, Patchset 16:class PLATFORM_EXPORT SVGDocumentResourceTrackerBase
Virali Purbey . resolved

Was there a specific need to create a base class here?

Divyansh Mangal

`svg_dcoument_resource_tracker` is in `core` directory whereas our new class `svg_resource_scheduler_registry` is at `platform` directory, by design
no class of `core` can be used in `platform` (it ends up created cyclic dependencies and linking errors). But vice-versa, that is classes in `platform` can be freely used in `core`.

As such to go around this problem, I created this base class, and made the already exisiting `svg_document_resource_tracker` inherited from it, so that
`AgentGroupScheduler` and `SVGDocumentResourceTrackerBase` can instead be used as key-value pair in registry without any linking errors.


This was one way to go around the dependency issue that I could think of, let me know if you want to discuss on this.

Divyansh Mangal

We are moving towards weak coupling of members hence this base class is no longer needed.
Please see the discussion on for details:
https://chromium-review.googlesource.com/c/chromium/src/+/7239586/comment/34331345_78eef7e0/

Closing this thread but let me know if you have any doubts

Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 27
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Mon, 09 Feb 2026 05:58:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Virali Purbey <virali...@microsoft.com>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Virali Purbey (Gerrit)

unread,
Feb 9, 2026, 3:08:06 AM (13 days ago) Feb 9
to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Fredrik Söderquist and Vinay Singh

Virali Purbey added 2 comments

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
Line 99, Patchset 16:void SVGDocumentResourceTracker::ClearTracker() {
Virali Purbey . resolved

Can we add a DCHECK to see if `entries_` are empty?

Divyansh Mangal

`entries_` member will eventually be removed (during feature flag removal), and it will definitely be empty when feature flag is on, so I think this check will be redundant, but let me know if you think otherwise.

Virali Purbey

Done

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 296, Patchset 16: if (!registry->HasTrackerForScheduler(agent_group_scheduler)) {
Virali Purbey . resolved

We always have to check if the scheduler has tracker, return it otherwise create it. Can we move this logic to registry itself to avoid duplicate code and call it `GetOrCreateTrackerForScheduler()`?

Divyansh Mangal

This was a little tricky due to the dependency problem discussed in https://chromium-review.googlesource.com/c/chromium/src/+/7239586/comment/b75d9fdf_5a3d4509/

but a template function came handy here, let me know what you think of this?

Virali Purbey

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Fredrik Söderquist
  • Vinay Singh
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Mon, 09 Feb 2026 08:07:36 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 9, 2026, 3:55:22 AM (13 days ago) Feb 9
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist and Vinay Singh

Divyansh Mangal added 1 comment

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
Gerrit-Comment-Date: Mon, 09 Feb 2026 08:54:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Feb 9, 2026, 10:54:12 AM (13 days ago) Feb 9
to Divyansh Mangal, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal and Vinay Singh

Fredrik Söderquist added 14 comments

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.h
Line 43, Patchset 27 (Latest): // TODO(dmangal): Below constructor with cache identifier can be removed
// during feature flag removal.
Fredrik Söderquist . unresolved

Couldn't we just keep using this one for both cases, and then do the folding when removing the flag? That avoids duplicating code.

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
Line 99, Patchset 27 (Latest):void SVGDocumentResourceTracker::ClearTracker() {
Fredrik Söderquist . unresolved

I think I'd call this `Dispose()` instead to better signal that the object is going away.

Line 100, Patchset 27 (Latest): for (const auto& resource : tracked_resources_) {
resource->GetContent()->Dispose();
}
Fredrik Söderquist . resolved

I hope this will be fine to do during as part of the weak-callback, but this function does a lot of things, so it's difficult to say. A pre-finalizer potentially has similar issues though. So consider this a heads up if any issues arise.

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 67, Patchset 27 (Latest): auto task_runner =
page.GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

return *registry->GetOrCreateTrackerForScheduler(
&page.GetAgentGroupScheduler(), [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
Fredrik Söderquist . unresolved

Passing in the task-runner seems a bit unnecessary, because it's just `DefaultTaskRunner()` on the "key".

Line 66, Patchset 27 (Latest): auto* registry = SVGResourceSchedulerRegistry::Get();
auto task_runner =
page.GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

return *registry->GetOrCreateTrackerForScheduler(
&page.GetAgentGroupScheduler(), [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
});
Fredrik Söderquist . unresolved

Why not fold this into `Page::GetSVGDocumentResourceTracker()`? Then the change becomes smaller, and we could even cache the reference there (and thus not need to do a hash-lookup everytime we need it).

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 61, Patchset 27 (Latest): SVGDocumentResourceTracker* tracker = GetTrackerForScheduler(scheduler);

if (!tracker) {
tracker = create_tracker();
RegisterSchedulerTracker(scheduler, tracker);
}
Fredrik Söderquist . unresolved

Then this could be implemented using a single `insert()`.

Line 53, Patchset 27 (Latest): // Returns the tracker for the given scheduler, creating one using the
// provided callback if it doesn't exist.
Fredrik Söderquist . unresolved

What's the callback good for? It seems easier to just fold that into the function. The dependency is already there.


Also...

Line 46, Patchset 27 (Latest): // Returns true if the given scheduler has an associated tracker.
bool HasTrackerForScheduler(AgentGroupScheduler* scheduler) const;
Fredrik Söderquist . unresolved

Is this used? I see one use in a `DCHECK` - that could be replaced with checking a return value instead.

Line 36, Patchset 27 (Latest): // Associates an AgentGroupScheduler with an SVGDocumentResourceTracker.
// If the scheduler is already registered, updates its tracker.
void RegisterSchedulerTracker(AgentGroupScheduler* scheduler,
SVGDocumentResourceTracker* tracker);
Fredrik Söderquist . unresolved

This should be an internal detail - nothing should call this except `GetOrCreateTrackerForScheduler`.

Line 32, Patchset 27 (Latest): static SVGResourceSchedulerRegistry* Get();
Fredrik Söderquist . unresolved

Can return a reference. I think you could also just make `GetTrackerForScheduler()` static, and then not need to expose this here.

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.cc
Line 11, Patchset 27 (Latest):#include "third_party/blink/renderer/platform/wtf/static_constructors.h"
Fredrik Söderquist . unresolved

You don't need this. `DEFINE_STATIC_LOCAL` is in `std_lib_extras.h`.

Line 61, Patchset 27 (Latest): if (pair.value) {
Fredrik Söderquist . unresolved

When would this be null?

Line 66, Patchset 27 (Latest): for (const auto& scheduler : dead_schedulers) {
scheduler_tracker_map_.erase(scheduler);
}
Fredrik Söderquist . unresolved
```suggestion
scheduler_tracker_map_.RemoveAll(dead_schedulers);
```
File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Fredrik Söderquist

How have you tested this? I _think_ thsi may need to use `UntracedMember` rather than `WeakMember`.

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Mon, 09 Feb 2026 15:54:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 10, 2026, 10:26:27 AM (12 days ago) Feb 10
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 14 comments

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.h
Line 43, Patchset 27: // TODO(dmangal): Below constructor with cache identifier can be removed

// during feature flag removal.
Fredrik Söderquist . resolved

Couldn't we just keep using this one for both cases, and then do the folding when removing the flag? That avoids duplicating code.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
Line 99, Patchset 27:void SVGDocumentResourceTracker::ClearTracker() {
Fredrik Söderquist . resolved

I think I'd call this `Dispose()` instead to better signal that the object is going away.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_resource_document_content.cc
Line 67, Patchset 27: auto task_runner =

page.GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

return *registry->GetOrCreateTrackerForScheduler(
&page.GetAgentGroupScheduler(), [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
Fredrik Söderquist . resolved

Passing in the task-runner seems a bit unnecessary, because it's just `DefaultTaskRunner()` on the "key".

Divyansh Mangal

Folded this into `Page::GetSVGDocumentResourceTracker()` so this no longer was needed.

Line 66, Patchset 27: auto* registry = SVGResourceSchedulerRegistry::Get();

auto task_runner =
page.GetPageScheduler()->GetAgentGroupScheduler().DefaultTaskRunner();

return *registry->GetOrCreateTrackerForScheduler(
&page.GetAgentGroupScheduler(), [task_runner]() {
return MakeGarbageCollected<SVGDocumentResourceTracker>(task_runner);
});
Fredrik Söderquist . resolved

Why not fold this into `Page::GetSVGDocumentResourceTracker()`? Then the change becomes smaller, and we could even cache the reference there (and thus not need to do a hash-lookup everytime we need it).

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_resource_document_content_test.cc
Line 34, Patchset 16: *SVGResourceSchedulerRegistry::Get()->GetTrackerForScheduler(
Virali Purbey . resolved

Since this is a singleton class, can we have `ClearForTesting()` to clear scheduler_tracker_map_ (guarded under test build flags) or provide a way to destroy/recreate the singleton in tests.

Divyansh Mangal

`SVGResourceSchedulerRegistry` is garbage collected so I believe it should clear the memory during destruction,

The main reason I don't want to create explicit `ClearForTesting` was to make sure that we are clearing/unregistring the tracker at the correct place. Currently the unregistration is done at `AgentGroupScheduler::Dispose()`, if the tests require such clearing explicitly they can be added but for now i believe it should be ok to have this as-is. Let me know if you want to discuss on this further.

Divyansh Mangal

Done

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 61, Patchset 27: SVGDocumentResourceTracker* tracker = GetTrackerForScheduler(scheduler);

if (!tracker) {
tracker = create_tracker();
RegisterSchedulerTracker(scheduler, tracker);
}
Fredrik Söderquist . resolved

Then this could be implemented using a single `insert()`.

Divyansh Mangal

Used `Set` in the simplified code

Line 53, Patchset 27: // Returns the tracker for the given scheduler, creating one using the

// provided callback if it doesn't exist.
Fredrik Söderquist . resolved

What's the callback good for? It seems easier to just fold that into the function. The dependency is already there.


Also...

Divyansh Mangal

No longer needed as we are now in `core` directory

Line 46, Patchset 27: // Returns true if the given scheduler has an associated tracker.
bool HasTrackerForScheduler(AgentGroupScheduler* scheduler) const;
Fredrik Söderquist . resolved

Is this used? I see one use in a `DCHECK` - that could be replaced with checking a return value instead.

Divyansh Mangal

Done

Line 36, Patchset 27: // Associates an AgentGroupScheduler with an SVGDocumentResourceTracker.

// If the scheduler is already registered, updates its tracker.
void RegisterSchedulerTracker(AgentGroupScheduler* scheduler,
SVGDocumentResourceTracker* tracker);
Fredrik Söderquist . resolved

This should be an internal detail - nothing should call this except `GetOrCreateTrackerForScheduler`.

Divyansh Mangal

Done

Line 32, Patchset 27: static SVGResourceSchedulerRegistry* Get();
Fredrik Söderquist . unresolved

Can return a reference. I think you could also just make `GetTrackerForScheduler()` static, and then not need to expose this here.

Divyansh Mangal

I tried making it static (as per the current Patchset `GetOrCreateTrackerForScheduler` was tried to made static) but it uses the instance variable scheduler_tracker_map_ so got compiler errors.

I have still kept the `SVGResourceSchedulerRegistry::Get()` cause making instance variable scheduler_tracker_map_ static seemed incorrect, but let me know what you think of this?

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.cc
Line 11, Patchset 27:#include "third_party/blink/renderer/platform/wtf/static_constructors.h"
Fredrik Söderquist . resolved

You don't need this. `DEFINE_STATIC_LOCAL` is in `std_lib_extras.h`.

Divyansh Mangal

Done

Line 61, Patchset 27: if (pair.value) {
Fredrik Söderquist . resolved

When would this be null?

Divyansh Mangal

You are right, this shouldn't be null, probably a DCHECK make more sense here,

Line 66, Patchset 27: for (const auto& scheduler : dead_schedulers) {
scheduler_tracker_map_.erase(scheduler);
}
Fredrik Söderquist . resolved
```suggestion
scheduler_tracker_map_.RemoveAll(dead_schedulers);
```
Divyansh Mangal

Done

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Fredrik Söderquist

How have you tested this? I _think_ thsi may need to use `UntracedMember` rather than `WeakMember`.

Divyansh Mangal

I mainly did manual testing locally, based on the examples in bugs:
https://issues.chromium.org/issues/360599258
https://issues.chromium.org/issues/459746761
(Also did testing when RenderDocument is enabled)

I have also used `UntracedMember` in the latest patchset

Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 29
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Tue, 10 Feb 2026 15:26:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Virali Purbey <virali...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 10, 2026, 10:30:44 AM (12 days ago) Feb 10
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 1 comment

File third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
Line 100, Patchset 27: for (const auto& resource : tracked_resources_) {
resource->GetContent()->Dispose();
}
Fredrik Söderquist . resolved

I hope this will be fine to do during as part of the weak-callback, but this function does a lot of things, so it's difficult to say. A pre-finalizer potentially has similar issues though. So consider this a heads up if any issues arise.

Divyansh Mangal

Thanks for the heads‑up, I mainly relied on the existing tests in svg_resource_document_content_test.cc along with some manual testing across a few scenarios. I agree that this may not cover every edge case, but I’ll keep a close eye on things and follow up if any issues surface after the merge of this change

Gerrit-Comment-Date: Tue, 10 Feb 2026 15:30:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Feb 10, 2026, 11:54:58 AM (12 days ago) Feb 10
to Divyansh Mangal, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist added 2 comments

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 32, Patchset 27: static SVGResourceSchedulerRegistry* Get();
Fredrik Söderquist . unresolved

Can return a reference. I think you could also just make `GetTrackerForScheduler()` static, and then not need to expose this here.

Divyansh Mangal

I tried making it static (as per the current Patchset `GetOrCreateTrackerForScheduler` was tried to made static) but it uses the instance variable scheduler_tracker_map_ so got compiler errors.

I have still kept the `SVGResourceSchedulerRegistry::Get()` cause making instance variable scheduler_tracker_map_ static seemed incorrect, but let me know what you think of this?

Fredrik Söderquist

How to make this static:

.h file:
```
...
static SVGDocumentResourceTracker* GetTracker(AgentGroupScheduler&);
...
```

.cc file:
```
...
namespace {

class RegistryHolder : public GarbageCollected<RegistryHolder> {
public:
...
MapType& GetMap() { ... }
...
 private:
MapType map_;
};
MapType& GetTrackerMap() {
DCHECK(IsMainThread());
DEFINE_STATIC_LOCAL(Persistent<RegistryHolder>, holder,
(MakeGarbageCollected<RegistryHolder>()));
return registry->GetMap();
}

} // namespace

SVGDocumentResourceTracker*
SVGResourceSchedulerRegistry::GetTracker(AgentGroupScheduler& scheduler) {
MapType& map = GetTrackerMap();
  auto it = map.find(&scheduler);
...
}
...
```
File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Fredrik Söderquist

How have you tested this? I _think_ thsi may need to use `UntracedMember` rather than `WeakMember`.

Divyansh Mangal

I mainly did manual testing locally, based on the examples in bugs:
https://issues.chromium.org/issues/360599258
https://issues.chromium.org/issues/459746761
(Also did testing when RenderDocument is enabled)

I have also used `UntracedMember` in the latest patchset

Fredrik Söderquist

Did you verify that cleanup happened as expected? (`Dispose()` being called etc.)

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 30
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Tue, 10 Feb 2026 16:54:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Fredrik Söderquist <f...@opera.com>
Comment-In-Reply-To: Divyansh Mangal <dma...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 10, 2026, 1:50:33 PM (12 days ago) Feb 10
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Fredrik Söderquist, Vinay Singh and Virali Purbey

Divyansh Mangal added 2 comments

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 32, Patchset 27: static SVGResourceSchedulerRegistry* Get();
Fredrik Söderquist . resolved
Divyansh Mangal

Thanks for the awesome suggestion!, I incorporated the same in the registry.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
Fredrik Söderquist . unresolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Fredrik Söderquist

How have you tested this? I _think_ thsi may need to use `UntracedMember` rather than `WeakMember`.

Divyansh Mangal

I mainly did manual testing locally, based on the examples in bugs:
https://issues.chromium.org/issues/360599258
https://issues.chromium.org/issues/459746761
(Also did testing when RenderDocument is enabled)

I have also used `UntracedMember` in the latest patchset

Fredrik Söderquist

Did you verify that cleanup happened as expected? (`Dispose()` being called etc.)

Divyansh Mangal

Yes, `Dispose()` indeed gets called correctly when I changed to `UntracedMember`, I checked by adding breakpoints for the tests in third_party\blink\renderer\core\svg\svg_resource_document_content_test.cc

Open in Gerrit

Related details

Attention is currently required from:
  • Fredrik Söderquist
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 31
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Fredrik Söderquist <f...@opera.com>
Gerrit-Comment-Date: Tue, 10 Feb 2026 18:50:00 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Fredrik Söderquist (Gerrit)

unread,
Feb 11, 2026, 7:13:54 AM (11 days ago) Feb 11
to Divyansh Mangal, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Divyansh Mangal, Vinay Singh and Virali Purbey

Fredrik Söderquist voted and added 3 comments

Votes added by Fredrik Söderquist

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 31 (Latest):
Fredrik Söderquist . resolved

LGTM w/ nit

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 22, Patchset 31 (Latest): : public GarbageCollected<SVGResourceSchedulerRegistry> {
Fredrik Söderquist . unresolved

You don't need this now (ditto for the `Trace()`.

File third_party/blink/renderer/platform/scheduler/main_thread/svg_resource_scheduler_registry.h
File-level comment, Patchset 21:
Fredrik Söderquist . resolved

We shouldn't have anything "SVG" in `platform/`. Prefer weak coupling instead. It might also be possible to just observe garbage collection as well.

Divyansh Mangal

Thanks for letting me know about this, the only reason I needed the files in `platform` because a good place to clear the corresponding tracker that I could find was in `AgentGroupSchedulerImpl::Dispose` (when AgentGroupScheduler is getting disposed).

In the new patchset I have moved these new files from `platform` level to `core` and instead made the key in hashmap as a weakMember
```
HeapHashMap<WeakMember<AgentGroupScheduler>,
Member<SVGDocumentResourceTracker>> scheduler_tracker_map_;
```
and introduced a weak callback method `ProcessCustomWeakness` which calls the `ClearTracker` function during GC cycle. Let me know what you think of this and if any improvements are needed.
Fredrik Söderquist

How have you tested this? I _think_ thsi may need to use `UntracedMember` rather than `WeakMember`.

Divyansh Mangal

I mainly did manual testing locally, based on the examples in bugs:
https://issues.chromium.org/issues/360599258
https://issues.chromium.org/issues/459746761
(Also did testing when RenderDocument is enabled)

I have also used `UntracedMember` in the latest patchset

Fredrik Söderquist

Did you verify that cleanup happened as expected? (`Dispose()` being called etc.)

Divyansh Mangal

Yes, `Dispose()` indeed gets called correctly when I changed to `UntracedMember`, I checked by adding breakpoints for the tests in third_party\blink\renderer\core\svg\svg_resource_document_content_test.cc

Fredrik Söderquist

Excellent, thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Divyansh Mangal
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
Gerrit-Change-Number: 7239586
Gerrit-PatchSet: 31
Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
Gerrit-Attention: Divyansh Mangal <dma...@microsoft.com>
Gerrit-Comment-Date: Wed, 11 Feb 2026 12:13:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Divyansh Mangal (Gerrit)

unread,
Feb 12, 2026, 10:58:04 AM (10 days ago) Feb 12
to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
Attention needed from Vinay Singh and Virali Purbey

Divyansh Mangal voted and added 1 comment

Votes added by Divyansh Mangal

Commit-Queue+1

1 comment

File third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
Line 22, Patchset 31: : public GarbageCollected<SVGResourceSchedulerRegistry> {
Fredrik Söderquist . resolved

You don't need this now (ditto for the `Trace()`.

Divyansh Mangal

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Vinay Singh
  • Virali Purbey
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
    Gerrit-Change-Number: 7239586
    Gerrit-PatchSet: 32
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    Gerrit-CC: Dileep Maurya <dileep...@microsoft.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Gaurav Kumar <gaur...@microsoft.com>
    Gerrit-CC: Ragvesh Sharma <rags...@microsoft.com>
    Gerrit-CC: Sejal Anand <sejal...@microsoft.com>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Attention: Virali Purbey <virali...@microsoft.com>
    Gerrit-Comment-Date: Thu, 12 Feb 2026 15:57:29 +0000
    satisfied_requirement
    open
    diffy

    Divyansh Mangal (Gerrit)

    unread,
    Feb 13, 2026, 2:44:16 AM (9 days ago) Feb 13
    to Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org
    Attention needed from Vinay Singh and Virali Purbey

    Divyansh Mangal voted Commit-Queue+2

    Commit-Queue+2
    Gerrit-Comment-Date: Fri, 13 Feb 2026 07:43:45 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Feb 13, 2026, 2:59:33 AM (9 days ago) Feb 13
    to Divyansh Mangal, Fredrik Söderquist, Vinay Singh, Virali Purbey, Sejal Anand, Dileep Maurya, Gaurav Kumar, Ragvesh Sharma, chrom...@appspot.gserviceaccount.com, chromium...@chromium.org, Dirk Schulze, Stephen Chenney, blink-isola...@chromium.org, blink-...@chromium.org, chikamu...@chromium.org, fmalit...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, kouhe...@chromium.org, pdr+svgw...@chromium.org, scheduler-...@chromium.org

    Chromium LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    31 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
    Insertions: 1, Deletions: 4.

    @@ -18,8 +18,7 @@
    // AgentGroupScheduler instances and their corresponding
    // SVGDocumentResourceTracker instances. This ties the SVG resource lifecycle
    // with the AgentGroupScheduler.
    -class CORE_EXPORT SVGResourceSchedulerRegistry final
    - : public GarbageCollected<SVGResourceSchedulerRegistry> {
    +class CORE_EXPORT SVGResourceSchedulerRegistry final {
    public:
    SVGResourceSchedulerRegistry() = default;
    ~SVGResourceSchedulerRegistry() = default;
    @@ -31,8 +30,6 @@
    // Returns the tracker for the given scheduler, creating one if the tracker
    // doesn't exist.
    static SVGDocumentResourceTracker* GetTracker(AgentGroupScheduler& scheduler);
    -
    - void Trace(Visitor*) const {}
    };

    } // namespace blink
    ```

    Change information

    Commit message:
    [SVG] Introduce a registry for managing `AgentGroupScheduler` and
    `SVGDocumentResourceTracker`

    In CL:6807690, we transitioned SVG resource handling from a local
    cache-based architecture to leverage the existing `MemoryCache` data
    structure. This resolved issues where SVG resources were not
    refreshed on reload, under the assumption that reloads would not
    create new `Page` objects.

    However, CL:6965528 introduced the `RenderDocument` feature, which
    fundamentally changed the navigation framework. With
    `RenderDocument`, every cross-document navigation—including
    reloads creates a new Page (along with a new LocalFrame,
    RenderFrame, WebView, etc.) upon committing navigation. This
    invalidated our previous architecture and introduced race conditions
    during reloads due to deletion of `Page` and associated resources.

    This CL re-architects SVG caching to eliminate the dependency on
    `Page` for resource scheduling. Since `Page` previously acted as the
    provider of `AgentGroupScheduler` to `SVGDocumentResource`, we now
    introduce a dedicated registry to maintain this relationship
    directly.

    Key changes in this CL:

    1) Introduce SVGResourceSchedulerRegistry
    2) Redirect all call sites where `Page` currently provides
    `AgentGroupScheduler`.
    3) Cleanup of `SVGDocumentResourceTracker` is now the responsibility
    of `SVGResourceSchedulerRegistry`.
    4) Tests are updated to use `SVGResourceSchedulerRegistry`.

    Design doc: https://docs.google.com/document/d/1BF027AlGjIocPblyxi-KGaG15YvBPCNUOW81P9BWSpE/edit?usp=sharing
    Bug: 360599258, 459746761
    Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
    Reviewed-by: Fredrik Söderquist <f...@opera.com>
    Commit-Queue: Divyansh Mangal <dma...@microsoft.com>
    Cr-Commit-Position: refs/heads/main@{#1584477}
    Files:
    • M third_party/blink/renderer/core/page/page.cc
    • M third_party/blink/renderer/core/svg/build.gni
    • M third_party/blink/renderer/core/svg/svg_document_resource_tracker.cc
    • M third_party/blink/renderer/core/svg/svg_document_resource_tracker.h
    • A third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.cc
    • A third_party/blink/renderer/core/svg/svg_resource_scheduler_registry.h
    • M third_party/blink/renderer/platform/runtime_enabled_features.json5
    Change size: M
    Delta: 7 files changed, 141 insertions(+), 13 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Fredrik Söderquist
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I96093a7d3a415eafaff25344850dabca746ce0c4
    Gerrit-Change-Number: 7239586
    Gerrit-PatchSet: 33
    Gerrit-Owner: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Divyansh Mangal <dma...@microsoft.com>
    Gerrit-Reviewer: Fredrik Söderquist <f...@opera.com>
    Gerrit-Reviewer: Vinay Singh <vinay...@microsoft.com>
    Gerrit-Reviewer: Virali Purbey <virali...@microsoft.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages