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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.cpp

Issue 2513413008: [ImageResource 0a] Do not notify ResourceClient/ImageResourceObserver of finish twice (Closed)
Patch Set: Rebase Created 4 years 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 349
350 void Resource::setLoader(ResourceLoader* loader) { 350 void Resource::setLoader(ResourceLoader* loader) {
351 CHECK(!m_loader); 351 CHECK(!m_loader);
352 DCHECK(stillNeedsLoad()); 352 DCHECK(stillNeedsLoad());
353 m_loader = loader; 353 m_loader = loader;
354 m_status = Pending; 354 m_status = Pending;
355 } 355 }
356 356
357 void Resource::checkNotify() { 357 void Resource::checkNotify() {
358 notifyClientsInternal(MarkFinishedOption::ShouldMarkFinished);
359 }
360
361 void Resource::notifyClientsInternal(MarkFinishedOption markFinishedOption) {
362 if (isLoading()) 358 if (isLoading())
363 return; 359 return;
364 360
365 ResourceClientWalker<ResourceClient> w(m_clients); 361 ResourceClientWalker<ResourceClient> w(m_clients);
366 while (ResourceClient* c = w.next()) { 362 while (ResourceClient* c = w.next()) {
367 if (markFinishedOption == MarkFinishedOption::ShouldMarkFinished) 363 markClientFinished(c);
368 markClientFinished(c);
369 c->notifyFinished(this); 364 c->notifyFinished(this);
370 } 365 }
371 } 366 }
372 367
373 void Resource::markClientFinished(ResourceClient* client) { 368 void Resource::markClientFinished(ResourceClient* client) {
374 if (m_clients.contains(client)) { 369 if (m_clients.contains(client)) {
375 m_finishedClients.add(client); 370 m_finishedClients.add(client);
376 m_clients.remove(client); 371 m_clients.remove(client);
377 } 372 }
378 } 373 }
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 case Resource::TextTrack: 1099 case Resource::TextTrack:
1105 case Resource::Media: 1100 case Resource::Media:
1106 case Resource::Manifest: 1101 case Resource::Manifest:
1107 return false; 1102 return false;
1108 } 1103 }
1109 NOTREACHED(); 1104 NOTREACHED();
1110 return false; 1105 return false;
1111 } 1106 }
1112 1107
1113 } // namespace blink 1108 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698