Commit 29c36f00 authored by sigbjornf's avatar sigbjornf Committed by Commit bot

Speculatively handle weak member clearing while creating iteration vector.

CSSFontSelector keeps a set of weakly referenced clients; when notifying
those the set is copied into a temporary heap vector before iterating.

Allocating that vector might potentially cause a GC, which in turn
could cause some of the weak references to be cleared. With the outcome
that the temporary vector will contain empty tail elements.

Speculatively check&handle that eventuality when iterating.

R=haraken
BUG=568173

Review URL: https://codereview.chromium.org/1642913002

Cr-Commit-Position: refs/heads/master@{#372112}
parent 6f4d9bc5
...@@ -83,8 +83,12 @@ void CSSFontSelector::dispatchInvalidationCallbacks() ...@@ -83,8 +83,12 @@ void CSSFontSelector::dispatchInvalidationCallbacks()
WillBeHeapVector<RawPtrWillBeMember<CSSFontSelectorClient>> clients; WillBeHeapVector<RawPtrWillBeMember<CSSFontSelectorClient>> clients;
copyToVector(m_clients, clients); copyToVector(m_clients, clients);
for (size_t i = 0; i < clients.size(); ++i) // TODO(sof): the null check is temporarily in place to speculatively address
clients[i]->fontsNeedUpdate(this); // crbug.com/568173.
for (auto& client : clients) {
if (client)
client->fontsNeedUpdate(this);
}
} }
void CSSFontSelector::fontFaceInvalidated() void CSSFontSelector::fontFaceInvalidated()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment