Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2513413008: [ImageResource 0a] Do not notify ResourceClient/ImageResourceObserver of finish twice (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index b8e64992ef5c27b8b57bdf11fc69c58d37fd5df9..fec9f76f5ad0bb2540c6952b63376dd83d9afd5e 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -152,19 +152,17 @@ void ImageResource::checkNotify() {
if (m_isSchedulingReload || shouldReloadBrokenPlaceholder())
return;
- notifyObserversInternal(MarkFinishedOption::ShouldMarkFinished);
+ notifyObserversInternal();
Resource::checkNotify();
}
-void ImageResource::notifyObserversInternal(
- MarkFinishedOption markFinishedOption) {
+void ImageResource::notifyObserversInternal() {
if (isLoading())
return;
for (auto* observer : m_observers.asVector()) {
if (m_observers.contains(observer)) {
- if (markFinishedOption == MarkFinishedOption::ShouldMarkFinished)
- markObserverFinished(observer);
+ markObserverFinished(observer);
observer->imageNotifyFinished(this);
}
}
@@ -698,10 +696,10 @@ void ImageResource::onePartInMultipartReceived(
// Notify finished when the first part ends.
if (!errorOccurred())
setStatus(Cached);
- // We will also notify clients/observers of the finish in
- // Resource::finish()/error() so we don't mark them finished here.
- notifyObserversInternal(MarkFinishedOption::DoNotMarkFinished);
- notifyClientsInternal(MarkFinishedOption::DoNotMarkFinished);
+ // We notify clients/observers of finish here, and they will not be
+ // notified again in Resource::finish()/error().
+ notifyObserversInternal();
+ notifyClientsInternal();
if (loader())
loader()->didFinishLoadingFirstPartInMultipart();
}

Powered by Google App Engine
This is Rietveld 408576698