|
1 /* |
|
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
|
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
|
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
|
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
|
6 |
|
7 This library is free software; you can redistribute it and/or |
|
8 modify it under the terms of the GNU Library General Public |
|
9 License as published by the Free Software Foundation; either |
|
10 version 2 of the License, or (at your option) any later version. |
|
11 |
|
12 This library is distributed in the hope that it will be useful, |
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 Library General Public License for more details. |
|
16 |
|
17 You should have received a copy of the GNU Library General Public License |
|
18 along with this library; see the file COPYING.LIB. If not, write to |
|
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
20 Boston, MA 02110-1301, USA. |
|
21 |
|
22 This class provides all functionality needed for loading images, style sheets and html |
|
23 pages from the web. It has a memory cache for these objects. |
|
24 */ |
|
25 |
|
26 #include "config.h" |
|
27 #include "CachedResourceClientWalker.h" |
|
28 |
|
29 namespace WebCore { |
|
30 |
|
31 CachedResourceClientWalker::CachedResourceClientWalker(const HashCountedSet<CachedResourceClient*>& set) |
|
32 : m_clientSet(set), m_clientVector(set.size()), m_index(0) |
|
33 { |
|
34 typedef HashCountedSet<CachedResourceClient*>::const_iterator Iterator; |
|
35 Iterator end = set.end(); |
|
36 size_t clientIndex = 0; |
|
37 for (Iterator current = set.begin(); current != end; ++current) |
|
38 m_clientVector[clientIndex++] = current->first; |
|
39 } |
|
40 |
|
41 CachedResourceClient* CachedResourceClientWalker::next() |
|
42 { |
|
43 size_t size = m_clientVector.size(); |
|
44 while (m_index < size) { |
|
45 CachedResourceClient* next = m_clientVector[m_index++]; |
|
46 if (m_clientSet.contains(next)) |
|
47 return next; |
|
48 } |
|
49 |
|
50 return 0; |
|
51 } |
|
52 |
|
53 } |