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

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

Issue 2045883002: Clean up markClientsAndObserversFinished(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix sign mismatch comparison Created 4 years, 6 months 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 | « no previous file | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | 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 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ImageResourceObserverWalker walker(m_observers); 99 ImageResourceObserverWalker walker(m_observers);
100 while (auto* observer = walker.next()) { 100 while (auto* observer = walker.next()) {
101 observer->imageNotifyFinished(this); 101 observer->imageNotifyFinished(this);
102 } 102 }
103 103
104 Resource::checkNotify(); 104 Resource::checkNotify();
105 } 105 }
106 106
107 void ImageResource::markClientsAndObserversFinished() 107 void ImageResource::markClientsAndObserversFinished()
108 { 108 {
109 while (!m_observers.isEmpty()) { 109 HashCountedSet<ImageResourceObserver*> observers;
110 HashCountedSet<ImageResourceObserver*>::iterator it = m_observers.begin( ); 110 m_observers.swap(observers);
111 for (int i = it->value; i; i--) { 111 for (const auto& it : observers)
112 m_finishedObservers.add(it->key); 112 m_finishedObservers.add(it.key, it.value);
113 m_observers.remove(it);
114 }
115 }
116 113
117 Resource::markClientsAndObserversFinished(); 114 Resource::markClientsAndObserversFinished();
118 } 115 }
119 116
120 void ImageResource::addObserver(ImageResourceObserver* observer) 117 void ImageResource::addObserver(ImageResourceObserver* observer)
121 { 118 {
122 willAddClientOrObserver(); 119 willAddClientOrObserver();
123 120
124 m_observers.add(observer); 121 m_observers.add(observer);
125 122
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 if (response().wasFetchedViaServiceWorker()) 549 if (response().wasFetchedViaServiceWorker())
553 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 550 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
554 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 551 if (!getImage()->currentFrameHasSingleSecurityOrigin())
555 return false; 552 return false;
556 if (passesAccessControlCheck(securityOrigin)) 553 if (passesAccessControlCheck(securityOrigin))
557 return true; 554 return true;
558 return !securityOrigin->taintsCanvas(response().url()); 555 return !securityOrigin->taintsCanvas(response().url());
559 } 556 }
560 557
561 } // namespace blink 558 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/Resource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698