Skip to content
Snippets Groups Projects
Commit d02c0766 authored by François Doray's avatar François Doray Committed by Chromium LUCI CQ
Browse files

[m131] [blink] Only create a DocumentResourceCoordinator for an active Document.

DocumentResourceCoordinator is cleared in Document::Shutdown and
shouldn't be recreated afterwards.

Today, a MediaStreamTrackImpl creates a SchedulingAffectingFeatureHandle
when it becomes "ready", which notifies the Document's
DocumentResourceCoordinator that WebRTC is in use. This handle may be
deleted in the destructor of MediaStreamTrackImpl, which may run after
the Document is detached. This recreates a DocumentResourceCoordinator
and notifies it that WebRTC is no longer in use. This triggers a
CHECK failure, because that DocumentResourceCoordinator was never
notified that WebRTC was in use. Not recreating the
DocumentResourceCoordinator when the Document is detached resolves the
issue.

MediaStreamTrackImpl should probably always delete its
SchedulingAffectingFeatureHandle before its destructor runs, as
it is perilous for a garabage-collected object to do work in its
destructor, but that will be addressed in a separate CL. This CL is
kept as simple as possible to make a merge possible.

(cherry picked from commit 23008251)

Bug: 375923380
Change-Id: I14d7c49f44ad25a877f3b9fc90214990b82b98ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5979265


Commit-Queue: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1377606}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5994550
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Prudhvikumar Bommana <pbommana@google.com>
Commit-Queue: Prudhvikumar Bommana <pbommana@google.com>
Cr-Commit-Position: refs/branch-heads/6778@{#1733}
Cr-Branched-From: b21671ca-refs/heads/main@{#1368529}
parent bf181576
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment