Commit ab4979f9 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by Chromium LUCI CQ

Return early on !document_ in ImageNotifyFinished

If document_ is not set, StyleFetchedImage::ImageNotifyFinished() is a
no-op, so we can return early.

Change-Id: Id967ab46ef583185df42132c972b956c16f853a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2643406
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845849}
parent c7aad97d
...@@ -136,18 +136,18 @@ void StyleFetchedImage::RemoveClient(ImageResourceObserver* observer) { ...@@ -136,18 +136,18 @@ void StyleFetchedImage::RemoveClient(ImageResourceObserver* observer) {
} }
void StyleFetchedImage::ImageNotifyFinished(ImageResourceContent*) { void StyleFetchedImage::ImageNotifyFinished(ImageResourceContent*) {
if (!document_)
return;
if (image_ && image_->HasImage()) { if (image_ && image_->HasImage()) {
Image& image = *image_->GetImage(); Image& image = *image_->GetImage();
auto* svg_image = DynamicTo<SVGImage>(image); if (auto* svg_image = DynamicTo<SVGImage>(image))
if (document_ && svg_image)
svg_image->UpdateUseCounters(*document_); svg_image->UpdateUseCounters(*document_);
} }
if (document_) { if (LocalDOMWindow* window = document_->domWindow())
if (LocalDOMWindow* window = document_->domWindow()) ImageElementTiming::From(*window).NotifyBackgroundImageFinished(this);
ImageElementTiming::From(*window).NotifyBackgroundImageFinished(this);
}
// Oilpan: do not prolong the Document's lifetime. // Oilpan: do not prolong the Document's lifetime.
document_.Clear(); document_.Clear();
......
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