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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.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
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 rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy) 388 void Resource::setDataBufferingPolicy(DataBufferingPolicy dataBufferingPolicy)
389 { 389 {
390 m_options.dataBufferingPolicy = dataBufferingPolicy; 390 m_options.dataBufferingPolicy = dataBufferingPolicy;
391 m_data.clear(); 391 m_data.clear();
392 setEncodedSize(0); 392 setEncodedSize(0);
393 } 393 }
394 394
395 void Resource::markClientsAndObserversFinished() 395 void Resource::markClientsAndObserversFinished()
396 { 396 {
397 while (!m_clients.isEmpty()) { 397 HashCountedSet<ResourceClient*> clients;
398 HashCountedSet<ResourceClient*>::iterator it = m_clients.begin(); 398 m_clients.swap(clients);
399 for (int i = it->value; i; i--) { 399 for (const auto& it : clients)
400 m_finishedClients.add(it->key); 400 m_finishedClients.add(it.key, it.value);
401 m_clients.remove(it);
402 }
403 }
404 } 401 }
405 402
406 void Resource::error(const ResourceError& error) 403 void Resource::error(const ResourceError& error)
407 { 404 {
408 ASSERT(!error.isNull()); 405 ASSERT(!error.isNull());
409 m_error = error; 406 m_error = error;
410 m_isRevalidating = false; 407 m_isRevalidating = false;
411 408
412 if (m_error.isCancellation() || !isPreloaded()) 409 if (m_error.isCancellation() || !isPreloaded())
413 memoryCache()->remove(this); 410 memoryCache()->remove(this);
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 case Resource::Media: 1142 case Resource::Media:
1146 return "Media"; 1143 return "Media";
1147 case Resource::Manifest: 1144 case Resource::Manifest:
1148 return "Manifest"; 1145 return "Manifest";
1149 } 1146 }
1150 ASSERT_NOT_REACHED(); 1147 ASSERT_NOT_REACHED();
1151 return "Unknown"; 1148 return "Unknown";
1152 } 1149 }
1153 1150
1154 } // namespace blink 1151 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.cpp ('k') | third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698