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

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 0dae78e07f2abdc91d4f179feb783582253255d3..4eb3f1c85c45a88f78e625be046a968ddedee7cb 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);
}
}
@@ -700,10 +698,9 @@ 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().
+ checkNotify();
if (loader())
loader()->didFinishLoadingFirstPartInMultipart();
}
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698